33#include <NDEVR/WidgetOptions.h>
34#include <NDEVR/Bounds.h>
35#include <NDEVR/VectorFunctions.h>
37#include <QApplication>
38#include <QStylePainter>
39#include <QPropertyAnimation>
58 setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed);
70 if (widget !=
nullptr)
72 QPoint pos = mapFromGlobal(widget->mapToGlobal(QPoint(0,0)));
73 QRect geometry(pos, widget->size());
76 bounds = { geometry.y(), geometry.bottomRight().y() };
78 bounds = { geometry.x(), geometry.bottomRight().x() };
106 setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Ignored);
108 setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred);
128 QPoint(width() / 4, draw_bounds[
MIN] - width())
129 , QPoint(width() / 1, draw_bounds[
MAX] + width()));
134 QPoint(draw_bounds[
MIN] - height(), height() / 4)
135 , QPoint(draw_bounds[
MAX] + height(), height() / 1));
141 QColor highlight = palette().color(QPalette::ColorRole::Highlight);
142 QColor background = highlight.darker();
143 background.setAlphaF(0.2f);
144 QPen pen(QColor(0, 0, 0));
147 p.setBrush(background);
148 QRect entire_rect(QPoint(0, 0), size());
149 p.drawRect(entire_rect);
151 QLinearGradient linear;
152 linear.setColorAt(0.0, QColor(0, 0, 0, 0));
153 linear.setColorAt(0.2, highlight);
154 linear.setColorAt(0.8, highlight);
155 linear.setColorAt(1.0, QColor(0, 0, 0, 0));
156 linear.setStart(draw_rect.topLeft());
157 linear.setFinalStop(draw_rect.bottomRight());
160 p.drawRect(draw_rect);
164 int thickness =
getMax(2, style()->pixelMetric(QStyle::PixelMetric::PM_SmallIconSize) / 8);
167 return QSize(thickness, 0);
171 return QSize(0, thickness);
A specification of upper and lower bounds in N-dimensions.
Definition Bounds.hpp:57
Definition SelectionHighlightBar.h:44
void setAnimationPercent(double animation_percent)
Definition SelectionHighlightBar.h:62
void paintEvent(QPaintEvent *) override
Definition SelectionHighlightBar.h:121
double animation_percent
Definition SelectionHighlightBar.h:46
Bounds< 1, int > m_old_draw_bounds
Definition SelectionHighlightBar.h:194
QSize sizeHint() const override
Definition SelectionHighlightBar.h:162
double m_animation_percent
Definition SelectionHighlightBar.h:199
void moveHighlight(QWidget *widget)
Definition SelectionHighlightBar.h:67
bool m_is_vertical
Definition SelectionHighlightBar.h:197
Bounds< 1, int > m_draw_bounds
Definition SelectionHighlightBar.h:195
int m_speed
Definition SelectionHighlightBar.h:198
double animationPercent() const
Definition SelectionHighlightBar.h:61
SelectionHighlightBar(QWidget *parent=nullptr)
Definition SelectionHighlightBar.h:48
void moveHighlight(const Bounds< 1, int > &bounds)
Definition SelectionHighlightBar.h:87
QPropertyAnimation * m_move_animation
Definition SelectionHighlightBar.h:193
void startAnimation()
Definition SelectionHighlightBar.h:177
enum QEasingCurve::Type m_animation_type
Definition SelectionHighlightBar.h:196
Bounds< 1, int > currentBounds() const
Definition SelectionHighlightBar.h:112
void setVertical(bool vertical)
Definition SelectionHighlightBar.h:102
An element of a vector space. An element of the real coordinate space Rn Basis vector,...
Definition Vector.hpp:62
constexpr t_type getMax(const t_type &left, const t_type &right)
Finds the max of the given arguments using the > operator.
Definition BaseFunctions.hpp:116
@ MIN
Definition BaseValues.hpp:226
@ MAX
Definition BaseValues.hpp:227
constexpr t_to cast(const Angle< t_from > &value)
Definition Angle.h:514