Results 1 to 4 of 4

Thread: form action

  1. #1
    Join Date
    Apr 2015
    Location
    My home is in beautiful North Carolina.
    Posts
    10
    Qt products
    Qt5
    Platforms
    Windows

    Thumbs up form action

    I'm as green as a newbie can be to QT5,4.
    The question I have concerns the form I have.
    Qt Code:
    1. void ACemployee_Dialog::on_lineEdit_name_returnPressed()
    2. {
    3. name = ui->lineEdit_name->text();
    4. if(name == ""){
    5. QMessageBox msgBox;
    6. msgBox.setText("Name can not be blank, please enter a value.");
    7. msgBox.exec();
    8. ui->lineEdit_name->setFocus();
    9. }
    10. else {
    11. ui->label_status->setText(name);
    12. ui->lineEdit_address->setFocus();
    13. }
    14. }
    To copy to clipboard, switch view to plain text mode 
    It works well but i ran across a 'feature'. When filling out the lineEdit and an error is notice in a lineEdit above the current lineEdit above, and one clicks on the lineEdit
    in question and corrects the error the form has to be reset.
    The window does not have to be closed and reopen but one has to start from the beginning of the form.

    Thanks in advance for your wisdom.
    Last edited by anda_skoa; 3rd September 2015 at 18:14. Reason: missing [code] tags

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: form action

    What do you mean with "the form has to be reset"?
    Or more precisely: what it actually your question?

    Cheers,
    _

  3. #3
    Join Date
    Apr 2015
    Location
    My home is in beautiful North Carolina.
    Posts
    10
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: form action

    Well, say I was on line 3 of the form and there was an error in a line above, say line1. Line1 was edited. Click back to line 3 and finish the form. When it was executed got a 'hic-up' and no insert. Reinserted the data from line1 to end. Executed and insert was there.

    I can't get it to happen again. I changed to use arg1. Don't know if that had anything to do with it. My experience with other languages tells me that is a slim change.

    Thanks for your reply.

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: form action

    So the problem does no longer appear, or at least not right now?

    In any case, you might want to connect to "editingFinished" instead, this is also triggered when the focus leaves the line input (user using TAB or mouse to move input).
    Also name.isEmpty()

    Cheers,
    _

Similar Threads

  1. Replies: 7
    Last Post: 20th September 2014, 12:03
  2. Replies: 3
    Last Post: 18th July 2013, 04:12
  3. Replies: 7
    Last Post: 23rd May 2012, 12:00
  4. How to hide from taskbar a form showed form mainwindow
    By tonnot in forum Qt Programming
    Replies: 1
    Last Post: 10th February 2011, 14:36
  5. No action checked in an exclusive action group
    By SkripT in forum Qt Programming
    Replies: 12
    Last Post: 13th February 2006, 06:19

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.