15 #include <QDialogButtonBox>
16 #include <QPushButton>
18 #include <QVBoxLayout>
20 #include "qgssettings.h"
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 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 );