Re: save and restore the geometry of KMainWindow

2018-02-02 Thread Alexander Semke

On 01.02.2018 20:52, Albert Astals Cid wrote:

El dimarts, 30 de gener de 2018, a les 21:06:02 CET, Alexander Semke va
escriure:


The state is already saved and restored there. Why not to do the same
for the geometry?

I think that it's generally frowned upon putting your position on screen
because it means "you know too much".

Basically it's supposed to be the window manager task, not your app.
And if the window manager doesn't do this the user has to move their 
windows around again upon start?
Especially when working on big displays where the user wants to have 
certain placements for different programs
it would be helpful also to restore the position on the screen 
automatically.


The size is being restored, at least for a couple of programs I checked 
(konsole, kwrite, dolphin). Is this done by kwin?
I don't think there is a big practical difference from the user 
perspective between "restoring the size" and "restoring the position"

with respect to "you know too much"...


--
Alexander


Re: save and restore the geometry of KMainWindow

2018-02-01 Thread Albert Astals Cid
El dimarts, 30 de gener de 2018, a les 21:06:02 CET, Alexander Semke va 
escriure:
> On 30.01.2018 16:38, Milian Wolff wrote:
> > This works for me:
> > https://github.com/KDAB/hotspot/blob/4d1177d1631902dce1dd82f53553e97a7544b
> > 1fa/ src/mainwindow.cpp#L162
> 
> Thanks, that helped. I was using
> restoreGeometry(group.readEntry("geometry").toLatin1()) instead of
> 
> restoreGeometry(group.readEntry("geometry", QByteArray())) ... Hotspot
> is a nice tool by the way :-)
> 
> Why not to add this logic to KMainWindow and to make this automatically
> available for all/many KDE applications?
> 
> The state is already saved and restored there. Why not to do the same
> for the geometry?

I think that it's generally frowned upon putting your position on screen 
because it means "you know too much".

Basically it's supposed to be the window manager task, not your app.

Also i think that may not work on wayland because of the above reason (can 
easily be wrong)

Cheers,
  Albert





Re: save and restore the geometry of KMainWindow

2018-01-30 Thread Alexander Semke


On 30.01.2018 16:38, Milian Wolff wrote:

This works for me:
https://github.com/KDAB/hotspot/blob/4d1177d1631902dce1dd82f53553e97a7544b1fa/
src/mainwindow.cpp#L162
Thanks, that helped. I was using 
restoreGeometry(group.readEntry("geometry").toLatin1()) instead of


restoreGeometry(group.readEntry("geometry", QByteArray())) ... Hotspot 
is a nice tool by the way :-)


Why not to add this logic to KMainWindow and to make this automatically 
available for all/many KDE applications?


The state is already saved and restored there. Why not to do the same 
for the geometry?


--

Alexander




Re: save and restore the geometry of KMainWindow

2018-01-30 Thread Milian Wolff
On Monday, January 29, 2018 9:17:54 AM CET Alexander Semke wrote:
> resending this to kde-devel...
> 
> On 28.01.2018 18:45, Alexander Semke wrote:
> > Hi,
> > 
> > KMainWindow takes care of saving/restoring the state of the main
> > window, menus and toolbars.
> > Also, the size of the main window is correctly stored and restored.
> > However, I don't see how
> > to save and restore the position of the main window. I checked couple
> > of KDE programs
> > like dolphin, konsole, etc. - nothing restores the last window
> > position correctly. I also tried to
> > to do saveGeometry() to KConfigGroup in the destructor and to
> > restoreGeometry() in
> > the constructor but this doesn't seem to work. Is this because of the
> > window manager ignoring
> > the geometry hints as mentioned in
> > http://doc.qt.io/qt-5/application-windows.html#window-geometry ?
> > 
> > Can somebody point to an application doing this correctly?

This works for me:

https://github.com/KDAB/hotspot/blob/4d1177d1631902dce1dd82f53553e97a7544b1fa/
src/mainwindow.cpp#L162

What window manager are you using?

-- 
Milian Wolff
m...@milianw.de
http://milianw.de




Re: save and restore the geometry of KMainWindow

2018-01-29 Thread Alexander Semke

resending this to kde-devel...


On 28.01.2018 18:45, Alexander Semke wrote:

Hi,

KMainWindow takes care of saving/restoring the state of the main 
window, menus and toolbars.
Also, the size of the main window is correctly stored and restored. 
However, I don't see how
to save and restore the position of the main window. I checked couple 
of KDE programs
like dolphin, konsole, etc. - nothing restores the last window 
position correctly. I also tried to
to do saveGeometry() to KConfigGroup in the destructor and to 
restoreGeometry() in
the constructor but this doesn't seem to work. Is this because of the 
window manager ignoring
the geometry hints as mentioned in 
http://doc.qt.io/qt-5/application-windows.html#window-geometry ?


Can somebody point to an application doing this correctly?

Thanks and Regards,
Alexander