Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[SOLVED] showing a window while a user is editing a QLineEdit field



  • Is there a way that I could popup a window while a user is editing a QLineEdit field without interrupting the edit process?



  • Maybe "QToolTip":http://developer.qt.nokia.com/doc/qt-4.7/qtooltip.html will be enough for you?



  • Perhaps you can use a QCompleter in popupCompleter mode? What do you want to achieve exactly?



  • If you need a complete window, and popup is not enough for you, you have to manually catch the signal of editing, open a new window, place it in the screen, and set the focus back to the edit component. It depends on what are you needs.



  • Well the tooltip seems to work only with mouse over, perhaps I can generate an event to get it to show up instead. I have not tried the popup but I supposed it would of done the same thing. Will give it a try. As for fluca1978's solution, I want to make sure there are no simpler implementations before going that route but thanks for the idea.

    Here is what I want to do: When the user is filling in data that is invalid, I want to show a non obtrusive message to this regard, ie it will not interrupt the process of editing the field. Now I have all the code written to validate the data and I am currently implementing this message with a QMessageBox but this ends the editing process and the user needs to close the box and reenable editing.



  • This basically works for me:

    @
    void MainWindow::displayToolTip()
    {
    QPoint pos = mapToGlobal(ui->textEdit->pos());
    QToolTip::showText(pos, QString("The text edit has %1 chars").arg(ui->textEdit->toPlainText().count()));
    }
    @



  • [quote author="Volker" date="1320789006"]This basically works for me:

    @
    void MainWindow::displayToolTip()
    {
    QPoint pos = mapToGlobal(ui->textEdit->pos());
    QToolTip::showText(pos, QString("The text edit has %1 chars").arg(ui->textEdit->toPlainText().count()));
    }
    @

    [/quote]

    I did this originally but the tooltip wasn't alway showing, probably due to me making the changes too fast. thanks.


Log in to reply