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

fix: Fix close dialog not show in center #612

Merged
merged 1 commit into from
Feb 18, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/lib/cooperation/core/gui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ void MainWindow::showCloseDialog()
if (option == "Exit")
QApplication::quit();

CooperationDialog dlg;
CooperationDialog dlg(this);

QVBoxLayout *layout = new QVBoxLayout();
QCheckBox *op1 = new QCheckBox(tr("Minimise to system tray"));
Expand Down Expand Up @@ -284,6 +284,12 @@ void MainWindow::showCloseDialog()
dlg.setFixedSize(400, 200);
#endif

// get the center position of parent window and move to center
QRect parentRect = this->window()->frameGeometry();
QRect dialogRect = dlg.frameGeometry();
QPoint centerPoint = parentRect.center() - dialogRect.center();
dlg.move(centerPoint);

int code = dlg.exec();
if (code == QDialog::Accepted) {
bool isExit = op2->checkState() == Qt::Checked;
Expand Down