hi friends,
i am having a window with size (10,800,1010,40) .. its having a button (diagnosButton) ... a thread is running parallel which will receive communication from server and emit a signal newMessage (QString) ... in my mainwindow i get the signal of thread and called a slot ()
this is the slot
void TidBar
::showToolTip(const QString &message
) {
int setval = 0;
//value = diagnosButton->mapToGlobal(diagnosButton->rect().topLeft());
value
= diagnosButton
->mapToGlobal
(QPoint(0,
0));
qreal x = value.x();
qreal y = value.y();
QRect rectval
= this
->rect
();
QPoint value2
(x
+ 70, y
- 54);
QToolTip::showText(value2, message,
this ,rectval
);
}
void TidBar::showToolTip(const QString &message)
{
QFont serifFont("Times", 12, QFont::Bold);
QPalette color;
int setval = 0;
color.setColor( QPalette::Inactive,QPalette::QPalette::ToolTipBase,Qt::yellow);
//value = diagnosButton->mapToGlobal(diagnosButton->rect().topLeft());
value = diagnosButton->mapToGlobal(QPoint(0, 0));
qreal x = value.x();
qreal y = value.y();
QRect rectval = this->rect();
QPoint value2 (x + 70, y - 54);
QToolTip::setPalette(color);
QToolTip::setFont(serifFont);
QToolTip::showText(value2, message,this ,rectval );
}
To copy to clipboard, switch view to plain text mode
i try to show a tooltip with the message from the thread signal newMessage(QString) .... i thought this tooltip will last for long until i move the cursor outside the window ...
but the tooltip disapper or hide afer few seconds .... i dont know where i mistaked .... please help
Bookmarks