21#include <QDialogButtonBox>
26#include "moc_qgspanelwidget.cpp"
28using namespace Qt::StringLiterals;
37 const auto constPanels = panels;
68 if ( p->window() == p )
75 p = p->parentWidget();
102 QDialog *dlg =
new QDialog();
103 const QString key = u
"/UI/paneldialog/%1"_s.arg( panel->
panelTitle() );
105 dlg->restoreGeometry( settings.
value( key ).toByteArray() );
107 dlg->setLayout(
new QVBoxLayout() );
108 dlg->layout()->addWidget( panel );
109 QDialogButtonBox *buttonBox =
new QDialogButtonBox( QDialogButtonBox::Ok );
110 connect( buttonBox, &QDialogButtonBox::accepted, dlg, &QDialog::accept );
111 dlg->layout()->addWidget( buttonBox );
113 settings.
setValue( key, dlg->saveGeometry() );
125 if ( event->key() == Qt::Key_Escape )
131 QWidget::keyPressEvent( event );
139 this->setLayout(
new QVBoxLayout() );
140 this->layout()->setContentsMargins( 0, 0, 0, 0 );
141 this->layout()->addWidget(
widget );
Stores settings for use within QGIS.
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.