mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-20 08:10:52 +01:00
Contournement du bug #2 : les polices ayant une taille inferieure ou egale a 4 se voient desormais attribuer une epaisseur plus fine.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@584 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -211,7 +211,7 @@ void BorderInset::draw(QPainter *qp, qreal x, qreal y) {
|
||||
// dessine le cadre
|
||||
if (display_border) qp -> drawRect(diagram);
|
||||
|
||||
qp -> setFont(QFont(QETApp::diagramTextsFont(), QETApp::diagramTextsSize()));
|
||||
qp -> setFont(QETApp::diagramTextsFont());
|
||||
|
||||
// dessine la case vide qui apparait des qu'il y a un entete
|
||||
if (display_border && (display_columns || display_rows)) {
|
||||
|
||||
@@ -548,7 +548,7 @@ bool CustomElement::parseText(QDomElement &e, QPainter &qp) {
|
||||
|
||||
qp.save();
|
||||
setPainterStyle(e, qp);
|
||||
qp.setFont(QFont(QString(QETApp::diagramTextsFont()), size));
|
||||
qp.setFont(QETApp::diagramTextsFont(size));
|
||||
qp.drawText(QPointF(pos_x, pos_y), e.attribute("text"));
|
||||
qp.restore();
|
||||
return(true);
|
||||
@@ -575,7 +575,7 @@ ElementTextItem *CustomElement::parseInput(QDomElement &e) {
|
||||
) return(0);
|
||||
|
||||
ElementTextItem *eti = new ElementTextItem(e.attribute("text"), this);
|
||||
eti -> setFont(QFont(QETApp::diagramTextsFont(), size));
|
||||
eti -> setFont(QETApp::diagramTextsFont(size));
|
||||
eti -> setPos(pos_x, pos_y);
|
||||
eti -> setOriginalPos(QPointF(pos_x, pos_y));
|
||||
if (e.attribute("rotate") == "true") eti -> setFollowParentRotations(true);
|
||||
|
||||
@@ -28,7 +28,7 @@ DiagramTextItem::DiagramTextItem(QGraphicsItem *parent, QGraphicsScene *scene) :
|
||||
QGraphicsTextItem(parent, scene)
|
||||
{
|
||||
setDefaultTextColor(Qt::black);
|
||||
setFont(QFont(QETApp::diagramTextsFont(), QETApp::diagramTextsSize()));
|
||||
setFont(QETApp::diagramTextsFont());
|
||||
setFlags(QGraphicsItem::ItemIsSelectable|QGraphicsItem::ItemIsMovable);
|
||||
connect(this, SIGNAL(lostFocus()), this, SLOT(setNonFocusable()));
|
||||
}
|
||||
@@ -44,7 +44,7 @@ DiagramTextItem::DiagramTextItem(const QString &text, QGraphicsItem *parent, QGr
|
||||
previous_text(text)
|
||||
{
|
||||
setDefaultTextColor(Qt::black);
|
||||
setFont(QFont(QETApp::diagramTextsFont(), QETApp::diagramTextsSize()));
|
||||
setFont(QETApp::diagramTextsFont());
|
||||
setFlags(QGraphicsItem::ItemIsSelectable|QGraphicsItem::ItemIsMovable);
|
||||
connect(this, SIGNAL(lostFocus()), this, SLOT(setNonFocusable()));
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ void PartText::fromXml(const QDomElement &xml_element) {
|
||||
int font_size = xml_element.attribute("size").toInt(&ok);
|
||||
if (!ok || font_size < 1) font_size = 20;
|
||||
|
||||
setFont(QFont(QString(QETApp::diagramTextsFont()), font_size));
|
||||
setFont(QETApp::diagramTextsFont(font_size));
|
||||
setPlainText(xml_element.attribute("text"));
|
||||
setPos(
|
||||
xml_element.attribute("x").toDouble(),
|
||||
@@ -179,7 +179,7 @@ void PartText::setProperty(const QString &property, const QVariant &value) {
|
||||
setPos(pos().x(), value.toDouble());
|
||||
} else if (property == "size") {
|
||||
if (!value.canConvert(QVariant::Int)) return;
|
||||
setFont(QFont(font().family(), value.toInt()));
|
||||
setFont(QETApp::diagramTextsFont(value.toInt()));
|
||||
} else if (property == "text") {
|
||||
setPlainText(value.toString());
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ void PartTextField::fromXml(const QDomElement &xml_element) {
|
||||
int font_size = xml_element.attribute("size").toInt(&ok);
|
||||
if (!ok || font_size < 1) font_size = 20;
|
||||
|
||||
setFont(QFont(QString(QETApp::diagramTextsFont()), font_size));
|
||||
setFont(QETApp::diagramTextsFont(font_size));
|
||||
setPlainText(xml_element.attribute("text"));
|
||||
setPos(
|
||||
xml_element.attribute("x").toDouble(),
|
||||
@@ -199,7 +199,7 @@ void PartTextField::setProperty(const QString &property, const QVariant &value)
|
||||
setPos(pos().x(), value.toDouble());
|
||||
} else if (property == "size") {
|
||||
if (!value.canConvert(QVariant::Int)) return;
|
||||
setFont(QFont(font().family(), value.toInt()));
|
||||
setFont(QETApp::diagramTextsFont(value.toInt()));
|
||||
} else if (property == "text") {
|
||||
setPlainText(value.toString());
|
||||
} else if (property == "rotate") {
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
QString QETApp::common_elements_dir = QString();
|
||||
QString QETApp::config_dir = QString();
|
||||
QString QETApp::lang_dir = QString();
|
||||
QString QETApp::diagram_texts_font = QString();
|
||||
int QETApp::diagram_texts_size = 9;
|
||||
FileElementsCollection *QETApp::common_collection = 0;
|
||||
FileElementsCollection *QETApp::custom_collection = 0;
|
||||
QMap<uint, QETProject *> QETApp::registered_projects_ = QMap<uint, QETProject *>();
|
||||
@@ -441,18 +439,29 @@ bool QETApp::closeEveryEditor() {
|
||||
}
|
||||
|
||||
/**
|
||||
@param size taille voulue - si aucune taille n'est specifiee, la valeur
|
||||
specifiee dans la configuration (diagramsize) est utilisee. La valeur par
|
||||
defaut est 9.
|
||||
@return la police a utiliser pour rendre les textes sur les schemas
|
||||
La famille "Sans Serif" est utilisee par defaut mais peut etre surchargee
|
||||
dans la configuration (diagramfont).
|
||||
*/
|
||||
QString QETApp::diagramTextsFont() {
|
||||
return(diagram_texts_font);
|
||||
}
|
||||
QFont QETApp::diagramTextsFont(int size) {
|
||||
// acces a la configuration de l'application
|
||||
QSettings &qet_settings = QETApp::settings();
|
||||
|
||||
/**
|
||||
@return la taille de police par defaut a utiliser pour rendre les textes
|
||||
sur les schemas
|
||||
*/
|
||||
int QETApp::diagramTextsSize() {
|
||||
return(diagram_texts_size);
|
||||
// police a utiliser pour le rendu de texte
|
||||
QString diagram_texts_family = qet_settings.value("diagramfont", "Sans Serif").toString();
|
||||
int diagram_texts_size = qet_settings.value("diagramsize", 9).toInt();
|
||||
|
||||
if (size != -1) {
|
||||
diagram_texts_size = size;
|
||||
}
|
||||
QFont diagram_texts_font = QFont(diagram_texts_family, diagram_texts_size);
|
||||
if (diagram_texts_size <= 4) {
|
||||
diagram_texts_font.setWeight(QFont::Light);
|
||||
}
|
||||
return(diagram_texts_font);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -806,10 +815,6 @@ void QETApp::initConfiguration() {
|
||||
// lit le fichier de configuration
|
||||
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();
|
||||
diagram_texts_size = qet_settings -> value("diagramsize", 9).toInt();
|
||||
|
||||
// fichiers recents
|
||||
projects_recent_files_ = new RecentFiles("projects");
|
||||
elements_recent_files_ = new RecentFiles("elements");
|
||||
|
||||
@@ -90,8 +90,7 @@ class QETApp : public QETSingleApplication {
|
||||
public:
|
||||
static void overrideLangDir(const QString &);
|
||||
static QString lang_dir; ///< Dossier contenant les fichiers de langue
|
||||
static QString diagramTextsFont();
|
||||
static int diagramTextsSize();
|
||||
static QFont diagramTextsFont(int = -1);
|
||||
static QETDiagramEditor *diagramEditorForFile(const QString &);
|
||||
static QList<QETDiagramEditor *> diagramEditors();
|
||||
static QList<QETElementEditor *> elementEditors();
|
||||
@@ -130,8 +129,6 @@ class QETApp : public QETSingleApplication {
|
||||
QETArguments qet_arguments_; ///< Analyseur d'arguments
|
||||
bool non_interactive_execution_; ///< booleen indiquant si l'application va se terminer immediatement apres un court traitement
|
||||
|
||||
static QString diagram_texts_font;
|
||||
static int diagram_texts_size;
|
||||
static FileElementsCollection *common_collection;
|
||||
static FileElementsCollection *custom_collection;
|
||||
static QMap<uint, QETProject *> registered_projects_;
|
||||
|
||||
Reference in New Issue
Block a user