Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. TableView row height
Forum Updated to NodeBB v4.3 + New Features

TableView row height

Scheduled Pinned Locked Moved QML and Qt Quick
tableviewheightrowdelegate
15 Posts 4 Posters 7.5k Views 3 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.
  • S Offline
    S Offline
    sierdzio
    Moderators
    wrote on 27 Mar 2015, 11:40 last edited by
    #2

    Does rowDelegate.height work for you? Or just chekcing the delegate you have connected?

    (Z(:^

    1 Reply Last reply
    0
    • M Offline
      M Offline
      morte
      wrote on 27 Mar 2015, 13:12 last edited by morte
      #3

      @sierdzio said:

      Does rowDelegate.height work for you? Or just chekcing the delegate you have connected?

      No, i dont know how to access height property of rowDelegate.
      I want get row height value to set same height in my custom section delegate.

      1 Reply Last reply
      0
      • T Offline
        T Offline
        th.thielemann
        wrote on 28 Mar 2015, 10:31 last edited by
        #4

        But this sets the height for all rows:

            TableView
            {
                id: tableView
                anchors.fill: tableArea
                headerDelegate: headersDel
                rowDelegate:
                Rectangle
                {
                    height: 30 // Height for all columns
                }
        

        ...
        }

        and in your column delegate you can use:

            Component
            {
                id: iconRowDelegate
                Image
                {
                    anchors.fill: parent            
                    fillMode: Image.Pad
                    source: "Icon.png"
                }
            }
        
        M 1 Reply Last reply 30 Mar 2015, 08:57
        0
        • T th.thielemann
          28 Mar 2015, 10:31

          But this sets the height for all rows:

              TableView
              {
                  id: tableView
                  anchors.fill: tableArea
                  headerDelegate: headersDel
                  rowDelegate:
                  Rectangle
                  {
                      height: 30 // Height for all columns
                  }
          

          ...
          }

          and in your column delegate you can use:

              Component
              {
                  id: iconRowDelegate
                  Image
                  {
                      anchors.fill: parent            
                      fillMode: Image.Pad
                      source: "Icon.png"
                  }
              }
          
          M Offline
          M Offline
          morte
          wrote on 30 Mar 2015, 08:57 last edited by
          #5

          @th.thielemann
          I don't want to redefine rowDelegate, i want get height from it (since it differs depending on platform and pixel density).
          Question become: how to access rowDelegate's height property?

          P 1 Reply Last reply 30 Mar 2015, 09:41
          0
          • M morte
            30 Mar 2015, 08:57

            @th.thielemann
            I don't want to redefine rowDelegate, i want get height from it (since it differs depending on platform and pixel density).
            Question become: how to access rowDelegate's height property?

            P Offline
            P Offline
            p3c0
            Moderators
            wrote on 30 Mar 2015, 09:41 last edited by
            #6

            @morte Since there is no other way, for now, you can use private properties.

            console.log(tableview.__currentRowItem.height) 
            //tableview = id of TableView
            

            157

            1 Reply Last reply
            1
            • M Offline
              M Offline
              morte
              wrote on 30 Mar 2015, 14:13 last edited by morte 4 Jan 2015, 14:22
              #7

              @p3c0
              I get actual height value, but first row in view not draws after that, i don't know why yet.

              TableView {
              	id: view
              	property int row_height
                  anchors.fill: parent
              	section.delegate: section_delegate
                   Component.onCompleted {
                      currentRow = 0;
                      row_height = ____currentRowItem.height;
                   }
              }
              
              Component {
              	id: section_delegate
              	Rectangle {
              		width: view.width
              		height: view.row_height
              	}
              }
              
              P 1 Reply Last reply 31 Mar 2015, 06:40
              0
              • M morte
                30 Mar 2015, 14:13

                @p3c0
                I get actual height value, but first row in view not draws after that, i don't know why yet.

                TableView {
                	id: view
                	property int row_height
                    anchors.fill: parent
                	section.delegate: section_delegate
                     Component.onCompleted {
                        currentRow = 0;
                        row_height = ____currentRowItem.height;
                     }
                }
                
                Component {
                	id: section_delegate
                	Rectangle {
                		width: view.width
                		height: view.row_height
                	}
                }
                
                P Offline
                P Offline
                p3c0
                Moderators
                wrote on 31 Mar 2015, 06:40 last edited by
                #8

                @morte Can you explain with an example what you are trying to do ?

                157

                M 1 Reply Last reply 31 Mar 2015, 08:22
                0
                • P p3c0
                  31 Mar 2015, 06:40

                  @morte Can you explain with an example what you are trying to do ?

                  M Offline
                  M Offline
                  morte
                  wrote on 31 Mar 2015, 08:22 last edited by
                  #9

                  @p3c0
                  There is TableView with my section delegate and i want to set section delegate's height same as height of rows in view.

                  P 1 Reply Last reply 31 Mar 2015, 09:21
                  0
                  • M morte
                    31 Mar 2015, 08:22

                    @p3c0
                    There is TableView with my section delegate and i want to set section delegate's height same as height of rows in view.

                    P Offline
                    P Offline
                    p3c0
                    Moderators
                    wrote on 31 Mar 2015, 09:21 last edited by
                    #10

                    @morte You will need to set current item in TableView. You can do this by using currentRow of TableView.

                    Component.onCompleted: tableView.currentRow = 0
                    

                    157

                    M 2 Replies Last reply 31 Mar 2015, 13:44
                    0
                    • P p3c0
                      31 Mar 2015, 09:21

                      @morte You will need to set current item in TableView. You can do this by using currentRow of TableView.

                      Component.onCompleted: tableView.currentRow = 0
                      
                      M Offline
                      M Offline
                      morte
                      wrote on 31 Mar 2015, 13:44 last edited by
                      #11

                      @p3c0
                      Thats it, thanks!

                      1 Reply Last reply
                      0
                      • P p3c0
                        31 Mar 2015, 09:21

                        @morte You will need to set current item in TableView. You can do this by using currentRow of TableView.

                        Component.onCompleted: tableView.currentRow = 0
                        
                        M Offline
                        M Offline
                        morte
                        wrote on 1 Apr 2015, 12:11 last edited by morte 4 Jan 2015, 12:13
                        #12

                        @p3c0
                        I have just tested it: anyway setting
                        Component.onCompleted: tableView.currentRow = 0
                        in view gives incorrect behavior of view

                        P 1 Reply Last reply 1 Apr 2015, 12:17
                        0
                        • M morte
                          1 Apr 2015, 12:11

                          @p3c0
                          I have just tested it: anyway setting
                          Component.onCompleted: tableView.currentRow = 0
                          in view gives incorrect behavior of view

                          P Offline
                          P Offline
                          p3c0
                          Moderators
                          wrote on 1 Apr 2015, 12:17 last edited by
                          #13

                          @morte Do you get the height properly after setting currentRow ?

                          157

                          M 1 Reply Last reply 1 Apr 2015, 15:34
                          0
                          • P p3c0
                            1 Apr 2015, 12:17

                            @morte Do you get the height properly after setting currentRow ?

                            M Offline
                            M Offline
                            morte
                            wrote on 1 Apr 2015, 15:34 last edited by morte 4 Jan 2015, 15:35
                            #14

                            @p3c0
                            I get actual height value, but first row in view not draws after that, i don't know why yet.

                            TableView {
                            	id: view
                            	property int row_height
                                anchors.fill: parent
                            	section.delegate: section_delegate
                                 Component.onCompleted {
                                    currentRow = 0;
                                    row_height = __currentRowItem.height;
                                 }
                            }
                            
                            Component {
                            	id: section_delegate
                            	Rectangle {
                            		width: view.width
                            		height: view.row_height
                            	}
                            }
                            
                            P 1 Reply Last reply 2 Apr 2015, 04:49
                            0
                            • M morte
                              1 Apr 2015, 15:34

                              @p3c0
                              I get actual height value, but first row in view not draws after that, i don't know why yet.

                              TableView {
                              	id: view
                              	property int row_height
                                  anchors.fill: parent
                              	section.delegate: section_delegate
                                   Component.onCompleted {
                                      currentRow = 0;
                                      row_height = __currentRowItem.height;
                                   }
                              }
                              
                              Component {
                              	id: section_delegate
                              	Rectangle {
                              		width: view.width
                              		height: view.row_height
                              	}
                              }
                              
                              P Offline
                              P Offline
                              p3c0
                              Moderators
                              wrote on 2 Apr 2015, 04:49 last edited by
                              #15

                              @morte What do you mean by not draws ? See if you get updated height inside the Component.

                              157

                              1 Reply Last reply
                              0

                              11/15

                              31 Mar 2015, 13:44

                              • Login

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