34 lines
684 B
C++
34 lines
684 B
C++
#include "runtimeDialog.h"
|
|
#include <QVBoxLayout>
|
|
#include <QKeyEvent>
|
|
|
|
RuntimeDialog::RuntimeDialog(QWidget *parent)
|
|
: QDialog(parent)
|
|
,_pContent(nullptr)
|
|
{
|
|
_layout = new QVBoxLayout(this);
|
|
_layout->setContentsMargins(0, 0, 0, 0);
|
|
}
|
|
|
|
void RuntimeDialog::keyPressEvent(QKeyEvent* event) {
|
|
if (event->key() == Qt::Key_Escape) {
|
|
emit exitRuntime();
|
|
hide();
|
|
}
|
|
}
|
|
|
|
void RuntimeDialog::setContent(QWidget* content)
|
|
{
|
|
if(content)
|
|
_layout->addWidget(content);
|
|
_pContent = content;
|
|
}
|
|
|
|
void RuntimeDialog::removeContent(QWidget* content)
|
|
{
|
|
if(content){
|
|
if(_layout->count())
|
|
_layout->removeWidget(content);
|
|
}
|
|
}
|