qsizepolicy

QToolButton with text: Overwrite minimal height to minic regular button height

爱⌒轻易说出口 提交于 2019-12-24 18:00:54
问题 I am displaying QToolButtons with icon plus text ( Qt::ToolButtonTextBesideIcon ) outside of a tool bar. Each button has a QAction associated with it which determines the used icon and the displayed text. All those buttons are placed inside a QGridLayout. So far so good. Unfortunately, it looks like that as soon as you add a QAction to a QToolButton, Qt automatically decides to shrink it down to the minimal size, which is not what I want given my QGridLayout. I used the following lines to

Resize QDialog at a runtime

左心房为你撑大大i 提交于 2019-12-18 13:34:19
问题 I have a QDialog subclass containing some options of my application. Some of the options are core, the other are advanced, so I decided to put them into separeted checkable QGroupBox. I want my dialog to shrink verticaly when the user checked off advanced options box, but I can't find the way to do it properly - the dialog size stays exactle the same I set dialog's size policy to Expanding , tried to call adjustSize() and tried to call resize() method - nothing helps. I can't resize

Qt: HBoxLayout - stop MainWindow from resizing to contents

这一生的挚爱 提交于 2019-12-11 10:03:36
问题 It seems most people are asking how to make their QMainWindow resize to its contents - I have the opposite problem, my MainWindow does resize and I don't know why. When I set my QLabel to a longer text, my mainwindow suddenly gets bigger, and I can't find out why that happens. The following example code basically contains: A QMainWindow A QWidget as central widget A QVBoxLayout as a child of that A LabelBar inside that. The LabelBar is a QWidget which in turn contains: A QHBoxLayout Two

Resizing Qt Widgets based on Window size

不问归期 提交于 2019-12-11 04:18:22
问题 I have certain Qt widgets inserted into QLayouts that are children of a Qt Window. I am trying to add a suggested size that the widgets need to be initialized with. I would also like Qt to resize the widgets proportional to what the Qt Window was resized. Additionally I would like to set an aspect ratio to the widgets that must be honored. However, the only way I can do so is using setFixedSize(). Though this widget cannot be rescaled with the window. Any suggestions?? EDIT: I tried

Resize QDialog at a runtime

瘦欲@ 提交于 2019-11-30 09:45:25
I have a QDialog subclass containing some options of my application. Some of the options are core, the other are advanced, so I decided to put them into separeted checkable QGroupBox. I want my dialog to shrink verticaly when the user checked off advanced options box, but I can't find the way to do it properly - the dialog size stays exactle the same I set dialog's size policy to Expanding , tried to call adjustSize() and tried to call resize() method - nothing helps. I can't resize programmaticaly dialog to be smaller then it's current size (it only can become larger). At the same time, it is