Results 1 to 20 of 21

Thread: How does the QItemDelegate work?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2008
    Posts
    57
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default How does the QItemDelegate work?

    Hello,

    I have followed the example of creating a spinboxdelegate in a QTableWidget.
    http://doc.trolltech.com/4.3/itemvie...xdelegate.html

    I have subclassed the QTableWidget in order to specify the return as hotkey for both open(F2) and close(return) the spinbox delegate. To do that I have overrided the keyPressEvent. This is the example code of the KeyPressEvent:

    Qt Code:
    1. void MyTableWidget::keyPressEvent(QKeyEvent *e)
    2. {
    3.  
    4.  
    5. if(e->key() == Qt::Key_Return)
    6. {
    7.  
    8. n = new QKeyEvent(e->type(), Qt::Key_F2, e->modifiers(), e->text(), e->isAutoRepeat(), e->count());
    9.  
    10. }
    11. else
    12. {
    13.  
    14. n = e;
    15.  
    16. }
    17.  
    18. QTableWidget::keyPressEvent(n);
    19.  
    20. }
    To copy to clipboard, switch view to plain text mode 
    I use:
    tableWidget->setItemDelegateForColumn(1, new SpinBoxDelegate);

    instead of the example codes:
    SpinBoxDelegate delegate;
    tableView.setItemDelegate(&delegate);

    When I crosscompile & and transfer the example code to an embedded system (Arm9, QTopia 4.3) the spinbox delegate and its methods createEditor and setEditorData is never called when the cell is opened for editing?

    I really need this to work. I have no idea why the spinbox delegate does not work on the embedded system? If you need further info to be able to help I will provide it for you.

    Thank you in advance...
    Last edited by jpn; 2nd March 2008 at 09:28. Reason: missing [code] tags

Similar Threads

  1. QItemDelegate Editor Crash
    By mclark in forum Qt Programming
    Replies: 13
    Last Post: 22nd March 2018, 04:06
  2. premature call to setmodeldata with QItemDelegate
    By placebo in forum Qt Programming
    Replies: 1
    Last Post: 25th November 2007, 17:39
  3. QActions don't work with menubar hidden
    By Pepe in forum Qt Programming
    Replies: 1
    Last Post: 16th August 2007, 01:04
  4. Change work area OS
    By pakulo in forum Qt Programming
    Replies: 15
    Last Post: 15th May 2007, 07:20
  5. QTextEdit Justify align making work
    By dec0ding in forum Qt Programming
    Replies: 2
    Last Post: 13th January 2006, 12:02

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.