Review Request 119512: Fix saving/loading of file dialog sizes

Thomas Lübking thomas.luebking at gmail.com
Fri Aug 1 10:10:21 UTC 2014



On Juli 28, 2014, 10:17 vorm., Lukáš Tinkl wrote:
> > If the only issue is the open ::exec() TODO, you might "trick" it by calling ::winId(), then restore the size and ultimately ::exec()
> > 
> > Otherwise you could open an own nested eventloop instead of relying on the dialogs exec, but that'd be less elegant.
> > 
> > In either case I don't see why bringing your own config re/storage.
> 
> Lukáš Tinkl wrote:
>     The trick with winId() unfortunately doesn't work, the dialog gets restored to the default size, not the saved one... :/ Any other ideas?
> 
> Thomas Lübking wrote:
>     I'm not gonna say "impossible", but the reason could then not be the absence of a windowHandle()
>     Eventually sth. alters the window size post the restore.
>     
>     Have you checked for presence of a m_dialog->windowHandle() after calling m_dialog->winId() and m_dialog->size() after calling 
>     KWindowConfig::restoreWindowSize(m_dialog->windowHandle(), conf->group("FileDialogSize")); and before calling m_dialog->exec() ?
> 
> Martin Klapetek wrote:
>     KWindowConfig::restoreWindowSize is broken for some reason.
>     
>     I did some investigation and basically what happens is this:
>      - KWindowConfig::restoreWindowSize resutls in QXcbWindow::setGeometry call
>      - geometry is set to the QWindow, but no to its QWidgets (no idea why)
>      - when event loop hits next loop, widgets are checked if their size >= their min size
>      - because they didn't receive the updated geometry, this^ is not true
>      - the widgets get resized to their min size
>      - the window has a wrong geometry
>     
>     I don't know why the widgets don't receive the event however, my knowledge in this is lacking.
> 
> Lukáš Tinkl wrote:
>     So how do we proceed with this one? Having tiny filedialogs is annoying as hell...
> 
> Thomas Lübking wrote:
>     Fix KWindowConfig::restoreWindowSize, I'd say.
>     I assume calling
>     
>     + window->create();
>     
>     before "window->resize(width, height);" in frameworks/kconfig/src/gui/kwindowconfig.cpp:81 should be be sufficient?
>     (This should ensure d->platformWindow->setGeometry(QRect(position(), newSize)); is called in QWindow::resize())
> 
> Lukáš Tinkl wrote:
>     Nope, it didn't work unfortunately :/

You must still ensure that there's a QWindow before the Dialog::exec() call, ie. calling ::winId() is still required in addition on this particular case.


- Thomas


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/119512/#review63311
-----------------------------------------------------------


On Juli 28, 2014, 10:21 vorm., Lukáš Tinkl wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/119512/
> -----------------------------------------------------------
> 
> (Updated Juli 28, 2014, 10:21 vorm.)
> 
> 
> Review request for KDE Frameworks, kdelibs, Aleix Pol Gonzalez, and Martin Klapetek.
> 
> 
> Repository: frameworkintegration
> 
> 
> Description
> -------
> 
> This patch tries to fix saving/restoring file dialog sizes. Using KWindowConfig::restoreWindowSize() doesn't work here with the modal exec() methods. Instead, the patch uses the same method as KDirSelectDialog. 
> 
> 
> Diffs
> -----
> 
>   src/platformtheme/kdeplatformfiledialoghelper.h 406a4f1 
>   src/platformtheme/kdeplatformfiledialoghelper.cpp 520b6f5 
>   src/platformtheme/kdirselectdialog.cpp 9a4082a 
>   src/platformtheme/kdirselectdialog_p.h 5a8e758 
> 
> Diff: https://git.reviewboard.kde.org/r/119512/diff/
> 
> 
> Testing
> -------
> 
> Current Plasma 5, working fine :)
> 
> 
> Thanks,
> 
> Lukáš Tinkl
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20140801/e321de6c/attachment.html>


More information about the Kde-frameworks-devel mailing list