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. Set pseudo-state pressed for QSplitterHandle overridden mouse events
Forum Updated to NodeBB v4.3 + New Features

Set pseudo-state pressed for QSplitterHandle overridden mouse events

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 2 Posters 481 Views 2 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.
  • R Offline
    R Offline
    Robert Sanson
    wrote on last edited by
    #1

    I have overridden the mousePressEvent, mouseMoveEvent and mouseReleaseEvent for a sub-class QSplitterHandle and am able to change the style for the ::handle:hover but not for the ::handle:pressed. My assumption is that since I have overridden these mouse events, that I need to some how set the pseudo-state pressed to true/false within these mouse events in order for the style to be able to be changed but I haven't found a way to fix this. Does anybody know how to go about this?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Are you calling the base class implementation of these methods ?

      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
      0
      • R Offline
        R Offline
        Robert Sanson
        wrote on last edited by
        #3

        I'm guessing that is my question on how to do that. I have created a custom widget for the QSplitter and have overridden the createHandle to use the custom widget for the QSplitterHandle, but I am not sure how to tell it in the mouse events that the pressed is enabled or set to true.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          How to do what ?

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

          R 1 Reply Last reply
          0
          • SGaistS SGaist

            How to do what ?

            R Offline
            R Offline
            Robert Sanson
            wrote on last edited by
            #5

            @SGaist Maybe I am confused by what you are asking. The mouse events are getting called from me clicking on the the custom QSplitter and its custom QSplitterHandle but the pseudo-state pressed needs to be set in these mouse events. Do I need to call some kind of base class method for setting the pressed state?

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              First the question will be: what are you doing in the method you reimplemented ?

              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
              0
              • R Offline
                R Offline
                Robert Sanson
                wrote on last edited by
                #7

                In the mousePressEvent I have:

                setCursor(Qt::ClosedHandCursor);
                
                   eventPtr->accept();
                

                In the mouseMoveEvent I have:

                if (eventPtr->buttons() & Qt::LeftButton)
                   {
                      setCursor(Qt::ClosedHandCursor);
                
                      auto pos = parentWidget()->mapFromGlobal(eventPtr->globalPos()).y();
                
                      moveSplitter(pos);
                
                      eventPtr->accept();
                   }
                

                and in the mouseReleaseEvent I have:

                setCursor(Qt::PointingHandCursor);
                
                   eventPtr->accept();
                
                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  If you want to have QSplitter do the standard stuff beside your modifications then you have to call the base class implementation of these methods.

                  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
                  0

                  • Login

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