diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ff23a479..82d41435 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -102,6 +102,7 @@ else() private/widgets/DockWidget.cpp private/widgets/QWidgetAdapter_widgets.cpp private/indicators/ClassicIndicators.cpp + private/indicators/ClassicIndicatorsWindow.cpp # private/indicators/AnimatedIndicators.cpp ) diff --git a/src/private/indicators/ClassicIndicators.cpp b/src/private/indicators/ClassicIndicators.cpp index 82fffea5..189afc33 100644 --- a/src/private/indicators/ClassicIndicators.cpp +++ b/src/private/indicators/ClassicIndicators.cpp @@ -14,243 +14,14 @@ #include "DragController_p.h" #include "Frame_p.h" #include "Logging_p.h" -#include "Utils_p.h" +#include "Config.h" #include "FrameworkWidgetFactory.h" +#include "ClassicIndicatorsWindow_p.h" -#include - -#define INDICATOR_WIDTH 40 -#define OUTTER_INDICATOR_MARGIN 10 //#define KDDOCKWIDGETS_RUBBERBAND_IS_TOPLEVEL 1 using namespace KDDockWidgets; -namespace KDDockWidgets { -class IndicatorWindow; -} - -void Indicator::paintEvent(QPaintEvent *) -{ - QPainter p(this); - if (m_hovered) - p.drawImage(rect(), m_imageActive, rect()); - else - p.drawImage(rect(), m_image, rect()); - -} - -void Indicator::setHovered(bool hovered) -{ - if (hovered != m_hovered) { - m_hovered = hovered; - update(); - if (hovered) { - q->setDropLocation(m_dropLocation); - } else if (q->currentDropLocation() == m_dropLocation) { - q->setDropLocation(DropIndicatorOverlayInterface::DropLocation_None); - } - } -} - -QString Indicator::iconName(bool active) const -{ - QString suffix = active ? QStringLiteral("_active") - : QString(); - - QString name; - switch (m_dropLocation) { - case DropIndicatorOverlayInterface::DropLocation_Center: - name = QStringLiteral("center"); - break; - case DropIndicatorOverlayInterface::DropLocation_Left: - name = QStringLiteral("inner_left"); - break; - case DropIndicatorOverlayInterface::DropLocation_Right: - name = QStringLiteral("inner_right"); - break; - case DropIndicatorOverlayInterface::DropLocation_Bottom: - name = QStringLiteral("inner_bottom"); - break; - case DropIndicatorOverlayInterface::DropLocation_Top: - name = QStringLiteral("inner_top"); - break; - case DropIndicatorOverlayInterface::DropLocation_OutterLeft: - name = QStringLiteral("outter_left"); - break; - case DropIndicatorOverlayInterface::DropLocation_OutterBottom: - name = QStringLiteral("outter_bottom"); - break; - case DropIndicatorOverlayInterface::DropLocation_OutterRight: - name = QStringLiteral("outter_right"); - break; - case DropIndicatorOverlayInterface::DropLocation_OutterTop: - name = QStringLiteral("outter_top"); - break; - case DropIndicatorOverlayInterface::DropLocation_None: - return QString(); - } - - return name + suffix; -} - -QString Indicator::iconFileName(bool active) const -{ - const QString name = iconName(active); - return KDDockWidgets::windowManagerHasTranslucency() ? QStringLiteral(":/img/classic_indicators/%1.png").arg(name) - : QStringLiteral(":/img/classic_indicators/opaque/%1.png").arg(name); -} - -IndicatorWindow::IndicatorWindow(ClassicIndicators *classicIndicators_, QWidget *) - : QWidget(nullptr, Qt::Tool | Qt::BypassWindowManagerHint) - , classicIndicators(classicIndicators_) - , m_center(new Indicator(classicIndicators, this, DropIndicatorOverlayInterface::DropLocation_Center)) // Each indicator is not a top-level. Otherwise there's noticeable delay. - , m_left(new Indicator(classicIndicators, this, DropIndicatorOverlayInterface::DropLocation_Left)) - , m_right(new Indicator(classicIndicators, this, DropIndicatorOverlayInterface::DropLocation_Right)) - , m_bottom(new Indicator(classicIndicators, this, DropIndicatorOverlayInterface::DropLocation_Bottom)) - , m_top(new Indicator(classicIndicators, this, DropIndicatorOverlayInterface::DropLocation_Top)) - , m_outterLeft(new Indicator(classicIndicators, this, DropIndicatorOverlayInterface::DropLocation_OutterLeft)) - , m_outterRight(new Indicator(classicIndicators, this, DropIndicatorOverlayInterface::DropLocation_OutterRight)) - , m_outterBottom(new Indicator(classicIndicators, this, DropIndicatorOverlayInterface::DropLocation_OutterBottom)) - , m_outterTop(new Indicator(classicIndicators, this, DropIndicatorOverlayInterface::DropLocation_OutterTop)) -{ - setWindowFlag(Qt::FramelessWindowHint, true); - setAttribute(Qt::WA_TranslucentBackground); - updatePosition(); - - m_indicators << m_center << m_left << m_right << m_top << m_bottom - << m_outterBottom << m_outterTop << m_outterLeft << m_outterRight; - - setObjectName(QStringLiteral("_docks_IndicatorWindow_Overlay")); -} - -bool IndicatorWindow::event(QEvent *e) -{ - if (e->type() == QEvent::Show) { - updatePosition(); - } - - return QWidget::event(e); -} - -Indicator *IndicatorWindow::indicatorForLocation(DropIndicatorOverlayInterface::DropLocation loc) const -{ - switch (loc) { - case DropIndicatorOverlayInterface::DropLocation_Center: - return m_center; - case DropIndicatorOverlayInterface::DropLocation_Left: - return m_left; - case DropIndicatorOverlayInterface::DropLocation_Right: - return m_right; - case DropIndicatorOverlayInterface::DropLocation_Bottom: - return m_bottom; - case DropIndicatorOverlayInterface::DropLocation_Top: - return m_top; - case DropIndicatorOverlayInterface::DropLocation_OutterLeft: - return m_outterLeft; - case DropIndicatorOverlayInterface::DropLocation_OutterBottom: - return m_outterBottom; - case DropIndicatorOverlayInterface::DropLocation_OutterRight: - return m_outterRight; - case DropIndicatorOverlayInterface::DropLocation_OutterTop: - return m_outterTop; - case DropIndicatorOverlayInterface::DropLocation_None: - return nullptr; - } - - return nullptr; -} - -void IndicatorWindow::updateMask() -{ - QRegion region; - - if (!KDDockWidgets::windowManagerHasTranslucency()) { - for (Indicator *indicator : qAsConst(m_indicators)) { - if (indicator->isVisible()) - region = region.united(QRegion(indicator->geometry(), QRegion::Rectangle)); - } - } - - setMask(region); -} - -void IndicatorWindow::resizeEvent(QResizeEvent *ev) -{ - QWidget::resizeEvent(ev); - updatePositions(); -} - -void IndicatorWindow::updateIndicatorVisibility(bool visible) -{ - Frame *hoveredFrame = classicIndicators->m_hoveredFrame; - const bool isTheOnlyFrame = hoveredFrame && hoveredFrame->isTheOnlyFrame(); - - const bool innerShouldBeVisible = visible && hoveredFrame; - const bool outterShouldBeVisible = visible && !isTheOnlyFrame; - - for (Indicator *indicator : { m_center, m_left, m_right, m_bottom, m_top }) - indicator->setVisible(innerShouldBeVisible); - - for (Indicator *indicator : { m_outterTop, m_outterLeft, m_outterRight, m_outterBottom }) - indicator->setVisible(outterShouldBeVisible); - - updateMask(); -} - -QPoint IndicatorWindow::posForIndicator(DropIndicatorOverlayInterface::DropLocation loc) const -{ - Indicator *indicator = indicatorForLocation(loc); - return indicator->mapToGlobal(indicator->rect().center()); -} - -void IndicatorWindow::hover(QPoint globalPos) -{ - for (Indicator *indicator : qAsConst(m_indicators)) { - if (indicator->isVisible()) - indicator->setHovered(indicator->rect().contains(indicator->mapFromGlobal(globalPos))); - } -} - -void IndicatorWindow::updatePosition() -{ - QRect rect = classicIndicators->rect(); - QPoint pos = classicIndicators->mapToGlobal(QPoint(0, 0)); - rect.moveTo(pos); - setGeometry(rect); -} - -void IndicatorWindow::updatePositions() -{ - QRect r = rect(); - const int indicatorWidth = m_outterBottom->width(); - const int halfIndicatorWidth = m_outterBottom->width() / 2; - - m_outterLeft->move(r.x() + OUTTER_INDICATOR_MARGIN, r.center().y() - halfIndicatorWidth); - m_outterBottom->move(r.center().x() - halfIndicatorWidth, r.y() + height() - indicatorWidth - OUTTER_INDICATOR_MARGIN); - m_outterTop->move(r.center().x() - halfIndicatorWidth, r.y() + OUTTER_INDICATOR_MARGIN); - m_outterRight->move(r.x() + width() - indicatorWidth - OUTTER_INDICATOR_MARGIN, r.center().y() - halfIndicatorWidth); - Frame *hoveredFrame = classicIndicators->m_hoveredFrame; - if (hoveredFrame) { - QRect hoveredRect = hoveredFrame->QWidget::geometry(); - m_center->move(r.topLeft() + hoveredRect.center() - QPoint(halfIndicatorWidth, halfIndicatorWidth)); - m_top->move(m_center->pos() - QPoint(0, indicatorWidth + OUTTER_INDICATOR_MARGIN)); - m_right->move(m_center->pos() + QPoint(indicatorWidth + OUTTER_INDICATOR_MARGIN, 0)); - m_bottom->move(m_center->pos() + QPoint(0, indicatorWidth + OUTTER_INDICATOR_MARGIN)); - m_left->move(m_center->pos() - QPoint(indicatorWidth + OUTTER_INDICATOR_MARGIN, 0)); - } -} - -Indicator::Indicator(ClassicIndicators *classicIndicators, IndicatorWindow *parent, ClassicIndicators::DropLocation location) - : QWidget(parent) - , q(classicIndicators) - , m_dropLocation(location) -{ - m_image = QImage(iconFileName(/*active=*/ false)).scaled(INDICATOR_WIDTH, INDICATOR_WIDTH); - m_imageActive = QImage(iconFileName(/*active=*/ true)).scaled(INDICATOR_WIDTH, INDICATOR_WIDTH); - setFixedSize(m_image.size()); - setVisible(true); -} - ClassicIndicators::ClassicIndicators(DropArea *dropArea) : DropIndicatorOverlayInterface(dropArea) // Is parented on the drop-area, not a toplevel. , m_rubberBand(Config::self().frameworkWidgetFactory()->createRubberBand(rubberBandIsTopLevel() ? nullptr : dropArea)) diff --git a/src/private/indicators/ClassicIndicatorsWindow.cpp b/src/private/indicators/ClassicIndicatorsWindow.cpp new file mode 100644 index 00000000..9c1987e9 --- /dev/null +++ b/src/private/indicators/ClassicIndicatorsWindow.cpp @@ -0,0 +1,242 @@ +/* + This file is part of KDDockWidgets. + + SPDX-FileCopyrightText: 2019-2020 Klarälvdalens Datakonsult AB, a KDAB Group company + Author: Sérgio Martins + + SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only + + Contact KDAB at for commercial licensing options. +*/ + +#include "ClassicIndicatorsWindow_p.h" +#include "ClassicIndicators_p.h" +#include "Utils_p.h" + +#include + +#define INDICATOR_WIDTH 40 +#define OUTTER_INDICATOR_MARGIN 10 + +using namespace KDDockWidgets; + +void Indicator::paintEvent(QPaintEvent *) +{ + QPainter p(this); + if (m_hovered) + p.drawImage(rect(), m_imageActive, rect()); + else + p.drawImage(rect(), m_image, rect()); +} + +void Indicator::setHovered(bool hovered) +{ + if (hovered != m_hovered) { + m_hovered = hovered; + update(); + if (hovered) { + q->setDropLocation(m_dropLocation); + } else if (q->currentDropLocation() == m_dropLocation) { + q->setDropLocation(DropIndicatorOverlayInterface::DropLocation_None); + } + } +} + +QString Indicator::iconName(bool active) const +{ + QString suffix = active ? QStringLiteral("_active") + : QString(); + + QString name; + switch (m_dropLocation) { + case DropIndicatorOverlayInterface::DropLocation_Center: + name = QStringLiteral("center"); + break; + case DropIndicatorOverlayInterface::DropLocation_Left: + name = QStringLiteral("inner_left"); + break; + case DropIndicatorOverlayInterface::DropLocation_Right: + name = QStringLiteral("inner_right"); + break; + case DropIndicatorOverlayInterface::DropLocation_Bottom: + name = QStringLiteral("inner_bottom"); + break; + case DropIndicatorOverlayInterface::DropLocation_Top: + name = QStringLiteral("inner_top"); + break; + case DropIndicatorOverlayInterface::DropLocation_OutterLeft: + name = QStringLiteral("outter_left"); + break; + case DropIndicatorOverlayInterface::DropLocation_OutterBottom: + name = QStringLiteral("outter_bottom"); + break; + case DropIndicatorOverlayInterface::DropLocation_OutterRight: + name = QStringLiteral("outter_right"); + break; + case DropIndicatorOverlayInterface::DropLocation_OutterTop: + name = QStringLiteral("outter_top"); + break; + case DropIndicatorOverlayInterface::DropLocation_None: + return QString(); + } + + return name + suffix; +} + +QString Indicator::iconFileName(bool active) const +{ + const QString name = iconName(active); + return KDDockWidgets::windowManagerHasTranslucency() ? QStringLiteral(":/img/classic_indicators/%1.png").arg(name) + : QStringLiteral(":/img/classic_indicators/opaque/%1.png").arg(name); +} + +IndicatorWindow::IndicatorWindow(ClassicIndicators *classicIndicators_, QWidget *) + : QWidget(nullptr, Qt::Tool | Qt::BypassWindowManagerHint) + , classicIndicators(classicIndicators_) + , m_center(new Indicator(classicIndicators, this, DropIndicatorOverlayInterface::DropLocation_Center)) // Each indicator is not a top-level. Otherwise there's noticeable delay. + , m_left(new Indicator(classicIndicators, this, DropIndicatorOverlayInterface::DropLocation_Left)) + , m_right(new Indicator(classicIndicators, this, DropIndicatorOverlayInterface::DropLocation_Right)) + , m_bottom(new Indicator(classicIndicators, this, DropIndicatorOverlayInterface::DropLocation_Bottom)) + , m_top(new Indicator(classicIndicators, this, DropIndicatorOverlayInterface::DropLocation_Top)) + , m_outterLeft(new Indicator(classicIndicators, this, DropIndicatorOverlayInterface::DropLocation_OutterLeft)) + , m_outterRight(new Indicator(classicIndicators, this, DropIndicatorOverlayInterface::DropLocation_OutterRight)) + , m_outterBottom(new Indicator(classicIndicators, this, DropIndicatorOverlayInterface::DropLocation_OutterBottom)) + , m_outterTop(new Indicator(classicIndicators, this, DropIndicatorOverlayInterface::DropLocation_OutterTop)) +{ + setWindowFlag(Qt::FramelessWindowHint, true); + setAttribute(Qt::WA_TranslucentBackground); + updatePosition(); + + m_indicators << m_center << m_left << m_right << m_top << m_bottom + << m_outterBottom << m_outterTop << m_outterLeft << m_outterRight; + + setObjectName(QStringLiteral("_docks_IndicatorWindow_Overlay")); +} + +bool IndicatorWindow::event(QEvent *e) +{ + if (e->type() == QEvent::Show) { + updatePosition(); + } + + return QWidget::event(e); +} + +Indicator *IndicatorWindow::indicatorForLocation(DropIndicatorOverlayInterface::DropLocation loc) const +{ + switch (loc) { + case DropIndicatorOverlayInterface::DropLocation_Center: + return m_center; + case DropIndicatorOverlayInterface::DropLocation_Left: + return m_left; + case DropIndicatorOverlayInterface::DropLocation_Right: + return m_right; + case DropIndicatorOverlayInterface::DropLocation_Bottom: + return m_bottom; + case DropIndicatorOverlayInterface::DropLocation_Top: + return m_top; + case DropIndicatorOverlayInterface::DropLocation_OutterLeft: + return m_outterLeft; + case DropIndicatorOverlayInterface::DropLocation_OutterBottom: + return m_outterBottom; + case DropIndicatorOverlayInterface::DropLocation_OutterRight: + return m_outterRight; + case DropIndicatorOverlayInterface::DropLocation_OutterTop: + return m_outterTop; + case DropIndicatorOverlayInterface::DropLocation_None: + return nullptr; + } + + return nullptr; +} + +void IndicatorWindow::updateMask() +{ + QRegion region; + + if (!KDDockWidgets::windowManagerHasTranslucency()) { + for (Indicator *indicator : qAsConst(m_indicators)) { + if (indicator->isVisible()) + region = region.united(QRegion(indicator->geometry(), QRegion::Rectangle)); + } + } + + setMask(region); +} + +void IndicatorWindow::resizeEvent(QResizeEvent *ev) +{ + QWidget::resizeEvent(ev); + updatePositions(); +} + +void IndicatorWindow::updateIndicatorVisibility(bool visible) +{ + Frame *hoveredFrame = classicIndicators->m_hoveredFrame; + const bool isTheOnlyFrame = hoveredFrame && hoveredFrame->isTheOnlyFrame(); + + const bool innerShouldBeVisible = visible && hoveredFrame; + const bool outterShouldBeVisible = visible && !isTheOnlyFrame; + + for (Indicator *indicator : { m_center, m_left, m_right, m_bottom, m_top }) + indicator->setVisible(innerShouldBeVisible); + + for (Indicator *indicator : { m_outterTop, m_outterLeft, m_outterRight, m_outterBottom }) + indicator->setVisible(outterShouldBeVisible); + + updateMask(); +} + +QPoint IndicatorWindow::posForIndicator(DropIndicatorOverlayInterface::DropLocation loc) const +{ + Indicator *indicator = indicatorForLocation(loc); + return indicator->mapToGlobal(indicator->rect().center()); +} + +void IndicatorWindow::hover(QPoint globalPos) +{ + for (Indicator *indicator : qAsConst(m_indicators)) { + if (indicator->isVisible()) + indicator->setHovered(indicator->rect().contains(indicator->mapFromGlobal(globalPos))); + } +} + +void IndicatorWindow::updatePosition() +{ + QRect rect = classicIndicators->rect(); + QPoint pos = classicIndicators->mapToGlobal(QPoint(0, 0)); + rect.moveTo(pos); + setGeometry(rect); +} + +void IndicatorWindow::updatePositions() +{ + QRect r = rect(); + const int indicatorWidth = m_outterBottom->width(); + const int halfIndicatorWidth = m_outterBottom->width() / 2; + + m_outterLeft->move(r.x() + OUTTER_INDICATOR_MARGIN, r.center().y() - halfIndicatorWidth); + m_outterBottom->move(r.center().x() - halfIndicatorWidth, r.y() + height() - indicatorWidth - OUTTER_INDICATOR_MARGIN); + m_outterTop->move(r.center().x() - halfIndicatorWidth, r.y() + OUTTER_INDICATOR_MARGIN); + m_outterRight->move(r.x() + width() - indicatorWidth - OUTTER_INDICATOR_MARGIN, r.center().y() - halfIndicatorWidth); + Frame *hoveredFrame = classicIndicators->m_hoveredFrame; + if (hoveredFrame) { + QRect hoveredRect = hoveredFrame->QWidget::geometry(); + m_center->move(r.topLeft() + hoveredRect.center() - QPoint(halfIndicatorWidth, halfIndicatorWidth)); + m_top->move(m_center->pos() - QPoint(0, indicatorWidth + OUTTER_INDICATOR_MARGIN)); + m_right->move(m_center->pos() + QPoint(indicatorWidth + OUTTER_INDICATOR_MARGIN, 0)); + m_bottom->move(m_center->pos() + QPoint(0, indicatorWidth + OUTTER_INDICATOR_MARGIN)); + m_left->move(m_center->pos() - QPoint(indicatorWidth + OUTTER_INDICATOR_MARGIN, 0)); + } +} + +Indicator::Indicator(ClassicIndicators *classicIndicators, IndicatorWindow *parent, ClassicIndicators::DropLocation location) + : QWidget(parent) + , q(classicIndicators) + , m_dropLocation(location) +{ + m_image = QImage(iconFileName(/*active=*/ false)).scaled(INDICATOR_WIDTH, INDICATOR_WIDTH); + m_imageActive = QImage(iconFileName(/*active=*/ true)).scaled(INDICATOR_WIDTH, INDICATOR_WIDTH); + setFixedSize(m_image.size()); + setVisible(true); +} diff --git a/src/private/indicators/ClassicIndicatorsWindow_p.h b/src/private/indicators/ClassicIndicatorsWindow_p.h new file mode 100644 index 00000000..771360a3 --- /dev/null +++ b/src/private/indicators/ClassicIndicatorsWindow_p.h @@ -0,0 +1,80 @@ +/* + This file is part of KDDockWidgets. + + SPDX-FileCopyrightText: 2019-2020 Klarälvdalens Datakonsult AB, a KDAB Group company + Author: Sérgio Martins + + SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only + + Contact KDAB at for commercial licensing options. +*/ + +#ifndef KD_INDICATORS_CLASSICINDICATORS_WINDOW_P_H +#define KD_INDICATORS_CLASSICINDICATORS_WINDOW_P_H + +#include "DropIndicatorOverlayInterface_p.h" + +#include +#include +#include + +namespace KDDockWidgets { + +class Indicator; +class ClassicIndicators; + +class IndicatorWindow : public QWidget +{ + Q_OBJECT +public: + explicit IndicatorWindow(ClassicIndicators *classicIndicators, QWidget * = nullptr); + void hover(QPoint globalPos); + void updatePositions(); + void updateIndicatorVisibility(bool visible); + QPoint posForIndicator(DropIndicatorOverlayInterface::DropLocation) const; +private: + void updatePosition(); + void resizeEvent(QResizeEvent *ev) override; + bool event(QEvent *e) override; + + // When the compositor doesn't support translucency, we use a mask instead + // Only happens on Linux + void updateMask(); + + Indicator *indicatorForLocation(DropIndicatorOverlayInterface::DropLocation loc) const; + + ClassicIndicators *const classicIndicators; + Indicator *const m_center; + Indicator *const m_left; + Indicator *const m_right; + Indicator *const m_bottom; + Indicator *const m_top; + Indicator *const m_outterLeft; + Indicator *const m_outterRight; + Indicator *const m_outterBottom; + Indicator *const m_outterTop; + QVector m_indicators; +}; + +class Indicator : public QWidget +{ + Q_OBJECT +public: + typedef QList List; + explicit Indicator(ClassicIndicators *classicIndicators, IndicatorWindow *parent, + DropIndicatorOverlayInterface::DropLocation location); + void paintEvent(QPaintEvent *) override; + + void setHovered(bool hovered); + QString iconName(bool active) const; + QString iconFileName(bool active) const; + + QImage m_image; + QImage m_imageActive; + ClassicIndicators *const q; + bool m_hovered = false; + const DropIndicatorOverlayInterface::DropLocation m_dropLocation; +}; +} + +#endif diff --git a/src/private/indicators/ClassicIndicators_p.h b/src/private/indicators/ClassicIndicators_p.h index 9c958907..5af4793e 100644 --- a/src/private/indicators/ClassicIndicators_p.h +++ b/src/private/indicators/ClassicIndicators_p.h @@ -45,58 +45,6 @@ private: IndicatorWindow *const m_indicatorWindow; }; -class IndicatorWindow : public QWidget -{ - Q_OBJECT -public: - explicit IndicatorWindow(ClassicIndicators *classicIndicators, QWidget * = nullptr); - void hover(QPoint globalPos); - void updatePositions(); - void updateIndicatorVisibility(bool visible); - QPoint posForIndicator(DropIndicatorOverlayInterface::DropLocation) const; -private: - void updatePosition(); - void resizeEvent(QResizeEvent *ev) override; - bool event(QEvent *e) override; - - // When the compositor doesn't support translucency, we use a mask instead - // Only happens on Linux - void updateMask(); - - Indicator *indicatorForLocation(DropIndicatorOverlayInterface::DropLocation loc) const; - - ClassicIndicators *const classicIndicators; - Indicator *const m_center; - Indicator *const m_left; - Indicator *const m_right; - Indicator *const m_bottom; - Indicator *const m_top; - Indicator *const m_outterLeft; - Indicator *const m_outterRight; - Indicator *const m_outterBottom; - Indicator *const m_outterTop; - QVector m_indicators; -}; - -class Indicator : public QWidget -{ - Q_OBJECT -public: - typedef QList List; - explicit Indicator(ClassicIndicators *classicIndicators, IndicatorWindow *parent, ClassicIndicators::DropLocation location); - void paintEvent(QPaintEvent *) override; - - void setHovered(bool hovered); - QString iconName(bool active) const; - QString iconFileName(bool active) const; - - QImage m_image; - QImage m_imageActive; - ClassicIndicators *const q; - bool m_hovered = false; - const ClassicIndicators::DropLocation m_dropLocation; -}; - } #endif