diff options
author | Jochen Becher <jochen_becher@gmx.de> | 2017-12-28 22:04:45 +0100 |
---|---|---|
committer | Jochen Becher <jochen_becher@gmx.de> | 2018-01-09 14:23:03 +0000 |
commit | b567a080e27abd589d44d323fe9c1fa9a2d68028 (patch) | |
tree | 003cc4273234eeedec4f282f30c76b1d9296a6a8 /src/libs/modelinglib | |
parent | 09bdb4f8cdf822ec25f0546f378fd139f742bb14 (diff) |
ModelEditor: Fix toolbar icon rendering on HDPI screens
Some high DPI icons are still missing. But icons rendered from
stereotype definitions get the correct size and look much better.
Change-Id: Iabd8283e9bd0ae7e074471a065d009ac5c5836cc
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src/libs/modelinglib')
3 files changed, 5 insertions, 4 deletions
diff --git a/src/libs/modelinglib/qmt/model_ui/treemodel.cpp b/src/libs/modelinglib/qmt/model_ui/treemodel.cpp index 69cdf186610..671f769ba59 100644 --- a/src/libs/modelinglib/qmt/model_ui/treemodel.cpp +++ b/src/libs/modelinglib/qmt/model_ui/treemodel.cpp @@ -831,7 +831,7 @@ QIcon TreeModel::createIcon(StereotypeIcon::Element stereotypeIconElement, Style { const Style *style = m_styleController->adaptStyle(styleElementType); return m_stereotypeController->createIcon(stereotypeIconElement, stereotypes, defaultIconPath, style, - QSize(48, 48), QMarginsF(3.0, 2.0, 3.0, 4.0)); + QSize(48, 48), QMarginsF(3.0, 2.0, 3.0, 4.0), 3.0); } } // namespace qmt diff --git a/src/libs/modelinglib/qmt/stereotype/stereotypecontroller.cpp b/src/libs/modelinglib/qmt/stereotype/stereotypecontroller.cpp index 5e5e4b73fde..0eda3182639 100644 --- a/src/libs/modelinglib/qmt/stereotype/stereotypecontroller.cpp +++ b/src/libs/modelinglib/qmt/stereotype/stereotypecontroller.cpp @@ -129,7 +129,7 @@ CustomRelation StereotypeController::findCustomRelation(const QString &customRel QIcon StereotypeController::createIcon(StereotypeIcon::Element element, const QList<QString> &stereotypes, const QString &defaultIconPath, const Style *style, const QSize &size, - const QMarginsF &margins) + const QMarginsF &margins, qreal lineWidth) { // TODO implement cache with key build from element, stereotypes, defaultIconPath, style, size and margins // TODO implement unique id for style which can be used as key @@ -158,10 +158,11 @@ QIcon StereotypeController::createIcon(StereotypeIcon::Element element, const QL iconBoundingRect.height() + margins.top() + margins.bottom()); pixmap.fill(Qt::transparent); QPainter painter(&pixmap); + painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform); painter.setBrush(Qt::NoBrush); painter.translate(-iconBoundingRect.topLeft() + QPointF(margins.left(), margins.top())); QPen linePen = style->linePen(); - linePen.setWidthF(2.0); + linePen.setWidthF(lineWidth); painter.setPen(linePen); painter.setBrush(style->fillBrush()); ShapePaintVisitor visitor(&painter, QPointF(0.0, 0.0), diff --git a/src/libs/modelinglib/qmt/stereotype/stereotypecontroller.h b/src/libs/modelinglib/qmt/stereotype/stereotypecontroller.h index a010352e361..1cf7c3e64f9 100644 --- a/src/libs/modelinglib/qmt/stereotype/stereotypecontroller.h +++ b/src/libs/modelinglib/qmt/stereotype/stereotypecontroller.h @@ -59,7 +59,7 @@ public: CustomRelation findCustomRelation(const QString &customRelationId) const; QIcon createIcon(StereotypeIcon::Element element, const QList<QString> &stereotypes, const QString &defaultIconPath, const Style *style, - const QSize &size, const QMarginsF &margins); + const QSize &size, const QMarginsF &margins, qreal lineWidth); void addStereotypeIcon(const StereotypeIcon &stereotypeIcon); void addCustomRelation(const CustomRelation &customRelation); |