Reputation: 11933
Qt 4.8 on Fedora 17 x64
In my QWidget::mouseMoveEvent
, I am trying to check to see if the cursor is currently set to either Qt::SizeVerCursor
or Qt::SizeHorCursor
, but the QCursor
returned by calling QWidget::cursor()
cannot be compared to either Qt::SizeVerCursor
or Qt::SizeHorCursor
because of a compile error. It looks like this is because both Qt::SizeVerCursor
and Qt::SizeHorCursor
are actually Qt::CursorShape
instead of QCursor
.
This code fails to compile:
void MyGraphicsView::mouseMoveEvent( QMouseEvent *event )
{
if( ( cursor() == Qt::SizeHorCursor ) || ( cursor() == Qt::SizeVerCursor ) )
{
qDebugGreen() << "Cursor is a size cursor!";
}
QGraphicsView::mouseMoveEvent( event );
}
Here is the compile error:
error: no match for ‘operator==’ in ‘QWidget::cursor() const() == (Qt::CursorShape)6u’
How can I check if the current cursor is either Qt::SizeVerCursor
or Qt::SizeHorCursor
?
Upvotes: 1
Views: 4217