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. By using Qt designer I have created scroll area and inside the scroll area I have give group box.. inside that group box I have added lot of elements but vertical scroll bar is not working.. even it is not visible.

By using Qt designer I have created scroll area and inside the scroll area I have give group box.. inside that group box I have added lot of elements but vertical scroll bar is not working.. even it is not visible.

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 4 Posters 846 Views
  • 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
    saia
    wrote on last edited by
    #1

    Re: Scroll area not showing the vertical scroll bar

    jsulmJ 1 Reply Last reply
    0
    • S saia

      Re: Scroll area not showing the vertical scroll bar

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by jsulm
      #2

      @saia Please use short titles for your threads and describe your problem in the body of the message, not in the title!
      Provide more information like Qt version and platform and relevant code.

      In the thread you linked the issue was solved - did you check the suggested solution?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • C Offline
        C Offline
        ChrisW67
        wrote on last edited by
        #3

        By using Qt designer I have created scroll area and inside the scroll area I have give group box.. inside that group box I have added lot of elements but vertical scroll bar is not working.. even it is not visible.

        Unless that group box is larger than the available client area of the QScrollArea then this is expected behaviour. Just adding a lot of elements to the group box does not tell us anything about its size, nor does it guarantee that the QGroupBox grew to accommodate the content rather than truncating or otherwise producing a broken layout.

        Post some code (use the </> tool) and screen shots that actually display the problem you think you have.

        S 1 Reply Last reply
        0
        • C ChrisW67

          By using Qt designer I have created scroll area and inside the scroll area I have give group box.. inside that group box I have added lot of elements but vertical scroll bar is not working.. even it is not visible.

          Unless that group box is larger than the available client area of the QScrollArea then this is expected behaviour. Just adding a lot of elements to the group box does not tell us anything about its size, nor does it guarantee that the QGroupBox grew to accommodate the content rather than truncating or otherwise producing a broken layout.

          Post some code (use the </> tool) and screen shots that actually display the problem you think you have.

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

          @ChrisW67 I have tried by giving group box height is greater than the Qscroll Area.. eventhough it is not creating the verticalscrollBar..Please find the below my code# -- coding: utf-8 --

          Form implementation generated from reading ui file 'sam.ui'

          Created by: PyQt5 UI code generator 5.15.10

          WARNING: Any manual changes made to this file will be lost when pyuic5 is

          run again. Do not edit this file unless you know what you are doing.

          from PyQt5 import QtCore, QtGui, QtWidgets

          class Ui_MainWindow(object):
          def setupUi(self, MainWindow):
          MainWindow.setObjectName("MainWindow")
          MainWindow.resize(800, 635)
          self.centralwidget = QtWidgets.QWidget(MainWindow)
          self.centralwidget.setObjectName("centralwidget")
          self.frame = QtWidgets.QFrame(self.centralwidget)
          self.frame.setGeometry(QtCore.QRect(10, 10, 771, 201))
          self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
          self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
          self.frame.setObjectName("frame")
          self.label = QtWidgets.QLabel(self.frame)
          self.label.setGeometry(QtCore.QRect(20, 20, 91, 31))
          font = QtGui.QFont()
          font.setBold(True)
          font.setWeight(75)
          self.label.setFont(font)
          self.label.setObjectName("label")
          self.label_2 = QtWidgets.QLabel(self.frame)
          self.label_2.setGeometry(QtCore.QRect(20, 80, 91, 31))
          font = QtGui.QFont()
          font.setBold(True)
          font.setWeight(75)
          self.label_2.setFont(font)
          self.label_2.setObjectName("label_2")
          self.lineEdit = QtWidgets.QLineEdit(self.frame)
          self.lineEdit.setGeometry(QtCore.QRect(140, 20, 261, 31))
          self.lineEdit.setObjectName("lineEdit")
          self.lineEdit_2 = QtWidgets.QLineEdit(self.frame)
          self.lineEdit_2.setGeometry(QtCore.QRect(140, 81, 261, 31))
          self.lineEdit_2.setObjectName("lineEdit_2")
          self.pushButton = QtWidgets.QPushButton(self.frame)
          self.pushButton.setGeometry(QtCore.QRect(270, 150, 93, 28))
          self.pushButton.setObjectName("pushButton")
          self.scrollArea = QtWidgets.QScrollArea(self.centralwidget)
          self.scrollArea.setGeometry(QtCore.QRect(20, 230, 701, 101))
          self.scrollArea.setWidgetResizable(True)
          self.scrollArea.setObjectName("scrollArea")
          self.scrollAreaWidgetContents = QtWidgets.QWidget()
          self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 699, 99))
          self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
          self.groupBox = QtWidgets.QGroupBox(self.scrollAreaWidgetContents)
          self.groupBox.setGeometry(QtCore.QRect(0, 0, 681, 211))
          self.groupBox.setObjectName("groupBox")
          self.label_3 = QtWidgets.QLabel(self.groupBox)
          self.label_3.setGeometry(QtCore.QRect(20, 40, 91, 31))
          self.label_3.setObjectName("label_3")
          self.label_4 = QtWidgets.QLabel(self.groupBox)
          self.label_4.setGeometry(QtCore.QRect(20, 90, 111, 51))
          self.label_4.setObjectName("label_4")
          self.label_5 = QtWidgets.QLabel(self.groupBox)
          self.label_5.setGeometry(QtCore.QRect(20, 150, 55, 31))
          self.label_5.setObjectName("label_5")
          self.lineEdit_3 = QtWidgets.QLineEdit(self.groupBox)
          self.lineEdit_3.setGeometry(QtCore.QRect(160, 40, 321, 31))
          self.lineEdit_3.setObjectName("lineEdit_3")
          self.lineEdit_4 = QtWidgets.QLineEdit(self.groupBox)
          self.lineEdit_4.setGeometry(QtCore.QRect(160, 100, 321, 31))
          self.lineEdit_4.setObjectName("lineEdit_4")
          self.lineEdit_5 = QtWidgets.QLineEdit(self.groupBox)
          self.lineEdit_5.setGeometry(QtCore.QRect(160, 150, 321, 31))
          self.lineEdit_5.setObjectName("lineEdit_5")
          self.pushButton_2 = QtWidgets.QPushButton(self.groupBox)
          self.pushButton_2.setGeometry(QtCore.QRect(500, 40, 93, 28))
          self.pushButton_2.setObjectName("pushButton_2")
          self.pushButton_3 = QtWidgets.QPushButton(self.groupBox)
          self.pushButton_3.setGeometry(QtCore.QRect(500, 100, 93, 28))
          self.pushButton_3.setObjectName("pushButton_3")
          self.pushButton_4 = QtWidgets.QPushButton(self.groupBox)
          self.pushButton_4.setGeometry(QtCore.QRect(500, 150, 93, 28))
          self.pushButton_4.setObjectName("pushButton_4")
          self.scrollArea.setWidget(self.scrollAreaWidgetContents)
          MainWindow.setCentralWidget(self.centralwidget)
          self.menubar = QtWidgets.QMenuBar(MainWindow)
          self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 26))
          self.menubar.setObjectName("menubar")
          MainWindow.setMenuBar(self.menubar)
          self.statusbar = QtWidgets.QStatusBar(MainWindow)
          self.statusbar.setObjectName("statusbar")
          MainWindow.setStatusBar(self.statusbar)

              self.retranslateUi(MainWindow)
              QtCore.QMetaObject.connectSlotsByName(MainWindow)
          
          def retranslateUi(self, MainWindow):
              _translate = QtCore.QCoreApplication.translate
              MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
              self.label.setText(_translate("MainWindow", "Engine name"))
              self.label_2.setText(_translate("MainWindow", "Component"))
              self.pushButton.setText(_translate("MainWindow", "Search"))
              self.groupBox.setTitle(_translate("MainWindow", "Inputs"))
              self.label_3.setText(_translate("MainWindow", "Drwaings"))
              self.label_4.setText(_translate("MainWindow", "Books"))
              self.label_5.setText(_translate("MainWindow", "Files"))
              self.pushButton_2.setText(_translate("MainWindow", "Locate"))
              self.pushButton_3.setText(_translate("MainWindow", "Locate"))
              self.pushButton_4.setText(_translate("MainWindow", "Locate"))
          

          if name == "main":
          import sys
          app = QtWidgets.QApplication(sys.argv)
          MainWindow = QtWidgets.QMainWindow()
          ui = Ui_MainWindow()
          ui.setupUi(MainWindow)
          MainWindow.show()
          sys.exit(app.exec_())

          jsulmJ 1 Reply Last reply
          0
          • S saia

            @ChrisW67 I have tried by giving group box height is greater than the Qscroll Area.. eventhough it is not creating the verticalscrollBar..Please find the below my code# -- coding: utf-8 --

            Form implementation generated from reading ui file 'sam.ui'

            Created by: PyQt5 UI code generator 5.15.10

            WARNING: Any manual changes made to this file will be lost when pyuic5 is

            run again. Do not edit this file unless you know what you are doing.

            from PyQt5 import QtCore, QtGui, QtWidgets

            class Ui_MainWindow(object):
            def setupUi(self, MainWindow):
            MainWindow.setObjectName("MainWindow")
            MainWindow.resize(800, 635)
            self.centralwidget = QtWidgets.QWidget(MainWindow)
            self.centralwidget.setObjectName("centralwidget")
            self.frame = QtWidgets.QFrame(self.centralwidget)
            self.frame.setGeometry(QtCore.QRect(10, 10, 771, 201))
            self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
            self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
            self.frame.setObjectName("frame")
            self.label = QtWidgets.QLabel(self.frame)
            self.label.setGeometry(QtCore.QRect(20, 20, 91, 31))
            font = QtGui.QFont()
            font.setBold(True)
            font.setWeight(75)
            self.label.setFont(font)
            self.label.setObjectName("label")
            self.label_2 = QtWidgets.QLabel(self.frame)
            self.label_2.setGeometry(QtCore.QRect(20, 80, 91, 31))
            font = QtGui.QFont()
            font.setBold(True)
            font.setWeight(75)
            self.label_2.setFont(font)
            self.label_2.setObjectName("label_2")
            self.lineEdit = QtWidgets.QLineEdit(self.frame)
            self.lineEdit.setGeometry(QtCore.QRect(140, 20, 261, 31))
            self.lineEdit.setObjectName("lineEdit")
            self.lineEdit_2 = QtWidgets.QLineEdit(self.frame)
            self.lineEdit_2.setGeometry(QtCore.QRect(140, 81, 261, 31))
            self.lineEdit_2.setObjectName("lineEdit_2")
            self.pushButton = QtWidgets.QPushButton(self.frame)
            self.pushButton.setGeometry(QtCore.QRect(270, 150, 93, 28))
            self.pushButton.setObjectName("pushButton")
            self.scrollArea = QtWidgets.QScrollArea(self.centralwidget)
            self.scrollArea.setGeometry(QtCore.QRect(20, 230, 701, 101))
            self.scrollArea.setWidgetResizable(True)
            self.scrollArea.setObjectName("scrollArea")
            self.scrollAreaWidgetContents = QtWidgets.QWidget()
            self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 699, 99))
            self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
            self.groupBox = QtWidgets.QGroupBox(self.scrollAreaWidgetContents)
            self.groupBox.setGeometry(QtCore.QRect(0, 0, 681, 211))
            self.groupBox.setObjectName("groupBox")
            self.label_3 = QtWidgets.QLabel(self.groupBox)
            self.label_3.setGeometry(QtCore.QRect(20, 40, 91, 31))
            self.label_3.setObjectName("label_3")
            self.label_4 = QtWidgets.QLabel(self.groupBox)
            self.label_4.setGeometry(QtCore.QRect(20, 90, 111, 51))
            self.label_4.setObjectName("label_4")
            self.label_5 = QtWidgets.QLabel(self.groupBox)
            self.label_5.setGeometry(QtCore.QRect(20, 150, 55, 31))
            self.label_5.setObjectName("label_5")
            self.lineEdit_3 = QtWidgets.QLineEdit(self.groupBox)
            self.lineEdit_3.setGeometry(QtCore.QRect(160, 40, 321, 31))
            self.lineEdit_3.setObjectName("lineEdit_3")
            self.lineEdit_4 = QtWidgets.QLineEdit(self.groupBox)
            self.lineEdit_4.setGeometry(QtCore.QRect(160, 100, 321, 31))
            self.lineEdit_4.setObjectName("lineEdit_4")
            self.lineEdit_5 = QtWidgets.QLineEdit(self.groupBox)
            self.lineEdit_5.setGeometry(QtCore.QRect(160, 150, 321, 31))
            self.lineEdit_5.setObjectName("lineEdit_5")
            self.pushButton_2 = QtWidgets.QPushButton(self.groupBox)
            self.pushButton_2.setGeometry(QtCore.QRect(500, 40, 93, 28))
            self.pushButton_2.setObjectName("pushButton_2")
            self.pushButton_3 = QtWidgets.QPushButton(self.groupBox)
            self.pushButton_3.setGeometry(QtCore.QRect(500, 100, 93, 28))
            self.pushButton_3.setObjectName("pushButton_3")
            self.pushButton_4 = QtWidgets.QPushButton(self.groupBox)
            self.pushButton_4.setGeometry(QtCore.QRect(500, 150, 93, 28))
            self.pushButton_4.setObjectName("pushButton_4")
            self.scrollArea.setWidget(self.scrollAreaWidgetContents)
            MainWindow.setCentralWidget(self.centralwidget)
            self.menubar = QtWidgets.QMenuBar(MainWindow)
            self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 26))
            self.menubar.setObjectName("menubar")
            MainWindow.setMenuBar(self.menubar)
            self.statusbar = QtWidgets.QStatusBar(MainWindow)
            self.statusbar.setObjectName("statusbar")
            MainWindow.setStatusBar(self.statusbar)

                self.retranslateUi(MainWindow)
                QtCore.QMetaObject.connectSlotsByName(MainWindow)
            
            def retranslateUi(self, MainWindow):
                _translate = QtCore.QCoreApplication.translate
                MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
                self.label.setText(_translate("MainWindow", "Engine name"))
                self.label_2.setText(_translate("MainWindow", "Component"))
                self.pushButton.setText(_translate("MainWindow", "Search"))
                self.groupBox.setTitle(_translate("MainWindow", "Inputs"))
                self.label_3.setText(_translate("MainWindow", "Drwaings"))
                self.label_4.setText(_translate("MainWindow", "Books"))
                self.label_5.setText(_translate("MainWindow", "Files"))
                self.pushButton_2.setText(_translate("MainWindow", "Locate"))
                self.pushButton_3.setText(_translate("MainWindow", "Locate"))
                self.pushButton_4.setText(_translate("MainWindow", "Locate"))
            

            if name == "main":
            import sys
            app = QtWidgets.QApplication(sys.argv)
            MainWindow = QtWidgets.QMainWindow()
            ui = Ui_MainWindow()
            ui.setupUi(MainWindow)
            MainWindow.show()
            sys.exit(app.exec_())

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @saia Please format your code properly, especially if you use Python as indentation is part of the syntax.

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            S 2 Replies Last reply
            0
            • jsulmJ jsulm

              @saia Please format your code properly, especially if you use Python as indentation is part of the syntax.

              S Offline
              S Offline
              saia
              wrote on last edited by
              #6

              @jsulm That is just converted from ui to py file.. it is working fine.. Actually I designed the GUI in QT designer and then converted here.

              jsulmJ 1 Reply Last reply
              0
              • S saia

                @jsulm That is just converted from ui to py file.. it is working fine.. Actually I designed the GUI in QT designer and then converted here.

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @saia Do you think somebody will format all this code correctly if he/she want to understand and run it? You are asking for help, so you should provided needed information in proper way.

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • jsulmJ jsulm

                  @saia Please format your code properly, especially if you use Python as indentation is part of the syntax.

                  S Offline
                  S Offline
                  saia
                  wrote on last edited by
                  #8

                  @jsulm I am sorry jsulm..I will explain you what I am expecting here is.. ScrollArea is working fine for Tablewidget. ScrollArea is not working for groupBox.. In this group box I have added the elements which exceeds the height of the scrollArea. Here it is scrollArea is not working. Suggest me what should I do now.. I converted ui to py file.. When I am pasting here.. it is missing indentation. Suggest me what should I do now..

                  JonBJ 1 Reply Last reply
                  0
                  • S saia

                    @jsulm I am sorry jsulm..I will explain you what I am expecting here is.. ScrollArea is working fine for Tablewidget. ScrollArea is not working for groupBox.. In this group box I have added the elements which exceeds the height of the scrollArea. Here it is scrollArea is not working. Suggest me what should I do now.. I converted ui to py file.. When I am pasting here.. it is missing indentation. Suggest me what should I do now..

                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by JonB
                    #9

                    @saia
                    When you paste blocks of code look at the "toolbar" and hover the icons to find Code. It looks like </>. Or just put line of ``` (3 backticks) above and below any blocks of code text.

                    S 1 Reply Last reply
                    0
                    • JonBJ JonB

                      @saia
                      When you paste blocks of code look at the "toolbar" and hover the icons to find Code. It looks like </>. Or just put line of ``` (3 backticks) above and below any blocks of code text.

                      S Offline
                      S Offline
                      saia
                      wrote on last edited by
                      #10

                      @JonB Thanks for your quick response.. I got the answer now.. My approach here is when we add the group box inside the QscrollArea. we have to give the minimum height which should be greater than the QScrollArea then automatically we will get the verticalscrollBar..

                      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