Results 1 to 3 of 3

Thread: Qwidgets

  1. #1
    Join Date
    Jul 2018
    Qt products

    Default Qwidgets

    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.

  2. #2
    Join Date
    Jul 2008
    Thanked 52 Times in 50 Posts
    Qt products
    Qt4 Qt5
    Unix/X11 Windows

    Default Re: Qwidgets

    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.


  3. #3
    Join Date
    Jan 2008
    Alameda, CA, USA
    Thanked 656 Times in 646 Posts
    Qt products
    Windows Android

    Default Re: Qwidgets

    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).
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. QWidgets and processes
    By mihaiadrian in forum Qt Programming
    Replies: 3
    Last Post: 19th May 2010, 16:38
  2. Multiple QWidgets
    By codeman in forum Qt Programming
    Replies: 7
    Last Post: 23rd March 2010, 11:21
  3. NLE Editor using QWidgets/QGraphicsView
    By depsch in forum Newbie
    Replies: 0
    Last Post: 14th September 2009, 23:07
  4. Navigate between QWidgets and MainWindow
    By pcaeiro in forum Qt Programming
    Replies: 2
    Last Post: 5th August 2009, 12:05
  5. QTableView, add QWidgets
    By xgoan in forum Qt Programming
    Replies: 2
    Last Post: 30th November 2006, 18:34


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.