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

QDialog opens at the center of QGoodWindow's initial position, ignoring its current one #23

Closed
kresimirko opened this issue Jan 20, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@kresimirko
Copy link

kresimirko commented Jan 20, 2023

Hello. I'm back again with another issue and this time I really am not sure if this is an issue on my behalf or not.

When using a regular QMainWindow, connecting a QAction to a QDialog's open() slot works fine. The dialog's parent is the QMainWindow and it opens in the center, even after moving.

// Example code
AboutWindow *aboutWindow = new AboutWindow(this); // inherits QDialog
connect(helpAction, &QAction::triggered, aboutWindow, &AboutWindow::show);

image
Initial position

image
Position after being moved by cursor

However, if I connect that same QAction to the same show() slot, but this time have a QGoodWindow as its parent, this happens:

image
Initial position

image
Position after being moved by cursor

If I use move() on the dialog's parent window before it being shown, that is used as the initial position instead.

@kresimirko
Copy link
Author

kresimirko commented Jan 20, 2023

I'm aware of the fact that I can get the position of the window on the screen, calculate things from there and position the dialog that way, but I still feel like this is notable.

@antonypro
Copy link
Owner

antonypro commented Jan 21, 2023

@kresimirko: I don't think that this is exactly a bug, because the library works, but not mimic the QMainWindow behavior.

As a workaround, you could, instead of create a global QDialog and show and close it as user request, create a temporary QDialog every time the dialog is requested, this also ensure that your dialog will have a Windows show animation on any show event, and not remember it's old position on show event.

Anyway, I will accept your issue as a enhancement to be released in the next version, it will mimic the QMainWindow behavior.

Thanks for reporting!

@antonypro antonypro added the enhancement New feature or request label Jan 21, 2023
@kresimirko
Copy link
Author

Alright, thanks! I've already applied a workaround so I'll just stick to that.

@antonypro
Copy link
Owner

This enhancement was addressed on version 2.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants