Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QWidget::mousePressEvent() fail to capture the left click event
Forum Updated to NodeBB v4.3 + New Features

QWidget::mousePressEvent() fail to capture the left click event

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 52 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    www111
    wrote last edited by
    #1

    Hi all,

    As the title mentions, I define that event for my tab widget.
    I expect that when the user clicks the tab, mousePressEvent can be called. However, I notice that only the right click is detected instead of the left click.

    I have even tried to implement the event filter, and I notice that both left and right clicks on the tab can trigger the QEvent::MouseButtonPress.

    I am wondering why the left click on the tab can not be detected from QWidget::mousePressEvent()

    JonBJ Pl45m4P 2 Replies Last reply
    0
    • W www111

      Hi all,

      As the title mentions, I define that event for my tab widget.
      I expect that when the user clicks the tab, mousePressEvent can be called. However, I notice that only the right click is detected instead of the left click.

      I have even tried to implement the event filter, and I notice that both left and right clicks on the tab can trigger the QEvent::MouseButtonPress.

      I am wondering why the left click on the tab can not be detected from QWidget::mousePressEvent()

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote last edited by
      #2

      @www111 said in QWidget::mousePressEvent() fail to capture the left click event:

      I expect that when the user clicks the tab

      I don't know for sure, and I don't know about your right click, but if you are clicking on the "tab" in the sense of the tab bar rather than the widget area then do mouse clicks go to the QTabBar *QTabWidget::tabBar() const?

      1 Reply Last reply
      0
      • W www111

        Hi all,

        As the title mentions, I define that event for my tab widget.
        I expect that when the user clicks the tab, mousePressEvent can be called. However, I notice that only the right click is detected instead of the left click.

        I have even tried to implement the event filter, and I notice that both left and right clicks on the tab can trigger the QEvent::MouseButtonPress.

        I am wondering why the left click on the tab can not be detected from QWidget::mousePressEvent()

        Pl45m4P Offline
        Pl45m4P Offline
        Pl45m4
        wrote last edited by
        #3

        @www111

        I suspect that some other widget takes ("accepts") the mouse event, so it's not propagated to the tab event handler anymore.


        If debugging is the process of removing software bugs, then programming must be the process of putting them in.

        ~E. W. Dijkstra

        W 1 Reply Last reply
        0
        • Pl45m4P Pl45m4

          @www111

          I suspect that some other widget takes ("accepts") the mouse event, so it's not propagated to the tab event handler anymore.

          W Offline
          W Offline
          www111
          wrote last edited by
          #4

          @Pl45m4
          Oh okay. I will have a look at the other part of the code.
          Do you know why the left click can be detected within the eventfilter?
          Does it mean that the event captured by eventfilter would be the higher priority?

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved