[qet] qet/qet: [5163] Dissociate fonts policy and size for independent text item |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 5163
Author: scorpio810
Date: 2017-12-10 02:03:36 +0100 (Sun, 10 Dec 2017)
Log Message:
-----------
Dissociate fonts policy and size for independent text item
Possiblility to overide defaut settings by adding in QElectroTech.conf
diagramitemsize, diagramitemfont variable, for example:
[General]
diagramitemsize=12
diagramitemfont=droid
Modified Paths:
--------------
trunk/sources/qetapp.cpp
trunk/sources/qetapp.h
trunk/sources/qetgraphicsitem/diagramtextitem.cpp
Modified: trunk/sources/qetapp.cpp
===================================================================
--- trunk/sources/qetapp.cpp 2017-12-09 20:53:55 UTC (rev 5162)
+++ trunk/sources/qetapp.cpp 2017-12-10 01:03:36 UTC (rev 5163)
@@ -778,7 +778,32 @@
}
return(diagram_texts_font);
}
+/**
+ * @brief QETApp::diagramTextsItemFont
+ * the font for to use in independent text item
+ * @param size of font
+ * @return
+ */
+QFont QETApp::diagramTextsItemFont(qreal size)
+{
+ QSettings settings;
+ //Font to use
+ QString diagram_texts_item_family = settings.value("diagramitemfont", "Sans Serif").toString();
+ qreal diagram_texts_item_size = settings.value("diagramitemsize", 9.0).toDouble();
+
+ if (size != -1.0) {
+ diagram_texts_item_size = size;
+ }
+ QFont diagram_texts_item_font = QFont(diagram_texts_item_family);
+ diagram_texts_item_font.setPointSizeF(diagram_texts_item_size);
+ if (diagram_texts_item_size <= 4.0) {
+ diagram_texts_item_font.setWeight(QFont::Light);
+ }
+ return(diagram_texts_item_font);
+}
+
+
/**
@return les editeurs de schemas
*/
Modified: trunk/sources/qetapp.h
===================================================================
--- trunk/sources/qetapp.h 2017-12-09 20:53:55 UTC (rev 5162)
+++ trunk/sources/qetapp.h 2017-12-10 01:03:36 UTC (rev 5163)
@@ -122,6 +122,7 @@
static void overrideLangDir(const QString &);
static QString lang_dir; ///< Directory containing localization files.
static QFont diagramTextsFont(qreal = -1.0);
+ static QFont diagramTextsItemFont(qreal = -1.0);
static QETDiagramEditor *diagramEditorForFile(const QString &);
static QETDiagramEditor *diagramEditorAncestorOf (const QWidget *child);
static QList<QETDiagramEditor *> diagramEditors();
Modified: trunk/sources/qetgraphicsitem/diagramtextitem.cpp
===================================================================
--- trunk/sources/qetgraphicsitem/diagramtextitem.cpp 2017-12-09 20:53:55 UTC (rev 5162)
+++ trunk/sources/qetgraphicsitem/diagramtextitem.cpp 2017-12-10 01:03:36 UTC (rev 5163)
@@ -52,7 +52,7 @@
setZValue(10);
setAcceptHoverEvents(true);
setDefaultTextColor(Qt::black);
- setFont(QETApp::diagramTextsFont());
+ setFont(QETApp::diagramTextsItemFont());
setFlags(QGraphicsItem::ItemIsSelectable|QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemSendsGeometryChanges);
setNoEditable(false);
setToolTip(tr("Maintenir ctrl pour un déplacement libre"));