Skip to content

Commit

Permalink
Qt driver: add flag to control if a pen is used for text rendering MA…
Browse files Browse the repository at this point in the history
…GP-1219
  • Loading branch information
sandorkertesz committed Nov 26, 2019
1 parent adf58ac commit 04368c9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/drivers/QtDriver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ using namespace magics;
/*!
\brief Constructor
*/
QtDriver::QtDriver() {
QtDriver::QtDriver() : forceTextPen_(false) {
scene_ = 0;
initialized_ = false;
symbolManager_ = 0;
Expand All @@ -81,6 +81,11 @@ QtDriver::QtDriver() {
// lineWidthFactor_=0.6;
lineWidthFactor_ = 0.55;
fontSizeFactor_ = 1.1;

std::string v = getEnvVariable("MV_FORCE_TEXT_PEN");
if (v == "1" ) {
forceTextPen_ = true;
}
}

/*!
Expand Down Expand Up @@ -1165,7 +1170,9 @@ MAGICS_NO_EXPORT void QtDriver::renderText(const Text& text) const {
MgQTextItem* item = new MgQTextItem(allText);
item->setParentItem(currentItem_);
item->setFont(font);
// item->setPen(QPen());
if (forceTextPen_) {
item->setPen(QPen(Qt::transparent));
}
item->setTextBlanking(text.getBlanking());
item->setBrush(getQtColour(magfont.colour()));

Expand Down Expand Up @@ -1281,7 +1288,9 @@ MAGICS_NO_EXPORT void QtDriver::renderText(const Text& text) const {
MgQTextItem* item = new MgQTextItem(str);
item->setParentItem(currentItem_);
item->setFont(font);
// item->setPen(QPen());
if (forceTextPen_) {
item->setPen(QPen(Qt::transparent));
}
item->setTextBlanking(text.getBlanking());
item->setBrush(getQtColour(magfont.colour()));

Expand Down
2 changes: 2 additions & 0 deletions src/drivers/QtDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ class QtDriver : public BaseDriver, public QtDriverAttributes {
MFloat lineWidthFactor_;
MFloat fontSizeFactor_;
MFloat dpiResolutionRatio_;

bool forceTextPen_;
};

} // namespace magics
Expand Down

0 comments on commit 04368c9

Please sign in to comment.