Question

geom does not work right. When you define a new position for the window, part of it is off screen. How to solve this problem?

#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    QRect test(0,0,300,240);
    setGeometry(test);
}

MainWindow::~MainWindow()
{
    delete ui;
}
Was it helpful?

Solution

Solved:

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    QRect test(0,0,300,240);
    setGeometry(test);
    move(0,0);//Fix
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top