That’s kind of what I figured out .
What I wound up doing, was setting elide mode to none on the view, then doing a
resize of each column to fit, then resizing the dialog so the treeview is the
correct size, then setting textmode back to elide right.
This way, if the customer resizes, it will still elide, but it comes up without.
Scott
-Original Message-
From: Volker Hilsheimer
Sent: Friday, June 3, 2022 5:12 AM
To: Scott Bloom
Cc: interest@qt-project.org
Subject: Re: [Interest] Anyway to tell if a QModelIndex's data will be
displayed with an elide?
> On 2 Jun 2022, at 19:31, Scott Bloom wrote:
>
> I have a request, to open a dialog without out any eliding, which is easy
> enough to do via the views textElideMode.
>
> So I can resize all the columns to fit, pretty straight forward, if I don’t
> set the textElideMode
>
> However, they also want no the data to be full visible, and not have to
> resize the dialog/scroll.
>
> However, I cant seem to find a proper “this is the size the treeview (though
> the same issue exists for any abstractview) minimum size hnt that wont
> require scrollbars.
>
> Am I missing something obvious? (I must be)
>
> Scott
There is no need for QTreeView to calculate a sizeHint for the entire tree,
because, well, it is a scrollview :) And calculating a sizeHint would also mean
that the view has to update layouts when data that influences the sizeHint
changes, and that would be quite expensive (the view does have to do at least
some of that anyway to adjust the scrollbars, but since scrolling is “per row”
rather than “per pixel”, we can optimize that a lot; see
QTreeViewPrivate::updateScrollBars()).
I think the best you can do is to get the visualRect of the last index, and
then calculate the view’s sizeHint based on that. That means that the tree has
to be fully expanded.
Volker
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest