Can Somone help me with my if statements and it have somwthing to do with variables I think i didn’t do it right since i am few day using Qt.



  • @
    if (bool editing = "a");

    {

        ui->EditNoteButton->setText("End Editing Note");
    
    ui->TextTitle->setReadOnly(!true);
    
    ui->Note_2->setReadOnly(!true);
    
    ui->AddNoteButton->setEnabled(!true);
    
    ui->RemoveNoteButton->setEnabled(!true);
    
    ui->listView->setEnabled(!true);
    
    bool editing = "b";
    

    }

    if (bool editing = "b");
    

    {

        ui->EditNoteButton->setText("Edit Note");
    
    ui->TextTitle->setReadOnly(true);
    
    ui->Note_2->setReadOnly(true);
    
    ui->AddNoteButton->setEnabled(true);
    
    ui->RemoveNoteButton->setEnabled(true);
    
    ui->listView->setEnabled(true);
    
    bool editing = "a";
    

    }
    @

    Plaese help me

    [[Marked up code, moved to General and Desktop, Tobias]]



  • there is no semicolon (;) after the if statement

    @if (condition)
    {
    // code goes here
    }@

    instead of !true you can write false, or simply 0

    also, a bool is false if only set to 0, everything else is true

    all in all, I'd recommend that you learn some C++ before you go into Qt



  • I recommend www.cplusplus.com in case you want some good and up to date reference on c++.



  • I agree with utcenter and musimbate, you should learn more about c++.
    But I think you should change:

    @ if (editing == "a")

    {
        ........
        editing = "b";
     
    }
     
        if (editing == "b")
     
    {
     
           ..................
        editing = "a";
     
    }
    

    @

    If you are passing "a" or "b" to 'editing' it can not be bool.
    Good luck!!!





  • [quote author="goblincoding" date="1358778408"]"Learn C++":http://www.learncpp.com/[/quote]

    IMHO, probably the best tutorial on C++.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.