15 #include <QDialogButtonBox> 16 #include <QPushButton> 18 #include <QVBoxLayout> 53 if (
QgsPanelWidget *panel = qobject_cast< QgsPanelWidget * >( p ) )
56 if ( p->window() == p )
63 p = p->parentWidget();
80 QDialog *dlg =
new QDialog();
81 QString key = QStringLiteral(
"/UI/paneldialog/%1" ).arg( panel->
panelTitle() );
83 dlg->restoreGeometry( settings.
value( key ).toByteArray() );
85 dlg->setLayout(
new QVBoxLayout() );
86 dlg->layout()->addWidget( panel );
87 QDialogButtonBox *buttonBox =
new QDialogButtonBox( QDialogButtonBox::Ok );
88 connect( buttonBox, &QDialogButtonBox::accepted, dlg, &QDialog::accept );
89 dlg->layout()->addWidget( buttonBox );
91 settings.
setValue( key, dlg->saveGeometry() );
103 if ( event->key() == Qt::Key_Escape )
113 this->setLayout(
new QVBoxLayout() );
114 this->layout()->setContentsMargins( 0, 0, 0, 0 );
115 this->layout()->addWidget( widget );
This class is a composition of two QSettings instances:
void setValue(const QString &key, const QVariant &value, const QgsSettings::Section section=QgsSettings::NoSection)
Sets the value of setting key to value.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), const Section section=NoSection) const
Returns the value for setting key.