Top-Level Window vs Window in QGuiApplication?
-
The
QGuiApplicationclass 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?
-
The
QGuiApplicationclass 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
-
The
QGuiApplicationclass 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
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. -
@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. -
@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()?