I have problem with my QWidget window which I can't update position. I don't use the Ui tool.
I've tried:
QRect screenGeometry;
int x;
int y;
screenGeometry = QApplication::primaryScreen()->geometry();
x = (screenGeometry.width() - aw_.width()) / 2;
y = (screenGeometry.height() - aw_.height()) / 2;
aw_.move(x, y);
aw_.show();
but the window doesn't move.
I also tried :
QRect screenGeometry;
int x;
int y;
screenGeometry = QApplication::primaryScreen()->geometry();
x = screenGeometry.center().x();
y = screenGeometry.center().y();
aw_.setUpdatesEnabled(true);
aw_.setGeometry(x, y, 400, 300);
QApplication::processEvents();
aw_.show();
There the size of the window changed but remains stuck a random point on the screen.
I also tried to create a new project with a Ui and I saw in the Design panel that the values of X and Y of the geometry property can't be changed (they're disabled) but not width and height.
Does anyone has an idea?
Thanks in advance.
Problem solved: I'm using Debian running with Wayland which doesn't allow windows to move by themselves.
Thanks.