Non-Blocking DialogBox (NonModal?) required for Statusmessages



  • Hello,

    I need a DialogBox which shall present a String to the user.
    -> This Dialogbox should be on top of the application, e.g. as a splashscreen,
    -> But never blocking user interaction to the parent application window.

    @
    if (!dlg_IDList)
    {
    dlg_IDList = new QInputDialog(0, Qt::SplashScreen);
    dlg_IDList->setOkButtonText("Encode Route");
    dlg_IDList->setCancelButtonText("Reset Route");
    dlg_IDList->setModal(false);
    }

    // if resultString changes
    QString text = dlg_IDList->getText( this, tr("Title"), tr("ID List"), QLineEdit::Normal, resultString);
    @

    Everytime resultString changes, I getText() that String in a Dialog. But here, it blocks the user interaction to my main window.
    I'd rather prefer not to block me..

    Do you have any suggestions?

    Thank you
    Huck



  • If you use a QInputDialog and call get_Text, you make a synchronous call to the dialog to show and return a user entered value. That will always block the UI.

    You would have to display the dialog and then connect some signals and slots to check, when the user presses OK. I never did such things with QInputDialog, so I have no code ready here.



  • Yes you're right.

    So I'll build up a new QDialog with my own requirements for this.

    Thank you!



  • You can make use of [[Doc:QInputDialog]] without the static convenience methods too. Just connect to the special signals. I would say "textValueSelected() ":/doc/qt-4.8/qinputdialog.html#textValueSelected is what you need here:

    bq. This signal is emitted whenever the user selects a text string by accepting the dialog; for example, by clicking the OK button. The selected string is specified by text.

    You will have to call the respective setters for that parameters of your input box, that go into the call of the static convenience methods.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.