Results 1 to 4 of 4

Thread: How can we edit the QListWidgets items and send the values back?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2016
    Posts
    22
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Post Re: How can we edit the QListWidgets items and send the values back?

    Thank you for your reply... I tried with qlistwidgetitem but then I was unable to get the data..


    if (retVal == SOAP_OK) {
    // loop over all configurationKeys

    QListWidget *list1 = w.findChild<QListWidget *>("keyWidget");
    //QListWidget *list2 = w.findChild<QListWidget *>("valueWidget");
    QListWidgetItem *list2 = new QListWidgetItem("valueWidget");


    list2->setFlags(list2->flags()|Qt :: ItemIsEditable);

    std::vector<cp__KeyValue *>::iterator it;
    for (it = getConfResponse->configurationKey.begin(); it != getConfResponse->configurationKey.end(); ++it) {

    //std::cout << "key is" << (*it)->key;


    list1->addItem(QString::fromStdString((*it)->key));
    //list2->addItem(QString::fromStdString(*(*it)->value).toStdString().c_str());


    //list2->addItem(QString::fromStdString(*(*it)->value));

    // BOOST_LOG(lg) << "Value :" << (*((*it)->value) != NULL : *((*it)->value) "not defined");
    if((*it)->value !=NULL)
    {
    BOOST_LOG(lg) << " Key :: " << (*it)->key << " Value :: " << (*(*it)->value);
    cout << " Key :: " << (*it)->key << " Value :: " << (*(*it)->value);

    //list2->addItem(QString::fromStdString(*(*it)->value));
    //list2->setText(QString::fromStdString(*(*it)->value));
    list2->setData(Qt:isplayRole, QString::fromStdString(*(*it)->value) );


    }

    else
    {

    BOOST_LOG(lg) << " Key :: " << (*it)->key << " Value :: " << (*it)->value;
    cout << " Key :: " << (*it)->key << " Value :: " << (*it)->value;
    //list2->addItem("0");

    }



    As we see in the code, when I try to use qlistwidgetitem I am getting empty message on the output

  2. #2
    Join Date
    Jan 2016
    Posts
    1
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How can we edit the QListWidgets items and send the values back?

    it means that you have read data from severs in Qt application and you saw them, however you can't send your data to server?

Similar Threads

  1. Replies: 1
    Last Post: 1st November 2014, 12:42
  2. Replies: 9
    Last Post: 10th October 2012, 22:55
  3. Bring To Front Send To Back, where's the inbetween?
    By InterFiction in forum Newbie
    Replies: 1
    Last Post: 24th November 2011, 23:54
  4. Thread started from main does send signal back.
    By edxxgardo in forum Qt Programming
    Replies: 3
    Last Post: 20th July 2011, 14:36
  5. how can i edit pixel values
    By Askar in forum Qt Programming
    Replies: 1
    Last Post: 4th March 2010, 04:09

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
  •  
Qt is a trademark of The Qt Company.