Bug report #11517
Size restrictions of custom forms created in Qt Designer not honored
|Affected QGIS version:||master||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||Yes||Resolution:||fixed/implemented|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||19787|
No matter which "sizePolicy" settings I choose for the forms I create in Qt Designer, the forms get more or less random size in QGIS (both in 2.4 and nightly dev). Even if "sizePolicy" is "Fixed", the size can still be freely changed in QGIS.
To create custom forms in Qt Designer is an extremely cool feature, IMHO. But with the size settings not honored, the forms will look amateurish, if implemented in our clients GIS environment.
Please fix for 2.6. Thanks.
Our QGIS runs on windows 7 64 bit; PostgreSQL 9.2.5 and PostGIS 2.0.3 are running on CentOS 6.5 Final 64 bit.
#4 Updated by Matthias Kuhn about 5 years ago
It was reported quite short before release (actually after the original release date) and is a UX glitch rather than a big issue. -1 for tagging it as a blocker, there are more important issues. I'll take care of it for 2.8 (unless somebody fixes it for 2.6 of course).
Sidenote: In general forms look not too bad if using Qt layouts. And dialog geometries are saved across sessions.
#7 Updated by Alessandro Pasotti about 4 years ago
- Resolution set to worksforme
- Assignee set to Alessandro Pasotti
I cannot reproduce, setting the dialog size policy to Minimum or MinimumExpanding from designer in the UI file works for me, I didn't test other options but I don't see any reason why they should not work.
Can you please provide an example form that does not work?
#10 Updated by Alessandro Pasotti about 4 years ago
- Resolution deleted (
- Status changed from Closed to Reopened
Re-checked and this is indeed a problem since the form is embedded in a dialog and the parent is not set correctly, hence it's not even reachable via init python code.
Patch is almost ready.
#11 Updated by Alessandro Pasotti about 4 years ago
- Status changed from Reopened to In Progress
- Resolution set to fixed/implemented
- Pull Request or Patch supplied changed from No to Yes
Fixed (indirectly) with https://github.com/qgis/QGIS/pull/2449
that makes possible to alter the outer dialog from python code in the form, the following example set the container to a fixed size of 800x600, the resulting form dialog will not be resizeable.
# -*- coding: utf-8 -*- """ QGIS forms can have a Python function that is called when the form is opened. Use this function to add extra logic to your forms. Enter the name of the function in the "Python Init function" field. An example follows: """ from qgis.core import QgsMessageLog from PyQt4.QtGui import QSizePolicy def my_form_open(dialog, layer, feature): QgsMessageLog.logMessage(str(dialog)) dialog.parent().setFixedWidth(800) dialog.parent().setFixedHeight(600) dialog.parent().setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)