Results 1 to 3 of 3

Thread: How to show custom widget in TreeView's cell :-/

  1. #1
    Join Date
    Jul 2007
    Posts
    2
    Qt products
    Qt4

    Default How to show custom widget in TreeView's cell :-/

    Hi everyone!

    I'd like use QTableView for presenting data both numerical/text and presented as chart using my own custom widget. Partially I managed to solve my problem.

    My QTableView is one of objects of my QMainWindow class. In QMainWindows constructor I create tableView object, add model for it and my delegate class.
    Basing on SpinBox Delegate Qt's example I made my own spin box delegate which shows chart for specyfic columns. But it doesn't work exacly like in SpinBox Delegate example. When I click on specyfic cell it doesn't show my delegate. Besides I don't want to click on cell to show my delegate at all, but I thought to myself I can start like this.
    Then I added connectin between signal clicked from QTableView to window slot function, which does:
    tableView->openPersistentEditor (index);

    I thought it solves problem with hiding delegates when I click somewhere else on TreeView. Unfortunatelly it doesn't. :-(
    Besieds I still don't know how to force TableView to show my delegate class objectes (and connected with them my custom widgets) automaticly in specyfic columns (usually first from right, but It can be even 10 columns from right).

    Thanks for reading my problem. I appreciate any sugestions.
    Best regards!
    Wolf

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How to show custom widget in TreeView's cell :-/

    • When would you like a custom editor to be shown?
    • When would you like it to be closed?
    • In what way does it work differently than spinbox delegate?
    • Actually the delegate itself is nothing visible, but it does render items and provide editors.
    • Could we see the delegate code?
    J-P Nurmi

  3. #3
    Join Date
    Jul 2007
    Posts
    2
    Qt products
    Qt4

    Default Re: How to show custom widget in TreeView's cell :-/

    All right...
    Problem solved... Don't use a gun, where fly swatter is good enough.
    There is QAbstractItemView::setIndexWidget (QModelIndex&, QWidget*) function and that's all folks. I was looking for in wrong direction :-\

    But thanks anyway

Similar Threads

  1. Replies: 1
    Last Post: 5th November 2006, 23:50
  2. Problem applying setWindowOpacity to a custom Widget
    By yellowmat in forum Qt Programming
    Replies: 8
    Last Post: 1st November 2006, 10:05
  3. Replies: 5
    Last Post: 16th May 2006, 20:38
  4. Replies: 4
    Last Post: 24th March 2006, 22:50
  5. Replies: 12
    Last Post: 15th February 2006, 10:46

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.