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. Need help with using the debugger
Forum Updated to NodeBB v4.3 + New Features

Need help with using the debugger

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
15 Posts 2 Posters 3.9k 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.
  • Allan5A Offline
    Allan5A Offline
    Allan5
    wrote on last edited by A Former User
    #1

    These is the errors that i have, i don´t know if these errors be of ide or to my errors

    0_1512680455180_error1.png
    0_1512680459589_error2.png
    0_1512680468479_error3.png
    0_1512680474254_error4.png
    0_1512680486437_error5.png
    0_1512680492270_error6.png
    0_1512680497430_error7.png
    0_1512680506105_error8.png
    0_1512680513255_error9.png

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      You have at least one flaw in your code flow. You won't reach the if (existe > 0) line because if your condition becomes true you call return true; after setting existe to 1.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      Allan5A 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi and welcome to devnet,

        You have at least one flaw in your code flow. You won't reach the if (existe > 0) line because if your condition becomes true you call return true; after setting existe to 1.

        Allan5A Offline
        Allan5A Offline
        Allan5
        wrote on last edited by Allan5
        #3

        @SGaist

        Thank you for your answer , but in one of the images inside the cycle “while”it goes into “if”and then gets back true but never goes out of function

        If you want to watch the mistake I can show you in a video

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Can you explain that more precisely ? If the if statement of your while loop goes through then you will return early.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          Allan5A 1 Reply Last reply
          0
          • SGaistS SGaist

            Can you explain that more precisely ? If the if statement of your while loop goes through then you will return early.

            Allan5A Offline
            Allan5A Offline
            Allan5
            wrote on last edited by
            #5

            @SGaist

            I do not speak much English and it helped me with the google translator but the question is:

            When entering my username and password that are correct according to the query, the user finds me and I would have to return true, but doing the 2 things returns true and false at the same time.

            Because the Boolean function when it returns true does not leave the function but it continues with the code that is below and also returns false, that is my error, I mean true and false return at the same time and it does not have to happen according to the language .

            If you want to see my error more thoroughly I made a video.

            This is the video I did if you can help me thanks

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Are you sure your method is not called twice ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              Allan5A 1 Reply Last reply
              0
              • SGaistS SGaist

                Are you sure your method is not called twice ?

                Allan5A Offline
                Allan5A Offline
                Allan5
                wrote on last edited by
                #7

                @SGaist

                if because if you look at the image where I have the conditional where that conditional is called is the only place where the function is called, not if you saw the video? there is how it works, it returns me at the same time true and false, try to uninstall qt and then reinstall it and stay the same

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  A function can't return twice. Hence my question of a double connection or that function called twice from maybe different places in your code.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  Allan5A 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    A function can't return twice. Hence my question of a double connection or that function called twice from maybe different places in your code.

                    Allan5A Offline
                    Allan5A Offline
                    Allan5
                    wrote on last edited by
                    #9

                    @SGaist

                    That's what I wonder, because the function I do not call it twice and if it was then I would always return true because the user exists and returns true but never leaves the function and returns to me but this time false

                    0_1512945550237_error1.png
                    0_1512945565415_error2.png

                    0_1512945579614_error3.png

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      Try an alternative implementation:

                      bool found = false;
                      
                      while (query.next()) {
                          if (/* conditions*/) {
                              found = true;
                              break;
                          }
                      }
                      
                      if (!found) {
                      /* show your dialog */
                      }
                      return found;
                      

                      By the way, why are your re-creating the database connection each time you call your functions ?

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      Allan5A 2 Replies Last reply
                      0
                      • SGaistS SGaist

                        Try an alternative implementation:

                        bool found = false;
                        
                        while (query.next()) {
                            if (/* conditions*/) {
                                found = true;
                                break;
                            }
                        }
                        
                        if (!found) {
                        /* show your dialog */
                        }
                        return found;
                        

                        By the way, why are your re-creating the database connection each time you call your functions ?

                        Allan5A Offline
                        Allan5A Offline
                        Allan5
                        wrote on last edited by
                        #11

                        @SGaist

                        Well, I just did something that I think I should not do but I passed all my class to a dynamic library using certain #ifdef parameters and I started to play with the compiler a bit but I do not know if that would hurt me at the time of package the program in an installer that I put it so that my code is compiled in good execution time that is my logic that if I leave this error in doubt because it passes and test your suggestion but I take the variable as constant I do not know why

                        And thanks

                        1 Reply Last reply
                        0
                        • SGaistS SGaist

                          Try an alternative implementation:

                          bool found = false;
                          
                          while (query.next()) {
                              if (/* conditions*/) {
                                  found = true;
                                  break;
                              }
                          }
                          
                          if (!found) {
                          /* show your dialog */
                          }
                          return found;
                          

                          By the way, why are your re-creating the database connection each time you call your functions ?

                          Allan5A Offline
                          Allan5A Offline
                          Allan5
                          wrote on last edited by
                          #12

                          @SGaist

                          or if and with respect to why I re-create the connection is because I was not throwing an error something strange that at the time of executing the query I could not find the database and so far I do not know why, I have had many problems with sqlite I had already worked with mysql but right now with sqlite has given me many strange problems like for example right now I have a query that I do the same in all the tables that is to insert but when I want to insert it to that table it throws me the error of parameter count mismatch and I'm trying to solve because I get that error

                          1 Reply Last reply
                          0
                          • SGaistS Offline
                            SGaistS Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on last edited by
                            #13

                            When deploying your application you will have to deploy the Qt libraries anyway so having an additional library should really not be a problem.

                            As for the parameter count mismatch, any chance that you are using named placeholders ? If so, please update to Qt 5.10, the SQLite backend has complete support for it since that version.

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            Allan5A 1 Reply Last reply
                            0
                            • SGaistS SGaist

                              When deploying your application you will have to deploy the Qt libraries anyway so having an additional library should really not be a problem.

                              As for the parameter count mismatch, any chance that you are using named placeholders ? If so, please update to Qt 5.10, the SQLite backend has complete support for it since that version.

                              Allan5A Offline
                              Allan5A Offline
                              Allan5
                              wrote on last edited by
                              #14

                              @SGaist

                              Thanks for the help right now I am downloading the update of 5.10, but only by cursiodad, what is the best way to make a portable database with the QT, because my decision had been SQLITE because it created a file as a database to me I would like this because the application I want to be able to take your database to another machine and then import it with my application, because my application will work offline, I do not want it to be connected to another server or that the client has to install other things so that it works for you, suppose SQL SERVER or MYSQL does not, I want it to be portable and that when the client can export a database it can take a file with all the information and all the records and then import it into another machine

                              And thanks for your time in answering me, whenever you want I have a case pack 1500 icons for buttons and other things

                              1 Reply Last reply
                              0
                              • SGaistS Offline
                                SGaistS Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on last edited by
                                #15

                                You can dump the content of a Postgresql/MySQL database into a file if wanted and load that file again on another instance however that still means that you have to have one of these server running somewhere accessible.

                                Interested in AI ? www.idiap.ch
                                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                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