Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    How to get mouse event from QTabBar

    General and Desktop
    3
    7
    2788
    Loading More Posts
    • 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.
    • G
      GrahamL last edited by

      Hi
      I want track mouse events occurring in the QTabBar widget inside my QTabWidget but dont see how to do this.

      I would be grateful if someone could provide some hints

      Thanks

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        You can look for the QTabBar using findChild and install an eventFilter on it

        Hope it helps

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply Reply Quote 0
        • R
          rohaase last edited by

          Hi,

          ich have near the same problem with the Handlich of QTabBar.
          I need do use a mouse-right-click for a special handling by changing the tabs. But I did not find out how to impelent the eventFilter mousePressEvent for that. I can fetch the right click, left clicks, but I am not able to make the same handling by the right click (setting the tab as activ).
          So for what should this be done: I want to change the tab by left click and fill in some 'special' data into that QTabWidget.
          I want to use the right click in the same way, but I want to fill 'all' (different fillings into lists) data into that QTabWidget.
          There are the same elements only different content.

          I hope you could understand my text, I am a nuub in programming and english.

          Thx for help !!!

          I am a newbie in C++ - so be kind ;=)

          1 Reply Last reply Reply Quote 0
          • R
            rohaase last edited by

            Hi all,

            do I have to open a new discussion to get an answer, ist this here the wrog place ? please give me a hint.

            Thx

            I am a newbie in C++ - so be kind ;=)

            1 Reply Last reply Reply Quote 0
            • SGaist
              SGaist Lifetime Qt Champion last edited by

              Please practice some patience, waiting 24 to 72 hours before bumping your question is common. Not everybody on this forum lives in the same timezone as you.

              What did you already try ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply Reply Quote 0
              • R
                rohaase last edited by

                I tried a lot and now I am so confused ..

                I installed an eventFilter so far so good.
                I am able to get 'QT::LeftButton' and 'QT::RightButton' and the event 'QT::MouseButtonPressed'.

                Now I want to indentify the clicked Tab by index (if possible) in QTabBar (even left or right mousebutton has been used to click) - this is not possible.

                I need the index from the clicked Tab because I want to have the same behavior like we have with the left one. Only some data should be different shown.

                I think I will give up, I have no more Ideas.

                I am a newbie in C++ - so be kind ;=)

                1 Reply Last reply Reply Quote 0
                • SGaist
                  SGaist Lifetime Qt Champion last edited by

                  You can also subclass QTabBar and set it on your QTabWidget, it will be easier to play with the tabs in there.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post