BinCalc
::BinCalc(QWidget *parent
) { ..
pushButton_0->installEventFilter(this);
}
bool BinCalc
::eventFilter(QObject* watched,
QEvent* event
) //BinCalc is the frameless widget {
if(event
->type
()==QEvent::MouseButtonPress) { QPoint posInPushButton
=dynamic_cast<QMouseEvent
*>
(event
)->pos
();
QPoint posOfPushButton
=dynamic_cast<QWidget
*>
(watched
)->pos
();
m_moveStartPos=posInPushButton+posOfPushButton;
}
return QWidget::eventFilter(watched, event
);
}
BinCalc::BinCalc(QWidget *parent) {
..
pushButton_0->installEventFilter(this);
}
bool BinCalc::eventFilter(QObject* watched, QEvent* event) //BinCalc is the frameless widget
{
if(event->type()==QEvent::MouseButtonPress) {
QPoint posInPushButton=dynamic_cast<QMouseEvent*>(event)->pos();
QPoint posOfPushButton=dynamic_cast<QWidget*>(watched)->pos();
m_moveStartPos=posInPushButton+posOfPushButton;
}
return QWidget::eventFilter(watched, event);
}
To copy to clipboard, switch view to plain text mode
This code works but is very slow (It flickers when moving. This doesn't happen when moving with the line edit.) Is there a possibility to make it faster?
edit: I've noticed, that the button isn't activated (it doesn't get the event). So it doesn't work 
edit2: it is activated, but it has no animation
Bookmarks