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
Forum Updated to NodeBB v4.3 + New Features

Show only rows with invalid value in QT Tree view

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 3 Posters 509 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.
  • A Offline
    A Offline
    Ayush Gupta
    wrote on 9 Aug 2019, 05:10 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.

    P J 3 Replies Last reply 9 Aug 2019, 09:28
    0
    • A Ayush Gupta
      9 Aug 2019, 05:10

      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.

      P Offline
      P Offline
      Pl45m4
      wrote on 9 Aug 2019, 09:28 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
        9 Aug 2019, 05:10

        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.

        J Offline
        J Offline
        JonB
        wrote on 9 Aug 2019, 09:43 last edited by JonB 8 Sept 2019, 09:43
        #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 9 Aug 2019, 09:48 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.

          J 1 Reply Last reply 9 Aug 2019, 09:54
          0
          • A Ayush Gupta
            9 Aug 2019, 05:10

            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.

            P Offline
            P Offline
            Pl45m4
            wrote on 9 Aug 2019, 09:53 last edited by Pl45m4 8 Sept 2019, 09:55
            #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

            J 1 Reply Last reply 9 Aug 2019, 09:55
            1
            • A Ayush Gupta
              9 Aug 2019, 09:48

              @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.

              J Offline
              J Offline
              JonB
              wrote on 9 Aug 2019, 09:54 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
              • P Pl45m4
                9 Aug 2019, 09:53

                @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" ?

                J Offline
                J Offline
                JonB
                wrote on 9 Aug 2019, 09:55 last edited by JonB 8 Sept 2019, 09:55
                #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 9 Aug 2019, 10:01 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?

                  J 1 Reply Last reply 9 Aug 2019, 10:05
                  0
                  • A Ayush Gupta
                    9 Aug 2019, 10:01

                    @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?

                    J Offline
                    J Offline
                    JonB
                    wrote on 9 Aug 2019, 10:05 last edited by JonB 8 Sept 2019, 10:07
                    #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

                    4/9

                    9 Aug 2019, 09:48

                    • Login

                    • Login or register to search.
                    4 out of 9
                    • First post
                      4/9
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved