Unsolved Top-Level Window vs Window in QGuiApplication?
-
The
QGuiApplication
class has two functions:QWindowList QGuiApplication::topLevelWindows()
Returns a list of the top-level windows in the application.
and
QWindowList QGuiApplication::allWindows()
Returns a list of all the windows in the application.
Isn't a window a top-level window as well? What is the difference between these two functions?
-
@CJha said in Top-Level Window vs Window in QGuiApplication?:
Isn't a window a top-level window as well? What is the difference between these two functions?
A window could be embedded inside another window. That makes it a window that is not top-level.
For example, see https://specifications.freedesktop.org/xembed-spec/xembed-spec-latest.html
-
@CJha
AlltopLevelWindows()
appear inallWindows()
, but not allallWindows()
appear intopLevelWindows()
:)In Qt "Any widget without a parent widget is a top-level widget or window. " You should be able to verify this holds for all the windows/widgets in those two lists --- all
topLevelWindows()
should have no parent, and no other window inallWindows()
should have no parent. -
This post is deleted! -
@JonB Thanks! sounds a little complicated, but I think I get it. The basic distinction being if a window has a parent then I will only find it using
allWindows()
and not usingtopLevelWindows()
? -
@CJha Yes, exactly that.