DiagramDesigner/diagramCavas/source/propertyDialog.cpp

37 lines
756 B
C++
Raw Normal View History

2026-04-08 14:17:47 +08:00
#include "propertyDialog.h"
#include <QVBoxLayout>
#include <QKeyEvent>
PropertyDlg::PropertyDlg(QWidget *parent)
: QDialog(parent)
2026-04-24 17:14:45 +08:00
,_curWidget(nullptr)
2026-04-08 14:17:47 +08:00
{
setWindowTitle("属性显示");
setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint );
_layout = new QVBoxLayout(this);
_layout->setContentsMargins(0, 0, 0, 0);
setMinimumSize(300, 500);
}
PropertyDlg::~PropertyDlg()
{
2026-04-24 17:14:45 +08:00
if(_curWidget)
removeContent(_curWidget);
2026-04-08 14:17:47 +08:00
}
void PropertyDlg::setContent(QWidget* content)
{
2026-04-24 17:14:45 +08:00
if(content){
if(_layout->count() == 0)
_layout->addWidget(content);
_curWidget = content;
}
2026-04-08 14:17:47 +08:00
}
void PropertyDlg::removeContent(QWidget* content)
{
if(content)
_layout->removeWidget(content);
}