PDA

View Full Version : QTableWidget mouseMoveEvent



mbjerkne
24th January 2006, 19:49
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?



void MyTable::mouseMouseEvent(QMouseEvent * event)
{
if ( event->button() == Qt::LeftButton )
{
std::cout << "mouse moved" << std::endl;
}
QTableWidget::mouseMoveEvent(event);
}

chaimar
24th January 2006, 20:45
I'm not sure but maybe you have to install the eventfilter like this:

MyTable->installEventFilter(this);

drull
29th May 2013, 21:53
MyTable->setMouseTracking(true);
MyTable->viewport()->setMouseTracking(true);