Re: [PyQt] populate Qcombobox

2011-07-28 Thread Tony Peña
oh .. ok.. i solved ok my trouble.. i'm complicated too much by anything
with 2 lines i fix my problem :)

countries = cursor.execute("SELECT DISTINCT(Country) FROM
iata_icao_codes desc;")

for line in countries:
country = "%s" % line
self.ui.country_list.addItem(country)

thanxs any way for all :)

2011/7/28 Vincent Vande Vyvre 

> **
> Le 28/07/11 20:22, Tony Peña a écrit :
>
> Hi.
>
>  I have some data into DB and i want to populate that into Combobox and
> get some errors
>
> for countries in cursor.execute("SELECT Country FROM
> iata_icao_codes;"):
> self.connect(self.ui.country_list.addItem(0, str(countries)))
>
>  error:
>
>  TypeError: arguments did not match any overloaded call:
> QComboBox.addItem(QString, QVariant userData=QVariant()): argument 1 has
> unexpected type 'int'
> QComboBox.addItem(QIcon, QString, QVariant userData=QVariant()): argument 1
> has unexpected type 'int'
>
>  i Try with this form:
>
>  for countries in cursor.execute("SELECT Country FROM
> iata_icao_codes;"):
> self.connect(self.ui.country_list.insertItems(0, countries))
>
>  TypeError: arguments did not match any overloaded call:
> QObject.connect(QObject, SIGNAL(), QObject, SLOT(),
> Qt.ConnectionType=Qt.AutoConnection): argument 1 has unexpected type
> 'NoneType'
> QObject.connect(QObject, SIGNAL(), callable,
> Qt.ConnectionType=Qt.AutoConnection): argument 1 has unexpected type
> 'NoneType'
> QObject.connect(QObject, SIGNAL(), SLOT(),
> Qt.ConnectionType=Qt.AutoConnection): argument 1 has unexpected type
> 'NoneType'
>
>
>  any idea?
>
>  thanxs by the way
>
> --
> Antonio Peña
> Secure email with PGP 0x8B021001 available at http://pgp.mit.edu
>  Fingerprint: 74E6 2974 B090 366D CE71  7BB2 6476 FA09 8B02 1001
>
>
> ___
> PyQt mailing list
> PyQt@riverbankcomputing.comhttp://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
>  The return of addItem, insertItem and other is always None
>
> ...
> >>> cb = QtGui.QComboBox()
> >>> print cb.insertItem(0, "Item")
> None
> >>> print cb.addItem("Item")
> None
> >>>
>
> Why are you using 'connect' ?
>
>
>
> for countries in cursor.execute("SELECT Country FROM
> iata_icao_codes;"):
> self.ui.country_list.insertItems(0, countries)
>
> No ?
> --
> Vincent V.V.
> Oqapy  . Qarte+7.
> PaQager 
>
> ___
> PyQt mailing listPyQt@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>



-- 
Antonio Peña
Secure email with PGP 0x8B021001 available at http://pgp.mit.edu
Fingerprint: 74E6 2974 B090 366D CE71  7BB2 6476 FA09 8B02 1001
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Re: [PyQt] populate Qcombobox

2011-07-28 Thread Vincent Vande Vyvre


  
  
Le 28/07/11 20:22, Tony Peña a écrit :
Hi. 
  
  
  I have some data into DB and i want to populate that into
Combobox and get some errors
  
  
  
       for countries in cursor.execute("SELECT Country FROM
  iata_icao_codes;"):
            self.connect(self.ui.country_list.addItem(0,
  str(countries)))


error:



  TypeError: arguments did not match any overloaded call:
  QComboBox.addItem(QString, QVariant userData=QVariant()):
argument 1 has unexpected type 'int'
  QComboBox.addItem(QIcon, QString, QVariant
userData=QVariant()): argument 1 has unexpected type 'int'



i Try with this form:



  
  
       for countries in cursor.execute("SELECT Country FROM
iata_icao_codes;"):
             
self.connect(self.ui.country_list.insertItems(0, countries))




  TypeError: arguments did not match any overloaded call:
  QObject.connect(QObject, SIGNAL(), QObject, SLOT(),
Qt.ConnectionType=Qt.AutoConnection): argument 1 has
unexpected type 'NoneType'
  QObject.connect(QObject, SIGNAL(), callable,
Qt.ConnectionType=Qt.AutoConnection): argument 1 has
unexpected type 'NoneType'
  QObject.connect(QObject, SIGNAL(), SLOT(),
Qt.ConnectionType=Qt.AutoConnection): argument 1 has
unexpected type 'NoneType'





any idea?


thanxs by the way

-- 
Antonio Peña
  Secure email with PGP 0x8B021001
available at http://pgp.mit.edu
  
  Fingerprint: 74E6 2974 B090 366D CE71 
7BB2 6476 FA09 8B02 1001
  
  

___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

The return of addItem, insertItem and other is always None

...
>>> cb = QtGui.QComboBox()
>>> print cb.insertItem(0, "Item")
None
>>> print cb.addItem("Item")
None
>>>

Why are you using 'connect' ?



         for countries in cursor.execute("SELECT Country FROM
  iata_icao_codes;"):
            self.ui.country_list.insertItems(0, countries)

No ?
-- 
  Vincent V.V.
  Oqapy . Qarte+7 . PaQager
  


___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[PyQt] populate Qcombobox

2011-07-28 Thread Tony Peña
Hi.

I have some data into DB and i want to populate that into Combobox and get
some errors

   for countries in cursor.execute("SELECT Country FROM
iata_icao_codes;"):
self.connect(self.ui.country_list.addItem(0, str(countries)))

error:

TypeError: arguments did not match any overloaded call:
QComboBox.addItem(QString, QVariant userData=QVariant()): argument 1 has
unexpected type 'int'
QComboBox.addItem(QIcon, QString, QVariant userData=QVariant()): argument 1
has unexpected type 'int'

i Try with this form:

   for countries in cursor.execute("SELECT Country FROM
iata_icao_codes;"):
self.connect(self.ui.country_list.insertItems(0, countries))

TypeError: arguments did not match any overloaded call:
QObject.connect(QObject, SIGNAL(), QObject, SLOT(),
Qt.ConnectionType=Qt.AutoConnection): argument 1 has unexpected type
'NoneType'
QObject.connect(QObject, SIGNAL(), callable,
Qt.ConnectionType=Qt.AutoConnection): argument 1 has unexpected type
'NoneType'
QObject.connect(QObject, SIGNAL(), SLOT(),
Qt.ConnectionType=Qt.AutoConnection): argument 1 has unexpected type
'NoneType'


any idea?

thanxs by the way

-- 
Antonio Peña
Secure email with PGP 0x8B021001 available at http://pgp.mit.edu
 Fingerprint: 74E6 2974 B090 366D CE71  7BB2 6476 FA09 8B02 1001
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt