Loading...
Searching...
No Matches
widgets/Constants.hpp
1#pragma once
2#include <QGraphicsItem>
3#include <QRectF>
4
5#include <score_lib_base_export.h>
6
7#include <algorithm>
8#include <array>
9#include <cstddef>
10namespace score
11{
12static const constexpr QRectF defaultSliderSize{0., 0., 60., 23.};
13static const constexpr QRectF defaultKnobSize{0., 0., 35., 35.};
14static const constexpr QRectF defaultCheckBoxSize{0., 0., 20., 20.};
15static const constexpr QRectF defaultToggleSize{0., 0., 60., 20.};
16static const constexpr QRectF defaultRangeSliderSize{0., 0., 60., 23.};
17
18struct DoubleSpinboxWithEnter;
19struct DefaultControlImpl;
20struct DefaultGraphicsSliderImpl;
21struct DefaultGraphicsSpinboxImpl;
22struct DefaultGraphicsKnobImpl;
23
26static const constexpr auto LinkComponentsModifier = Qt::ShiftModifier;
27
28SCORE_LIB_BASE_EXPORT bool linkComponentsRequested() noexcept;
29
33template <typename T, std::size_t N, typename Set>
35 const std::array<T, N>& previous, std::size_t source, T current, Set&& set) noexcept
36{
37 const T delta = current - previous[source];
38 for(std::size_t i = 0; i < N; i++)
39 if(i != source)
40 set(i, std::clamp(T(previous[i] + delta), T(0), T(1)));
41}
42
43static constexpr auto GraphicsItemType = QGraphicsItem::UserType + 90000;
44#define SCORE_GRAPHICS_ITEM_TYPE(value) \
45private: \
46 Q_INTERFACES(QGraphicsItem) \
47public: \
48 enum \
49 { \
50 Type = GraphicsItemType + value \
51 }; \
52 int type() const override \
53 { \
54 return Type; \
55 } \
56 \
57private:
58}
Base toolkit upon which the software is built.
Definition Application.cpp:108
void linkComponents(const std::array< T, N > &previous, std::size_t source, T current, Set &&set) noexcept
Definition widgets/Constants.hpp:34
STL namespace.