PDA

View Full Version : Qwidgets



Lavs
24th July 2018, 13:56
On clicking pushbutton, pages in stacked widget has to slide left once. And on double clicking same pushbutton, pages has to slide right twice. Can anyone please help me to write code for this in qt.

Ginsengelf
25th July 2018, 08:11
Hi, you can use the clicked() signal of the QPushButton, but you will have to overload the mouseEvent() for your button and check QEvent::MouseButtonDblClick because there is no signal on double click.

Ginsengelf

d_stranz
26th July 2018, 01:10
Another possibility is to use a QTimer in the slot that responds to the clicked() signal. When the first click occurs, start the timer for some short timeout - 250 ms or so (you can determine the actual double-click interval for your OS using QApplication::doubleClickInterval() ). When the second click comes, if the timer is still running then you stop it and slide two pages because the second click has come within the double-click interval. If the timer has timed out, the response has been slower than a double-click, so you slide one page. (Implement the "slide one page" slot for the QTimer::timeOut() signal).