Text Shadows in QLabel Snippets: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
(clean-up)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
//Easy way to add shadows to text in QLabel <br /> //include headers &lt;QGraphicsDropShadowEffect&gt;
Easy way to add shadows to text in QLabel


// For an example we have QLabel called userName<br /> // set blur to 0, and setOffset to 1,1 and color for smooth look must be little butter darker then text color
<code>
include headers <QGraphicsDropShadowEffect>
 
// For an example we have QLabel called userName
// set blur to 0, and setOffset to 1,1 and color for smooth look must be little butter darker then text color
 
QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect(this);
effect->setBlurRadius(0);
effect->setColor(QColor("#EEEEEE"));
effect->setOffset(1,1);
ui->userName->setGraphicsEffect(effect);
</code>

Latest revision as of 15:32, 24 March 2016

Easy way to add shadows to text in QLabel

include headers <QGraphicsDropShadowEffect>

// For an example we have QLabel called userName
// set blur to 0, and setOffset to 1,1 and color for smooth look must be little butter darker then text color

QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect(this);
effect->setBlurRadius(0);
effect->setColor(QColor("#EEEEEE"));
effect->setOffset(1,1);
ui->userName->setGraphicsEffect(effect);