Added new option "In layout" to context menu tool Detail.
--HG-- branch : develop
This commit is contained in:
parent
710558812a
commit
d38e81cecb
|
@ -3510,6 +3510,7 @@ void MainWindow::InitDocksContain()
|
||||||
|
|
||||||
detailsWidget = new VWidgetDetails(pattern, doc, this);
|
detailsWidget = new VWidgetDetails(pattern, doc, this);
|
||||||
connect(doc, &VPattern::FullUpdateFromFile, detailsWidget, &VWidgetDetails::UpdateList);
|
connect(doc, &VPattern::FullUpdateFromFile, detailsWidget, &VWidgetDetails::UpdateList);
|
||||||
|
connect(doc, &VPattern::UpdateInLayoutList, detailsWidget, &VWidgetDetails::UpdateList);
|
||||||
connect(detailsWidget, &VWidgetDetails::Highlight, sceneDetails, &VMainGraphicsScene::HighlightItem);
|
connect(detailsWidget, &VWidgetDetails::Highlight, sceneDetails, &VMainGraphicsScene::HighlightItem);
|
||||||
detailsWidget->setVisible(false);
|
detailsWidget->setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1202,6 +1202,12 @@ void VAbstractPattern::ClearScene()
|
||||||
emit ClearMainWindow();
|
emit ClearMainWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VAbstractPattern::CheckInLayoutList()
|
||||||
|
{
|
||||||
|
emit UpdateInLayoutList();
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VAbstractPattern::ToolExists(const quint32 &id) const
|
void VAbstractPattern::ToolExists(const quint32 &id) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -291,6 +291,7 @@ signals:
|
||||||
void UndoCommand();
|
void UndoCommand();
|
||||||
void SetEnabledGUI(bool enabled);
|
void SetEnabledGUI(bool enabled);
|
||||||
void CheckLayout();
|
void CheckLayout();
|
||||||
|
void UpdateInLayoutList();
|
||||||
void SetCurrentPP(const QString &patterPiece);
|
void SetCurrentPP(const QString &patterPiece);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -298,6 +299,7 @@ public slots:
|
||||||
void haveLiteChange();
|
void haveLiteChange();
|
||||||
void NeedFullParsing();
|
void NeedFullParsing();
|
||||||
void ClearScene();
|
void ClearScene();
|
||||||
|
void CheckInLayoutList();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** @brief nameActivDraw name current pattern peace. */
|
/** @brief nameActivDraw name current pattern peace. */
|
||||||
|
|
|
@ -156,9 +156,9 @@ const val VContainer::GetObject(const QHash<key, val> &obj, key id) const
|
||||||
*/
|
*/
|
||||||
const VDetail VContainer::GetDetail(quint32 id) const
|
const VDetail VContainer::GetDetail(quint32 id) const
|
||||||
{
|
{
|
||||||
if (d->details.contains(id))
|
if (d->details->contains(id))
|
||||||
{
|
{
|
||||||
return d->details.value(id);
|
return d->details->value(id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -188,8 +188,8 @@ quint32 VContainer::AddGObject(VGObject *obj)
|
||||||
*/
|
*/
|
||||||
quint32 VContainer::AddDetail(const VDetail &detail)
|
quint32 VContainer::AddDetail(const VDetail &detail)
|
||||||
{
|
{
|
||||||
quint32 id = getNextId();
|
const quint32 id = getNextId();
|
||||||
d->details[id] = detail;
|
d->details->insert(id, detail);
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ void VContainer::Clear()
|
||||||
qCDebug(vCon, "Clearing container data.");
|
qCDebug(vCon, "Clearing container data.");
|
||||||
_id = NULL_ID;
|
_id = NULL_ID;
|
||||||
|
|
||||||
d->details.clear();
|
d->details->clear();
|
||||||
ClearVariables();
|
ClearVariables();
|
||||||
ClearGObjects();
|
ClearGObjects();
|
||||||
ClearUniqueNames();
|
ClearUniqueNames();
|
||||||
|
@ -272,7 +272,7 @@ void VContainer::ClearForFullParse()
|
||||||
qCDebug(vCon, "Clearing container data for full parse.");
|
qCDebug(vCon, "Clearing container data for full parse.");
|
||||||
_id = NULL_ID;
|
_id = NULL_ID;
|
||||||
|
|
||||||
d->details.clear();
|
d->details->clear();
|
||||||
ClearVariables(VarType::Increment);
|
ClearVariables(VarType::Increment);
|
||||||
ClearVariables(VarType::LineAngle);
|
ClearVariables(VarType::LineAngle);
|
||||||
ClearVariables(VarType::LineLength);
|
ClearVariables(VarType::LineLength);
|
||||||
|
@ -496,7 +496,7 @@ void VContainer::UpdateGObject(quint32 id, VGObject* obj)
|
||||||
void VContainer::UpdateDetail(quint32 id, const VDetail &detail)
|
void VContainer::UpdateDetail(quint32 id, const VDetail &detail)
|
||||||
{
|
{
|
||||||
Q_ASSERT_X(id != NULL_ID, Q_FUNC_INFO, "id == 0"); //-V654 //-V712
|
Q_ASSERT_X(id != NULL_ID, Q_FUNC_INFO, "id == 0"); //-V654 //-V712
|
||||||
d->details[id] = detail;
|
d->details->insert(id, detail);
|
||||||
UpdateId(id);
|
UpdateId(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -653,7 +653,7 @@ const QMap<QString, QSharedPointer<T> > VContainer::DataVar(const VarType &type)
|
||||||
// cppcheck-suppress unusedFunction
|
// cppcheck-suppress unusedFunction
|
||||||
void VContainer::ClearDetails()
|
void VContainer::ClearDetails()
|
||||||
{
|
{
|
||||||
d->details.clear();
|
d->details->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -731,7 +731,7 @@ const QHash<quint32, QSharedPointer<VGObject> > *VContainer::DataGObjects() cons
|
||||||
*/
|
*/
|
||||||
const QHash<quint32, VDetail> *VContainer::DataDetails() const
|
const QHash<quint32, VDetail> *VContainer::DataDetails() const
|
||||||
{
|
{
|
||||||
return &d->details;
|
return d->details.data();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -78,14 +78,19 @@ class VContainerData : public QSharedData //-V690
|
||||||
public:
|
public:
|
||||||
|
|
||||||
VContainerData(const VTranslateVars *trVars, const Unit *patternUnit)
|
VContainerData(const VTranslateVars *trVars, const Unit *patternUnit)
|
||||||
:gObjects(QHash<quint32, QSharedPointer<VGObject> >()),
|
: gObjects(QHash<quint32, QSharedPointer<VGObject> >()),
|
||||||
variables(QHash<QString, QSharedPointer<VInternalVariable> > ()), details(QHash<quint32, VDetail>()),
|
variables(QHash<QString, QSharedPointer<VInternalVariable> > ()),
|
||||||
|
details(QSharedPointer<QHash<quint32, VDetail>>(new QHash<quint32, VDetail>())),
|
||||||
trVars(trVars), patternUnit(patternUnit)
|
trVars(trVars), patternUnit(patternUnit)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
VContainerData(const VContainerData &data)
|
VContainerData(const VContainerData &data)
|
||||||
:QSharedData(data), gObjects(data.gObjects),
|
: QSharedData(data),
|
||||||
variables(data.variables), details(data.details), trVars(data.trVars), patternUnit(data.patternUnit)
|
gObjects(data.gObjects),
|
||||||
|
variables(data.variables),
|
||||||
|
details(data.details),
|
||||||
|
trVars(data.trVars),
|
||||||
|
patternUnit(data.patternUnit)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual ~VContainerData();
|
virtual ~VContainerData();
|
||||||
|
@ -102,7 +107,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* @brief details container of details
|
* @brief details container of details
|
||||||
*/
|
*/
|
||||||
QHash<quint32, VDetail> details;
|
QSharedPointer<QHash<quint32, VDetail>> details;
|
||||||
|
|
||||||
const VTranslateVars *trVars;
|
const VTranslateVars *trVars;
|
||||||
const Unit *patternUnit;
|
const Unit *patternUnit;
|
||||||
|
|
|
@ -76,6 +76,7 @@
|
||||||
#include "../undocommands/deletedetail.h"
|
#include "../undocommands/deletedetail.h"
|
||||||
#include "../undocommands/movedetail.h"
|
#include "../undocommands/movedetail.h"
|
||||||
#include "../undocommands/savedetailoptions.h"
|
#include "../undocommands/savedetailoptions.h"
|
||||||
|
#include "../undocommands/toggledetailinlayout.h"
|
||||||
#include "../vgeometry/varc.h"
|
#include "../vgeometry/varc.h"
|
||||||
#include "../vgeometry/vcubicbezier.h"
|
#include "../vgeometry/vcubicbezier.h"
|
||||||
#include "../vgeometry/vcubicbezierpath.h"
|
#include "../vgeometry/vcubicbezierpath.h"
|
||||||
|
@ -731,15 +732,15 @@ void VToolDetail::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
||||||
{
|
{
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
QAction *actionOption = menu.addAction(QIcon::fromTheme("preferences-other"), tr("Options"));
|
QAction *actionOption = menu.addAction(QIcon::fromTheme("preferences-other"), tr("Options"));
|
||||||
|
|
||||||
|
QAction *inLayoutOption = menu.addAction(tr("In layout"));
|
||||||
|
inLayoutOption->setCheckable(true);
|
||||||
|
const VDetail detail = VAbstractTool::data.GetDetail(id);
|
||||||
|
inLayoutOption->setChecked(detail.IsInLayout());
|
||||||
|
|
||||||
QAction *actionRemove = menu.addAction(QIcon::fromTheme("edit-delete"), tr("Delete"));
|
QAction *actionRemove = menu.addAction(QIcon::fromTheme("edit-delete"), tr("Delete"));
|
||||||
if (_referens > 1)
|
_referens > 1 ? actionRemove->setEnabled(false) : actionRemove->setEnabled(true);
|
||||||
{
|
|
||||||
actionRemove->setEnabled(false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
actionRemove->setEnabled(true);
|
|
||||||
}
|
|
||||||
QAction *selectedAction = menu.exec(event->screenPos());
|
QAction *selectedAction = menu.exec(event->screenPos());
|
||||||
if (selectedAction == actionOption)
|
if (selectedAction == actionOption)
|
||||||
{
|
{
|
||||||
|
@ -751,6 +752,13 @@ void VToolDetail::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
||||||
setDialog();
|
setDialog();
|
||||||
dialog->show();
|
dialog->show();
|
||||||
}
|
}
|
||||||
|
else if (selectedAction == inLayoutOption)
|
||||||
|
{
|
||||||
|
ToggleDetailInLayout *togglePrint = new ToggleDetailInLayout(id, selectedAction->isChecked(),
|
||||||
|
&(VAbstractTool::data), doc);
|
||||||
|
connect(togglePrint, &ToggleDetailInLayout::UpdateList, doc, &VAbstractPattern::CheckInLayoutList);
|
||||||
|
qApp->getUndoStack()->push(togglePrint);
|
||||||
|
}
|
||||||
else if (selectedAction == actionRemove)
|
else if (selectedAction == actionRemove)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
Loading…
Reference in New Issue
Block a user