made PanelWidget class more portable and modular
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user