[Qgis-developer] Upgraded collapsible groupboxes

Etienne Tourigny etourigny.dev at gmail.com
Thu Sep 13 05:47:38 PDT 2012


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 code is already in src/gui/qgsrasterlayersaveasdialog.cpp but
does not appear to have an effect (as the top of the widget is visible
when it is expanded).

 connect( mCreateOptionsGroupBox, SIGNAL( collapsedStateChanged( QWidget* ) ),
           this, SLOT( groupBoxExpanded( QWidget* ) ) );

Perhaps adding margins would help, or calculating the expanded
groupbox size and scrolling to that.

Any way, QgsCollapsibleGroupBox could be hacked to detect if parent is
a QScrollArea (or descendant) and call groupBoxExpanded() on that
parent.

>
> 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.

Not necessarily, we can create a subclass of QScrollArea, that is
aware of any child QgsCollapsibleGrouoBox. And promote any widget to
our custom widgets, without resorting to designer plugins.

But working directly in qgscollapsiblegroupbox (as explained above)
might be easier. Should scrolling to the bottom of opened groupbox be
automatic, or would there be cases where it should be disabled?

Etienne
>
> 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