Skip to content

Commit 36aee06

Browse files
authored
Merge pull request #48 from berendkleinhaneveld/master
Several small fixes and improvements, Thank to @berendkleinhaneveld
2 parents 86aff25 + f20e1d1 commit 36aee06

8 files changed

+89
-74
lines changed

Diff for: .travis.yml

+6-7
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ os:
99

1010
env:
1111
- CONFIG=Release
12-
12+
1313
branches:
1414
only:
1515
- master
@@ -21,11 +21,10 @@ before_install:
2121
brew install opencv;
2222
brew install curl;
2323
else
24-
QT_VERSION_MM=59;
25-
QT_VERSION_FULL=591-trusty;
26-
sudo apt-add-repository --yes ppa:beineri/opt-qt$QT_VERSION_FULL && sudo apt-get update -qq && sudo apt-get install -qq qt${QT_VERSION_MM}base qt${QT_VERSION_MM}script qt${QT_VERSION_MM}tools && export CMAKE_PREFIX_PATH=/opt/qt${QT_VERSION_MM};
27-
sudo apt-get install libopencv-dev;
28-
sudo apt-get install curl;
24+
QT_VERSION_MM=510;
25+
QT_VERSION_FULL=5.10.1-xenial;
26+
sudo apt-add-repository --yes ppa:beineri/opt-qt-$QT_VERSION_FULL && sudo apt-get update -qq && sudo apt-get install -qq qt${QT_VERSION_MM}base qt${QT_VERSION_MM}script qt${QT_VERSION_MM}tools && export CMAKE_PREFIX_PATH=/opt/qt${QT_VERSION_MM};
27+
sudo apt-get install libopencv-dev curl libgl1-mesa-dev;
2928
fi
3029
before_script:
3130
- mkdir build
@@ -38,4 +37,4 @@ before_script:
3837

3938
script:
4039
- cmake --build . --config $CONFIG
41-
- cmake --build . --config $CONFIG --target upload_file
40+
- cmake --build . --config $CONFIG --target upload_file

Diff for: appveyor.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,19 @@ environment:
33
matrix:
44
- CMAKE_BUILD_TYPE: Release
55

6+
# Do not build feature branch with open Pull Requests
7+
skip_branch_with_pr: true
8+
69
install:
710
- cmd: set QT5_DIR=C:\Qt\5.10.1\msvc2015_64\lib\cmake
811
- cmd: choco install OpenCV
9-
- cmd: choco install curl
12+
- cmd: choco install curl --version=7.66.0.20190926
1013
- cmd: set OPENCV_DIR=C:\tools\opencv\build
1114
- cmd: cd C:\projects\PixelAnnotationTool
12-
15+
1316
build_script:
1417
- cmd: mkdir build
1518
- cmd: cd build
1619
- cmd: cmake .. -DQT5_DIR=%QT5_DIR% -DOpenCV_DIR=%OPENCV_DIR% -G"Visual Studio 14 Win64"
1720
- cmd: cmake --build . --config Release
18-
- cmd: cmake --build . --config Release --target upload_file
21+
- cmd: cmake --build . --config Release --target upload_file

Diff for: src/label_widget.cpp

+8-9
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,19 @@
44
#include <QDebug>
55
#include <QPainter>
66

7-
LabelWidget::LabelWidget(const LabelInfo &label, QWidget *parent , Qt::WindowFlags f ) :
8-
QLabel(parent, f) {
7+
LabelWidget::LabelWidget(const LabelInfo &label, QWidget *parent, Qt::WindowFlags f)
8+
: QLabel(parent, f) {
99
setNewLabel(label);
1010
_is_selected = false;
1111
}
1212

1313

1414
void LabelWidget::setNewLabel(const LabelInfo &label) {
1515
_label = label;
16-
QString text = (label.shortcut) ?
17-
label.name + " (" + label.shortcut->key().toString() + ")" :
18-
label.name;
19-
20-
setText(text);
16+
// Only set the text, when it is not set already
17+
if (this->text() == "") {
18+
setText(_label.name);
19+
}
2120
setAlignment(Qt::AlignHCenter);
2221
setStyleSheet("QLabel { background-color : " + label.color.name() + "; color : " + readableColor(_label.color).name() + "; font: 14px; }");
2322
}
@@ -42,6 +41,6 @@ void LabelWidget::paintEvent(QPaintEvent *event) {
4241
}
4342
}
4443

