37 lines
756 B
C++
37 lines
756 B
C++
#include "propertyDialog.h"
|
|
#include <QVBoxLayout>
|
|
#include <QKeyEvent>
|
|
|
|
PropertyDlg::PropertyDlg(QWidget *parent)
|
|
: QDialog(parent)
|
|
,_curWidget(nullptr)
|
|
{
|
|
setWindowTitle("属性显示");
|
|
setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint );
|
|
_layout = new QVBoxLayout(this);
|
|
_layout->setContentsMargins(0, 0, 0, 0);
|
|
setMinimumSize(300, 500);
|
|
}
|
|
|
|
|
|
PropertyDlg::~PropertyDlg()
|
|
{
|
|
if(_curWidget)
|
|
removeContent(_curWidget);
|
|
}
|
|
|
|
void PropertyDlg::setContent(QWidget* content)
|
|
{
|
|
if(content){
|
|
if(_layout->count() == 0)
|
|
_layout->addWidget(content);
|
|
_curWidget = content;
|
|
}
|
|
}
|
|
|
|
void PropertyDlg::removeContent(QWidget* content)
|
|
{
|
|
if(content)
|
|
_layout->removeWidget(content);
|
|
}
|