Results 1 to 2 of 2

Thread: QTableWidget item checkable and combo?

  1. #1
    Join Date
    Mar 2006
    Posts
    47
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11

    Default QTableWidget item checkable and combo?

    Hi,
    Earlier i worked on QT3 and now working on QT4.I Placed QTableWidget on a form using QT Designer and Which have three column , I wants to take first column
    (1) as Qcheckable item and
    (2) second one as combo item.
    How this can be achieved QTableWidgetItem using QT4. Please give me some example code.

    In qt3 QChecktable item is inserted in QTable using
    QCheckTableItem *item=new QCheckTableItem( table, "Nikon" );

    and Qcombo item is inserted in QTable using
    table->setItem( j, 3, new QComboTableItem ( table, KBMB, FALSE ) );


    How this will be done in QT4 QTableWidget.

    Thanks and Regards

  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: QTableWidget item checkable and combo?

    Checkable items:
    QTableWidgetItem::setFlags() and pass Qt::ItemIsUserCheckable amongst the others wanted flags. Initialize the check state with QTableWidgetItem::setCheckState().

    Combo:
    You'll get a combo out of the box If you set the data as a boolean value. That would be something like QTableWidgetItem::setData(Qt::EditRole, true/false). If you need more options than just true/false, you can always set a QComboBox as a cell widget by QTableWidget::setCellWidget().
    J-P Nurmi

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.