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. FocusOutEvent question.... please help me.
Qt 6.11 is out! See what's new in the release blog

FocusOutEvent question.... please help me.

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 4 Posters 1.0k 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.
  • K Offline
    K Offline
    kwanyoung
    wrote on last edited by
    #1

    hi, all.

    Please understand that my English skills is not good.

    I have Dialog

    this dialog has one lineEdit and one pushButton (Cancel button / when clicked close dialog)

    I have set the focusOutEvent on the lineEdit

    because , when emit focuseOutEvent to put up a messageBox.

    then, when i click CancelButton , i want to just close dialog , but a message pops up.

    How can I solve this problem?

    I tried hard with my low English skills..... Please Help me .. !

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      You said:

      • but a message pops up.

      Your own messageBox comes again when you close dialog
      or is it a new message ? ( not yours)

      K 1 Reply Last reply
      0
      • A Offline
        A Offline
        Asperamanca
        wrote on last edited by
        #3

        Could you post your code? That would help us understand your problem.

        1 Reply Last reply
        0
        • mrjjM mrjj

          Hi
          You said:

          • but a message pops up.

          Your own messageBox comes again when you close dialog
          or is it a new message ? ( not yours)

          K Offline
          K Offline
          kwanyoung
          wrote on last edited by kwanyoung
          #4

          @mrjj @Asperamanca

          focusOutEvent of lineEdit

          focusOutEvent(QFocusEvent* event)
          {
          QMessageBox::warning(this,tr("message"),"message",QMessageBox::OK);
          // Because, if user enters the wrong value in lineEdit
          }

          1. I click cancel button (to close dialog)
          2. my lineEdit is focusOut
          3. call focusOutEvent
          4. pop up a message.

          I want to keep the message out.

          aha_1980A 1 Reply Last reply
          0
          • K kwanyoung

            @mrjj @Asperamanca

            focusOutEvent of lineEdit

            focusOutEvent(QFocusEvent* event)
            {
            QMessageBox::warning(this,tr("message"),"message",QMessageBox::OK);
            // Because, if user enters the wrong value in lineEdit
            }

            1. I click cancel button (to close dialog)
            2. my lineEdit is focusOut
            3. call focusOutEvent
            4. pop up a message.

            I want to keep the message out.

            aha_1980A Offline
            aha_1980A Offline
            aha_1980
            Lifetime Qt Champion
            wrote on last edited by aha_1980
            #5

            @kwanyoung I think what you want to achive can better be done with a QValidator assigned to the lineEdit.

            And please: no messagebox! thats bad user experience. disable the dialogs Ok button, show an status message in the dialog, but no messagebox. thanks :)

            Edit: Example: http://code.qt.io/cgit/qt/qtserialbus.git/tree/examples/serialbus/can/sendframebox.cpp?h=dev

            Qt has to stay free or it will die.

            1 Reply Last reply
            3
            • K Offline
              K Offline
              kwanyoung
              wrote on last edited by
              #6

              thank you !

              aha_1980A 1 Reply Last reply
              1
              • K kwanyoung

                thank you !

                aha_1980A Offline
                aha_1980A Offline
                aha_1980
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @kwanyoung if your problem is solved, please mark this topic as SOLVED too. thanks :)

                Qt has to stay free or it will die.

                1 Reply Last reply
                1

                • Login

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