Results 1 to 4 of 4

Thread: detecting back and forward buttons on >= 5 button mouse

  1. #1
    Join Date
    Jun 2008
    Posts
    88
    Thanks
    4
    Thanked 4 Times in 3 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11
    Wiki edits
    1

    Default detecting back and forward buttons on >= 5 button mouse

    So, in the Qt namespace you get the following button enumerations. Is there a good way to tell which button is the forward button and which is the back?

    On Linux, I understand that this is stored in something like xmodmap, even if I knew how to get that information programmatically, I'm still not sure how to map XButton1 or XButton2 to those values.

    Constant Value Description
    Qt::NoButton 0x00000000 The button state does not refer to any button (see QMouseEvent::button()).
    Qt::LeftButton 0x00000001 The left button is pressed, or an event refers to the left button. (The left button may be the right button on left-handed mice.)
    Qt::RightButton 0x00000002 The right button.
    Qt::MidButton 0x00000004 The middle button.
    Qt::XButton1 0x00000008 The first X button.
    Qt::XButton2 0x00000010 The second X button.

    Any ideas on how to do this? I would imagine someone out there has solved this problem. I was expecting to find the answer in one of Qt's webkit examples but didnt locate anything.

  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: detecting back and forward buttons on >= 5 button mouse

    There are two options as I see it:
    1. These button are standardized.
    If so, just test it, and you know which is which.
    2. There is no standard.
    In that case, offer a settings dialog, where the user can set which button is which.

    (The left button may be the right button on left-handed mice.)
    I don't think this is true.
    A true left-handed mouse probably switched the buttons as well.
    In addition, this is something you can change over the mouse settings of the OS.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Jun 2008
    Posts
    88
    Thanks
    4
    Thanked 4 Times in 3 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11
    Wiki edits
    1

    Default Re: detecting back and forward buttons on >= 5 button mouse

    You might be right about just testing them and assuming they're standardized. I supposed a few carefully planned tests could show what happens when you change settings in your xmodmap to see if Qt is getting raw mouse events or if they are in fact going through X's button mappings first. I was just hoping someone had a definitive answer. I'm just messing around with creating a directory browser and thought it would be nice to enable those buttons for navigation.

    Also just so you know, the left button/right button swap comment didnt come from me, I copied that text from the Qt 4.6 documentation for the Qt namespace

  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: detecting back and forward buttons on >= 5 button mouse

    Also just so you know, the left button/right button swap comment didnt come from me, I copied that text from the Qt 4.6 documentation for the Qt namespace
    Well, they are human too, the trolls
    I just don't see the point of having a left handed mouse (that means it was ergonomically designed to be held left handed) and not swap the buttons - what sense would that make?
    It would be equivalent to a normal mouse with swapped buttons.
    The trolls probably put it there to cover this possibility.

    Anyway, as I said, this can be set from the OS mouse settings, so eventually, this doesn't really matter, since you can change the buttons functions as you see fit.
    It is not important on which side the button is, it is important what FUNCTIONALITY the pressed button has (as in the OS mouse settings).
    In that regard the "left mouse button" is not necessarily on the left, but rather the button configured with the functionality of the "left button"(i.e selecting etc, and not for the context menu).
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. Replies: 8
    Last Post: 10th June 2010, 07:34
  2. Replies: 9
    Last Post: 26th October 2009, 00:13
  3. Mouse Over event on button
    By vishal.chauhan in forum Qt Programming
    Replies: 9
    Last Post: 10th January 2007, 05:03
  4. Detecting mouse clicks outside of widget
    By init2null in forum Qt Programming
    Replies: 2
    Last Post: 5th May 2006, 19:16
  5. Sorry another problem. Mouse Buttons.
    By Zephro in forum Qt Programming
    Replies: 14
    Last Post: 24th February 2006, 16:08

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.