From dc1796301dc86a759688f1fe3a615bc7c84295ff Mon Sep 17 00:00:00 2001 From: scribblemaniac Date: Fri, 26 Mar 2021 22:18:02 -0600 Subject: [PATCH 1/3] Group sections of onion skin widget with QGroupBox Also removed some unnecessary elements that were there for layout purposes, but the same effect could be achieved without them. The opacity is split up into to QHBoxLayouts in prepartion for adding a FlowLayout in the next commit. --- app/ui/onionskin.ui | 753 +++++++++++++++++++++----------------------- 1 file changed, 355 insertions(+), 398 deletions(-) diff --git a/app/ui/onionskin.ui b/app/ui/onionskin.ui index 0b90b5210e..be8d80ced2 100644 --- a/app/ui/onionskin.ui +++ b/app/ui/onionskin.ui @@ -7,12 +7,12 @@ 0 0 436 - 275 + 378 - 222 + 239 150 @@ -59,13 +59,16 @@ true + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + 0 0 436 - 256 + 357 @@ -88,402 +91,356 @@ 6 - - - 2 + + + Previous Frames + + + + QLayout::SetDefaultConstraint + + + 6 + + + 6 + + + + + Onion skin previous frame + + + Onion skin previous frame + + + false + + + ... + + + + :/app/icons/onionPrev.png:/app/icons/onionPrev.png + + + + 24 + 24 + + + + true + + + true + + + + + + + + 0 + 0 + + + + + 50 + 0 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 1 + + + 60 + + + + + + + Onion skin color: red + + + Onion skin color: red + + + ... + + + + :/app/icons/onion-red.png:/app/icons/onion-red.png + + + + 24 + 24 + + + + true + + + true + + + + + + + + + + Next Frames + + + + QLayout::SetDefaultConstraint + + + 6 + + + 6 + + + + + Onion skin next frame + + + Onion skin next frame + + + ... + + + + :/app/icons/onionNext.png:/app/icons/onionNext.png + + + + 24 + 24 + + + + true + + + true + + + + + + + + 0 + 0 + + + + + 50 + 0 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + QAbstractSpinBox::UpDownArrows + + + 1 + + + 60 + + + + + + + + 16777215 + 16777215 + + + + Onion skin color: blue + + + Onion skin color: blue + + + false + + + ... + + + + :/app/icons/onion-blue.png:/app/icons/onion-blue.png + + + + 24 + 24 + + + + true + + + true + + + + + + + + + + Distributed Opacity + + + + 10 + + + 6 + + + 6 + + + + + + + + 0 + 0 + + + + Max + + + + + + + + 0 + 0 + + + + + 60 + 0 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + % + + + + + + 100 + + + + + + + + + + + + 0 + 0 + + + + Min + + + + + + + + 0 + 0 + + + + + 60 + 0 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + % + + + + + + 100 + + + + + + + + + + + + Show Keyframes Only + + + + + + + Show During Playback + + + + + + + Qt::Vertical + + + + 20 + 40 + - - - - - 0 - 0 - - - - Previous Frames - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - QLayout::SetDefaultConstraint - - - 6 - - - 6 - - - - - Onion skin previous frame - - - Onion skin previous frame - - - false - - - ... - - - - :/app/icons/onionPrev.png:/app/icons/onionPrev.png - - - - 24 - 24 - - - - true - - - true - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - 1 - - - 60 - - - - - - - Onion skin color: red - - - Onion skin color: red - - - ... - - - - :/app/icons/onion-red.png:/app/icons/onion-red.png - - - - 24 - 24 - - - - true - - - true - - - - - - - - - Next Frames - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - QLayout::SetDefaultConstraint - - - 6 - - - 6 - - - - - Onion skin next frame - - - Onion skin next frame - - - ... - - - - :/app/icons/onionNext.png:/app/icons/onionNext.png - - - - 24 - 24 - - - - true - - - true - - - - - - - - 0 - 0 - - - - - 50 - 0 - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - QAbstractSpinBox::UpDownArrows - - - 1 - - - 60 - - - - - - - - 16777215 - 16777215 - - - - Onion skin color: blue - - - Onion skin color: blue - - - false - - - ... - - - - :/app/icons/onion-blue.png:/app/icons/onion-blue.png - - - - 24 - 24 - - - - true - - - true - - - - - - - - - Distributed opacity - - - - - - - 10 - - - 6 - - - 6 - - - - - - 0 - 0 - - - - Min - - - - - - - - 0 - 0 - - - - - 60 - 0 - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - % - - - - - - 100 - - - - - - - - 0 - 0 - - - - Max - - - - - - - - 0 - 0 - - - - - 60 - 0 - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - % - - - - - - 100 - - - - - - - - - Show Keyframes Only - - - - - - - Show During Playback - - - - - - - Qt::Horizontal - - - - 40 - 0 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 0 - 0 - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - + From 6afe1f1800db25627f2c3eee5f0c702fe7f9bbb6 Mon Sep 17 00:00:00 2001 From: scribblemaniac Date: Sat, 27 Mar 2021 00:15:41 -0600 Subject: [PATCH 2/3] Use FlowLayout for laying out the distributed opacity onion skin section --- app/src/onionskinwidget.cpp | 13 ++ app/ui/onionskin.ui | 229 ++++++++++++++++++++---------------- 2 files changed, 143 insertions(+), 99 deletions(-) diff --git a/app/src/onionskinwidget.cpp b/app/src/onionskinwidget.cpp index 83366de7ec..df38b878d2 100644 --- a/app/src/onionskinwidget.cpp +++ b/app/src/onionskinwidget.cpp @@ -19,6 +19,7 @@ GNU General Public License for more details. #include "preferencemanager.h" #include "editor.h" +#include "flowlayout.h" #include "util.h" OnionSkinWidget::OnionSkinWidget(QWidget *parent) : @@ -26,6 +27,7 @@ OnionSkinWidget::OnionSkinWidget(QWidget *parent) : ui(new Ui::OnionSkin) { ui->setupUi(this); + clearFocusOnFinished(ui->onionPrevFramesNumBox); clearFocusOnFinished(ui->onionNextFramesNumBox); clearFocusOnFinished(ui->onionMinOpacityBox); @@ -42,6 +44,17 @@ void OnionSkinWidget::initUI() updateUI(); makeConnections(); + // Change the horizontal layout in the Distributed Opacity group box to a + // flow layout to reduce the minimum width + FlowLayout *opacityLayout = new FlowLayout; + opacityLayout->setAlignment(Qt::AlignHCenter); + ui->opacityGroup->layout()->removeWidget(ui->minOpacityGroup); + ui->opacityGroup->layout()->removeWidget(ui->maxOpacityGroup); + opacityLayout->addWidget(ui->minOpacityGroup); + opacityLayout->addWidget(ui->maxOpacityGroup); + delete ui->opacityGroup->layout(); + ui->opacityGroup->setLayout(opacityLayout); + #ifdef __APPLE__ // Mac only style. ToolButtons are naturally borderless on Win/Linux. QString stylesheet = diff --git a/app/ui/onionskin.ui b/app/ui/onionskin.ui index be8d80ced2..f98b541078 100644 --- a/app/ui/onionskin.ui +++ b/app/ui/onionskin.ui @@ -6,14 +6,14 @@ 0 0 - 436 - 378 + 255 + 401 - 239 - 150 + 187 + 121 @@ -23,6 +23,12 @@ Onion Skins + + + 0 + 0 + + 0 @@ -56,6 +62,9 @@ QFrame::Plain + + Qt::ScrollBarAsNeeded + true @@ -67,8 +76,8 @@ 0 0 - 436 - 357 + 255 + 380 @@ -312,7 +321,7 @@ Distributed Opacity - + 10 @@ -323,94 +332,122 @@ 6 - - - - - - 0 - 0 - - - - Max - - - - - - - - 0 - 0 - - - - - 60 - 0 - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - % - - - - - - 100 - - - - + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + Min + + + + + + + + 0 + 0 + + + + + 60 + 0 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + % + + + + + + 100 + + + + + - - - - - - 0 - 0 - - - - Min - - - - - - - - 0 - 0 - - - - - 60 - 0 - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - % - - - - - - 100 - - - - + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + Max + + + + + + + + 0 + 0 + + + + + 60 + 0 + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + % + + + + + + 100 + + + + + @@ -434,12 +471,6 @@ Qt::Vertical - - - 20 - 40 - - From 12b3200579b924f187d9f031fd9e995081ad1b2b Mon Sep 17 00:00:00 2001 From: scribblemaniac Date: Sat, 27 Mar 2021 00:37:07 -0600 Subject: [PATCH 3/3] Fix QGroupBox margins and spacing --- app/src/onionskinwidget.cpp | 1 + app/ui/onionskin.ui | 34 +++++++++++++++++++++++++++++----- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/app/src/onionskinwidget.cpp b/app/src/onionskinwidget.cpp index df38b878d2..f4872aa3d3 100644 --- a/app/src/onionskinwidget.cpp +++ b/app/src/onionskinwidget.cpp @@ -48,6 +48,7 @@ void OnionSkinWidget::initUI() // flow layout to reduce the minimum width FlowLayout *opacityLayout = new FlowLayout; opacityLayout->setAlignment(Qt::AlignHCenter); + opacityLayout->setContentsMargins(0, 6, 0, 6); ui->opacityGroup->layout()->removeWidget(ui->minOpacityGroup); ui->opacityGroup->layout()->removeWidget(ui->maxOpacityGroup); opacityLayout->addWidget(ui->minOpacityGroup); diff --git a/app/ui/onionskin.ui b/app/ui/onionskin.ui index f98b541078..bc9b8967c7 100644 --- a/app/ui/onionskin.ui +++ b/app/ui/onionskin.ui @@ -6,8 +6,8 @@ 0 0 - 255 - 401 + 213 + 382 @@ -76,8 +76,8 @@ 0 0 - 255 - 380 + 213 + 361 @@ -108,9 +108,15 @@ QLayout::SetDefaultConstraint + + 0 + 6 + + 0 + 6 @@ -212,9 +218,15 @@ QLayout::SetDefaultConstraint + + 0 + 6 + + 0 + 6 @@ -323,11 +335,17 @@ - 10 + 6 + + + 0 6 + + 0 + 6 @@ -471,6 +489,12 @@ Qt::Vertical + + + 0 + 0 + +