From 18bf210c041c9074c45acf3b6fd875cea7cca3c0 Mon Sep 17 00:00:00 2001 From: shun-iwasawa Date: Fri, 18 Sep 2020 16:54:39 +0900 Subject: [PATCH 1/4] additional style sheet --- toonz/sources/include/toonz/preferences.h | 5 +- .../include/toonz/preferencesitemids.h | 1 + toonz/sources/toonz/main.cpp | 12 +-- toonz/sources/toonz/mainwindow.cpp | 12 +-- toonz/sources/toonz/preferencespopup.cpp | 98 ++++++++++++++++--- toonz/sources/toonz/preferencespopup.h | 29 ++++++ toonz/sources/toonzlib/preferences.cpp | 33 ++++++- 7 files changed, 162 insertions(+), 28 deletions(-) diff --git a/toonz/sources/include/toonz/preferences.h b/toonz/sources/include/toonz/preferences.h index 63b419f6..48f4785f 100644 --- a/toonz/sources/include/toonz/preferences.h +++ b/toonz/sources/include/toonz/preferences.h @@ -200,7 +200,10 @@ public: QStringList getLanguageList() const { return m_languageList; } QMap getRoomMap() const { return m_roomMaps; } - QString getCurrentStyleSheetPath() const; // OK + QString getCurrentStyleSheet() const; + QString getAdditionalStyleSheet() const { + return getStringValue(additionalStyleSheet); + } bool getPixelsOnly() const { return getBoolValue(pixelsOnly); } QString getOldUnits() const { return getStringValue(oldUnits); } QString getOldCameraUnits() const { return getStringValue(oldCameraUnits); } diff --git a/toonz/sources/include/toonz/preferencesitemids.h b/toonz/sources/include/toonz/preferencesitemids.h index e0fbbf6e..034497fa 100644 --- a/toonz/sources/include/toonz/preferencesitemids.h +++ b/toonz/sources/include/toonz/preferencesitemids.h @@ -24,6 +24,7 @@ enum PreferencesItemId { //---------- // Interface CurrentStyleSheetName, + additionalStyleSheet, iconTheme, pixelsOnly, oldUnits, diff --git a/toonz/sources/toonz/main.cpp b/toonz/sources/toonz/main.cpp index 81310d18..06e62212 100644 --- a/toonz/sources/toonz/main.cpp +++ b/toonz/sources/toonz/main.cpp @@ -231,7 +231,7 @@ project->setUseScenePath(TProject::Extras, false); // Imposto la rootDir per ImageCache /*-- TOONZCACHEROOTの設定 --*/ - TFilePath cacheDir = ToonzFolder::getCacheRootFolder(); + TFilePath cacheDir = ToonzFolder::getCacheRootFolder(); if (cacheDir.isEmpty()) cacheDir = TEnv::getStuffDir() + "cache"; TImageCache::instance()->setRootDir(cacheDir); @@ -339,10 +339,10 @@ int main(int argc, char *argv[]) { QApplication a(argc, argv); #ifdef MACOSX -// This workaround is to avoid missing left button problem on Qt5.6.0. -// To invalidate m_rightButtonClicked in Qt/qnsview.mm, sending -// NSLeftButtonDown event before NSLeftMouseDragged event propagated to -// QApplication. See more details in ../mousedragfilter/mousedragfilter.mm. + // This workaround is to avoid missing left button problem on Qt5.6.0. + // To invalidate m_rightButtonClicked in Qt/qnsview.mm, sending + // NSLeftButtonDown event before NSLeftMouseDragged event propagated to + // QApplication. See more details in ../mousedragfilter/mousedragfilter.mm. #include "mousedragfilter.h" @@ -762,7 +762,7 @@ int main(int argc, char *argv[]) { a.processEvents(); // Carico lo styleSheet - QString currentStyle = Preferences::instance()->getCurrentStyleSheetPath(); + QString currentStyle = Preferences::instance()->getCurrentStyleSheet(); a.setStyleSheet(currentStyle); // Perspective grid tool - custom grid diff --git a/toonz/sources/toonz/mainwindow.cpp b/toonz/sources/toonz/mainwindow.cpp index 736706b3..e781c75c 100644 --- a/toonz/sources/toonz/mainwindow.cpp +++ b/toonz/sources/toonz/mainwindow.cpp @@ -1263,7 +1263,7 @@ void MainWindow::onMenuCheckboxChanged() { FieldGuideToggleAction = isChecked; else if (cm->getAction(MI_RasterizePli) == action) { if (!QGLPixelBuffer::hasOpenGLPbuffers()) isChecked = 0; - RasterizePliToggleAction = isChecked; + RasterizePliToggleAction = isChecked; } else if (cm->getAction(MI_SafeArea) == action) SafeAreaToggleAction = isChecked; else if (cm->getAction(MI_ViewColorcard) == action) @@ -3158,7 +3158,7 @@ void MainWindow::clearCacheFolder() { // 1. $CACHE/[Current ProcessID] // 2. $CACHE/temp/[Current scene folder] if the current scene is untitled - TFilePath cacheRoot = ToonzFolder::getCacheRootFolder(); + TFilePath cacheRoot = ToonzFolder::getCacheRootFolder(); if (cacheRoot.isEmpty()) cacheRoot = TEnv::getStuffDir() + "cache"; TFilePathSet filesToBeRemoved; @@ -3310,12 +3310,8 @@ class ReloadStyle final : public MenuItemHandler { public: ReloadStyle() : MenuItemHandler("MI_ReloadStyle") {} void execute() override { - QString currentStyle = Preferences::instance()->getCurrentStyleSheetPath(); - QFile file(currentStyle); - file.open(QFile::ReadOnly); - QString styleSheet = QString(file.readAll()); - qApp->setStyleSheet(styleSheet); - file.close(); + QString currentStyle = Preferences::instance()->getCurrentStyleSheet(); + qApp->setStyleSheet(currentStyle); } } reloadStyle; diff --git a/toonz/sources/toonz/preferencespopup.cpp b/toonz/sources/toonz/preferencespopup.cpp index 570ad6a4..f0d1a2e9 100644 --- a/toonz/sources/toonz/preferencespopup.cpp +++ b/toonz/sources/toonz/preferencespopup.cpp @@ -108,7 +108,7 @@ SizeField::SizeField(QSize min, QSize max, QSize value, QWidget* parent) bool ret = true; ret = ret && connect(m_fieldX, SIGNAL(editingFinished()), this, SIGNAL(editingFinished())); - ret = ret && connect(m_fieldY, SIGNAL(editingFinished()), this, + ret = ret && connect(m_fieldY, SIGNAL(editingFinished()), this, SIGNAL(editingFinished())); assert(ret); } @@ -355,6 +355,53 @@ PreferencesPopup::Display30bitChecker::~Display30bitChecker() { QSurfaceFormat::setDefaultFormat(m_currentDefaultFormat); } +//********************************************************************************** +// PreferencesPopup::AdditionalStyleEdit implementation +//********************************************************************************** + +PreferencesPopup::AdditionalStyleEdit::AdditionalStyleEdit( + PreferencesPopup* parent) + : DVGui::Dialog(parent, true, false, "AdditionalStyleEdit") { + setWindowTitle(tr("Additional Style Sheet")); + setModal(true); + + m_edit = new QTextEdit(this); + QPushButton* okButton = new QPushButton(tr("OK"), this); + QPushButton* applyButton = new QPushButton(tr("Apply"), this); + QPushButton* closeButton = new QPushButton(tr("Close"), this); + + QString placeHolderTxt( + "/* Type additional style sheet here to customize GUI. \n" + " Example: To enlarge the Style Editor buttons */\n\n" + "#StyleEditor #bottomWidget QPushButton{ \n padding : 13 21; \n }"); + m_edit->setPlaceholderText(placeHolderTxt); + m_edit->setAcceptRichText(false); + + m_topLayout->addWidget(m_edit); + + addButtonBarWidget(okButton, applyButton, closeButton); + + bool ret = true; + ret = ret && connect(okButton, SIGNAL(pressed()), this, SLOT(onOK())); + ret = ret && connect(applyButton, SIGNAL(pressed()), this, SLOT(onApply())); + ret = ret && connect(closeButton, SIGNAL(pressed()), this, SLOT(close())); +} + +void PreferencesPopup::AdditionalStyleEdit::showEvent(QShowEvent*) { + m_edit->setPlainText(Preferences::instance()->getAdditionalStyleSheet()); +} + +void PreferencesPopup::AdditionalStyleEdit::onOK() { + onApply(); + close(); +} + +void PreferencesPopup::AdditionalStyleEdit::onApply() { + Preferences::instance()->setValue(additionalStyleSheet, + m_edit->toPlainText()); + emit additionalSheetEdited(); +} + //********************************************************************************** // PreferencesPopup implementation //********************************************************************************** @@ -437,14 +484,16 @@ void PreferencesPopup::onPathAliasPriorityChanged() { void PreferencesPopup::onStyleSheetTypeChanged() { QApplication::setOverrideCursor(Qt::WaitCursor); - QString currentStyle = m_pref->getCurrentStyleSheetPath(); + QString currentStyle = m_pref->getCurrentStyleSheet(); QString iconThemeName = QIcon::themeName(); std::string styleString = currentStyle.toStdString(); std::string iconThemeString = iconThemeName.toStdString(); qApp->setStyleSheet(currentStyle); QApplication::restoreOverrideCursor(); - if (currentStyle.contains("Light") || currentStyle.contains("Neutral")) { + if (currentStyle.contains("file:///") && (currentStyle.contains("Light") || + currentStyle.contains("Neutral")) || + currentStyle.contains("imgs/black")) { m_pref->setValue(iconTheme, true); if (iconThemeName != "dark") { // QIcon::setThemeName(Preferences::instance()->getIconTheme() ? "dark" @@ -741,6 +790,25 @@ void PreferencesPopup::onAutoSavePeriodExternallyChanged() { //} //----------------------------------------------------------------------------- +void PreferencesPopup::onEditAdditionalStyleSheet() { + if (!m_additionalStyleEdit) { + m_additionalStyleEdit = new AdditionalStyleEdit(this); + + bool ret = connect(m_additionalStyleEdit, SIGNAL(additionalSheetEdited()), + this, SLOT(onAdditionalStyleSheetEdited())); + assert(ret); + } + m_additionalStyleEdit->show(); +} + +//----------------------------------------------------------------------------- + +void PreferencesPopup::onAdditionalStyleSheetEdited() { + onStyleSheetTypeChanged(); +} + +//----------------------------------------------------------------------------- + void PreferencesPopup::onPixelUnitExternallySelected(bool on) { CheckBox* pixelsOnlyCB = getUI(pixelsOnly); // call slot function onPixelsOnlyChanged() accordingly @@ -760,7 +828,7 @@ void PreferencesPopup::onInterfaceFontChanged(const QString& text) { for (ComboBoxItem& item : newStyleItems) fontStyleCombo->addItem(item.first, item.second); if (!oldTypeface.isEmpty()) { - int newIndex = fontStyleCombo->findText(oldTypeface); + int newIndex = fontStyleCombo->findText(oldTypeface); if (newIndex < 0) newIndex = 0; fontStyleCombo->setCurrentIndex(newIndex); } @@ -887,7 +955,7 @@ QWidget* PreferencesPopup::createUI(PreferencesItemId id, for (const ComboBoxItem& item : comboItems) combo->addItem(item.first, item.second); combo->setCurrentIndex(combo->findData(item.value)); - ret = connect(combo, SIGNAL(currentIndexChanged(int)), this, + ret = connect(combo, SIGNAL(currentIndexChanged(int)), this, SLOT(onChange())); widget = combo; } else { // create IntLineEdit @@ -924,7 +992,7 @@ QWidget* PreferencesPopup::createUI(PreferencesItemId id, if (id == interfaceFont) { // create QFontComboBox QFontComboBox* combo = new QFontComboBox(this); combo->setCurrentText(item.value.toString()); - ret = connect(combo, SIGNAL(currentIndexChanged(const QString&)), this, + ret = connect(combo, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(onInterfaceFontChanged(const QString&))); widget = combo; } else if (!comboItems.isEmpty()) { // create QComboBox @@ -932,7 +1000,7 @@ QWidget* PreferencesPopup::createUI(PreferencesItemId id, for (const ComboBoxItem& item : comboItems) combo->addItem(item.first, item.second); combo->setCurrentIndex(combo->findData(item.value)); - ret = connect(combo, SIGNAL(currentIndexChanged(int)), this, + ret = connect(combo, SIGNAL(currentIndexChanged(int)), this, SLOT(onChange())); widget = combo; } else { // create FileField @@ -955,7 +1023,7 @@ QWidget* PreferencesPopup::createUI(PreferencesItemId id, { ColorField* field = new ColorField(this, false, colorToTPixel(item.value.value())); - ret = connect(field, SIGNAL(colorChanged(const TPixel32&, bool)), this, + ret = connect(field, SIGNAL(colorChanged(const TPixel32&, bool)), this, SLOT(onColorFieldChanged(const TPixel32&, bool))); widget = field; } break; @@ -1405,7 +1473,9 @@ inline T PreferencesPopup::getUI(PreferencesItemId id) { //********************************************************************************** PreferencesPopup::PreferencesPopup() - : QDialog(TApp::instance()->getMainWindow()), m_formatProperties() { + : QDialog(TApp::instance()->getMainWindow()) + , m_formatProperties() + , m_additionalStyleEdit(nullptr) { setWindowTitle(tr("Preferences")); setObjectName("PreferencesPopup"); @@ -1546,9 +1616,9 @@ QWidget* PreferencesPopup::createGeneralPage() { bool ret = true; ret = ret && connect(m_pref, SIGNAL(stopAutoSave()), this, SLOT(onAutoSaveExternallyChanged())); - ret = ret && connect(m_pref, SIGNAL(startAutoSave()), this, + ret = ret && connect(m_pref, SIGNAL(startAutoSave()), this, SLOT(onAutoSaveExternallyChanged())); - ret = ret && connect(m_pref, SIGNAL(autoSavePeriodChanged()), this, + ret = ret && connect(m_pref, SIGNAL(autoSavePeriodChanged()), this, SLOT(onAutoSavePeriodExternallyChanged())); // ret = ret && connect(m_projectRootDocuments, SIGNAL(stateChanged(int)), @@ -1585,12 +1655,16 @@ QWidget* PreferencesPopup::createInterfacePage() { QPushButton* check30bitBtn = new QPushButton(tr("Check Availability")); + QPushButton* additionalStyleSheetBtn = + new QPushButton(tr("Edit Additional Style Sheet..")); + QWidget* widget = new QWidget(this); QGridLayout* lay = new QGridLayout(); setupLayout(lay); insertUI(CurrentStyleSheetName, lay, styleSheetItemList); int row = lay->rowCount(); + // lay->addWidget(additionalStyleSheetBtn, row - 1, 3); // lay->addWidget(new QLabel(tr("Icon Theme*:"), this), 2, 0, // Qt::AlignRight | Qt::AlignVCenter); @@ -1642,6 +1716,8 @@ QWidget* PreferencesPopup::createInterfacePage() { ret = ret && connect(TApp::instance()->getCurrentScene(), SIGNAL(pixelUnitSelected(bool)), this, SLOT(onPixelUnitExternallySelected(bool))); + ret = ret && connect(additionalStyleSheetBtn, SIGNAL(clicked()), this, + SLOT(onEditAdditionalStyleSheet())); ret = ret && connect(check30bitBtn, SIGNAL(clicked()), this, SLOT(onCheck30bitDisplay())); assert(ret); diff --git a/toonz/sources/toonz/preferencespopup.h b/toonz/sources/toonz/preferencespopup.h index fb0bcd00..a233e733 100644 --- a/toonz/sources/toonz/preferencespopup.h +++ b/toonz/sources/toonz/preferencespopup.h @@ -17,6 +17,7 @@ // Qt includes #include #include +#include #include #include #include @@ -68,11 +69,13 @@ public: private: class FormatProperties; + class AdditionalStyleEdit; class Display30bitChecker; private: Preferences* m_pref; FormatProperties* m_formatProperties; + AdditionalStyleEdit* m_additionalStyleEdit; // DVGui::CheckBox *m_projectRootDocuments, *m_projectRootDesktop, // *m_projectRootCustom; @@ -175,6 +178,9 @@ private slots: void onAutoSaveExternallyChanged(); void onAutoSavePeriodExternallyChanged(); // void onProjectRootChanged(); + + void onEditAdditionalStyleSheet(); + void onAdditionalStyleSheetEdited(); void onPixelUnitExternallySelected(bool on); void onInterfaceFontChanged(const QString& text); void onLutPathChanged(); @@ -251,4 +257,27 @@ protected: void paintGL() override; }; +//********************************************************************************** +// PreferencesPopup::AdditionalStyleEdit definition +//********************************************************************************** + +class PreferencesPopup::AdditionalStyleEdit final : public DVGui::Dialog { + Q_OBJECT + +public: + AdditionalStyleEdit(PreferencesPopup* parent); + +private: + QTextEdit* m_edit; + +protected: + void showEvent(QShowEvent* e) override; + +private slots: + void onOK(); + void onApply(); +signals: + void additionalSheetEdited(); +}; + #endif // PREFERENCESPOPUP_H diff --git a/toonz/sources/toonzlib/preferences.cpp b/toonz/sources/toonzlib/preferences.cpp index c71229bf..a300b938 100644 --- a/toonz/sources/toonzlib/preferences.cpp +++ b/toonz/sources/toonzlib/preferences.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include // boost includes @@ -401,6 +402,7 @@ void Preferences::definePreferenceItems() { // Interface define(CurrentStyleSheetName, "CurrentStyleSheetName", QMetaType::QString, "Dark"); + define(additionalStyleSheet, "additionalStyleSheet", QMetaType::QString, ""); define(iconTheme, "iconTheme", QMetaType::Bool, false); define(pixelsOnly, "pixelsOnly", QMetaType::Bool, true); define(oldUnits, "oldUnits", QMetaType::QString, "mm"); @@ -993,13 +995,40 @@ QString Preferences::getCurrentLanguage() const { //----------------------------------------------------------------- -QString Preferences::getCurrentStyleSheetPath() const { +QString Preferences::getCurrentStyleSheet() const { QString currentStyleSheetName = getStringValue(CurrentStyleSheetName); if (currentStyleSheetName.isEmpty()) return QString(); TFilePath path(TEnv::getConfigDir() + "qss"); QString string = currentStyleSheetName + QString("/") + currentStyleSheetName + QString(".qss"); - return QString("file:///" + path.getQString() + "/" + string); + QString styleSheetPath = path.getQString() + "/" + string; + + QString additionalSheetStr = getStringValue(additionalStyleSheet); + // if there is no additional style sheet, return the path and let + // Qt to load and parse it + if (additionalSheetStr.isEmpty()) return QString("file:///" + styleSheetPath); + + // if there is any additional style sheet, load the style sheet + // from the file and combine with it + QString styleSheetStr; + QFile f(styleSheetPath); + if (f.open(QFile::ReadOnly | QFile::Text)) { + QTextStream ts(&f); + styleSheetStr = ts.readAll(); + } + styleSheetStr += additionalSheetStr; + + // here we will convert all relative paths to absolute paths + // or Qt will look for images relative to the current working directory + // since it has no idea where the style sheet comes from. + + QString currentStyleFolderPath = + path.getQString().replace("\\", "/") + "/" + currentStyleSheetName; + + styleSheetStr.replace(QRegExp("url\\(['\"]([^'\"]+)['\"]\\)"), + "url(\"" + currentStyleFolderPath + QString("/\\1\")")); + + return styleSheetStr; } //----------------------------------------------------------------- From 035837602c32c3194392c101b81117962fe26064 Mon Sep 17 00:00:00 2001 From: manongjohn Date: Sun, 24 Apr 2022 10:24:40 -0400 Subject: [PATCH 2/4] Apply skipped qss changes for OT PR 3714 --- stuff/config/qss/Dark/Dark.qss | 2 +- stuff/config/qss/Darker/Darker.qss | 2 +- stuff/config/qss/Light/Light.qss | 2 +- stuff/config/qss/Medium/Medium.qss | 2 +- .../config/qss/Medium/less/layouts/mainwindow.less | 2 +- stuff/config/qss/Neutral/Neutral.qss | 2 +- toonz/sources/toonzlib/preferences.cpp | 13 ++++++++++++- 7 files changed, 18 insertions(+), 7 deletions(-) diff --git a/stuff/config/qss/Dark/Dark.qss b/stuff/config/qss/Dark/Dark.qss index 5380002e..f992d5a5 100644 --- a/stuff/config/qss/Dark/Dark.qss +++ b/stuff/config/qss/Dark/Dark.qss @@ -310,7 +310,7 @@ QMenu { } QMenu::item { border: 0; - padding: 3 28; + padding: 3 28 3 8; } QMenu::item:selected { background-color: #a35293; diff --git a/stuff/config/qss/Darker/Darker.qss b/stuff/config/qss/Darker/Darker.qss index 37a55d00..2da79530 100644 --- a/stuff/config/qss/Darker/Darker.qss +++ b/stuff/config/qss/Darker/Darker.qss @@ -310,7 +310,7 @@ QMenu { } QMenu::item { border: 0; - padding: 3 28; + padding: 3 28 3 8; } QMenu::item:selected { background-color: #a35293; diff --git a/stuff/config/qss/Light/Light.qss b/stuff/config/qss/Light/Light.qss index 461159b7..b048ad9c 100644 --- a/stuff/config/qss/Light/Light.qss +++ b/stuff/config/qss/Light/Light.qss @@ -310,7 +310,7 @@ QMenu { } QMenu::item { border: 0; - padding: 3 28; + padding: 3 28 3 8; } QMenu::item:selected { background-color: #d97fbe; diff --git a/stuff/config/qss/Medium/Medium.qss b/stuff/config/qss/Medium/Medium.qss index efe96c01..e205c661 100644 --- a/stuff/config/qss/Medium/Medium.qss +++ b/stuff/config/qss/Medium/Medium.qss @@ -310,7 +310,7 @@ QMenu { } QMenu::item { border: 0; - padding: 3 28; + padding: 3 28 3 8; } QMenu::item:selected { background-color: #a35293; diff --git a/stuff/config/qss/Medium/less/layouts/mainwindow.less b/stuff/config/qss/Medium/less/layouts/mainwindow.less index 822f164a..d84ad76e 100644 --- a/stuff/config/qss/Medium/less/layouts/mainwindow.less +++ b/stuff/config/qss/Medium/less/layouts/mainwindow.less @@ -140,7 +140,7 @@ QMenu { padding: 2 0; &::item { border: 0; - padding: 3 28; + padding: 3 28 3 8; &:selected { background-color: @menu-item-bg-color-selected; color: @menu-item-text-color-selected; diff --git a/stuff/config/qss/Neutral/Neutral.qss b/stuff/config/qss/Neutral/Neutral.qss index 05549cb8..22e6eff4 100644 --- a/stuff/config/qss/Neutral/Neutral.qss +++ b/stuff/config/qss/Neutral/Neutral.qss @@ -310,7 +310,7 @@ QMenu { } QMenu::item { border: 0; - padding: 3 28; + padding: 3 28 3 8; } QMenu::item:selected { background-color: #c16099; diff --git a/toonz/sources/toonzlib/preferences.cpp b/toonz/sources/toonzlib/preferences.cpp index a300b938..6bff1ef2 100644 --- a/toonz/sources/toonzlib/preferences.cpp +++ b/toonz/sources/toonzlib/preferences.cpp @@ -402,7 +402,18 @@ void Preferences::definePreferenceItems() { // Interface define(CurrentStyleSheetName, "CurrentStyleSheetName", QMetaType::QString, "Dark"); - define(additionalStyleSheet, "additionalStyleSheet", QMetaType::QString, ""); + + // Qt has a bug in recent versions that Menu item Does not show correctly + // (QTBUG-90242) Since the current OT is made to handle such issue, so we need + // to apply an extra adjustment when it is run on the older versions (5.9.x) + // of Qt + QString defaultAditionalSheet = ""; +#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) + defaultAditionalSheet = "QMenu::Item{ padding: 3 28 3 28; }"; +#endif + + define(additionalStyleSheet, "additionalStyleSheet", QMetaType::QString, + defaultAditionalSheet); define(iconTheme, "iconTheme", QMetaType::Bool, false); define(pixelsOnly, "pixelsOnly", QMetaType::Bool, true); define(oldUnits, "oldUnits", QMetaType::QString, "mm"); From 53ead8192398ba7680f4995d9a50529aa89f670e Mon Sep 17 00:00:00 2001 From: shun-iwasawa Date: Thu, 18 Mar 2021 11:58:48 +0900 Subject: [PATCH 3/4] fix additional style sheet condition --- toonz/sources/toonzlib/preferences.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/toonz/sources/toonzlib/preferences.cpp b/toonz/sources/toonzlib/preferences.cpp index 6bff1ef2..6b6be358 100644 --- a/toonz/sources/toonzlib/preferences.cpp +++ b/toonz/sources/toonzlib/preferences.cpp @@ -407,8 +407,9 @@ void Preferences::definePreferenceItems() { // (QTBUG-90242) Since the current OT is made to handle such issue, so we need // to apply an extra adjustment when it is run on the older versions (5.9.x) // of Qt + // Update: confirmed that the bug does not appear at least in Qt 5.12.8 QString defaultAditionalSheet = ""; -#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) +#if QT_VERSION < QT_VERSION_CHECK(5, 12, 9) defaultAditionalSheet = "QMenu::Item{ padding: 3 28 3 28; }"; #endif From 9587dda7fa001e6423cad003c14717db95455ab1 Mon Sep 17 00:00:00 2001 From: manongjohn Date: Sun, 24 Apr 2022 11:40:36 -0400 Subject: [PATCH 4/4] Fix small linux application font size --- toonz/sources/toonzlib/preferences.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/toonz/sources/toonzlib/preferences.cpp b/toonz/sources/toonzlib/preferences.cpp index 6b6be358..2a7dc3d3 100644 --- a/toonz/sources/toonzlib/preferences.cpp +++ b/toonz/sources/toonzlib/preferences.cpp @@ -413,6 +413,13 @@ void Preferences::definePreferenceItems() { defaultAditionalSheet = "QMenu::Item{ padding: 3 28 3 28; }"; #endif + // Linux system font size appears a lot smaller than it should be despite + // setting QApplication's setPixelSize = 12 in main.cpp. We'll correct it using + // the additional stylesheet. +#if defined(LINUX) || defined(FREEBSD) + defaultAditionalSheet = "QWidget { font: 12px; }" + defaultAditionalSheet; +#endif + define(additionalStyleSheet, "additionalStyleSheet", QMetaType::QString, defaultAditionalSheet); define(iconTheme, "iconTheme", QMetaType::Bool, false);