Results 1 to 3 of 3

Thread: QTableWidgetItem not enabled

  1. #1
    Join Date
    Sep 2007
    Location
    Sant'Elpidio a Mare, Italy
    Posts
    194
    Thanks
    54
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Lightbulb QTableWidgetItem not enabled

    Hi all,
    I have a QTableWidget.
    When I add QTableItemWidgetItem with the following code:
    Qt Code:
    1. int index=ui.tbwcategories->rowCount();
    2. ui.tbwcategories->insertRow(index);
    3.  
    4. itemName->setFlags(Qt::ItemIsUserCheckable);
    5. itemName->setCheckState(Qt::Unchecked);
    6. itemName->setText(query.value(1).toString());
    7. itemName->setToolTip(query.value(2).toString());
    8. ui.tbwcategories->setItem(index,1,itemName);
    9. itemId->setText(query.value(0).toString());
    10. ui.tbwcategories->setItem(index,0,itemId);
    To copy to clipboard, switch view to plain text mode 
    I see that inserted item is not enabled, like if it is setEnabled(false) or something alike... it is a right checkbox, but it is not active, not checkable.
    In documentation I didn't find anything about this, so here I am...

    I rely on you, my masters!
    Last edited by Raccoon29; 21st March 2008 at 18:48. Reason: spelling error
    --
    raccoon29

    "La mia vita finirà quando non vedrò più la gente ridere...non necessariamente alle mie battute "

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QTableWidgetItem not enabled

    QTableWidgetItem::setFlags() takes a combination of flags, OR'ed together:
    Qt Code:
    1. itemName->setFlags(itemName->flags() | Qt::ItemIsUserCheckable);
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

  3. The following user says thank you to jpn for this useful post:

    Raccoon29 (21st March 2008)

  4. #3
    Join Date
    Sep 2007
    Location
    Sant'Elpidio a Mare, Italy
    Posts
    194
    Thanks
    54
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: QTableWidgetItem not enabled

    Quote Originally Posted by jpn View Post
    QTableWidgetItem::setFlags() takes a combination of flags, OR'ed together:
    Qt Code:
    1. itemName->setFlags(itemName->flags() | Qt::ItemIsUserCheckable);
    To copy to clipboard, switch view to plain text mode 
    Thank you so much!
    Great as always

    Sorry but I never understand these flags...
    --
    raccoon29

    "La mia vita finirà quando non vedrò più la gente ridere...non necessariamente alle mie battute "

Similar Threads

  1. Centering An Icon In A QTableWidgetItem?
    By mclark in forum Qt Programming
    Replies: 3
    Last Post: 15th November 2007, 00:11
  2. QTableWidgetItem visual format
    By uygar in forum Qt Programming
    Replies: 5
    Last Post: 6th October 2007, 18:48
  3. Replies: 1
    Last Post: 21st August 2007, 17:25
  4. QTableWidgetItem and formatting / input masks
    By Walter in forum Qt Programming
    Replies: 3
    Last Post: 27th July 2007, 14:39
  5. Interesting little Segfault w/r to signal/slot connection
    By Hydragyrum in forum Qt Programming
    Replies: 24
    Last Post: 12th September 2006, 20:22

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.