Results 1 to 3 of 3

Thread: QTableWidget mouseMoveEvent

  1. #1
    Join Date
    Jan 2006
    Location
    Minnesota
    Posts
    14
    Qt products
    Qt4
    Platforms
    Windows

    Default QTableWidget mouseMoveEvent

    I have a class that is a QTableWidget, and I want to be able to select a row and raise/lower it within the table. I was going to reimplement mouseMoveEvent in combination with a keyboard key or maybe the right mouse button, but I have not been able to get any mouse move events from the method.

    i.e. this code does not produce any output. I have tried turning mouse tracking on, with no luck. Any suggestions?

    Qt Code:
    1. void MyTable::mouseMouseEvent(QMouseEvent * event)
    2. {
    3. if ( event->button() == Qt::LeftButton )
    4. {
    5. std::cout << "mouse moved" << std::endl;
    6. }
    7. QTableWidget::mouseMoveEvent(event);
    8. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Norway
    Posts
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTableWidget mouseMoveEvent

    I'm not sure but maybe you have to install the eventfilter like this:
    MyTable->installEventFilter(this);

  3. #3
    Join Date
    May 2013
    Posts
    1
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QTableWidget mouseMoveEvent

    MyTable->setMouseTracking(true);
    MyTable->viewport()->setMouseTracking(true);

Similar Threads

  1. QComboBox in QTableWidget : display troubles.
    By Nyphel in forum Qt Programming
    Replies: 2
    Last Post: 13th October 2007, 23:29
  2. Select columns from a QTableWidget
    By toglez in forum Qt Programming
    Replies: 10
    Last Post: 7th October 2007, 15:15
  3. QTableWidget issues
    By Djony in forum Qt Programming
    Replies: 42
    Last Post: 19th December 2006, 23:27
  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.