hi,
i want when mouse double click on widget it should show central to window ..
and again double click i should go to prevoius position ...
i tried this
void Widget
::mouseDoubleClickEvent(QMouseEvent *pEvent
) {
if(pEvent->MouseButtonDblClick )
{
int x = (screenGeometry.width() - this->width()) / 2;
int y = (screenGeometry.height()- this->height()) / 2;
this->move(x, y);
}
else
{
this->move(this->x(),this->y());
pEvent->accept();
}
}
void Widget::mouseDoubleClickEvent(QMouseEvent *pEvent)
{
if(pEvent->MouseButtonDblClick )
{
QRect screenGeometry = QApplication::desktop()->screenGeometry();
int x = (screenGeometry.width() - this->width()) / 2;
int y = (screenGeometry.height()- this->height()) / 2;
this->move(x, y);
}
else
{
this->move(this->x(),this->y());
pEvent->accept();
}
}
To copy to clipboard, switch view to plain text mode
First condition is working but second condition is not working can anybody give solution...
Bookmarks