[Qgis-developer] Upgraded collapsible groupboxes

Larry Shaffer larrys at dakotacarto.com
Fri Sep 14 19:06:59 PDT 2012


Hi Etienne,

On Fri, Sep 14, 2012 at 8:54 AM, Etienne Tourigny
<etourigny.dev at gmail.com> wrote:
> I have pushed a fix for this directly in QgsCollapsibleGroupBox, by
> finding the parent QScrollArea widget and scrolling down when
> expanding. I needed to call QApplication::processEvents() before
> mParentScrollArea->ensureWidgetVisible( this );
>
> This works in both dialogs that use the collapsible group box (raster
> save as and label editor).

The scroll-on-expand works very well. Nicely done!

I noticed a couple of things (one I fixed). When many groupboxes are
in the expanded state, on *first* showing of the dialog the last shown
expanded groupbox would cause the scroll area to make it visible, i.e.
it would scroll to there instead of starting at the top. Scroll areas
should start at top on dialog's first showing. Fixed in commit 8f0cb99
[0].

When the available space in the dialog is shorter than the height of
the groupbox, it appears that when expanding the groupbox, and the
scroll area scrolls to show it all, the groupbox is centered, instead
of its top part at the top of the available space. Not a big deal but
the effect can hide some options that are at the top of very tall
groupboxes (try with Data Defined Font section of Adv Labeling).

Seems like if the groupbox is too tall for the available vertical
space, it should scroll so the top (groupbox title) is at the top of
the available space. (I did not try to fix this.)

> In the case that layout is different, there is still the
> collapsedStateChanged( QWidget* ) signal that is emitted.

I changed this to collapsedStateChanged( QgsCollapsibleGroupBox* )
with [0]. This allows direct access to the custom widget's methods,
which I then used to make the label preview part of the splitter in
the Adv. Labeling dialog collapsible [1]. This signal will be useful
when connecting many groupboxes, allowing one slot to handle all the
signals.

[0] https://github.com/qgis/Quantum-GIS/commit/8f0cb990ae2e0bb07676723ea578337402bbe77c
[1] https://github.com/qgis/Quantum-GIS/commit/d0800fbff9dc93d788f298ce0ea98edea777e662

Unless you have (or someone else has) other features or fixes for the
new QgsCollapsibleGroupBox class, I think we can start using them in
more dialogs. Opinions on this anyone?

Regards,

Larry


> I have also pushed a layout fix when using the Oxygen theme (common in
> KDE desktops), thanks to the help of Radim and Larry, as well as a few
> other fixes by Larry.
>
> Etienne
>
> On Thu, Sep 13, 2012 at 2:02 AM, Larry Shaffer <larrys at dakotacarto.com> wrote:
>> Hi,
>>
>> On Wed, Sep 12, 2012 at 11:00 AM, Etienne Tourigny
>> <etourigny.dev at gmail.com> wrote:
>>> Hi, thanks for your input
>>>
>>> I have tried to fix that issue, but didn't find a working solution yet
>>> (there is code in there addressing that issue). I think that Qt does
>>> not scroll down, because part of the widget is already visible. If
>>> anyone has a suggestion I would appreciate it.
>>
>> Not sure how that would be possible from the QgsCollapsibleGroupBox
>> class, since the custom groupbox could be placed anywhere, not just in
>> a scroll area. What Leyan is suggesting (I think) would have to be
>> some slot in the dialog's class that catches the signal when one of
>> its children collapsible groupboxes is expanded, then figures the
>> current scroll position of the groupbox and how much of it is hidden,
>> then scrolls appropriately to expose the whole groupbox.
>>
>> This would be somewhat similar to toolbox behavior, though without the
>> horrible 'hide everything else' aspect of that widget. A nice feature
>> to have, but probably a pain to add to many dialogs... unless we
>> create a custom Designer plugin scroll area class with such a slot so
>> that the signal of every collapsible groupbox it contains could be
>> assigned to it in Designer. The QgsCollapsibleGroupBox class would
>> also have to be a QtDesigner plugin, which Etienne has already worked
>> on.
>>
>> Regards,
>>
>> Larry
>>
>>> Etienne
>>>
>>> On Wed, Sep 12, 2012 at 12:46 PM, 欧阳乐岩 <ouyang.leyan at hotmail.com> wrote:
>>>>
>>>>
>>>> On 09/12/2012 02:15 AM, Larry Shaffer wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> Over the past couple of days Etienne Tourigny and I have upgraded the
>>>>> functionality of the QgsCollapsibleGroupBox class he recently
>>>>> introduced. The changes have been pushed to master branch and can be
>>>>> seen in the Save As... dialog for raster layers and in the scroll
>>>>> areas of the 3 tabs in the PAL Labeling options.
>>>>>
>>>>> We have tested on some Linux versions and on Mac. *Feedback on the
>>>>> look and functionality, as well as any OS-specific issues, would be
>>>>> greatly appreciated.* It would be best to make sure these new changes
>>>>> work on (hopefully) every supported platform before using them more
>>>>> extensively.
>>>>
>>>>
>>>> Hi,
>>>>
>>>> It seems to be working well for me (compiled under Archlinux). Just one
>>>> small remark:
>>>> * For a long dialog like "Save as ..." for rasters, I need to scroll to see
>>>> everything. When the "Pyramids" groupbox is closed, the area scrolls
>>>> automatically to hide the resulting blank space, which is nice. However,
>>>> when opening the "Pyramids" groupbox, the dialog does not scroll down to
>>>> show the newly visible options. It would be nice to show them, as if we open
>>>> the groupbox we are probably interested in its content.
>>>>
>>>> Regards,
>>>>
>>>> Leyan
>>>>
>>>> _______________________________________________
>>>> Qgis-developer mailing list
>>>> Qgis-developer at lists.osgeo.org
>>>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>>> _______________________________________________
>>> Qgis-developer mailing list
>>> Qgis-developer at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/qgis-developer


More information about the Qgis-developer mailing list