Debian Codegraph @

src/stackdisplay.cpp

raw symbols SCIP
1 /*
2 Copyright (C) 2014 Mario Stephan <[email protected]>
3
4 This library is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published
6 by the Free Software Foundation; either version 2.1 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 Lesser General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #include "stackdisplay.h"cxx . . $ `<file>/src/stackdisplay.h`/
19
20 #include <QColor>
21 #include <QPainter>
22 #include <QStyleOption>
23
24 class StackDisplayPrivatecxx . . $ StackDisplayPrivate# {
25 public:
26 int heightcxx . . $ StackDisplayPrivate#height.;
27 int widthcxx . . $ StackDisplayPrivate#width.;
28 int margincxx . . $ StackDisplayPrivate#margin.;
29 int countcxx . . $ StackDisplayPrivate#count.;
30 int indexSelectedcxx . . $ StackDisplayPrivate#indexSelected.;
31 int barHeightcxx . . $ StackDisplayPrivate#barHeight.;
32 QColorcxx . . $ QColor# colorBarscxx . . $ StackDisplayPrivate#colorBars.;
33 };
34
35 StackDisplaycxx . . $ StackDisplay#::StackDisplaycxx . . $ StackDisplay#StackDisplay(108f35f7aa7f3cf9).(QWidgetcxx . . $ QWidget#* parent)
36 : QWidgetcxx . . $ QWidget#QWidget(872e7b0c281abd8d).(parent)
37 {
38 pcxx . . $ StackDisplay#p. = new StackDisplayPrivatecxx . . $ StackDisplayPrivate#;
39
40 pcxx . . $ StackDisplay#p.->colorBarscxx . . $ StackDisplayPrivate#colorBars..setRgbcxx . . $ QColor#setRgb(748afa4755bc9595).(200, 200, 200);
41
42 pcxx . . $ StackDisplay#p.->countcxx . . $ StackDisplayPrivate#count. = 6;
43 pcxx . . $ StackDisplay#p.->indexSelectedcxx . . $ StackDisplayPrivate#indexSelected. = 1;
44 pcxx . . $ StackDisplay#p.->barHeightcxx . . $ StackDisplayPrivate#barHeight. = 3;
45 pcxx . . $ StackDisplay#p.->margincxx . . $ StackDisplayPrivate#margin. = 8;
46 }
47
48 StackDisplaycxx . . $ StackDisplay#::~cxx . . $ StackDisplay#`~StackDisplay`(ced63f7c635d850d).StackDisplaycxx . . $ StackDisplay#()
49 {
50 delete pcxx . . $ StackDisplay#p.;
51 }
52
53 void StackDisplaycxx . . $ StackDisplay#::resizeEventcxx . . $ StackDisplay#resizeEvent(eeeec21cf8dc0387).(QResizeEventcxx . . $ QResizeEvent#* e)
54 {
55 Q_UNUSEDcxx . . $ `<external>/15045578679651060896/qglobal.h:117:9`!(e);
56
57 pcxx . . $ StackDisplay#p.->widthcxx . . $ StackDisplayPrivate#width. = widthcxx . . $ QWidget#width(455f465bc33b4cdf).();
58 pcxx . . $ StackDisplay#p.->heightcxx . . $ StackDisplayPrivate#height. = heightcxx . . $ QWidget#height(455f465bc33b4cdf).();
59 }
60
61 void StackDisplaycxx . . $ StackDisplay#::setBarColorcxx . . $ StackDisplay#setBarColor(406700690822ecf).(QColorcxx . . $ QColor# color)
62 {
63 pcxx . . $ StackDisplay#p.->colorBarscxx . . $ StackDisplayPrivate#colorBars. =cxx . . $ QColor#`operator=`(a3db1be773b26671). color;
64 updatecxx . . $ QWidget#update(49f6e7a06ebc5aa8).();
65 }
66
67 void StackDisplaycxx . . $ StackDisplay#::setCountcxx . . $ StackDisplay#setCount(d4f767463ce0a6b3).(int value)
68 {
69 pcxx . . $ StackDisplay#p.->countcxx . . $ StackDisplayPrivate#count. = value;
70 updatecxx . . $ QWidget#update(49f6e7a06ebc5aa8).();
71 }
72
73 void StackDisplaycxx . . $ StackDisplay#::setSelectedcxx . . $ StackDisplay#setSelected(d4f767463ce0a6b3).(int value)
74 {
75 pcxx . . $ StackDisplay#p.->indexSelectedcxx . . $ StackDisplayPrivate#indexSelected. = value;
76 updatecxx . . $ QWidget#update(49f6e7a06ebc5aa8).();
77 }
78
79 void StackDisplaycxx . . $ StackDisplay#::setMargincxx . . $ StackDisplay#setMargin(d4f767463ce0a6b3).(int value)
80 {
81 pcxx . . $ StackDisplay#p.->margincxx . . $ StackDisplayPrivate#margin. = value;
82 }
83
84 void StackDisplaycxx . . $ StackDisplay#::paintEventcxx . . $ StackDisplay#paintEvent(f239c9e85d61a220).(QPaintEventcxx . . $ QPaintEvent#*)
85 {
86 drawBarscxx . . $ StackDisplay#drawBars(49f6e7a06ebc5aa8).();
87 QStyleOptioncxx . . $ QStyleOption# optcxx . . $ QStyleOption#QStyleOption(3e454b8ccf442868).;
88 opt.initcxx . . $ QStyleOption#init(20cdb7fa2a1349c7).(this);
89 QPaintercxx . . $ QPainter# pcxx . . $ QPainter#QPainter(dd2eedc069b0ab5f).(this);
90 stylecxx . . $ QWidget#style(5bbb00d3017c281f).()->drawPrimitivecxx . . $ QStyle#drawPrimitive(68b0feb4a84cbdce).(QStylecxx . . $ QStyle#::PE_Widgetcxx . . $ QStyle#PE_Widget., &opt, &p, this);
91 }
92
93 void StackDisplaycxx . . $ StackDisplay#::drawBarscxx . . $ StackDisplay#drawBars(49f6e7a06ebc5aa8).()
94 {
95
96 QPaintercxx . . $ QPainter# paintercxx . . $ QPainter#QPainter(dd2eedc069b0ab5f).(this);
97 painter.setPencxx . . $ QPainter#setPen(129a55e114526ad3).(pcxx . . $ StackDisplay#p.->colorBarscxx . . $ StackDisplayPrivate#colorBars.);
98
99 if (pcxx . . $ StackDisplay#p.->countcxx . . $ StackDisplayPrivate#count. == 0)
100 return;
101
102 int space = (int)(pcxx . . $ StackDisplay#p.->heightcxx . . $ StackDisplayPrivate#height. / pcxx . . $ StackDisplay#p.->countcxx . . $ StackDisplayPrivate#count.);
103 int posY = 0;
104
105 for (int i = 0; i < pcxx . . $ StackDisplay#p.->countcxx . . $ StackDisplayPrivate#count.; i++) {
106 posY = posY + space;
107 for (int j = 0; j < pcxx . . $ StackDisplay#p.->barHeightcxx . . $ StackDisplayPrivate#barHeight.; j++) {
108 //draw bars
109 painter.drawLinecxx . . $ QPainter#drawLine(748afa4755bc9595).(pcxx . . $ StackDisplay#p.->margincxx . . $ StackDisplayPrivate#margin. * 2,
110 posY + j - pcxx . . $ StackDisplay#p.->barHeightcxx . . $ StackDisplayPrivate#barHeight.,
111 pcxx . . $ StackDisplay#p.->widthcxx . . $ StackDisplayPrivate#width. - pcxx . . $ StackDisplay#p.->margincxx . . $ StackDisplayPrivate#margin.,
112 posY + j - pcxx . . $ StackDisplay#p.->barHeightcxx . . $ StackDisplayPrivate#barHeight.);
113 }
114 if (i == pcxx . . $ StackDisplay#p.->indexSelectedcxx . . $ StackDisplayPrivate#indexSelected.) {
115 //draw triancle
116 for (int j = pcxx . . $ StackDisplay#p.->margincxx . . $ StackDisplayPrivate#margin.; j < pcxx . . $ StackDisplay#p.->margincxx . . $ StackDisplayPrivate#margin. + 5; j++) {
117 painter.drawLinecxx . . $ QPainter#drawLine(748afa4755bc9595).(j,
118 posY - (pcxx . . $ StackDisplay#p.->margincxx . . $ StackDisplayPrivate#margin. + 5 - j) + 1 - pcxx . . $ StackDisplay#p.->barHeightcxx . . $ StackDisplayPrivate#barHeight.,
119 j,
120 posY + (pcxx . . $ StackDisplay#p.->margincxx . . $ StackDisplayPrivate#margin. + 5 - j) - 1 - pcxx . . $ StackDisplay#p.->barHeightcxx . . $ StackDisplayPrivate#barHeight.);
121 }
122 }
123 }
124 }