The visualization connected to tool dialog.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2016-11-05 12:49:20 +02:00
parent 65a38141de
commit bf306f6101
4 changed files with 33 additions and 5 deletions

View File

@ -936,7 +936,7 @@ void MainWindow::ToolDetail(bool checked)
{ {
ToolSelectAllDrawObjects(); ToolSelectAllDrawObjects();
SetToolButton<DialogSeamAllowance>(checked, Tool::Detail, "://cursor/new_detail_cursor.png", SetToolButton<DialogSeamAllowance>(checked, Tool::Detail, "://cursor/new_detail_cursor.png",
tr("Select points, arcs, curves clockwise."), &MainWindow::ClosedDialogDetail); tr("Select main path objects clockwise."), &MainWindow::ClosedDialogDetail);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -29,6 +29,7 @@
#include "dialogseamallowance.h" #include "dialogseamallowance.h"
#include "ui_dialogseamallowance.h" #include "ui_dialogseamallowance.h"
#include "../vpatterndb/vpiecenode.h" #include "../vpatterndb/vpiecenode.h"
#include "visualization/path/vistoolpiece.h"
#include <QBuffer> #include <QBuffer>
#include <QMenu> #include <QMenu>
@ -51,6 +52,8 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 &
ui->listWidget->setContextMenuPolicy(Qt::CustomContextMenu); ui->listWidget->setContextMenuPolicy(Qt::CustomContextMenu);
connect(ui->listWidget, &QListWidget::customContextMenuRequested, this, &DialogSeamAllowance::ShowContextMenu); connect(ui->listWidget, &QListWidget::customContextMenuRequested, this, &DialogSeamAllowance::ShowContextMenu);
vis = new VisToolPiece(data);
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -122,7 +125,34 @@ void DialogSeamAllowance::ChosenObject(quint32 id, const SceneObject &type)
} }
ValidObjects(MainPathIsValid()); ValidObjects(MainPathIsValid());
show();
auto visPath = qobject_cast<VisToolPiece *>(vis);
SCASSERT(visPath != nullptr);
const VPiece p = CreatePiece();
visPath->SetPiece(p);
if (p.CountNode() == 1)
{
emit ToolTip(tr("Select main path objects clockwise, <b>Shift</b> - reverse direction curve, "
"<b>Enter</b> - finish creation"));
visPath->VisualMode(NULL_ID);
}
else
{
visPath->RefreshGeometry();
}
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSeamAllowance::ShowDialog(bool click)
{
if (click == false)
{
emit ToolTip("");
setModal(true);
show();
}
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------

View File

@ -52,6 +52,7 @@ public:
public slots: public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE; virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
virtual void ShowDialog(bool click) Q_DECL_OVERRIDE;
protected: protected:
/** @brief SaveData Put dialog data in local variables */ /** @brief SaveData Put dialog data in local variables */

View File

@ -53,9 +53,6 @@ void VisToolPiece::RefreshGeometry()
QGraphicsEllipseItem *point = GetPoint(static_cast<quint32>(i), supportColor); QGraphicsEllipseItem *point = GetPoint(static_cast<quint32>(i), supportColor);
DrawPoint(point, nodes.at(i), supportColor); DrawPoint(point, nodes.at(i), supportColor);
} }
Visualization::toolTip = tr("Select main path objects, <b>Shift</b> - reverse direction curves, "
"<b>Enter</b> - finish creation");
} }
} }