Fixed issue #836. Change Detail Name - Update List of Details.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2018-04-07 14:11:44 +03:00
parent 188db90050
commit cc4768ff77
8 changed files with 38 additions and 8 deletions

View File

@ -1458,13 +1458,22 @@ void MainWindow::ShowToolTip(const QString &toolTip)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief triggers the update of the groups * @brief triggers the update of the visibility groups
*/ */
void MainWindow::UpdateGroups() void MainWindow::UpdateVisibilityGroups()
{ {
groupsWidget->UpdateGroups(); groupsWidget->UpdateGroups();
} }
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief triggers the update of the details list
*/
void MainWindow::UpdateDetailsList()
{
detailsWidget->UpdateList();
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief showEvent handle after show window. * @brief showEvent handle after show window.
@ -4155,7 +4164,7 @@ void MainWindow::InitDocksContain()
qCDebug(vMainWindow, "Initialization groups dock."); qCDebug(vMainWindow, "Initialization groups dock.");
groupsWidget = new VWidgetGroups(doc, this); groupsWidget = new VWidgetGroups(doc, this);
ui->dockWidgetGroups->setWidget(groupsWidget); ui->dockWidgetGroups->setWidget(groupsWidget);
connect(doc,&VAbstractPattern::UpdateGroups , this, &MainWindow::UpdateGroups); connect(doc,&VAbstractPattern::UpdateGroups , this, &MainWindow::UpdateVisibilityGroups);
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);

View File

@ -69,7 +69,8 @@ public:
public slots: public slots:
void ProcessCMD(); void ProcessCMD();
virtual void ShowToolTip(const QString &toolTip) Q_DECL_OVERRIDE; virtual void ShowToolTip(const QString &toolTip) Q_DECL_OVERRIDE;
virtual void UpdateGroups() Q_DECL_OVERRIDE; virtual void UpdateVisibilityGroups() Q_DECL_OVERRIDE;
virtual void UpdateDetailsList() Q_DECL_OVERRIDE;
signals: signals:
void RefreshHistory(); void RefreshHistory();

View File

@ -293,7 +293,7 @@ void VDrawTool::ContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 itemI
SCASSERT(window != nullptr) SCASSERT(window != nullptr)
{ {
AddItemToGroup *addItemToGroup = new AddItemToGroup(item, doc, groupId); AddItemToGroup *addItemToGroup = new AddItemToGroup(item, doc, groupId);
connect(addItemToGroup, &AddItemToGroup::UpdateGroups, window, &VAbstractMainWindow::UpdateGroups); connect(addItemToGroup, &AddItemToGroup::UpdateGroups, window, &VAbstractMainWindow::UpdateVisibilityGroups);
qApp->getUndoStack()->push(addItemToGroup); qApp->getUndoStack()->push(addItemToGroup);
} }
} }
@ -306,7 +306,7 @@ void VDrawTool::ContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 itemI
SCASSERT(window != nullptr) SCASSERT(window != nullptr)
{ {
RemoveItemFromGroup *removeItemFromGroup = new RemoveItemFromGroup(item, doc, groupId); RemoveItemFromGroup *removeItemFromGroup = new RemoveItemFromGroup(item, doc, groupId);
connect(removeItemFromGroup, &RemoveItemFromGroup::UpdateGroups, window, &VAbstractMainWindow::UpdateGroups); connect(removeItemFromGroup, &RemoveItemFromGroup::UpdateGroups, window, &VAbstractMainWindow::UpdateVisibilityGroups);
qApp->getUndoStack()->push(removeItemFromGroup); qApp->getUndoStack()->push(removeItemFromGroup);
} }
} }

View File

@ -51,6 +51,7 @@
#include "../undocommands/togglepiecestate.h" #include "../undocommands/togglepiecestate.h"
#include "../vwidgets/vmaingraphicsview.h" #include "../vwidgets/vmaingraphicsview.h"
#include "../vwidgets/vnobrushscalepathitem.h" #include "../vwidgets/vnobrushscalepathitem.h"
#include "../vwidgets/vabstractmainwindow.h"
#include "../qmuparser/qmutokenparser.h" #include "../qmuparser/qmutokenparser.h"
#include <QFuture> #include <QFuture>
@ -1437,6 +1438,10 @@ void VToolSeamAllowance::SaveDialogChange(const QString &undoText)
const bool groupChange = not undocommands.isEmpty(); const bool groupChange = not undocommands.isEmpty();
SavePieceOptions *saveCommand = new SavePieceOptions(oldDet, newDet, doc, m_id); SavePieceOptions *saveCommand = new SavePieceOptions(oldDet, newDet, doc, m_id);
if (VAbstractMainWindow *window = qobject_cast<VAbstractMainWindow *>(qApp->getMainWindow()))
{ // Better not to crash here, just silently do not update list.
connect(saveCommand, &SavePieceOptions::UpdateGroups, window, &VAbstractMainWindow::UpdateDetailsList);
}
if (groupChange) if (groupChange)
{ {

View File

@ -93,6 +93,8 @@ void SavePieceOptions::undo()
{ {
tool->Update(m_oldDet); tool->Update(m_oldDet);
} }
emit UpdateGroups();
} }
else else
{ {
@ -138,6 +140,8 @@ void SavePieceOptions::redo()
{ {
tool->Update(m_newDet); tool->Update(m_newDet);
} }
emit UpdateGroups();
} }
else else
{ {

View File

@ -36,6 +36,7 @@
class SavePieceOptions : public VUndoCommand class SavePieceOptions : public VUndoCommand
{ {
Q_OBJECT
public: public:
SavePieceOptions(const VPiece &oldDet, const VPiece &newDet, VAbstractPattern *doc, quint32 id, SavePieceOptions(const VPiece &oldDet, const VPiece &newDet, VAbstractPattern *doc, quint32 id,
QUndoCommand *parent = nullptr); QUndoCommand *parent = nullptr);
@ -47,6 +48,8 @@ public:
virtual int id() const Q_DECL_OVERRIDE; virtual int id() const Q_DECL_OVERRIDE;
quint32 DetId() const; quint32 DetId() const;
VPiece NewDet() const; VPiece NewDet() const;
signals:
void UpdateGroups();
private: private:
Q_DISABLE_COPY(SavePieceOptions) Q_DISABLE_COPY(SavePieceOptions)

View File

@ -158,6 +158,13 @@ void VAbstractMainWindow::ExportDataToCSV()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VAbstractMainWindow::UpdateGroups() void VAbstractMainWindow::UpdateVisibilityGroups()
{ {
// do nothing
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractMainWindow::UpdateDetailsList()
{
// do nothing
} }

View File

@ -46,7 +46,8 @@ public:
public slots: public slots:
virtual void ShowToolTip(const QString &toolTip)=0; virtual void ShowToolTip(const QString &toolTip)=0;
virtual void UpdateGroups(); virtual void UpdateVisibilityGroups();
virtual void UpdateDetailsList();
protected slots: protected slots:
void WindowsLocale(); void WindowsLocale();