Skip to content

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

C

Style Editor Overhaul (#1397)

Jeremy Bullock4bf6729ad254
diff --git a/toonz/sources/include/toonzqt/styleeditor.h b/toonz/sources/include/toonzqt/styleeditor.h
index cb2254372..d51601e87 100644
--- a/toonz/sources/include/toonzqt/styleeditor.h
+++ b/toonz/sources/include/toonzqt/styleeditor.h
@@ -8,6 +8,7 @@
#include "tfilepath.h"
#include "tpixel.h"
#include "tpalette.h"
+#include "saveloadqsettings.h"
// TnzLib includes
#include "toonz/tpalettehandle.h"
@@ -35,6 +36,8 @@
#include <QScrollArea>
#include <QMouseEvent>
#include <QPointF>
+#include <QSettings>
+#include <QSplitter>
// iwsw commented out temporarily
//#include "ghibli_3dlut_util.h"
@@ -450,14 +453,30 @@ class PlainColorPage final : public StyleEditorPage {
ColorModel m_color;
bool m_signalEnabled;
-
+ bool m_isVertical = true;
+ int m_visibleParts;
void updateControls();
+ QPushButton *m_wheelShowButton;
+ QPushButton *m_hsvShowButton;
+ QPushButton *m_alphaShowButton;
+ QPushButton *m_rgbShowButton;
+ QPushButton *m_toggleOrientationButton;
+ // QGridLayout *m_mainLayout;
+ QFrame *m_slidersContainer;
+ QFrame *m_wheelFrame;
+ QSplitter *m_vSplitter;
public:
PlainColorPage(QWidget *parent = 0);
~PlainColorPage() {}
void setColor(const TColorStyle &style, int colorParameterIndex);
+ void setVisibleParts(int settings);
+ int getVisibleParts();
+ void setIsVertical(bool isVertical);
+ bool getIsVertical() { return m_isVertical; }
+ QByteArray getSplitterState();
+ void setSplitterState(QByteArray state);
protected:
void resizeEvent(QResizeEvent *) override;
@@ -469,6 +488,7 @@ protected slots:
void onWheelChanged(const ColorModel &color, bool isDragging);
// void onWheelSliderChanged(int value);
// void onWheelSliderReleased();
+ void toggleOrientation();
public slots:
// void setWheelChannel(int channel);
@@ -581,7 +601,7 @@ using namespace StyleEditorGUI;
// StyleEditor
//-----------------------------------------------------------------------------
-class DVAPI StyleEditor final : public QWidget {
+class DVAPI StyleEditor final : public QWidget, public SaveLoadQSettings {
Q_OBJECT
PaletteController *m_paletteController;
@@ -620,6 +640,7 @@ class DVAPI StyleEditor final : public QWidget {
StyleChooserPage *m_vectorBrushesStylePage;
StyleChooserPage *m_mypaintBrushesStylePage;
SettingsPage *m_settingsPage;
+ QScrollArea *m_vectorArea;
TColorStyleP
m_oldStyle; //!< A copy of current style \a before the last change.
@@ -630,6 +651,7 @@ class DVAPI StyleEditor final : public QWidget {
bool m_enabled;
bool m_enabledOnlyFirstTab;
bool m_enabledFirstAndLastTab;
+ bool m_colorPageIsVertical = true;
public:
StyleEditor(PaletteController *, QWidget *parent = 0);
@@ -655,6 +677,10 @@ public:
m_settingsPage->enableAutopaintToggle(enabled);
}
+ // SaveLoadQSettings
+ virtual void save(QSettings &settings) const override;
+ virtual void load(QSettings &settings) override;
+
protected:
/*! Return false if style is linked and style must be set to null.*/
bool setStyle(TColorStyle *currentStyle);
@@ -712,6 +738,10 @@ protected slots:
void onParamStyleChanged(bool isDragging);
+ void onSpecialButtonToggled(bool on);
+ void onCustomButtonToggled(bool on);
+ void onVectorBrushButtonToggled(bool on);
+
private:
QFrame *createBottomWidget();
void updateTabBar();
diff --git a/toonz/sources/toonz/tpanels.cpp b/toonz/sources/toonz/tpanels.cpp
index 0ebe8c906..5d9058b1d 100644
--- a/toonz/sources/toonz/tpanels.cpp
+++ b/toonz/sources/toonz/tpanels.cpp
@@ -795,7 +795,7 @@ StyleEditorPanel::StyleEditorPanel(QWidget *parent) : TPanel(parent) {
setWidget(m_styleEditor);
m_styleEditor->setLevelHandle(TApp::instance()->getCurrentLevel());
-
+ setMinimumWidth(200);
resize(340, 630);
}
diff --git a/toonz/sources/toonzqt/styleeditor.cpp b/toonz/sources/toonzqt/styleeditor.cpp
index 86aadf6d8..3e5f137f9 100644
--- a/toonz/sources/toonzqt/styleeditor.cpp
+++ b/toonz/sources/toonzqt/styleeditor.cpp
@@ -1508,46 +1508,49 @@ PlainColorPage::PlainColorPage(QWidget *parent)
SLOT(onControlChanged(const ColorModel &, bool)));
}
- QPushButton *wheelShowButton = new QPushButton(tr("Wheel"), this);
- QPushButton *hsvShowButton = new QPushButton(tr("HSV"), this);
- QPushButton *alphaShowButton = new QPushButton(tr("Alpha"), this);
- QPushButton *rgbShowButton = new QPushButton(tr("RGB"), this);
-
- QFrame *wheelFrame = new QFrame(this);
+ m_wheelShowButton = new QPushButton(tr("Wheel"), this);
+ m_hsvShowButton = new QPushButton(tr("HSV"), this);
+ m_alphaShowButton = new QPushButton(tr("Alpha"), this);
+ m_rgbShowButton = new QPushButton(tr("RGB"), this);
+ m_toggleOrientationButton = new QPushButton(QChar(0x2194), this);
+ m_toggleOrientationButton->setFixedWidth(20);
+
+ m_wheelFrame = new QFrame(this);
QFrame *hsvFrame = new QFrame(this);
QFrame *alphaFrame = new QFrame(this);
QFrame *rgbFrame = new QFrame(this);
- QFrame *slidersContainer = new QFrame(this);
- QSplitter *vSplitter = new QSplitter(this);
+ m_slidersContainer = new QFrame(this);
+ m_vSplitter = new QSplitter(this);
//プロパティの設定
// channelButtonGroup->setExclusive(true);
- wheelShowButton->setCheckable(true);
- hsvShowButton->setCheckable(true);
- alphaShowButton->setCheckable(true);
- rgbShowButton->setCheckable(true);
- wheelShowButton->setMinimumWidth(30);
- hsvShowButton->setMinimumWidth(30);
- alphaShowButton->setMinimumWidth(30);
- rgbShowButton->setMinimumWidth(30);
-
- wheelFrame->setObjectName("PlainColorPageParts");
+ m_wheelShowButton->setCheckable(true);
+ m_hsvShowButton->setCheckable(true);
+ m_alphaShowButton->setCheckable(true);
+ m_rgbShowButton->setCheckable(true);
+ m_wheelShowButton->setMinimumWidth(30);
+ m_hsvShowButton->setMinimumWidth(30);
+ m_alphaShowButton->setMinimumWidth(30);
+ m_rgbShowButton->setMinimumWidth(30);
+
+ m_wheelFrame->setObjectName("PlainColorPageParts");
hsvFrame->setObjectName("PlainColorPageParts");
alphaFrame->setObjectName("PlainColorPageParts");
rgbFrame->setObjectName("PlainColorPageParts");
- wheelShowButton->setChecked(true);
- wheelShowButton->setFocusPolicy(Qt::NoFocus);
- hsvShowButton->setChecked(true);
- hsvShowButton->setFocusPolicy(Qt::NoFocus);
- alphaShowButton->setChecked(true);
- alphaShowButton->setFocusPolicy(Qt::NoFocus);
- rgbShowButton->setChecked(true);
- rgbShowButton->setFocusPolicy(Qt::NoFocus);
+ m_wheelShowButton->setChecked(true);
+ m_wheelShowButton->setFocusPolicy(Qt::NoFocus);
+ m_hsvShowButton->setChecked(true);
+ m_hsvShowButton->setFocusPolicy(Qt::NoFocus);
+ m_alphaShowButton->setChecked(true);
+ m_alphaShowButton->setFocusPolicy(Qt::NoFocus);
+ m_rgbShowButton->setChecked(true);
+ m_rgbShowButton->setFocusPolicy(Qt::NoFocus);
+ m_toggleOrientationButton->setFocusPolicy(Qt::NoFocus);
- vSplitter->setOrientation(Qt::Vertical);
- vSplitter->setFocusPolicy(Qt::NoFocus);
+ m_vSplitter->setOrientation(Qt::Vertical);
+ m_vSplitter->setFocusPolicy(Qt::NoFocus);
// m_verticalSlider->hide();
// m_squaredColorWheel->hide();
@@ -1562,10 +1565,11 @@ PlainColorPage::PlainColorPage(QWidget *parent)
showButtonLayout->setMargin(0);
showButtonLayout->setSpacing(0);
{
- showButtonLayout->addWidget(wheelShowButton, 1);
- showButtonLayout->addWidget(hsvShowButton, 1);
- showButtonLayout->addWidget(alphaShowButton, 1);
- showButtonLayout->addWidget(rgbShowButton, 1);
+ showButtonLayout->addWidget(m_wheelShowButton, 1);
+ showButtonLayout->addWidget(m_hsvShowButton, 1);
+ showButtonLayout->addWidget(m_alphaShowButton, 1);
+ showButtonLayout->addWidget(m_rgbShowButton, 1);
+ showButtonLayout->addWidget(m_toggleOrientationButton, 1);
}
mainLayout->addLayout(showButtonLayout);
@@ -1573,8 +1577,8 @@ PlainColorPage::PlainColorPage(QWidget *parent)
wheelLayout->setMargin(5);
wheelLayout->setSpacing(0);
{ wheelLayout->addWidget(m_hexagonalColorWheel); }
- wheelFrame->setLayout(wheelLayout);
- vSplitter->addWidget(wheelFrame);
+ m_wheelFrame->setLayout(wheelLayout);
+ m_vSplitter->addWidget(m_wheelFrame);
QVBoxLayout *slidersLayout = new QVBoxLayout();
slidersLayout->setMargin(0);
@@ -1609,15 +1613,16 @@ PlainColorPage::PlainColorPage(QWidget *parent)
rgbFrame->setLayout(rgbLayout);
slidersLayout->addWidget(rgbFrame, 3);
}
- slidersContainer->setLayout(slidersLayout);
- vSplitter->addWidget(slidersContainer);
- mainLayout->addWidget(vSplitter, 1);
+ m_slidersContainer->setLayout(slidersLayout);
+ m_vSplitter->addWidget(m_slidersContainer);
+
+ mainLayout->addWidget(m_vSplitter, 1);
}
setLayout(mainLayout);
QList<int> list;
list << rect().height() / 2 << rect().height() / 2;
- vSplitter->setSizes(list);
+ m_vSplitter->setSizes(list);
// connect(m_squaredColorWheel, SIGNAL(colorChanged(const ColorModel &,
// bool)),
@@ -1635,14 +1640,16 @@ PlainColorPage::PlainColorPage(QWidget *parent)
// SLOT(setWheelChannel(int)));
// Show/Hideトグルボタン
- connect(wheelShowButton, SIGNAL(toggled(bool)), wheelFrame,
+ connect(m_wheelShowButton, SIGNAL(toggled(bool)), m_wheelFrame,
SLOT(setVisible(bool)));
- connect(hsvShowButton, SIGNAL(toggled(bool)), hsvFrame,
+ connect(m_hsvShowButton, SIGNAL(toggled(bool)), hsvFrame,
SLOT(setVisible(bool)));
- connect(alphaShowButton, SIGNAL(toggled(bool)), alphaFrame,
+ connect(m_alphaShowButton, SIGNAL(toggled(bool)), alphaFrame,
SLOT(setVisible(bool)));
- connect(rgbShowButton, SIGNAL(toggled(bool)), rgbFrame,
+ connect(m_rgbShowButton, SIGNAL(toggled(bool)), rgbFrame,
SLOT(setVisible(bool)));
+ connect(m_toggleOrientationButton, SIGNAL(clicked()), this,
+ SLOT(toggleOrientation()));
}
//-----------------------------------------------------------------------------
@@ -1693,6 +1700,81 @@ void PlainColorPage::setColor(const TColorStyle &style,
m_signalEnabled = oldSignalEnabled;
}
+//-----------------------------------------------------------------------------
+
+void PlainColorPage::setVisibleParts(int settings) {
+ m_visibleParts = settings;
+ if (m_visibleParts & 0x01)
+ m_wheelShowButton->setChecked(true);
+ else
+ m_wheelShowButton->setChecked(false);
+ if (m_visibleParts & 0x02)
+ m_hsvShowButton->setChecked(true);
+ else
+ m_hsvShowButton->setChecked(false);
+ if (m_visibleParts & 0x04)
+ m_alphaShowButton->setChecked(true);
+ else
+ m_alphaShowButton->setChecked(false);
+ if (m_visibleParts & 0x08)
+ m_rgbShowButton->setChecked(true);
+ else
+ m_rgbShowButton->setChecked(false);
+}
+
+//-----------------------------------------------------------------------------
+
+int PlainColorPage::getVisibleParts() {
+ int visibleParts = 0;
+ if (m_wheelShowButton->isChecked()) visibleParts |= 0x01;
+ if (m_hsvShowButton->isChecked()) visibleParts |= 0x02;
+ if (m_alphaShowButton->isChecked()) visibleParts |= 0x04;
+ if (m_rgbShowButton->isChecked()) visibleParts |= 0x08;
+ return visibleParts;
+}
+
+//-----------------------------------------------------------------------------
+
+void PlainColorPage::setIsVertical(bool isVertical) {
+ // if (m_isVertical == isVertical) return;
+ // not returning even if it already is the same orientation
+ // to take advantage of the resizing here
+ // this is useful for the first time the splitter is set
+ // afterwards, it will be overridden by the saved state
+ // from settings.
+ m_isVertical = isVertical;
+ if (isVertical) {
+ m_vSplitter->setOrientation(Qt::Vertical);
+ m_toggleOrientationButton->setText(QChar(0x2194));
+ QList<int> sectionSizes;
+ // maximize color wheel space
+ sectionSizes << height() - 1 << 1;
+ m_vSplitter->setSizes(sectionSizes);
+ } else {
+ m_vSplitter->setOrientation(Qt::Horizontal);
+ m_toggleOrientationButton->setText(QChar(0x2195));
+ QList<int> sectionSizes;
+ sectionSizes << width() / 2 << width() / 2;
+ m_vSplitter->setSizes(sectionSizes);
+ }
+}
+
+//-----------------------------------------------------------------------------
+
+void PlainColorPage::toggleOrientation() { setIsVertical(!m_isVertical); }
+
+//-----------------------------------------------------------------------------
+
+QByteArray PlainColorPage::getSplitterState() {
+ return m_vSplitter->saveState();
+}
+
+//-----------------------------------------------------------------------------
+
+void PlainColorPage::setSplitterState(QByteArray state) {
+ m_vSplitter->restoreState(state);
+}
+
//-----------------------------------------------------------------------------
/*
void PlainColorPage::setWheelChannel(int channel)
@@ -1817,7 +1899,7 @@ void StyleChooserPage::computeSize() {
int rowCount = 0;
if (m_chipPerRow != 0)
rowCount = (getChipCount() + m_chipPerRow - 1) / m_chipPerRow;
- setMinimumSize(5 * m_chipSize.width(), rowCount * m_chipSize.height() + 10);
+ setMinimumSize(3 * m_chipSize.width(), rowCount * m_chipSize.height() + 10);
update();
}
@@ -2941,21 +3023,63 @@ StyleEditor::StyleEditor(PaletteController *paletteController, QWidget *parent)
// For the plainColorPage and the settingsPage
// I create a "fake" QScrollArea (without ScrollingBar
// in order to use the styleSheet to stylish its background
- QScrollArea *plainArea = makeChooserPageWithoutScrollBar(m_plainColorPage);
-
- QScrollArea *textureArea = makeChooserPage(m_textureStylePage);
- QScrollArea *specialArea = makeChooserPage(m_specialStylePage);
- QScrollArea *customArea = makeChooserPage(m_customStylePage);
- QScrollArea *vectorBrushesArea = makeChooserPage(m_vectorBrushesStylePage);
+ QScrollArea *plainArea = makeChooserPageWithoutScrollBar(m_plainColorPage);
+ QScrollArea *textureArea = makeChooserPage(m_textureStylePage);
QScrollArea *mypaintBrushesArea = makeChooserPage(m_mypaintBrushesStylePage);
QScrollArea *settingsArea = makeChooserPageWithoutScrollBar(m_settingsPage);
+ QVBoxLayout *vectorLayout = new QVBoxLayout(this);
+ vectorLayout->setMargin(0);
+ vectorLayout->setSpacing(0);
+ vectorLayout->setSizeConstraint(QLayout::SetNoConstraint);
+
+ QVBoxLayout *vectorOutsideLayout = new QVBoxLayout(this);
+ vectorOutsideLayout->setMargin(0);
+ vectorOutsideLayout->setSpacing(0);
+ vectorOutsideLayout->setSizeConstraint(QLayout::SetNoConstraint);
+
+ QPushButton *specialButton = new QPushButton(tr("Generated"), this);
+ QPushButton *customButton = new QPushButton(tr("Trail"), this);
+ QPushButton *vectorBrushButton = new QPushButton(tr("Vector Brush"), this);
+ specialButton->setCheckable(true);
+ customButton->setCheckable(true);
+ vectorBrushButton->setCheckable(true);
+ specialButton->setChecked(true);
+ customButton->setChecked(true);
+ vectorBrushButton->setChecked(true);
+
+ QHBoxLayout *vectorButtonLayout = new QHBoxLayout(this);
+ vectorButtonLayout->setSizeConstraint(QLayout::SetNoConstraint);
+
+ QFrame *vectorFrame = new QFrame(this);
+ vectorFrame->setMinimumWidth(50);
+
+ QFrame *vectorOutsideFrame = new QFrame(this);
+ vectorOutsideFrame->setMinimumWidth(50);
+
+ vectorButtonLayout->addWidget(specialButton);
+ vectorButtonLayout->addWidget(customButton);
+ vectorButtonLayout->addWidget(vectorBrushButton);
+
+ vectorOutsideLayout->addLayout(vectorButtonLayout);
+ vectorLayout->addWidget(m_specialStylePage);
+ vectorLayout->addWidget(m_customStylePage);
+ vectorLayout->addWidget(m_vectorBrushesStylePage);
+
+ vectorFrame->setLayout(vectorLayout);
+ m_vectorArea = makeChooserPage(vectorFrame);
+ m_vectorArea->setMinimumWidth(50);
+ vectorOutsideLayout->addWidget(m_vectorArea);
+
+ vectorOutsideFrame->setLayout(vectorOutsideLayout);
+ QScrollArea *vectorOutsideArea =
+ makeChooserPageWithoutScrollBar(vectorOutsideFrame);
+ vectorOutsideArea->setMinimumWidth(50);
+
m_styleChooser = new QStackedWidget(this);
m_styleChooser->addWidget(plainArea);
m_styleChooser->addWidget(textureArea);
- m_styleChooser->addWidget(specialArea);
- m_styleChooser->addWidget(customArea);
- m_styleChooser->addWidget(vectorBrushesArea);
+ m_styleChooser->addWidget(vectorOutsideArea);
m_styleChooser->addWidget(mypaintBrushesArea);
m_styleChooser->addWidget(settingsArea);
m_styleChooser->addWidget(makeChooserPageWithoutScrollBar(emptyPage));
@@ -2972,7 +3096,7 @@ StyleEditor::StyleEditor(PaletteController *paletteController, QWidget *parent)
m_colorParameterSelector->setFixedHeight(22);
/* ------- layout ------- */
- QVBoxLayout *mainLayout = new QVBoxLayout;
+ QGridLayout *mainLayout = new QGridLayout;
mainLayout->setMargin(0);
mainLayout->setSpacing(0);
{
@@ -2985,11 +3109,11 @@ StyleEditor::StyleEditor(PaletteController *paletteController, QWidget *parent)
}
m_tabBarContainer->setLayout(hLayout);
- mainLayout->addWidget(m_tabBarContainer, 0);
- mainLayout->addWidget(m_styleChooser, 1);
- mainLayout->addWidget(bottomWidget, 0);
- mainLayout->addWidget(m_statusLabel, 0);
- mainLayout->addWidget(m_toolBar, 0);
+ mainLayout->addWidget(m_tabBarContainer, 0, 0, 1, 2, 0);
+ mainLayout->addWidget(m_styleChooser, 1, 0, 1, 2);
+ mainLayout->addWidget(bottomWidget, 2, 0, 1, 2, 0);
+ mainLayout->addWidget(m_statusLabel, 3, 0, 1, 2, 0);
+ mainLayout->addWidget(m_toolBar, 4, 0, 1, 2, 0);
}
setLayout(mainLayout);
@@ -3020,12 +3144,18 @@ StyleEditor::StyleEditor(PaletteController *paletteController, QWidget *parent)
ret = ret && connect(m_plainColorPage,
SIGNAL(colorChanged(const ColorModel &, bool)), this,
SLOT(onColorChanged(const ColorModel &, bool)));
+ ret = ret && connect(specialButton, SIGNAL(toggled(bool)), this,
+ SLOT(onSpecialButtonToggled(bool)));
+ ret = ret && connect(customButton, SIGNAL(toggled(bool)), this,
+ SLOT(onCustomButtonToggled(bool)));
+ ret = ret && connect(vectorBrushButton, SIGNAL(toggled(bool)), this,
+ SLOT(onVectorBrushButtonToggled(bool)));
assert(ret);
/* ------- initial conditions ------- */
enable(false, false, false);
// set to the empty page
- m_styleChooser->setCurrentIndex(7);
+ m_styleChooser->setCurrentIndex(m_styleChooser->count() - 1);
}
//-----------------------------------------------------------------------------
@@ -3071,7 +3201,7 @@ QFrame *StyleEditor::createBottomWidget() {
/* ------ layout ------ */
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->setMargin(4);
- mainLayout->setSpacing(10);
+ mainLayout->setSpacing(1);
{
QHBoxLayout *hLayout = new QHBoxLayout;
hLayout->setMargin(0);
@@ -3110,20 +3240,18 @@ QFrame *StyleEditor::createBottomWidget() {
void StyleEditor::updateTabBar() {
m_styleBar->clearTabBar();
if (m_enabled && !m_enabledOnlyFirstTab && !m_enabledFirstAndLastTab) {
- m_styleBar->addSimpleTab(tr("Plain"));
+ m_styleBar->addSimpleTab(tr("Color"));
m_styleBar->addSimpleTab(tr("Texture"));
- m_styleBar->addSimpleTab(tr("Special"));
- m_styleBar->addSimpleTab(tr("Custom"));
- m_styleBar->addSimpleTab(tr("Vector Brush"));
- m_styleBar->addSimpleTab(tr("MyPaint Brush"));
+ m_styleBar->addSimpleTab(tr("Vector"));
+ m_styleBar->addSimpleTab(tr("Raster"));
m_styleBar->addSimpleTab(tr("Settings"));
} else if (m_enabled && m_enabledOnlyFirstTab && !m_enabledFirstAndLastTab)
- m_styleBar->addSimpleTab(tr("Plain"));
+ m_styleBar->addSimpleTab(tr("Color"));
else if (m_enabled && !m_enabledOnlyFirstTab && m_enabledFirstAndLastTab) {
- m_styleBar->addSimpleTab(tr("Plain"));
+ m_styleBar->addSimpleTab(tr("Color"));
m_styleBar->addSimpleTab(tr("Settings"));
} else {
- m_styleChooser->setCurrentIndex(7);
+ m_styleChooser->setCurrentIndex(m_styleChooser->count() - 1);
return;
}
m_tabBarContainer->layout()->update();
@@ -3170,7 +3298,7 @@ void StyleEditor::onStyleSwitched() {
if (!palette) {
// set the current page to empty
- m_styleChooser->setCurrentIndex(7);
+ m_styleChooser->setCurrentIndex(m_styleChooser->count() - 1);
enable(false);
m_colorParameterSelector->clear();
m_oldStyle = TColorStyleP();
@@ -3564,3 +3692,48 @@ void StyleEditor::onParamStyleChanged(bool isDragging) {
m_editedStyle->invalidateIcon(); // Refresh the new color icon
m_newColor->setStyle(*m_editedStyle); //
}
+
+//-----------------------------------------------------------------------------
+
+void StyleEditor::onSpecialButtonToggled(bool on) {
+ m_specialStylePage->setVisible(on);
+ m_vectorArea->widget()->resize(m_vectorArea->widget()->sizeHint());
+ qApp->processEvents();
+}
+
+//-----------------------------------------------------------------------------
+
+void StyleEditor::onCustomButtonToggled(bool on) {
+ m_customStylePage->setVisible(on);
+ m_vectorArea->widget()->resize(m_vectorArea->widget()->sizeHint());
+ qApp->processEvents();
+}
+
+//-----------------------------------------------------------------------------
+
+void StyleEditor::onVectorBrushButtonToggled(bool on) {
+ m_vectorBrushesStylePage->setVisible(on);
+ m_vectorArea->widget()->resize(m_vectorArea->widget()->sizeHint());
+ qApp->processEvents();
+}
+
+//-----------------------------------------------------------------------------
+
+void StyleEditor::save(QSettings &settings) const {
+ settings.setValue("isVertical", m_plainColorPage->getIsVertical());
+ settings.setValue("visibleParts", m_plainColorPage->getVisibleParts());
+ settings.setValue("splitterState", m_plainColorPage->getSplitterState());
+}
+void StyleEditor::load(QSettings &settings) {
+ QVariant isVertical = settings.value("isVertical");
+ if (isVertical.canConvert(QVariant::Bool)) {
+ m_colorPageIsVertical = isVertical.toBool();
+ m_plainColorPage->setIsVertical(m_colorPageIsVertical);
+ }
+ QVariant visibleParts = settings.value("visibleParts");
+ if (visibleParts.canConvert(QVariant::Int))
+ m_plainColorPage->setVisibleParts(visibleParts.toInt());
+ QVariant splitterState = settings.value("splitterState");
+ if (splitterState.canConvert(QVariant::ByteArray))
+ m_plainColorPage->setSplitterState(splitterState.toByteArray());
+}
\ No newline at end of file