Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-74861

CSS-style not applied to first QSizeGrip of composite widget in QVBoxLayout

    XMLWordPrintable

Details

    • Linux/X11

    Description

      The PySide2 sample code below shows a custom widget (TestWidget) consisting of a QFrame and aCSS-styled QSizeGrip. The TestApp places several instances of this TestWidget in a QVBoxLayout. The first QSizeGrip is not visible unless it is the only size grip in the layout, as shown in the attached images

      import sys
      from PySide2 import QtCore
      from PySide2.QtWidgets import QApplication, QWidget , QMainWindow , QGraphicsView , QVBoxLayout , QFrame , QSizeGrip , QWidget
      
      
      class TestWidget(QWidget):
      	def __init__(self , parent=None):
      		super(TestWidget , self).__init__(parent)
      
      		layout = QVBoxLayout()
      		layout.setContentsMargins( 0 , 0 , 0 , 0 )
      
      		frame = QFrame()
      		frame.setFrameShape(QFrame.StyledPanel)
      		frame.setMinimumHeight( 100 )
      
      		grip = QSizeGrip(self)
      		grip.setStyleSheet( "QSizeGrip { image: url(dots.png); }")
      		grip.setCursor(QtCore.Qt.SplitVCursor)
      
      		layout.addWidget(frame)
      		layout.addWidget( grip , 0 , QtCore.Qt.AlignBottom | QtCore.Qt.AlignRight )
      
      		self.setLayout(layout)
      
      class TestApp(QMainWindow):
      	def __init__(self, parent=None):
      		super(TestApp, self).__init__(parent)
      
      		track1 = TestWidget()
      		track2 = TestWidget()
      		track3 = TestWidget()
      
      		centralWidget = QWidget()
      		layout = QVBoxLayout(centralWidget)
      
      		layout.addWidget(track1)
      		layout.addWidget(track2)
      		layout.addWidget(track3)
      
      		self.setCentralWidget(centralWidget)
      		self.show()	
      
      if __name__=="__main__":
          app = QApplication(sys.argv)
          myapp = TestApp();
          sys.exit(app.exec_())		
      

      I've observed the same bug in PySide version 1.2.2 (Qt version 4.8.7)

      Attachments

        1. dots.png
          dots.png
          0.3 kB
        2. QSizeGrip_Issue_2.png
          QSizeGrip_Issue_2.png
          6 kB
        3. QSizeGrip_Issue.png
          QSizeGrip_Issue.png
          6 kB
        4. TestApp_2.png
          TestApp_2.png
          9 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            crmaurei Cristian Maureira-Fredes
            olumide olumide
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes