Results 1 to 2 of 2

Thread: QTableWidget & cellWidget : some pointers

  1. #1
    Join Date
    Sep 2009
    Posts
    49
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QTableWidget & cellWidget : some pointers

    I am creating a QTableWidget and in each sell I am setting up a custom widget:
    Qt Code:
    1. for row in range(4):
    2. self.qTableWidget.setCellWidget(row, 0, QtGui.QDoubleSpinBox())
    To copy to clipboard, switch view to plain text mode 

    This works fine. How ever when I change the value of spinBox, none of the signals
    (cell*.* or item*.*) of QTableWidget is emitting. I would prefer this technique compare of another ones.

    Another way to solve this problem is to use "setItemDelegate" method and using spinBox
    as a delegate. What I don't like here is that when you click in a cell, your widget
    will become visible and as soon as cell lost it's focus, delegate widgets become invisible.

    Is there a any way I keep the the widget visible all the time and delegate technique?
    Prashant


    qt-sdk-win-opensource-2009.03.1.exe
    Python 2.6.3
    PyQt-Py2.6-gpl-4.6-1
    Win XP, 32 Bit

  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: QTableWidget & cellWidget : some pointers

    Quote Originally Posted by prashant View Post
    This works fine. How ever when I change the value of spinBox, none of the signals
    (cell*.* or item*.*) of QTableWidget is emitting.
    That's because those widgets are not related to the model in any way.

    Another way to solve this problem is to use "setItemDelegate" method and using spinBox
    as a delegate. What I don't like here is that when you click in a cell, your widget
    will become visible and as soon as cell lost it's focus, delegate widgets become invisible.

    Is there a any way I keep the the widget visible all the time and delegate technique?
    You can render the looks of spinbox into the cell using QStyle API.
    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.


Similar Threads

  1. Replies: 7
    Last Post: 18th September 2009, 10:59
  2. Crash in QTableWidget
    By ghorwin in forum Qt Programming
    Replies: 3
    Last Post: 29th October 2007, 16:57
  3. QComboBox in QTableWidget : display troubles.
    By Nyphel in forum Qt Programming
    Replies: 2
    Last Post: 13th October 2007, 23:29
  4. QTableWidget editing question
    By Trasmeister in forum Qt Programming
    Replies: 1
    Last Post: 20th September 2006, 18:46
  5. Replies: 6
    Last Post: 5th March 2006, 21:05

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.