You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 12, 2025. It is now read-only.
QPushButton *btn = new QPushButton("p is gw", this);
btn->move(200, 200);
// this is GoodWindow
connect(btn, &QPushButton::clicked, this, [=]() {
QDialog d(this);
d.setWindowTitle("p is gw");
d.resize(400, 300);
d.exec();
});
QPushButton *btn2 = new QPushButton("p is btn", this);
btn2->move(200, 300);
connect(btn2, &QPushButton::clicked, this, [=]() {
QDialog d(btn);
d.setWindowTitle("p is btn");
d.resize(400, 300);
d.exec();
});
QRect QGoodWindow::geometry() const
{
#ifdef Q_OS_WIN
RECT client_rect;
GetClientRect(m_hwnd, &client_rect);
int w = qFloor((client_rect.right - client_rect.left) / m_pixel_ratio);
int h = qFloor((client_rect.bottom - client_rect.top) / m_pixel_ratio);
QRect rect = QRect(x(), y(), w, h);
qDebug() << "----------" << rect << QMainWindow::geometry();
// ---------- QRect(931,516 593x470) QRect(0,0 593x470)
return rect;
#else
return QMainWindow::geometry();
#endif
}
And i find QMainWindow::geometry() always return (0, 0, x, x),when i use button as parent, qt may use QMainWindow::geometry(). Is there any way i do not have to get QGoodWindow::geometry()?