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. QStyledItemDelegate: height for width
QtWS25 Last Chance

QStyledItemDelegate: height for width

Scheduled Pinned Locked Moved General and Desktop
3 Posts 1 Posters 1.2k 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.
  • T Offline
    T Offline
    tdiff
    wrote on last edited by
    #1

    Hi

    What is the best way to implement ItemDelegate that changes it's height when view is resized?

    I want to implement my own "very special" item delegate for QTableWidget in such a manner that it will have different height depending if I can layout all the data in a single line or not. In later case (item's width was too small) I want to make it taller, thus I would be able to put data into several lines. Width of the item is obviously correlated with width of QTableWidget.

    The problem is that in delegate's sizeHint() function there is no way to find out anything about TableView's size to make decision about what kind of layout's should I be using.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tdiff
      wrote on last edited by
      #2

      Well, may be I should be passing pointer to view as a parameter of ItemDelegate?
      But this looks like a hack and I would prefer avoiding this approach.

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tdiff
        wrote on last edited by
        #3

        no, it doesn't work anyway: rows heights seem not to be updated dynamically at all.

        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