Look at the following Image:
I have created the Sub Window
dynamically.
I'm tried to use setWindowIcon
function like the following:
mdiWindows->setWindowIcon(QIcon("icon.ico"));
But does not works fine.
Also see the following code (MDI window creation):
QWidget *widget = new QWidget(this);
QTextEdit *TextEdit = new QTextEdit(widget);
TextEdit->setObjectName("myTextEdit");
QMdiSubWindow *mdiWindows = ui->mdiArea->addSubWindow(widget);
mdiWindows->setGeometry(5, 5, 300, 250);
mdiWindows->setWindowTitle("untitled" + QString::number(ui->mdiArea->subWindowList().count()));
mdiWindows->setWindowState(Qt::WindowMaximized);
mdiWindows->layout()->addWidget(TextEdit);
mdiWindows->layout()->setContentsMargins(0,0,0,
mdiWindows->layout()->setSpacing(
mdiWindows->show();
How to change MDI subWindow icon ?
setWindowIcon
function? – RobbieEmdiWindows->setWindowIcon(QIcon("icon.ico"));
, but does not works fine. – Lion KingsetWindowIcon
does what you need. If you cannot get it to work, how about you do some debugging? What does "does not works fine" mean? How does it fail. DoesQIcon("icon.ico")
give you a valid icon? – David Heffernan