Results 1 to 8 of 8

Thread: [Multi click] What about x-ple click where x > 2 ?

  1. #1
    Join Date
    May 2006
    Posts
    55
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default [Multi click] What about x-ple click where x > 2 ?

    Hi,
    Is there a (nice) way to get multiple click events in Qt ?
    Googling on the subject lead me to short threads in mailing-lists
    with one asking (and even proposing code if I got it well)
    and nobody answering.
    Is there any negative recommendation by trolltech or anyone else
    on the subject, explaning this absence of feature ?
    Regards.

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: [Multi click] What about x-ple click where x > 2 ?

    Multiple clicks (i.e more then one and not double click) are nothing more then normal clicks where you just need to compare the time difference between the clicks agaist a defined threshold.
    Where is the problem?

  3. #3
    Join Date
    May 2006
    Posts
    55
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: [Multi click] What about x-ple click where x > 2 ?

    Thanks for replying, high_flyer.
    "Where is the problem ?"
    In the ease of using it. What would you say if double was not
    pre-baked by Qt in the form of a virtual method mouseDoubleClickEvent ?
    A library, a framework is supposed to help get things done simpler, no ?
    I wish MouseEvent had a "multiClickCount" or something of that meaning.
    I guess it would not have cost that much as the time comparison is already
    executed for double click... I thought... and then read the source. OK this seems
    to be heavily system dependent. But QTextEdit has some thing of this kind in its source...
    Regards

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: [Multi click] What about x-ple click where x > 2 ?

    In the ease of using it. What would you say if double was not
    pre-baked by Qt in the form of a virtual method mouseDoubleClickEvent ?
    I don't agree with your statment.
    A single left and right clicks as well as left double click became a standard use of mouse button long ago.
    Since practically every GUI application uses some or all of those it makes sense to have them in a GUI library.
    But multi clicks are not a standard practice, therefore, I would not excpect it to be built in Qt.
    A library, a framework is supposed to help get things done simpler, no ?
    Yes.
    And Qt is great at doing that.
    Qt covers lots of frequently used tasks in GUI and non GUI applications alike, but it can't cover ALL wishes of everyone, you have to agree about that - so where should one draw the line on what to implement and what not?
    Surely you have to agree that the degree of how much a feature is used is a good mesure to decide that.
    I wish MouseEvent had a "multiClickCount" or something of that meaning.
    Well, I wish Qt had many other features...
    But that would take all the fun out of coding...
    I guess it would not have cost that much as the time comparison is already
    executed for double click... I thought... and then read the source. OK this seems
    to be heavily system dependent.
    Qt offers you all the tools to do that easely, and it is NOT system dependent, since QTimer/QTime is not system dependent nor is QMouseEvent.
    But QTextEdit has some thing of this kind in its source...
    Thats one way to go about it, (reading in to Qt source) but the problem is really simple... just few lines of code...

    Qt Code:
    1. MyWidget::mouseReleaseEvent ( QMouseEvent * event )
    2. {
    3. clickTimer.start(m_timeout);
    4. }
    5.  
    6. MyWidget::mousePressEvent( QMouseEvent * event )
    7. {
    8. clickTimer.stop();
    9. m_clickCounter++;
    10. }
    11.  
    12. //the slot to be executed when clickTimer timesout
    13. void MyWidget::multiClickSlot()
    14. {
    15. switch(m_clickCounter)
    16. {
    17. case 3: //do something
    18. break;
    19. case 4: //do somthing else
    20. }
    21. }
    To copy to clipboard, switch view to plain text mode 

    Or something similar...

  5. The following user says thank you to high_flyer for this useful post:

    lauranger (24th August 2006)

  6. #5
    Join Date
    May 2006
    Posts
    55
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: [Multi click] What about x-ple click where x > 2 ?

    "something similar" is OK for me
    My post was not a rant. I like Qt a lot

  7. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: [Multi click] What about x-ple click where x > 2 ?

    "Multiclicking" (with multi > 2) is not a good design. It's much better to use a single or double click with a keyboard modifier (shift, ctrl, ...) instead.

  8. The following user says thank you to wysota for this useful post:

    lauranger (24th August 2006)

  9. #7
    Join Date
    May 2006
    Posts
    55
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: [Multi click] What about x-ple click where x > 2 ?

    Quote Originally Posted by wysota
    "Multiclicking" (with multi > 2) is not a good design. It's much better to use a single or double click with a keyboard modifier (shift, ctrl, ...) instead.
    That's a good point : I rarely use quadruple-click for rectangular selection in vim but use Ctrl-V in stead. /o\
    But on the other side triple click for whole line selection has become a standard. (And QTextEdit features it, as already stated).
    Modifiers are easier to master than click multiplicity and offer more usable combinations.
    So this is a better alternative.
    Thanks Wysota.

  10. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: [Multi click] What about x-ple click where x > 2 ?

    Quote Originally Posted by lauranger
    But on the other side triple click for whole line selection has become a standard. (And QTextEdit features it, as already stated).
    Nobody said things considered a standard are always good solutions to problems.

Similar Threads

  1. TreeView click item not connecting
    By Big Duck in forum Qt Programming
    Replies: 2
    Last Post: 9th June 2006, 19:38
  2. Push button double click
    By curtisw in forum Qt Programming
    Replies: 3
    Last Post: 15th February 2006, 16:40
  3. QTableWidget click in empty space results in error?
    By Giel Peters in forum Qt Programming
    Replies: 4
    Last Post: 21st January 2006, 00:07
  4. Replies: 5
    Last Post: 12th January 2006, 15:40

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.