From 48e411a3ce97a57b27279153fd56c9e7f8356c94 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 7 Apr 2016 17:57:53 +0300 Subject: [PATCH] Working with group widget. --HG-- branch : feature --- src/app/valentina/dialogs/dialogs.pri | 9 +- src/app/valentina/dialogs/vwidgetgroups.cpp | 159 ++++++++++++++++++ src/app/valentina/dialogs/vwidgetgroups.h | 62 +++++++ src/app/valentina/dialogs/vwidgetgroups.ui | 58 +++++++ src/app/valentina/mainwindow.cpp | 20 ++- src/app/valentina/mainwindow.h | 4 +- src/libs/ifc/xml/vabstractpattern.cpp | 117 ++++++++++++- src/libs/ifc/xml/vabstractpattern.h | 7 +- src/libs/vmisc/share/resources/icon.qrc | 4 + .../share/resources/icon/16x16/closed_eye.png | Bin 0 -> 416 bytes .../resources/icon/16x16/closed_eye@2x.png | Bin 0 -> 668 bytes .../share/resources/icon/16x16/open_eye.png | Bin 0 -> 527 bytes .../resources/icon/16x16/open_eye@2x.png | Bin 0 -> 1107 bytes .../share/resources/icon/svg/closed_eye.svg | 99 +++++++++++ .../share/resources/icon/svg/open_eye.svg | 5 + .../toolsinglepoint/vtoolsinglepoint.cpp | 7 + .../toolsinglepoint/vtoolsinglepoint.h | 1 + src/libs/vtools/undocommands/addgroup.cpp | 2 + src/libs/vtools/undocommands/addgroup.h | 2 + src/libs/vtools/undocommands/delgroup.cpp | 2 + src/libs/vtools/undocommands/delgroup.h | 2 + 21 files changed, 545 insertions(+), 15 deletions(-) create mode 100644 src/app/valentina/dialogs/vwidgetgroups.cpp create mode 100644 src/app/valentina/dialogs/vwidgetgroups.h create mode 100644 src/app/valentina/dialogs/vwidgetgroups.ui create mode 100644 src/libs/vmisc/share/resources/icon/16x16/closed_eye.png create mode 100644 src/libs/vmisc/share/resources/icon/16x16/closed_eye@2x.png create mode 100644 src/libs/vmisc/share/resources/icon/16x16/open_eye.png create mode 100644 src/libs/vmisc/share/resources/icon/16x16/open_eye@2x.png create mode 100644 src/libs/vmisc/share/resources/icon/svg/closed_eye.svg create mode 100644 src/libs/vmisc/share/resources/icon/svg/open_eye.svg diff --git a/src/app/valentina/dialogs/dialogs.pri b/src/app/valentina/dialogs/dialogs.pri index f110de946..c5910f074 100644 --- a/src/app/valentina/dialogs/dialogs.pri +++ b/src/app/valentina/dialogs/dialogs.pri @@ -17,7 +17,8 @@ HEADERS += \ $$PWD/configpages/pathpage.h \ $$PWD/dialoglayoutsettings.h \ $$PWD/dialoglayoutprogress.h \ - $$PWD/dialogsavelayout.h + $$PWD/dialogsavelayout.h \ + $$PWD/vwidgetgroups.h SOURCES += \ $$PWD/dialogincrements.cpp \ @@ -33,7 +34,8 @@ SOURCES += \ $$PWD/configpages/pathpage.cpp \ $$PWD/dialoglayoutsettings.cpp \ $$PWD/dialoglayoutprogress.cpp \ - $$PWD/dialogsavelayout.cpp + $$PWD/dialogsavelayout.cpp \ + $$PWD/vwidgetgroups.cpp FORMS += \ $$PWD/dialogincrements.ui \ @@ -44,4 +46,5 @@ FORMS += \ $$PWD/dialogpatternxmledit.ui \ $$PWD/dialoglayoutsettings.ui \ $$PWD/dialoglayoutprogress.ui \ - $$PWD/dialogsavelayout.ui + $$PWD/dialogsavelayout.ui \ + $$PWD/vwidgetgroups.ui diff --git a/src/app/valentina/dialogs/vwidgetgroups.cpp b/src/app/valentina/dialogs/vwidgetgroups.cpp new file mode 100644 index 000000000..3d5965a5f --- /dev/null +++ b/src/app/valentina/dialogs/vwidgetgroups.cpp @@ -0,0 +1,159 @@ +/************************************************************************ + ** + ** @file vwidgetgroups.cpp + ** @author Roman Telezhynskyi + ** @date 6 4, 2016 + ** + ** @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) 2016 Valentina project + ** 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 . + ** + *************************************************************************/ + +#include "vwidgetgroups.h" +#include "ui_vwidgetgroups.h" +#include "../vtools/dialogs/tools/dialoggroup.h" +#include "../vtools/undocommands/delgroup.h" + +#include + +//--------------------------------------------------------------------------------------------------------------------- +VWidgetGroups::VWidgetGroups(VAbstractPattern *doc, QWidget *parent) + : QWidget(parent), + ui(new Ui::VWidgetGroups), + doc(doc) +{ + ui->setupUi(this); + + FillTable(doc->GetGroups()); + + ui->tableWidget->setContextMenuPolicy(Qt::CustomContextMenu); + + connect(ui->tableWidget, &QTableWidget::cellClicked, this, &VWidgetGroups::GroupVisibilityChanged); + connect(ui->tableWidget, &QTableWidget::customContextMenuRequested, this, &VWidgetGroups::CtxMenu); +} + +//--------------------------------------------------------------------------------------------------------------------- +VWidgetGroups::~VWidgetGroups() +{ + delete ui; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VWidgetGroups::GroupVisibilityChanged(int row, int column) +{ + if (column != 0) + { + return; + } + + QTableWidgetItem *item = ui->tableWidget->item(row, column); + const quint32 id = item->data(Qt::UserRole).toUInt(); + const bool visible = not doc->GetGroupVisivility(id); + doc->SetGroupVisivility(id, visible); + if (visible) + { + item->setIcon(QIcon("://icon/16x16/open_eye.png")); + } + else + { + item->setIcon(QIcon("://icon/16x16/closed_eye.png")); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +void VWidgetGroups::CtxMenu(const QPoint &pos) +{ + QTableWidgetItem *item = ui->tableWidget->itemAt(pos); + if(not item) + { + return; + } + + const int row = item->row(); + item = ui->tableWidget->item(row, 0); + const quint32 id = item->data(Qt::UserRole).toUInt(); + + QMenu *menu = new QMenu; + QAction *actionRename = menu->addAction(tr("Rename")); + QAction *actionDelete = menu->addAction(tr("Delete")); + QAction *selectedAction = menu->exec(ui->tableWidget->viewport()->mapToGlobal(pos)); + if (selectedAction == actionRename) + { + DialogGroup *dialog = new DialogGroup(new VContainer(qApp->TrVars(), qApp->patternUnitP()), NULL_ID, this); + dialog->SetName(doc->GetGroupName(id)); + const int result = dialog->exec(); + + if (result == QDialog::Accepted) + { + doc->SetGroupName(id, dialog->GetName()); + item = ui->tableWidget->item(row, 1); + item->setText(dialog->GetName()); + } + delete dialog; + } + else if (selectedAction == actionDelete) + { + DelGroup *delGroup = new DelGroup(doc, id); + connect(delGroup, &DelGroup::UpdateGroups, this, &VWidgetGroups::UpdateGroups); + qApp->getUndoStack()->push(delGroup); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +void VWidgetGroups::UpdateGroups() +{ + FillTable(doc->GetGroups()); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VWidgetGroups::FillTable(const QMap > &groups) +{ + ui->tableWidget->clear(); + + ui->tableWidget->setColumnCount(2); + ui->tableWidget->setRowCount(groups.size()); + qint32 currentRow = -1; + auto i = groups.constBegin(); + while (i != groups.constEnd()) + { + ++currentRow; + const QPair data = i.value(); + + QTableWidgetItem *item = new QTableWidgetItem(); + item->setTextAlignment(Qt::AlignHCenter); + if (data.second) + { + item->setIcon(QIcon("://icon/16x16/open_eye.png")); + } + else + { + item->setIcon(QIcon("://icon/16x16/closed_eye.png")); + } + item->setData(Qt::UserRole, i.key()); + ui->tableWidget->setItem(currentRow, 0, item); + + item = new QTableWidgetItem(data.first); + item->setTextAlignment(Qt::AlignLeft); + ui->tableWidget->setItem(currentRow, 1, item); + ++i; + } + ui->tableWidget->resizeColumnsToContents(); + ui->tableWidget->resizeRowsToContents(); +} diff --git a/src/app/valentina/dialogs/vwidgetgroups.h b/src/app/valentina/dialogs/vwidgetgroups.h new file mode 100644 index 000000000..5d46f7a57 --- /dev/null +++ b/src/app/valentina/dialogs/vwidgetgroups.h @@ -0,0 +1,62 @@ +/************************************************************************ + ** + ** @file vwidgetgroups.h + ** @author Roman Telezhynskyi + ** @date 6 4, 2016 + ** + ** @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) 2016 Valentina project + ** 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 . + ** + *************************************************************************/ + +#ifndef VWIDGETGROUPS_H +#define VWIDGETGROUPS_H + +#include +#include "../ifc/xml/vabstractpattern.h" + +namespace Ui +{ + class VWidgetGroups; +} + +class VWidgetGroups : public QWidget +{ + Q_OBJECT + +public: + explicit VWidgetGroups(VAbstractPattern *doc, QWidget *parent = nullptr); + virtual ~VWidgetGroups(); + +public slots: + void UpdateGroups(); + +private slots: + void GroupVisibilityChanged(int row, int column); + void CtxMenu(const QPoint &pos); +private: + Q_DISABLE_COPY(VWidgetGroups) + Ui::VWidgetGroups *ui; + VAbstractPattern *doc; + + void FillTable(const QMap > &groups); +}; + +#endif // VWIDGETGROUPS_H diff --git a/src/app/valentina/dialogs/vwidgetgroups.ui b/src/app/valentina/dialogs/vwidgetgroups.ui new file mode 100644 index 000000000..3bd6c417e --- /dev/null +++ b/src/app/valentina/dialogs/vwidgetgroups.ui @@ -0,0 +1,58 @@ + + + VWidgetGroups + + + + 0 + 0 + 371 + 279 + + + + Form + + + + + + true + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + false + + + false + + + 16 + + + false + + + true + + + false + + + false + + + 10 + + + + + + + + diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index a1e99b1b3..a54c5aed8 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -54,6 +54,7 @@ #include "tools/vtooldetail.h" #include "tools/vtooluniondetails.h" #include "dialogs/dialogs.h" +#include "dialogs/vwidgetgroups.h" #include "../vtools/undocommands/addgroup.h" #include @@ -119,7 +120,9 @@ MainWindow::MainWindow(QWidget *parent) separatorAct(nullptr), leftGoToStage(nullptr), rightGoToStage(nullptr), autoSaveTimer(nullptr), guiEnabled(true), gradationHeights(nullptr), gradationSizes(nullptr), gradationHeightsLabel(nullptr), gradationSizesLabel(nullptr), - toolOptions(nullptr), lock(nullptr) + toolOptions(nullptr), + groupsWidget(nullptr), + lock(nullptr) { for (int i = 0; i < MaxRecentFiles; ++i) { @@ -154,7 +157,7 @@ MainWindow::MainWindow(QWidget *parent) ui->toolBox->setCurrentIndex(0); ReadSettings(); - PropertyBrowser(); + InitDocksContain(); setCurrentFile(""); WindowsLocale(); @@ -1001,6 +1004,7 @@ void MainWindow::ClosedDialogUnionDetails(int result) void MainWindow::ToolGroup(bool checked) { ToolSelectGroupObjects(); + currentScene->clearSelection(); SetToolButton(checked, Tool::Group, ":/cursor/group_plus_cursor.png", tr("Select objects, Enter - finish creation"), &MainWindow::ClosedDialogGroup); } @@ -1020,6 +1024,7 @@ void MainWindow::ClosedDialogGroup(int result) if (not group.isNull()) { AddGroup *addGroup = new AddGroup(group, doc); + connect(addGroup, &AddGroup::UpdateGroups, groupsWidget, &VWidgetGroups::UpdateGroups); qApp->getUndoStack()->push(addGroup); } } @@ -1733,7 +1738,7 @@ void MainWindow::InitToolButtons() connect(ui->toolButtonPointFromArcAndTangent, &QToolButton::clicked, this, &MainWindow::ToolPointFromArcAndTangent); connect(ui->toolButtonArcWithLength, &QToolButton::clicked, this, &MainWindow::ToolArcWithLength); connect(ui->toolButtonTrueDarts, &QToolButton::clicked, this, &MainWindow::ToolTrueDarts); - + connect(ui->toolButtonGroup, &QToolButton::clicked, this, &MainWindow::ToolGroup); } //--------------------------------------------------------------------------------------------------------------------- @@ -3551,13 +3556,17 @@ void MainWindow::AddDocks() } //--------------------------------------------------------------------------------------------------------------------- -void MainWindow::PropertyBrowser() +void MainWindow::InitDocksContain() { qCDebug(vMainWindow, "Initialization property browser."); toolOptions = new VToolOptionsPropertyBrowser(ui->dockWidgetToolOptions); connect(ui->view, &VMainGraphicsView::itemClicked, toolOptions, &VToolOptionsPropertyBrowser::itemClicked); connect(doc, &VPattern::FullUpdateFromFile, toolOptions, &VToolOptionsPropertyBrowser::UpdateOptions); + + qCDebug(vMainWindow, "Initialization groups dock."); + groupsWidget = new VWidgetGroups(doc, this); + ui->dockWidgetGroups->setWidget(groupsWidget); } //--------------------------------------------------------------------------------------------------------------------- @@ -4140,6 +4149,7 @@ void MainWindow::ChangePP(int index, bool zoomBestFit) } } toolOptions->itemClicked(nullptr);//hide options for tool in previous pattern piece + groupsWidget->UpdateGroups(); } } @@ -4724,7 +4734,7 @@ void MainWindow::ToolSelectGroupObjects() const emit ItemsSelection(SelectionType::ByMouseRelease); - ui->view->AllowRubberBand(false); + ui->view->AllowRubberBand(true); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/app/valentina/mainwindow.h b/src/app/valentina/mainwindow.h index 673dcdf63..98b383942 100644 --- a/src/app/valentina/mainwindow.h +++ b/src/app/valentina/mainwindow.h @@ -48,6 +48,7 @@ class QLabel; class DialogIncrements; class DialogTool; class DialogHistory; +class VWidgetGroups; /** * @brief The MainWindow class main windows. @@ -276,6 +277,7 @@ private: QPointer gradationHeightsLabel; QPointer gradationSizesLabel; VToolOptionsPropertyBrowser *toolOptions; + VWidgetGroups *groupsWidget; std::shared_ptr> lock; void SetDefaultHeight(); @@ -333,7 +335,7 @@ private: void UpdateSizesList(const QStringList &list); void AddDocks(); - void PropertyBrowser(); + void InitDocksContain(); bool OpenNewValentina(const QString &fileName = QString())const; void FileClosedCorrect(); QStringList GetUnlokedRestoreFileList()const; diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp index d723c0365..9b4758bf7 100644 --- a/src/libs/ifc/xml/vabstractpattern.cpp +++ b/src/libs/ifc/xml/vabstractpattern.cpp @@ -323,8 +323,9 @@ void VAbstractPattern::ParseGroups(const QDomElement &domElement) itemTool.insert(i.key(), i.value()); } - const bool previous = itemVisibility.value(i.key(), true); + const bool previous = itemVisibility.value(i.key(), false); itemVisibility.insert(i.key(), previous || groupData.first); + ++i; } } } @@ -340,6 +341,7 @@ void VAbstractPattern::ParseGroups(const QDomElement &domElement) VDataTool* tool = tools.value(i.value()); tool->GroupVisibility(i.key(), itemVisibility.value(i.key(), true)); } + ++i; } } @@ -1478,9 +1480,9 @@ QDomElement VAbstractPattern::CreateGroup(quint32 id, const QString &name, const } QDomElement group = createElement(TagGroup); - group.setAttribute(AttrId, id); - group.setAttribute(AttrName, name); - group.setAttribute(AttrVisible, trueStr); + SetAttribute(group, AttrId, id); + SetAttribute(group, AttrName, name); + SetAttribute(group, AttrVisible, true); auto i = groupData.constBegin(); while (i != groupData.constEnd()) @@ -1495,6 +1497,38 @@ QDomElement VAbstractPattern::CreateGroup(quint32 id, const QString &name, const return group; } +//--------------------------------------------------------------------------------------------------------------------- +QString VAbstractPattern::GetGroupName(quint32 id) +{ + QString name = tr("New group"); + QDomElement groups = CreateGroups(); + if (not groups.isNull()) + { + QDomElement group = elementById(id); + if (group.isElement()) + { + name = GetParametrString(group, AttrName, name); + return name; + } + else + { + if (groups.childNodes().isEmpty()) + { + QDomNode parent = groups.parentNode(); + parent.removeChild(groups); + } + + qDebug("Can't get group by id = %u.", id); + return name; + } + } + else + { + qDebug("Can't get tag Groups."); + return name; + } +} + //--------------------------------------------------------------------------------------------------------------------- void VAbstractPattern::SetGroupName(quint32 id, const QString &name) { @@ -1526,3 +1560,78 @@ void VAbstractPattern::SetGroupName(quint32 id, const QString &name) return; } } + +//--------------------------------------------------------------------------------------------------------------------- +QMap > VAbstractPattern::GetGroups() +{ + QMap > data; + + QDomElement groups = CreateGroups(); + if (not groups.isNull()) + { + QDomNode domNode = groups.firstChild(); + while (domNode.isNull() == false) + { + if (domNode.isElement()) + { + const QDomElement group = domNode.toElement(); + if (group.isNull() == false) + { + if (group.tagName() == TagGroup) + { + const quint32 id = GetParametrUInt(group, AttrId, "0"); + const bool visible = GetParametrBool(group, AttrVisible, trueStr); + const QString name = GetParametrString(group, AttrName, tr("New group")); + + data.insert(id, qMakePair(name, visible)); + } + } + } + domNode = domNode.nextSibling(); + } + } + else + { + qDebug("Can't get tag Groups."); + } + + return data; +} + +//--------------------------------------------------------------------------------------------------------------------- +bool VAbstractPattern::GetGroupVisivility(quint32 id) +{ + QDomElement group = elementById(id); + if (group.isElement()) + { + return GetParametrBool(group, AttrVisible, trueStr); + } + else + { + qDebug("Can't get group by id = %u.", id); + return true; + } +} + +//--------------------------------------------------------------------------------------------------------------------- +void VAbstractPattern::SetGroupVisivility(quint32 id, bool visible) +{ + QDomElement group = elementById(id); + if (group.isElement()) + { + SetAttribute(group, AttrVisible, visible); + modified = true; + emit patternChanged(false); + + QDomElement groups = CreateGroups(); + if (not groups.isNull()) + { + ParseGroups(groups); + } + } + else + { + qDebug("Can't get group by id = %u.", id); + return; + } +} diff --git a/src/libs/ifc/xml/vabstractpattern.h b/src/libs/ifc/xml/vabstractpattern.h index 90e8c1b3c..0f5c77396 100644 --- a/src/libs/ifc/xml/vabstractpattern.h +++ b/src/libs/ifc/xml/vabstractpattern.h @@ -67,8 +67,6 @@ public: bool GetActivDrawElement(QDomElement &element) const; bool GetActivNodeElement(const QString& name, QDomElement& element) const; - void ParseGroups(const QDomElement &domElement); - quint32 getCursor() const; void setCursor(const quint32 &value); @@ -116,9 +114,14 @@ public: QDomElement GetDraw(const QString &name) const; + void ParseGroups(const QDomElement &domElement); QDomElement CreateGroups(); QDomElement CreateGroup(quint32 id, const QString &name, const QMap &groupData); + QString GetGroupName(quint32 id); void SetGroupName(quint32 id, const QString &name); + QMap > GetGroups(); + bool GetGroupVisivility(quint32 id); + void SetGroupVisivility(quint32 id, bool visible); static const QString TagPattern; static const QString TagCalculation; diff --git a/src/libs/vmisc/share/resources/icon.qrc b/src/libs/vmisc/share/resources/icon.qrc index 3d273e73d..8abf44308 100644 --- a/src/libs/vmisc/share/resources/icon.qrc +++ b/src/libs/vmisc/share/resources/icon.qrc @@ -57,5 +57,9 @@ icon/16x16/toolsectionpoint@2x.png icon/16x16/operations.png icon/16x16/operations@2x.png + icon/16x16/closed_eye.png + icon/16x16/closed_eye@2x.png + icon/16x16/open_eye.png + icon/16x16/open_eye@2x.png diff --git a/src/libs/vmisc/share/resources/icon/16x16/closed_eye.png b/src/libs/vmisc/share/resources/icon/16x16/closed_eye.png new file mode 100644 index 0000000000000000000000000000000000000000..dc1142f4a29195ecebcea04c689eecebcb91a475 GIT binary patch literal 416 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 Z<1f+1Yiy&t4WR%4002ovPDHLkV1kvA1cm?r literal 0 HcmV?d00001 diff --git a/src/libs/vmisc/share/resources/icon/svg/closed_eye.svg b/src/libs/vmisc/share/resources/icon/svg/closed_eye.svg new file mode 100644 index 000000000..c22134f20 --- /dev/null +++ b/src/libs/vmisc/share/resources/icon/svg/closed_eye.svg @@ -0,0 +1,99 @@ + + + + + + image/svg+xml + + Closed Eye + + + + + + Closed Eye + Created with Sketch (http://www.bohemiancoding.com/sketch) + + + + + + + + + + + + + diff --git a/src/libs/vmisc/share/resources/icon/svg/open_eye.svg b/src/libs/vmisc/share/resources/icon/svg/open_eye.svg new file mode 100644 index 000000000..11b37c377 --- /dev/null +++ b/src/libs/vmisc/share/resources/icon/svg/open_eye.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp index b41c53e4b..0fc8aca76 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp @@ -66,6 +66,7 @@ VToolSinglePoint::VToolSinglePoint(VAbstractPattern *doc, VContainer *data, quin connect(namePoint, &VGraphicsSimpleTextItem::ShowContextMenu, this, &VToolSinglePoint::contextMenuEvent); connect(namePoint, &VGraphicsSimpleTextItem::DeleteTool, this, &VToolSinglePoint::DeleteFromLabel); connect(namePoint, &VGraphicsSimpleTextItem::PointChoosed, this, &VToolSinglePoint::PointChoosed); + connect(namePoint, &VGraphicsSimpleTextItem::PointSelected, this, &VToolSinglePoint::PointSelected); connect(namePoint, &VGraphicsSimpleTextItem::NameChangePosition, this, &VToolSinglePoint::NameChangePosition); lineName = new QGraphicsLineItem(this); this->setBrush(QBrush(Qt::NoBrush)); @@ -174,6 +175,12 @@ void VToolSinglePoint::PointChoosed() emit ChoosedTool(id, SceneObject::Point); } +//--------------------------------------------------------------------------------------------------------------------- +void VToolSinglePoint::PointSelected(bool selected) +{ + setSelected(selected); +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief FullUpdateFromFile update tool data form file. diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.h index 9c0cf5710..dbacedea4 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.h @@ -60,6 +60,7 @@ public slots: virtual void Disable(bool disable, const QString &namePP) Q_DECL_OVERRIDE; virtual void EnableToolMove(bool move) Q_DECL_OVERRIDE; void PointChoosed(); + void PointSelected(bool selected); virtual void FullUpdateFromFile() Q_DECL_OVERRIDE; virtual void DoChangePosition(quint32 id, qreal mx, qreal my) Q_DECL_OVERRIDE; virtual void AllowHover(bool enabled) Q_DECL_OVERRIDE; diff --git a/src/libs/vtools/undocommands/addgroup.cpp b/src/libs/vtools/undocommands/addgroup.cpp index 2a5bdf65b..fbb4f05c7 100644 --- a/src/libs/vtools/undocommands/addgroup.cpp +++ b/src/libs/vtools/undocommands/addgroup.cpp @@ -64,6 +64,7 @@ void AddGroup::undo() qCDebug(vUndo, "Can't delete group."); return; } + emit UpdateGroups(); } else { @@ -99,6 +100,7 @@ void AddGroup::redo() { groups.appendChild(xml); doc->ParseGroups(groups); + emit UpdateGroups(); } else { diff --git a/src/libs/vtools/undocommands/addgroup.h b/src/libs/vtools/undocommands/addgroup.h index ae3273253..ca0807fdf 100644 --- a/src/libs/vtools/undocommands/addgroup.h +++ b/src/libs/vtools/undocommands/addgroup.h @@ -39,6 +39,8 @@ public: virtual ~AddGroup(); virtual void undo() Q_DECL_OVERRIDE; virtual void redo() Q_DECL_OVERRIDE; +signals: + void UpdateGroups(); private: Q_DISABLE_COPY(AddGroup) const QString nameActivDraw; diff --git a/src/libs/vtools/undocommands/delgroup.cpp b/src/libs/vtools/undocommands/delgroup.cpp index 17ce0c0ce..818e5e1a6 100644 --- a/src/libs/vtools/undocommands/delgroup.cpp +++ b/src/libs/vtools/undocommands/delgroup.cpp @@ -57,6 +57,7 @@ void DelGroup::undo() { groups.appendChild(xml); doc->ParseGroups(groups); + emit UpdateGroups(); } else { @@ -87,6 +88,7 @@ void DelGroup::redo() qCDebug(vUndo, "Can't delete group."); return; } + emit UpdateGroups(); if (groups.childNodes().isEmpty()) { diff --git a/src/libs/vtools/undocommands/delgroup.h b/src/libs/vtools/undocommands/delgroup.h index fc8638445..a04372470 100644 --- a/src/libs/vtools/undocommands/delgroup.h +++ b/src/libs/vtools/undocommands/delgroup.h @@ -39,6 +39,8 @@ public: virtual ~DelGroup(); virtual void undo() Q_DECL_OVERRIDE; virtual void redo() Q_DECL_OVERRIDE; +signals: + void UpdateGroups(); private: Q_DISABLE_COPY(DelGroup) const QString nameActivDraw;