45-
QString LabelWidget::getName(){
44+
QString LabelWidget::getName() {
4645
return this->_label.name;
47-
}
46+
}

Diff for: src/labels.cpp

+4-6
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ LabelInfo::LabelInfo() {
1515
this->id_categorie = 0;
1616
this->color = QColor(0, 0, 0);
1717
item = NULL;
18-
shortcut = nullptr;
1918
}
2019

2120
LabelInfo::LabelInfo(QString name, QString categorie, int id, int id_categorie, QColor color) {
@@ -25,7 +24,6 @@ LabelInfo::LabelInfo(QString name, QString categorie, int id, int id_categorie,
2524
this->id_categorie = id_categorie;
2625
this->color = color;
2726
item = NULL;
28-
shortcut = nullptr;
2927
}
3028

3129
void LabelInfo::read(const QJsonObject &json) {
@@ -52,7 +50,6 @@ void LabelInfo::write(QJsonObject &json) const {
5250
json["color"] = jarray;
5351
}
5452

55-
5653
void Name2Labels::read(const QJsonObject &json) {
5754
QJsonObject array = json["labels"].toObject();
5855
for (QJsonObject::iterator it = array.begin(); it != array.end(); it++) {
@@ -62,6 +59,7 @@ void Name2Labels::read(const QJsonObject &json) {
6259
(*this)[label.name] = label;
6360
}
6461
}
62+
6563
void Name2Labels::write(QJsonObject &json) const {
6664
QMapIterator<QString, LabelInfo> it(*this);
6765
QJsonObject object;
@@ -86,7 +84,7 @@ Id2Labels getId2Label(const Name2Labels& labels) {
8684
return id_labels;
8785
}
8886

89-
Name2Labels defaulfLabels() {
87+
Name2Labels defaultLabels() {
9088
Name2Labels labels;
9189
// inspired by https://raw.githubusercontent.com/mcordts/cityscapesScripts/master/cityscapesscripts/helpers/labels.py
9290
labels["unlabeled" ] = LabelInfo("unlabeled" , "void" , 00, 0, QColor( 0, 0, 0));
@@ -137,7 +135,7 @@ Name2Labels defaulfLabels() {
137135
// labels[it.key()].color = cmap[i++];
138136
//}
139137
//labels["unlabeled"].color = QColor(0, 0, 0);
140-
138+
141139
return labels;
142140

143-
}
141+
}

Diff for: src/labels.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
#include <QListWidgetItem>
55
#include <QJsonObject>
6-
#include <QtWidgets/QShortcut>
76

87
class LabelInfo {
98
public:
@@ -13,7 +12,6 @@ class LabelInfo {
1312
int id_categorie ;
1413
QColor color ;
1514
QListWidgetItem *item;
16-
QShortcut *shortcut ;
1715
LabelInfo();
1816
LabelInfo(QString name, QString categorie, int id, int id_categorie, QColor color);
1917
void read(const QJsonObject &json);
@@ -29,6 +27,6 @@ class Name2Labels : public QMap<QString, LabelInfo> {
2927
class Id2Labels : public QMap<int,const LabelInfo*> { };
3028

3129
Id2Labels getId2Label(const Name2Labels& labels);
32-
Name2Labels defaulfLabels();
30+
Name2Labels defaultLabels();
3331

34-
#endif
32+
#endif

0 commit comments

Comments
 (0)