15 #include <QDialogButtonBox>
16 #include <QPushButton>
18 #include <QVBoxLayout>
31 const auto constPanels = panels;
54 if (
QgsPanelWidget *panel = qobject_cast< QgsPanelWidget * >( p ) )
57 if ( p->window() == p )
64 p = p->parentWidget();
91 QDialog *dlg =
new QDialog();
92 QString key = QStringLiteral(
"/UI/paneldialog/%1" ).arg( panel->
panelTitle() );
94 dlg->restoreGeometry( settings.
value( key ).toByteArray() );
96 dlg->setLayout(
new QVBoxLayout() );
97 dlg->layout()->addWidget( panel );
98 QDialogButtonBox *buttonBox =
new QDialogButtonBox( QDialogButtonBox::Ok );
99 connect( buttonBox, &QDialogButtonBox::accepted, dlg, &QDialog::accept );
100 dlg->layout()->addWidget( buttonBox );
102 settings.
setValue( key, dlg->saveGeometry() );
114 if ( event->key() == Qt::Key_Escape )
120 QWidget::keyPressEvent( event );
128 this->setLayout(
new QVBoxLayout() );
129 this->layout()->setContentsMargins( 0, 0, 0, 0 );
130 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.