How to Bring the Widget Bring to front in Qt?

Please have a look at this screenshot:

The circles are custom controls. When I click a control, I need to bring the widget to the front. Ex. if I click the second circle it should look like this:

When the control is clicked I am able to get the sender (i.e. the control). Only thing is how to bring the object to the front.

Please help me fix this issue.

Answers


Have you tried QWidget::raise()?

Raises this widget to the top of the parent widget's stack. After this call the widget will be visually in front of any overlapping sibling widgets. Note: When using activateWindow(), you can call this function to ensure that the window is stacked on top.

So the pattern I usually use that will ensure a window is shown, brought to the front of sibling widgets and brought in front of other applications is:

widget->show();
widget->activateWindow();
widget->raise();

Need Your Help

System.ObjectModel Warning Xamarin does not run on Android

c# android visual-studio xamarin xamarin.android

We are running the 'Welcome to Xamarin` example on Visual Studio Enterprise, using the latest Xamarin, in a Windows 8.1 environment.

What is the most reliable way to create a custom event log and event source during the installation of a .Net Service

c# .net windows-services event-log eventlog-source

I am having difficulty reliably creating / removing event sources during the installation of my .Net Windows Service.