It is possible to decrease the width of a QPushButton, I tried with:
<property name = "geometry">
<Rect>
<Width> 21 </ width>
<Height> 21 </ height>
</ Rect>
</ Property>
but it did not work
Thank you also for the previous answer
reduce a button
Moderator: andrew
Forum rules
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
Always indicate your operating system and QCAD version.
Attach drawing files, scripts and screenshots.
Post one question per topic.
-
- Full Member
- Posts: 81
- Joined: Fri Apr 17, 2015 6:40 am
- Location: http://creativitainformaticart.altervista.org
reduce a button
- Attachments
-
- Screenshot_20190926-085636_VNC Viewer.jpg (9.01 KiB) Viewed 5697 times
Re: reduce a button
The button might be in a layout in which case the layout controls the button size.
You should be able to override by setting size policy to fixed:
https://doc.qt.io/qt-5/qwidget.html#siz ... e-policies
You should be able to override by setting size policy to fixed:
https://doc.qt.io/qt-5/qwidget.html#siz ... e-policies
-
- Full Member
- Posts: 81
- Joined: Fri Apr 17, 2015 6:40 am
- Location: http://creativitainformaticart.altervista.org
Re: reduce a button
I tried that:
newIdObj3D = objectFromPath ("MainWindow :: Options :: NewIdObj3D");
//newIdObj3D.resize(21,21);
sizePolicy = QtGui.QSizePolicy (QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed);
newIdObj3D.setSizePolicy (sizePolicy);
newIdObj3D.clicked.connect (function () {presNewIdObj3D ();});
but am I probably wrong?
newIdObj3D = objectFromPath ("MainWindow :: Options :: NewIdObj3D");
//newIdObj3D.resize(21,21);
sizePolicy = QtGui.QSizePolicy (QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed);
newIdObj3D.setSizePolicy (sizePolicy);
newIdObj3D.clicked.connect (function () {presNewIdObj3D ();});
but am I probably wrong?
Re: reduce a button
Please have a look at PropertyEditor.js for an example to set the size policy.
Note that you can search the git repository online (for example for "QSizePolicy .js"). Or you can checkout the repository and search locally. QCAD sources contain lots of JS code with plenty of example code.
Note that you can search the git repository online (for example for "QSizePolicy .js"). Or you can checkout the repository and search locally. QCAD sources contain lots of JS code with plenty of example code.
-
- Full Member
- Posts: 81
- Joined: Fri Apr 17, 2015 6:40 am
- Location: http://creativitainformaticart.altervista.org
Re: reduce a button
ok thank you, I try to arrange myself as much as possible
solved this way:
<Item>
<widget class = "QPushButton" name = "NewIdObj3D">
<property name = "toolTip">
<string> Creates a new 3d shape </string>
</ Property>
<property name = "sizePolicy">
<sizepolicy hsizetype = "Maximum" vsizetype = "Fixed">
<Horstretch> 0 </ horstretch>
<Verstretch> 0 </ verstretch>
</ Sizepolicy>
</ Property>
<property name = "maximumSize">
<Size>
<Width> 21 </ width>
<Height> 16777215 </ height>
</ Size>
</ Property>
<property name = "text">
<String> + </ string>
</ Property>
</ Widget>
</ Item>
solved this way:
<Item>
<widget class = "QPushButton" name = "NewIdObj3D">
<property name = "toolTip">
<string> Creates a new 3d shape </string>
</ Property>
<property name = "sizePolicy">
<sizepolicy hsizetype = "Maximum" vsizetype = "Fixed">
<Horstretch> 0 </ horstretch>
<Verstretch> 0 </ verstretch>
</ Sizepolicy>
</ Property>
<property name = "maximumSize">
<Size>
<Width> 21 </ width>
<Height> 16777215 </ height>
</ Size>
</ Property>
<property name = "text">
<String> + </ string>
</ Property>
</ Widget>
</ Item>
- Attachments
-
- Schermo.jpg (164.65 KiB) Viewed 5507 times