QMainWindow inside a MDIarea as QMDisubwindow. Icon not changing
hi,
I have a QT Gui application that has a MdiArea where I open subwindows, also based on QMainwindow. I've done that essentially because I wanted to have a taskbar on each of the subwindows.
Everything works fine but the icon in each of the subwindows is the same as the application itself.
the setWindowTitle works great I can have different windows titles for the subwindows but setWindowIcon has no effect.
anyone knows how to change the icons in this case?
An happy new year.
Re: QMainWindow inside a MDIarea as QMDisubwindow. Icon not changing
Did you make sure the icon (or resourse file) is accessible, watch for warnings in Application Output
Re: QMainWindow inside a MDIarea as QMDisubwindow. Icon not changing
Yes I've made sure. And I also used the designer to build the subwindows and in the designer I've put a specific icon that is shown in the preview of the form but then when inserted that window in the mdiarea the icon becames replaced by the icon of the application,
I even issue the setWindowIcon with a nonexistent icon, as in that case no icon would be used, but always the same result the icon is the icon of the application.
regards,
Yes I've made sure. And I also used the designer to build the subwindows and in the designer I've put a specific icon that is shown in the preview of the form but then when inserted that window in the mdiarea the icon becames replaced by the icon of the application,
I even issue the setWindowIcon with a nonexistent icon, as in that case no icon would be used, but always the same result the icon is the icon of the application.
regards,
Yes I've made sure. And I also used the designer to build the subwindows and in the designer I've put a specific icon that is shown in the preview of the form but then when inserted that window in the mdiarea the icon becames replaced by the icon of the application,
I even issue the setWindowIcon with a nonexistent icon, as in that case no icon would be used, but always the same result the icon is the icon of the application.
regards,
Added after 1 45 minutes:
Code:
this
->setWindowIcon
(QIcon(QString::fromUtf8(":/Icons/Icons/insert-table2.png")));
tablewindow *windowtable=new tablewindow;
//windowtable->setWindowIcon(QIcon(QString::fromUtf8(":/Icons/Icons/insert-table2.png")));
windowtable->setWindowTitle(dialog.fileName);
ui->mdiArea->addSubWindow(windowtable,Qt::SubWindow);
Just to make more clear the above piece of code is in my mainwindow.cpp. when I added the first line of code
Code:
this
->setWindowIcon
(QIcon(QString::fromUtf8(":/Icons/Icons/insert-table2.png")));
the Icon of the main application changed as the icon of the subwindow (windowtable)
just to confirm that really insert-table2.png was acessible.
The behavior that I was expecting was to change only the subwindow icon through the line
Code:
//windowtable->setWindowIcon(QIcon(QString::fromUtf8(":/Icons/Icons/insert-table2.png")));
commented above but was not comented when I tested. I imagine that this is something deep inside qt that makes all the Qmainwindows share the icon of the main Qmainwindows. I may be wrong, obviously.
regards,