src/settingseditor/settingseditor.cpp

changeset 335
c5830bce1c23
parent 296
38f6fad61bad
child 341
71c8cea3c205
--- a/src/settingseditor/settingseditor.cpp	Thu Jul 14 16:47:59 2022 +0300
+++ b/src/settingseditor/settingseditor.cpp	Wed Jul 20 12:59:07 2022 +0300
@@ -22,6 +22,11 @@
 	this->ui.keyboardShortcutsView->setModel(new KeyboardShortcutsEditor{parent, this});
 	this->ui.viewModeButtonGroup->setId(this->ui.viewModeTabs, int{QMdiArea::TabbedView});
 	this->ui.viewModeButtonGroup->setId(this->ui.viewModeSubWindows, int{QMdiArea::SubWindowView});
+	this->ui.toolButtonStyle->addItem(tr("Icons only"), Qt::ToolButtonIconOnly);
+	this->ui.toolButtonStyle->addItem(tr("Text only"), Qt::ToolButtonTextOnly);
+	this->ui.toolButtonStyle->addItem(tr("Text beside icon"), Qt::ToolButtonTextBesideIcon);
+	this->ui.toolButtonStyle->addItem(tr("Text under icon"), Qt::ToolButtonTextUnderIcon);
+	this->ui.toolButtonStyle->addItem(tr("Style default"), Qt::ToolButtonFollowStyle);
 	this->loadSettings();
 	this->setWindowTitle(tr("Settings"));
 	this->setWindowIcon(QIcon{":/icons/settings-outline.png"});
@@ -55,6 +60,11 @@
 	if (viewMode != -1) {
 		setSetting<Setting::ViewMode>(static_cast<QMdiArea::ViewMode>(viewMode));
 	}
+	const QVariant toolButtonStyle = this->ui.toolButtonStyle->currentData();
+	if (toolButtonStyle.isValid()) {
+		setSetting<Setting::ToolButtonStyle>(
+			static_cast<Qt::ToolButtonStyle>(toolButtonStyle.toInt()));
+	}
 	this->librariesEditor.saveSettings();
 	Q_EMIT this->settingsChanged();
 }
@@ -72,4 +82,9 @@
 	if (viewModeButton != nullptr) {
 		viewModeButton->setChecked(true);
 	}
+	int toolButtonStyleIndex = this->ui.toolButtonStyle->findData(
+		setting<Setting::ToolButtonStyle>());
+	if (toolButtonStyleIndex != -1) {
+		this->ui.toolButtonStyle->setCurrentIndex(toolButtonStyleIndex);
+	}
 }

mercurial