Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QMessageBox and QInputDialog
Forum Updated to NodeBB v4.3 + New Features

QMessageBox and QInputDialog

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
22 Posts 6 Posters 9.4k Views 4 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.
  • D Offline
    D Offline
    DivyaMuthyala
    wrote on 20 Jan 2017, 03:59 last edited by
    #11

    Hi,
    divyamuthyala755@gmail.com
    Thankyou

    1 Reply Last reply
    1
    • D Offline
      D Offline
      DivyaMuthyala
      wrote on 20 Jan 2017, 05:04 last edited by
      #12

      Hi,

      After Now I am able to get text from input dialog, now how to close input dialog by pressing enter key.

      Thanks in advance.

      J 1 Reply Last reply 20 Jan 2017, 05:51
      1
      • D DivyaMuthyala
        20 Jan 2017, 05:04

        Hi,

        After Now I am able to get text from input dialog, now how to close input dialog by pressing enter key.

        Thanks in advance.

        J Offline
        J Offline
        jsulm
        Lifetime Qt Champion
        wrote on 20 Jan 2017, 05:51 last edited by
        #13

        @DivyaMuthyala Well, documentation: http://doc.qt.io/qt-5/qmessagebox.html
        See "Default and Escape Keys" there.

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • D Offline
          D Offline
          DivyaMuthyala
          wrote on 20 Jan 2017, 06:58 last edited by
          #14

          Hi,

          Now My QInputDialog is not closing with Enter Key.
          Can anyone please give me solution.

          J 1 Reply Last reply 20 Jan 2017, 07:01
          0
          • D DivyaMuthyala
            20 Jan 2017, 06:58

            Hi,

            Now My QInputDialog is not closing with Enter Key.
            Can anyone please give me solution.

            J Offline
            J Offline
            jsulm
            Lifetime Qt Champion
            wrote on 20 Jan 2017, 07:01 last edited by
            #15

            @DivyaMuthyala Did you check the link I posted?

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            1
            • D Offline
              D Offline
              DivyaMuthyala
              wrote on 20 Jan 2017, 07:22 last edited by
              #16

              Hi,
              Yes I have checked , its working for messagebox but not for inputdialog.

              J D 2 Replies Last reply 20 Jan 2017, 07:36
              0
              • D DivyaMuthyala
                20 Jan 2017, 07:22

                Hi,
                Yes I have checked , its working for messagebox but not for inputdialog.

                J Offline
                J Offline
                jsulm
                Lifetime Qt Champion
                wrote on 20 Jan 2017, 07:36 last edited by
                #17

                @DivyaMuthyala Since QInputDialog is derived from QDialog you should read http://doc.qt.io/qt-5/qdialog.html
                "Default Button".

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • D DivyaMuthyala
                  20 Jan 2017, 07:22

                  Hi,
                  Yes I have checked , its working for messagebox but not for inputdialog.

                  D Offline
                  D Offline
                  Devopia53
                  wrote on 20 Jan 2017, 08:39 last edited by Devopia53
                  #18

                  @DivyaMuthyala

                  Hi.

                  This is one of the tricky methods.

                  QInputDialog    dlg(this);
                  
                  dlg.setWindowTitle(tr("QInputDialog::getText()"));
                  dlg.setLabelText(tr("User name:"));
                  dlg.setTextValue(QDir::home().dirName());
                  dlg.setOption(QInputDialog::NoButtons);
                  dlg.open();
                  QLineEdit   *lineEdit = dlg.findChild<QLineEdit *>();
                  if (lineEdit)
                      connect(lineEdit, &QLineEdit::returnPressed, [&dlg](){
                          dlg.accept();
                      });
                  if (dlg.exec() == QDialog::Accepted)
                      qDebug() << dlg.textValue();
                  
                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    DivyaMuthyala
                    wrote on 20 Jan 2017, 09:23 last edited by
                    #19

                    Hi,

                    Can we create QInputDialog with only one "ok" button???

                    J 1 Reply Last reply 20 Jan 2017, 10:58
                    0
                    • D DivyaMuthyala
                      20 Jan 2017, 09:23

                      Hi,

                      Can we create QInputDialog with only one "ok" button???

                      J Offline
                      J Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on 20 Jan 2017, 10:58 last edited by
                      #20

                      @DivyaMuthyala Maybe you can. But the documentation says:
                      "Escape Key
                      If the user presses the Esc key in a dialog, QDialog::reject() will be called. This will cause the window to close: The close event cannot be ignored."
                      That means: even if there is no Cancel button the user will still be able to use Esc key to close the dialog. Why do you want to remove Cancel button?

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • D Offline
                        D Offline
                        DivyaMuthyala
                        wrote on 20 Jan 2017, 11:02 last edited by
                        #21

                        Here I am using arm based Embeded device.

                        My requirement is,InputDialog should by Enter Key,not for Escape Key.

                        J 1 Reply Last reply 20 Jan 2017, 12:26
                        0
                        • D DivyaMuthyala
                          20 Jan 2017, 11:02

                          Here I am using arm based Embeded device.

                          My requirement is,InputDialog should by Enter Key,not for Escape Key.

                          J Offline
                          J Offline
                          jsulm
                          Lifetime Qt Champion
                          wrote on 20 Jan 2017, 12:26 last edited by
                          #22

                          @DivyaMuthyala You can create you own dialogs

                          https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          2

                          20/22

                          20 Jan 2017, 10:58

                          • Login

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