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. Show only rows with invalid value in QT Tree view

Show only rows with invalid value in QT Tree view

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 3 Posters 493 Views
  • 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.
  • A Offline
    A Offline
    Ayush Gupta
    wrote on last edited by
    #1

    I have one tree view. I need one functionality like check box.
    On clicking on check Box it should display the rows with only invalid values.
    On uncheck the tree should show all the rows.
    How can I achieve this.

    Pl45m4P JonBJ 3 Replies Last reply
    0
    • A Ayush Gupta

      I have one tree view. I need one functionality like check box.
      On clicking on check Box it should display the rows with only invalid values.
      On uncheck the tree should show all the rows.
      How can I achieve this.

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by
      #2

      @ayush-gupta

      What are invalid value? What model are you using?
      You can set the "isCheckable" flag to your item to make it checkable.


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      1 Reply Last reply
      1
      • A Ayush Gupta

        I have one tree view. I need one functionality like check box.
        On clicking on check Box it should display the rows with only invalid values.
        On uncheck the tree should show all the rows.
        How can I achieve this.

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by JonB
        #3

        @ayush-gupta
        (Probably) Like all these "make QTreeView only show certain rows", interpose a https://doc.qt.io/qt-5/qsortfilterproxymodel.html between the view and your actual model to filter in/out desired rows, according to whatever your criteria are.

        1 Reply Last reply
        1
        • A Offline
          A Offline
          Ayush Gupta
          wrote on last edited by
          #4

          @pl45m4 said in Show only rows with invalid value in QT Tree view:

          isCheckable

          @JonB you mean to say override filterAcceptsRow?

          @Pl45m4 I am using QSortFilterProxyModel. I mean some rows with invalid value which i mark red background in my tree view.
          isCheckable is not my requirement.

          JonBJ 1 Reply Last reply
          0
          • A Ayush Gupta

            I have one tree view. I need one functionality like check box.
            On clicking on check Box it should display the rows with only invalid values.
            On uncheck the tree should show all the rows.
            How can I achieve this.

            Pl45m4P Offline
            Pl45m4P Offline
            Pl45m4
            wrote on last edited by Pl45m4
            #5

            @ayush-gupta said in Show only rows with invalid value in QT Tree view:

            I need one functionality like check box.

            You were asking for a checkBox inside your treeView. This was at least one part of your question :)

            So you have your checkBox already in your view and you are asking for a solution to toggle between "all" and "invalid only" ?


            If debugging is the process of removing software bugs, then programming must be the process of putting them in.

            ~E. W. Dijkstra

            JonBJ 1 Reply Last reply
            1
            • A Ayush Gupta

              @pl45m4 said in Show only rows with invalid value in QT Tree view:

              isCheckable

              @JonB you mean to say override filterAcceptsRow?

              @Pl45m4 I am using QSortFilterProxyModel. I mean some rows with invalid value which i mark red background in my tree view.
              isCheckable is not my requirement.

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #6

              @ayush-gupta

              @JonB you mean to say override filterAcceptsRow?

              Yes, via https://doc.qt.io/qt-5/qsortfilterproxymodel.html#filterAcceptsRow.

              1 Reply Last reply
              1
              • Pl45m4P Pl45m4

                @ayush-gupta said in Show only rows with invalid value in QT Tree view:

                I need one functionality like check box.

                You were asking for a checkBox inside your treeView. This was at least one part of your question :)

                So you have your checkBox already in your view and you are asking for a solution to toggle between "all" and "invalid only" ?

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by JonB
                #7

                @pl45m4
                I don't think OP is looking for a checkbox against each row. He simply has some widget outside the table view rows which he uses to indicate what behaviour is wanted (exclude "invalid" rows or not) across all table rows.

                1 Reply Last reply
                1
                • A Offline
                  A Offline
                  Ayush Gupta
                  wrote on last edited by
                  #8

                  @Pl45m4 Yes I need a solution to toggle between all and invalid only.

                  @JonB @Pl45m4 Is right
                  What I want tree views contains lot of rows with data.
                  Also the invalid rows which are marked as red.
                  So on clicking check box only invalid rows should be displayed in tree view
                  on uncheck all rows with invalid value should display.

                  @JonB If I use filterAcceptAllrow() which property of item helps me in filtering can you point it out?

                  JonBJ 1 Reply Last reply
                  0
                  • A Ayush Gupta

                    @Pl45m4 Yes I need a solution to toggle between all and invalid only.

                    @JonB @Pl45m4 Is right
                    What I want tree views contains lot of rows with data.
                    Also the invalid rows which are marked as red.
                    So on clicking check box only invalid rows should be displayed in tree view
                    on uncheck all rows with invalid value should display.

                    @JonB If I use filterAcceptAllrow() which property of item helps me in filtering can you point it out?

                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by JonB
                    #9

                    @ayush-gupta
                    What you say does not make sense. If you have a checkbox against each individual row, how can that be for showing/hiding/filtering all rows? If you want one checkbox to affect all rows somehow, which is what you say, it should not be against each row, but outside of the rows. I leave it to you.

                    @JonB If I use filterAcceptAllrow() which property of item helps me in filtering can you point it out?

                    Only you know whatever it is in each row in your model which makes you consider that row to be "invalid". It's not a property of the view or model. Presumably whatever criteria you currently use for your "Also the invalid rows which are marked as red".

                    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