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.
-
-
@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?
-
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.
-
@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_()) -
@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..
-
@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..