[Interest] How to make transparent ToolTip on Linux

Igor Mironchik igor.mironchik at gmail.com
Tue May 5 14:27:05 CEST 2015


Hi,

I'm trying to make transparent ToolTip that will move text cursor when 
it moves.

I use the next code:

CursorShifter::CursorShifter( QWidget * parent )
     :    QWidget( parent, Qt::ToolTip | Qt::FramelessWindowHint |
             Qt::WindowDoesNotAcceptFocus |
             Qt::NoDropShadowWindowHint |
             Qt::WindowStaysOnTopHint )
     ,    d( new CursorShifterPrivate( this ) )
{
     d->init();
}

void
CursorShifterPrivate::init()
{
     color = q->palette().color( QPalette::Highlight );
     light = lighterColor( color, 75 );
     basicSize = qRound( (qreal) FingerGeometry::width() * 0.2 );
     timer = new QTimer( q );
     q->setWindowModality( Qt::NonModal );

     q->setAttribute( Qt::WA_TranslucentBackground, true );
     q->setAttribute( Qt::WA_NoSystemBackground, true );
     q->setAutoFillBackground( false );

     QObject::connect( timer, SIGNAL( timeout() ),
         q, SLOT( _q_hideTimer() ) );
}

But I receive black instead of transparent. Look at the picture...

ToolTip

Is it a bug of Qt, or it relevant to my Kubuntu 15.04?

And if anybody know, how to make transparent ToolTip?

Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150505/de9b7a42/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: snapshot2.png
Type: image/png
Size: 4429 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150505/de9b7a42/attachment.png>


More information about the Interest mailing list