-
Notifications
You must be signed in to change notification settings - Fork 26
/
utils.h
67 lines (54 loc) · 1.56 KB
/
utils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef UTILS_H
#define UTILS_H
#include <QStringList>
#include <QString>
#include <QPoint>
#include <QList>
#include <QPen>
class QPushButton;
class QPolygon;
class QWidget;
class QImage;
class QRect;
class PlateFile;
class Utils
{
public:
static QString helpString();
static QString informationString();
static QString warningString();
static QString errorString();
static QString fatalErrorString();
/*
* Pen to pain a polygon
*/
static QPen polygonPaintingPen();
/*
* Calculate a polygon centroid
*/
static QPoint centroid(const QPolygon &polygon);
/*
* Set tooltips for buttons with their shortcuts
*/
static void setShortcutTooltips(const QList<QPushButton *> &buttons);
/*
* Supported image formats as a UNIX wildcard
*/
static QStringList imageMatchingWildcard();
static QPoint fitPoint(const QRect &m_referenceRect, const QPoint &_pos);
/*
* Return a selection rectangle to edit the specified plate
*/
static QRect selectionForPlate(const PlateFile &plateFile, const QImage &inImage);
static void help(const QString &message, QWidget *parent = nullptr);
static void message(const QString &message, QWidget *parent = nullptr);
static void warning(const QString &message, QWidget *parent = nullptr);
static void error(const QString &message, QWidget *parent = nullptr);
static void fatalError(const QString &message, QWidget *parent = nullptr);
};
inline
QPen Utils::polygonPaintingPen()
{
return QPen(Qt::magenta, 2);
}
#endif // UTILS_H