bring panel title bar to the style sheet
|
@ -363,6 +363,15 @@ TPanel {
|
|||
background-color: @m_dialog_border_color;
|
||||
}
|
||||
|
||||
TPanelTitleBar{
|
||||
qproperty-BorderPixmap: url("@{image_url}/tpaneltitlebar_border.png");
|
||||
qproperty-ActiveBorderPixmap: url("@{image_url}/tpaneltitlebar_border_active.png");
|
||||
qproperty-FloatBorderPixmap: url("@{image_url}/tpaneltitlebar_border_float.png");
|
||||
qproperty-FloatActiveBorderPixmap: url("@{image_url}/tpaneltitlebar_border_float_active.png");
|
||||
qproperty-TitleColor: rgb(192,192,192);
|
||||
qproperty-ActiveTitleColor: rgb(255,255,255);
|
||||
}
|
||||
|
||||
/* ------ Palette ------ */
|
||||
PaletteViewer #ToolBarContainer
|
||||
{
|
||||
|
|
|
@ -374,6 +374,14 @@ TPanel {
|
|||
/*Used for dialog border*/
|
||||
background-color: #000000;
|
||||
}
|
||||
TPanelTitleBar {
|
||||
qproperty-BorderPixmap: url("../gray_072/imgs/tpaneltitlebar_border.png");
|
||||
qproperty-ActiveBorderPixmap: url("../gray_072/imgs/tpaneltitlebar_border_active.png");
|
||||
qproperty-FloatBorderPixmap: url("../gray_072/imgs/tpaneltitlebar_border_float.png");
|
||||
qproperty-FloatActiveBorderPixmap: url("../gray_072/imgs/tpaneltitlebar_border_float_active.png");
|
||||
qproperty-TitleColor: #c0c0c0;
|
||||
qproperty-ActiveTitleColor: #ffffff;
|
||||
}
|
||||
/* ------ Palette ------ */
|
||||
PaletteViewer #ToolBarContainer {
|
||||
margin: 0px;
|
||||
|
|
|
@ -374,6 +374,14 @@ TPanel {
|
|||
/*Used for dialog border*/
|
||||
background-color: #000000;
|
||||
}
|
||||
TPanelTitleBar {
|
||||
qproperty-BorderPixmap: url("../gray_072/imgs/tpaneltitlebar_border.png");
|
||||
qproperty-ActiveBorderPixmap: url("../gray_072/imgs/tpaneltitlebar_border_active.png");
|
||||
qproperty-FloatBorderPixmap: url("../gray_072/imgs/tpaneltitlebar_border_float.png");
|
||||
qproperty-FloatActiveBorderPixmap: url("../gray_072/imgs/tpaneltitlebar_border_float_active.png");
|
||||
qproperty-TitleColor: #c0c0c0;
|
||||
qproperty-ActiveTitleColor: #ffffff;
|
||||
}
|
||||
/* ------ Palette ------ */
|
||||
PaletteViewer #ToolBarContainer {
|
||||
margin: 0px;
|
||||
|
|
|
@ -361,6 +361,15 @@ TPanel {
|
|||
background-color: @m_dialog_border_color;
|
||||
}
|
||||
|
||||
TPanelTitleBar{
|
||||
qproperty-BorderPixmap: url("@{image_url}/tpaneltitlebar_border.png");
|
||||
qproperty-ActiveBorderPixmap: url("@{image_url}/tpaneltitlebar_border_active.png");
|
||||
qproperty-FloatBorderPixmap: url("@{image_url}/tpaneltitlebar_border_float.png");
|
||||
qproperty-FloatActiveBorderPixmap: url("@{image_url}/tpaneltitlebar_border_float_active.png");
|
||||
qproperty-TitleColor: rgb(192,192,192);
|
||||
qproperty-ActiveTitleColor: rgb(255,255,255);
|
||||
}
|
||||
|
||||
/* ------ Palette ------ */
|
||||
PaletteViewer #ToolBarContainer
|
||||
{
|
||||
|
|
|
@ -374,6 +374,14 @@ TPanel {
|
|||
/*Used for dialog border*/
|
||||
background-color: #202020;
|
||||
}
|
||||
TPanelTitleBar {
|
||||
qproperty-BorderPixmap: url("imgs/tpaneltitlebar_border.png");
|
||||
qproperty-ActiveBorderPixmap: url("imgs/tpaneltitlebar_border_active.png");
|
||||
qproperty-FloatBorderPixmap: url("imgs/tpaneltitlebar_border_float.png");
|
||||
qproperty-FloatActiveBorderPixmap: url("imgs/tpaneltitlebar_border_float_active.png");
|
||||
qproperty-TitleColor: #c0c0c0;
|
||||
qproperty-ActiveTitleColor: #ffffff;
|
||||
}
|
||||
/* ------ Palette ------ */
|
||||
PaletteViewer #ToolBarContainer {
|
||||
margin: 0px;
|
||||
|
|
|
@ -374,6 +374,14 @@ TPanel {
|
|||
/*Used for dialog border*/
|
||||
background-color: #202020;
|
||||
}
|
||||
TPanelTitleBar {
|
||||
qproperty-BorderPixmap: url("imgs/tpaneltitlebar_border.png");
|
||||
qproperty-ActiveBorderPixmap: url("imgs/tpaneltitlebar_border_active.png");
|
||||
qproperty-FloatBorderPixmap: url("imgs/tpaneltitlebar_border_float.png");
|
||||
qproperty-FloatActiveBorderPixmap: url("imgs/tpaneltitlebar_border_float_active.png");
|
||||
qproperty-TitleColor: #c0c0c0;
|
||||
qproperty-ActiveTitleColor: #ffffff;
|
||||
}
|
||||
/* ------ Palette ------ */
|
||||
PaletteViewer #ToolBarContainer {
|
||||
margin: 0px;
|
||||
|
|
BIN
stuff/config/qss/gray_072/imgs/tpaneltitlebar_border.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
stuff/config/qss/gray_072/imgs/tpaneltitlebar_border_active.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
stuff/config/qss/gray_072/imgs/tpaneltitlebar_border_float.png
Normal file
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 17 KiB |
|
@ -210,6 +210,16 @@ QGroupBox {
|
|||
|
||||
/* ------ Toonz Classes Difinitions ------ */
|
||||
|
||||
/* ------ TPanel ------ */
|
||||
TPanelTitleBar{
|
||||
qproperty-BorderPixmap: url("@{image_url}/tpaneltitlebar_border.png");
|
||||
qproperty-ActiveBorderPixmap: url("@{image_url}/tpaneltitlebar_border_active.png");
|
||||
qproperty-FloatBorderPixmap: url("@{image_url}/tpaneltitlebar_border_float.png");
|
||||
qproperty-FloatActiveBorderPixmap: url("@{image_url}/tpaneltitlebar_border_float_active.png");
|
||||
qproperty-TitleColor: rgb(192,192,192);
|
||||
qproperty-ActiveTitleColor: rgb(255,255,255);
|
||||
}
|
||||
|
||||
/* ------ Palette ------ */
|
||||
PaletteViewer #ToolBarContainer
|
||||
{
|
||||
|
|
|
@ -142,6 +142,15 @@ QGroupBox::title {
|
|||
left: 15px;
|
||||
}
|
||||
/* ------ Toonz Classes Difinitions ------ */
|
||||
/* ------ TPanel ------ */
|
||||
TPanelTitleBar {
|
||||
qproperty-BorderPixmap: url("imgs/tpaneltitlebar_border.png");
|
||||
qproperty-ActiveBorderPixmap: url("imgs/tpaneltitlebar_border_active.png");
|
||||
qproperty-FloatBorderPixmap: url("imgs/tpaneltitlebar_border_float.png");
|
||||
qproperty-FloatActiveBorderPixmap: url("imgs/tpaneltitlebar_border_float_active.png");
|
||||
qproperty-TitleColor: #c0c0c0;
|
||||
qproperty-ActiveTitleColor: #ffffff;
|
||||
}
|
||||
/* ------ Palette ------ */
|
||||
PaletteViewer #ToolBarContainer {
|
||||
margin: 0px;
|
||||
|
|
|
@ -142,6 +142,15 @@ QGroupBox::title {
|
|||
left: 15px;
|
||||
}
|
||||
/* ------ Toonz Classes Difinitions ------ */
|
||||
/* ------ TPanel ------ */
|
||||
TPanelTitleBar {
|
||||
qproperty-BorderPixmap: url("imgs/tpaneltitlebar_border.png");
|
||||
qproperty-ActiveBorderPixmap: url("imgs/tpaneltitlebar_border_active.png");
|
||||
qproperty-FloatBorderPixmap: url("imgs/tpaneltitlebar_border_float.png");
|
||||
qproperty-FloatActiveBorderPixmap: url("imgs/tpaneltitlebar_border_float_active.png");
|
||||
qproperty-TitleColor: #c0c0c0;
|
||||
qproperty-ActiveTitleColor: #ffffff;
|
||||
}
|
||||
/* ------ Palette ------ */
|
||||
PaletteViewer #ToolBarContainer {
|
||||
margin: 0px;
|
||||
|
|
BIN
stuff/config/qss/gray_128/imgs/tpaneltitlebar_border.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
stuff/config/qss/gray_128/imgs/tpaneltitlebar_border_active.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
stuff/config/qss/gray_128/imgs/tpaneltitlebar_border_float.png
Normal file
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 17 KiB |
|
@ -27,6 +27,7 @@
|
|||
#include <QMap>
|
||||
#include <QApplication>
|
||||
#include <QFile>
|
||||
#include <qdrawutil.h>
|
||||
#include <assert.h>
|
||||
|
||||
extern TEnv::StringVar EnvSafeAreaName;
|
||||
|
@ -341,40 +342,30 @@ void TPanelTitleBar::paintEvent(QPaintEvent *) {
|
|||
QPainter painter(this);
|
||||
QRect rect = this->rect();
|
||||
|
||||
QColor titleColor;
|
||||
QColor brushColor;
|
||||
bool isPanelActive;
|
||||
|
||||
TPanel *dw = qobject_cast<TPanel *>(parentWidget());
|
||||
Q_ASSERT(dw != 0);
|
||||
// docked panel
|
||||
if (!dw->isFloating()) {
|
||||
if (dw->widgetInThisPanelIsFocused()) {
|
||||
brushColor = QColor(64, 64, 64);
|
||||
titleColor = QColor(Qt::white);
|
||||
} else {
|
||||
brushColor = QColor(100, 100, 100);
|
||||
titleColor = QColor(192, 192, 192);
|
||||
}
|
||||
} else if (isActiveWindow()) {
|
||||
brushColor = QColor(96, 96, 96);
|
||||
titleColor = QColor(Qt::white);
|
||||
} else {
|
||||
brushColor = QColor(128, 128, 128);
|
||||
titleColor = QColor(192, 192, 192);
|
||||
isPanelActive = dw->widgetInThisPanelIsFocused();
|
||||
qDrawBorderPixmap(&painter, rect, QMargins(3, 3, 3, 3),
|
||||
(isPanelActive) ? m_activeBorderPm : m_borderPm);
|
||||
}
|
||||
// floating panel
|
||||
else {
|
||||
isPanelActive = isActiveWindow();
|
||||
qDrawBorderPixmap(
|
||||
&painter, rect, QMargins(3, 3, 3, 3),
|
||||
(isPanelActive) ? m_floatActiveBorderPm : m_floatBorderPm);
|
||||
}
|
||||
painter.setBrush(brushColor);
|
||||
painter.setPen(Qt::black);
|
||||
painter.drawRect(rect.adjusted(0, 0, -1, -1));
|
||||
|
||||
painter.setPen(titleColor);
|
||||
painter.drawLine(rect.topLeft(), rect.bottomLeft());
|
||||
painter.drawLine(rect.topLeft(), rect.topRight());
|
||||
|
||||
if (dw->getOrientation() == TDockWidget::vertical) {
|
||||
QString titleText = painter.fontMetrics().elidedText(
|
||||
dw->windowTitle(), Qt::ElideRight, rect.width() - 50);
|
||||
|
||||
painter.setBrush(Qt::NoBrush);
|
||||
painter.setPen(titleColor);
|
||||
painter.setPen(isPanelActive ? m_activeTitleColor : m_titleColor);
|
||||
painter.drawText(QPointF(10, 15), titleText);
|
||||
}
|
||||
|
||||
|
|
|
@ -99,6 +99,9 @@ class TPanelTitleBar final : public QFrame {
|
|||
bool m_closeButtonHighlighted;
|
||||
std::vector<std::pair<QPoint, QWidget *>> m_buttons;
|
||||
|
||||
QPixmap m_borderPm, m_activeBorderPm, m_floatBorderPm, m_floatActiveBorderPm;
|
||||
QColor m_titleColor, m_activeTitleColor;
|
||||
|
||||
public:
|
||||
TPanelTitleBar(QWidget *parent = 0,
|
||||
TDockWidget::Orientation orientation = TDockWidget::vertical);
|
||||
|
@ -112,6 +115,23 @@ public:
|
|||
// pos = widget position. n.b. if pos.x()<0 then origin is topright corner
|
||||
void add(const QPoint &pos, QWidget *widget);
|
||||
|
||||
QPixmap getBorderPixmap() const { return m_borderPm; }
|
||||
void setBorderPixmap(const QPixmap &pixmap) { m_borderPm = pixmap; }
|
||||
QPixmap getActiveBorderPixmap() const { return m_activeBorderPm; }
|
||||
void setActiveBorderPixmap(const QPixmap &pixmap) {
|
||||
m_activeBorderPm = pixmap;
|
||||
}
|
||||
QPixmap getFloatBorderPixmap() const { return m_floatBorderPm; }
|
||||
void setFloatBorderPixmap(const QPixmap &pixmap) { m_floatBorderPm = pixmap; }
|
||||
QPixmap getFloatActiveBorderPixmap() const { return m_floatActiveBorderPm; }
|
||||
void setFloatActiveBorderPixmap(const QPixmap &pixmap) {
|
||||
m_floatActiveBorderPm = pixmap;
|
||||
}
|
||||
QColor getTitleColor() const { return m_titleColor; }
|
||||
void setTitleColor(const QColor &color) { m_titleColor = color; }
|
||||
QColor getActiveTitleColor() const { return m_activeTitleColor; }
|
||||
void setActiveTitleColor(const QColor &color) { m_activeTitleColor = color; }
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
|
||||
|
@ -123,6 +143,17 @@ protected:
|
|||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseDoubleClickEvent(QMouseEvent *) override;
|
||||
|
||||
Q_PROPERTY(QPixmap BorderPixmap READ getBorderPixmap WRITE setBorderPixmap);
|
||||
Q_PROPERTY(QPixmap ActiveBorderPixmap READ getActiveBorderPixmap WRITE
|
||||
setActiveBorderPixmap);
|
||||
Q_PROPERTY(QPixmap FloatBorderPixmap READ getFloatBorderPixmap WRITE
|
||||
setFloatBorderPixmap);
|
||||
Q_PROPERTY(QPixmap FloatActiveBorderPixmap READ getFloatActiveBorderPixmap
|
||||
WRITE setFloatActiveBorderPixmap);
|
||||
Q_PROPERTY(QColor TitleColor READ getTitleColor WRITE setTitleColor);
|
||||
Q_PROPERTY(QColor ActiveTitleColor READ getActiveTitleColor WRITE
|
||||
setActiveTitleColor);
|
||||
|
||||
signals:
|
||||
|
||||
void closeButtonPressed();
|
||||
|
|