mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-21 08:40:53 +01:00
Centralisation du nom de la police a utiliser pour le rendu de texte
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@242 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
#include "customelement.h"
|
#include "customelement.h"
|
||||||
#include "elementtextitem.h"
|
#include "elementtextitem.h"
|
||||||
#include "diagram.h"
|
#include "diagram.h"
|
||||||
|
#include "qetapp.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
/**
|
/**
|
||||||
Constructeur de la classe ElementPerso. Permet d'instancier un element
|
Constructeur de la classe ElementPerso. Permet d'instancier un element
|
||||||
@@ -389,7 +390,7 @@ bool CustomElement::parseText(QDomElement &e, QPainter &qp) {
|
|||||||
|
|
||||||
qp.save();
|
qp.save();
|
||||||
setPainterStyle(e, qp);
|
setPainterStyle(e, qp);
|
||||||
qp.setFont(QFont(QString("Sans Serif"), size));
|
qp.setFont(QFont(QString(QETApp::diagramTextsFont()), size));
|
||||||
qp.drawText(QPointF(pos_x, pos_y), e.attribute("text"));
|
qp.drawText(QPointF(pos_x, pos_y), e.attribute("text"));
|
||||||
qp.restore();
|
qp.restore();
|
||||||
return(true);
|
return(true);
|
||||||
@@ -417,7 +418,7 @@ bool CustomElement::parseInput(QDomElement &e) {
|
|||||||
) return(false);
|
) return(false);
|
||||||
|
|
||||||
ElementTextItem *eti = new ElementTextItem(e.attribute("text"), this);
|
ElementTextItem *eti = new ElementTextItem(e.attribute("text"), this);
|
||||||
eti -> setFont(QFont("Sans Serif", size));
|
eti -> setFont(QFont(QETApp::diagramTextsFont(), size));
|
||||||
eti -> setPos(pos_x, pos_y);
|
eti -> setPos(pos_x, pos_y);
|
||||||
if (e.attribute("rotate") == "true") eti -> setFollowParentRotations(true);
|
if (e.attribute("rotate") == "true") eti -> setFollowParentRotations(true);
|
||||||
return(true);
|
return(true);
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
#include "parttext.h"
|
#include "parttext.h"
|
||||||
#include "texteditor.h"
|
#include "texteditor.h"
|
||||||
#include "elementscene.h"
|
#include "elementscene.h"
|
||||||
|
#include "qetapp.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Constructeur
|
Constructeur
|
||||||
@@ -51,7 +52,7 @@ void PartText::fromXml(const QDomElement &xml_element) {
|
|||||||
int font_size = xml_element.attribute("size").toInt(&ok);
|
int font_size = xml_element.attribute("size").toInt(&ok);
|
||||||
if (!ok || font_size < 1) font_size = 20;
|
if (!ok || font_size < 1) font_size = 20;
|
||||||
|
|
||||||
setFont(QFont(QString("Sans Serif"), font_size));
|
setFont(QFont(QString(QETApp::diagramTextsFont()), font_size));
|
||||||
setPlainText(xml_element.attribute("text"));
|
setPlainText(xml_element.attribute("text"));
|
||||||
setPos(
|
setPos(
|
||||||
xml_element.attribute("x").toDouble(),
|
xml_element.attribute("x").toDouble(),
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "parttextfield.h"
|
#include "parttextfield.h"
|
||||||
#include "textfieldeditor.h"
|
#include "textfieldeditor.h"
|
||||||
|
#include "qetapp.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Constructeur
|
Constructeur
|
||||||
@@ -50,7 +51,7 @@ void PartTextField::fromXml(const QDomElement &xml_element) {
|
|||||||
int font_size = xml_element.attribute("size").toInt(&ok);
|
int font_size = xml_element.attribute("size").toInt(&ok);
|
||||||
if (!ok || font_size < 1) font_size = 20;
|
if (!ok || font_size < 1) font_size = 20;
|
||||||
|
|
||||||
setFont(QFont(QString("Sans Serif"), font_size));
|
setFont(QFont(QString(QETApp::diagramTextsFont()), font_size));
|
||||||
setPlainText(xml_element.attribute("text"));
|
setPlainText(xml_element.attribute("text"));
|
||||||
setPos(
|
setPos(
|
||||||
xml_element.attribute("x").toDouble(),
|
xml_element.attribute("x").toDouble(),
|
||||||
|
|||||||
12
qetapp.cpp
12
qetapp.cpp
@@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
QString QETApp::common_elements_dir = QString();
|
QString QETApp::common_elements_dir = QString();
|
||||||
QString QETApp::config_dir = QString();
|
QString QETApp::config_dir = QString();
|
||||||
|
QString QETApp::diagram_texts_font = QString();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Constructeur
|
Constructeur
|
||||||
@@ -121,6 +122,9 @@ QETApp::QETApp(int &argc, char **argv) : QApplication(argc, argv) {
|
|||||||
// lit le fichier de configuration
|
// lit le fichier de configuration
|
||||||
qet_settings = new QSettings(configDir() + "qelectrotech.conf", QSettings::IniFormat, this);
|
qet_settings = new QSettings(configDir() + "qelectrotech.conf", QSettings::IniFormat, this);
|
||||||
|
|
||||||
|
// police a utiliser pour le rendu de texte
|
||||||
|
diagram_texts_font = qet_settings -> value("diagramfont", "Sans Serif").toString();
|
||||||
|
|
||||||
// Creation et affichage d'un editeur de schema
|
// Creation et affichage d'un editeur de schema
|
||||||
QStringList files;
|
QStringList files;
|
||||||
foreach(QString argument, arguments()) {
|
foreach(QString argument, arguments()) {
|
||||||
@@ -140,7 +144,7 @@ QETApp::~QETApp() {
|
|||||||
@param desired_language langage voulu
|
@param desired_language langage voulu
|
||||||
*/
|
*/
|
||||||
void QETApp::setLanguage(const QString &desired_language) {
|
void QETApp::setLanguage(const QString &desired_language) {
|
||||||
QString languages_path = QETApp::languagesPath();
|
QString languages_path = languagesPath();
|
||||||
|
|
||||||
// charge les eventuelles traductions pour la lib Qt
|
// charge les eventuelles traductions pour la lib Qt
|
||||||
qtTranslator.load("qt_" + desired_language, languages_path);
|
qtTranslator.load("qt_" + desired_language, languages_path);
|
||||||
@@ -247,7 +251,7 @@ QString QETApp::commonElementsDir() {
|
|||||||
@return Le chemin du dossier des elements persos
|
@return Le chemin du dossier des elements persos
|
||||||
*/
|
*/
|
||||||
QString QETApp::customElementsDir() {
|
QString QETApp::customElementsDir() {
|
||||||
return(QETApp::configDir() + "elements/");
|
return(configDir() + "elements/");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -370,6 +374,10 @@ bool QETApp::closeEveryEditor() {
|
|||||||
return(every_window_closed);
|
return(every_window_closed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString QETApp::diagramTextsFont() {
|
||||||
|
return(diagram_texts_font);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Nettoie certaines choses avant que l'application ne quitte
|
Nettoie certaines choses avant que l'application ne quitte
|
||||||
*/
|
*/
|
||||||
|
|||||||
3
qetapp.h
3
qetapp.h
@@ -62,6 +62,8 @@ class QETApp : public QApplication {
|
|||||||
private:
|
private:
|
||||||
static QString config_dir; ///< Dossier contenant la configuration et la collection d'elements de l'utilisateur
|
static QString config_dir; ///< Dossier contenant la configuration et la collection d'elements de l'utilisateur
|
||||||
#endif
|
#endif
|
||||||
|
public:
|
||||||
|
static QString diagramTextsFont();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool event(QEvent *);
|
bool event(QEvent *);
|
||||||
@@ -90,6 +92,7 @@ class QETApp : public QApplication {
|
|||||||
bool every_element_visible;
|
bool every_element_visible;
|
||||||
QSignalMapper signal_map;
|
QSignalMapper signal_map;
|
||||||
QSettings *qet_settings;
|
QSettings *qet_settings;
|
||||||
|
static QString diagram_texts_font;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void systray(QSystemTrayIcon::ActivationReason);
|
void systray(QSystemTrayIcon::ActivationReason);
|
||||||
|
|||||||
Reference in New Issue
Block a user