Add a button in config page for open Qfontdialog widget

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5168 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
scorpio810
2017-12-11 00:52:33 +00:00
parent 2d20fb3081
commit 925b54920e
2 changed files with 26 additions and 9 deletions

View File

@@ -253,14 +253,8 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) : ConfigPage
terminal_exportlist_ = new QCheckBox(tr("Exporter les bornes dans la nomenclature"), projects_view_mode_);
m_zoom_out_beyond_folio = new QCheckBox(tr("Autoriser le dézoom au delà du folio"), this);
bool ok;
QFont font = QFontDialog::getFont(&ok, QFont(), this);
if (ok) {
settings.setValue("diagramitemfont", font.family());
settings.setValue("diagramitemsize", font.pointSize());
settings.setValue("diagramitemweight", font.weight());
settings.setValue("diagramitemstyle", font.styleName());
}
QPushButton *fontButton = new QPushButton(tr("Choix de la police de texte utilisée pour les textes independants"));
elements_management_ = new QGroupBox(tr("Gestion des éléments"), this);
highlight_integrated_elements_ = new QCheckBox(tr("Mettre en valeur dans le panel les éléments fraîchement intégrés", "configuration option"));
@@ -304,7 +298,8 @@ if (ok) {
projects_view_mode_layout -> addWidget(save_label_paste_);
projects_view_mode_layout -> addWidget(folio_panel_);
projects_view_mode_layout -> addWidget(terminal_exportlist_);
projects_view_mode_layout-> addWidget(fontButton, 0, 0);
connect(fontButton, SIGNAL(clicked()), this, SLOT(setFont()));
projects_view_mode_ -> setLayout(projects_view_mode_layout);
QVBoxLayout *elements_management_layout = new QVBoxLayout();
@@ -525,3 +520,20 @@ QIcon PrintConfigPage::icon() const {
QString PrintConfigPage::title() const {
return(tr("Impression", "configuration page title"));
}
/**
* @brief GeneralConfigurationPage::setFont
* Apply font to config
*/
void GeneralConfigurationPage::setFont()
{
bool ok;
QSettings settings;
QFont font = QFontDialog::getFont(&ok, QFont(), this);
if (ok) {
settings.setValue("diagramitemfont", font.family());
settings.setValue("diagramitemsize", font.pointSize());
settings.setValue("diagramitemweight", font.weight());
settings.setValue("diagramitemstyle", font.styleName());
}
}

View File

@@ -18,6 +18,7 @@
#ifndef CONFIG_PAGES_H
#define CONFIG_PAGES_H
#include <QtWidgets>
#include <QDialog>
#include "configpage.h"
#include "projectpropertiesdialog.h"
#include "titleblockpropertieswidget.h"
@@ -90,6 +91,9 @@ class GeneralConfigurationPage : public ConfigPage {
private:
void fillLang(QSettings &);
public slots:
void setFont();
// attributes
private:
QLabel *title_label_;
@@ -112,6 +116,7 @@ class GeneralConfigurationPage : public ConfigPage {
QGroupBox *lang_group_box;
QComboBox *lang_combo_box;
QLabel *lang_label;
QPushButton *fontButton;
};
/**