Results 1 to 4 of 4

Thread: Stopping any further processing in nested if statements

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android
    Thanked 342 Times in 324 Posts

    Default Re: Stopping any further processing in nested if statements

    Is the break; line executed , can you see the debug text ?
    Qt Code:
    1. while (query.next()) {
    2. ....
    3. if(aa != ui.validator->text())
    4. {
    5. ....
    6. if (msgBox.clickedButton() == connectButton)
    7. {
    8. qDebug() << "before break";
    9. break;
    10. }
    11. }
    To copy to clipboard, switch view to plain text mode 

    everything below the "break" statement will not be executed, same as here:
    Qt Code:
    1. #include <iostream>
    2. int main(){
    3. while( 1 ){
    4. std::cout << "in while..."; // this will be visible only once
    5. if( 1 ){
    6. if( 1 ){
    7. break; // while loop will end here
    8. }
    9. }
    10. std::cout << "after break..."; // this will not be visible
    11. }
    12. return 0;
    13. }
    To copy to clipboard, switch view to plain text mode 

  2. The following user says thank you to stampede for this useful post:

    thefatladysingsopera (9th November 2011)

Similar Threads

  1. QSqlQuery prepared statements proper usage
    By psih128 in forum Qt Programming
    Replies: 5
    Last Post: 11th April 2011, 23:10
  2. how to avoid switch statements in item delegates
    By GrahamLabdon in forum Newbie
    Replies: 1
    Last Post: 9th March 2011, 21:11
  3. QtSql: Maximum number of PREPARE statements
    By kayssun in forum Qt Programming
    Replies: 2
    Last Post: 25th April 2010, 09:51
  4. QtSql: execBatch() with SELECT statements
    By herrmarder in forum Qt Programming
    Replies: 2
    Last Post: 28th January 2010, 13:43
  5. reading fprintf statements from console in qt
    By KrishnaKishan in forum Qt Programming
    Replies: 2
    Last Post: 15th March 2007, 10:00

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.