Width of QHBoxLayout is restricted in QDialog
-
Hello,
I'am using a
QDialogwindow that opens if a user press a special key or interacts with the menu bar.I create a class that inherits
QDialogand create a instance ofQHBoxLayout. If I use the horizontal layout I can see that the width of the layout is cropped /restricted.
m_hLayout->addWidget(m_one); m_hLayout->addWidget(m_two); m_hLayout->addWidget(m_three); m_hLayout->addWidget(m_four); //m_groupMag->setFixedSize(500, 700); //adding a fixed size shows the button with the full size. m_groupMag->setLayout(m_hLayout);One way to correct this is to set the size of the
QWidgetthat sets the layout to a fixed size. Nevertheless I think that is can not be the correct way.
If I use theQVBoxLayoutthere is no problem with any restriction. The elements are shown with the full size vertically.The dialog window opens with the
showMaximized()function.
Any idea what the problem is?Kind regards.
-
Hello,
I'am using a
QDialogwindow that opens if a user press a special key or interacts with the menu bar.I create a class that inherits
QDialogand create a instance ofQHBoxLayout. If I use the horizontal layout I can see that the width of the layout is cropped /restricted.
m_hLayout->addWidget(m_one); m_hLayout->addWidget(m_two); m_hLayout->addWidget(m_three); m_hLayout->addWidget(m_four); //m_groupMag->setFixedSize(500, 700); //adding a fixed size shows the button with the full size. m_groupMag->setLayout(m_hLayout);One way to correct this is to set the size of the
QWidgetthat sets the layout to a fixed size. Nevertheless I think that is can not be the correct way.
If I use theQVBoxLayoutthere is no problem with any restriction. The elements are shown with the full size vertically.The dialog window opens with the
showMaximized()function.
Any idea what the problem is?Kind regards.
@makopo said in Width of QHBoxLayout is restricted in QDialog:
m_groupMag
Is this widget also in a layout?
-
@makopo said in Width of QHBoxLayout is restricted in QDialog:
m_groupMag
Is this widget also in a layout?
-
@makopo Then m_groupMag will not resize or fill free space. Put it also in the layout of its parent.