Skip to content

Commit

Permalink
Fix 3d tab is not activated when reopening vector layer properties
Browse files Browse the repository at this point in the history
Fixes #35011
  • Loading branch information
nyalldawson committed Jun 9, 2020
1 parent 0f3525d commit 3c0ecbf
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
7 changes: 7 additions & 0 deletions python/gui/auto_generated/qgsoptionsdialogbase.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ Restore the base ui.
Sometimes useful to do at end of subclass's constructor.

:param title: the window title (it does not need to be defined if previously given to initOptionsBase();
%End

void restoreLastPage();
%Docstring
Refocus the active tab from the last time the dialog was shown.

.. versionadded:: 3.14
%End

void resizeAlltabs( int index );
Expand Down
2 changes: 2 additions & 0 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15475,6 +15475,8 @@ void QgisApp::showLayerProperties( QgsMapLayer *mapLayer, const QString &page )

if ( !page.isEmpty() )
vectorLayerPropertiesDialog->setCurrentPage( page );
else
vectorLayerPropertiesDialog->restoreLastPage();

mMapStyleWidget->blockUpdates( true );
if ( vectorLayerPropertiesDialog->exec() )
Expand Down
12 changes: 9 additions & 3 deletions src/gui/qgsoptionsdialogbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,15 @@ void QgsOptionsDialogBase::restoreOptionsBaseUi( const QString &title )
mOptListWidget->setMaximumWidth(
mSettings->value( QStringLiteral( "/Windows/%1/splitState" ).arg( mOptsKey ) ).isNull() ? 150 : 16777215 );
mOptSplitter->restoreState( mSettings->value( QStringLiteral( "/Windows/%1/splitState" ).arg( mOptsKey ) ).toByteArray() );

restoreLastPage();

// get rid of annoying outer focus rect on Mac
mOptListWidget->setAttribute( Qt::WA_MacShowFocusRect, false );
}

void QgsOptionsDialogBase::restoreLastPage()
{
int curIndx = mSettings->value( QStringLiteral( "/Windows/%1/tab" ).arg( mOptsKey ), 0 ).toInt();

// if the last used tab is out of range or not enabled display the first enabled one
Expand All @@ -204,9 +213,6 @@ void QgsOptionsDialogBase::restoreOptionsBaseUi( const QString &title )
mOptStackedWidget->setCurrentIndex( curIndx );
mOptListWidget->setCurrentRow( curIndx );
}

// get rid of annoying outer focus rect on Mac
mOptListWidget->setAttribute( Qt::WA_MacShowFocusRect, false );
}

void QgsOptionsDialogBase::resizeAlltabs( int index )
Expand Down
7 changes: 7 additions & 0 deletions src/gui/qgsoptionsdialogbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ class GUI_EXPORT QgsOptionsDialogBase : public QDialog
*/
void restoreOptionsBaseUi( const QString &title = QString() );

/**
* Refocus the active tab from the last time the dialog was shown.
*
* \since QGIS 3.14
*/
void restoreLastPage();

/**
* Resizes all tabs when the dialog is resized
* \param index current tab index
Expand Down

0 comments on commit 3c0ecbf

Please sign in to comment.