Skip to content

Commit 57c026f

Browse files
committed
Fix tag group problem
1 parent f3b8d0e commit 57c026f

File tree

5 files changed

+22
-16
lines changed

5 files changed

+22
-16
lines changed

src/Interface/Application/ModuleProxyWidget.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,6 @@ namespace SCIRun
9797
QSizeF originalSize_;
9898
QTimeLine* timeLine_;
9999
};
100-
101-
// arbitrary values
102-
static const int TagDataKey = 123;
103-
static const int TagLayerKey = 100;
104-
static const int CurrentTagKey = 101;
105-
static const int NoTag = -1;
106-
static const int AllTags = -50;
107-
static const int ClearTags = -77;
108-
static const int ShowGroups = -100;
109-
static const int HideGroups = -101;
110100
}
111101
}
112102

src/Interface/Application/NetworkEditor.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1568,7 +1568,8 @@ void NetworkEditor::tagLayer(bool active, int tag)
15681568
{
15691569
if (item->data(TagDataKey).toInt() == NoTag)
15701570
{
1571-
item->setData(TagDataKey, tag);
1571+
if (validTag(tag))
1572+
item->setData(TagDataKey, tag);
15721573
}
15731574
else if (ClearTags == tag)
15741575
{
@@ -1787,7 +1788,6 @@ void NetworkEditor::highlightTaggedItem(int tagValue)
17871788

17881789
void NetworkEditor::highlightTaggedItem(QGraphicsItem* item, int tagValue)
17891790
{
1790-
qDebug() << "highlightTaggedItem" << tagValue;
17911791
if (tagValue == NoTag)
17921792
{
17931793
item->setGraphicsEffect(blurEffect());

src/Interface/Application/TagManagerWindow.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ QColor TagManagerWindow::tagColor(int tag) const
112112
{
113113
int r, g, b;
114114
r = g = b = 155;
115-
if (0 <= tag && tag < NumberOfTags)
115+
if (validTag(tag))
116116
{
117117
auto colorStr = tagColors_[tag];
118118
try
@@ -134,8 +134,7 @@ QColor TagManagerWindow::tagColor(int tag) const
134134

135135
QString TagManagerWindow::tagName(int tag) const
136136
{
137-
auto name = (0 <= tag && tag < NumberOfTags) ? tagNames_[tag] : "[No tag]";
138-
qDebug() << "tagName" << tag << name;
137+
auto name = validTag(tag) ? tagNames_[tag] : "[No tag]";
139138
return name;
140139
}
141140

src/Interface/Application/TagManagerWindow.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ class TagManagerWindow : public QDockWidget, public Ui::TagManager
4040

4141
public:
4242
explicit TagManagerWindow(QWidget* parent = nullptr);
43-
enum { NumberOfTags = 10 };
4443
void setTagNames(const QVector<QString>& names);
4544
void setTagColors(const QVector<QString>& colors);
4645
QStringList getTagNames() const { return tagNames_.toList(); }

src/Interface/Application/Utility.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,24 @@ namespace Gui
8484
const char* insertNewModuleActionTypePropertyName();
8585

8686
const Qt::GlobalColor CLIPBOARD_COLOR = Qt::cyan;
87+
88+
// arbitrary values
89+
enum TagValues
90+
{
91+
MinTag = 0,
92+
MaxTag = 9,
93+
NumberOfTags = 10,
94+
TagDataKey = 123,
95+
TagLayerKey = 100,
96+
CurrentTagKey = 101,
97+
NoTag = -1,
98+
AllTags = -50,
99+
ClearTags = -77,
100+
ShowGroups = -100,
101+
HideGroups = -101
102+
};
103+
104+
inline bool validTag(int tag) { return MinTag <= tag && tag <= MaxTag; }
87105
}
88106

89107
}

0 commit comments

Comments
 (0)