made PanelWidget class more portable and modular

This commit is contained in:
itsmattkc
2019-06-24 18:34:01 -07:00
parent 8e5c6091c9
commit 99de635b91
2 changed files with 21 additions and 4 deletions
+9 -4
View File
@@ -22,14 +22,19 @@
#include <QPainter>
#include "panel/panelfocusmanager.h"
PanelWidget::PanelWidget(QWidget *parent) :
QDockWidget(parent)
QDockWidget(parent),
border_visible_(false)
{
setFocusPolicy(Qt::ClickFocus);
}
void PanelWidget::SetBorderVisible(bool enabled)
{
border_visible_ = enabled;
update();
}
void PanelWidget::SetTitle(const QString &t)
{
title_ = t;
@@ -48,7 +53,7 @@ void PanelWidget::paintEvent(QPaintEvent *event)
QDockWidget::paintEvent(event);
// Check if this panel (or a child of it) has focus using PanelFocusManager
if (olive::panel_focus_manager->CurrentlyFocused() == this) {
if (border_visible_) {
// Draw a highlight border if so
QPainter p(this);
+12
View File
@@ -41,6 +41,13 @@ public:
* MainWindow.
*/
PanelWidget(QWidget* parent);
/**
* @brief Set visibility of panel's highlighted border, mostly used for showing panel focus
*
* @param enabled
*/
void SetBorderVisible(bool enabled);
protected:
/**
* @brief Set panel's title
@@ -92,6 +99,11 @@ private:
* @brief Internal subtitle string
*/
QString subtitle_;
/**
* @brief Internal border visibility value
*/
bool border_visible_;
};
#endif // PANEL_WIDGET_H