Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Application is crashing on A20-olimexXino-Micro board with debian jessy linux on it with Qt5.6
Qt 6.12 LTS is out! See what's new in the release blog

Application is crashing on A20-olimexXino-Micro board with debian jessy linux on it with Qt5.6

Scheduled Pinned Locked Moved Solved General and Desktop
12 Posts 3 Posters 4.7k 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.
  • VRoninV Offline
    VRoninV Offline
    VRonin
    wrote on last edited by
    #3

    You are just doing something unbelievably intricate for an operation that would be trivial with a QStyledItemDelegate. Did you consider using it instead?

    "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
    ~Napoleon Bonaparte

    On a crusade to banish setIndexWidget() from the holy land of Qt

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

      Hi
      Its good description but nothing really spring to eye.
      Only note is removeWidget will take out the widget from layout
      but ownership remains the same.
      So if the original parent is deleted, it will delete it also.
      But you seem to override it anyway with
      formWidget = data->objWidget;

      Also, this
      devStr = ui->tblClient->model()->data(ui->tblClient->model()->index(ui->tblClient->currentRow(),ui->tblClient->currentColumn())).toString();

      Makes me nervous as one NULL and its a crash :)

      S 1 Reply Last reply
      1
      • VRoninV Offline
        VRoninV Offline
        VRonin
        wrote on last edited by
        #5

        Other possible sources of problems:

        • MsgBox on the stack if you supply a parent in the constructor
        • what is layout?

        "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
        ~Napoleon Bonaparte

        On a crusade to banish setIndexWidget() from the holy land of Qt

        1 Reply Last reply
        2
        • mrjjM mrjj

          Hi
          Its good description but nothing really spring to eye.
          Only note is removeWidget will take out the widget from layout
          but ownership remains the same.
          So if the original parent is deleted, it will delete it also.
          But you seem to override it anyway with
          formWidget = data->objWidget;

          Also, this
          devStr = ui->tblClient->model()->data(ui->tblClient->model()->index(ui->tblClient->currentRow(),ui->tblClient->currentColumn())).toString();

          Makes me nervous as one NULL and its a crash :)

          S Offline
          S Offline
          Sagar Ojha
          wrote on last edited by
          #6

          @mrjj is it possible
          ui->tblClient->model()->data(ui->tblClient->model()->index(ui->tblClient->currentRow(),ui->tblClient->currentColumn())).toString();

          this will return NULL, I mean, if there is a cell present on tablewidget, only then I am able to clicke on it, and in this condition is it possible??

          mrjjM 1 Reply Last reply
          0
          • S Sagar Ojha

            @mrjj is it possible
            ui->tblClient->model()->data(ui->tblClient->model()->index(ui->tblClient->currentRow(),ui->tblClient->currentColumn())).toString();

            this will return NULL, I mean, if there is a cell present on tablewidget, only then I am able to clicke on it, and in this condition is it possible??

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

            @Sagar-Ojha
            Hi
            Yes if only used when clicking it might be safe.
            But its also a bit hard to read compared to something like

            auto model = ui->tblClient->model();
            auto client = ui->tblClient;
            int row = client -> currentRow();
            int row = client -> currentColumn();
            devStr = model->data(  model->index ( row, col ) ).toString();
            
            S 1 Reply Last reply
            1
            • mrjjM mrjj

              @Sagar-Ojha
              Hi
              Yes if only used when clicking it might be safe.
              But its also a bit hard to read compared to something like

              auto model = ui->tblClient->model();
              auto client = ui->tblClient;
              int row = client -> currentRow();
              int row = client -> currentColumn();
              devStr = model->data(  model->index ( row, col ) ).toString();
              
              S Offline
              S Offline
              Sagar Ojha
              wrote on last edited by
              #8

              @mrjj This code is working fine,
              What would be the correct way to remove privious widget and add another widget to a frame, am i missing something to do the same??

              mrjjM 1 Reply Last reply
              0
              • S Sagar Ojha

                @mrjj This code is working fine,
                What would be the correct way to remove privious widget and add another widget to a frame, am i missing something to do the same??

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

                @Sagar-Ojha said in Application is crashing on A20-olimexXino-Micro board with debian jessy linux on it with Qt5.6:

                What would be the correct way to remove privious widget and add another widget to a frame, am i missing something to do the same??

                You mean a QFrame with a layout ?

                Or do you mean how to have widgets in cells of a View class ?

                If its anything to do with Table/tree views then as @VRonin suggest the right way is via
                QStyledItemDelegate

                So its depends :)

                S 1 Reply Last reply
                0
                • mrjjM mrjj

                  @Sagar-Ojha said in Application is crashing on A20-olimexXino-Micro board with debian jessy linux on it with Qt5.6:

                  What would be the correct way to remove privious widget and add another widget to a frame, am i missing something to do the same??

                  You mean a QFrame with a layout ?

                  Or do you mean how to have widgets in cells of a View class ?

                  If its anything to do with Table/tree views then as @VRonin suggest the right way is via
                  QStyledItemDelegate

                  So its depends :)

                  S Offline
                  S Offline
                  Sagar Ojha
                  wrote on last edited by
                  #10

                  @mrjj Yes, I ment QFrame with a layout.

                  mrjjM 1 Reply Last reply
                  0
                  • S Sagar Ojha

                    @mrjj Yes, I ment QFrame with a layout.

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

                    @Sagar-Ojha
                    Then there is nothing wrong with removeWidget as such. :)

                    For QTableWidget stuff, delegates are "better".

                    1 Reply Last reply
                    2
                    • S Offline
                      S Offline
                      Sagar Ojha
                      wrote on last edited by
                      #12

                      Problem related to this topic is solved. There are other problems with this project I am dealing now, thanks @mrjj and @VRonin your suggestion were helpfull regarding to this problem :)

                      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
                      • Unsolved