[SOLVED] How to get QToolTip mask?
-
Hi! I want to create my control based on QLabel, and I want to set label's shape like platform-dependent tooltip's shape... So, I need to get QToolTip mask and apply it for label.
I tried:
[code]
QLabel label;
QStyleHintReturnMask mask;
QStyleOption opt;
opt.initFrom( &label );
QApplication::style()->styleHint( QStyle::SH_ToolTip_Mask, &opt, &label, &mask );
[/code]
but mask.region.isEmpty() returns true... -
do you want to make your custom widget look like a tool tip?
I'm not sure what exactly the mask should return and if it is used for all platforms at all.
If you just want to make it look like use QLabel, it's sizeHint() method and do this in the paint method (taken from QTipLabel class - used by QToolTip):
@
void QTipLabel::paintEvent(QPaintEvent *ev)
{
QStylePainter p(this);
QStyleOptionFrame opt;
opt.init(this);
p.drawPrimitive(QStyle::PE_PanelTipLabel, opt);
p.end();QLabel::paintEvent(ev);
}
@