Unsolved Qapplication size
-
hi freiends,
i am using QT mainwindow in maximized position i am trying get geometry i am x and y position in negative
my screen size is width 1920 and 1080 but mt application in maximized position i am getting xpos -8 and ypos -8 width 1920 and height 1017 can i now why it is getting.
-
Hi
Do you have multiple monitors ?doing
showFullScreen(); qDebug() << geometry();
shows 0,0 and 1920x1080 as expected
-
i fullscreen i am getting correct but in maximized i want postion.
-
@satyanarayana143
Do you have a frameless window or something like that?showMaximized();
qDebug() << geometry();i get the expected values.
You can try frameGeometry and see if values are more as you expect.
geometry returns the size minus the decorations. ( captions, borders) -
not frameless window
-
@satyanarayana143
well i get perfectly normal values.
Can you show what you do ? (code) -
@satyanarayana143 Where exactly do you call geometry()? If in constructor of your main window then you should do it after the constructor was executed and the main window is actually being shown.
-
I've got the same problem using two Dell monitors with Qt 5.11.2 and MSVC2017
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); } MainWindow::~MainWindow() { delete ui; } void MainWindow::on_pushButton_clicked() { qDebug() << "Pos: " << this->pos(); }
Output when maximized:
Pos: QPoint(-8,-8)