Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Unsolved How to recognize padding for a QTableView table item?

    General and Desktop
    padding qtreeview item style
    2
    2
    1060
    Loading More Posts
    • 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.
    • X
      xintrea last edited by xintrea

      For a column with an icon and text (left column), I need to calculate the fixed column width and set it in pixels (as the architect wants).

      The size of the icon is known, the size of the longest line of text in the column is also known and is calculated through fontMetrics (). Only the default padding used in the cell is unknown, and it is needed for calculations.

      I read the documentation, but I find only solutions "how to install padding":

      ui-> fingerTableView-> setStyleSheet ("QTableView :: item {padding: 25px}");
      

      But I need to do the opposite thing: how to get the default padding from the table cell.

      There is a styleSheet () method that returns a style, and I could parse it. But the problem is that this method actually returns just the style specified through setStyleSheet (), not the default style.

      Where else can I get the default padding for the table item, I can not figure it out. Help.

      1 Reply Last reply Reply Quote 0
      • Christian Ehrlicher
        Christian Ehrlicher Lifetime Qt Champion last edited by

        @xintrea said in How to recognize padding for a QTableView table item?:

        not the default style.

        Only the stylesheet style provides a padding (see box model), all other styles don't have a 'padding' value at all. So what do you want exactly (and why)?

        Qt has to stay free or it will die.

        1 Reply Last reply Reply Quote 1
        • First post
          Last post