restore dialog sizes and QTBUG-40584

2019-01-25 Thread Alexander Semke
Hi,

after having read the documentation of KWindowConfig::restoreWindowSize(), I
understood how to properly restore the dialog sizes. I'm in a process of fixing
this now in LabPlot (20 dialogs or so):

https://cgit.kde.org/labplot.git/commit/?
id=ebfa6b4243dec41b6c656483a57401de4b387793

https://cgit.kde.org/labplot.git/commit/?
id=817125ca5f2c3d1141e52342e9e0239ea9f4f4ed

Basically, the pattern I need to add now everywhere is something like this:

//restore saved settings if available
create(); // ensure there's a window created
KConfigGroup conf(KSharedConfig::openConfig(), "FunctionValuesDialog");
if (conf.exists()) {
KWindowConfig::restoreWindowSize(windowHandle(), conf);
resize(windowHandle()->size()); // workaround for QTBUG-40584
} else
resize(QSize(300, 0).expandedTo(minimumSize()));

I'm wondering why not to move this logic completely into
KWindowConfig::restoreWindowSize() so that in the application code, until
QTBUG-40584 is adressed, we can simply do

KConfigGroup conf(KSharedConfig::openConfig(), "FunctionValuesDialog");
KWindowConfig::restoreWindowSize(windowHandle(), conf);

Were there any arguments against this?

https://bugreports.qt.io/browse/QTBUG-40584 - this one was closed last year
with "Incomplete" even though David actually provided enough information...

--
Alexander




Re: restore dialog sizes and QTBUG-40584

2019-01-26 Thread Albert Astals Cid
El divendres, 25 de gener de 2019, a les 9:26:15 CET, Alexander Semke va 
escriure:
> Hi,
> 
> after having read the documentation of KWindowConfig::restoreWindowSize(), I
> understood how to properly restore the dialog sizes. I'm in a process of 
> fixing
> this now in LabPlot (20 dialogs or so):
> 
> https://cgit.kde.org/labplot.git/commit/?
> id=ebfa6b4243dec41b6c656483a57401de4b387793
> 
> https://cgit.kde.org/labplot.git/commit/?
> id=817125ca5f2c3d1141e52342e9e0239ea9f4f4ed
> 
> Basically, the pattern I need to add now everywhere is something like this:
> 
> //restore saved settings if available
> create(); // ensure there's a window created
> KConfigGroup conf(KSharedConfig::openConfig(), "FunctionValuesDialog");
> if (conf.exists()) {
>   KWindowConfig::restoreWindowSize(windowHandle(), conf);
>   resize(windowHandle()->size()); // workaround for QTBUG-40584
> } else
>   resize(QSize(300, 0).expandedTo(minimumSize()));
> 
> I'm wondering why not to move this logic completely into
> KWindowConfig::restoreWindowSize() so that in the application code, until
> QTBUG-40584 is adressed, we can simply do
> 
> KConfigGroup conf(KSharedConfig::openConfig(), "FunctionValuesDialog");
> KWindowConfig::restoreWindowSize(windowHandle(), conf);
> 
> Were there any arguments against this?
> 
> https://bugreports.qt.io/browse/QTBUG-40584 - this one was closed last year
> with "Incomplete" even though David actually provided enough information...

IMHO what we should do is get David to reopen the bug.

Cheers,
  Albert

> 
> --
> Alexander
> 
> 
> 






Re: restore dialog sizes and QTBUG-40584

