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. QDialog window usage and exemples...
Forum Updated to NodeBB v4.3 + New Features

QDialog window usage and exemples...

Scheduled Pinned Locked Moved General and Desktop
22 Posts 3 Posters 7.3k 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.
  • jerome_isAviableJ Offline
    jerome_isAviableJ Offline
    jerome_isAviable
    wrote on last edited by
    #11

    thanks Andre, yur explication is ok for me.
    Also, i try it an ok... the QDialog window open fine.

    BUT, i have always the same problem crash application (really strange).
    This not resolve the problem, but maybe it is a way for understand, because...
    because when i call, inside these QDialog windows (like from every where) the QSqlQuery query, i do a query.exec().
    Also, i see inside debug tool that it crash on sql driver use...
    So maybe it is the same problem... of bad call.

    what do you think ?
    is it possible to use same technic for call a query than for call a QDialog or everythings ?

    (again, thanks for your answer, i learn really a lot with you)

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Subst27
      wrote on last edited by
      #12

      get the source code
      how you declare the query and execute it ?

      1 Reply Last reply
      0
      • jerome_isAviableJ Offline
        jerome_isAviableJ Offline
        jerome_isAviable
        wrote on last edited by
        #13

        in fact someone make me understand that there is no way to do same style for execute query.
        For use QSqlQuery, i go by declare the database default access, and then declare a QSqlQuery. After, i use query.prepare(), and if need, query.bindValue(). after that, i do an query.exec() around condition for get back an eventuall error, and then a loop while(query.next()) for catch the datas.

        but also, in the first QDialog window, i use a QSqlQueryModel and use model->setQuery("SELECT...blablabla...");

        i think that there is an internal conflict because debug gdb tell me that it crash on the postgresql drivers qsl library.

        so... i try to find a solution...

        1 Reply Last reply
        0
        • jerome_isAviableJ Offline
          jerome_isAviableJ Offline
          jerome_isAviable
          wrote on last edited by
          #14

          maybe the solution is to not use QSqlQueryModel... but pfffff... i'm lazy and this tool is nice and if it will be impossible to trust the Qt tools and do all without model helper... why follow to use Qt and not just use WXWidget in fact ?

          I just follow the exemples and this crash is really strange. In fact, i hope it is an error from my-self.

          I hope also to find a solution without re-invent the wheel or have to big difficulties.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #15

            And you think that switching toolkit would solve SQL driver issues for you?

            1 Reply Last reply
            0
            • jerome_isAviableJ Offline
              jerome_isAviableJ Offline
              jerome_isAviable
              wrote on last edited by
              #16

              Subst27, thank you a lot for give some time for try to help.
              Also, i give you some parts of my code.
              like that you could have a look and see if there is something you like or dislike, or maybe could use for yourself, and maybe find a bad code.
              this code is not clean... but some parts are considered as finished inside.

              https://gist.github.com/anonymous/f203fb28adf22d8e241a

              1 Reply Last reply
              0
              • jerome_isAviableJ Offline
                jerome_isAviableJ Offline
                jerome_isAviable
                wrote on last edited by
                #17

                Andre: i really don't know. i don't know because i can not understand why this issue occur.
                If i caould be able to understand what's happen really, i will sure find a good solution (and maybe tuch the code of the driver). But i think this is not my level.

                I just try to understand at this step of my reflexion... and then, i see that when i call this from an other one QDialog window who not use QSqlQueryModel, there is no problem... so i think that maybe there is a problem inside the code of the QSqlQueryModel tool... but i'm really not sure, i just do a link by deduction.

                1 Reply Last reply
                0
                • jerome_isAviableJ Offline
                  jerome_isAviableJ Offline
                  jerome_isAviable
                  wrote on last edited by
                  #18

                  for the part of code... this part of my open_project::on_projects_list_clicked() file has to be change by this:
                  @
                  void open_project::on_projects_list_clicked(const QModelIndex &index)
                  {
                  QString sformat = QString("dd/MM/yyyy %1 hh:mm:ss").arg(tr("à"));
                  name = model->record(index.row()).value("name").toString();
                  comment = model->record(index.row()).value("comment").toString();
                  ref_project = model->record(index.row()).value("refproject").toString();
                  date_create = model->record(index.row()).value("datecreate").toDateTime();
                  id = model->record(index.row()).value("id").toInt();
                  ui_open_project->label_name->setText(name);
                  ui_open_project->comment->setText(comment);
                  ui_open_project->ref_client->setText(ref_project);
                  ui_open_project->date_create->setText(date_create.toString(sformat));
                  if (id != 0)
                  locations_refresh();
                  ui_open_project->treeView_locations->setColumnHidden(1,true);
                  }
                  @

                  1 Reply Last reply
                  0
                  • jerome_isAviableJ Offline
                    jerome_isAviableJ Offline
                    jerome_isAviable
                    wrote on last edited by
                    #19

                    ok Andre, now i swith toolkit and not use QsqlQueryModel for popaulate my model for my QListView of the QDialog window who call the other...
                    And YES... this was the problem definitly.

                    So... use QSqlQueryModel without some other use of query could crash the application. I had a good dedustive analyse of the problem. Impossible to use this tool, this tool is not "good" (execpt if you only use one QDialog maybe) and bugged.

                    But... what i can do for post a bug around this tool for Qt ?
                    Wich post could be positive bug report for help to find a solution for this tool can works good ?

                    1 Reply Last reply
                    0
                    • jerome_isAviableJ Offline
                      jerome_isAviableJ Offline
                      jerome_isAviable
                      wrote on last edited by
                      #20

                      here is the modification of my code for be able to see the application works normally...

                      https://gist.github.com/anonymous/09985ba94fa765754193

                      if someone find why this QSqlQueryModel crash the application, and/or what kind of bug publication i can write, you would be welcome to teach this.

                      thank you for your help and teach.

                      1 Reply Last reply
                      0
                      • jerome_isAviableJ Offline
                        jerome_isAviableJ Offline
                        jerome_isAviable
                        wrote on last edited by
                        #21

                        forget my text about QStandardItem, i was wrong.

                        But not for crash by QSqlQUeryModel use with some other QSqlQuery at same time ith other QDialog window open. I follox my search around this for try to use it well... if possible.

                        I hope one day to grow up my level of C++ for repair the bugged Qt code. I try to have a look inside qsql postgresql driver... but the code is really strange, i can not undersatnd well what the hacker does and why.

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          Subst27
                          wrote on last edited by
                          #22

                          well..
                          I'v been away

                          now coming back

                          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