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?
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?