Qt Forum

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

    Update: Forum Guidelines & Code of Conduct

    [Reworded question :)] How to set minimum (but still expandable) size for column?

    General and Desktop
    1
    2
    830
    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.
    • M
      Moschops last edited by

      I have a QTreeView with four columns. Sometimes, on the Solaris build, the first column shrinks to the width of the little tree-navigation buttons (those little buttons next to a row that expand the row to show its children). Just on the Solaris version.

      I call setStretchLastSection(false) after setting the model, as advised elsewhere, but it doesn't seem to make a difference.

      @ ui->projectExplorerTreeView->setModel(model.data());
      ui->projectExplorerTreeView->header()->setStretchLastSection(false);@

      I'd rather not have to manually force the first column to have a minimum size, as it's very conceivable that the user might want to shrink the column size - it's just very bad for it to happen by itself. Are there any other settings I could fiddle with that anyone knows of?

      1 Reply Last reply Reply Quote 0
      • M
        Moschops last edited by

        Okay, no response to this question; how about changing it a bit. How can I set a minimum size for the first column, such that the user can resize it manually but not below a certain width? Hopefully, if I can do this, whatever is causing the Solaris version to shrink it to almost zero will also obey the minimum size.

        I see functions for setting the size, but I don't see one for setting a minimum allowed size.

        Edit: I have a headerMinimumSectionSize set in the header's properties, but this seems to be ignored sometimes on the Solaris version; from reading the documentation, I can't tell if the headerMinimumSectonSize is meant to be an absolute, always on minimum value no matter what, or if it's something that could be ignored.

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