Merged develop into feature
--HG-- branch : feature
This commit is contained in:
commit
e1a4eeb4e4
|
@ -65,6 +65,22 @@ void VWidgetDetails::UpdateList()
|
||||||
FillTable(m_data->DataDetails());
|
FillTable(m_data->DataDetails());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VWidgetDetails::SelectDetail(quint32 id)
|
||||||
|
{
|
||||||
|
const int rowCount = ui->tableWidget->rowCount();
|
||||||
|
for (int row = 0; row < rowCount; ++row)
|
||||||
|
{
|
||||||
|
QTableWidgetItem *item = ui->tableWidget->item(row, 0);
|
||||||
|
|
||||||
|
if (item->data(Qt::UserRole).toUInt() == id)
|
||||||
|
{
|
||||||
|
ui->tableWidget->setCurrentItem(item);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VWidgetDetails::InLayoutStateChanged(int row, int column)
|
void VWidgetDetails::InLayoutStateChanged(int row, int column)
|
||||||
{
|
{
|
||||||
|
@ -81,7 +97,7 @@ void VWidgetDetails::InLayoutStateChanged(int row, int column)
|
||||||
const bool inLayout = not allDetails->value(id).IsInLayout();
|
const bool inLayout = not allDetails->value(id).IsInLayout();
|
||||||
|
|
||||||
ToggleDetailInLayout *togglePrint = new ToggleDetailInLayout(id, inLayout, m_data, m_doc);
|
ToggleDetailInLayout *togglePrint = new ToggleDetailInLayout(id, inLayout, m_data, m_doc);
|
||||||
connect(togglePrint, &ToggleDetailInLayout::NeedLiteParsing, m_doc, &VAbstractPattern::LiteParseTree);
|
connect(togglePrint, &ToggleDetailInLayout::UpdateList, this, &VWidgetDetails::UpdateList);
|
||||||
qApp->getUndoStack()->push(togglePrint);
|
qApp->getUndoStack()->push(togglePrint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,16 +155,50 @@ void VWidgetDetails::FillTable(const QHash<quint32, VDetail> *details)
|
||||||
ui->tableWidget->setCurrentCell(selectedRow, 0);
|
ui->tableWidget->setCurrentCell(selectedRow, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VWidgetDetails::ToggleSectionDetails(bool select)
|
||||||
|
{
|
||||||
|
const QHash<quint32, VDetail> *allDetails = m_data->DataDetails();
|
||||||
|
if (allDetails->count() == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i<ui->tableWidget->rowCount(); ++i)
|
||||||
|
{
|
||||||
|
QTableWidgetItem *item = ui->tableWidget->item(i, 0);
|
||||||
|
const quint32 id = item->data(Qt::UserRole).toUInt();
|
||||||
|
if (allDetails->contains(id))
|
||||||
|
{
|
||||||
|
if (not select == allDetails->value(id).IsInLayout())
|
||||||
|
{
|
||||||
|
ToggleDetailInLayout *togglePrint = new ToggleDetailInLayout(id, select, m_data, m_doc);
|
||||||
|
connect(togglePrint, &ToggleDetailInLayout::UpdateList, this, &VWidgetDetails::UpdateList);
|
||||||
|
qApp->getUndoStack()->push(togglePrint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VWidgetDetails::ShowContextMenu(const QPoint &pos)
|
void VWidgetDetails::ShowContextMenu(const QPoint &pos)
|
||||||
{
|
{
|
||||||
QMenu *menu = new QMenu;
|
QMenu *menu = new QMenu(this);
|
||||||
QAction *actionSelectAll = menu->addAction(tr("Select all"));
|
QAction *actionSelectAll = menu->addAction(tr("Select all"));
|
||||||
QAction *actionSelectNone = menu->addAction(tr("Select none"));
|
QAction *actionSelectNone = menu->addAction(tr("Select none"));
|
||||||
|
|
||||||
|
QAction *actionSeparator = new QAction(this);
|
||||||
|
actionSeparator->setSeparator(true);
|
||||||
|
menu->addAction(actionSeparator);
|
||||||
|
|
||||||
|
QAction *actionInvertSelection = menu->addAction(tr("Invert selection"));
|
||||||
|
|
||||||
const QHash<quint32, VDetail> *allDetails = m_data->DataDetails();
|
const QHash<quint32, VDetail> *allDetails = m_data->DataDetails();
|
||||||
if (not allDetails->count() == 0)
|
if (allDetails->count() == 0)
|
||||||
{
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int selectedDetails = 0;
|
int selectedDetails = 0;
|
||||||
|
|
||||||
QHash<quint32, VDetail>::const_iterator iter = allDetails->constBegin();
|
QHash<quint32, VDetail>::const_iterator iter = allDetails->constBegin();
|
||||||
|
@ -160,6 +210,7 @@ void VWidgetDetails::ShowContextMenu(const QPoint &pos)
|
||||||
}
|
}
|
||||||
++iter;
|
++iter;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedDetails == 0)
|
if (selectedDetails == 0)
|
||||||
{
|
{
|
||||||
actionSelectNone->setDisabled(true);
|
actionSelectNone->setDisabled(true);
|
||||||
|
@ -169,6 +220,7 @@ void VWidgetDetails::ShowContextMenu(const QPoint &pos)
|
||||||
actionSelectAll->setDisabled(true);
|
actionSelectAll->setDisabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QAction *selectedAction = menu->exec(ui->tableWidget->viewport()->mapToGlobal(pos));
|
QAction *selectedAction = menu->exec(ui->tableWidget->viewport()->mapToGlobal(pos));
|
||||||
|
|
||||||
bool select;
|
bool select;
|
||||||
|
@ -176,32 +228,32 @@ void VWidgetDetails::ShowContextMenu(const QPoint &pos)
|
||||||
{
|
{
|
||||||
select = true;
|
select = true;
|
||||||
qApp->getUndoStack()->beginMacro(tr("select all details"));
|
qApp->getUndoStack()->beginMacro(tr("select all details"));
|
||||||
|
ToggleSectionDetails(select);
|
||||||
}
|
}
|
||||||
else if (selectedAction == actionSelectNone)
|
else if (selectedAction == actionSelectNone)
|
||||||
{
|
{
|
||||||
select = false;
|
select = false;
|
||||||
qApp->getUndoStack()->beginMacro(tr("select none details"));
|
qApp->getUndoStack()->beginMacro(tr("select none details"));
|
||||||
|
ToggleSectionDetails(select);
|
||||||
}
|
}
|
||||||
else
|
else if (selectedAction == actionInvertSelection)
|
||||||
{
|
{
|
||||||
return;
|
qApp->getUndoStack()->beginMacro(tr("invert selection"));
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i<ui->tableWidget->rowCount(); ++i)
|
for (int i = 0; i<ui->tableWidget->rowCount(); ++i)
|
||||||
{
|
{
|
||||||
QTableWidgetItem *item = ui->tableWidget->item(i, 0);
|
QTableWidgetItem *item = ui->tableWidget->item(i, 0);
|
||||||
const quint32 id = item->data(Qt::UserRole).toUInt();
|
const quint32 id = item->data(Qt::UserRole).toUInt();
|
||||||
if (not select == m_data->DataDetails()->value(id).IsInLayout())
|
if (allDetails->contains(id))
|
||||||
{
|
{
|
||||||
|
select = not allDetails->value(id).IsInLayout();
|
||||||
|
|
||||||
ToggleDetailInLayout *togglePrint = new ToggleDetailInLayout(id, select, m_data, m_doc);
|
ToggleDetailInLayout *togglePrint = new ToggleDetailInLayout(id, select, m_data, m_doc);
|
||||||
connect(togglePrint, &ToggleDetailInLayout::NeedLiteParsing, m_doc, &VAbstractPattern::LiteParseTree);
|
connect(togglePrint, &ToggleDetailInLayout::UpdateList, this, &VWidgetDetails::UpdateList);
|
||||||
qApp->getUndoStack()->push(togglePrint);
|
qApp->getUndoStack()->push(togglePrint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
qApp->getUndoStack()->endMacro();
|
qApp->getUndoStack()->endMacro();
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,7 @@ signals:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void UpdateList();
|
void UpdateList();
|
||||||
|
void SelectDetail(quint32 id);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void InLayoutStateChanged(int row, int column);
|
void InLayoutStateChanged(int row, int column);
|
||||||
|
@ -65,6 +66,7 @@ private:
|
||||||
VContainer *m_data;
|
VContainer *m_data;
|
||||||
|
|
||||||
void FillTable(const QHash<quint32, VDetail> *details);
|
void FillTable(const QHash<quint32, VDetail> *details);
|
||||||
|
void ToggleSectionDetails(bool select);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VWIDGETDETAILS_H
|
#endif // VWIDGETDETAILS_H
|
||||||
|
|
|
@ -3510,6 +3510,8 @@ 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(doc, &VPattern::ShowDetail, detailsWidget, &VWidgetDetails::SelectDetail);
|
||||||
connect(detailsWidget, &VWidgetDetails::Highlight, sceneDetails, &VMainGraphicsScene::HighlightItem);
|
connect(detailsWidget, &VWidgetDetails::Highlight, sceneDetails, &VMainGraphicsScene::HighlightItem);
|
||||||
detailsWidget->setVisible(false);
|
detailsWidget->setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1203,6 +1203,18 @@ void VAbstractPattern::ClearScene()
|
||||||
emit ClearMainWindow();
|
emit ClearMainWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VAbstractPattern::CheckInLayoutList()
|
||||||
|
{
|
||||||
|
emit UpdateInLayoutList();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VAbstractPattern::SelectedDetail(quint32 id)
|
||||||
|
{
|
||||||
|
emit ShowDetail(id);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VAbstractPattern::ToolExists(const quint32 &id) const
|
void VAbstractPattern::ToolExists(const quint32 &id) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -292,6 +292,8 @@ signals:
|
||||||
void UndoCommand();
|
void UndoCommand();
|
||||||
void SetEnabledGUI(bool enabled);
|
void SetEnabledGUI(bool enabled);
|
||||||
void CheckLayout();
|
void CheckLayout();
|
||||||
|
void UpdateInLayoutList();
|
||||||
|
void ShowDetail(quint32 id);
|
||||||
void SetCurrentPP(const QString &patterPiece);
|
void SetCurrentPP(const QString &patterPiece);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -299,6 +301,8 @@ public slots:
|
||||||
void haveLiteChange();
|
void haveLiteChange();
|
||||||
void NeedFullParsing();
|
void NeedFullParsing();
|
||||||
void ClearScene();
|
void ClearScene();
|
||||||
|
void CheckInLayoutList();
|
||||||
|
void SelectedDetail(quint32 id);
|
||||||
|
|
||||||
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"
|
||||||
|
@ -710,6 +711,7 @@ void VToolDetail::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||||
|
|
||||||
if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick)
|
if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick)
|
||||||
{
|
{
|
||||||
|
doc->SelectedDetail(id);
|
||||||
emit ChoosedTool(id, SceneObject::Detail);
|
emit ChoosedTool(id, SceneObject::Detail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -771,15 +773,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)
|
||||||
{
|
{
|
||||||
|
@ -791,6 +793,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
|
||||||
|
|
|
@ -82,22 +82,6 @@ void ToggleDetailInLayout::redo()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
bool ToggleDetailInLayout::mergeWith(const QUndoCommand *command)
|
|
||||||
{
|
|
||||||
const ToggleDetailInLayout *stateCommand = static_cast<const ToggleDetailInLayout *>(command);
|
|
||||||
SCASSERT(stateCommand != nullptr);
|
|
||||||
const quint32 id = stateCommand->getDetId();
|
|
||||||
|
|
||||||
if (id != m_id)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_newState = stateCommand->getNewState();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
int ToggleDetailInLayout::id() const
|
int ToggleDetailInLayout::id() const
|
||||||
{
|
{
|
||||||
|
@ -134,8 +118,7 @@ void ToggleDetailInLayout::Do(bool state)
|
||||||
VDetail det = m_data->DataDetails()->value(m_id);
|
VDetail det = m_data->DataDetails()->value(m_id);
|
||||||
det.SetInLayout(state);
|
det.SetInLayout(state);
|
||||||
m_data->UpdateDetail(m_id, det);
|
m_data->UpdateDetail(m_id, det);
|
||||||
|
emit UpdateList();
|
||||||
emit NeedLiteParsing(Document::LiteParse);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,10 +50,12 @@ public:
|
||||||
virtual ~ToggleDetailInLayout();
|
virtual ~ToggleDetailInLayout();
|
||||||
virtual void undo() Q_DECL_OVERRIDE;
|
virtual void undo() Q_DECL_OVERRIDE;
|
||||||
virtual void redo() Q_DECL_OVERRIDE;
|
virtual void redo() Q_DECL_OVERRIDE;
|
||||||
virtual bool mergeWith(const QUndoCommand *command) Q_DECL_OVERRIDE;
|
|
||||||
virtual int id() const Q_DECL_OVERRIDE;
|
virtual int id() const Q_DECL_OVERRIDE;
|
||||||
quint32 getDetId() const;
|
quint32 getDetId() const;
|
||||||
bool getNewState() const;
|
bool getNewState() const;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void UpdateList();
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(ToggleDetailInLayout)
|
Q_DISABLE_COPY(ToggleDetailInLayout)
|
||||||
quint32 m_id;
|
quint32 m_id;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user