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. Groupbox occupies Whole Space on QMainWindow
Forum Updated to NodeBB v4.3 + New Features

Groupbox occupies Whole Space on QMainWindow

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 360 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.
  • A Offline
    A Offline
    ArunBm
    wrote on last edited by
    #1

    Hi
    following is my piece of Code.
    I want to add Group box to QMainWindow.
    With my code the groupbox Whole QMainWindow.
    How do I place the GroupBox to a particular place

    
    class FormWidget(QtWidgets.QWidget):    
        def __init__(self, parent):        
            super(FormWidget, self).__init__(parent)
            self.layout = QtWidgets.QVBoxLayout(self)
            self.GroupBox = QtWidgets.QGroupBox("GroupBox")
            self.layout.addWidget(self.GroupBox)
            self.GroupBox.setGeometry(0, 0, 180, 320)
            self.setLayout(self.layout)
    
    
    class mainWindow(QtWidgets.QMainWindow):
        def __init__(self):        
            super().__init__()         
            uic.loadUi('ui/main.ui',self)     
            self.initUi()
            self.form_widget = FormWidget(self)
            self.setCentralWidget(self.form_widget)
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What kind of particular place do you have in mind ?

      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
      • A Offline
        A Offline
        ArunBm
        wrote on last edited by
        #3

        hi

        My intention was to show two groupbox on MainWindow...Then I read somewhere u can place only one widget on CMainWindow using setCentralWidget...

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

          That's correct there's one central widget but it can be composed of many widgets. Then you can also use the docker widgets.

          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
          1

          • Login

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