Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Ho to disable/make disappear error underlines in QtCreator ?
Forum Updated to NodeBB v4.3 + New Features

Ho to disable/make disappear error underlines in QtCreator ?

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
18 Posts 3 Posters 2.4k 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.
  • R Offline
    R Offline
    RobDaNet
    wrote on last edited by RobDaNet
    #1

    Hi all,

    I'm using the following C macro in QtCreator:

    #define Nil      ((Object){ TT_NIL,  { .n=0 }  })
    

    which causes this underlines to appear:

    qterror1.png

    and in code (the comment show the messages I get by hovering on the underline with the mouse) :

    Upvalue* new_upvalue(Object* value) {
        Upvalue* u = (Upvalue*)new_obj(sizeof(Upvalue), TT_UPVALUE);
        u->value = value;
        u->closed_value = Nil;// extra ;
        u->next = NULL; // expected a declaration
        return u; // expected token ';' got '{'
    }
    

    I checked in the color table (tool->options->textEditor) but I didn't find a corresponding property to make those line transparent (or white, at least). I'm running Qt Creator 3.5.1 Based on Qt 5.5.1 (GCC 5.2.1 20151129, 64 bit) on Ubuntu 16:04.
    Do you have any advice, please ?
    Thanks

    JonBJ 1 Reply Last reply
    0
    • R RobDaNet

      Hi all,

      I'm using the following C macro in QtCreator:

      #define Nil      ((Object){ TT_NIL,  { .n=0 }  })
      

      which causes this underlines to appear:

      qterror1.png

      and in code (the comment show the messages I get by hovering on the underline with the mouse) :

      Upvalue* new_upvalue(Object* value) {
          Upvalue* u = (Upvalue*)new_obj(sizeof(Upvalue), TT_UPVALUE);
          u->value = value;
          u->closed_value = Nil;// extra ;
          u->next = NULL; // expected a declaration
          return u; // expected token ';' got '{'
      }
      

      I checked in the color table (tool->options->textEditor) but I didn't find a corresponding property to make those line transparent (or white, at least). I'm running Qt Creator 3.5.1 Based on Qt 5.5.1 (GCC 5.2.1 20151129, 64 bit) on Ubuntu 16:04.
      Do you have any advice, please ?
      Thanks

      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by JonB
      #2

      @RobDaNet
      I'm sorry I don't know how to achieve that. But would you not rather try to deal with whatever Qt editor is trying to tell you about those lines, rather than switching them off visually everywhere? What does the hover say?

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

        Hi
        When you provide pictures only, its very hard to check out what is going on
        since you cant just copy the code. :(

        In any case for that old QtCreator, i think you can do

        Tools -> Options -> Text Editor -> Font&Colors: find and check the "Error" at the "Color Scheme". Click "Copy", "Ok". Select No underline at the Underline section.

        To make all such "bad code" underlines not showing.

        But as @JonB says
        would be good idea to check what its unhappy about.
        (if it does show a hover tip)

        R 1 Reply Last reply
        2
        • mrjjM mrjj

          Hi
          When you provide pictures only, its very hard to check out what is going on
          since you cant just copy the code. :(

          In any case for that old QtCreator, i think you can do

          Tools -> Options -> Text Editor -> Font&Colors: find and check the "Error" at the "Color Scheme". Click "Copy", "Ok". Select No underline at the Underline section.

          To make all such "bad code" underlines not showing.

          But as @JonB says
          would be good idea to check what its unhappy about.
          (if it does show a hover tip)

          R Offline
          R Offline
          RobDaNet
          wrote on last edited by
          #4

          @mrjj Hi mrjj, I added the code together with the message I get by hovering on the underlines with the mouse. As I mentioned in my question, I tried to find a property in the Font&Colors list, but there's none referring to the Underline. Probably it was added in a later version. As regard the error itself, I don't think it makes any sense. Take this line:

          u->closed_value = Nil;//extra ;
          

          why would it ask for an extra ';' ? The other error messages are without any doubt a consequence of this syntax error, so of very little concern.
          Thanks for your interest.

          mrjjM 1 Reply Last reply
          0
          • JonBJ JonB

            @RobDaNet
            I'm sorry I don't know how to achieve that. But would you not rather try to deal with whatever Qt editor is trying to tell you about those lines, rather than switching them off visually everywhere? What does the hover say?

            R Offline
            R Offline
            RobDaNet
            wrote on last edited by
            #5

            @JonB Hi JonB, I update my question. Thanks.

            1 Reply Last reply
            0
            • R RobDaNet

              @mrjj Hi mrjj, I added the code together with the message I get by hovering on the underlines with the mouse. As I mentioned in my question, I tried to find a property in the Font&Colors list, but there's none referring to the Underline. Probably it was added in a later version. As regard the error itself, I don't think it makes any sense. Take this line:

              u->closed_value = Nil;//extra ;
              

              why would it ask for an extra ';' ? The other error messages are without any doubt a consequence of this syntax error, so of very little concern.
              Thanks for your interest.

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by mrjj
              #6

              @RobDaNet
              Hi
              The #define does not contain the ;
              so when expanded it does miss the ;
              and hence
              value = Nil
              does need the ;

              Note:
              did you update the original post ?
              We have some issues regarding refreshing after forum updates so hence i ask if you added new info:)

              R 1 Reply Last reply
              2
              • mrjjM mrjj

                @RobDaNet
                Hi
                The #define does not contain the ;
                so when expanded it does miss the ;
                and hence
                value = Nil
                does need the ;

                Note:
                did you update the original post ?
                We have some issues regarding refreshing after forum updates so hence i ask if you added new info:)

                R Offline
                R Offline
                RobDaNet
                wrote on last edited by
                #7

                @mrjj HI, yes I did but the first time it didn't show the update. By the way, to which Nil you are referring at? The semicolon is present in the initialization.

                mrjjM 1 Reply Last reply
                0
                • R RobDaNet

                  @mrjj HI, yes I did but the first time it didn't show the update. By the way, to which Nil you are referring at? The semicolon is present in the initialization.

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @RobDaNet
                  Hi
                  The image
                  alt text

                  no ;

                  but its updated ?
                  (so it has one)

                  R 1 Reply Last reply
                  0
                  • mrjjM mrjj

                    @RobDaNet
                    Hi
                    The image
                    alt text

                    no ;

                    but its updated ?
                    (so it has one)

                    R Offline
                    R Offline
                    RobDaNet
                    wrote on last edited by
                    #9

                    @mrjj If I put a ';' in the macro I cannot pass it to a function, so I need the ';' to be added at the initialisation point. Also, it shouldn't be an error either passing Nil to a function without the ';', don't you think ?

                    R mrjjM 2 Replies Last reply
                    0
                    • R RobDaNet

                      @mrjj If I put a ';' in the macro I cannot pass it to a function, so I need the ';' to be added at the initialisation point. Also, it shouldn't be an error either passing Nil to a function without the ';', don't you think ?

                      R Offline
                      R Offline
                      RobDaNet
                      wrote on last edited by
                      #10

                      @RobDaNet I was't trying to be funny, by the way. My point is that once the macro is expanded I have, from a C point of view, no error, even if I pass the macro to a function.

                      1 Reply Last reply
                      0
                      • R RobDaNet

                        @mrjj If I put a ';' in the macro I cannot pass it to a function, so I need the ';' to be added at the initialisation point. Also, it shouldn't be an error either passing Nil to a function without the ';', don't you think ?

                        mrjjM Offline
                        mrjjM Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        Hi
                        Ah, yes if you use it as a parameter and not just for an assignment
                        then the ; cannot be included.

                        but then you must add it when assigning. so in that context
                        u->closed_value = Nil;//extra ;
                        the ; is not really extra. (IMHO)

                        Are you saying that with a c compiler it will accept
                        the define with no ;
                        at a assignment?
                        xxx = Nil

                        R 2 Replies Last reply
                        1
                        • mrjjM mrjj

                          Hi
                          Ah, yes if you use it as a parameter and not just for an assignment
                          then the ; cannot be included.

                          but then you must add it when assigning. so in that context
                          u->closed_value = Nil;//extra ;
                          the ; is not really extra. (IMHO)

                          Are you saying that with a c compiler it will accept
                          the define with no ;
                          at a assignment?
                          xxx = Nil

                          R Offline
                          R Offline
                          RobDaNet
                          wrote on last edited by
                          #12

                          @mrjj Not at all, I'm saying that in the initialization the ';' token is present and I shouldn't get those underlines.

                          1 Reply Last reply
                          0
                          • mrjjM mrjj

                            Hi
                            Ah, yes if you use it as a parameter and not just for an assignment
                            then the ; cannot be included.

                            but then you must add it when assigning. so in that context
                            u->closed_value = Nil;//extra ;
                            the ; is not really extra. (IMHO)

                            Are you saying that with a c compiler it will accept
                            the define with no ;
                            at a assignment?
                            xxx = Nil

                            R Offline
                            R Offline
                            RobDaNet
                            wrote on last edited by
                            #13

                            @mrjj The message in the comment is what I get by hovering the mouse on the underline.

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

                              hi
                              well if you include the "extra" ; then
                              i agree it should not whine.
                              However, in that old creator, im not sure that can be disabled.

                              and just so i understand.
                              even with the ;
                              you get
                              u->next = NULL; // expected a declaration
                              return u; // expected token ';' got '{'

                              ?

                              R 1 Reply Last reply
                              2
                              • mrjjM mrjj

                                hi
                                well if you include the "extra" ; then
                                i agree it should not whine.
                                However, in that old creator, im not sure that can be disabled.

                                and just so i understand.
                                even with the ;
                                you get
                                u->next = NULL; // expected a declaration
                                return u; // expected token ';' got '{'

                                ?

                                R Offline
                                R Offline
                                RobDaNet
                                wrote on last edited by
                                #15

                                @mrjj Thanks

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

                                  Hi
                                  Just as a note:
                                  You can use QtCreator with any version of Qt.
                                  So if you wish you could use the newest Creator with Qt5.5.1
                                  Its only if you wish to make Creator plugins the version does matter.

                                  That said, im still not sure why it underlines it as
                                  checking with other macros it seems to accept it.

                                  R 1 Reply Last reply
                                  2
                                  • mrjjM mrjj

                                    Hi
                                    Just as a note:
                                    You can use QtCreator with any version of Qt.
                                    So if you wish you could use the newest Creator with Qt5.5.1
                                    Its only if you wish to make Creator plugins the version does matter.

                                    That said, im still not sure why it underlines it as
                                    checking with other macros it seems to accept it.

                                    R Offline
                                    R Offline
                                    RobDaNet
                                    wrote on last edited by
                                    #17

                                    @mrjj Thanks for your note, too. I'm sure I will get the last version very soon. Especially since it offer the option to turn off the error underlining system. Maybe on the newest version these kind of macros won't even be flagged as an error, as you noticed before.

                                    mrjjM 1 Reply Last reply
                                    1
                                    • R RobDaNet

                                      @mrjj Thanks for your note, too. I'm sure I will get the last version very soon. Especially since it offer the option to turn off the error underlining system. Maybe on the newest version these kind of macros won't even be flagged as an error, as you noticed before.

                                      mrjjM Offline
                                      mrjjM Offline
                                      mrjj
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #18

                                      @RobDaNet
                                      I tried to create a Object as a struct with
                                      int n;
                                      and it seems not to mind :)

                                      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