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();
81 QDialog *dlg =
new QDialog();
82 QString key = QStringLiteral(
"/UI/paneldialog/%1" ).arg( panel->
panelTitle() );
84 dlg->restoreGeometry( settings.
value( key ).toByteArray() );
86 dlg->setLayout(
new QVBoxLayout() );
87 dlg->layout()->addWidget( panel );
88 QDialogButtonBox *buttonBox =
new QDialogButtonBox( QDialogButtonBox::Ok );
89 connect( buttonBox, &QDialogButtonBox::accepted, dlg, &QDialog::accept );
90 dlg->layout()->addWidget( buttonBox );
92 settings.
setValue( key, dlg->saveGeometry() );
104 if ( event->key() == Qt::Key_Escape )
114 this->setLayout(
new QVBoxLayout() );
115 this->layout()->setContentsMargins( 0, 0, 0, 0 );
116 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.