Text Shadows in QLabel Snippets

From Qt Wiki
Revision as of 09:52, 24 February 2015 by Maintenance script (talk | contribs)
Jump to navigation Jump to search

//Easy way to add shadows to text in QLabel
//include headers <QGraphicsDropShadowEffect&gt;

// 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);<br /> effect-&gt;setBlurRadius(0);<br /> effect-&gt;setColor(QColor(&quot;#EEEEEE&amp;quot;));<br /> effect-&gt;setOffset(1,1);<br /> ui-&gt;userName-&gt;setGraphicsEffect(effect);