Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

bring panel title bar to the style sheet

shun_iwasawa064d70388eb0
diff --git a/stuff/config/qss/gray_048/gray_048.less b/stuff/config/qss/gray_048/gray_048.less
index c9643879e..758be3ecf 100644
--- a/stuff/config/qss/gray_048/gray_048.less
+++ b/stuff/config/qss/gray_048/gray_048.less
@@ -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
{
diff --git a/stuff/config/qss/gray_048/gray_048.qss b/stuff/config/qss/gray_048/gray_048.qss
index a9a35c689..41c2f4181 100644
--- a/stuff/config/qss/gray_048/gray_048.qss
+++ b/stuff/config/qss/gray_048/gray_048.qss
@@ -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;
diff --git a/stuff/config/qss/gray_048/gray_048_mac.qss b/stuff/config/qss/gray_048/gray_048_mac.qss
index f6005d456..2e0686e81 100644
--- a/stuff/config/qss/gray_048/gray_048_mac.qss
+++ b/stuff/config/qss/gray_048/gray_048_mac.qss
@@ -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;
diff --git a/stuff/config/qss/gray_072/gray_072.less b/stuff/config/qss/gray_072/gray_072.less
index d8a63f4d3..8ec2515be 100644
--- a/stuff/config/qss/gray_072/gray_072.less
+++ b/stuff/config/qss/gray_072/gray_072.less
@@ -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
{
diff --git a/stuff/config/qss/gray_072/gray_072.qss b/stuff/config/qss/gray_072/gray_072.qss
index f18b35d9c..b1feeabe8 100644
--- a/stuff/config/qss/gray_072/gray_072.qss
+++ b/stuff/config/qss/gray_072/gray_072.qss
@@ -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;
diff --git a/stuff/config/qss/gray_072/gray_072_mac.qss b/stuff/config/qss/gray_072/gray_072_mac.qss
index d3cc3d9a4..054ab70e4 100644
--- a/stuff/config/qss/gray_072/gray_072_mac.qss
+++ b/stuff/config/qss/gray_072/gray_072_mac.qss
@@ -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;
diff --git a/stuff/config/qss/gray_072/imgs/tpaneltitlebar_border.png b/stuff/config/qss/gray_072/imgs/tpaneltitlebar_border.png
new file mode 100644
index 000000000..05178cf52
Binary files /dev/null and b/stuff/config/qss/gray_072/imgs/tpaneltitlebar_border.png differ
diff --git a/stuff/config/qss/gray_072/imgs/tpaneltitlebar_border_active.png b/stuff/config/qss/gray_072/imgs/tpaneltitlebar_border_active.png
new file mode 100644
index 000000000..1c5edcb69
Binary files /dev/null and b/stuff/config/qss/gray_072/imgs/tpaneltitlebar_border_active.png differ
diff --git a/stuff/config/qss/gray_072/imgs/tpaneltitlebar_border_float.png b/stuff/config/qss/gray_072/imgs/tpaneltitlebar_border_float.png
new file mode 100644
index 000000000..476e84528
Binary files /dev/null and b/stuff/config/qss/gray_072/imgs/tpaneltitlebar_border_float.png differ
diff --git a/stuff/config/qss/gray_072/imgs/tpaneltitlebar_border_float_active.png b/stuff/config/qss/gray_072/imgs/tpaneltitlebar_border_float_active.png
new file mode 100644
index 000000000..39129c093
Binary files /dev/null and b/stuff/config/qss/gray_072/imgs/tpaneltitlebar_border_float_active.png differ
diff --git a/stuff/config/qss/gray_128/gray_128.less b/stuff/config/qss/gray_128/gray_128.less
index 5bbb76bd4..b76efafe5 100644
--- a/stuff/config/qss/gray_128/gray_128.less
+++ b/stuff/config/qss/gray_128/gray_128.less
@@ -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
{
diff --git a/stuff/config/qss/gray_128/gray_128.qss b/stuff/config/qss/gray_128/gray_128.qss
index 494ca0074..d00832615 100644
--- a/stuff/config/qss/gray_128/gray_128.qss
+++ b/stuff/config/qss/gray_128/gray_128.qss
@@ -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;
diff --git a/stuff/config/qss/gray_128/gray_128_mac.qss b/stuff/config/qss/gray_128/gray_128_mac.qss
index fcac0dee3..e287b1728 100644
--- a/stuff/config/qss/gray_128/gray_128_mac.qss
+++ b/stuff/config/qss/gray_128/gray_128_mac.qss
@@ -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;
diff --git a/stuff/config/qss/gray_128/imgs/tpaneltitlebar_border.png b/stuff/config/qss/gray_128/imgs/tpaneltitlebar_border.png
new file mode 100644
index 000000000..05178cf52
Binary files /dev/null and b/stuff/config/qss/gray_128/imgs/tpaneltitlebar_border.png differ
diff --git a/stuff/config/qss/gray_128/imgs/tpaneltitlebar_border_active.png b/stuff/config/qss/gray_128/imgs/tpaneltitlebar_border_active.png
new file mode 100644
index 000000000..1c5edcb69
Binary files /dev/null and b/stuff/config/qss/gray_128/imgs/tpaneltitlebar_border_active.png differ
diff --git a/stuff/config/qss/gray_128/imgs/tpaneltitlebar_border_float.png b/stuff/config/qss/gray_128/imgs/tpaneltitlebar_border_float.png
new file mode 100644
index 000000000..476e84528
Binary files /dev/null and b/stuff/config/qss/gray_128/imgs/tpaneltitlebar_border_float.png differ
diff --git a/stuff/config/qss/gray_128/imgs/tpaneltitlebar_border_float_active.png b/stuff/config/qss/gray_128/imgs/tpaneltitlebar_border_float_active.png
new file mode 100644
index 000000000..39129c093
Binary files /dev/null and b/stuff/config/qss/gray_128/imgs/tpaneltitlebar_border_float_active.png differ
diff --git a/toonz/sources/toonz/pane.cpp b/toonz/sources/toonz/pane.cpp
index 15989f2e2..e94ee83d0 100644
--- a/toonz/sources/toonz/pane.cpp
+++ b/toonz/sources/toonz/pane.cpp
@@ -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);
}
diff --git a/toonz/sources/toonz/pane.h b/toonz/sources/toonz/pane.h
index 253f4c699..3af30c397 100644
--- a/toonz/sources/toonz/pane.h
+++ b/toonz/sources/toonz/pane.h
@@ -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();