Promote class VTableGraphicsView in Qt Designer.
--HG-- branch : develop
This commit is contained in:
parent
dc8d715814
commit
00a8242349
|
@ -56,26 +56,27 @@ TableWindow::TableWindow(QWidget *parent)
|
||||||
ui->statusBar->addWidget(numberDetal);
|
ui->statusBar->addWidget(numberDetal);
|
||||||
ui->statusBar->addWidget(colission);
|
ui->statusBar->addWidget(colission);
|
||||||
outItems = collidingItems = false;
|
outItems = collidingItems = false;
|
||||||
//sceneRect = QRectF(0, 0, qApp->toPixel(203), qApp->toPixel(287));
|
|
||||||
sceneRect = QRectF(0, 0, qApp->toPixel(823, Unit::Mm), qApp->toPixel(1171, Unit::Mm));
|
sceneRect = QRectF(0, 0, qApp->toPixel(823, Unit::Mm), qApp->toPixel(1171, Unit::Mm));
|
||||||
tableScene = new QGraphicsScene(sceneRect);
|
tableScene = new QGraphicsScene(sceneRect);
|
||||||
QBrush brush;
|
QBrush brush;
|
||||||
brush.setStyle( Qt::SolidPattern );
|
brush.setStyle( Qt::SolidPattern );
|
||||||
brush.setColor( QColor( Qt::gray ) );
|
brush.setColor( QColor( Qt::gray ) );
|
||||||
tableScene->setBackgroundBrush( brush );
|
tableScene->setBackgroundBrush( brush );
|
||||||
VTableGraphicsView* view = new VTableGraphicsView(tableScene);
|
|
||||||
view->fitInView(view->scene()->sceneRect(), Qt::KeepAspectRatio);
|
ui->view->setScene(tableScene);
|
||||||
ui->horizontalLayout->addWidget(view);
|
ui->view->fitInView(ui->view->scene()->sceneRect(), Qt::KeepAspectRatio);
|
||||||
connect(ui->actionTurn, &QAction::triggered, view, &VTableGraphicsView::rotateItems);
|
ui->horizontalLayout->addWidget(ui->view);
|
||||||
connect(ui->actionMirror, &QAction::triggered, view, &VTableGraphicsView::MirrorItem);
|
connect(tableScene, &QGraphicsScene::selectionChanged, ui->view, &VTableGraphicsView::selectionChanged);
|
||||||
connect(ui->actionZoomIn, &QAction::triggered, view, &VTableGraphicsView::ZoomIn);
|
connect(ui->actionTurn, &QAction::triggered, ui->view, &VTableGraphicsView::rotateItems);
|
||||||
connect(ui->actionZoomOut, &QAction::triggered, view, &VTableGraphicsView::ZoomOut);
|
connect(ui->actionMirror, &QAction::triggered, ui->view, &VTableGraphicsView::MirrorItem);
|
||||||
|
connect(ui->actionZoomIn, &QAction::triggered, ui->view, &VTableGraphicsView::ZoomIn);
|
||||||
|
connect(ui->actionZoomOut, &QAction::triggered, ui->view, &VTableGraphicsView::ZoomOut);
|
||||||
connect(ui->actionStop, &QAction::triggered, this, &TableWindow::StopTable);
|
connect(ui->actionStop, &QAction::triggered, this, &TableWindow::StopTable);
|
||||||
connect(ui->actionSave, &QAction::triggered, this, &TableWindow::saveScene);
|
connect(ui->actionSave, &QAction::triggered, this, &TableWindow::saveScene);
|
||||||
connect(ui->actionNext, &QAction::triggered, this, &TableWindow::GetNextDetail);
|
connect(ui->actionNext, &QAction::triggered, this, &TableWindow::GetNextDetail);
|
||||||
connect(ui->actionAdd, &QAction::triggered, this, &TableWindow::AddLength);
|
connect(ui->actionAdd, &QAction::triggered, this, &TableWindow::AddLength);
|
||||||
connect(ui->actionRemove, &QAction::triggered, this, &TableWindow::RemoveLength);
|
connect(ui->actionRemove, &QAction::triggered, this, &TableWindow::RemoveLength);
|
||||||
connect(view, &VTableGraphicsView::itemChect, this, &TableWindow::itemChect);
|
connect(ui->view, &VTableGraphicsView::itemChect, this, &TableWindow::itemChect);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -199,6 +200,7 @@ void TableWindow::showEvent ( QShowEvent * event )
|
||||||
{
|
{
|
||||||
QMainWindow::showEvent(event);
|
QMainWindow::showEvent(event);
|
||||||
moveToCenter();
|
moveToCenter();
|
||||||
|
ui->view->fitInView(ui->view->scene()->sceneRect(), Qt::KeepAspectRatio);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -211,8 +213,8 @@ void TableWindow::StopTable()
|
||||||
tableScene->clear();
|
tableScene->clear();
|
||||||
delete listOutItems;
|
delete listOutItems;
|
||||||
listDetails.clear();
|
listDetails.clear();
|
||||||
//sceneRect = QRectF(0, 0, 230*resol/25.9, 327*resol/25.9);
|
|
||||||
sceneRect = QRectF(0, 0, qApp->toPixel(823, Unit::Mm), qApp->toPixel(1171, Unit::Mm));
|
sceneRect = QRectF(0, 0, qApp->toPixel(823, Unit::Mm), qApp->toPixel(1171, Unit::Mm));
|
||||||
|
tableScene->setSceneRect(sceneRect);
|
||||||
emit closed();
|
emit closed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,9 @@
|
||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>9</number>
|
<number>9</number>
|
||||||
</property>
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="VTableGraphicsView" name="view"/>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QToolBar" name="toolBar">
|
<widget class="QToolBar" name="toolBar">
|
||||||
|
@ -198,6 +201,13 @@
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>VTableGraphicsView</class>
|
||||||
|
<extends>QGraphicsView</extends>
|
||||||
|
<header>vtablegraphicsview.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="share/resources/icon.qrc"/>
|
<include location="share/resources/icon.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -36,11 +36,10 @@
|
||||||
#include "../options.h"
|
#include "../options.h"
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VTableGraphicsView::VTableGraphicsView(QGraphicsScene* pScene, QWidget *parent)
|
VTableGraphicsView::VTableGraphicsView(QWidget *parent)
|
||||||
:QGraphicsView(pScene, parent)
|
:QGraphicsView(parent)
|
||||||
{
|
{
|
||||||
QGraphicsView::setResizeAnchor(QGraphicsView::AnchorUnderMouse);
|
QGraphicsView::setResizeAnchor(QGraphicsView::AnchorUnderMouse);
|
||||||
connect(pScene, &QGraphicsScene::selectionChanged, this, &VTableGraphicsView::selectionChanged);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -43,7 +43,7 @@ public:
|
||||||
*/
|
*/
|
||||||
enum typeMove_e { Left, Right, Up, Down };
|
enum typeMove_e { Left, Right, Up, Down };
|
||||||
|
|
||||||
VTableGraphicsView(QGraphicsScene* pScene, QWidget *parent = nullptr);
|
VTableGraphicsView(QWidget *parent = nullptr);
|
||||||
signals:
|
signals:
|
||||||
/**
|
/**
|
||||||
* @brief itemChect emit after change selection state detail.
|
* @brief itemChect emit after change selection state detail.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user