×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Jan 2009
    Location
    ભારત->ગુજરાત->ભાવનગર
    Posts
    279

    Post unable to check checkbox in listwidget....

    Bonjure!!
    i have problem with my list widget, i am unable to check the checkbox in my listwidget . Show below is the code :

    .cpp file
    Code:
    void qtsnippet::messagesFound(const QMessageIdList &ids)
    {
    //    foreach(const QMessageId &id, ids)
    //    {
    //        QMessage message=m_manager->message(id);
    //        QString messageString = message.textContent();
    //        widget->addItem(messageString);
    
    
    
    //    }
        QMessage message;
        for(int i = 0; i < ids.count(); ++i)
        {
                        message = m_manager->message(ids.at(i));
                        QMessageAddress from = message.from();
                        QString number(from.addressee());
                        QString text;
                        text.append( number + ": " + message.find(message.bodyId()).textContent());
                        widget->insertItem(i,text);
                        //.QMessageBox::information(this,"Incoming SMS",text);
    
    
        }
        for(int i=0;i<widget->count();i++){
            widget->item(i)->setFlags(widget->item(i)->flags() | Qt::ItemIsUserCheckable);
            widget->item(i)->setCheckState(Qt::Unchecked);
        } /* Article code "checkbox in listwidget*/
    }
    As shown in code i have individually set the flag as well as checked state for all items in listwidget, but then also m unable to perform checking and uncheking operation .
    Regards
    Viral Parmar

  2. #2
    Registered User
    Join Date
    Jan 2009
    Location
    ભારત->ગુજરાત->ભાવનગર
    Posts
    279

    Cool Re: [SOLVED]unable to check checkbox in listwidget....

    well problem is solved, the code pasted by me in my previous post is correct. I was just facing problem because of small size of checkbox, i have to carefully touch to get that specific checkbox checked..
    Regards
    Viral Parmar

  3. #3
    Nokia Developer Champion
    Join Date
    Oct 2007
    Location
    જુનાગઢ - India
    Posts
    3,034

    Re: unable to check checkbox in listwidget....

    Great......
    Last edited by savaj; 2011-10-20 at 07:01. Reason: Issue is already fixed

  4. #4
    Nokia Developer Expert
    Join Date
    Feb 2008
    Posts
    183

    Re: unable to check checkbox in listwidget....

    I think I answered this before to you, but:

    "Make QListView signal clicked() or activated() to call a your own slot where you call setCheckState() for the list view. "

    I.e. define custom slot for your list/owner of the list. Then connect either of the above signals to this custom slot, where you call the setCheckState() for the given index.

    See SDK: http://doc.qt.nokia.com/latest/qabst...html#activated

  5. #5
    Registered User
    Join Date
    Jul 2010
    Posts
    36

    Re: unable to check checkbox in listwidget....

    there is any idea about how to add pushButton on each item in listWidget or other type of list

Similar Threads

  1. How to avoid Qt ListWidget from autojumping on insertion of new items
    By tormhau in forum [Archived] Beginning Qt
    Replies: 5
    Last Post: 2011-01-12, 21:40
  2. First checkBox remains checked.How to check\uncheck checkBoxes?
    By jennie in forum Symbian User Interface
    Replies: 7
    Last Post: 2007-09-12, 13:10
  3. unable to get the selected values in the checkbox
    By vasant21 in forum Symbian User Interface
    Replies: 1
    Last Post: 2006-07-15, 20:48

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •