GUI experts say that just use tool button icons not very good choise. This way

good only for standard icons. I added option show text under icon.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-04-11 21:20:37 +03:00
parent 31676f3684
commit 9466da601c
10 changed files with 174 additions and 10 deletions

View File

@ -42,6 +42,7 @@ const QString VSettings::SettingConfigurationUnit = QStringLitera
const QString VSettings::SettingConfigurationLabelLanguage = QStringLiteral("configuration/label_language");
const QString VSettings::SettingConfigurationConfirmItemDeletion
= QStringLiteral("configuration/confirm_item_deletion");
const QString VSettings::SettingConfigurationToolBarStyle = QStringLiteral("configuration/tool_bar_style");
const QString VSettings::SettingPathsIndividualMeasurements = QStringLiteral("paths/individual_measurements");
const QString VSettings::SettingPathsStandardMeasurements = QStringLiteral("paths/standard_measurements");
@ -178,6 +179,18 @@ void VSettings::SetConfirmItemDelete(const bool &value)
setValue(SettingConfigurationConfirmItemDeletion, value);
}
//---------------------------------------------------------------------------------------------------------------------
bool VSettings::GetToolBarStyle() const
{
return value(SettingConfigurationToolBarStyle, 1).toBool();
}
//---------------------------------------------------------------------------------------------------------------------
void VSettings::SetToolBarStyle(const bool &value)
{
setValue(SettingConfigurationToolBarStyle, value);
}
//---------------------------------------------------------------------------------------------------------------------
QString VSettings::GetPathIndividualMeasurements() const
{

View File

@ -64,6 +64,9 @@ public:
bool GetConfirmItemDelete() const;
void SetConfirmItemDelete(const bool &value);
bool GetToolBarStyle() const;
void SetToolBarStyle(const bool &value);
QString GetPathIndividualMeasurements() const;
void SetPathIndividualMeasurements(const QString &value);
@ -137,6 +140,7 @@ private:
static const QString SettingConfigurationUnit;
static const QString SettingConfigurationLabelLanguage;
static const QString SettingConfigurationConfirmItemDeletion;
static const QString SettingConfigurationToolBarStyle;
static const QString SettingPathsIndividualMeasurements;
static const QString SettingPathsStandardMeasurements;

View File

@ -46,18 +46,20 @@
ConfigurationPage::ConfigurationPage(QWidget *parent)
: QWidget(parent), autoSaveCheck(nullptr), autoTime(nullptr), langCombo(nullptr), labelCombo(nullptr),
unitCombo(nullptr), osOptionCheck(nullptr), langChanged(false), unitChanged(false), labelLangChanged(false),
sendReportCheck(nullptr), askPointDeletionCheck(nullptr)
sendReportCheck(nullptr), askPointDeletionCheck(nullptr), toolBarStyleCheck(nullptr)
{
QGroupBox *saveGroup = SaveGroup();
QGroupBox *langGroup = LangGroup();
QGroupBox *sendGroup = SendGroup();
QGroupBox *drawGroup = DrawGroup();
QGroupBox *toolBarGroup = ToolBarGroup();
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(saveGroup);
mainLayout->addWidget(langGroup);
mainLayout->addWidget(sendGroup);
mainLayout->addWidget(drawGroup);
mainLayout->addWidget(toolBarGroup);
mainLayout->addStretch(1);
setLayout(mainLayout);
}
@ -76,6 +78,7 @@ void ConfigurationPage::Apply()
qApp->getSettings()->SetOsSeparator(osOptionCheck->isChecked());
qApp->getSettings()->SetSendReportState(sendReportCheck->isChecked());
qApp->getSettings()->SetConfirmItemDelete(askPointDeletionCheck->isChecked());
qApp->getSettings()->SetToolBarStyle(toolBarStyleCheck->isChecked());
if (langChanged)
{
@ -289,6 +292,21 @@ QGroupBox *ConfigurationPage::DrawGroup()
return drawGroup;
}
//---------------------------------------------------------------------------------------------------------------------
QGroupBox *ConfigurationPage::ToolBarGroup()
{
QGroupBox *toolBarGroup = new QGroupBox(tr("Toolbar"));
toolBarStyleCheck = new QCheckBox(tr("The text appears under the icon. (recommended for beginners.)"));
toolBarStyleCheck->setChecked(qApp->getSettings()->GetToolBarStyle());
QVBoxLayout *editLayout = new QVBoxLayout;
editLayout->addWidget(toolBarStyleCheck);
toolBarGroup->setLayout(editLayout);
return toolBarGroup;
}
//---------------------------------------------------------------------------------------------------------------------
void ConfigurationPage::SetLabelComboBox(const QStringList &list)
{

View File

@ -60,11 +60,13 @@ private:
bool labelLangChanged;
QCheckBox *sendReportCheck;
QCheckBox *askPointDeletionCheck;
QCheckBox *toolBarStyleCheck;
QGroupBox *SaveGroup();
QGroupBox *LangGroup();
QGroupBox *SendGroup();
QGroupBox *DrawGroup();
QGroupBox *ToolBarGroup();
void SetLabelComboBox(const QStringList &list);
};

View File

@ -1419,6 +1419,7 @@ void MainWindow::Preferences()
ConfigDialog dlg(this);
connect(&dlg, &ConfigDialog::UpdateProperties, this, &MainWindow::WindowsLocale); // Must be first
connect(&dlg, &ConfigDialog::UpdateProperties, toolOptions, &VToolOptionsPropertyBrowser::RefreshOptions);
connect(&dlg, &ConfigDialog::UpdateProperties, this, &MainWindow::ToolBarStyles);
if (dlg.exec() == QDialog::Accepted)
{
InitAutoSave();
@ -2111,6 +2112,9 @@ void MainWindow::ReadSettings()
// Stack limit
qApp->getUndoStack()->setUndoLimit(qApp->getSettings()->GetUndoCount());
// Text under tool buton icon
ToolBarStyles();
}
//---------------------------------------------------------------------------------------------------------------------
@ -2623,6 +2627,30 @@ void MainWindow::WindowsLocale()
qApp->getSettings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolBarStyles()
{
ToolBarStyle(ui->toolBarArrows);
ToolBarStyle(ui->toolBarDraws);
ToolBarStyle(ui->toolBarOption);
ToolBarStyle(ui->toolBarStages);
ToolBarStyle(ui->toolBarTools);
ToolBarStyle(ui->mainToolBar);
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolBarStyle(QToolBar *bar)
{
if (qApp->getSettings()->GetToolBarStyle())
{
bar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
}
else
{
bar->setToolButtonStyle(Qt::ToolButtonIconOnly);
}
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ReopenFilesAfterCrash(QStringList &args)
{

View File

@ -134,6 +134,7 @@ public slots:
void UpdateGradation();
void GlobalChangePP(const QString &patternPiece);
void WindowsLocale();
void ToolBarStyles();
signals:
/**
* @brief ModelChosen emit after calculation all details.
@ -271,6 +272,7 @@ private:
bool OpenNewValentina(const QString &fileName = QString())const;
void FileClosedCorrect();
QStringList GetUnlokedRestoreFileList()const;
void ToolBarStyle(QToolBar *bar);
};
#endif // MAINWINDOW_H

View File

@ -825,9 +825,17 @@
<addaction name="menuHelp"/>
</widget>
<widget class="QToolBar" name="mainToolBar">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="windowTitle">
<string>Toolbar files</string>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
@ -843,9 +851,17 @@
<property name="enabled">
<bool>true</bool>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="windowTitle">
<string>ToolBar modes</string>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
@ -857,9 +873,17 @@
<addaction name="actionLayout"/>
</widget>
<widget class="QToolBar" name="toolBarDraws">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="windowTitle">
<string>Toolbar pattern</string>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
@ -869,9 +893,17 @@
<addaction name="actionNewDraw"/>
</widget>
<widget class="QToolBar" name="toolBarOption">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="windowTitle">
<string>Toolbar options</string>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
<attribute name="toolBarArea">
<enum>BottomToolBarArea</enum>
</attribute>
@ -883,9 +915,17 @@
<property name="enabled">
<bool>true</bool>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="windowTitle">
<string>Toolbar tools</string>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
@ -914,9 +954,17 @@
<widget class="QWidget" name="dockWidgetContents_10"/>
</widget>
<widget class="QToolBar" name="toolBarArrows">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="windowTitle">
<string>toolBar</string>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
@ -1058,7 +1106,7 @@
<normaloff>:/icon/32x32/arrow_cursor.png</normaloff>:/icon/32x32/arrow_cursor.png</iconset>
</property>
<property name="text">
<string>Pointer tools</string>
<string>Pointer</string>
</property>
<property name="toolTip">
<string>Pointer tools</string>
@ -1085,7 +1133,7 @@
<normaloff>:/icon/32x32/option_draw.png</normaloff>:/icon/32x32/option_draw.png</iconset>
</property>
<property name="text">
<string>Change the label of pattern piece</string>
<string>Config pattern piece</string>
</property>
<property name="toolTip">
<string>Change the label of pattern piece</string>
@ -1133,7 +1181,7 @@
<normaloff>:/icon/32x32/layout.png</normaloff>:/icon/32x32/layout.png</iconset>
</property>
<property name="text">
<string>Export pattern (layout)</string>
<string>Export pattern</string>
</property>
<property name="toolTip">
<string>Create layout</string>

View File

@ -84,6 +84,8 @@ TableWindow::TableWindow(QWidget *parent)
connect(ui->actionPrint_pre_view, &QAction::triggered, this, &TableWindow::PrintPreview);
connect(ui->action_Print, &QAction::triggered, this, &TableWindow::LayoutPrint);
connect(ui->actionSave_to_p_df, &QAction::triggered, this, &TableWindow::PrintToPdf);
ReadSettings();
}
//---------------------------------------------------------------------------------------------------------------------
@ -754,3 +756,30 @@ void TableWindow::EnableActions(bool enable)
ui->actionPrint_pre_view->setEnabled(enable);
ui->action_Print->setEnabled(enable);
}
//---------------------------------------------------------------------------------------------------------------------
void TableWindow::ToolBarStyle(QToolBar *bar)
{
if (qApp->getSettings()->GetToolBarStyle())
{
bar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
}
else
{
bar->setToolButtonStyle(Qt::ToolButtonIconOnly);
}
}
//---------------------------------------------------------------------------------------------------------------------
void TableWindow::ReadSettings()
{
// Text under tool buton icon
ToolBarStyles();
}
//---------------------------------------------------------------------------------------------------------------------
void TableWindow::ToolBarStyles()
{
ToolBarStyle(ui->toolBar);
ToolBarStyle(ui->toolBar_2);
}

View File

@ -113,6 +113,9 @@ private:
QMap<QString, QString> InitFormates() const;
void EnableActions(bool enable);
void ToolBarStyle(QToolBar *bar);
void ReadSettings();
void ToolBarStyles();
};
#endif // TABLEWINDOW_H

View File

@ -38,6 +38,11 @@
</layout>
</widget>
<widget class="QToolBar" name="toolBar">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="windowTitle">
<string>Main toolbar</string>
</property>
@ -48,7 +53,7 @@
</size>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonIconOnly</enum>
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
@ -170,9 +175,17 @@
<addaction name="menuLayout"/>
</widget>
<widget class="QToolBar" name="toolBar_2">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="windowTitle">
<string>Toolbar print</string>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
@ -209,10 +222,10 @@
</iconset>
</property>
<property name="text">
<string>Stop</string>
<string>Back</string>
</property>
<property name="toolTip">
<string>Stop laying</string>
<string>Back to main window</string>
</property>
</action>
<action name="actionZoomIn">
@ -247,7 +260,7 @@
<normaloff>:/icon/32x32/layout.png</normaloff>:/icon/32x32/layout.png</iconset>
</property>
<property name="text">
<string>Layout</string>
<string>Generate a layout</string>
</property>
</action>
<action name="actionPrint_pre_view">
@ -255,7 +268,9 @@
<bool>false</bool>
</property>
<property name="icon">
<iconset theme="document-print-preview"/>
<iconset theme="document-print-preview">
<normaloff/>
</iconset>
</property>
<property name="text">
<string>Print pre&amp;view...</string>
@ -266,7 +281,9 @@
<bool>false</bool>
</property>
<property name="icon">
<iconset theme="document-print"/>
<iconset theme="document-print">
<normaloff/>
</iconset>
</property>
<property name="text">
<string>&amp;Print...</string>