Sat, 09 Jul 2022 23:05:25 +0200
Increased some labels sizes.
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | /* |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
2 | * RangedSlider.cpp is part bmsapp. |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | * |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
4 | * Original written for Brewtarget, and is Copyright the following |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | * authors 2009-2020 |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | * - Matt Young <mfsy@yahoo.com> |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | * - Mik Firestone <mikfire@gmail.com> |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | * - Philip G. Lee <rocketman768@gmail.com> |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | * |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | * bmsapp is free software: you can redistribute it and/or modify |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | * it under the terms of the GNU General Public License as published by |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | * the Free Software Foundation, either version 3 of the License, or |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | * (at your option) any later version. |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | * |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | * bmsapp is distributed in the hope that it will be useful, |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
18 | * GNU General Public License for more details. |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
19 | * |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
20 | * You should have received a copy of the GNU General Public License |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
21 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
22 | */ |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
23 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
24 | #include "RangedSlider.h" |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
25 | #include <QPaintEvent> |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
26 | #include <QPainter> |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
27 | #include <QColor> |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
28 | #include <QPalette> |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
29 | #include <QApplication> |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
30 | #include <QRectF> |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
31 | #include <QFont> |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
32 | #include <QFontMetrics> |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
33 | #include <QMouseEvent> |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
34 | #include <QLabel> |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
35 | #include <QToolTip> |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
36 | #include <QLinearGradient> |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
37 | #include <QPainterPath> |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
38 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
39 | #include <QDebug> |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
40 | |
99
053c0578cf58
CMakeLists.txt cleanup. Removed partial BeerColor plugin, it was ugly and takes too much space. A bit of RanedSlider code cleanup. Most widgets for the first tab in the recipe editor placed.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
41 | RangedSlider::RangedSlider(QWidget* parent) : QWidget(parent), |
97
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
42 | _min(0.0), |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
43 | _max(1.0), |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
44 | _prefMin(0.25), |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
45 | _prefMax(0.75), |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
46 | _val(0.5), |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
47 | _prec(3), |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
48 | _tooltipText(""), |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
49 | _bgBrush(QColor(255,0,0)), |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
50 | _prefRangeBrush(QColor(0,127,0)), |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
51 | _prefRangePen(Qt::NoPen), |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
52 | _markerBrush(QColor(255,255,255)), |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
53 | _markerTextIsValue(false), |
99
053c0578cf58
CMakeLists.txt cleanup. Removed partial BeerColor plugin, it was ugly and takes too much space. A bit of RanedSlider code cleanup. Most widgets for the first tab in the recipe editor placed.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
54 | indicatorTextFont("Arial", 10, QFont::Normal) // Previously we just did the indicator text in 'default' font |
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
55 | { |
100
d11a3e713e3b
Added more edit fields to the first recipe editor tab. Cleanup of RangedSlider is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
99
diff
changeset
|
56 | // Fixed minimum size. |
d11a3e713e3b
Added more edit fields to the first recipe editor tab. Cleanup of RangedSlider is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
99
diff
changeset
|
57 | this->setMinimumSize(60, 20); |
d11a3e713e3b
Added more edit fields to the first recipe editor tab. Cleanup of RangedSlider is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
99
diff
changeset
|
58 | this->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed ); |
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
59 | |
100
d11a3e713e3b
Added more edit fields to the first recipe editor tab. Cleanup of RangedSlider is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
99
diff
changeset
|
60 | // There no particular reason to limit our horizontal size, so, in principle, this call asks that there be no such |
d11a3e713e3b
Added more edit fields to the first recipe editor tab. Cleanup of RangedSlider is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
99
diff
changeset
|
61 | // (practical) limit. |
d11a3e713e3b
Added more edit fields to the first recipe editor tab. Cleanup of RangedSlider is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
99
diff
changeset
|
62 | this->setMaximumWidth(QWIDGETSIZE_MAX); |
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
63 | |
100
d11a3e713e3b
Added more edit fields to the first recipe editor tab. Cleanup of RangedSlider is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
99
diff
changeset
|
64 | // Generate mouse move events whenever mouse movers over widget. |
d11a3e713e3b
Added more edit fields to the first recipe editor tab. Cleanup of RangedSlider is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
99
diff
changeset
|
65 | this->setMouseTracking(true); |
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
66 | |
100
d11a3e713e3b
Added more edit fields to the first recipe editor tab. Cleanup of RangedSlider is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
99
diff
changeset
|
67 | this->repaint(); |
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
68 | } |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
69 | |
100
d11a3e713e3b
Added more edit fields to the first recipe editor tab. Cleanup of RangedSlider is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
99
diff
changeset
|
70 | |
97
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
71 | /** |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
72 | * @brief Set the normal limits in the _prexXxx values and calculate |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
73 | * the real drawing limits so that we can see if a value is slightly |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
74 | * out of range. |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
75 | */ |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
76 | void RangedSlider::setRange( double min, double max ) |
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
77 | { |
97
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
78 | _prefMin = min; |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
79 | _prefMax = max; |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
80 | // Calculate the outer limits |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
81 | _min = _prefMin - ((_prefMax - _prefMin) * 0.2); |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
82 | _max = _prefMax + ((_prefMax - _prefMin) * 0.2); |
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
83 | |
97
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
84 | // Set the tooltip with the ranges. |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
85 | _tooltipText = QString("%1 - %2").arg(min, 0, 'f', _prec).arg(max, 0, 'f', _prec); |
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
86 | |
97
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
87 | update(); |
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
88 | } |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
89 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
90 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
91 | void RangedSlider::setRange(QPair<double,double> minmax) |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
92 | { |
99
053c0578cf58
CMakeLists.txt cleanup. Removed partial BeerColor plugin, it was ugly and takes too much space. A bit of RanedSlider code cleanup. Most widgets for the first tab in the recipe editor placed.
Michiel Broek <mbroek@mbse.eu>
parents:
97
diff
changeset
|
93 | setRange( minmax.first, minmax.second ); |
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
94 | } |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
95 | |
97
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
96 | |
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
97 | void RangedSlider::setValue(double value) |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
98 | { |
97
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
99 | _val = value; |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
100 | |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
101 | if (_val < _min) |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
102 | _val = _min; |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
103 | if (_val > _max) |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
104 | _val = _max; |
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
105 | |
97
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
106 | if (_markerTextIsValue) { |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
107 | _markerText = QString("%1").arg(value, 0, 'f', _prec); |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
108 | } |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
109 | |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
110 | update(); |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
111 | return; |
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
112 | } |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
113 | |
97
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
114 | |
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
115 | void RangedSlider::setPrecision(int precision) |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
116 | { |
97
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
117 | _prec = precision; |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
118 | update(); |
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
119 | } |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
120 | |
97
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
121 | |
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
122 | void RangedSlider::setBackgroundBrush( QBrush const& brush ) |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
123 | { |
97
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
124 | _bgBrush = brush; |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
125 | update(); |
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
126 | } |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
127 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
128 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
129 | void RangedSlider::setMarkerBrush( QBrush const& brush ) |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
130 | { |
97
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
131 | _markerBrush = brush; |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
132 | update(); |
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
133 | } |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
134 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
135 | void RangedSlider::setMarkerText( QString const& text ) |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
136 | { |
97
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
137 | _markerText = text; |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
138 | update(); |
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
139 | } |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
140 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
141 | void RangedSlider::setMarkerTextIsValue(bool val) |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
142 | { |
97
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
143 | _markerTextIsValue = val; |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
144 | update(); |
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
145 | } |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
146 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
147 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
148 | void RangedSlider::mouseMoveEvent(QMouseEvent* event) |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
149 | { |
97
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
150 | event->accept(); |
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
151 | |
97
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
152 | QPoint tipPoint( mapToGlobal(QPoint(0,0)) ); |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
153 | QToolTip::showText( tipPoint, _tooltipText, this ); |
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
154 | } |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
155 | |
97
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
156 | |
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
157 | void RangedSlider::paintEvent(QPaintEvent* event) |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
158 | { |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
159 | // |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
160 | // Simplistically, the high-level layout of the slider is: |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
161 | // |
97
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
162 | // |------------------------------------------------| |
96
c36fef8bb088
Removed the ugly green value text from the ranged slider.
Michiel Broek <mbroek@mbse.eu>
parents:
92
diff
changeset
|
163 | // | <--------------- Graphical Area -------------> | |
c36fef8bb088
Removed the ugly green value text from the ranged slider.
Michiel Broek <mbroek@mbse.eu>
parents:
92
diff
changeset
|
164 | // |------------------------------------------------| |
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
165 | // |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
166 | // The graphical area has: |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
167 | // - a background rectangle of the full width of the area, representing the range from this->_min to this->_max |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
168 | // - a foreground rectangle showing the sub-range of this background from this->_prefMin to this->_prefMax |
97
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
169 | // - a vertical line ("the indicator") showing where this->_val lies in the (this->_min to this->_max) range |
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
170 | // |
97
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
171 | // The indicator text sits on the center of the area and shows either its value (this->_valText) or some textual |
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
172 | // description (eg "Slightly Malty" on the IBU/GU scale) which comes from this->_markerText. |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
173 | // |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
174 | |
97
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
175 | int graphicalAreaHeight = this->height(); |
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
176 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
177 | // Although the Qt calls take an x- and a y- radius, we want the radius on the rectangle corners to be the same |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
178 | // vertically and horizontally, so only define one measure here. |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
179 | int rectangleCornerRadius = graphicalAreaHeight / 4; |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
180 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
181 | static const QPalette palette(QApplication::palette()); |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
182 | static const int indicatorLineWidth = 4; |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
183 | static const QColor fgRectColor(0,127,0); |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
184 | static const QColor indicatorTextColor(0,0,0); |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
185 | static const QColor valueTextColor(0,127,0); |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
186 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
187 | QLinearGradient glassGrad( QPointF(0,0), QPointF(0,graphicalAreaHeight) ); |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
188 | glassGrad.setColorAt( 0, QColor(255,255,255,127) ); |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
189 | glassGrad.setColorAt( 1, QColor(255,255,255,0) ); |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
190 | QBrush glassBrush(glassGrad); |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
191 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
192 | // Per https://doc.qt.io/qt-5/highdpi.html, for best High DPI display support, we need to: |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
193 | // • Always use the qreal versions of the QPainter drawing API |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
194 | // • Size windows and dialogs in relation to the corresponding screen size |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
195 | // • Replace hard-coded sizes in layouts and drawing code with values calculated from font metrics or screen size |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
196 | QPainter painter(this); |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
197 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
198 | // Work out the left-to-right (ie x-coordinate) positions of things in the graphical area |
97
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
199 | double graphicalAreaWidth = this->width(); |
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
200 | double range = this->_max - this->_min; |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
201 | double fgRectLeft = graphicalAreaWidth * ((this->_prefMin - this->_min )/range); |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
202 | double fgRectWidth = graphicalAreaWidth * ((this->_prefMax - this->_prefMin)/range); |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
203 | double indicatorLineMiddle = graphicalAreaWidth * ((this->_val - this->_min )/range); |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
204 | double indicatorLineLeft = indicatorLineMiddle - (indicatorLineWidth / 2); |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
205 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
206 | // Make sure all coordinates are valid. |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
207 | fgRectLeft = qBound(0.0, fgRectLeft, graphicalAreaWidth); |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
208 | fgRectWidth = qBound(0.0, fgRectWidth, graphicalAreaWidth - fgRectLeft); |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
209 | indicatorLineMiddle = qBound(0.0, indicatorLineMiddle, graphicalAreaWidth - (indicatorLineWidth / 2)); |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
210 | indicatorLineLeft = qBound(0.0, indicatorLineLeft, graphicalAreaWidth - indicatorLineWidth); |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
211 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
212 | // All the rest of what we need to do is inside the graphical area, so move the origin to the top-left corner of it |
97
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
213 | painter.translate(0, 0); |
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
214 | painter.setPen(Qt::NoPen); |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
215 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
216 | // Make sure anything we draw "inside" the "glass rectangle" stays inside. |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
217 | QPainterPath clipRect; |
97
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
218 | clipRect.addRoundedRect( QRectF(0, 0, graphicalAreaWidth, graphicalAreaHeight), rectangleCornerRadius, rectangleCornerRadius ); |
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
219 | painter.setClipPath(clipRect); |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
220 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
221 | // Draw the background rectangle. |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
222 | painter.setBrush(_bgBrush); |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
223 | painter.setRenderHint(QPainter::Antialiasing); |
97
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
224 | painter.drawRoundedRect( QRectF(0, 0, graphicalAreaWidth, graphicalAreaHeight), rectangleCornerRadius, rectangleCornerRadius ); |
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
225 | painter.setRenderHint(QPainter::Antialiasing, false); |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
226 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
227 | // Draw the style "foreground" rectangle. |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
228 | painter.save(); |
97
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
229 | painter.setBrush(_prefRangeBrush); |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
230 | painter.setPen(_prefRangePen); |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
231 | painter.setRenderHint(QPainter::Antialiasing); |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
232 | painter.drawRoundedRect( QRectF(fgRectLeft, 0, fgRectWidth, graphicalAreaHeight), rectangleCornerRadius, rectangleCornerRadius ); |
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
233 | painter.restore(); |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
234 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
235 | // Draw the indicator. |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
236 | painter.setBrush(_markerBrush); |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
237 | painter.drawRect( QRectF(indicatorLineLeft, 0, indicatorLineWidth, graphicalAreaHeight) ); |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
238 | |
97
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
239 | // Draw a white-to-clear gradient to suggest "glassy." |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
240 | painter.setBrush(glassBrush); |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
241 | painter.setRenderHint(QPainter::Antialiasing); |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
242 | painter.drawRoundedRect( QRectF(0, 0, graphicalAreaWidth, graphicalAreaHeight), rectangleCornerRadius, rectangleCornerRadius ); |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
243 | painter.setRenderHint(QPainter::Antialiasing, false); |
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
244 | |
97
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
245 | // Draw the _markerText in the center of the widget. |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
246 | // First we ask the painter what size rectangle it will need to display this text |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
247 | painter.setPen(indicatorTextColor); |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
248 | painter.setFont(this->indicatorTextFont); |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
249 | QRectF indicatorTextRect = painter.boundingRect(QRectF(), Qt::AlignCenter | Qt::AlignBottom, this->_markerText); |
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
250 | |
97
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
251 | // Then we use the size of this rectangle to try to calculate the X and Y position for the markerText. |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
252 | double indicatorTextX = (graphicalAreaWidth - indicatorTextRect.width()) / 2; |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
253 | double indicatorTextY = (graphicalAreaHeight - indicatorTextRect.height()) / 2; |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
254 | |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
255 | // Now we can draw the indicator text |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
256 | painter.drawText( indicatorTextX, indicatorTextY, indicatorTextRect.width(), indicatorTextRect.height(), Qt::AlignCenter | Qt::AlignBottom, this->_markerText); |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
257 | |
8283bbf95806
Stripped down the RangedSlider. It is more compact and still does everything. Base colors (red and green) are fixed inside, also automatisc setting of outer limits. The tooltip shows the current ranges. Still some finetuning to be done.
Michiel Broek <mbroek@mbse.eu>
parents:
96
diff
changeset
|
258 | return; |
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
259 | } |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
260 | |
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
261 | |
100
d11a3e713e3b
Added more edit fields to the first recipe editor tab. Cleanup of RangedSlider is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
99
diff
changeset
|
262 | void RangedSlider::moveEvent(QMoveEvent *event) |
d11a3e713e3b
Added more edit fields to the first recipe editor tab. Cleanup of RangedSlider is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
99
diff
changeset
|
263 | { |
d11a3e713e3b
Added more edit fields to the first recipe editor tab. Cleanup of RangedSlider is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
99
diff
changeset
|
264 | QWidget::moveEvent(event); |
d11a3e713e3b
Added more edit fields to the first recipe editor tab. Cleanup of RangedSlider is ready.
Michiel Broek <mbroek@mbse.eu>
parents:
99
diff
changeset
|
265 | return; |
92
fb0bb9a2a7e1
Added support to build designer plugins, but it is nog yet complete. Added RangedSlider fro the brewtarget project to make our version of it. Started EditRecipe screen.
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
266 | } |