PDA

View Full Version : QTreeWidgetItem and checkbox detection



merlvingian
24th August 2008, 02:58
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)


#include <QtGui>
#include <QApplication>
#include <QMainWindow>
#include <QTreeWidget>
#include <QTreeWidgetItem>

int main(int argc, char *argv[]) {

QApplication app(argc, argv);

QTreeWidget *treeWidget = new QTreeWidget();
treeWidget->setHeaderLabels(QStringList() << "column 0" << "column 1");
treeWidget->header()->moveSection(1,0);

QTreeWidgetItem *item = new QTreeWidgetItem(treeWidget);
item->setCheckState(0,Qt::Unchecked);
item->setText(0,"<-- My ability to check/uncheck is very far off from the actuall check box");

QMainWindow *mainWindow = new QMainWindow();
mainWindow->setCentralWidget(treeWidget);
mainWindow->show();

return app.exec();
}


Anyone have any insight?

ktk
24th August 2008, 14:10
This pretty much looks like a bug. Maybe check with 4.4.1 before submitting a bug report to the Trolls...

merlvingian
25th August 2008, 06:16
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.