[Interest] QWindows and objectNames

Tor Arne Vestbø Tor.arne.Vestbo at qt.io
Fri Sep 24 15:27:31 CEST 2021


That’s expected. The name of your widget is “myMainWindow”. The name of the QWindow (QWidgetWindow) backing that QWidget has the widget name with a “Window” suffix.

Renaming your widget to “myMainWindowWidget” will make it clearer :)

Tor Arne

> On 24 Sep 2021, at 12:57, Yves Maurischat <yves.maurischat at basyskom.com> wrote:
> Hello,
> I've got an application (Qt 5.14.2 on Windows) with a MainWindow class derived from QWidget and with the flag Qt::Window set. In the MainWindow constructor the objectName is set to "myMainWindow". When iterating over all application windows using QGuiApplication::allWindows() (there is just one) and printing out out their objectNames I get "myMainWindowWindow" (i.e. an additional "Window" added to the objectName) for my main window.
> Is this expected behaviour or a bug? (IMHO it's the latter one, but I might have missed something here).
> Kind regards,
> *Yves Maurischat*
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest

More information about the Interest mailing list