diff --git a/share/translations/seamly2d_cs_CZ.ts b/share/translations/seamly2d_cs_CZ.ts
index 0f405efaf7dd..514b6069bb49 100644
--- a/share/translations/seamly2d_cs_CZ.ts
+++ b/share/translations/seamly2d_cs_CZ.ts
@@ -4013,10 +4013,6 @@ Possibly the file is already being downloaded.
-
-
-
-
Smazat
@@ -4209,6 +4205,34 @@ Possibly the file is already being downloaded.
Název
+
+
+ Upravit
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
HistoryDialog
diff --git a/share/translations/seamly2d_de_DE.ts b/share/translations/seamly2d_de_DE.ts
index 08e2fe0ac772..bb863e5ee4ff 100644
--- a/share/translations/seamly2d_de_DE.ts
+++ b/share/translations/seamly2d_de_DE.ts
@@ -4022,10 +4022,6 @@ Possibly the file is already being downloaded.
Gruppe bearbeiten
-
-
- Umbenennen
-
Löschen
@@ -4218,6 +4214,34 @@ Possibly the file is already being downloaded.
Bezeichnung
+
+
+ Bearbeiten
+
+
+
+
+
+
+
+
+
+
+
+ Gesperrt
+
+
+
+
+
+
+
+
+
+
+
+ Farbe
+
HistoryDialog
diff --git a/share/translations/seamly2d_el_GR.ts b/share/translations/seamly2d_el_GR.ts
index 21e99583e90c..47d9b53f65c3 100644
--- a/share/translations/seamly2d_el_GR.ts
+++ b/share/translations/seamly2d_el_GR.ts
@@ -4013,10 +4013,6 @@ Possibly the file is already being downloaded.
-
-
- Μετονομασία
-
Διαγραφή
@@ -4209,6 +4205,34 @@ Possibly the file is already being downloaded.
Όνομα
+
+
+ Επεξεργασία
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
HistoryDialog
diff --git a/share/translations/seamly2d_en_CA.ts b/share/translations/seamly2d_en_CA.ts
index dfdba8f659bb..d53e6dde1157 100644
--- a/share/translations/seamly2d_en_CA.ts
+++ b/share/translations/seamly2d_en_CA.ts
@@ -4013,10 +4013,6 @@ Possibly the file is already being downloaded.
-
-
- Rename
-
Delete
@@ -4209,6 +4205,34 @@ Possibly the file is already being downloaded.
Name
+
+
+ Edit
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
HistoryDialog
diff --git a/share/translations/seamly2d_en_GB.ts b/share/translations/seamly2d_en_GB.ts
index 67603da70a5b..3f5b9e8e91b3 100644
--- a/share/translations/seamly2d_en_GB.ts
+++ b/share/translations/seamly2d_en_GB.ts
@@ -4013,10 +4013,6 @@ Possibly the file is already being downloaded.
-
-
- Rename
-
Delete
@@ -4209,6 +4205,34 @@ Possibly the file is already being downloaded.
Name
+
+
+ Edit
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
HistoryDialog
diff --git a/share/translations/seamly2d_en_IN.ts b/share/translations/seamly2d_en_IN.ts
index ee03225cbc9e..1cabff5f0bf0 100644
--- a/share/translations/seamly2d_en_IN.ts
+++ b/share/translations/seamly2d_en_IN.ts
@@ -4013,10 +4013,6 @@ Possibly the file is already being downloaded.
-
-
- Rename
-
Delete
@@ -4209,6 +4205,34 @@ Possibly the file is already being downloaded.
Name
+
+
+ Edit
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
HistoryDialog
diff --git a/share/translations/seamly2d_en_US.ts b/share/translations/seamly2d_en_US.ts
index c59f44d496b5..931805e6771e 100644
--- a/share/translations/seamly2d_en_US.ts
+++ b/share/translations/seamly2d_en_US.ts
@@ -4013,10 +4013,6 @@ Possibly the file is already being downloaded.
-
-
- Rename
-
Delete
@@ -4209,6 +4205,34 @@ Possibly the file is already being downloaded.
Name
+
+
+ Edit
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
HistoryDialog
diff --git a/share/translations/seamly2d_es_ES.ts b/share/translations/seamly2d_es_ES.ts
index da1f07f4f1ad..1c437001bd84 100644
--- a/share/translations/seamly2d_es_ES.ts
+++ b/share/translations/seamly2d_es_ES.ts
@@ -4057,10 +4057,6 @@ Possibly the file is already being downloaded.
Editar Grupo
-
-
- Renombrar
-
Eliminar
@@ -4253,6 +4249,34 @@ Possibly the file is already being downloaded.
Nombre
+
+
+ Editar
+
+
+
+ Visible
+
+
+
+ El grupo es visible
+
+
+
+ Bloqueado
+
+
+
+ El grupo está bloqueado
+
+
+
+ El grupo tiene objetos
+
+
+
+ Color
+
HistoryDialog
diff --git a/share/translations/seamly2d_fi_FI.ts b/share/translations/seamly2d_fi_FI.ts
index b8634000b054..a3d2a481e899 100644
--- a/share/translations/seamly2d_fi_FI.ts
+++ b/share/translations/seamly2d_fi_FI.ts
@@ -4013,10 +4013,6 @@ Possibly the file is already being downloaded.
-
-
-
-
Poista
@@ -4209,6 +4205,34 @@ Possibly the file is already being downloaded.
Nimi
+
+
+ Muokkaa
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
HistoryDialog
diff --git a/share/translations/seamly2d_fr_FR.ts b/share/translations/seamly2d_fr_FR.ts
index 0a5c17442958..e9d91d80cc26 100644
--- a/share/translations/seamly2d_fr_FR.ts
+++ b/share/translations/seamly2d_fr_FR.ts
@@ -4013,10 +4013,6 @@ Possibly the file is already being downloaded.
-
-
- Renommer
-
Supprimer
@@ -4209,6 +4205,34 @@ Possibly the file is already being downloaded.
Nom
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
HistoryDialog
diff --git a/share/translations/seamly2d_he_IL.ts b/share/translations/seamly2d_he_IL.ts
index 6e15ffdfced7..b28eafeae2bf 100644
--- a/share/translations/seamly2d_he_IL.ts
+++ b/share/translations/seamly2d_he_IL.ts
@@ -4013,10 +4013,6 @@ Possibly the file is already being downloaded.
-
-
-
-
למחוק
@@ -4209,6 +4205,34 @@ Possibly the file is already being downloaded.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
HistoryDialog
diff --git a/share/translations/seamly2d_id_ID.ts b/share/translations/seamly2d_id_ID.ts
index e3f41547eadc..b915db3b9420 100644
--- a/share/translations/seamly2d_id_ID.ts
+++ b/share/translations/seamly2d_id_ID.ts
@@ -4013,10 +4013,6 @@ Possibly the file is already being downloaded.
-
-
-
-
hapus
@@ -4209,6 +4205,34 @@ Possibly the file is already being downloaded.
Nama
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
HistoryDialog
diff --git a/share/translations/seamly2d_it_IT.ts b/share/translations/seamly2d_it_IT.ts
index 8ee6ba45bcff..28e2223cbdfc 100644
--- a/share/translations/seamly2d_it_IT.ts
+++ b/share/translations/seamly2d_it_IT.ts
@@ -4013,10 +4013,6 @@ Possibly the file is already being downloaded.
-
-
-
-
Elimina
@@ -4209,6 +4205,34 @@ Possibly the file is already being downloaded.
Nome
+
+
+ Modifica
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
HistoryDialog
diff --git a/share/translations/seamly2d_nl_NL.ts b/share/translations/seamly2d_nl_NL.ts
index 105a88a9a720..3ee4e3572e3f 100644
--- a/share/translations/seamly2d_nl_NL.ts
+++ b/share/translations/seamly2d_nl_NL.ts
@@ -4018,10 +4018,6 @@ Possibly the file is already being downloaded.
-
-
- Hernoem
-
@@ -4204,16 +4200,44 @@ Possibly the file is already being downloaded.
-
+ Groep kleur
-
+ Naam groep
Naam
+
+
+ Bewerk
+
+
+
+ Zichtbaar
+
+
+
+ De groep is zichtbaar
+
+
+
+ Vergrendeld
+
+
+
+ De groep is vergrendeld
+
+
+
+ Groep heeft objecten
+
+
+
+ Kleur
+
HistoryDialog
diff --git a/share/translations/seamly2d_pt_BR.ts b/share/translations/seamly2d_pt_BR.ts
index e0e5ea3ca5b1..81c719cfe693 100644
--- a/share/translations/seamly2d_pt_BR.ts
+++ b/share/translations/seamly2d_pt_BR.ts
@@ -4013,10 +4013,6 @@ Possibly the file is already being downloaded.
-
-
- Renomear
-
Excluir
@@ -4209,6 +4205,34 @@ Possibly the file is already being downloaded.
Nome
+
+
+ Editar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
HistoryDialog
diff --git a/share/translations/seamly2d_ro_RO.ts b/share/translations/seamly2d_ro_RO.ts
index f9d6f673753e..84131d82592f 100644
--- a/share/translations/seamly2d_ro_RO.ts
+++ b/share/translations/seamly2d_ro_RO.ts
@@ -4013,10 +4013,6 @@ Possibly the file is already being downloaded.
-
-
-
-
Șterge
@@ -4209,6 +4205,34 @@ Possibly the file is already being downloaded.
Nume
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
HistoryDialog
diff --git a/share/translations/seamly2d_ru_RU.ts b/share/translations/seamly2d_ru_RU.ts
index ff31981b6c4c..04ddc39d270b 100644
--- a/share/translations/seamly2d_ru_RU.ts
+++ b/share/translations/seamly2d_ru_RU.ts
@@ -4240,6 +4240,34 @@ Possibly the file is already being downloaded.
Название
+
+
+ Редактировать
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
HistoryDialog
diff --git a/share/translations/seamly2d_uk_UA.ts b/share/translations/seamly2d_uk_UA.ts
index b819e97b4923..eee39060c0b3 100644
--- a/share/translations/seamly2d_uk_UA.ts
+++ b/share/translations/seamly2d_uk_UA.ts
@@ -4013,10 +4013,6 @@ Possibly the file is already being downloaded.
-
-
- Перейменувати
-
Видалити
@@ -4209,6 +4205,34 @@ Possibly the file is already being downloaded.
імя
+
+
+ Редагувати
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
HistoryDialog
diff --git a/share/translations/seamly2d_zh_CN.ts b/share/translations/seamly2d_zh_CN.ts
index 50fe6bdc5b2c..11c269b40f99 100644
--- a/share/translations/seamly2d_zh_CN.ts
+++ b/share/translations/seamly2d_zh_CN.ts
@@ -4013,10 +4013,6 @@ Possibly the file is already being downloaded.
-
-
-
-
删除
@@ -4209,6 +4205,34 @@ Possibly the file is already being downloaded.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
HistoryDialog
diff --git a/src/app/seamly2d/dialogs/groups_widget.cpp b/src/app/seamly2d/dialogs/groups_widget.cpp
index 9b38228b5e29..78df6b00e4b8 100644
--- a/src/app/seamly2d/dialogs/groups_widget.cpp
+++ b/src/app/seamly2d/dialogs/groups_widget.cpp
@@ -127,11 +127,10 @@ GroupsWidget::GroupsWidget(VContainer *data, VAbstractPattern *doc, QWidget *par
connect(ui->deleteGroup_ToolButton, &QToolButton::clicked, this, &GroupsWidget::deleteGroupFromList);
connect(ui->editGroup_ToolButton, &QToolButton::clicked, this, &GroupsWidget::editGroup);
- connect(ui->groups_TableWidget, &QTableWidget::cellClicked, this, &GroupsWidget::groupVisibilityChanged);
- connect(ui->groups_TableWidget, &QTableWidget::cellClicked, this, &GroupsWidget::groupLockChanged);
- connect(ui->groups_TableWidget, &QTableWidget::cellChanged, this, &GroupsWidget::renameGroup);
- connect(ui->groups_TableWidget, &QTableWidget::cellClicked, this, &GroupsWidget::fillGroupItemList);
- connect(ui->groups_TableWidget, &QTableWidget::currentCellChanged, this, &GroupsWidget::fillGroupItemList);
+ connect(ui->groups_TableWidget, &QTableWidget::cellChanged, this, &GroupsWidget::renameGroup);
+ connect(ui->groups_TableWidget, &QTableWidget::cellClicked, this, &GroupsWidget::cellClicked);
+ connect(ui->groups_TableWidget, &QTableWidget::cellDoubleClicked, this, &GroupsWidget::cellDoubleClicked);
+ connect(ui->groups_TableWidget, &QTableWidget::currentCellChanged, this, &GroupsWidget::fillGroupItemList);
ui->groups_TableWidget->setContextMenuPolicy(Qt::CustomContextMenu);
connect(ui->groups_TableWidget, &QTableWidget::customContextMenuRequested, this, &GroupsWidget::groupContextMenu);
@@ -150,6 +149,22 @@ GroupsWidget::~GroupsWidget()
delete ui;
}
+//---------------------------------------------------------------------------------------------------------------------
+/**
+ * @brief changeEvent Handle language change event to retranslate the widget's ui.
+ * @param event QEvent sent to widget.
+ */
+ void GroupsWidget::changeEvent(QEvent *event)
+{
+ if (event->type() == QEvent::LanguageChange)
+ {
+ ui->retranslateUi(this);
+ updateGroups();
+ }
+
+ // remember to call base class implementation
+ QWidget::changeEvent(event);
+}
//---------------------------------------------------------------------------------------------------------------------
void GroupsWidget::groupVisibilityChanged(int row, int column)
{
@@ -163,15 +178,16 @@ void GroupsWidget::groupVisibilityChanged(int row, int column)
const bool visible = !m_doc->getGroupVisibility(groupId);
setGroupVisibility(item, groupId, visible);
}
+ else
+ {
+ QApplication::beep();
+ }
}
//---------------------------------------------------------------------------------------------------------------------
void GroupsWidget::groupLockChanged(int row, int column)
{
- if (column != 1)
- {
- return;
- }
+ if (column != 1) return;
QTableWidgetItem *item = ui->groups_TableWidget->item(row, column);
if (!item) return;
@@ -181,17 +197,21 @@ void GroupsWidget::groupLockChanged(int row, int column)
if (locked)
{
item->setIcon(QIcon("://icon/32x32/lock_on.png"));
+ item = ui->groups_TableWidget->item(row, 4);
+ item->setFlags(item->flags() & ~Qt::ItemIsEditable);
}
else
{
item->setIcon(QIcon("://icon/32x32/lock_off.png"));
+ item = ui->groups_TableWidget->item(row, 4);
+ item->setFlags(item->flags() | Qt::ItemIsEditable);
}
}
//---------------------------------------------------------------------------------------------------------------------
void GroupsWidget::renameGroup(int row, int column)
{
- if (column != 2)
+ if (column != 4)
{
return;
}
@@ -228,27 +248,33 @@ void GroupsWidget::showGroups(QMap groups)
void GroupsWidget::showAllGroups()
{
- qCDebug(WidgetGroups, "Show All Groups");
- quint32 groupId;
- bool locked;
- for (int i = 0; i < ui->groups_TableWidget->rowCount(); ++i)
- {
- QTableWidgetItem *item = ui->groups_TableWidget->item(i, 0);
- if (!item)
- {
- return;
- }
- groupId = item->data(Qt::UserRole).toUInt();
- locked = m_doc->getGroupLock(groupId);
- if (item && locked == false)
- {
- setGroupVisibility(item, groupId, true);
- }
- }
+ ui->groups_TableWidget->setSortingEnabled(false);
+ ui->groups_TableWidget->blockSignals(true);
+ qCDebug(WidgetGroups, "Show All Groups");
+ quint32 groupId;
+ bool locked;
+ for (int i = 0; i < ui->groups_TableWidget->rowCount(); ++i)
+ {
+ QTableWidgetItem *item = ui->groups_TableWidget->item(i, 0);
+ if (!item)
+ {
+ return;
+ }
+ groupId = item->data(Qt::UserRole).toUInt();
+ locked = m_doc->getGroupLock(groupId);
+ if (item && locked == false)
+ {
+ setGroupVisibility(item, groupId, true);
+ }
+ }
+ ui->groups_TableWidget->blockSignals(false);
+ ui->groups_TableWidget->setSortingEnabled(true);
}
void GroupsWidget::hideAllGroups()
{
+ ui->groups_TableWidget->setSortingEnabled(false);
+ ui->groups_TableWidget->blockSignals(true);
qCDebug(WidgetGroups, "Hide All Groups");
quint32 groupId;
bool locked;
@@ -266,6 +292,8 @@ void GroupsWidget::hideAllGroups()
setGroupVisibility(item, groupId, false);
}
}
+ ui->groups_TableWidget->blockSignals(false);
+ ui->groups_TableWidget->setSortingEnabled(true);
}
void GroupsWidget::lockAllGroups()
@@ -281,6 +309,8 @@ void GroupsWidget::lockAllGroups()
const quint32 groupId = item->data(Qt::UserRole).toUInt();
m_doc->setGroupLock(groupId, true);
item->setIcon(QIcon("://icon/32x32/lock_on.png"));
+ item = ui->groups_TableWidget->item(row, 4);
+ item->setFlags(item->flags() & ~Qt::ItemIsEditable);
}
}
@@ -297,6 +327,8 @@ void GroupsWidget::unlockAllGroups()
const quint32 groupId = item->data(Qt::UserRole).toUInt();
m_doc->setGroupLock(groupId, false);
item->setIcon(QIcon("://icon/32x32/lock_off.png"));
+ item = ui->groups_TableWidget->item(row, 4);
+ item->setFlags(item->flags() | Qt::ItemIsEditable);
}
}
@@ -334,9 +366,9 @@ void GroupsWidget::addGroupToList()
case QMessageBox::Retry:
break; // Repeat Add Group Dialog
case QMessageBox::Cancel:
- return; // Exit Add Group Dialog
+ return; // Exit Add Group Dialog
default:
- break; // should never be reached
+ break; // should never be reached
}
}
@@ -428,11 +460,12 @@ void GroupsWidget::editGroup()
switch (boxResult)
{
case QMessageBox::Retry:
- break; // Repeat Add Group Dialog
+ break; // Repeat Edit Group Dialog
case QMessageBox::Cancel:
- return; // Exit Add Group Dialog
+ ui->groups_TableWidget->blockSignals(false);
+ return; // Exit Edit Group Dialog
default:
- break; // should never be reached
+ break; // should never be reached
}
}
@@ -440,18 +473,19 @@ void GroupsWidget::editGroup()
const QString groupLineType = dialog->getLineType();
const QString groupLineWeight = dialog->getLineWeight();
+ // Add color item
QTableWidgetItem *item = ui->groups_TableWidget->item(row, 3);
item->setTextAlignment(Qt::AlignLeft | Qt::AlignVCenter);
item->setSizeHint(QSize(20, 20));
QPixmap pixmap(20, 20);
pixmap.fill(QColor(groupColor));
item->setIcon(QIcon(pixmap));
- item->setFlags(item->flags() &= ~(Qt::ItemIsEditable)); // set the item non-editable (view only), and non-selectable
+ item->setFlags(item->flags() & ~Qt::ItemIsEditable); // set the item non-editable (view only), and non-selectable
item->setToolTip(tr("Group color"));
- ui->groups_TableWidget->setItem(row, 3, item);
-
+ // Add group name item
item = ui->groups_TableWidget->item(row, 4);
item->setText(groupName);
+ item->setFlags(item->flags() | Qt::ItemIsEditable);
m_doc->setGroupName(groupId, groupName);
m_doc->setGroupColor(groupId, groupColor);
@@ -460,14 +494,18 @@ void GroupsWidget::editGroup()
updateGroups();
}
+ else
+ {
+ QApplication::beep();
+ }
ui->groups_TableWidget->blockSignals(false);
}
//---------------------------------------------------------------------------------------------------------------------
void GroupsWidget::groupContextMenu(const QPoint &pos)
{
- ui->groups_TableWidget->setSortingEnabled(false);
- ui->groups_TableWidget->blockSignals(true);
+ //ui->groups_TableWidget->setSortingEnabled(false);
+ //ui->groups_TableWidget->blockSignals(true);
QTableWidgetItem *item = ui->groups_TableWidget->itemAt(pos);
if (!item)
@@ -486,78 +524,16 @@ void GroupsWidget::groupContextMenu(const QPoint &pos)
}
QScopedPointer menu(new QMenu());
- QAction *actionRename = menu->addAction(QIcon("://icon/32x32/rename_32"), tr("Rename"));
+ QAction *actionEdit = menu->addAction(QIcon("://icon/32x32/edit.png"), tr("Edit"));
QAction *actionDelete = menu->addAction(QIcon::fromTheme("edit-delete"), tr("Delete"));
QAction *selectedAction = menu->exec(ui->groups_TableWidget->viewport()->mapToGlobal(pos));
if(selectedAction == nullptr)
{
return;
}
- else if (selectedAction == actionRename)
+ else if (selectedAction == actionEdit)
{
- QString oldGroupName = m_doc->getGroupName(groupId);
- QScopedPointer dialog(new EditGroupDialog(new VContainer(qApp->TrVars(),
- qApp->patternUnitP()), NULL_ID, this));
- dialog->setName(m_doc->getGroupName(groupId));
- dialog->setColor(m_doc->getGroupColor(groupId));
- dialog->setLineType(m_doc->getGroupLineType(groupId));
- dialog->setLineWeight(m_doc->getGroupLineWeight(groupId));
- dialog->setWindowTitle(tr("Edit Group"));
-
- QString groupName;
- while (1)
- {
- const bool result = dialog->exec();
- groupName = dialog->getName();
- if (result == false || groupName.isEmpty())
- {
- return;
- }
- bool exists = m_doc->groupNameExists(groupName);
- if (exists == false || groupName == oldGroupName)
- {
- break;
- }
-
- QMessageBox messageBox;
- messageBox.setWindowTitle(tr("Name Exists"));
- messageBox.setIcon(QMessageBox::Warning);
- messageBox.setStandardButtons(QMessageBox::Retry | QMessageBox::Cancel);
- messageBox.setDefaultButton(QMessageBox::Retry);
- messageBox.setText(tr("The action can't be completed because the group name already exists."));
- int boxResult = messageBox.exec();
-
- switch (boxResult)
- {
- case QMessageBox::Retry:
- break; // Repeat Add Group Dialog
- case QMessageBox::Cancel:
- return; // Exit Add Group Dialog
- default:
- break; // should never be reached
- }
- }
-
- const QString groupColor = dialog->getColor();
- const QString groupLineType = dialog->getLineType();
- const QString groupLineWeight = dialog->getLineWeight();
-
- item = ui->groups_TableWidget->item(row, 3);
- item->setTextAlignment(Qt::AlignLeft | Qt::AlignVCenter);
- item->setSizeHint(QSize(20, 20));
- QPixmap pixmap(20, 20);
- pixmap.fill(QColor(groupColor));
- item->setIcon(QIcon(pixmap));
- item->setFlags(item->flags() &= ~(Qt::ItemIsEditable)); // set the item non-editable (view only), and non-selectable
- item->setToolTip(tr("Group color"));
- ui->groups_TableWidget->setItem(row, 3, item);
-
- item = ui->groups_TableWidget->item(row, 4);
- item->setText(groupName);
- m_doc->setGroupName(groupId, groupName);
- m_doc->setGroupColor(groupId, groupColor);
- m_doc->setGroupLineType(groupId, groupLineType);
- m_doc->setGroupLineWeight(groupId, groupLineWeight);
+ editGroup();
}
else if (selectedAction == actionDelete)
{
@@ -566,8 +542,8 @@ void GroupsWidget::groupContextMenu(const QPoint &pos)
qApp->getUndoStack()->push(command);
}
- ui->groups_TableWidget->setSortingEnabled(true);
- ui->groups_TableWidget->blockSignals(false);
+ //ui->groups_TableWidget->setSortingEnabled(true);
+ //ui->groups_TableWidget->blockSignals(false);
}
@@ -607,7 +583,7 @@ void GroupsWidget::fillTable(const QMap &groups)
setGroupVisibility(item, i.key(), data.visible);
item->setData(Qt::UserRole, i.key());
- item->setFlags(item->flags() &= ~(Qt::ItemIsEditable)); // set the item non-editable (view only), and non-selectable
+ item->setFlags(item->flags() & ~Qt::ItemIsEditable); // set the item non-editable (view only), and non-selectable
item->setToolTip(tr("Show which groups in the list are visible"));
ui->groups_TableWidget->setItem(currentRow, 0, item);
@@ -617,7 +593,7 @@ void GroupsWidget::fillTable(const QMap &groups)
item->setSizeHint(QSize(20, 20));
item->setIcon(data.locked ? QIcon("://icon/32x32/lock_on.png") : QIcon("://icon/32x32/lock_off.png"));
item->setData(Qt::UserRole, i.key());
- item->setFlags(item->flags() &= ~(Qt::ItemIsEditable)); // set the item non-editable (view only), and non-selectable
+ item->setFlags(item->flags() & ~Qt::ItemIsEditable); // set the item non-editable (view only), and non-selectable
item->setToolTip(tr("Show which groups in the list are locked"));
ui->groups_TableWidget->setItem(currentRow, 1, item);
@@ -626,7 +602,7 @@ void GroupsWidget::fillTable(const QMap &groups)
item->setTextAlignment(Qt::AlignHCenter);
item->setIcon(!m_doc->isGroupEmpty(i.key()) ? QIcon("://icon/32x32/history.png") : QIcon());
item->setData(Qt::UserRole, i.key());
- item->setFlags(item->flags() &= ~(Qt::ItemIsEditable)); // set the item non-editable (view only), and non-selectable
+ item->setFlags(item->flags() & ~Qt::ItemIsEditable); // set the item non-editable (view only), and non-selectable
item->setToolTip(tr("Show which groups contain objects"));
ui->groups_TableWidget->setItem(currentRow, 2, item);
@@ -638,7 +614,7 @@ void GroupsWidget::fillTable(const QMap &groups)
pixmap.fill(QColor(data.color));
item->setIcon(QIcon(pixmap));
item->setData(Qt::UserRole, data.color);
- item->setFlags(item->flags() &= ~(Qt::ItemIsEditable)); // set the item non-editable (view only), and non-selectable
+ item->setFlags(item->flags() & ~Qt::ItemIsEditable); // set the item non-editable (view only), and non-selectable
item->setToolTip(tr("Group color"));
ui->groups_TableWidget->setItem(currentRow, 3, item);
@@ -647,15 +623,23 @@ void GroupsWidget::fillTable(const QMap &groups)
nameItem->setTextAlignment(Qt::AlignLeft | Qt::AlignVCenter);
nameItem->setToolTip(tr("Group name"));
ui->groups_TableWidget->setItem(currentRow, 4, nameItem);
-
+ if (data.locked)
+ {
+ nameItem->setFlags(nameItem->flags() & ~Qt::ItemIsEditable);
+ }
++i;
}
- ui->groups_TableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem(makeHeaderName(QString("Visible"))));
- ui->groups_TableWidget->setHorizontalHeaderItem(1, new QTableWidgetItem(makeHeaderName(QString("Locked"))));
- ui->groups_TableWidget->setHorizontalHeaderItem(2, new QTableWidgetItem(makeHeaderName(QString("Objects"))));
- ui->groups_TableWidget->setHorizontalHeaderItem(3, new QTableWidgetItem(makeHeaderName(QString("Color"))));
+ ui->groups_TableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem(makeHeaderName(tr("Visible"))));
+ ui->groups_TableWidget->horizontalHeaderItem(0)->setToolTip(tr("Group is visible"));
+ ui->groups_TableWidget->setHorizontalHeaderItem(1, new QTableWidgetItem(makeHeaderName(tr("Locked"))));
+ ui->groups_TableWidget->horizontalHeaderItem(1)->setToolTip(tr("Group is locked"));
+ ui->groups_TableWidget->setHorizontalHeaderItem(2, new QTableWidgetItem(makeHeaderName(tr("Objects"))));
+ ui->groups_TableWidget->horizontalHeaderItem(2)->setToolTip(tr("Group has objects"));
+ ui->groups_TableWidget->setHorizontalHeaderItem(3, new QTableWidgetItem(makeHeaderName(tr("Color"))));
+ ui->groups_TableWidget->horizontalHeaderItem(3)->setToolTip(tr("Group color"));
ui->groups_TableWidget->setHorizontalHeaderItem(4, new QTableWidgetItem(tr("Name")));
+ ui->groups_TableWidget->horizontalHeaderItem(4)->setToolTip(tr("Group name"));
ui->groups_TableWidget->horizontalHeaderItem(4)->setTextAlignment(Qt::AlignLeft | Qt::AlignVCenter);
ui->groups_TableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed);
ui->groups_TableWidget->resizeColumnsToContents();
@@ -1097,7 +1081,8 @@ QString GroupsWidget::getObjName(quint32 toolId)
catch (const VExceptionBadId &error)
{
qCDebug(WidgetGroups, "Error! Couldn't get object name by id = %s. %s %s", qUtf8Printable(QString().setNum(toolId)),
- qUtf8Printable(error.ErrorMessage()), qUtf8Printable(error.DetailedInformation()));
+ qUtf8Printable(error.ErrorMessage()),
+ qUtf8Printable(error.DetailedInformation()));
return QString("Unknown Object");// Return Unknown string
}
}
@@ -1215,7 +1200,60 @@ QString GroupsWidget::getObjName(quint32 toolId)
}
}
}
+//---------------------------------------------------------------------------------------------------------------------
+/**
+ * @brief cellClicked Handle clicking of table cell.
+ * @param row row of selected table widget item.
+ * @param column column of selected table widget item.
+ */
+void GroupsWidget::cellClicked(int row, int column)
+{
+ if (column == 0)
+ {
+ groupVisibilityChanged(row, 0);
+ }
+ else if (column == 1)
+ {
+ groupLockChanged(row, 1);
+ }
+ else if ((column == 2) || (column == 3) || (column == 4))
+ {
+ QTableWidgetItem *item = ui->groups_TableWidget->item(row, 0);
+ const quint32 groupId = item->data(Qt::UserRole).toUInt();
+ const bool locked = m_doc->getGroupLock(groupId);
+ if (locked == true)
+ {
+ QApplication::beep();
+ }
+ }
+
+ fillGroupItemList();
+}
+//---------------------------------------------------------------------------------------------------------------------
+/**
+ * @brief cellDoubleClicked Handle double clicking of table cell.
+ * @param row row of selected table widget item.
+ * @param column column of selected table widget item.
+ */
+void GroupsWidget::cellDoubleClicked(int row, int column)
+{
+ QTableWidgetItem *item = ui->groups_TableWidget->item(row, 1);
+ const quint32 groupId = item->data(Qt::UserRole).toUInt();
+ const bool locked = m_doc->getGroupLock(groupId);
+ if (locked == false)
+ {
+ if (column == 3)
+ {
+ editGroup();
+ }
+ }
+ else
+ {
+ QApplication::beep();
+ }
+ return;
+}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief Handle double clicking of list item.
diff --git a/src/app/seamly2d/dialogs/groups_widget.h b/src/app/seamly2d/dialogs/groups_widget.h
index 9a5a34a3601c..42b04367abc3 100644
--- a/src/app/seamly2d/dialogs/groups_widget.h
+++ b/src/app/seamly2d/dialogs/groups_widget.h
@@ -98,6 +98,8 @@ private slots:
void renameGroup(int row, int column);
void groupContextMenu(const QPoint &pos);
void draftBlockHasGroups(bool value);
+ protected:
+ virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(GroupsWidget)
@@ -111,6 +113,8 @@ private slots:
void fillGroupItemList();
void addGroupItem(const quint32 &toolId, const quint32 &objId, const Tool &tooltype);
void groupItemContextMenu(const QPoint &pos);
+ void cellClicked(int row, int column);
+ void cellDoubleClicked(int row, int column);
void itemDoubleClicked(QListWidgetItem *item);
void zoomToObject(QSharedPointer point);
void setGroupVisibility(QTableWidgetItem *item, const quint32 &groupId, const bool &visible);
diff --git a/src/app/seamly2d/dialogs/groups_widget.ui b/src/app/seamly2d/dialogs/groups_widget.ui
index 7952ef6a67dc..942fe11bec71 100644
--- a/src/app/seamly2d/dialogs/groups_widget.ui
+++ b/src/app/seamly2d/dialogs/groups_widget.ui
@@ -95,9 +95,6 @@
Lock all groups
-
- ...
-
:/icon/32x32/lock_on.png:/icon/32x32/lock_on.png
@@ -121,9 +118,6 @@
Unlock all groups
-
- ...
-
:/icon/32x32/lock_off.png:/icon/32x32/lock_off.png
@@ -202,6 +196,9 @@
Qt::Vertical
+
+
+ false
@@ -322,6 +319,9 @@
16
+
+ 30
+
true