Sergey Stolyarov
Sergey Stolyarov

Reputation: 2657

How to hide handles in QSplitter widget?

Is it possible to completely hide handles from QSplitter widget? I've tried to hide() them but it doesn't work — handles are still on the screen and isVisible() reporting false.

QSplitter::setHandleWidth doesn't work as expected — it doesn't hide handles when calling it with 0.

Upvotes: 2

Views: 3480

Answers (5)

Ansal P A
Ansal P A

Reputation: 45

Calling QSplitter::setHandleWidth with zero works now. If you are using designer, setting handle width property to zero does the trick.

Upvotes: 0

Shuman
Shuman

Reputation: 4132

setting the image to a non-exists image seems working

self.splitter.setStyleSheet("QSplitter::handle { image: url(images/notExists.png); }")

Upvotes: 0

luca
luca

Reputation: 7526

Use QSplitter::handleWidth(1). I tried with handleWidth(0) but it seems that the minimum accepted width is 1

Upvotes: 0

larsmoa
larsmoa

Reputation: 12942

How bout subclassing QSplitter and overriding paintEvent(QPaintEvent*) to block actual painting of the widget?

Upvotes: 0

Henrik Hartz
Henrik Hartz

Reputation: 3675

The inability to set a zero-width handle seems odd and might be considered a bug - but then again why would you want to? You won't be able to grab a zero-width handle so it seems to be that you really want to use a vertical/horizontal layout.

Upvotes: 1

Related Questions