Results 1 to 2 of 2

Thread: Invalid conversion error while Storing into Combobox

  1. #1
    Join Date
    Feb 2012
    Posts
    24
    Thanks
    4
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Question Invalid conversion error while Storing into Combobox

    Hi I am bit new to QT programming. I am working on server proxy related module where I need to store the result into the combobox. Here goes the example:

    Qt Code:
    1. QNetworkProxyQuery npq(QUrl(QLatin1String("http://www.google.com")));
    2. QList<QNetworkProxy> listOfProxies = QNetworkProxyFactory::systemProxyForQuery(npq);
    3.  
    4. foreach ( QNetworkProxy loopItem, listOfProxies )
    5. {
    6. qDebug() << "ProxyHostName_IP: " << loopItem.hostName();
    7. qDebug()<< "Port: " << loopItem.port();
    8.  
    9. ui->comb_conf_box->addItem(loopItem.hostName()); //combo box for Host name IP
    10. ui->comb_port_box->addItem(loopItem.port()); // combo box for POrt
    11. }
    To copy to clipboard, switch view to plain text mode 

    I am able to receive Host Name IP but Port number doesnt appear. Please help!!!

    Eroor thrown is: Invalid conversion from quint16 to const char*

  2. #2
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Invalid conversion error while Storing into Combobox

    Qt Code:
    1. ui->comb_port_box->addItem( QString::number( loopItem.port() ) ); // combo box for POrt
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. X Error: BadRequest (invalid request code or no such operation) 1
    By Luc4 in forum Qt for Embedded and Mobile
    Replies: 5
    Last Post: 18th April 2011, 14:40
  2. Building static Qt. Error 126 invalid argument
    By kea_ in forum Installation and Deployment
    Replies: 2
    Last Post: 20th March 2011, 07:58
  3. Replies: 6
    Last Post: 8th April 2010, 08:04
  4. error: invalid use of void expression
    By ChineseGeek in forum Qt Programming
    Replies: 17
    Last Post: 3rd October 2009, 08:59
  5. error:invalid use of member
    By quickNitin in forum General Programming
    Replies: 4
    Last Post: 19th June 2006, 15:21

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.