Brandon Clark
Brandon Clark

Reputation: 796

Qt: Window size execution methods?

When trying to set a fixed window size why doesn't the following code work:

window->setSizeIncrement(1024,600);
window->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);

But this code does:

window->setMaximumHeight(600);
window->setMinimumHeight(600);
window->setMaximumWidth(1024);
window->setMinimumWidth(1024);

I achieve what I want, a fixed width and height window. Not as efficiently as I had thought.

Upvotes: 0

Views: 464

Answers (1)

Bart
Bart

Reputation: 20038

You could simply use setFixedSize(const QSize & s) to achieve the same.

As for the setsizeIncrement(), as discussed in the documentation it merely sets an increment step for the window size. What's more, depending on your platform the following might be important:

Warning: The size increment has no effect under Windows, and may be disregarded by the window manager on X11.

Upvotes: 1

Related Questions