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. Disabled SplitHCursor!?

Disabled SplitHCursor!?

Scheduled Pinned Locked Moved Solved General and Desktop
11 Posts 2 Posters 3.2k 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.
  • S Offline
    S Offline
    ShinSat
    wrote on last edited by ShinSat
    #1

    Hi All,

    I have an odd issue that my SplitHCursor is invisible on my QSplitter(s).
    I'm trying to understand the reproducing pattern, but no luck so far.

    One quick question is what property is responsible for changing the mouse cursor on QSplitter?
    Do I need to set stylesheet or something in QSplitter??

    Thanks in advance for your help.
    Sat

    S 1 Reply Last reply
    0
    • S ShinSat

      Hi All,

      I have an odd issue that my SplitHCursor is invisible on my QSplitter(s).
      I'm trying to understand the reproducing pattern, but no luck so far.

      One quick question is what property is responsible for changing the mouse cursor on QSplitter?
      Do I need to set stylesheet or something in QSplitter??

      Thanks in advance for your help.
      Sat

      S Offline
      S Offline
      ShinSat
      wrote on last edited by
      #2

      @ShinSat QSplitter itself works but no SplitHCursor... Strange..

      Sat

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

        Hi,

        What version of Qt are you using ?
        On what platform ?
        Can you show the code setting up the QSplitter ?

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

        S 1 Reply Last reply
        1
        • SGaistS SGaist

          Hi,

          What version of Qt are you using ?
          On what platform ?
          Can you show the code setting up the QSplitter ?

          S Offline
          S Offline
          ShinSat
          wrote on last edited by ShinSat
          #4

          Thanks for an update, @SGaist
          I'm using pyqt5.9.1 on Windows7.
          Still investigating the issue and found in a different app that SplitHCursor was also invisible occasionally in horizontal header in my QTable/QTreeView on QSplitter.
          I wonder if there's workaround to forcefully set the mouse cursor shape..

          I'll share code snippet once it's ready.

          Sat

          S 1 Reply Last reply
          0
          • S ShinSat

            Thanks for an update, @SGaist
            I'm using pyqt5.9.1 on Windows7.
            Still investigating the issue and found in a different app that SplitHCursor was also invisible occasionally in horizontal header in my QTable/QTreeView on QSplitter.
            I wonder if there's workaround to forcefully set the mouse cursor shape..

            I'll share code snippet once it's ready.

            Sat

            S Offline
            S Offline
            ShinSat
            wrote on last edited by ShinSat
            #5

            @ShinSat I'm still investigating the issue with the following custom QSplitter/QSplitterHandle.
            One strange thing is that I can't change the cursor shape in MySplitterHandle.mouseMoveEvent.
            MySplitterHandle.mouseMoveEvent is successfully invoked but the cursor shape doesn't change.
            Is there any possible situation where setCursor method doesn't work?? What am I missing???

            class MySplitter(QSplitter):
                def __init__(self, dir, parent=None):
                    super(MySplitter, self).__init__(parent=parent)
                    self.setOrientation(dir)
                    #self.setHandleWidth(1)
                    self.split_handle = None
            
            
                def createHandle(self):
                    self.split_handle = MySplitterHandle(self.orientation(), self)
                    return self.split_handle
            
            
            
            class MySplitterHandle(QSplitterHandle):
                def __init__(self, orientation, parent):
                    super(MySplitterHandle, self).__init__(orientation, parent)
            
                    self.setCursor(Qt.SplitHCursor if orientation == Qt.Horizontal else Qt.SplitVCursor)
                    #self.setCursor(Qt.PointingHandCursor)
                    self.setMouseTracking(True)
                    self.direction = orientation
            
                def mouseMoveEvent(self, event):
                    print('setting splitter cursor')
                    super().mouseMoveEvent(event)
                    #self.unsetCursor()
                    self.setCursor(Qt.SplitHCursor if self.direction == Qt.Horizontal else Qt.SplitVCursor)
            
            S 1 Reply Last reply
            0
            • S ShinSat

              @ShinSat I'm still investigating the issue with the following custom QSplitter/QSplitterHandle.
              One strange thing is that I can't change the cursor shape in MySplitterHandle.mouseMoveEvent.
              MySplitterHandle.mouseMoveEvent is successfully invoked but the cursor shape doesn't change.
              Is there any possible situation where setCursor method doesn't work?? What am I missing???

              class MySplitter(QSplitter):
                  def __init__(self, dir, parent=None):
                      super(MySplitter, self).__init__(parent=parent)
                      self.setOrientation(dir)
                      #self.setHandleWidth(1)
                      self.split_handle = None
              
              
                  def createHandle(self):
                      self.split_handle = MySplitterHandle(self.orientation(), self)
                      return self.split_handle
              
              
              
              class MySplitterHandle(QSplitterHandle):
                  def __init__(self, orientation, parent):
                      super(MySplitterHandle, self).__init__(orientation, parent)
              
                      self.setCursor(Qt.SplitHCursor if orientation == Qt.Horizontal else Qt.SplitVCursor)
                      #self.setCursor(Qt.PointingHandCursor)
                      self.setMouseTracking(True)
                      self.direction = orientation
              
                  def mouseMoveEvent(self, event):
                      print('setting splitter cursor')
                      super().mouseMoveEvent(event)
                      #self.unsetCursor()
                      self.setCursor(Qt.SplitHCursor if self.direction == Qt.Horizontal else Qt.SplitVCursor)
              
              S Offline
              S Offline
              ShinSat
              wrote on last edited by
              #6

              @ShinSat Update:
              Looks like self.cursor().shape() in MySplitterHandle shows the correct shape but the mouse cursor is not changing..

              S 1 Reply Last reply
              0
              • S ShinSat

                @ShinSat Update:
                Looks like self.cursor().shape() in MySplitterHandle shows the correct shape but the mouse cursor is not changing..

                S Offline
                S Offline
                ShinSat
                wrote on last edited by
                #7

                @ShinSat Found one workaround with the following code, but my widgets are on QMainWindow and another splitter between QDock and CentralWidget is also staying ArrowCursor, which should be either SplitHCursor or SplitVCursor. Therefore, the workaround can't be the final solution.

                class MySplitterHandle(QSplitterHandle):
                ...
                ...
                    def enterEvent(self, e):
                        print('enterEvent')
                        #super().enterEvent(e)
                        QApplication.setOverrideCursor(Qt.SplitHCursor if self.direction == Qt.Horizontal else Qt.SplitVCursor)
                
                    def leaveEvent(self, e):
                        print('leaveEvent')
                        #super().enterEvent(e)
                        QApplication.setOverrideCursor(Qt.ArrowCursor)
                
                S 1 Reply Last reply
                0
                • S ShinSat

                  @ShinSat Found one workaround with the following code, but my widgets are on QMainWindow and another splitter between QDock and CentralWidget is also staying ArrowCursor, which should be either SplitHCursor or SplitVCursor. Therefore, the workaround can't be the final solution.

                  class MySplitterHandle(QSplitterHandle):
                  ...
                  ...
                      def enterEvent(self, e):
                          print('enterEvent')
                          #super().enterEvent(e)
                          QApplication.setOverrideCursor(Qt.SplitHCursor if self.direction == Qt.Horizontal else Qt.SplitVCursor)
                  
                      def leaveEvent(self, e):
                          print('leaveEvent')
                          #super().enterEvent(e)
                          QApplication.setOverrideCursor(Qt.ArrowCursor)
                  
                  S Offline
                  S Offline
                  ShinSat
                  wrote on last edited by
                  #8

                  @ShinSat SOLVED. It was my fault that I was missing QApplication.restoreOverrideCursor() after some modification of cursor shape.

                  Thanks!
                  Sat

                  S 1 Reply Last reply
                  3
                  • S ShinSat

                    @ShinSat SOLVED. It was my fault that I was missing QApplication.restoreOverrideCursor() after some modification of cursor shape.

                    Thanks!
                    Sat

                    S Offline
                    S Offline
                    ShinSat
                    wrote on last edited by
                    #9

                    @ShinSat Sorry, again. I just wanted to share what are the options that we can change the mouse cursor shape.
                    Is this the only option that we have?
                    QApplication.setOverrideCursor(Qt.WaitCursor)/QApplication.restoreOverrideCursor()

                    Thanks,
                    Sat

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

                      These are for application wide modification otherwise you have QWidget::setCursor.

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

                      S 1 Reply Last reply
                      0
                      • SGaistS SGaist

                        These are for application wide modification otherwise you have QWidget::setCursor.

                        S Offline
                        S Offline
                        ShinSat
                        wrote on last edited by
                        #11

                        @SGaist Ah, yes, I was missing that... ashamed....
                        Thank you very much for your help!

                        Regards,
                        Sat

                        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