×

Discussion Board

Results 1 to 14 of 14
  1. #1
    Regular Contributor
    Join Date
    Oct 2008
    Posts
    323

    Question QListWidget with checkbox

    Dear all,

    in Qlistwidget i implemented the checkboxes with items,
    if i click the item it want to enable the checkbox,
    if checkbox already enable it want to disable the checkbod

    [i.e] i dont want to click pointedly check box icon to enable, if i click
    the item in the Qlistwidget item that item automatically enables the checkbox
    and if checkbox already enabled it want to disable?

    is it possible? any one have idea about this?
    Last edited by damodharan; 2010-05-30 at 10:47.

  2. #2
    Regular Contributor
    Join Date
    Oct 2008
    Posts
    323

    Question Re: QListWidget with checkbox

    and

    is there any possible way to put the check box at right side of the Qlistwidget

  3. #3
    Regular Contributor
    Join Date
    Oct 2008
    Posts
    323

    Question Re: QListWidget with checkbox

    any one have idea about this?

  4. #4
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Re: QListWidget with checkbox

    Quote Originally Posted by damodharan View Post
    and

    is there any possible way to put the check box at right side of the Qlistwidget
    Use Drag and Drop feature.

    Put the Checkbox at the right side..

    Best regards,

  5. #5
    Regular Contributor
    Join Date
    Oct 2008
    Posts
    323

    Question Re: QListWidget with checkbox

    Quote Originally Posted by rahulvala View Post
    Use Drag and Drop feature.

    Put the Checkbox at the right side..

    Best regards,
    Reahulvala,
    i am adding the check box

    widgetitem->setCheckState(Qt::Unchecked);

    now u understand ? its will show check box in the listwidget at leftside
    i want that in right side ?

    ok

  6. #6
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Re: QListWidget with checkbox

    Quote Originally Posted by damodharan View Post
    Reahulvala,
    i am adding the check box

    widgetitem->setCheckState(Qt::Unchecked);

    now u understand ? its will show check box in the listwidget at leftside
    i want that in right side ?

    ok

    When you connect Checkbox with list widget it will always show in the left side...

    See the below discussion :
    http://discussion.forum.nokia.com/fo...ad.php?t=85977

    Best regards,

  7. #7
    Regular Contributor
    Join Date
    Oct 2008
    Posts
    323

    Re: QListWidget with checkbox

    thx for ur reply Rahulvala

  8. #8
    Regular Contributor
    Join Date
    Oct 2008
    Posts
    323

    Question Re: QListWidget with checkbox

    Quote Originally Posted by rahulvala View Post
    When you connect Checkbox with list widget it will always show in the left side...

    See the below discussion :
    http://discussion.forum.nokia.com/fo...ad.php?t=85977

    Best regards,
    thx rahulvala,

    u have any idea about the below one?

    in Qlistwidget i implemented the check-boxes with items,
    if i click the list-widget item it want to enable the check-box,
    if check-box already enable it want to disable the check-box

    [i.e] i don't want to click check box icon to enable, if i click
    the list-widget item in the Qlistwidget that item automatically enables the check-box
    and if check-box already enabled it want to disable?

    is it possible? any one have idea about this?

  9. #9
    Super Contributor
    Join Date
    Oct 2008
    Location
    INDIA
    Posts
    2,326

    Re: QListWidget with checkbox

    Quote Originally Posted by damodharan View Post
    thx rahulvala,

    u have any idea about the below one?

    in Qlistwidget i implemented the check-boxes with items,
    if i click the list-widget item it want to enable the check-box,
    if check-box already enable it want to disable the check-box

    [i.e] i don't want to click check box icon to enable, if i click
    the list-widget item in the Qlistwidget that item automatically enables the check-box
    and if check-box already enabled it want to disable?

    is it possible? any one have idea about this?

    See this QCheckbox class reference...
    qthelp://com.trolltech.qt.460/qdoc/qcheckbox.html

    You will get every thing there about the Qcheckbox from how to disable and unable....

    Best regards,

  10. #10
    Regular Contributor
    Join Date
    Oct 2008
    Posts
    323

    Question Re: QListWidget with checkbox

    Quote Originally Posted by rahulvala View Post
    See this QCheckbox class reference...
    qthelp://com.trolltech.qt.460/qdoc/qcheckbox.html

    You will get every thing there about the Qcheckbox from how to disable and unable....

    Best regards,
    thx rahulvala for ur ans,

    i know how to enable and disable the check-box i want to know how to do that
    if i click on the list widget item ?

  11. #11
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: QListWidget with checkbox

    Quote Originally Posted by damodharan View Post
    in Qlistwidget i implemented the checkboxes with items,
    if i click the item it want to enable the checkbox,
    if checkbox already enable it want to disable the checkbod

    [i.e] i dont want to click pointedly check box icon to enable, if i click
    the item in the Qlistwidget item that item automatically enables the checkbox
    and if checkbox already enabled it want to disable?
    You should do something like this in a class derived from QListWidget:
    Code:
    in constructor:
    connect(this, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(toggleItem(QListWidgetItem*)));
    
    slot:
    void toggleItem (QListWidgetItem  *item)
    {
       if (item->checkState() == Qt::Checked)
          item->setCheckState(Qt::Unchecked);
       else
          item->setCheckState(Qt::Checked);
    }

  12. #12
    Regular Contributor
    Join Date
    Oct 2008
    Posts
    323

    Re: QListWidget with checkbox

    thx divanov ,
    thx for u r ans
    Exactly i also did the same thing.

  13. #13
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: QListWidget with checkbox

    Quote Originally Posted by damodharan View Post
    thx divanov ,
    thx for u r ans
    Exactly i also did the same thing.
    Posting solution could help other people with similar problems, save my time and will also contribute to your image.

  14. #14
    Regular Contributor
    Join Date
    Oct 2008
    Posts
    323

    Re: QListWidget with checkbox

    yeah sure ,

    below code is the solution for my thread
    i implemented on this way

    Code:
    	Qt::CheckState enablestate;
    	enablestate = ui.listWidget->currentItem()->checkState();
    			
    	if(enablestate == Qt::Checked )
    		{
    			ui.listWidget->currentItem()->setCheckState(Qt::Unchecked);
    		}
    	else
    		{
    			ui.listWidget->currentItem()->setCheckState(Qt::Checked);
    		}
    Last edited by damodharan; 2010-05-31 at 15:02.

Similar Threads

  1. QListWidget with CheckBox
    By damodharan in forum Qt
    Replies: 3
    Last Post: 2010-04-25, 09:47
  2. checkbox display incorrect in listbox
    By xuelanding in forum Symbian User Interface
    Replies: 1
    Last Post: 2010-01-29, 01:42
  3. Is there a way to add a checkbox & label together in list.
    By smanikandan14 in forum Symbian User Interface
    Replies: 8
    Last Post: 2008-10-27, 15:02
  4. Popup message w/an optional checkbox?
    By inc0gn1t007 in forum Symbian User Interface
    Replies: 5
    Last Post: 2006-06-14, 11:56

Posting Permissions

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