Qt Forum

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

    Call for Presentations - Qt World Summit

    QStyledItemDelegate: height for width

    General and Desktop
    1
    3
    926
    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.
    • T
      tdiff last edited by

      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 Reply Quote 0
      • T
        tdiff last edited by

        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 Reply Quote 0
        • T
          tdiff last edited by

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

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