Skip to content

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

C

fix style editor UI

shun-iwasawa2a343cd8e22c
diff --git a/toonz/sources/include/toonzqt/styleeditor.h b/toonz/sources/include/toonzqt/styleeditor.h
index 1f53f5891..307185adb 100644
--- a/toonz/sources/include/toonzqt/styleeditor.h
+++ b/toonz/sources/include/toonzqt/styleeditor.h
@@ -559,7 +559,6 @@ class SettingsPage final : public QScrollArea {
QGridLayout *m_paramsLayout;
QCheckBox *m_autoFillCheckBox;
- QWidget *m_autopaintToggleBox;
TColorStyleP m_editedStyle; //!< A copy of the current style being edited by
//! the Style Editor.
@@ -617,7 +616,7 @@ class DVAPI StyleEditor final : public QWidget, public SaveLoadQSettings {
*m_newColor; //!< New style viewer (lower-right panel side).
DVGui::StyleSample
*m_oldColor; //!< Old style viewer (lower-right panel side).
- QPushButton *m_toggleOrientationButton;
+ QAction *m_toggleOrientationAction;
QPushButton
*m_autoButton; //!< "Auto Apply" checkbox on the right panel side.
QPushButton *m_applyButton; //!< "Apply" button on the right panel side.
diff --git a/toonz/sources/toonzqt/Resources/orientation_h.svg b/toonz/sources/toonzqt/Resources/orientation_h.svg
new file mode 100644
index 000000000..6c7720a4b
--- /dev/null
+++ b/toonz/sources/toonzqt/Resources/orientation_h.svg
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ id="svg2"
+ x="0px"
+ y="0px"
+ viewBox="0 0 18 18"
+ xml:space="preserve"
+ width="18"
+ height="18"
+ sodipodi:docname="orientation_h.svg"
+ inkscape:version="0.92.4 (5da689c313, 2019-01-14)"><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1072"
+ inkscape:window-height="846"
+ id="namedview10"
+ showgrid="true"
+ inkscape:zoom="13.111111"
+ inkscape:cx="9"
+ inkscape:cy="5.9524044"
+ inkscape:window-x="528"
+ inkscape:window-y="55"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg2"><inkscape:grid
+ type="xygrid"
+ id="grid4520" /></sodipodi:namedview><metadata
+ id="metadata26"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
+ id="defs24" /><style
+ type="text/css"
+ id="style2">
+ .st0{fill:none;}
+ .st1{fill:url(#rect6_1_);stroke:#404040;stroke-width:2;stroke-linecap:square;stroke-miterlimit:1.5;}
+ .st2{fill:url(#rect8_1_);}
+ .st3{fill:none;stroke:#404040;stroke-width:2;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:2;}
+ .st4{fill:#A2A2A2;}
+ .st5{fill:#404040;}
+</style><path
+ style="fill:#e6e6e6;fill-opacity:1;stroke:#303030;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
+ d="M 6,13 2,9 6,5 Z"
+ id="rect853-7"
+ inkscape:connector-curvature="0" /><path
+ style="fill:#e6e6e6;fill-opacity:1;stroke:#303030;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
+ d="M 12,13 16,9 12,5 Z"
+ id="rect853-2-6"
+ inkscape:connector-curvature="0" /><rect
+ style="opacity:1;vector-effect:none;fill:#e6e6e6;fill-opacity:1;stroke:#303030;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers"
+ id="rect4537-0"
+ width="2"
+ height="6"
+ x="8"
+ y="-12"
+ transform="rotate(90)" /><path
+ style="fill:#e6e6e6;fill-opacity:1;stroke:none;stroke-width:2.52982187;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
+ d="M 6,13 2,9 6,5 Z"
+ id="rect853"
+ inkscape:connector-curvature="0" /><path
+ style="fill:#e6e6e6;fill-opacity:1;stroke:none;stroke-width:2.52982187;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
+ d="M 12,13 16,9 12,5 Z"
+ id="rect853-2"
+ inkscape:connector-curvature="0" /><rect
+ style="opacity:1;vector-effect:none;fill:#e6e6e6;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers"
+ id="rect4537-0-7"
+ width="2"
+ height="6"
+ x="8"
+ y="-12"
+ transform="rotate(90)" /></svg>
\ No newline at end of file
diff --git a/toonz/sources/toonzqt/Resources/orientation_v.svg b/toonz/sources/toonzqt/Resources/orientation_v.svg
new file mode 100644
index 000000000..00ac8766e
--- /dev/null
+++ b/toonz/sources/toonzqt/Resources/orientation_v.svg
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ version="1.1"
+ id="svg2"
+ x="0px"
+ y="0px"
+ viewBox="0 0 18 18"
+ xml:space="preserve"
+ width="18"
+ height="18"
+ sodipodi:docname="orientation_v.svg"
+ inkscape:version="0.92.4 (5da689c313, 2019-01-14)"><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1072"
+ inkscape:window-height="846"
+ id="namedview10"
+ showgrid="true"
+ inkscape:zoom="13.111111"
+ inkscape:cx="-3.7372882"
+ inkscape:cy="5.9491524"
+ inkscape:window-x="528"
+ inkscape:window-y="55"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg2"><inkscape:grid
+ type="xygrid"
+ id="grid4520" /></sodipodi:namedview><metadata
+ id="metadata26"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs
+ id="defs24" /><style
+ type="text/css"
+ id="style2">
+ .st0{fill:none;}
+ .st1{fill:url(#rect6_1_);stroke:#404040;stroke-width:2;stroke-linecap:square;stroke-miterlimit:1.5;}
+ .st2{fill:url(#rect8_1_);}
+ .st3{fill:none;stroke:#404040;stroke-width:2;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:2;}
+ .st4{fill:#A2A2A2;}
+ .st5{fill:#404040;}
+</style><path
+ style="fill:#e6e6e6;fill-opacity:1;stroke:#303030;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
+ d="M 13,12 9,16 5,12 Z"
+ id="rect853-7"
+ inkscape:connector-curvature="0" /><path
+ style="fill:#e6e6e6;fill-opacity:1;stroke:#303030;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
+ d="M 13,6 9,2 5,6 Z"
+ id="rect853-2-6"
+ inkscape:connector-curvature="0" /><rect
+ style="opacity:1;vector-effect:none;fill:#e6e6e6;fill-opacity:1;stroke:#303030;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers"
+ id="rect4537-0"
+ width="2"
+ height="6"
+ x="8"
+ y="6" /><path
+ style="fill:#e6e6e6;fill-opacity:1;stroke:none;stroke-width:2.52982187;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
+ d="M 13,12 9,16 5,12 Z"
+ id="rect853"
+ inkscape:connector-curvature="0" /><path
+ style="fill:#e6e6e6;fill-opacity:1;stroke:none;stroke-width:2.52982187;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
+ d="M 13,6 9,2 5,6 Z"
+ id="rect853-2"
+ inkscape:connector-curvature="0" /><rect
+ style="opacity:1;vector-effect:none;fill:#e6e6e6;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers"
+ id="rect4537-0-4"
+ width="2"
+ height="6"
+ x="8"
+ y="6" /></svg>
\ No newline at end of file
diff --git a/toonz/sources/toonzqt/styleeditor.cpp b/toonz/sources/toonzqt/styleeditor.cpp
index c1cd865bc..8556bf0ef 100644
--- a/toonz/sources/toonzqt/styleeditor.cpp
+++ b/toonz/sources/toonzqt/styleeditor.cpp
@@ -2528,46 +2528,33 @@ SettingsPage::SettingsPage(QWidget *parent)
setWidget(paramsContainer);
QVBoxLayout *paramsContainerLayout = new QVBoxLayout(this);
+ paramsContainerLayout->setMargin(10);
+ paramsContainerLayout->setSpacing(10);
paramsContainer->setLayout(paramsContainerLayout);
// Add a vertical layout to store the "autofill" checkbox widgets
- {
- m_autopaintToggleBox = new QWidget(this);
- // box->setFixedHeight(22);
- paramsContainerLayout->addWidget(m_autopaintToggleBox);
-
- QHBoxLayout *hLayout = new QHBoxLayout;
- m_autopaintToggleBox->setLayout(hLayout);
-
- hLayout->setSpacing(5);
- hLayout->setMargin(0);
- hLayout->addSpacing(98);
-
- m_autoFillCheckBox = new QCheckBox;
- hLayout->addWidget(m_autoFillCheckBox);
+ m_autoFillCheckBox = new QCheckBox(tr("Autopaint for Lines"), this);
+ paramsContainerLayout->addWidget(m_autoFillCheckBox, 0,
+ Qt::AlignLeft | Qt::AlignVCenter);
- QLabel *label =
- new QLabel(StyleEditorGUI::SettingsPage::tr("Autopaint for Lines"));
- hLayout->addWidget(label);
-
- hLayout->addStretch();
-
- ret = connect(m_autoFillCheckBox, SIGNAL(stateChanged(int)), this,
- SLOT(onAutofillChanged()));
- assert(ret);
- }
+ ret = connect(m_autoFillCheckBox, SIGNAL(stateChanged(int)), this,
+ SLOT(onAutofillChanged()));
+ assert(ret);
// Prepare the style parameters layout
m_paramsLayout = new QGridLayout;
+ m_paramsLayout->setMargin(0);
+ m_paramsLayout->setVerticalSpacing(8);
+ m_paramsLayout->setHorizontalSpacing(5);
paramsContainerLayout->addLayout(m_paramsLayout);
- paramsContainerLayout->addStretch();
+ paramsContainerLayout->addStretch(1);
}
//-----------------------------------------------------------------------------
void SettingsPage::enableAutopaintToggle(bool enabled) {
- m_autopaintToggleBox->setVisible(enabled);
+ m_autoFillCheckBox->setVisible(enabled);
}
//-----------------------------------------------------------------------------
@@ -2989,21 +2976,24 @@ StyleEditor::StyleEditor(PaletteController *paletteController, QWidget *parent)
menu->addAction(m_rgbAction);
QToolButton *toolButton = new QToolButton(this);
- toolButton->setIcon(QIcon(":Resources/menu.svg"));
- toolButton->setMaximumWidth(18);
- toolButton->setMaximumHeight(18);
+ toolButton->setIcon(createQIcon("options"));
+ toolButton->setFixedSize(22, 22);
toolButton->setMenu(menu);
toolButton->setPopupMode(QToolButton::InstantPopup);
toolButton->setToolTip(tr("Show or hide parts of the Color Page."));
- QToolBar *displayToolbar = new QToolBar(this);
- m_toggleOrientationButton = new QPushButton(QChar(0x2194), this);
- m_toggleOrientationButton->setFixedWidth(20);
- m_toggleOrientationButton->setToolTip(
+ QToolBar *displayToolbar = new QToolBar(this);
+ m_toggleOrientationAction =
+ displayToolbar->addAction(QIcon(":Resources/orientation_h.svg"), "");
+ m_toggleOrientationAction->setToolTip(
tr("Toggle orientation of the Color Page."));
- m_toggleOrientationButton->setFocusPolicy(Qt::NoFocus);
- displayToolbar->addWidget(m_toggleOrientationButton);
+ QWidget *toggleOrientationButton =
+ displayToolbar->widgetForAction(m_toggleOrientationAction);
+ toggleOrientationButton->setFixedSize(22, 22);
+ toggleOrientationButton->setFocusPolicy(Qt::NoFocus);
displayToolbar->addWidget(toolButton);
- displayToolbar->setFixedWidth(45);
+ displayToolbar->setMaximumHeight(22);
+ displayToolbar->setIconSize(QSize(18, 18));
+
/* ------- layout ------- */
QGridLayout *mainLayout = new QGridLayout;
mainLayout->setMargin(0);
@@ -3018,12 +3008,14 @@ StyleEditor::StyleEditor(PaletteController *paletteController, QWidget *parent)
}
m_tabBarContainer->setLayout(hLayout);
- mainLayout->addWidget(m_tabBarContainer, 0, 0, 1, 2, 0);
+ mainLayout->addWidget(m_tabBarContainer, 0, 0, 1, 2);
mainLayout->addWidget(m_styleChooser, 1, 0, 1, 2);
- mainLayout->addWidget(bottomWidget, 2, 0, 1, 2, 0);
- mainLayout->addWidget(m_toolBar, 3, 0, 1, 1, 0);
- mainLayout->addWidget(displayToolbar, 3, 1, 1, 1, 0);
+ mainLayout->addWidget(bottomWidget, 2, 0, 1, 2);
+ mainLayout->addWidget(m_toolBar, 3, 0);
+ mainLayout->addWidget(displayToolbar, 3, 1);
}
+ mainLayout->setColumnStretch(0, 1);
+ mainLayout->setRowStretch(1, 1);
setLayout(mainLayout);
/* ------- signal-slot connections ------- */
@@ -3062,9 +3054,9 @@ StyleEditor::StyleEditor(PaletteController *paletteController, QWidget *parent)
m_plainColorPage->m_alphaFrame, SLOT(setVisible(bool)));
ret = ret && connect(m_rgbAction, SIGNAL(toggled(bool)),
m_plainColorPage->m_rgbFrame, SLOT(setVisible(bool)));
- ret = ret && connect(m_toggleOrientationButton, SIGNAL(clicked()),
+ ret = ret && connect(m_toggleOrientationAction, SIGNAL(triggered()),
m_plainColorPage, SLOT(toggleOrientation()));
- ret = ret && connect(m_toggleOrientationButton, SIGNAL(clicked()), this,
+ ret = ret && connect(m_toggleOrientationAction, SIGNAL(triggered()), this,
SLOT(updateOrientationButton()));
assert(ret);
/* ------- initial conditions ------- */
@@ -3278,9 +3270,9 @@ void StyleEditor::hideEvent(QHideEvent *) {
void StyleEditor::updateOrientationButton() {
if (m_plainColorPage->getIsVertical()) {
- m_toggleOrientationButton->setText(QChar(0x2194));
+ m_toggleOrientationAction->setIcon(QIcon(":Resources/orientation_h.svg"));
} else {
- m_toggleOrientationButton->setText(QChar(0x2195));
+ m_toggleOrientationAction->setIcon(QIcon(":Resources/orientation_v.svg"));
}
}
diff --git a/toonz/sources/toonzqt/toonzqt.qrc b/toonz/sources/toonzqt/toonzqt.qrc
index d2256d3c8..5f5b59e99 100644
--- a/toonz/sources/toonzqt/toonzqt.qrc
+++ b/toonz/sources/toonzqt/toonzqt.qrc
@@ -323,5 +323,7 @@
<file>Resources/schematic_zoom_mode_off.svg</file>
<file>Resources/schematic_hand_mode_on.svg</file>
<file>Resources/schematic_hand_mode_off.svg</file>
+ <file>Resources/orientation_h.svg</file>
+ <file>Resources/orientation_v.svg</file>
</qresource>
</RCC>