15#include <QDialogButtonBox>
31 const auto constPanels = panels;
59 if (
QgsPanelWidget *panel = qobject_cast< QgsPanelWidget * >( p ) )
62 if ( p->window() == p )
69 p = p->parentWidget();
96 QDialog *dlg =
new QDialog();
97 const QString key = QStringLiteral(
"/UI/paneldialog/%1" ).arg( panel->
panelTitle() );
99 dlg->restoreGeometry( settings.
value( key ).toByteArray() );
101 dlg->setLayout(
new QVBoxLayout() );
102 dlg->layout()->addWidget( panel );
103 QDialogButtonBox *buttonBox =
new QDialogButtonBox( QDialogButtonBox::Ok );
104 connect( buttonBox, &QDialogButtonBox::accepted, dlg, &QDialog::accept );
105 dlg->layout()->addWidget( buttonBox );
107 settings.
setValue( key, dlg->saveGeometry() );
119 if ( event->key() == Qt::Key_Escape )
125 QWidget::keyPressEvent( event );
133 this->setLayout(
new QVBoxLayout() );
134 this->layout()->setContentsMargins( 0, 0, 0, 0 );
135 this->layout()->addWidget(
widget );
This class is a composition of two QSettings instances:
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
void setValue(const QString &key, const QVariant &value, QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.