Results 1 to 1 of 1

Thread: QTreeWidget + Persistent Editor problem

  1. #1

    Default QTreeWidget + 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:
    Qt Code:
    1. class tempEdit2 : public QItemDelegate
    2. {
    3. QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem & option, const QModelIndex &index) const
    4. {
    5. return new QToolButton(parent);
    6. };
    7.  
    8. };
    9.  
    10. int main(int argc, char** argv) {
    11.  
    12. QApplication app(argc,argv);
    13.  
    14. QTreeWidget* mWidget = new QTreeWidget( qApp->mainWidget() );
    15.  
    16. mWidget->setColumnCount(4);
    17. mWidget->setItemDelegate( new tempEdit2 );
    18.  
    19. mWidget->header()->moveSection( 0, 2 ); // this screws up the layout.
    20. mWidget->show();
    21.  
    22. QTreeWidgetItem* item = new QTreeWidgetItem( mWidget, QTreeWidgetItem::Type );
    23. mWidget->openPersistentEditor(item,1);
    24. mWidget->openPersistentEditor(item,2);
    25.  
    26. w.show();
    27. app.exec();
    28. }
    To copy to clipboard, switch view to plain text mode 
    Attached Images Attached Images

Similar Threads

  1. Help using the QTreeWidget persistent editor.
    By Billy Lee Black in forum Qt Programming
    Replies: 13
    Last Post: 18th July 2007, 20:59
  2. resizing a QTreeWidget
    By drhex in forum Qt Programming
    Replies: 6
    Last Post: 27th October 2006, 23:32

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.