Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8365749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T12:44:04+00:00 2026-06-09T12:44:04+00:00

Using a QComboBox with pyside, I know how to connect the signal and use

  • 0

Using a QComboBox with pyside, I know how to connect the signal and use the index that it sends. But what about the unicode argument? If I’d prefer to connect to something that wants the string from the combobox, is that possible?

From:
http://www.pyside.org/docs/pyside/PySide/QtGui/QComboBox.html#PySide.QtGui.QComboBox

All three signals exist in two versions, one with a PySide.QtCore.QString argument and one with an int argument.

Signals

def activated (arg__1)
def activated (index)

PySide.QtGui.QComboBox.activated(index)
Parameters: index – PySide.QtCore.int

PySide.QtGui.QComboBox.activated(arg_1)
Parameters: arg
_1 – unicode

Edit: some code.

le = ComboBoxIpPrefix()
le.currentIndexChanged.connect(lambda x....)

This code gives me the index. The question was how to get the unicode string mentioned in the docs.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T12:44:06+00:00Added an answer on June 9, 2026 at 12:44 pm

    I don’t understand what exactly your question is.

    There are two versions of QComboBox.activated signal. One gives you the index of the selected item, the other one gives you its text.

    To choose between them in PySide you do the following:

    a_combo_box.activated[int].connect(some_callable)
    
    a_combo_box.activated[str].connect(other_callable)
    

    The second line probably won’t work this way in Python 2, so substitute str with unicode.

    Note that I use general (C++) Qt documentation, because PySide documentation is still quite ambigous: I kept seeing those arg__1s everywhere…
    “Translating” to Python shouldn’t be too hard. Just keep in mind that QString becomes str (or unicode in Python 2; by the way, I like having my code work on all versions of Python, so I usually make an alias type text that is str in Py3 and unicode in Py2); long, short, etc. become int; double becomes float; QVariant is completely avoided, it just means that any data type can be passed there; and so on…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using PyQt4 , but this is general enough that it could just
I'm using winforms and I've got a comboBox that represents an IQueryable. Below the
I have a combobox that is bound to an enum using the following code:
I'm initialize my ComboBox using DataSource. After that when I'm trying to remove item
we can easily get index of combobox using FindString method int index = cboCountryTwoCode.FindString(localJob.DeliveryCountryTwoCode.Trim());
Is it possible to create multilevel combobox using ExtJS 4.0? I mean, that it
I'm trying to connect a qcombobox with a qwtslider, and I have two options
I'm working on building a List using Combobox that when a Client is selected
I've implemented a ComboBox using NetBeans that has a list of values, I want
I've been using MVVM (or my own flavour thereof) for some time now, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.