3

When I open a custom attribute form for a feature in Qgis it always gets resized to the default size of the original Qgis attribute form. I've tried to set the sizePolicy in QT Designer to Fixed instead of Preferred to prohibit this, but it didn't help.

If I resize the form when I open it by clicking on a feature in Qgis and then resize it, it still opens with Qgis default height/width when I click the next feature.

Is there any kind of setting to tell Qgis to use the size that the form is designed to?

(Running Qgis 1.8.0, QT Designer 4.8.4 on Windows 7)

  • 1
    It's a bug in QGIS. It's fixed in 2.0. – Nathan W Jul 16 '13 at 8:41
2

This was a bug in 1.8. It has now been fixed in 2.0. Any custom forms will have their designer sizes respected.

  • 1
    Do you know if this is still the case for QGIS 2.4? I seem to be having resize issues again. – user25976 Jul 8 '14 at 19:00
0

The maximum and the fixed size are not respected. It's a bug but we can use a custom script to fix it:

# -*- 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)

source:qgis issue 11517

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.