Results 1 to 4 of 4

Thread: Problem in SubClassing QTableItem.

  1. #1
    Join Date
    Jan 2006
    Location
    India
    Posts
    54
    Thanks
    1
    Thanked 7 Times in 6 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Problem in SubClassing QTableItem.

    I have created QRadioButton type QTableItem, by subclassing QTableItem.
    In createEditor function of QTableItem, I connected widget’s(QRadioButton's) clicked() signal with table’s custom slot reEmitClicked().
    In reEmitClicked(), I emit my own custom and overloaded signal clicked(currentRow(), currentCol()).

    But when I get the value of currentRow() and currentCol(), it does not match with cell’s row and column, where I clicked.

    What is the problem with it?

    Am I using the right approach?

  2. #2
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem in SubClassing QTableItem.

    jpn describes the approach you should take in this thread.

  3. #3
    Join Date
    Jan 2006
    Location
    India
    Posts
    54
    Thanks
    1
    Thanked 7 Times in 6 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: Problem in SubClassing QTableItem.

    Ya, I have Implemented this approach, but what i want when I create a radio button by subclassing the QTableItem. The functions like currentrow() and currentColumn() does not work properly.

    And I think I cant implement custom signal and slot in a subclass of QTableItem because it is inherited from Qt.

    Then waht should I do?

  4. #4
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem in SubClassing QTableItem.

    Yes, you are right you cannot create signals and slots for QTableItem. Also, your currentRow and currentColumn will not give you right answers because the radio button is focused and not the cell.

    I think you should
    - subclass QRadioButton and add properties for row and column.
    - access the row and column of the focused radio button to get the row and column.

Similar Threads

  1. Weird problem: multithread QT app kills my linux
    By Ishark in forum Qt Programming
    Replies: 2
    Last Post: 8th August 2008, 09:12
  2. Steps in solving a programming problem?
    By triperzonak in forum General Programming
    Replies: 8
    Last Post: 5th August 2008, 08:47
  3. problem of subclass QTableItem
    By hesummar in forum Qt Programming
    Replies: 1
    Last Post: 4th November 2006, 09:41
  4. Problem with QTreeWidget after subclassing
    By steve918 in forum Qt Programming
    Replies: 2
    Last Post: 28th July 2006, 18:51
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

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.