biolab / orange3

🍊 :bar_chart: :bulb: Orange: Interactive data analysis
https://orangedatamining.com
Other
4.85k stars 1.01k forks source link

The splitter that hides control panel is not shown on Windows #3143

Closed markotoplak closed 4 years ago

markotoplak commented 6 years ago

On Macs, for example, we see a good enough visual indication of the splitter:

splitter

On stock Ubuntu, less so:

splitter_ubuntu

While on Windows we only see a cursor change on mouse over.

As we are using the splitter in a less standard way, for showing and hiding something, we could go for some custom visual that would be the same on all platforms.

thocevar commented 6 years ago

I've just tried this and it's rather tricky. You can set the splitter's style __splitter.setStyle(QStyleFactory.create("fusion")) to one of available styles, which depend on your platform. On my windows machine it's "windows" or "fusion". The latter looks like your Ubuntu version.

Another option is to set the style of the handle using stylesheets (setStyleSheet("background-color: red")). Unfortunatelly, it seems that some styles ignore certain stylesheet parameters as I can set the background color but not a background image.

At this point, I'm a bit out of my Qt depth.

janezd commented 4 years ago

On Windows, the splitter is thinner. We can have either a smaller indicator

narrow-splitter

(enlarge the picture)

or we can make the splitter wider.

wider-splitter

I guess I like the narrow one - in my temporary opinion it is just bit enough to perhaps tell the user that there's something to click there. @markotoplak?

Should anybody wish to play: the following code needs to be added to the _Handle class in widget.py.

Narrow:

        class _Handle(QSplitterHandle):
            def paintEvent(self, event):
                super(QSplitterHandle, self).paintEvent(event)
                painter = QPainter(self)
                painter.setBrush(QColor(192, 192, 192))
                painter.setPen(QColor(160, 160, 160))
                painter.drawEllipse(self.width() / 2 - 1, self.height() / 2 - 1, 2, 2)

For the wider, increase the necessary number in the last line, plus call self.setHandleWidth(10) on the splitter class.

(We would of course add a condition to run this only on Windows.)

janezd commented 4 years ago

As we are using the splitter in a less standard way, for showing and hiding something, we could go for some custom visual that would be the same on all platforms.

Makes sense. The circle that we have now is not recognizable, I wouldn't be tempted to click it.

What about this -- on all platforms?

out

ajdapretnar commented 4 years ago

Very much in favour of the little arrow.

janezd commented 4 years ago

See https://github.com/biolab/orange-widget-base/pull/33.

janezd commented 4 years ago

Fixed in https://github.com/biolab/orange-widget-base/pull/33.