Merge with feature
--HG-- branch : develop
This commit is contained in:
commit
0485489b22
|
@ -16,22 +16,19 @@ include(core/core.pri)
|
|||
SOURCES += \
|
||||
$$PWD/main.cpp \
|
||||
$$PWD/mainwindow.cpp \
|
||||
$$PWD/tablewindow.cpp \
|
||||
$$PWD/stable.cpp \
|
||||
$$PWD/version.cpp \
|
||||
$$PWD/options.cpp
|
||||
$$PWD/options.cpp \
|
||||
$$PWD/mainwindowsnogui.cpp
|
||||
|
||||
# Some header files
|
||||
HEADERS += \
|
||||
$$PWD/mainwindow.h \
|
||||
$$PWD/options.h \
|
||||
$$PWD/tablewindow.h \
|
||||
$$PWD/stable.h \
|
||||
$$PWD/version.h
|
||||
$$PWD/version.h \
|
||||
$$PWD/mainwindowsnogui.h
|
||||
|
||||
# Main forms
|
||||
FORMS += \
|
||||
$$PWD/mainwindow.ui \
|
||||
$$PWD/tablewindow.ui
|
||||
|
||||
|
||||
$$PWD/mainwindow.ui
|
||||
|
|
|
@ -2068,14 +2068,14 @@ VSettings *VApplication::getSettings()
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VMainGraphicsScene *VApplication::getCurrentScene() const
|
||||
QGraphicsScene *VApplication::getCurrentScene() const
|
||||
{
|
||||
SCASSERT(currentScene != nullptr);
|
||||
return currentScene;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VApplication::setCurrentScene(VMainGraphicsScene *value)
|
||||
void VApplication::setCurrentScene(QGraphicsScene *value)
|
||||
{
|
||||
currentScene = value;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
class VApplication;// used in define
|
||||
class QUndoStack;
|
||||
class VMainGraphicsView;
|
||||
class VMainGraphicsScene;
|
||||
class VPattern;
|
||||
class QFile;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
|
||||
|
@ -110,8 +109,8 @@ public:
|
|||
void OpenSettings();
|
||||
VSettings *getSettings();
|
||||
|
||||
VMainGraphicsScene *getCurrentScene() const;
|
||||
void setCurrentScene(VMainGraphicsScene *value);
|
||||
QGraphicsScene *getCurrentScene() const;
|
||||
void setCurrentScene(QGraphicsScene *value);
|
||||
|
||||
void setCurrentDocument(VPattern *doc);
|
||||
VPattern *getCurrentDocument()const;
|
||||
|
@ -151,7 +150,7 @@ private:
|
|||
QMap<QString, qmu::QmuTranslation> stDescriptions;
|
||||
QUndoStack *undoStack;
|
||||
VMainGraphicsView *sceneView;
|
||||
VMainGraphicsScene *currentScene;
|
||||
QGraphicsScene *currentScene;
|
||||
QTimer *autoSaveTimer;
|
||||
/**
|
||||
* @brief mainWindow pointer to main window. Usefull if need create modal dialog. Without pointer to main window
|
||||
|
|
|
@ -117,7 +117,8 @@ void DialogAlongLine::ShowVisualization()
|
|||
{
|
||||
if (prepare == false)
|
||||
{
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisToolAlongLine::SetFactor);
|
||||
scene->addItem(line);
|
||||
line->RefreshGeometry();
|
||||
|
|
|
@ -225,7 +225,8 @@ void DialogArc::ShowVisualization()
|
|||
{
|
||||
if (prepare == false)
|
||||
{
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, path, &Visualization::SetFactor);
|
||||
scene->addItem(path);
|
||||
path->RefreshGeometry();
|
||||
|
|
|
@ -126,7 +126,8 @@ void DialogBisector::ShowVisualization()
|
|||
{
|
||||
if (prepare == false)
|
||||
{
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisToolBisector::SetFactor);
|
||||
scene->addItem(line);
|
||||
line->RefreshGeometry();
|
||||
|
|
|
@ -166,7 +166,7 @@ void DialogCurveIntersectAxis::ShowDialog(bool click)
|
|||
if (click)
|
||||
{
|
||||
/*We will ignore click if poinet is in point circle*/
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr);
|
||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(GetBasePointId());
|
||||
QLineF line = QLineF(point->toQPointF(), scene->getScenePos());
|
||||
|
@ -258,7 +258,8 @@ void DialogCurveIntersectAxis::ShowVisualization()
|
|||
if (prepare == false)
|
||||
{
|
||||
//TODO move to parent class!
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisToolCurveIntersectAxis::SetFactor);
|
||||
scene->addItem(line);
|
||||
line->RefreshGeometry();
|
||||
|
|
|
@ -92,7 +92,8 @@ void DialogCutArc::ShowVisualization()
|
|||
{
|
||||
if (prepare == false)
|
||||
{
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, path, &Visualization::SetFactor);
|
||||
scene->addItem(path);
|
||||
path->RefreshGeometry();
|
||||
|
|
|
@ -196,7 +196,8 @@ void DialogCutSpline::ShowVisualization()
|
|||
{
|
||||
if (prepare == false)
|
||||
{
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, path, &Visualization::SetFactor);
|
||||
scene->addItem(path);
|
||||
path->RefreshGeometry();
|
||||
|
|
|
@ -196,7 +196,8 @@ void DialogCutSplinePath::ShowVisualization()
|
|||
{
|
||||
if (prepare == false)
|
||||
{
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, path, &Visualization::SetFactor);
|
||||
scene->addItem(path);
|
||||
path->RefreshGeometry();
|
||||
|
|
|
@ -261,7 +261,7 @@ void DialogEndLine::ShowDialog(bool click)
|
|||
if (click)
|
||||
{
|
||||
/*We will ignore click if poinet is in point circle*/
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr);
|
||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(GetBasePointId());
|
||||
QLineF line = QLineF(point->toQPointF(), scene->getScenePos());
|
||||
|
@ -287,7 +287,8 @@ void DialogEndLine::ShowVisualization()
|
|||
if (prepare == false)
|
||||
{
|
||||
//TODO move to parent class!
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisToolEndLine::SetFactor);
|
||||
scene->addItem(line);
|
||||
line->RefreshGeometry();
|
||||
|
|
|
@ -254,7 +254,8 @@ void DialogHeight::ShowVisualization()
|
|||
{
|
||||
if (prepare == false)
|
||||
{
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisLine::SetFactor);
|
||||
scene->addItem(line);
|
||||
line->RefreshGeometry();
|
||||
|
|
|
@ -145,7 +145,8 @@ void DialogLine::ShowVisualization()
|
|||
{
|
||||
if (prepare == false)
|
||||
{
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisToolLine::SetFactor);
|
||||
scene->addItem(line);
|
||||
line->RefreshGeometry();
|
||||
|
|
|
@ -229,7 +229,8 @@ void DialogLineIntersect::ShowVisualization()
|
|||
{
|
||||
if (prepare == false)
|
||||
{
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisLine::SetFactor);
|
||||
scene->addItem(line);
|
||||
line->RefreshGeometry();
|
||||
|
|
|
@ -187,7 +187,7 @@ void DialogLineIntersectAxis::ShowDialog(bool click)
|
|||
if (click)
|
||||
{
|
||||
/*We will ignore click if poinet is in point circle*/
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr);
|
||||
const QSharedPointer<VPointF> point = data->GeometricObject<VPointF>(GetBasePointId());
|
||||
QLineF line = QLineF(point->toQPointF(), scene->getScenePos());
|
||||
|
@ -322,7 +322,8 @@ void DialogLineIntersectAxis::ShowVisualization()
|
|||
if (prepare == false)
|
||||
{
|
||||
//TODO move to parent class!
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisToolLineIntersectAxis::SetFactor);
|
||||
scene->addItem(line);
|
||||
line->RefreshGeometry();
|
||||
|
|
|
@ -116,7 +116,8 @@ void DialogNormal::ShowVisualization()
|
|||
{
|
||||
if (prepare == false)
|
||||
{
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisLine::SetFactor);
|
||||
scene->addItem(line);
|
||||
line->RefreshGeometry();
|
||||
|
|
|
@ -133,7 +133,8 @@ void DialogPointOfContact::ShowVisualization()
|
|||
{
|
||||
if (prepare == false)
|
||||
{
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisLine::SetFactor);
|
||||
scene->addItem(line);
|
||||
line->RefreshGeometry();
|
||||
|
|
|
@ -161,7 +161,8 @@ void DialogPointOfIntersection::ShowVisualization()
|
|||
{
|
||||
if (prepare == false)
|
||||
{
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisLine::SetFactor);
|
||||
line->RefreshGeometry();
|
||||
}
|
||||
|
|
|
@ -126,7 +126,8 @@ void DialogShoulderPoint::ShowVisualization()
|
|||
{
|
||||
if (prepare == false)
|
||||
{
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisLine::SetFactor);
|
||||
scene->addItem(line);
|
||||
line->RefreshGeometry();
|
||||
|
|
|
@ -185,7 +185,8 @@ void DialogSpline::ShowVisualization()
|
|||
{
|
||||
if (prepare == false)
|
||||
{
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, path, &Visualization::SetFactor);
|
||||
scene->addItem(path);
|
||||
path->RefreshGeometry();
|
||||
|
|
|
@ -267,7 +267,8 @@ void DialogSplinePath::ShowVisualization()
|
|||
{
|
||||
if (prepare == false)
|
||||
{
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, visPath, &Visualization::SetFactor);
|
||||
scene->addItem(visPath);
|
||||
visPath->setMode(Mode::Show);
|
||||
|
|
|
@ -200,7 +200,8 @@ void DialogTriangle::ShowVisualization()
|
|||
{
|
||||
if (prepare == false)
|
||||
{
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, line, &VisLine::SetFactor);
|
||||
scene->addItem(line);
|
||||
line->RefreshGeometry();
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#include "mainwindow.h"
|
||||
#include "core/vapplication.h"
|
||||
#include "core/vsettings.h"
|
||||
#include "tablewindow.h"
|
||||
#include "version.h"
|
||||
|
||||
#include <QTextCodec>
|
||||
|
@ -118,9 +117,6 @@ int main(int argc, char *argv[])
|
|||
MainWindow w;
|
||||
app.setWindowIcon(QIcon(":/icon/64x64/icon64x64.png"));
|
||||
app.setMainWindow(&w);
|
||||
TableWindow table;
|
||||
QObject::connect(&w, &MainWindow::ModelChosen, &table, &TableWindow::ModelChosen);
|
||||
QObject::connect(&table, &TableWindow::closed, &w, &MainWindow::tableClosed);
|
||||
|
||||
QCommandLineParser parser;
|
||||
parser.setApplicationDescription(QCoreApplication::translate("main", "Pattern making program."));
|
||||
|
|
|
@ -73,10 +73,10 @@ Q_LOGGING_CATEGORY(vMainWindow, "v.mainwindow")
|
|||
* @param parent parent widget.
|
||||
*/
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
:QMainWindow(parent), ui(new Ui::MainWindow), pattern(nullptr), doc(nullptr), currentTool(Tool::Arrow),
|
||||
lastUsedTool(Tool::Arrow), currentScene(nullptr), sceneDraw(nullptr), sceneDetails(nullptr),
|
||||
:MainWindowsNoGUI(parent), ui(new Ui::MainWindow), currentTool(Tool::Arrow),
|
||||
lastUsedTool(Tool::Arrow), sceneDraw(nullptr), sceneDetails(nullptr),
|
||||
mouseCoordinate(nullptr), helpLabel(nullptr), isInitialized(false), dialogTable(nullptr), dialogTool(nullptr),
|
||||
dialogHistory(nullptr), comboBoxDraws(nullptr), curFile(QString()), mode(Draw::Calculation), currentDrawIndex(0),
|
||||
dialogHistory(nullptr), comboBoxDraws(nullptr), mode(Draw::Calculation), currentDrawIndex(0),
|
||||
currentToolBoxIndex(0), drawMode(true), recentFileActs(),
|
||||
separatorAct(nullptr), autoSaveTimer(nullptr), guiEnabled(true), gradationHeights(nullptr),
|
||||
gradationSizes(nullptr),
|
||||
|
@ -95,33 +95,13 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
CreateMenus();
|
||||
ToolBarDraws();
|
||||
InitToolButtons();
|
||||
|
||||
sceneDraw = new VMainGraphicsScene();
|
||||
currentScene = sceneDraw;
|
||||
qApp->setCurrentScene(currentScene);
|
||||
connect(this, &MainWindow::EnableItemMove, sceneDraw, &VMainGraphicsScene::EnableItemMove);
|
||||
connect(sceneDraw, &VMainGraphicsScene::mouseMove, this, &MainWindow::mouseMove);
|
||||
sceneDetails = new VMainGraphicsScene();
|
||||
connect(sceneDetails, &VMainGraphicsScene::mouseMove, this, &MainWindow::mouseMove);
|
||||
|
||||
ui->view->setScene(currentScene);
|
||||
|
||||
sceneDraw->setTransform(ui->view->transform());
|
||||
sceneDetails->setTransform(ui->view->transform());
|
||||
|
||||
connect(ui->view, &VMainGraphicsView::NewFactor, sceneDraw, &VMainGraphicsScene::SetFactor);
|
||||
QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
policy.setHorizontalStretch(12);
|
||||
ui->view->setSizePolicy(policy);
|
||||
qApp->setSceneView(ui->view);
|
||||
InitScenes();
|
||||
|
||||
helpLabel = new QLabel(QObject::tr("Create new pattern piece to start working."));
|
||||
ui->statusBar->addWidget(helpLabel);
|
||||
|
||||
ToolBarTools();
|
||||
|
||||
pattern = new VContainer();
|
||||
|
||||
doc = new VPattern(pattern, &mode, sceneDraw, sceneDetails);
|
||||
connect(doc, &VPattern::ClearMainWindow, this, &MainWindow::Clear);
|
||||
connect(doc, &VPattern::patternChanged, this, &MainWindow::PatternWasModified);
|
||||
|
@ -151,6 +131,9 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
ui->toolBarStages->setIconSize(QSize(24, 24));
|
||||
ui->toolBarTools->setIconSize(QSize(24, 24));
|
||||
#endif
|
||||
|
||||
connect(ui->listWidget, &QListWidget::currentRowChanged, this, &MainWindow::ShowPaper);
|
||||
ui->dockWidgetLayoutPages->setVisible(false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -221,6 +204,29 @@ void MainWindow::AddPP(const QString &PPName, const QString &path)
|
|||
ui->actionNewDraw->setEnabled(true);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void MainWindow::InitScenes()
|
||||
{
|
||||
sceneDraw = new VMainGraphicsScene();
|
||||
currentScene = sceneDraw;
|
||||
qApp->setCurrentScene(currentScene);
|
||||
connect(this, &MainWindow::EnableItemMove, sceneDraw, &VMainGraphicsScene::EnableItemMove);
|
||||
connect(sceneDraw, &VMainGraphicsScene::mouseMove, this, &MainWindow::mouseMove);
|
||||
sceneDetails = new VMainGraphicsScene();
|
||||
connect(sceneDetails, &VMainGraphicsScene::mouseMove, this, &MainWindow::mouseMove);
|
||||
|
||||
ui->view->setScene(currentScene);
|
||||
|
||||
sceneDraw->setTransform(ui->view->transform());
|
||||
sceneDetails->setTransform(ui->view->transform());
|
||||
|
||||
connect(ui->view, &VMainGraphicsView::NewFactor, sceneDraw, &VMainGraphicsScene::SetFactor);
|
||||
QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
policy.setHorizontalStretch(12);
|
||||
ui->view->setSizePolicy(policy);
|
||||
qApp->setSceneView(ui->view);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief OptionDraw help change name of pattern piece.
|
||||
|
@ -261,7 +267,11 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons
|
|||
helpLabel->setText(toolTip);
|
||||
ui->view->setShowToolOptions(false);
|
||||
dialogTool = new Dialog(pattern, 0, this);
|
||||
connect(currentScene, &VMainGraphicsScene::ChoosedObject, dialogTool, &DialogTool::ChosenObject);
|
||||
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene);
|
||||
SCASSERT(scene != nullptr);
|
||||
|
||||
connect(scene, &VMainGraphicsScene::ChoosedObject, dialogTool, &DialogTool::ChosenObject);
|
||||
connect(dialogTool, &DialogTool::DialogClosed, this, closeDialogSlot);
|
||||
connect(dialogTool, &DialogTool::ToolTip, this, &MainWindow::ShowToolTip);
|
||||
ui->view->itemClicked(nullptr);
|
||||
|
@ -270,7 +280,6 @@ void MainWindow::SetToolButton(bool checked, Tool t, const QString &cursor, cons
|
|||
{
|
||||
if (QToolButton *tButton = qobject_cast< QToolButton * >(this->sender()))
|
||||
{
|
||||
SCASSERT(tButton != nullptr);
|
||||
tButton->setChecked(true);
|
||||
}
|
||||
}
|
||||
|
@ -301,7 +310,11 @@ void MainWindow::SetToolButtonWithApply(bool checked, Tool t, const QString &cur
|
|||
ui->view->setShowToolOptions(false);
|
||||
helpLabel->setText(toolTip);
|
||||
dialogTool = new Dialog(pattern, 0, this);
|
||||
connect(currentScene, &VMainGraphicsScene::ChoosedObject, dialogTool, &DialogTool::ChosenObject);
|
||||
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene);
|
||||
SCASSERT(scene != nullptr);
|
||||
|
||||
connect(scene, &VMainGraphicsScene::ChoosedObject, dialogTool, &DialogTool::ChosenObject);
|
||||
connect(dialogTool, &DialogTool::DialogClosed, this, closeDialogSlot);
|
||||
connect(dialogTool, &DialogTool::DialogApplied, this, applyDialogSlot);
|
||||
connect(dialogTool, &DialogTool::ToolTip, this, &MainWindow::ShowToolTip);
|
||||
|
@ -312,7 +325,6 @@ void MainWindow::SetToolButtonWithApply(bool checked, Tool t, const QString &cur
|
|||
{
|
||||
if (QToolButton *tButton = qobject_cast< QToolButton * >(this->sender()))
|
||||
{
|
||||
SCASSERT(tButton != nullptr);
|
||||
tButton->setChecked(true);
|
||||
}
|
||||
}
|
||||
|
@ -328,7 +340,10 @@ void MainWindow::ClosedDialog(int result)
|
|||
SCASSERT(dialogTool != nullptr);
|
||||
if (result == QDialog::Accepted)
|
||||
{
|
||||
QGraphicsItem *tool = dynamic_cast<QGraphicsItem *>(DrawTool::Create(dialogTool, currentScene, doc, pattern));
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene);
|
||||
SCASSERT(scene != nullptr);
|
||||
|
||||
QGraphicsItem *tool = dynamic_cast<QGraphicsItem *>(DrawTool::Create(dialogTool, scene, doc, pattern));
|
||||
ui->view->itemClicked(tool);
|
||||
}
|
||||
ArrowTool();
|
||||
|
@ -348,8 +363,11 @@ void MainWindow::ClosedDialogWithApply(int result)
|
|||
// Only create tool if not already created with apply
|
||||
if (dialogTool->GetAssociatedTool() == nullptr)
|
||||
{
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene);
|
||||
SCASSERT(scene != nullptr);
|
||||
|
||||
dialogTool->SetAssociatedTool(
|
||||
dynamic_cast<VAbstractTool * > (DrawTool::Create(dialogTool, currentScene, doc, pattern)));
|
||||
dynamic_cast<VAbstractTool * > (DrawTool::Create(dialogTool, scene, doc, pattern)));
|
||||
}
|
||||
else
|
||||
{ // Or update associated tool with data
|
||||
|
@ -379,8 +397,11 @@ void MainWindow::ApplyDialog()
|
|||
// Only create tool if not already created with apply
|
||||
if (dialogTool->GetAssociatedTool() == nullptr)
|
||||
{
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene);
|
||||
SCASSERT(scene != nullptr);
|
||||
|
||||
dialogTool->SetAssociatedTool(
|
||||
static_cast<VAbstractTool * > (DrawTool::Create(dialogTool, currentScene, doc, pattern)));
|
||||
static_cast<VAbstractTool * > (DrawTool::Create(dialogTool, scene, doc, pattern)));
|
||||
}
|
||||
else
|
||||
{ // Or update associated tool with data
|
||||
|
@ -704,16 +725,6 @@ void MainWindow::ShowToolTip(const QString &toolTip)
|
|||
helpLabel->setText(toolTip);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief tableClosed handle after close layout window.
|
||||
*/
|
||||
void MainWindow::tableClosed()
|
||||
{
|
||||
ui->actionDetails->setChecked(true);
|
||||
show();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void MainWindow::OpenRecentFile()
|
||||
{
|
||||
|
@ -799,6 +810,33 @@ void MainWindow::customEvent(QEvent *event)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void MainWindow::ClearLayout()
|
||||
{
|
||||
qDeleteAll (scenes);
|
||||
scenes.clear();
|
||||
shadows.clear();
|
||||
papers.clear();
|
||||
ui->listWidget->clear();
|
||||
SetLayoutModeActions(false);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void MainWindow::PrepareSceneList()
|
||||
{
|
||||
for (int i=1; i<=scenes.size(); ++i)
|
||||
{
|
||||
QListWidgetItem *item = new QListWidgetItem(ScenePreview(i-1), QString::number(i));
|
||||
ui->listWidget->addItem(item);
|
||||
}
|
||||
|
||||
if (not scenes.isEmpty())
|
||||
{
|
||||
ui->listWidget->setCurrentRow(0);
|
||||
SetLayoutModeActions(true);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief ToolBarOption enable option toolbar.
|
||||
|
@ -951,6 +989,7 @@ void MainWindow::InitToolButtons()
|
|||
connect(ui->toolButtonLineIntersectAxis, &QToolButton::clicked, this, &MainWindow::ToolLineIntersectAxis);
|
||||
connect(ui->toolButtonCurveIntersectAxis, &QToolButton::clicked, this, &MainWindow::ToolCurveIntersectAxis);
|
||||
connect(ui->toolButtonArcIntersectAxis, &QToolButton::clicked, this, &MainWindow::ToolCurveIntersectAxis);
|
||||
connect(ui->toolButtonLayoutSettings, &QToolButton::clicked, this, &MainWindow::ToolLayoutSettings);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -1125,13 +1164,19 @@ void MainWindow::keyPressEvent ( QKeyEvent * event )
|
|||
*/
|
||||
void MainWindow::SaveCurrentScene()
|
||||
{
|
||||
if (mode == Draw::Calculation || mode == Draw::Modeling)
|
||||
{
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene);
|
||||
SCASSERT(scene != nullptr);
|
||||
|
||||
/*Save transform*/
|
||||
currentScene->setTransform(ui->view->transform());
|
||||
scene->setTransform(ui->view->transform());
|
||||
/*Save scroll bars value for previous scene.*/
|
||||
QScrollBar *horScrollBar = ui->view->horizontalScrollBar();
|
||||
currentScene->setHorScrollBar(horScrollBar->value());
|
||||
scene->setHorScrollBar(horScrollBar->value());
|
||||
QScrollBar *verScrollBar = ui->view->verticalScrollBar();
|
||||
currentScene->setVerScrollBar(verScrollBar->value());
|
||||
scene->setVerScrollBar(verScrollBar->value());
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -1140,13 +1185,16 @@ void MainWindow::SaveCurrentScene()
|
|||
*/
|
||||
void MainWindow::RestoreCurrentScene()
|
||||
{
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene);
|
||||
SCASSERT(scene != nullptr);
|
||||
|
||||
/*Set transform for current scene*/
|
||||
ui->view->setTransform(currentScene->transform());
|
||||
ui->view->setTransform(scene->transform());
|
||||
/*Set value for current scene scroll bar.*/
|
||||
QScrollBar *horScrollBar = ui->view->horizontalScrollBar();
|
||||
horScrollBar->setValue(currentScene->getHorScrollBar());
|
||||
horScrollBar->setValue(scene->getHorScrollBar());
|
||||
QScrollBar *verScrollBar = ui->view->verticalScrollBar();
|
||||
verScrollBar->setValue(currentScene->getVerScrollBar());
|
||||
verScrollBar->setValue(scene->getVerScrollBar());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -1160,11 +1208,13 @@ void MainWindow::ActionDraw(bool checked)
|
|||
{
|
||||
qCDebug(vMainWindow, "Show draw scene");
|
||||
ui->actionDetails->setChecked(false);
|
||||
ui->actionLayout->setChecked(false);
|
||||
SaveCurrentScene();
|
||||
|
||||
currentScene = sceneDraw;
|
||||
ui->view->setScene(currentScene);
|
||||
connect(ui->view, &VMainGraphicsView::NewFactor, sceneDraw, &VMainGraphicsScene::SetFactor);
|
||||
connect(ui->view, &VMainGraphicsView::NewFactor, sceneDraw, &VMainGraphicsScene::SetFactor,
|
||||
Qt::UniqueConnection);
|
||||
RestoreCurrentScene();
|
||||
|
||||
mode = Draw::Calculation;
|
||||
|
@ -1179,7 +1229,20 @@ void MainWindow::ActionDraw(bool checked)
|
|||
ui->actionHistory->setEnabled(true);
|
||||
ui->actionOptionDraw->setEnabled(true);
|
||||
ui->actionNewDraw->setEnabled(true);
|
||||
ui->actionTable->setEnabled(true);
|
||||
ui->actionArrowTool->setEnabled(true);
|
||||
ui->actionShowCurveDetails->setEnabled(true);
|
||||
actionDockWidgetToolOptions->setEnabled(true);
|
||||
undoAction->setEnabled(true);
|
||||
redoAction->setEnabled(true);
|
||||
|
||||
if (qApp->patternType() == MeasurementsType::Standard)
|
||||
{
|
||||
ui->toolBarOption->setVisible(true);
|
||||
}
|
||||
|
||||
ui->dockWidgetLayoutPages->setVisible(false);
|
||||
ui->dockWidgetToolOptions->setVisible(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1198,11 +1261,12 @@ void MainWindow::ActionDetails(bool checked)
|
|||
{
|
||||
qCDebug(vMainWindow, "Show details scene");
|
||||
ui->actionDraw->setChecked(false);
|
||||
ui->actionLayout->setChecked(false);
|
||||
SaveCurrentScene();
|
||||
|
||||
currentScene = sceneDetails;
|
||||
ui->view->itemClicked(nullptr);
|
||||
ui->view->setScene(sceneDetails);
|
||||
ui->view->setScene(currentScene);
|
||||
disconnect(ui->view, &VMainGraphicsView::NewFactor, sceneDraw, &VMainGraphicsScene::SetFactor);
|
||||
RestoreCurrentScene();
|
||||
|
||||
|
@ -1211,16 +1275,33 @@ void MainWindow::ActionDetails(bool checked)
|
|||
comboBoxDraws->setCurrentIndex(comboBoxDraws->count()-1);
|
||||
comboBoxDraws->setEnabled(false);
|
||||
|
||||
|
||||
if (mode == Draw::Calculation)
|
||||
{
|
||||
currentToolBoxIndex = ui->toolBox->currentIndex();
|
||||
}
|
||||
mode = Draw::Modeling;
|
||||
SetEnableTool(true);
|
||||
currentToolBoxIndex = ui->toolBox->currentIndex();
|
||||
ui->toolBox->setCurrentIndex(4);
|
||||
|
||||
ui->actionHistory->setEnabled(false);
|
||||
ui->actionOptionDraw->setEnabled(false);
|
||||
ui->actionNewDraw->setEnabled(false);
|
||||
ui->actionTable->setEnabled(false);
|
||||
ui->actionArrowTool->setEnabled(true);
|
||||
ui->actionShowCurveDetails->setEnabled(false);
|
||||
actionDockWidgetToolOptions->setEnabled(true);
|
||||
undoAction->setEnabled(true);
|
||||
redoAction->setEnabled(true);
|
||||
|
||||
if (qApp->patternType() == MeasurementsType::Standard)
|
||||
{
|
||||
ui->toolBarOption->setVisible(true);
|
||||
}
|
||||
|
||||
ui->dockWidgetLayoutPages->setVisible(false);
|
||||
ui->dockWidgetToolOptions->setVisible(true);
|
||||
|
||||
helpLabel->setText("");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1228,6 +1309,81 @@ void MainWindow::ActionDetails(bool checked)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief ActionLayout begin creation layout.
|
||||
* @param checked true - button checked.
|
||||
*/
|
||||
void MainWindow::ActionLayout(bool checked)
|
||||
{
|
||||
if (checked)
|
||||
{
|
||||
qCDebug(vMainWindow, "Show layout scene");
|
||||
ui->actionDraw->setChecked(false);
|
||||
ui->actionDetails->setChecked(false);
|
||||
SaveCurrentScene();
|
||||
|
||||
const QHash<quint32, VDetail> *details = pattern->DataDetails();
|
||||
if (details->count() == 0)
|
||||
{
|
||||
Layout();
|
||||
return;
|
||||
}
|
||||
|
||||
PrepareDetailsForLayout(details);
|
||||
|
||||
currentScene = tempSceneLayout;
|
||||
ui->view->itemClicked(nullptr);
|
||||
ui->view->setScene(currentScene);
|
||||
disconnect(ui->view, &VMainGraphicsView::NewFactor, sceneDraw, &VMainGraphicsScene::SetFactor);
|
||||
|
||||
drawMode = false;
|
||||
currentDrawIndex = comboBoxDraws->currentIndex();//save current pattern peace
|
||||
comboBoxDraws->setCurrentIndex(-1);
|
||||
comboBoxDraws->setEnabled(false);
|
||||
|
||||
if (mode == Draw::Calculation)
|
||||
{
|
||||
currentToolBoxIndex = ui->toolBox->currentIndex();
|
||||
}
|
||||
mode = Draw::Layout;
|
||||
SetEnableTool(true);
|
||||
ui->toolBox->setCurrentIndex(5);
|
||||
|
||||
ui->actionHistory->setEnabled(false);
|
||||
ui->actionOptionDraw->setEnabled(false);
|
||||
ui->actionNewDraw->setEnabled(false);
|
||||
ui->actionArrowTool->setEnabled(false);
|
||||
ui->actionTable->setEnabled(false);
|
||||
ui->actionShowCurveDetails->setEnabled(false);
|
||||
actionDockWidgetToolOptions->setEnabled(false);
|
||||
undoAction->setEnabled(false);
|
||||
redoAction->setEnabled(false);
|
||||
mouseCoordinate->setText("");
|
||||
|
||||
if (qApp->patternType() == MeasurementsType::Standard)
|
||||
{
|
||||
ui->toolBarOption->setVisible(false);
|
||||
}
|
||||
|
||||
ui->dockWidgetLayoutPages->setVisible(true);
|
||||
ui->dockWidgetToolOptions->setVisible(false);
|
||||
|
||||
ShowPaper(ui->listWidget->currentRow());
|
||||
|
||||
if (scenes.isEmpty())
|
||||
{
|
||||
ui->toolButtonLayoutSettings->click();
|
||||
}
|
||||
|
||||
helpLabel->setText("");
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->actionLayout->setChecked(true);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief SaveAs save as pattern file.
|
||||
|
@ -1644,16 +1800,19 @@ void MainWindow::ClickEndVisualization()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void MainWindow::Layout()
|
||||
{
|
||||
const QHash<quint32, VDetail> *details = pattern->DataDetails();
|
||||
if (details->size() > 0)
|
||||
if (pattern->DataDetails()->size() > 0)
|
||||
{
|
||||
ui->actionDetails->setEnabled(true);
|
||||
ui->actionLayout->setEnabled(true);
|
||||
SetLayoutModeActions(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
listDetails.clear();
|
||||
ui->actionDetails->setEnabled(false);
|
||||
ui->actionLayout->setEnabled(false);
|
||||
ui->actionDraw->setChecked(true);
|
||||
SetLayoutModeActions(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1813,6 +1972,7 @@ void MainWindow::PatternWasModified(bool saved)
|
|||
{
|
||||
setWindowModified(!saved);
|
||||
ui->actionSave->setEnabled(!saved);
|
||||
isLayoutStale = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1898,41 +2058,6 @@ void MainWindow::ActionCurveDetailsMode(bool checked)
|
|||
sceneDraw->EnableDetailsMode(checked);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief ActionLayout begin creation layout.
|
||||
* @param checked true - button checked.
|
||||
*/
|
||||
void MainWindow::ActionLayout(bool checked)
|
||||
{
|
||||
Q_UNUSED(checked);
|
||||
ActionDetails(true);//Get all list of details.
|
||||
QVector<VLayoutDetail> listDetails;
|
||||
const QHash<quint32, VDetail> *details = pattern->DataDetails();
|
||||
if (details->count() == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
hide();//Now we can hide window
|
||||
QHashIterator<quint32, VDetail> idetail(*details);
|
||||
while (idetail.hasNext())
|
||||
{
|
||||
idetail.next();
|
||||
VLayoutDetail det = VLayoutDetail();
|
||||
det.SetCountourPoints(idetail.value().ContourPoints(pattern));
|
||||
det.SetSeamAllowencePoints(idetail.value().SeamAllowancePoints(pattern), idetail.value().getSeamAllowance());
|
||||
det.setName(idetail.value().getName());
|
||||
det.setWidth(qApp->toPixel(idetail.value().getWidth()));
|
||||
|
||||
listDetails.append(det);
|
||||
}
|
||||
QString description = doc->GetDescription();
|
||||
|
||||
QString fileName;
|
||||
curFile.isEmpty() ? fileName = "unnamed" : fileName = curFile;
|
||||
emit ModelChosen(listDetails, fileName, description);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief ClosedActionHistory actions after closing history window with variables.
|
||||
|
@ -1952,14 +2077,23 @@ void MainWindow::SetEnableTool(bool enable)
|
|||
{
|
||||
bool drawTools = false;
|
||||
bool modelingTools = false;
|
||||
if (mode == Draw::Calculation)
|
||||
bool layoutTools = false;
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case Draw::Calculation:
|
||||
drawTools = enable;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
case Draw::Modeling:
|
||||
modelingTools = enable;
|
||||
break;
|
||||
case Draw::Layout:
|
||||
layoutTools = enable;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
//Drawing Tools
|
||||
ui->toolButtonEndLine->setEnabled(drawTools);
|
||||
ui->toolButtonLine->setEnabled(drawTools);
|
||||
|
@ -1987,6 +2121,26 @@ void MainWindow::SetEnableTool(bool enable)
|
|||
|
||||
//Modeling Tools
|
||||
ui->toolButtonUnionDetails->setEnabled(modelingTools);
|
||||
|
||||
//Layout tools
|
||||
ui->toolButtonLayoutSettings->setEnabled(layoutTools);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void MainWindow::SetLayoutModeActions(bool enable)
|
||||
{
|
||||
bool value = enable;
|
||||
if (scenes.isEmpty())
|
||||
{
|
||||
value = false;
|
||||
}
|
||||
ui->actionExportAs->setEnabled(value);
|
||||
ui->actionPrintPreview->setEnabled(value);
|
||||
ui->actionPrintPreviewTailed->setEnabled(value);
|
||||
ui->actionSaveAsPDF->setEnabled(value);
|
||||
ui->actionSaveAsTiledPDF->setEnabled(value);
|
||||
ui->actionPrint->setEnabled(value);
|
||||
ui->actionPrintTiled->setEnabled(value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -2126,6 +2280,8 @@ void MainWindow::ReadSettings()
|
|||
*/
|
||||
void MainWindow::WriteSettings()
|
||||
{
|
||||
ActionDraw(true);
|
||||
|
||||
qApp->getSettings()->SetGeometry(saveGeometry());
|
||||
qApp->getSettings()->SetWindowState(saveState());
|
||||
qApp->getSettings()->SetToolbarsState(saveState(APP_VERSION));
|
||||
|
@ -2191,13 +2347,13 @@ void MainWindow::CreateMenus()
|
|||
UpdateRecentFileActions();
|
||||
|
||||
//Add Undo/Redo actions.
|
||||
QAction *undoAction = qApp->getUndoStack()->createUndoAction(this, tr("&Undo"));
|
||||
undoAction = qApp->getUndoStack()->createUndoAction(this, tr("&Undo"));
|
||||
undoAction->setShortcuts(QKeySequence::Undo);
|
||||
undoAction->setIcon(QIcon::fromTheme("edit-undo"));
|
||||
ui->menuPatternPiece->insertAction(ui->actionLast_tool, undoAction);
|
||||
ui->toolBarTools->addAction(undoAction);
|
||||
|
||||
QAction *redoAction = qApp->getUndoStack()->createRedoAction(this, tr("&Redo"));
|
||||
redoAction = qApp->getUndoStack()->createRedoAction(this, tr("&Redo"));
|
||||
redoAction->setShortcuts(QKeySequence::Redo);
|
||||
redoAction->setIcon(QIcon::fromTheme("edit-redo"));
|
||||
ui->menuPatternPiece->insertAction(ui->actionLast_tool, redoAction);
|
||||
|
@ -2208,7 +2364,8 @@ void MainWindow::CreateMenus()
|
|||
ui->menuPatternPiece->insertAction(ui->actionPattern_properties, separatorAct);
|
||||
|
||||
//Add dock
|
||||
ui->menuPatternPiece->insertAction(ui->actionPattern_properties, ui->dockWidgetToolOptions->toggleViewAction());
|
||||
actionDockWidgetToolOptions = ui->dockWidgetToolOptions->toggleViewAction();
|
||||
ui->menuPatternPiece->insertAction(ui->actionPattern_properties, actionDockWidgetToolOptions);
|
||||
|
||||
separatorAct = new QAction(this);
|
||||
separatorAct->setSeparator(true);
|
||||
|
@ -2387,6 +2544,14 @@ void MainWindow::CreateActions()
|
|||
connect(ui->actionEdit_pattern_code, &QAction::triggered, this, &MainWindow::EditPatternCode);
|
||||
connect(ui->actionCloseWindow, &QAction::triggered, this, &MainWindow::ResetWindow);
|
||||
connect(ui->actionShowCurveDetails, &QAction::triggered, this, &MainWindow::ActionCurveDetailsMode);
|
||||
|
||||
connect(ui->actionExportAs, &QAction::triggered, this, &MainWindow::ExportLayoutAs);
|
||||
connect(ui->actionPrintPreview, &QAction::triggered, this, &MainWindow::PrintPreviewOrigin);
|
||||
connect(ui->actionPrintPreviewTailed, &QAction::triggered, this, &MainWindow::PrintPreviewTiled);
|
||||
connect(ui->actionSaveAsPDF, &QAction::triggered, this, &MainWindow::SaveAsPDF);
|
||||
connect(ui->actionSaveAsTiledPDF, &QAction::triggered, this, &MainWindow::SaveAsTiledPDF);
|
||||
connect(ui->actionPrint, &QAction::triggered, this, &MainWindow::PrintOrigin);
|
||||
connect(ui->actionPrintTiled, &QAction::triggered, this, &MainWindow::PrintTiled);
|
||||
ui->actionEdit_pattern_code->setEnabled(false);
|
||||
|
||||
//Actions for recent files loaded by a main window application.
|
||||
|
@ -2452,11 +2617,11 @@ QString MainWindow::PatternPieceName(const QString &text)
|
|||
MainWindow::~MainWindow()
|
||||
{
|
||||
CancelTool();
|
||||
ClearLayout();
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
|
||||
delete lock; // Unlock pattern file
|
||||
#endif
|
||||
delete pattern;
|
||||
delete doc;
|
||||
delete sceneDetails;
|
||||
delete sceneDraw;
|
||||
|
@ -2644,6 +2809,23 @@ void MainWindow::ToolBarStyles()
|
|||
ToolBarStyle(ui->mainToolBar);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void MainWindow::ShowPaper(int index)
|
||||
{
|
||||
if (index < 0 || index >= scenes.size())
|
||||
{
|
||||
ui->view->setScene(tempSceneLayout);
|
||||
SetLayoutModeActions(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->view->setScene(scenes.at(index));
|
||||
SetLayoutModeActions(true);
|
||||
}
|
||||
|
||||
ui->view->fitInView(ui->view->scene()->sceneRect(), Qt::KeepAspectRatio);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void MainWindow::ToolBarStyle(QToolBar *bar)
|
||||
{
|
||||
|
|
|
@ -29,15 +29,12 @@
|
|||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include "widgets/vmaingraphicsscene.h"
|
||||
#include "mainwindowsnogui.h"
|
||||
#include "widgets/vmaingraphicsview.h"
|
||||
#include "dialogs/dialogs.h"
|
||||
#include "tools/vtooldetail.h"
|
||||
#include "tools/vtooluniondetails.h"
|
||||
#include "tools/drawTools/drawtools.h"
|
||||
#include "xml/vdomdocument.h"
|
||||
#include "../libs/vlayout/vlayoutdetail.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
|
@ -49,7 +46,7 @@ class VToolOptionsPropertyBrowser;
|
|||
/**
|
||||
* @brief The MainWindow class main windows.
|
||||
*/
|
||||
class MainWindow : public QMainWindow
|
||||
class MainWindow : public MainWindowsNoGUI
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -70,7 +67,6 @@ public slots:
|
|||
void ActionCurveDetailsMode(bool checked);
|
||||
void DrawOption();
|
||||
|
||||
void tableClosed();
|
||||
void ClosedActionTable();
|
||||
void ClosedActionHistory();
|
||||
|
||||
|
@ -140,14 +136,9 @@ public slots:
|
|||
void GlobalChangePP(const QString &patternPiece);
|
||||
void WindowsLocale();
|
||||
void ToolBarStyles();
|
||||
|
||||
void ShowPaper(int index);
|
||||
signals:
|
||||
/**
|
||||
* @brief ModelChosen emit after calculation all details.
|
||||
* @param listDetails list of details.
|
||||
* @param description pattern description.
|
||||
*/
|
||||
void ModelChosen(QVector<VLayoutDetail> listDetails, const QString &curFile,
|
||||
const QString &description);
|
||||
void RefreshHistory();
|
||||
void EnableItemMove(bool move);
|
||||
protected:
|
||||
|
@ -155,16 +146,15 @@ protected:
|
|||
virtual void showEvent(QShowEvent *event);
|
||||
virtual void closeEvent(QCloseEvent *event);
|
||||
virtual void customEvent(QEvent * event);
|
||||
|
||||
virtual void ClearLayout();
|
||||
virtual void PrepareSceneList();
|
||||
private:
|
||||
Q_DISABLE_COPY(MainWindow)
|
||||
/** @brief ui keeps information about user interface */
|
||||
Ui::MainWindow *ui;
|
||||
|
||||
/** @brief pattern container with data (points, arcs, splines, spline paths, variables) */
|
||||
VContainer *pattern;
|
||||
|
||||
/** @brief doc dom document container */
|
||||
VPattern *doc;
|
||||
|
||||
/** @brief tool current tool */
|
||||
Tool currentTool;
|
||||
|
@ -172,9 +162,6 @@ private:
|
|||
/** @brief tool last used tool */
|
||||
Tool lastUsedTool;
|
||||
|
||||
/** @brief currentScene pointer to current scene. */
|
||||
VMainGraphicsScene *currentScene;
|
||||
|
||||
/** @brief sceneDraw draw scene. */
|
||||
VMainGraphicsScene *sceneDraw;
|
||||
|
||||
|
@ -197,9 +184,6 @@ private:
|
|||
/** @brief comboBoxDraws comboc who show name of pattern peaces. */
|
||||
QComboBox *comboBoxDraws;
|
||||
|
||||
/** @brief fileName name current pattern file. */
|
||||
QString curFile;
|
||||
|
||||
/** @brief mode keep current draw mode. */
|
||||
Draw mode;
|
||||
|
||||
|
@ -232,6 +216,7 @@ private:
|
|||
|
||||
void SetEnableWidgets(bool enable);
|
||||
void SetEnableTool(bool enable);
|
||||
void SetLayoutModeActions(bool enable);
|
||||
|
||||
void SaveCurrentScene();
|
||||
void RestoreCurrentScene();
|
||||
|
@ -284,6 +269,8 @@ private:
|
|||
void ToolBarStyle(QToolBar *bar);
|
||||
|
||||
void AddPP(const QString &PPName, const QString &path);
|
||||
|
||||
void InitScenes();
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QToolBox" name="toolBox">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>2</horstretch>
|
||||
|
@ -685,6 +688,9 @@
|
|||
<layout class="QFormLayout" name="formLayout_5">
|
||||
<item row="0" column="0">
|
||||
<widget class="QToolButton" name="toolButtonNewDetail">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Seam allowance tool</string>
|
||||
</property>
|
||||
|
@ -734,6 +740,45 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_6">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>105</width>
|
||||
<height>380</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
<string>Layout</string>
|
||||
</attribute>
|
||||
<layout class="QFormLayout" name="formLayout_6">
|
||||
<item row="0" column="0">
|
||||
<widget class="QToolButton" name="toolButtonLayoutSettings">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Settings</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="emblem-system">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -770,11 +815,27 @@
|
|||
<property name="title">
|
||||
<string>&File</string>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuLayout">
|
||||
<property name="title">
|
||||
<string>Layout</string>
|
||||
</property>
|
||||
<addaction name="actionSaveAsPDF"/>
|
||||
<addaction name="actionPrintPreview"/>
|
||||
<addaction name="actionPrint"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionSaveAsTiledPDF"/>
|
||||
<addaction name="actionPrintPreviewTailed"/>
|
||||
<addaction name="actionPrintTiled"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionExportAs"/>
|
||||
</widget>
|
||||
<addaction name="actionNew"/>
|
||||
<addaction name="actionOpen"/>
|
||||
<addaction name="actionSave"/>
|
||||
<addaction name="actionSaveAs"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="menuLayout"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionPreferences"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionExit"/>
|
||||
|
@ -990,6 +1051,67 @@
|
|||
</attribute>
|
||||
<addaction name="actionArrowTool"/>
|
||||
</widget>
|
||||
<widget class="QDockWidget" name="dockWidgetLayoutPages">
|
||||
<property name="features">
|
||||
<set>QDockWidget::NoDockWidgetFeatures</set>
|
||||
</property>
|
||||
<property name="allowedAreas">
|
||||
<set>Qt::RightDockWidgetArea</set>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Layout pages</string>
|
||||
</property>
|
||||
<attribute name="dockWidgetArea">
|
||||
<number>2</number>
|
||||
</attribute>
|
||||
<widget class="QWidget" name="dockWidgetContents">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QListWidget" name="listWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="tabKeyNavigation">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="showDropIndicator" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>200</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="movement">
|
||||
<enum>QListView::Static</enum>
|
||||
</property>
|
||||
<property name="flow">
|
||||
<enum>QListView::TopToBottom</enum>
|
||||
</property>
|
||||
<property name="resizeMode">
|
||||
<enum>QListView::Adjust</enum>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="viewMode">
|
||||
<enum>QListView::IconMode</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<action name="actionNew">
|
||||
<property name="icon">
|
||||
<iconset theme="document-new">
|
||||
|
@ -1202,6 +1324,9 @@
|
|||
</property>
|
||||
</action>
|
||||
<action name="actionLayout">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
|
@ -1375,6 +1500,9 @@
|
|||
</property>
|
||||
</action>
|
||||
<action name="actionLast_tool">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Last Tool</string>
|
||||
</property>
|
||||
|
@ -1402,6 +1530,115 @@
|
|||
<string>F2</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSaveAsPDF">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="share/resources/icon.qrc">
|
||||
<normaloff>:/icon/32x32/pdf.png</normaloff>:/icon/32x32/pdf.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save as PDF</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Save original layout</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSaveAsTiledPDF">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="share/resources/icon.qrc">
|
||||
<normaloff>:/icon/32x32/pdf.png</normaloff>:/icon/32x32/pdf.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save as tiled PDF</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Split and save a layout into smaller pages</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPrint">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="document-print">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Print</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Print original a layout</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPrintTiled">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="document-print">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Print tiled</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Split and print a layout into smaller pages (for regular printers)</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPrintPreview">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="document-print-preview">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Print preview</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Print preview original layout</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPrintPreviewTailed">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="document-print-preview">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Print preview tailed</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Print preview tailed layout</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionExportAs">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="share/resources/icon.qrc">
|
||||
<normaloff>:/icon/32x32/export_to_picture_document.png</normaloff>:/icon/32x32/export_to_picture_document.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Export As...</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Export original layout</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,14 +1,14 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file tablewindow.h
|
||||
** @file mainwindowsnogui.h
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date November 15, 2013
|
||||
** @date 12 5, 2015
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2013-2015 Valentina project
|
||||
** Copyright (C) 2015 Valentina project
|
||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||
**
|
||||
** Valentina is free software: you can redistribute it and/or modify
|
||||
|
@ -26,74 +26,80 @@
|
|||
**
|
||||
*************************************************************************/
|
||||
|
||||
#ifndef TABLEWINDOW_H
|
||||
#define TABLEWINDOW_H
|
||||
#ifndef MAINWINDOWSNOGUI_H
|
||||
#define MAINWINDOWSNOGUI_H
|
||||
|
||||
#include <QLabel>
|
||||
#include <QMainWindow>
|
||||
|
||||
#include "../../libs/vlayout/vlayoutdetail.h"
|
||||
#include "../../libs/vlayout/vbank.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class TableWindow;
|
||||
}
|
||||
#include "../geometry/vdetail.h"
|
||||
#include "../libs/vlayout/vlayoutdetail.h"
|
||||
#include "xml/vpattern.h"
|
||||
|
||||
class QGraphicsScene;
|
||||
class QGraphicsRectItem;
|
||||
class QPrinter;
|
||||
|
||||
/**
|
||||
* @brief TableWindow class layout window.
|
||||
*/
|
||||
class TableWindow : public QMainWindow
|
||||
class MainWindowsNoGUI : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit TableWindow(QWidget *parent = nullptr);
|
||||
~TableWindow();
|
||||
MainWindowsNoGUI(QWidget *parent = nullptr);
|
||||
virtual ~MainWindowsNoGUI();
|
||||
|
||||
public slots:
|
||||
void ModelChosen(QVector<VLayoutDetail> listDetails, const QString &fileName, const QString &description);
|
||||
void Layout();
|
||||
void StopTable();
|
||||
void SaveLayout();
|
||||
void ShowPaper(int index);
|
||||
void PrintPreview();
|
||||
void Print (QPrinter *printer);
|
||||
void LayoutPrint();
|
||||
void PrintToPdf();
|
||||
|
||||
signals:
|
||||
/** @brief closed emit if window is closing. */
|
||||
void closed();
|
||||
void ToolLayoutSettings(bool checked);
|
||||
void ExportLayoutAs();
|
||||
void SaveAsPDF();
|
||||
void SaveAsTiledPDF();
|
||||
void PrintPages (QPrinter *printer);
|
||||
void PrintPreviewOrigin();
|
||||
void PrintPreviewTiled();
|
||||
void PrintOrigin();
|
||||
void PrintTiled();
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
void moveToCenter();
|
||||
void showEvent ( QShowEvent * event );
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(TableWindow)
|
||||
/** @brief ui keeps information about user interface */
|
||||
Ui::TableWindow* ui;
|
||||
|
||||
/** @brief listDetails list of details. */
|
||||
QVector<VLayoutDetail> listDetails;
|
||||
|
||||
/** @brief currentScene pointer to current scene. */
|
||||
QGraphicsScene *currentScene;
|
||||
|
||||
QGraphicsScene *tempSceneLayout;
|
||||
|
||||
/** @brief pattern container with data (points, arcs, splines, spline paths, variables) */
|
||||
VContainer *pattern;
|
||||
|
||||
/** @brief doc dom document container */
|
||||
VPattern *doc;
|
||||
|
||||
QList<QGraphicsItem *> papers;
|
||||
QList<QGraphicsItem *> shadows;
|
||||
QList<QGraphicsScene *> scenes;
|
||||
QList<QList<QGraphicsItem *> > details;
|
||||
|
||||
/** @brief fileName keep name of pattern file. */
|
||||
QString fileName;
|
||||
QAction *undoAction;
|
||||
QAction *redoAction;
|
||||
QAction *actionDockWidgetToolOptions;
|
||||
|
||||
/** @brief description pattern description */
|
||||
QString description;
|
||||
/** @brief fileName name current pattern file. */
|
||||
QString curFile;
|
||||
|
||||
QGraphicsScene* tempScene;
|
||||
bool isLayoutStale;
|
||||
|
||||
void PrepareDetailsForLayout(const QHash<quint32, VDetail> *details);
|
||||
|
||||
void InitTempLayoutScene();
|
||||
virtual void ClearLayout()=0;
|
||||
virtual void PrepareSceneList()=0;
|
||||
QIcon ScenePreview(int i) const;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(MainWindowsNoGUI)
|
||||
|
||||
bool isTiled;
|
||||
|
||||
void CreateShadows();
|
||||
void CreateScenes();
|
||||
|
||||
QMap<QString, QString> InitFormates() const;
|
||||
|
||||
void SvgFile(const QString &name, int i)const;
|
||||
void PngFile(const QString &name, int i)const;
|
||||
|
@ -105,17 +111,16 @@ private:
|
|||
|
||||
QVector<QImage> AllSheets();
|
||||
|
||||
void ClearLayout();
|
||||
void CreateShadows();
|
||||
void CreateScenes();
|
||||
void PrepareSceneList();
|
||||
QIcon ScenePreview(int i) const;
|
||||
QMap<QString, QString> InitFormates() const;
|
||||
void SaveLayoutAs();
|
||||
void PrintPreview();
|
||||
void LayoutPrint();
|
||||
|
||||
void EnableActions(bool enable);
|
||||
void ToolBarStyle(QToolBar *bar);
|
||||
void ReadSettings();
|
||||
void ToolBarStyles();
|
||||
void SetPrinterSettings(QPrinter *printer);
|
||||
|
||||
bool isPagesUniform() const;
|
||||
QString FileName() const;
|
||||
|
||||
int ContinueIfLayoutStale();
|
||||
};
|
||||
|
||||
#endif // TABLEWINDOW_H
|
||||
#endif // MAINWINDOWSNOGUI_H
|
|
@ -60,5 +60,6 @@
|
|||
<file>icon/16x16/fx.png</file>
|
||||
<file>icon/16x16/roll.png</file>
|
||||
<file>icon/16x16/progress.gif</file>
|
||||
<file>icon/32x32/export_to_picture_document.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
|
@ -5,7 +5,7 @@ Inherits=gnome,hicolor
|
|||
Example=x-directory-normal
|
||||
|
||||
#Directories
|
||||
Directories=16x16/actions,24x24/actions,32x32/actions
|
||||
Directories=16x16/actions,24x24/actions,32x32/actions,32x32/emblems
|
||||
|
||||
[16x16/actions]
|
||||
Size=16
|
||||
|
@ -22,4 +22,8 @@ Size=32
|
|||
Context=Actions
|
||||
Type=Fixed
|
||||
|
||||
[32x32/emblemss]
|
||||
Size=32
|
||||
Context=Emblems
|
||||
Type=Fixed
|
||||
|
||||
|
|
|
@ -67,5 +67,6 @@
|
|||
<file alias="16x16/actions/document-print-preview.png">icons/win.icon.theme/16x16/actions/document-print-preview.png</file>
|
||||
<file alias="24x24/actions/document-print-preview.png">icons/win.icon.theme/24x24/actions/document-print-preview.png</file>
|
||||
<file alias="32x32/actions/document-print-preview.png">icons/win.icon.theme/32x32/actions/document-print-preview.png</file>
|
||||
<file alias="32x32/emblems/emblem-system.png">icons/win.icon.theme/32x32/emblems/emblem-system.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -1,328 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>TableWindow</class>
|
||||
<widget class="QMainWindow" name="TableWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1000</width>
|
||||
<height>730</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Create a layout</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="share/resources/icon.qrc">
|
||||
<normaloff>:/icon/64x64/icon64x64.png</normaloff>:/icon/64x64/icon64x64.png</iconset>
|
||||
</property>
|
||||
<property name="locale">
|
||||
<locale language="English" country="UnitedStates"/>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="VTableGraphicsView" name="view">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>20</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="resizeAnchor">
|
||||
<enum>QGraphicsView::AnchorUnderMouse</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="toolBar">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Main toolbar</string>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
||||
</property>
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<addaction name="actionSave"/>
|
||||
<addaction name="actionZoomIn"/>
|
||||
<addaction name="actionZoomOut"/>
|
||||
<addaction name="actionStop"/>
|
||||
<addaction name="actionLayout"/>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusBar"/>
|
||||
<widget class="QDockWidget" name="dockWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>187</width>
|
||||
<height>121</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>187</width>
|
||||
<height>524287</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="features">
|
||||
<set>QDockWidget::DockWidgetMovable</set>
|
||||
</property>
|
||||
<property name="allowedAreas">
|
||||
<set>Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea</set>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Layout pages</string>
|
||||
</property>
|
||||
<attribute name="dockWidgetArea">
|
||||
<number>1</number>
|
||||
</attribute>
|
||||
<widget class="QWidget" name="dockWidgetContents">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QListWidget" name="listWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>200</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="movement">
|
||||
<enum>QListView::Static</enum>
|
||||
</property>
|
||||
<property name="flow">
|
||||
<enum>QListView::TopToBottom</enum>
|
||||
</property>
|
||||
<property name="isWrapping" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="resizeMode">
|
||||
<enum>QListView::Adjust</enum>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="viewMode">
|
||||
<enum>QListView::IconMode</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1000</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
<property name="title">
|
||||
<string>File</string>
|
||||
</property>
|
||||
<addaction name="actionSave"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionPrint_pre_view"/>
|
||||
<addaction name="action_Print"/>
|
||||
<addaction name="actionSave_to_p_df"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuEdit">
|
||||
<property name="title">
|
||||
<string>Edit</string>
|
||||
</property>
|
||||
<addaction name="actionZoomIn"/>
|
||||
<addaction name="actionZoomOut"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuLayout">
|
||||
<property name="title">
|
||||
<string>Layout</string>
|
||||
</property>
|
||||
<addaction name="actionLayout"/>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
<addaction name="menuEdit"/>
|
||||
<addaction name="menuLayout"/>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="toolBar_2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Toolbar print</string>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextUnderIcon</enum>
|
||||
</property>
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<addaction name="actionSave_to_p_df"/>
|
||||
<addaction name="actionPrint_pre_view"/>
|
||||
<addaction name="action_Print"/>
|
||||
</widget>
|
||||
<action name="actionSave">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="document-save-as">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Save As...</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Save layout</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+S</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionStop">
|
||||
<property name="icon">
|
||||
<iconset theme="process-stop">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Back</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Back to main window</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionZoomIn">
|
||||
<property name="icon">
|
||||
<iconset theme="zoom-in">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Zoom In</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Zoom In</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionZoomOut">
|
||||
<property name="icon">
|
||||
<iconset theme="zoom-out">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Zoom Out</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Zoom Out</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionLayout">
|
||||
<property name="icon">
|
||||
<iconset resource="share/resources/icon.qrc">
|
||||
<normaloff>:/icon/32x32/layout.png</normaloff>:/icon/32x32/layout.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Create Layout</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Create Layout</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPrint_pre_view">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="document-print-preview">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Print pre&view...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action_Print">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="document-print">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Print...</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string>Ctrl+P</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSave_to_p_df">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="share/resources/icon.qrc">
|
||||
<normaloff>:/icon/32x32/pdf.png</normaloff>:/icon/32x32/pdf.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Print to p&df</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>VTableGraphicsView</class>
|
||||
<extends>QGraphicsView</extends>
|
||||
<header>vtablegraphicsview.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="share/resources/icon.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -189,7 +189,8 @@ void VToolAlongLine::ShowVisualization(bool show)
|
|||
if (vis == nullptr)
|
||||
{
|
||||
VisToolAlongLine *visual = new VisToolAlongLine(getData());
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||
scene->addItem(visual);
|
||||
|
||||
|
|
|
@ -293,7 +293,8 @@ void VToolArc::ShowVisualization(bool show)
|
|||
if (vis == nullptr)
|
||||
{
|
||||
VisToolArc * visual = new VisToolArc(getData());
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||
scene->addItem(visual);
|
||||
|
||||
|
|
|
@ -347,7 +347,8 @@ void VToolBisector::ShowVisualization(bool show)
|
|||
if (vis == nullptr)
|
||||
{
|
||||
VisToolBisector * visual = new VisToolBisector(getData());
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||
scene->addItem(visual);
|
||||
|
||||
|
|
|
@ -227,7 +227,8 @@ void VToolCurveIntersectAxis::ShowVisualization(bool show)
|
|||
if (vis == nullptr)
|
||||
{
|
||||
VisToolCurveIntersectAxis * visual = new VisToolCurveIntersectAxis(getData());
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||
scene->addItem(visual);
|
||||
|
||||
|
|
|
@ -192,7 +192,8 @@ void VToolCutArc::ShowVisualization(bool show)
|
|||
if (vis == nullptr)
|
||||
{
|
||||
VisToolCutArc * visual = new VisToolCutArc(getData());
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||
scene->addItem(visual);
|
||||
|
||||
|
|
|
@ -202,7 +202,8 @@ void VToolCutSpline::ShowVisualization(bool show)
|
|||
if (vis == nullptr)
|
||||
{
|
||||
VisToolCutSpline * visual = new VisToolCutSpline(getData());
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||
scene->addItem(visual);
|
||||
|
||||
|
|
|
@ -246,7 +246,8 @@ void VToolCutSplinePath::ShowVisualization(bool show)
|
|||
if (vis == nullptr)
|
||||
{
|
||||
VisToolCutSplinePath *visual = new VisToolCutSplinePath(getData());
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||
scene->addItem(visual);
|
||||
|
||||
|
|
|
@ -287,7 +287,8 @@ void VToolEndLine::ShowVisualization(bool show)
|
|||
if (vis == nullptr)
|
||||
{
|
||||
VisToolEndLine * visual = new VisToolEndLine(getData());
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||
scene->addItem(visual);
|
||||
|
||||
|
|
|
@ -291,7 +291,8 @@ void VToolHeight::ShowVisualization(bool show)
|
|||
if (vis == nullptr)
|
||||
{
|
||||
VisToolHeight * visual = new VisToolHeight(getData());
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||
scene->addItem(visual);
|
||||
|
||||
|
|
|
@ -428,7 +428,8 @@ void VToolLine::ShowVisualization(bool show)
|
|||
if (vis == nullptr)
|
||||
{
|
||||
VisToolLine * visual = new VisToolLine(getData());
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||
scene->addItem(visual);
|
||||
|
||||
|
|
|
@ -309,7 +309,8 @@ void VToolLineIntersect::ShowVisualization(bool show)
|
|||
if (vis == nullptr)
|
||||
{
|
||||
VisToolLineIntersect * visual = new VisToolLineIntersect(getData());
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||
scene->addItem(visual);
|
||||
|
||||
|
|
|
@ -239,7 +239,8 @@ void VToolLineIntersectAxis::ShowVisualization(bool show)
|
|||
if (vis == nullptr)
|
||||
{
|
||||
VisToolLineIntersectAxis * visual = new VisToolLineIntersectAxis(getData());
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||
scene->addItem(visual);
|
||||
|
||||
|
|
|
@ -324,7 +324,8 @@ void VToolNormal::ShowVisualization(bool show)
|
|||
if (vis == nullptr)
|
||||
{
|
||||
VisToolNormal * visual = new VisToolNormal(getData());
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||
scene->addItem(visual);
|
||||
|
||||
|
|
|
@ -355,7 +355,8 @@ void VToolPointOfContact::ShowVisualization(bool show)
|
|||
if (vis == nullptr)
|
||||
{
|
||||
VisToolPointOfContact * visual = new VisToolPointOfContact(getData());
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||
scene->addItem(visual);
|
||||
|
||||
|
|
|
@ -260,7 +260,8 @@ void VToolPointOfIntersection::ShowVisualization(bool show)
|
|||
if (vis == nullptr)
|
||||
{
|
||||
VisToolPointOfIntersection * visual = new VisToolPointOfIntersection(getData());
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||
scene->addItem(visual);
|
||||
|
||||
|
|
|
@ -353,7 +353,8 @@ void VToolShoulderPoint::ShowVisualization(bool show)
|
|||
if (vis == nullptr)
|
||||
{
|
||||
VisToolShoulderPoint * visual = new VisToolShoulderPoint(getData());
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||
scene->addItem(visual);
|
||||
|
||||
|
|
|
@ -237,7 +237,8 @@ void VToolSpline::ShowVisualization(bool show)
|
|||
if (vis == nullptr)
|
||||
{
|
||||
VisToolSpline *visual = new VisToolSpline(getData(), this);
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||
|
||||
const QSharedPointer<VSpline> spl = VAbstractTool::data.GeometricObject<VSpline>(id);
|
||||
|
|
|
@ -318,7 +318,8 @@ void VToolSplinePath::ShowVisualization(bool show)
|
|||
if (vis == nullptr)
|
||||
{
|
||||
VisToolSplinePath *visual = new VisToolSplinePath(getData(), this);
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||
|
||||
QSharedPointer<VSplinePath> splPath = VAbstractTool::data.GeometricObject<VSplinePath>(id);
|
||||
|
|
|
@ -325,7 +325,8 @@ void VToolTriangle::ShowVisualization(bool show)
|
|||
if (vis == nullptr)
|
||||
{
|
||||
VisToolTriangle * visual = new VisToolTriangle(getData());
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr)
|
||||
connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor);
|
||||
scene->addItem(visual);
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ void Visualization::setScenePos(const QPointF &value)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void Visualization::VisualMode(const quint32 &pointId)
|
||||
{
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr);
|
||||
|
||||
this->point1Id = pointId;
|
||||
|
|
|
@ -87,7 +87,7 @@ protected:
|
|||
void AddItem(Item *item)
|
||||
{
|
||||
SCASSERT(item != nullptr);
|
||||
VMainGraphicsScene *scene = qApp->getCurrentScene();
|
||||
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(qApp->getCurrentScene());
|
||||
SCASSERT(scene != nullptr);
|
||||
|
||||
scene->addItem(item);
|
||||
|
|
|
@ -1,255 +0,0 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vtablegraphicsview.cpp
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date November 15, 2013
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2013-2015 Valentina project
|
||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||
**
|
||||
** Valentina is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** Valentina is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||
**
|
||||
*************************************************************************/
|
||||
|
||||
#include "vtablegraphicsview.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QGraphicsItem>
|
||||
#include <QGuiApplication>
|
||||
#include <QWheelEvent>
|
||||
#include <QScrollBar>
|
||||
#include "../options.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VTableGraphicsView::VTableGraphicsView(QWidget *parent)
|
||||
:QGraphicsView(parent)
|
||||
{
|
||||
QGraphicsView::setResizeAnchor(QGraphicsView::AnchorUnderMouse);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief selectionChanged handle selection change.
|
||||
*/
|
||||
// cppcheck-suppress unusedFunction
|
||||
void VTableGraphicsView::selectionChanged()
|
||||
{
|
||||
QList<QGraphicsItem *> listSelectedItems = scene()->selectedItems();
|
||||
if ( listSelectedItems.isEmpty() == true )
|
||||
{
|
||||
qDebug() << tr("can't find detail");
|
||||
emit itemChect(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << tr("detail found");
|
||||
emit itemChect(false);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief MirrorItem mirror detail.
|
||||
*/
|
||||
// cppcheck-suppress unusedFunction
|
||||
void VTableGraphicsView::MirrorItem()
|
||||
{
|
||||
QList<QGraphicsItem *> list = scene()->selectedItems();
|
||||
if (list.size()>0)
|
||||
{
|
||||
for ( qint32 i = 0; i < list.count(); ++i )
|
||||
{
|
||||
QGraphicsItem *item = list.at(i);
|
||||
SCASSERT(item != nullptr);
|
||||
QRectF itemRectOld = item->sceneBoundingRect();
|
||||
//Get the current transform
|
||||
QTransform transform(item->transform());
|
||||
|
||||
qreal m11 = transform.m11(); // Horizontal scaling
|
||||
qreal m12 = transform.m12(); // Vertical shearing
|
||||
qreal m13 = transform.m13(); // Horizontal Projection
|
||||
qreal m21 = transform.m21(); // Horizontal shearing
|
||||
qreal m22 = transform.m22(); // vertical scaling
|
||||
qreal m23 = transform.m23(); // Vertical Projection
|
||||
qreal m31 = transform.m31(); // Horizontal Position (DX)
|
||||
qreal m32 = transform.m32(); // Vertical Position (DY)
|
||||
qreal m33 = transform.m33(); // Addtional Projection Factor
|
||||
|
||||
// Horizontal flip
|
||||
m11 = -m11;
|
||||
|
||||
// Write back to the matrix
|
||||
transform.setMatrix(m11, m12, m13, m21, m22, m23, m31, m32, m33);
|
||||
|
||||
// Set the items transformation
|
||||
item->setTransform(transform);
|
||||
QRectF itemRectNew = item->sceneBoundingRect();
|
||||
qreal dx, dy;
|
||||
dx = itemRectOld.center().x()-itemRectNew.center().x();
|
||||
dy = itemRectOld.center().y()-itemRectNew.center().y();
|
||||
item->moveBy(dx, dy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief wheelEvent handle wheel events.
|
||||
* @param event wheel event.
|
||||
*/
|
||||
// cppcheck-suppress unusedFunction
|
||||
void VTableGraphicsView::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
if (QGuiApplication::keyboardModifiers() == Qt::ControlModifier)
|
||||
{
|
||||
// If was pressed button CTRL this code will execute
|
||||
if ((event->delta())>0)
|
||||
{
|
||||
ZoomIn();
|
||||
}
|
||||
else if ((event->delta())<0)
|
||||
{
|
||||
ZoomOut();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
verticalScrollBar()->setValue(verticalScrollBar()->value()-event->delta());
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief mousePressEvent handle mouse press events.
|
||||
* @param mousePress mouse press event.
|
||||
*/
|
||||
void VTableGraphicsView::mousePressEvent(QMouseEvent *mousePress)
|
||||
{
|
||||
if (mousePress->button() & Qt::LeftButton)
|
||||
{
|
||||
switch (QGuiApplication::keyboardModifiers())
|
||||
{
|
||||
case Qt::ControlModifier:
|
||||
QGraphicsView::setDragMode(QGraphicsView::ScrollHandDrag);
|
||||
QGraphicsView::mousePressEvent(mousePress);
|
||||
break;
|
||||
default:
|
||||
QGraphicsView::mousePressEvent(mousePress);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief mouseReleaseEvent handle mouse release events.
|
||||
* @param event mouse release event.
|
||||
*/
|
||||
void VTableGraphicsView::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
QGraphicsView::mouseReleaseEvent ( event );
|
||||
QGraphicsView::setDragMode( QGraphicsView::RubberBandDrag );
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief keyPressEvent handle key press events.
|
||||
* @param event key press event.
|
||||
*/
|
||||
void VTableGraphicsView::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
switch (event->key())
|
||||
{
|
||||
case Qt::Key_Space:
|
||||
rotateIt();
|
||||
break;
|
||||
case Qt::Key_Left:
|
||||
MoveItem(VTableGraphicsView::Left);
|
||||
break;
|
||||
case Qt::Key_Right:
|
||||
MoveItem(VTableGraphicsView::Right);
|
||||
break;
|
||||
case Qt::Key_Up:
|
||||
MoveItem(VTableGraphicsView::Up);
|
||||
break;
|
||||
case Qt::Key_Down:
|
||||
MoveItem(VTableGraphicsView::Down);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
QGraphicsView::keyPressEvent ( event );
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief rotateIt rotate selected details on 180 degree.
|
||||
*/
|
||||
void VTableGraphicsView::rotateIt()
|
||||
{
|
||||
QList<QGraphicsItem *> list = scene()->selectedItems();
|
||||
if (list.size()>0)
|
||||
{
|
||||
for ( qint32 i = 0; i < list.count(); ++i )
|
||||
{
|
||||
QGraphicsItem *item = list.at(i);
|
||||
SCASSERT(item != nullptr);
|
||||
item->setTransformOriginPoint(item->boundingRect().center());
|
||||
item->setRotation(item->rotation() + 90);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief MoveItem move selected detail.
|
||||
* @param move type of move.
|
||||
*/
|
||||
void VTableGraphicsView::MoveItem(VTableGraphicsView::typeMove_e move)
|
||||
{
|
||||
qreal dx = 0, dy = 0;
|
||||
switch (move)
|
||||
{
|
||||
case VTableGraphicsView::Left:
|
||||
dx = -3;
|
||||
dy = 0;
|
||||
break;
|
||||
case VTableGraphicsView::Right:
|
||||
dx = 3;
|
||||
dy = 0;
|
||||
break;
|
||||
case VTableGraphicsView::Up:
|
||||
dx = 0;
|
||||
dy = -3;
|
||||
break;
|
||||
case VTableGraphicsView::Down:
|
||||
dx = 0;
|
||||
dy = 3;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
QList<QGraphicsItem *> listSelectedItems = scene()->selectedItems();
|
||||
if (listSelectedItems.size()>0)
|
||||
{
|
||||
for ( qint32 i = 0; i < listSelectedItems.count(); ++i )
|
||||
{
|
||||
listSelectedItems.at(i)->moveBy(dx, dy);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,95 +0,0 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vtablegraphicsview.h
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date November 15, 2013
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2013-2015 Valentina project
|
||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||
**
|
||||
** Valentina is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** Valentina is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||
**
|
||||
*************************************************************************/
|
||||
|
||||
#ifndef VTABLEGRAPHICSVIEW_H
|
||||
#define VTABLEGRAPHICSVIEW_H
|
||||
|
||||
#include <QGraphicsView>
|
||||
|
||||
/**
|
||||
* @brief The VTableGraphicsView class table layout view.
|
||||
*/
|
||||
class VTableGraphicsView : public QGraphicsView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
* @brief The typeMove_e enum type items moves.
|
||||
*/
|
||||
enum typeMove_e { Left, Right, Up, Down };
|
||||
|
||||
VTableGraphicsView(QWidget *parent = nullptr);
|
||||
signals:
|
||||
/**
|
||||
* @brief itemChect emit after change selection state detail.
|
||||
* @param flag false - selected, true - don't selected.
|
||||
*/
|
||||
void itemChect( bool flag );
|
||||
public slots:
|
||||
void selectionChanged();
|
||||
void rotateItems();
|
||||
void MirrorItem();
|
||||
void ZoomIn();
|
||||
void ZoomOut();
|
||||
protected:
|
||||
void wheelEvent ( QWheelEvent * event );
|
||||
void mousePressEvent(QMouseEvent *mousePress);
|
||||
void mouseReleaseEvent ( QMouseEvent * event );
|
||||
void keyPressEvent ( QKeyEvent * event );
|
||||
void rotateIt();
|
||||
void MoveItem( VTableGraphicsView::typeMove_e move );
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief rotateItems handle rotatation detail.
|
||||
*/
|
||||
inline void VTableGraphicsView::rotateItems()
|
||||
{
|
||||
rotateIt();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief ZoomIn zoom in paper scale.
|
||||
*/
|
||||
inline void VTableGraphicsView::ZoomIn()
|
||||
{
|
||||
scale(1.1, 1.1);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief ZoomOut zoom out paper scale.
|
||||
*/
|
||||
inline void VTableGraphicsView::ZoomOut()
|
||||
{
|
||||
scale(1/1.1, 1/1.1);
|
||||
}
|
||||
|
||||
#endif // VTABLEGRAPHICSVIEW_H
|
|
@ -2,7 +2,6 @@
|
|||
# This need for corect working file translations.pro
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/vtablegraphicsview.h \
|
||||
$$PWD/vmaingraphicsview.h \
|
||||
$$PWD/vmaingraphicsscene.h \
|
||||
$$PWD/doubledelegate.h \
|
||||
|
@ -13,7 +12,6 @@ HEADERS += \
|
|||
$$PWD/vwidgetpopup.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/vtablegraphicsview.cpp \
|
||||
$$PWD/vmaingraphicsview.cpp \
|
||||
$$PWD/vmaingraphicsscene.cpp \
|
||||
$$PWD/doubledelegate.cpp \
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include <QString>
|
||||
|
||||
enum class Draw : char { Calculation, Modeling };
|
||||
enum class Draw : char { Calculation, Modeling, Layout };
|
||||
enum class GOType : char { Point, Arc, Spline, SplinePath, Unknown };
|
||||
enum class SplinePointPosition : char { FirstPoint, LastPoint };
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user