Thank you for reply. I also used
this->setWindowFlags(Qt::WindowStaysOnTopHint);
and
QMainWindow::showFullScreen();
to stay my confirmation message on top. that was my goal.
@bck25 ,@Frime
Thank you all for the replies. I can not set the alpha value as I am using an image as the background.
I solved this by moving the opacity to the BorderImage which acts as background of the Window.
Window {
id : root
flags: Qt.FramelessWindowHint
visible:true
color: "transparent" // This works properly when Aero theme is enabled in Windows
BorderImage {
visible:true
width:root.width
height:root.height
opacity: 0.8
source: "background.png"
}
}
Great !
I forgot that usual suspect… It's a tricky one…
Thanks for sharing !
Since you have it working now, please update the thread title prepending [solved] so other forum users may know a solution has been found :)
@Chris-Kawa, you got me wrong i guess, the problem is not stylesheet inheritance, it's about the target widget itself NOT getting the stylesheet, instead that only passing style to children, naming him doesn't affect the result too.
@emppu
How to prevent that a user opens the same window twice? Do I need a flag variable in C++ code or is it easily done in QML? This seems a common workflow (preference window, open/save dialog, etc). I don't want to disable the main window while About window is open.
You can do it right itself in QML. Declare component as global property and then check for null before creating that component.
property Component component
...
MenuItem {
...
onTriggered: {
if(!component) {
component = Qt.createComponent("About.qml");
var about = component.createObject(main);
about.show();
}
}
}
In my case main window didn't disable. Did you set any particular Qt::WindowFlags flag ?
If I keep an instance of About window as an attribute of main ApplicationWindow, does it occupy the memory since the main window is loaded? If I have many different windows, this is really inefficient. What's the simplest solution?
Anything instantiated will occupy memory. To delay that process you use the technique you mentioned or you can use Loader to load them dynamically.