Debian Codegraph @

src/gui/snippingArea/AdornerSizeInfo.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2019 Damir Porobic <[email protected]>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20 #ifndef KSNIP_ADORNERSIZEINFO_H
21 #define KSNIP_ADORNERSIZEINFO_H
22
23 #include <QPainter>
24 #include <QPainterPath>
25
26 class AdornerSizeInfo
27 {
28 public:
29 explicit AdornerSizeInfo();
30 ~AdornerSizeInfo();
31 void update(const QRect &captureRect);
32 void paint(QPainter *painter, const QColor &color);
33
34 private:
35 QFont mFont;
36 QFontMetrics *mFontMetric;
37 QPen *mSizeInfoPen;
38 QPainterPath mWidthInfo;
39 QPainterPath mHeightInfo;
40 QPoint mWidthTextPosition;
41 QPoint mHeightTextPosition;
42 QString mWidthInfoText;
43 QString mHeightInfoText;
44
45 void updateWidthInfo(const QRect &captureRect);
46 void updateHeightInfo(const QRect &captureRect);
47 void updateSizeInfoText(const QRect &captureRect);
48 };
49
50 #endif //KSNIP_ADORNERSIZEINFO_H