2019-01-26 Thread David Faure
On samedi 26 janvier 2019 18:43:21 CET Albert Astals Cid wrote:
> El divendres, 25 de gener de 2019, a les 9:26:15 CET, Alexander Semke va 
escriure:
> > Hi,
> > 
> > after having read the documentation of KWindowConfig::restoreWindowSize(),
> > I understood how to properly restore the dialog sizes. I'm in a process
> > of fixing this now in LabPlot (20 dialogs or so):
> > 
> > https://cgit.kde.org/labplot.git/commit/?
> > id=ebfa6b4243dec41b6c656483a57401de4b387793
> > 
> > https://cgit.kde.org/labplot.git/commit/?
> > id=817125ca5f2c3d1141e52342e9e0239ea9f4f4ed
> > 
> > Basically, the pattern I need to add now everywhere is something like
> > this:
> > 
> > //restore saved settings if available
> > create(); // ensure there's a window created
> > KConfigGroup conf(KSharedConfig::openConfig(), "FunctionValuesDialog");
> > if (conf.exists()) {
> > 
> > KWindowConfig::restoreWindowSize(windowHandle(), conf);
> > resize(windowHandle()->size()); // workaround for QTBUG-40584
> > 
> > } else
> > 
> > resize(QSize(300, 0).expandedTo(minimumSize()));
> > 
> > I'm wondering why not to move this logic completely into
> > KWindowConfig::restoreWindowSize() so that in the application code, until
> > QTBUG-40584 is adressed, we can simply do
> > 
> > KConfigGroup conf(KSharedConfig::openConfig(), "FunctionValuesDialog");
> > KWindowConfig::restoreWindowSize(windowHandle(), conf);
> > 
> > Were there any arguments against this?
> > 
> > https://bugreports.qt.io/browse/QTBUG-40584 - this one was closed last
> > year
> > with "Incomplete" even though David actually provided enough
> > information...
> 
> IMHO what we should do is get David to reopen the bug.

OK, done. But that's not going to fix the bug by magic ;)

-- 
David Faure, fa...@kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5





Re: restore dialog sizes and QTBUG-40584

2019-01-26 Thread Albert Astals Cid
El dissabte, 26 de gener de 2019, a les 18:48:05 CET, David Faure va escriure:
> On samedi 26 janvier 2019 18:43:21 CET Albert Astals Cid wrote:
> > El divendres, 25 de gener de 2019, a les 9:26:15 CET, Alexander Semke va 
> escriure:
> > > Hi,
> > > 
> > > after having read the documentation of KWindowConfig::restoreWindowSize(),
> > > I understood how to properly restore the dialog sizes. I'm in a process
> > > of fixing this now in LabPlot (20 dialogs or so):
> > > 
> > > https://cgit.kde.org/labplot.git/commit/?
> > > id=ebfa6b4243dec41b6c656483a57401de4b387793
> > > 
> > > https://cgit.kde.org/labplot.git/commit/?
> > > id=817125ca5f2c3d1141e52342e9e0239ea9f4f4ed
> > > 
> > > Basically, the pattern I need to add now everywhere is something like
> > > this:
> > > 
> > > //restore saved settings if available
> > > create(); // ensure there's a window created
> > > KConfigGroup conf(KSharedConfig::openConfig(), "FunctionValuesDialog");
> > > if (conf.exists()) {
> > > 
> > >   KWindowConfig::restoreWindowSize(windowHandle(), conf);
> > >   resize(windowHandle()->size()); // workaround for QTBUG-40584
> > > 
> > > } else
> > > 
> > >   resize(QSize(300, 0).expandedTo(minimumSize()));
> > > 
> > > I'm wondering why not to move this logic completely into
> > > KWindowConfig::restoreWindowSize() so that in the application code, until
> > > QTBUG-40584 is adressed, we can simply do
> > > 
> > > KConfigGroup conf(KSharedConfig::openConfig(), "FunctionValuesDialog");
> > > KWindowConfig::restoreWindowSize(windowHandle(), conf);
> > > 
> > > Were there any arguments against this?
> > > 
> > > https://bugreports.qt.io/browse/QTBUG-40584 - this one was closed last
> > > year
> > > with "Incomplete" even though David actually provided enough
> > > information...
> > 
> > IMHO what we should do is get David to reopen the bug.
> 
> OK, done. But that's not going to fix the bug by magic ;)

Totally, BTW i tried to fix this issue a while ago too, but finally half gave 
up and workarounded it somewhere else because my knowledge for X11 is too small 
to get this fixed.

Has anyone tried the ever promise of "Wayland will fix it" actually applies 
here?

Cheers,
  Albert

> 
>