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. How to set the min and max width of a tableview column while resizing in qml
Qt 6.11 is out! See what's new in the release blog

How to set the min and max width of a tableview column while resizing in qml

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 1.4k 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.
  • N Offline
    N Offline
    Noor Fathima
    wrote on last edited by
    #1

    Hi

    I am working on Table view in qml but facing issue in setting the min and max width of a table view column while resizing as there is no such property available for Tableviewcolumn.
    The columns are resized freely but i want it to be resized with an explicitly provided max and minimum width.
    Can anyone support me on this?

    M 1 Reply Last reply
    1
    • N Noor Fathima

      Hi

      I am working on Table view in qml but facing issue in setting the min and max width of a table view column while resizing as there is no such property available for Tableviewcolumn.
      The columns are resized freely but i want it to be resized with an explicitly provided max and minimum width.
      Can anyone support me on this?

      M Offline
      M Offline
      Mr. MG
      wrote on last edited by Mr. MG
      #2

      @Noor-Fathima,

      Hello! You can utilize the columnWidthProvider function by passing a calculation function to determine the maximum and minimum widths of columns. Here's an illustration:

      columnWidthProvider: function(column) {
          let width = explicitColumnWidth(column);
          if (width >= 0)
              return width;
          return explicitColumnWidth(column);
      }
      

      In this example, calculateColumnWidth() is a function that calculates the explicit width of the column, while calculateImplicitWidth() calculates the implicit width. Adjust these functions according to your specific requirements.

      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