Results 1 to 7 of 7

Thread: QTableView cell deactivation

  1. #1
    Join Date
    Oct 2010
    Posts
    12
    Thanks
    6
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QTableView cell deactivation

    Is there any way to be notified about cell deactivation in QTableView?

    I'm trying to enable and disable some buttons according to cell current state(activated or deactivated). I'm catching cell activation with clicked(QModelIndex) signal, but I'm wondering if there's similar technique to catch deactivated state.

  2. #2
    Join Date
    Jun 2011
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTableView cell deactivation

    QAbstractItemView::selectionModel ()
    has the signal
    void selectionChanged ( const QItemSelection & selected, const QItemSelection & deselected )

  3. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QTableView cell deactivation

    QItemSelectionModel::currentChanged() might be a better choice. This is the currently active cell rather than the selected cell(s).

  4. #4
    Join Date
    Nov 2011
    Posts
    17
    Thanks
    1
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: QTableView cell deactivation

    Hi,

    I´ve a similar problem. Is there a signal which is emitted, if all cells are deactivated? I want to disable a pushbutton if no cell is activated.

    Thanks
    Micha

  5. #5
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QTableView cell deactivation

    If by 'deactivated' you mean 'not selected' then the selectionChanged() signal tells you... selected will be empty.

  6. #6
    Join Date
    Nov 2011
    Posts
    17
    Thanks
    1
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: QTableView cell deactivation

    Yes I mean not selected. I´ll test it.

  7. #7
    Join Date
    Nov 2011
    Posts
    17
    Thanks
    1
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: QTableView cell deactivation

    Hi,

    it works perfect.

    Thanks for helping!

Similar Threads

  1. how to color a cell in a QTableView
    By JeanC in forum Qt Programming
    Replies: 13
    Last Post: 9th September 2015, 10:08
  2. Add QPushButton to cell in QTableView?
    By nikhil in forum Qt Programming
    Replies: 3
    Last Post: 14th July 2010, 09:01
  3. program self-deactivation and protection with Qt
    By timmu in forum Qt Programming
    Replies: 3
    Last Post: 21st May 2010, 18:00
  4. cell selection in QTableView
    By user in forum Qt Programming
    Replies: 3
    Last Post: 26th May 2008, 01:01
  5. How to select a cell in a QTableView
    By JeanC in forum Qt Programming
    Replies: 6
    Last Post: 6th February 2008, 13:20

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
  •  
Qt is a trademark of The Qt Company.