Results 1 to 3 of 3

Thread: QTreeWidgetItem and checkbox detection

  1. #1
    Join Date
    Sep 2006
    Posts
    46
    Thanks
    2
    Thanked 3 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QTreeWidgetItem and checkbox detection

    I could not find any reference to this in Trolltechs task tracker and I am not sure if it is a bug or something I am missing.

    If you have 2 columns in a QTreeWidget and rearrange them the check box hit location dramatically changes for the QTreeWidgetItem. This happens if you force the column change in code or do it at run time. With a populated tree the check location becomes the reference lines under the item expansion box.

    Minimal code example: (4.4.1 openSource/Linux)
    Qt Code:
    1. #include <QtGui>
    2. #include <QApplication>
    3. #include <QMainWindow>
    4. #include <QTreeWidget>
    5. #include <QTreeWidgetItem>
    6.  
    7. int main(int argc, char *argv[]) {
    8.  
    9. QApplication app(argc, argv);
    10.  
    11. QTreeWidget *treeWidget = new QTreeWidget();
    12. treeWidget->setHeaderLabels(QStringList() << "column 0" << "column 1");
    13. treeWidget->header()->moveSection(1,0);
    14.  
    15. QTreeWidgetItem *item = new QTreeWidgetItem(treeWidget);
    16. item->setCheckState(0,Qt::Unchecked);
    17. item->setText(0,"<-- My ability to check/uncheck is very far off from the actuall check box");
    18.  
    19. QMainWindow *mainWindow = new QMainWindow();
    20. mainWindow->setCentralWidget(treeWidget);
    21. mainWindow->show();
    22.  
    23. return app.exec();
    24. }
    To copy to clipboard, switch view to plain text mode 

    Anyone have any insight?

  2. #2
    Join Date
    May 2008
    Posts
    155
    Thanked 15 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QTreeWidgetItem and checkbox detection

    This pretty much looks like a bug. Maybe check with 4.4.1 before submitting a bug report to the Trolls...

  3. #3
    Join Date
    Sep 2006
    Posts
    46
    Thanks
    2
    Thanked 3 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTreeWidgetItem and checkbox detection

    Minimal code example: (4.4.1 openSource/Linux)
    This was checked with 4.4.1 open source on Linux. I am currently compiling 4.4.1 open source on a Windows machine and will attempt to verify the same behavior.

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.