Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tiled doesn't remember widget size #590

Closed
Gornova opened this issue Jan 12, 2014 · 17 comments
Closed

Tiled doesn't remember widget size #590

Gornova opened this issue Jan 12, 2014 · 17 comments
Assignees
Labels
bug Broken behavior. qt issue Qt related issue.

Comments

@Gornova
Copy link
Contributor

Gornova commented Jan 12, 2014

My test case: create a new map with tiled, then resize tileset preview to bigger than levels (for example) then close.
On next tiled running, my adjustment on tiled widget size are gone, so I need to do it again and again.
Could you add a preference to save widget height (and not just position?)

Here my 2 screens to show my problem:

  1. widget with custom height
    1

  2. then after close and re-open Tiled:
    2

my 2 cents: seems to be a problem only on default-right widgets, on left there is no problem O_O

@bjorn
Copy link
Member

bjorn commented Jan 12, 2014

Hmm, I've never noticed problems with this and am unable to reproduce your problem. Which version of Tiled are you using?

@Gornova
Copy link
Contributor Author

Gornova commented Jan 13, 2014

Tiled 0.9.1

@CyberMew
Copy link

CyberMew commented Mar 2, 2014

I am also having this issue not remembering the size. I have to readjust everytime I open the app. Happens on 0.9.1 and tiled-2014-02-09-win32-setup.exe as well

@bjorn
Copy link
Member

bjorn commented Mar 2, 2014

@CyberMew Are you also having the issue only on the widgets that default to the right, or is it not able to store this kind of settings at all?

@CyberMew
Copy link

CyberMew commented Mar 3, 2014

On first open: image
Adjusted panels size to my liking: image
Close app.
Open app: image

If I were to shift panels around it would say though, for eg if I drag minimap to the left side of the app (from the right), it would stay there. It still won't save the size setting though.

Is there an option to remember panel positions/sizes? If so, are they store per app or per .tmx?

@AxiomVerge
Copy link

I'd find this useful as well.

@bjorn
Copy link
Member

bjorn commented Jul 10, 2016

This issue stalled a long time ago because I could not reproduce the problem. Tiled already remembers both the position and the size of these views. I'm still not sure what the problem could be here.

Could @Gornova and @CyberMew maybe try the current version of Tiled, to see if the problem has somehow been fixed in the meantime?

@bjorn bjorn added the bug Broken behavior. label Jul 10, 2016
@CyberMew
Copy link

Haven't been using Tiled for 2 years :o

Just installed it and it seems fixed 💃

Just a side note, I found an app named Enfusoft that could let you tiled patterns easily and quickly. Do you think Tiled will have some of the basic features as well? After all, this is Tiled 😍

@Gornova
Copy link
Contributor Author

Gornova commented Jul 12, 2016

My test system is windows 8.1 64 bit

  1. downloaded 0.16.2 for windows 32bit
  2. downloaded this tileset for example http://opengameart.org/content/hearts-platformer-tileset-32-pixels
  3. created a new map and resized tiled window

before

  1. closed and reopened the same map

after

For me this issue is not fixed! As you can see properties panel on left is not readable when I reopen tiled

@CyberMew
Copy link

CyberMew commented Jul 12, 2016

It worked for me on a windows 7 x64 machine, but I believe it was a brand new install and not an upgrade over existing installation. Not sure if that affects anything. And in my test I only tried to adjust the right panels and not the left panels. I also didn't load any projects. Maybe I'll try to test again when I am at home.

@CyberMew
Copy link

Yup no issues for me. Forgot to mention that I am on the 64 bit Tiled setup. @Gornova is this a fresh install and/or a fresh project? Maybe you can try the 64 bit installer (to a new folder) with a fresh project and see how it goes?

@Gornova
Copy link
Contributor Author

Gornova commented Jul 12, 2016

same for 64bit version :(

@bjorn
Copy link
Member

bjorn commented Jul 17, 2016

This seems to have to do with maximizing the window. Due to the way this state is restored, the positions of the views are not correctly restored when the "normal" window state is not big enough, even if Tiled is actually maximized.

I wonder if there is some kind of workaround by code. For the user, a workaround is to make the window large before maximizing.

@bjorn bjorn added the qt issue Qt related issue. label Jul 17, 2016
@bjorn
Copy link
Member

bjorn commented Jul 17, 2016

After some testing I believe this is an issue in Qt that I can't fix on the Tiled side.

Even if I explicitly restore the size of the window first, then restore the positions of the views (called QMainWindow::restoreState) and afterwards restore the full geometry (QMainWindow::restoreGeometry), the views do not get correctly restored. It is as if restoreGeometry triggers a resize to "normal size" and then re-applies the maximized state*. Temporarily reducing the size of the window is then leading to layout updates that cause the view positions to change.

And if I don't use restoreGeometry but rather restore position, size and window state myself, then it loses the ability to store its "normal size", which seems to be only kept internally.

*) Theory confirmed with some debug print:

oldSize: QSize(-1, -1) newSize: QSize(620, 523)
oldSize: QSize(620, 523) newSize: QSize(1920, 1017)

This two-step process to restoring the window state is causing the views to not restore their state properly.

bjorn added a commit to bjorn/tiled-dev that referenced this issue May 13, 2022
In case of maximized windows, restoring the geometry causes two resize
events. We need to wait until the second resize event before trying to
restore the internal layout, otherwise it may be broken due to not
fitting in the initially smaller window.

I consider this more of a workaround to an issue in Qt, since ideally
there would only be a single resize event. I've added a 200ms timer that
makes sure the layout is always restored, even when a second resize
event is not sent.

Closes mapeditor#590
@bjorn
Copy link
Member

bjorn commented May 13, 2022

I've tried to find a nice workaround for this issue, but it needs to be tested before putting it in the release. Builds including this workaround should become available at https://github.com/mapeditor/tiled/actions/runs/2318670767 (though GA appears to be having some issues at the moment).

I've personally tested it on Linux with builds against Qt 5.15.2 and Qt 6.3, but it should also be tested on Windows and macOS.

@bjorn bjorn self-assigned this May 13, 2022
@bjorn bjorn closed this as completed in a49d87f May 16, 2022
@Gornova
Copy link
Contributor Author

Gornova commented May 16, 2022

Hi, I'm not able to test it on Windows, where is the link to download the build ?

@bjorn
Copy link
Member

bjorn commented May 16, 2022

Hi, I'm not able to test it on Windows, where is the link to download the build ?

Builds are now available at https://github.com/mapeditor/tiled/actions/runs/2332896230 (scroll down to "Artifacts"), but it has been tested on Windows by others now and I've also adjusted the patch for macOS. The fix will soon be available in Tiled 1.8.5. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Broken behavior. qt issue Qt related issue.
Projects
None yet
Development

No branches or pull requests

4 participants