[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] populate Qcombobox
From:       Tony_Peña <emperor.cu () gmail ! com>
Date:       2011-07-29 0:57:19
Message-ID: CALBaCduLNegKsWVVBzMD9wLiX7C7tZV=01GLUfQwQ-k-q2pEpA () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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 <vincent.vandevyvre@swing.be>

> **
> 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 <https://launchpad.net/oqapy> . Qarte+7<https://launchpad.net/qarte+7>.
> PaQager <https://launchpad.net/paqager>
>
> _______________________________________________
> PyQt mailing list    PyQt@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

[Attachment #5 (text/html)]

oh .. ok.. i solved ok my trouble.. i&#39;m complicated too much by anything with 2 \
lines i fix my problem :)<br><br><div style="background-color: transparent;"><span>   \
countries</span> <span>=</span> \
<span>cursor</span><span>.</span><span>execute</span><span>(</span><span>&quot;SELECT \
DISTINCT(Country) FROM iata_icao_codes desc;&quot;</span><span>)</span></div>


<div style="background-color: transparent;">                </div><div \
style="background-color: transparent;">                <span>for</span> \
<span>line</span> <span>in</span> <span>countries</span><span>:</span></div> <div \
style="background-color: transparent;">                        <span>country</span> \
<span>=</span> <span>&quot;</span><span>%s</span><span>&quot;</span> <span>%</span> \
<span>line</span></div> <div style="background-color: transparent;">                  \
<span>self</span><span>.</span><span>ui</span><span>.</span><span>country_list</span>< \
span>.</span><span>addItem</span><span>(</span><span>country</span><span>)</span></div>



<br>thanxs any way for all :)<br><br><div class="gmail_quote">2011/7/28 Vincent Vande \
Vyvre <span dir="ltr">&lt;<a href="mailto:vincent.vandevyvre@swing.be" \
target="_blank">vincent.vandevyvre@swing.be</a>&gt;</span><br><blockquote \
class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, \
204, 204); padding-left: 1ex;">


<u></u>

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


<br>_______________________________________________<br>
PyQt mailing list      <a href="mailto:PyQt@riverbankcomputing.com" \
target="_blank">PyQt@riverbankcomputing.com</a><br> <a \
href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt" \
target="_blank">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br></blockquote></div><br><br \
clear="all"><br>-- <br><font color="#888888"><font color="#888888">Antonio \
Pe</font><span><font color="#888888">ñ</font></span><font \
color="#888888">a</font><span></span><br>


<font color="#888888">Secure email with PGP 0x8B021001 available at <a \
href="http://pgp.mit.edu" \
target="_blank">http://pgp.mit.edu</a><br></font></font><font color="#888888"> <font \
color="#888888">Fingerprint: 74E6 2974 B090 366D CE71   7BB2 6476 FA09 8B02 \
1001</font></font><br>



_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic