Hello,
I have some very simple code that places QToolButtons in some cells in a QTreeWidget. The problem is that I use a persistent editor to place QToolButtons in 2 columns, then move column 0 to column 2 (there are 4 columns in total). On a x64 release build, this results in two buttons being drawn *on top* of each other. (screencap attached)
It works fine when compiled as a 32bit application, but does not work properly with compiled as a x64 application. Strangely, my x64 debug build of the application also works as I expect.
This is using Qt 4.3.4 on a WinXp Pro x64 SP2 machine with the vs2005 compiler.
The sample code looks like this:
{
{
};
};
int main(int argc, char** argv) {
mWidget->setColumnCount(4);
mWidget->setItemDelegate( new tempEdit2 );
mWidget->header()->moveSection( 0, 2 ); // this screws up the layout.
mWidget->show();
mWidget->openPersistentEditor(item,1);
mWidget->openPersistentEditor(item,2);
w.show();
app.exec();
}
class tempEdit2 : public QItemDelegate
{
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem & option, const QModelIndex &index) const
{
return new QToolButton(parent);
};
};
int main(int argc, char** argv) {
QApplication app(argc,argv);
QMainWindow w;
QTreeWidget* mWidget = new QTreeWidget( qApp->mainWidget() );
mWidget->setColumnCount(4);
mWidget->setItemDelegate( new tempEdit2 );
mWidget->header()->moveSection( 0, 2 ); // this screws up the layout.
mWidget->show();
QTreeWidgetItem* item = new QTreeWidgetItem( mWidget, QTreeWidgetItem::Type );
mWidget->openPersistentEditor(item,1);
mWidget->openPersistentEditor(item,2);
w.show();
app.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks