Results 1 to 4 of 4

Thread: Inserting a Custom Widget inside a QTableView Cell

  1. #1
    Join Date
    Dec 2007
    Posts
    119
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Inserting a Custom Widget inside a QTableView Cell

    Hi,
    I searched in the forum but I didn't find any good solution...I want to show in a QTableView Cell a custom widget (composed by 2 QCheckBox and 1 QSpinBox) which control/edit a specific data in my model.
    I created a custom QItemDelegate in order to show the custom widget inside the cell at editing time (there are several example exaplining how to implement this)...my next feature is showing the custom widget at not editing time, i.e. I want to permanently show the custom widget inside the cell (cell Editable/NotEditable mode) without any other action on cell in order to select/edit cell...
    Do you save some idea about this feaure implementation?

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Inserting a Custom Widget inside a QTableView Cell

    I suggest you search again, the issue has been discussed many times.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    May 2012
    Location
    India
    Posts
    51
    Thanks
    4
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Windows

    Default Re: Inserting a Custom Widget inside a QTableView Cell

    but through QItemDelegate we can only display the widget during editing the cell..
    Is there any way to display it permanently ?

  4. #4
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Inserting a Custom Widget inside a QTableView Cell

    Well, you can use QAbstractItemView::openPersistentEditor, but it can "slow down" your view if there are a lot of data.
    I would suggest to grab an editor using QPixmap::grabWidget or even better to render it using QWidget::render in the item's delegate QItemDelegate::paint method.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

Similar Threads

  1. Replies: 1
    Last Post: 7th September 2011, 18:04
  2. Custom widget won't size properly in a table cell
    By zeroknowledge in forum Qt Programming
    Replies: 1
    Last Post: 11th May 2011, 16:32
  3. Inserting label inside textEdit widget
    By dshan in forum Qt Programming
    Replies: 1
    Last Post: 11th January 2011, 11:17
  4. inserting custom Widget to listview
    By Amit_3117 in forum Qt Programming
    Replies: 20
    Last Post: 27th August 2010, 17:38
  5. How to show custom widget in TreeView's cell :-/
    By WolfMM in forum Qt Programming
    Replies: 2
    Last Post: 7th July 2007, 11:16

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.