1
votes

I would like to create a simple effect with my qt gui, but i have no idea how to achieve this.

I have several widgets, that i implemented as subclasses of qwidget. These are part of another widget and live in a layout. When the mouse hovers over these widgets, i want them to appear bigger to highlight the selected one.

This is what i already tried: Override the paint event, and simply paint it bigger. But then, the other widgets that also live in the same layout overpaint the oversized areas.

I also tried to call the paint function "by hand" from the parent window, to get control over the painting order. But that didnt help either.

I think there has to be a possibility achieving this effect this qt, but i simply dont know how. Any ideas?

1
I don't think "painting it bigger" is a good idea, but did you try raise()ing the widget when you do that?Mat
But i want to widget to really be bigger. Unfortunately raise() doesnt prevent the widget from being overpainted by the other widgets. If this helps: i want to have a similar effect to the auto hiding parts, like the solution explorer, of visual studio for example.Valerie
Then make it bigger with resize(), but that's probably going to mess up your layout. You might manage to make it work with spacers. I don't know, and I don't like stuff moving under the mouse. Changing colors/highlighting is ok though.Mat
You are right, but my input device is not the mouse. I use the hand positions from the kinect skeleton tracking. And if i design control elements, that are big enough to fit the hands on the screen, my screen will be complete full with control elements. Thats why i want to scale them when the hand hovers over them.Valerie

1 Answers

0
votes

You could either:

  • create your GUI inside a QGraphicsView, with QGraphicsWidgets and use setScale when the mouse enters or leave the widget, or
  • use QML.