Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED]QDialog problem, how i can keep the QDialog show until some case matches?
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]QDialog problem, how i can keep the QDialog show until some case matches?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 705 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    opengpu2
    wrote on last edited by opengpu2
    #1

    i write a dialog, which let the user enter a fileName, i want to keep the dialog show Until user enter a fileName which does Not exist.
    i write like this in the func:
    QDialog dlg(this);
    dlg.exec();
    if (dlg.result() == QDialog::Accepted)
    {
    ...
    while (QFile::exists(newFileName))
    {
    dlg.exec();
    }
    ....
    }
    but i found it's wrong. what should i do this work?
    thank you!

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      I would not wait for the dialog to be closed. You should reimplement QDialog class and handle the OK button yourself: when a file exists, you should reject the result. If it does not, you can set the Accepted state.

      (Z(:^

      1 Reply Last reply
      0
      • O Offline
        O Offline
        opengpu2
        wrote on last edited by
        #3

        yeh, i inherit from QDialog, and reimplement the accept.
        but u know, it's easy and convient to do this Check in the window's slot, But not the custom QDilaog, because the relative path is in the window, and i don't want to pass these related param to the QDialog.
        thank you

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          Sorry, I don't understand your resoning. How is it possible for the dialog (where the user selects the path and file name) not to know the file name?

          (Z(:^

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved