diff --git a/python/PyQt6/gui/auto_additions/qgsnewhttpconnection.py b/python/PyQt6/gui/auto_additions/qgsnewhttpconnection.py index ed94178ba9c..cf793dd4d7a 100644 --- a/python/PyQt6/gui/auto_additions/qgsnewhttpconnection.py +++ b/python/PyQt6/gui/auto_additions/qgsnewhttpconnection.py @@ -29,6 +29,6 @@ QgsNewHttpConnection.Flag.__and__ = lambda flag1, flag2: _force_int(flag1) & _fo QgsNewHttpConnection.Flag.__or__ = lambda flag1, flag2: QgsNewHttpConnection.Flag(_force_int(flag1) | _force_int(flag2)) try: QgsNewHttpConnection.__virtual_methods__ = ['validate', 'wfsSettingsKey', 'wmsSettingsKey'] - QgsNewHttpConnection.__overridden_methods__ = ['accept'] + QgsNewHttpConnection.__overridden_methods__ = ['accept', 'showEvent'] except (NameError, AttributeError): pass diff --git a/python/PyQt6/gui/auto_generated/qgsnewhttpconnection.sip.in b/python/PyQt6/gui/auto_generated/qgsnewhttpconnection.sip.in index 1b439dfc3e2..9a5f7697f51 100644 --- a/python/PyQt6/gui/auto_generated/qgsnewhttpconnection.sip.in +++ b/python/PyQt6/gui/auto_generated/qgsnewhttpconnection.sip.in @@ -123,6 +123,12 @@ Returns the QSettings key for WMS related settings for the connection. %Docstring Triggers a resync of the GUI widgets for the service specific settings (i.e. WFS and WMS related settings). +%End + + virtual void showEvent( QShowEvent *event ); + +%Docstring +Adjust height of dialog to fit the content. %End }; diff --git a/python/gui/auto_additions/qgsnewhttpconnection.py b/python/gui/auto_additions/qgsnewhttpconnection.py index decce24bfbc..0f9fe5ca3a2 100644 --- a/python/gui/auto_additions/qgsnewhttpconnection.py +++ b/python/gui/auto_additions/qgsnewhttpconnection.py @@ -1,6 +1,6 @@ # The following has been generated automatically from src/gui/qgsnewhttpconnection.h try: QgsNewHttpConnection.__virtual_methods__ = ['validate', 'wfsSettingsKey', 'wmsSettingsKey'] - QgsNewHttpConnection.__overridden_methods__ = ['accept'] + QgsNewHttpConnection.__overridden_methods__ = ['accept', 'showEvent'] except (NameError, AttributeError): pass diff --git a/python/gui/auto_generated/qgsnewhttpconnection.sip.in b/python/gui/auto_generated/qgsnewhttpconnection.sip.in index 2f6449ccd22..9c1d43b0550 100644 --- a/python/gui/auto_generated/qgsnewhttpconnection.sip.in +++ b/python/gui/auto_generated/qgsnewhttpconnection.sip.in @@ -123,6 +123,12 @@ Returns the QSettings key for WMS related settings for the connection. %Docstring Triggers a resync of the GUI widgets for the service specific settings (i.e. WFS and WMS related settings). +%End + + virtual void showEvent( QShowEvent *event ); + +%Docstring +Adjust height of dialog to fit the content. %End }; diff --git a/src/gui/qgsnewhttpconnection.cpp b/src/gui/qgsnewhttpconnection.cpp index e705e518801..3d31c30f009 100644 --- a/src/gui/qgsnewhttpconnection.cpp +++ b/src/gui/qgsnewhttpconnection.cpp @@ -178,10 +178,6 @@ QgsNewHttpConnection::QgsNewHttpConnection( QWidget *parent, ConnectionTypes typ mAuthGroupBox->hide(); mGroupBox->layout()->removeWidget( mAuthGroupBox ); } - // Adjust height - const int w = width(); - adjustSize(); - resize( w, height() ); connect( txtName, &QLineEdit::textChanged, this, &QgsNewHttpConnection::nameChanged ); connect( txtUrl, &QLineEdit::textChanged, this, &QgsNewHttpConnection::urlChanged ); @@ -368,6 +364,12 @@ void QgsNewHttpConnection::updateServiceSpecificSettings() txtPageSize->setText( QgsOwsConnection::settingsPagesize->value( detailsParameters ) ); } +void QgsNewHttpConnection::showEvent(QShowEvent* event) +{ + QDialog::showEvent( event ); + adjustSize(); +} + QUrl QgsNewHttpConnection::urlTrimmed() const { QUrl url( txtUrl->text().trimmed() ); diff --git a/src/gui/qgsnewhttpconnection.h b/src/gui/qgsnewhttpconnection.h index ab6a54337b3..f330684e41f 100644 --- a/src/gui/qgsnewhttpconnection.h +++ b/src/gui/qgsnewhttpconnection.h @@ -200,6 +200,11 @@ class GUI_EXPORT QgsNewHttpConnection : public QDialog, private Ui::QgsNewHttpCo */ void updateServiceSpecificSettings(); + /** + * Adjust height of dialog to fit the content. + */ + void showEvent( QShowEvent *event ) override; + private: ConnectionTypes mTypes = ConnectionWms;