Skip to content

Commit

Permalink
Use a QgsScrollArea when adding or inserting pages
Browse files Browse the repository at this point in the history
  • Loading branch information
uclaros authored and nyalldawson committed Feb 1, 2024
1 parent 795734f commit ae6abed
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/gui/qgsoptionsdialogbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "qgsguiutils.h"
#include "qgsapplication.h"
#include "qgsvariantutils.h"
#include "qgsscrollarea.h"

QgsOptionsDialogBase::QgsOptionsDialogBase( const QString &settingsKey, QWidget *parent, Qt::WindowFlags fl, QgsSettings *settings )
: QDialog( parent, fl )
Expand Down Expand Up @@ -396,10 +397,15 @@ void QgsOptionsDialogBase::addPage( const QString &title, const QString &tooltip
mOptTreeModel->appendRow( item );
}

QgsScrollArea *scrollArea = new QgsScrollArea();
scrollArea->setWidgetResizable( true );
scrollArea->setFrameShape( QFrame::NoFrame );
scrollArea->setWidget( widget );

if ( newPage < 0 )
mOptStackedWidget->addWidget( widget );
mOptStackedWidget->addWidget( scrollArea );
else
mOptStackedWidget->insertWidget( newPage, widget );
mOptStackedWidget->insertWidget( newPage, scrollArea );
}

void QgsOptionsDialogBase::insertPage( const QString &title, const QString &tooltip, const QIcon &icon, QWidget *widget, const QString &before, const QStringList &path, const QString &key )
Expand Down Expand Up @@ -492,7 +498,11 @@ void QgsOptionsDialogBase::insertPage( const QString &title, const QString &tool
}
}

mOptStackedWidget->insertWidget( page, widget );
QgsScrollArea *scrollArea = new QgsScrollArea();
scrollArea->setWidgetResizable( true );
scrollArea->setFrameShape( QFrame::NoFrame );
scrollArea->setWidget( widget );
mOptStackedWidget->insertWidget( page, scrollArea );
return;
}
}
Expand Down

0 comments on commit ae6abed

Please sign in to comment.