I'm trying to change the opacity of the window of my program in Qt and using C++11. In other words, I want to open the main Windows slowly by adding some instructions to main.cpp
. You see those instructons below:
MainWindow a;
a.show();
for(int Counter = 0; Counter <= 100; Counter++)
{
a.SetWindowOpacity(Counter);
for(Wait = 0; Wait < 100; Wait++);
}
But when I build and run my project, I don't see any changes and it normally runs. This is whole source code, main.cpp
.
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.setWindowTitle("Add a new student");
w.show();
for(int Counter = 0; Counter <= 100; Counter++)
{
w.setWindowOpacity(Counter);
for(int Wait = 0; Wait < 100; Wait++);
}
return a.exec();
}
So, why don't Qt change the opacity of the window of my program?
Aucun commentaire:
Enregistrer un commentaire