Nyaruko
Nyaruko

Reputation: 4499

How to make a QDockWidget not resizable by mouse?

How could I make a QDockWidget such that the user is not able to drag the boundary of the QDockWidget to resize it?

Upvotes: 5

Views: 909

Answers (2)

lee zhang
lee zhang

Reputation: 26

Actually, can set the size policy of the widget in dock widget to fixed.

inner_widget=QWidget()
inner_widget.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)

dock=QDockWidget("")
dock.setWidget(inner_widget)

I'm using PyQt with Qt 5.15.

Upvotes: 0

Jepessen
Jepessen

Reputation: 12445

You can try setSizePolicy. Something like

dock->setSizePolicy(QsizePolicy::Fixed);

Upvotes: 1

Related Questions