Qt界面坐标
x:左上角距屏幕左上角的水平距离
y:左上角距屏幕左上角的竖直距离
geometry几何属性:整个窗体的属性用frameGeometry(),客户区的属性用geometry()。
#include "QtWidgets0628.h" #include <QtWidgets/QApplication> #include <qdebug.h> int main(int argc, char *argv[]) { QApplication a(argc, argv); QtWidgets0628 w; w.show(); //整个窗体的左上角、宽高 qDebug() << "w.frameGeometry()" << ":" << w.frameGeometry().x() << "," << w.frameGeometry().y() << "," << w.frameGeometry().width() << "," << w.frameGeometry().height(); //客户区的左上角、宽高 qDebug() << "w.geometry()" << ":" << w.geometry().x() << "," << w.geometry().y() << "," << w.geometry().width() << "," << w.geometry().height(); //整个窗体的左上角、客户区的宽高 qDebug() << "w" << ":" << w.x() << "," << w.y() << "," << w.width() << "," << w.height(); return a.exec(); }