Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
hi please check this and help me . tnx alot
my qt library is 4.8.1 vs2008 sp1
class form : public QWidget
explicit form(QWidget *parent = 0);
#endif // FORM_H
form::form(QWidget *parent) :
QVBoxLayout *lay = new QVBoxLayout( this );
l = new QLineEdit; b = new QPushButton; lay->addWidget( l ); lay->addWidget( b ); connect(b, SIGNAL(clicked()), this, SLOT(onbtnclick()));
QToolTip::showText(l->pos(), "sometext", l);
int main(int argc, char **argv)
QApplication app( argc, argv );
form f; f.show(); return app.exec();
i want tooltip display for lineedit but display in other region and out of my widget !!!!
instead of your line in "onbtnclick()"
i know but i want this instead of setToolTip ! please guide me with QToolTip::show static function
Okay sorry, I didn't understand your initial question. Just to clarify, you want to display a tooltip - and define its position. The first argument in showText() defines the point of interest, not the point of display, so i don't think you can achieve your goal using that function. Have you thought of creating a label widget to look just like a tooltip and using a hover event to trigger it?
ok know please help me how can i do this ? in my example please help me.
Read the "QHoverEvent Doc":http://doc.qt.nokia.com/4.7-snapshot/qhoverevent.html and once you set up your hover signal, create a slot that shows your custom tooltip.
i read your link and i really tnx you but i cant understand how to use of hover ! if you can please show me with a very very simple example . very very tnx
cincirin last edited by
According to "QToolTip::showText":http://qt-project.org/doc/qt-4.8/qtooltip.html#showText docs, ...
bq. Shows text as a tool tip, with the global position pos as the point of interest
So you need to map widget coordinates to global : "QWidget::mapToGlobal":http://qt-project.org/doc/qt-4.8/qwidget.html#mapToGlobal