DiagramDesigner/source/graphicElementsPanel.cpp

29 lines
963 B
C++

#include "graphicElementsPanel.h"
#include "ui_graphicElementsPanel.h"
GraphicElementsPanel::GraphicElementsPanel(QWidget *parent)
: QWidget(parent)
, ui(new Ui::graphicElementsPanel)
{
ui->setupUi(this);
ui->pushBtn_rect->setProperty("shap",GIT_rect);
connect(ui->pushBtn_rect, SIGNAL(clicked()), this, SLOT(onBtnClicked_GraphicsItem()));
ui->pushBtn_roundRect->setProperty("shap",GIT_roundRect);
connect(ui->pushBtn_roundRect, SIGNAL(clicked()), this, SLOT(onBtnClicked_GraphicsItem()));
ui->pushBtn_polygon->setProperty("shap",GIT_polygon);
connect(ui->pushBtn_polygon, SIGNAL(clicked()), this, SLOT(onBtnClicked_GraphicsItem()));
}
GraphicElementsPanel::~GraphicElementsPanel()
{
delete ui;
}
void GraphicElementsPanel::onBtnClicked_GraphicsItem()
{
QObject* pObject = QObject::sender();
GraphicsItemType itetType = (GraphicsItemType)pObject->property("shap").toInt();
emit addGraphicsItem(itetType);
}