Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to resize my .gif file to full screen in any monitor? C++



  • I have created an app that show my gif, but any gifs shows with their own size and i do not know how to resize they to full screen. I use only QLabel, becouse it doesn't show any frame and icons. I need only gif as result. Here my code:

    #include <QtGui>
    #include <QMainwindow>
    #include <QString>
    #include <QPixmap>
    #include <QtWidgets>
    #include <QLabel>
    #include <QApplication>
    
    int main(int argc, char *argv[])
    {
        QApplication a(argc, argv);
        QLabel* label = new QLabel();
        label->setWindowFlags(Qt::FramelessWindowHint);
        label->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
            label->setScaledContents(true);
            label->setMargin(0);
        label->setMask((new QPixmap("F:\\ADDOBE ANIMATE\\proj\\ulq.gif"))->mask());
     QMovie *movie = new QMovie("F:\\ADDOBE ANIMATE\\proj\\ulq.gif");
     label->setMovie(movie);
     movie->start();
        label->show();
     return a.exec();
    
    
    }
    
    

    Can u help me how to resize result to full screen? And is this code a good way to show animations? Sorry for mistakes in English



  • @Raikoho said in How to resize my .gif file to full screen in any monitor? C++:

    I use only QLabel, becouse it doesn't show any frame and icons

    You still can use a frameless QWidget / QWindow. (setWindowFlags(Qt::FramelessWindowHint)), because then you could do something like:

    window.showFullScreen();
    

    (showFullScreen() does not work on QLabel)


Log in to reply