mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 05:00:33 +01:00
Add a button in config page for open a new Qfontdialog widget and choose
font for summarry pages (foliolist) git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5189 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -261,6 +261,13 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) : ConfigPage
|
|||||||
fontButton = new QPushButton(fontInfos);
|
fontButton = new QPushButton(fontInfos);
|
||||||
fontButton->setMinimumHeight(28);
|
fontButton->setMinimumHeight(28);
|
||||||
|
|
||||||
|
QString foliolistfontInfos = settings.value("foliolistfont").toString() + " " +
|
||||||
|
settings.value("foliolistsize").toString() + " (" +
|
||||||
|
settings.value("folioliststyle").toString() + ")";
|
||||||
|
foliolist_font_label = new QLabel(tr("Police des champs des pages sommaires"));
|
||||||
|
foliolist_fontButton = new QPushButton(foliolistfontInfos);
|
||||||
|
foliolist_fontButton->setMinimumHeight(28);
|
||||||
|
|
||||||
elements_management_ = new QGroupBox(tr("Gestion des éléments"), this);
|
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"));
|
highlight_integrated_elements_ = new QCheckBox(tr("Mettre en valeur dans le panel les éléments fraîchement intégrés", "configuration option"));
|
||||||
default_element_infos_label_ = new QLabel(
|
default_element_infos_label_ = new QLabel(
|
||||||
@@ -297,6 +304,7 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) : ConfigPage
|
|||||||
|
|
||||||
QVBoxLayout *projects_view_mode_layout = new QVBoxLayout;
|
QVBoxLayout *projects_view_mode_layout = new QVBoxLayout;
|
||||||
QHBoxLayout *font_view_layout = new QHBoxLayout;
|
QHBoxLayout *font_view_layout = new QHBoxLayout;
|
||||||
|
QHBoxLayout *foliolist_font_view_layout = new QHBoxLayout;
|
||||||
projects_view_mode_layout -> addWidget(windowed_mode_);
|
projects_view_mode_layout -> addWidget(windowed_mode_);
|
||||||
projects_view_mode_layout -> addWidget(tabbed_mode_);
|
projects_view_mode_layout -> addWidget(tabbed_mode_);
|
||||||
projects_view_mode_layout -> addWidget(m_zoom_out_beyond_folio);
|
projects_view_mode_layout -> addWidget(m_zoom_out_beyond_folio);
|
||||||
@@ -305,11 +313,17 @@ GeneralConfigurationPage::GeneralConfigurationPage(QWidget *parent) : ConfigPage
|
|||||||
projects_view_mode_layout -> addWidget(folio_panel_);
|
projects_view_mode_layout -> addWidget(folio_panel_);
|
||||||
projects_view_mode_layout -> addWidget(terminal_exportlist_);
|
projects_view_mode_layout -> addWidget(terminal_exportlist_);
|
||||||
font_view_layout->addWidget(font_label, 1);
|
font_view_layout->addWidget(font_label, 1);
|
||||||
font_view_layout->addWidget(fontButton, 0);
|
font_view_layout->addWidget(fontButton, 0);
|
||||||
|
foliolist_font_view_layout->addWidget(foliolist_font_label, 1);
|
||||||
|
foliolist_font_view_layout->addWidget(foliolist_fontButton, 0);
|
||||||
projects_view_mode_layout-> addLayout(font_view_layout);
|
projects_view_mode_layout-> addLayout(font_view_layout);
|
||||||
|
projects_view_mode_layout-> addLayout(foliolist_font_view_layout);
|
||||||
projects_view_mode_ -> setLayout(projects_view_mode_layout);
|
projects_view_mode_ -> setLayout(projects_view_mode_layout);
|
||||||
|
|
||||||
|
|
||||||
connect(fontButton, SIGNAL(clicked()), this, SLOT(setFont()));
|
connect(fontButton, SIGNAL(clicked()), this, SLOT(setFont()));
|
||||||
|
connect(foliolist_fontButton, SIGNAL(clicked()), this, SLOT(setFoliolistFont()));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QVBoxLayout *elements_management_layout = new QVBoxLayout();
|
QVBoxLayout *elements_management_layout = new QVBoxLayout();
|
||||||
@@ -550,4 +564,23 @@ void GeneralConfigurationPage::setFont()
|
|||||||
fontButton->setText(fontInfos);
|
fontButton->setText(fontInfos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @brief GeneralConfigurationPage::setFoliolistFont
|
||||||
|
* * Apply font to summary pages
|
||||||
|
*/
|
||||||
|
void GeneralConfigurationPage::setFoliolistFont()
|
||||||
|
{
|
||||||
|
bool ok;
|
||||||
|
QSettings settings;
|
||||||
|
QFont font = QFontDialog::getFont(&ok, QFont(), this);
|
||||||
|
if (ok) {
|
||||||
|
settings.setValue("foliolistfont", font.family());
|
||||||
|
settings.setValue("foliolistsize", font.pointSize());
|
||||||
|
settings.setValue("foliolistweight", font.weight());
|
||||||
|
settings.setValue("folioliststyle", font.styleName());
|
||||||
|
QString fontInfos = settings.value("foliolistfont").toString() + " " +
|
||||||
|
settings.value("foliolistsize").toString() + " (" +
|
||||||
|
settings.value("folioliststyle").toString() + ")";
|
||||||
|
foliolist_fontButton->setText(fontInfos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ class GeneralConfigurationPage : public ConfigPage {
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setFont();
|
void setFont();
|
||||||
|
void setFoliolistFont();
|
||||||
|
|
||||||
// attributes
|
// attributes
|
||||||
private:
|
private:
|
||||||
@@ -116,8 +117,10 @@ public slots:
|
|||||||
QGroupBox *lang_group_box;
|
QGroupBox *lang_group_box;
|
||||||
QComboBox *lang_combo_box;
|
QComboBox *lang_combo_box;
|
||||||
QLabel *lang_label;
|
QLabel *lang_label;
|
||||||
QLabel *font_label;
|
QLabel *font_label;
|
||||||
QPushButton *fontButton;
|
QPushButton *fontButton;
|
||||||
|
QLabel *foliolist_font_label;
|
||||||
|
QPushButton *foliolist_fontButton;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -127,9 +127,9 @@ void DiagramFolioList::fillRow(QPainter *qp, const QRectF &row_rect, QString aut
|
|||||||
QSettings settings;
|
QSettings settings;
|
||||||
|
|
||||||
|
|
||||||
QFontMetrics origFontMetrics(QETApp::diagramTextsFont());
|
QFontMetrics origFontMetrics(QETApp::foliolistTextsFont());
|
||||||
qreal origFontSize = QETApp::diagramTextsFont().pointSizeF();
|
qreal origFontSize = QETApp::foliolistTextsFont().pointSizeF();
|
||||||
QFont workingFont(QETApp::diagramTextsFont());
|
QFont workingFont(QETApp::foliolistTextsFont());
|
||||||
|
|
||||||
if (settings.value("genericpanel/folio", true).toBool()){
|
if (settings.value("genericpanel/folio", true).toBool()){
|
||||||
// reduce the font size if the text entry is long
|
// reduce the font size if the text entry is long
|
||||||
|
|||||||
@@ -806,6 +806,30 @@ QFont QETApp::diagramTextsItemFont(qreal size)
|
|||||||
}
|
}
|
||||||
return(diagram_texts_item_font);
|
return(diagram_texts_item_font);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @brief QETApp::foliolistTextsFont
|
||||||
|
* the font for to use in summary pages
|
||||||
|
* @param size
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
QFont QETApp::foliolistTextsFont(qreal size)
|
||||||
|
{
|
||||||
|
QSettings settings;
|
||||||
|
|
||||||
|
//Font to use
|
||||||
|
QString foliolist_texts_family = settings.value("foliolistfont", "Sans Serif").toString();
|
||||||
|
qreal foliolist_texts_size = settings.value("foliolistsize", 9.0).toDouble();
|
||||||
|
|
||||||
|
if (size != -1.0) {
|
||||||
|
foliolist_texts_size = size;
|
||||||
|
}
|
||||||
|
QFont foliolist_texts_font = QFont(foliolist_texts_family);
|
||||||
|
foliolist_texts_font.setPointSizeF(foliolist_texts_size);
|
||||||
|
if (foliolist_texts_size <= 4.0) {
|
||||||
|
foliolist_texts_font.setWeight(QFont::Light);
|
||||||
|
}
|
||||||
|
return(foliolist_texts_font);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ class QETApp : public QETSingleApplication {
|
|||||||
static QString lang_dir; ///< Directory containing localization files.
|
static QString lang_dir; ///< Directory containing localization files.
|
||||||
static QFont diagramTextsFont(qreal = -1.0);
|
static QFont diagramTextsFont(qreal = -1.0);
|
||||||
static QFont diagramTextsItemFont(qreal = -1.0);
|
static QFont diagramTextsItemFont(qreal = -1.0);
|
||||||
|
static QFont foliolistTextsFont(qreal = -1.0);
|
||||||
static QETDiagramEditor *diagramEditorForFile(const QString &);
|
static QETDiagramEditor *diagramEditorForFile(const QString &);
|
||||||
static QETDiagramEditor *diagramEditorAncestorOf (const QWidget *child);
|
static QETDiagramEditor *diagramEditorAncestorOf (const QWidget *child);
|
||||||
static QList<QETDiagramEditor *> diagramEditors();
|
static QList<QETDiagramEditor *> diagramEditors();
|
||||||
|
|||||||
Reference in New Issue
Block a user