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. 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.
Forum Updated to NodeBB v4.3 + New Features

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.

Scheduled Pinned Locked Moved General and Desktop
6 Posts 6 Posters 4.4k Views 1 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.
  • M Offline
    M Offline
    MathSquare
    wrote on last edited by
    #1

    @
    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]]

    1 Reply Last reply
    0
    • U Offline
      U Offline
      utcenter
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • musimbateM Offline
        musimbateM Offline
        musimbate
        wrote on last edited by
        #3

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

        Why join the navy if you can be a pirate?-Steve Jobs

        1 Reply Last reply
        0
        • B Offline
          B Offline
          BelenMuñoz
          wrote on last edited by
          #4

          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!!!

          Me casé con un enano pa jartarme de reí.

          1 Reply Last reply
          0
          • G Offline
            G Offline
            goblincoding
            wrote on last edited by
            #5

            "Learn C++":http://www.learncpp.com/

            http://www.goblincoding.com

            1 Reply Last reply
            0
            • P Offline
              P Offline
              panosk
              wrote on last edited by
              #6

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

              IMHO, probably the best tutorial on C++.

              1 Reply Last reply
              0

              • Login

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