You can try to change the hint every time you change the text:
First, define a private slot to edit the textChanged () signal from QLineEdit: (in the header file from the class where your QTextEdit belongs)
.... private slots: void onTextChanged(); ....
In the cpp file, connect the QLineEdit textChanged () signal to the specified slot and implement the behavior when changing the text:
// In constructor, or wherever you want to start tracking changes in the QLineEdit connect(myLineEdit, SIGNAL(textChanged()), this, SLOT(onTextChanged()));
Finally, the slot will look like this:
void MainWindow::onTextChanged() { myLineEdit->setTooltip(myLineEdit->text()); }
I assume that a class called MainWindow contains a QLineEdit.
source share