Sunday, July 6th 2008, 7:04pm UTC+1

You are not logged in.

  • Login
  • Register

syee

Beginner

1

Tuesday, May 6th 2008, 5:33pm

QTreeWidget and Persistent Editor problem

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:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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 );
	mWidget->show();

	QTreeWidgetItem* item = new QTreeWidgetItem( mWidget, QTreeWidgetItem::Type );
	mWidget->openPersistentEditor(item,1);
	mWidget->openPersistentEditor(item,2);

	w.show();
	app.exec();
}
syee has attached the following file:
  • colBug.png (37.05 kB - 34 times downloaded - Last download: Jun 25th 2008, 1:43pm)
  • Go to the top of the page

Rate this thread