Results 1 to 4 of 4

Thread: Custom controls when QTreeWidgetItem edited.

  1. #1
    Join Date
    Sep 2009
    Posts
    7
    Thanks
    2

    Default Custom controls when QTreeWidgetItem edited.

    Hey,
    i dont have great expirience with qt. What i want to do is to change the
    control (QLineEdit) if i double click on item in qtreewidget.
    How to make this. I'm not looking for entire solution, just for
    guidlines how to "bite" it where to search, what to exatly read.

    I'd be grateful for any inforamtion in this case

    Best regards,
    Kubas

  2. #2
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Thanks
    4
    Thanked 140 Times in 132 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Custom controls when QTreeWidgetItem edited.

    take a look at Spin Box Delegate example. You can find it in Qt Examples & Demos -> Item Views, or on the web here
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

  3. #3
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Custom controls when QTreeWidgetItem edited.

    With QTreeWidget you will only need to set proper flags on the tree widget item.
    QTreeWidgetItem::setFlagsYou could use it like -
    Qt Code:
    1. pItem->setFlags(pItem->flags() | Qt::ItemIsEditable);
    To copy to clipboard, switch view to plain text mode 
    Then when you press F2 , Qt will handle the editing mode.

  4. #4
    Join Date
    Sep 2009
    Posts
    7
    Thanks
    2

    Default Re: Custom controls when QTreeWidgetItem edited.

    Thanks for help, but i got another issue,
    i followed the spinbox delegate example, and i did just as written there
    i tried to set as editor QTimeEdit, but when i double click the item
    it opens a new small window with the QTimeEdit if i close it data are
    updated in gui. I'm using qt-jambi, is it bug ? Additionally when i close my app
    i get:
    QtJambi: Exception pending in native code in file '..\cpp\com_trolltech_qt_gui\qtjambishell_QItemDel egate.cpp':476

    Is there any other way to do this ?
    I found setData methid for each item, and there i can set which control
    should be used for editing, but i cannot place there QTimeEdit, i can only
    use there QTime but it doesnt allow to set display format and its always
    HH:mm:ss and i want only HH:mm.
    Any ideas ?

    Thank you in advance
    Kubas

Similar Threads

  1. Custom QTreeWidgetItem context menu?
    By AaronMK in forum Qt Programming
    Replies: 4
    Last Post: 1st February 2010, 04:42
  2. Custom shaped forms and controls
    By AlbertGoodwill in forum Qt Programming
    Replies: 1
    Last Post: 19th October 2007, 06:35

Tags for this Thread

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.