PDA

View Full Version : Glass widget overlay on top of application



harald.studer@gmial.com
28th May 2018, 17:43
I have a fully developed and finalized QT Application with user interface. For our users to have a simpler start into the software I would like to have a fully transparent widget on top of the application where I can give them advice on how to use it when they start the first time. I have created a custom widget by

class GlassOverlay : public QWidget
{
Q_OBJECT

public:
GlassOverlay( QWidget* parent = 0 /*, Qt::WindowFlags f = 0*/ );
void mousePressEvent(QMouseEvent *event);
};

In the constructor of GlassOverlay I defined

this->setAttribute(Qt::WA_TransparentForMouseEvents, true );

The Parent of the GlassOverlay instance is my MainWindow instance, and I automatically resize the GlassOverlay whenever the MainWindow resizes.

How do I get the mouse and keyboard events through to my underlying application? WA_TransparentForMouseEvents does not seem to work properly. Probably because the events go to MainWindow and not to the childs of MainWindows. Any ideas

d_stranz
28th May 2018, 18:30
Maybe you need the WA_ShowWithoutActivating flag as well?


where I can give them advice on how to use it when they start the first time.

Can't you use tool tips to accomplish the same thing? Or maybe you need a floating top-level window the can be moved away from the main window, but you can send it signals to indicate what the user has just done so you can give them instructions on the next step. This is probably very similar to what you are trying to do with the glas widget, but without all the problems with transparency and resizing.