|
| QString | marginsToString (const QMargins &margins) |
| | QETUtils::marginsToString.
|
| QMargins | marginsFromString (const QString &string) |
| | QETUtils::marginsFromString.
|
| qreal | graphicsHandlerSize (QGraphicsItem *item) |
| | QETUtils::graphicsHandlerSize.
|
| void | pixelSizedFont (QFont &font) |
| | QETUtils::pixelSizedFont Set the font size to pixelSize instead of pointSize (if needed). The font used to draw diagram must be pixel sized instead of point sized (default by Qt) then no matter the screen dpi used, the text in diagram keep the same size. For more information see https://qelectrotech.org/forum/viewtopic.php?pid=6267#p6267.
|
| QString | fontToString (const QFont &font) |
| | QETUtils::fontToString Serialize a font to the 10/11 field description format written by Qt 5, to be used instead of QFont::toString() everywhere a font description is stored in a project, element or settings file. The format of QFont::toString() is not stable across Qt versions : Qt 6.11 switched to a 19 field format carrying OpenType weights, which QFont::fromString() of Qt 5.x and Qt <= 6.10 rejects, leaving a broken font. The 10/11 field form is parsed correctly by every Qt version (they convert the legacy weight scale as needed), so composing it ourselves keeps files readable by every QET build in circulation. See https://github.com/qelectrotech/qelectrotech-source-mirror/issues/553.
|
| bool | fontFromString (QFont &font, const QString &description) |
| | QETUtils::fontFromString Restore a font from a description string, tolerating descriptions written by any Qt version. QFont::fromString() of Qt 5.x and Qt <= 6.10 rejects the >= 19 field format QFont::toString() emits since Qt 6.11 (16 base fields plus style name, font-feature count and variable-axis count), leaving a broken font behind. When the native parser fails, salvage such a description by re-composing the 10/11 field form (OpenType weight mapped back to the legacy scale) and parsing that instead, so no font information stored in existing files is lost. See https://github.com/qelectrotech/qelectrotech-source-mirror/issues/553.
|
| bool | sortBeginIntString (const QString &str_a, const QString &str_b) |
| | QETUtils::sortBeginIntString Sort the string str_a and str_b and take in count if string begin with an int to sort it as int and not as string in this case. For example if we have to sort the string : "3str", 10str", "100str", "2str", "20str".
The default behavior when sorting QString with the comparison operator will be:
"10str" "100str" "2str", "20str", "3str"
When sorting with this function, the result will be :
"10str", "2str", "3str", "20str", "100str".
|
| template<typename T> |
| QVector< QWeakPointer< T > > | sharedVectorToWeak (const QVector< QSharedPointer< T > > &vector) |
| template<typename T> |
| QVector< QSharedPointer< T > > | weakVectorToShared (const QVector< QWeakPointer< T > > &vector) |
Provide some small utils function
| bool QETUtils::sortBeginIntString |
( |
const QString & | str_a, |
|
|
const QString & | str_b ) |
QETUtils::sortBeginIntString Sort the string str_a and str_b and take in count if string begin with an int to sort it as int and not as string in this case. For example if we have to sort the string : "3str", 10str", "100str", "2str", "20str".
The default behavior when sorting QString with the comparison operator will be:
"10str" "100str" "2str", "20str", "3str"
When sorting with this function, the result will be :
"10str", "2str", "3str", "20str", "100str".
- Parameters
-
- Returns