How to display screen full of Images?



  • A very very basic and naive question.. How to display four images on the screen which span the entire window..?

    I want to create a game UI, which has cartoon Images on the front.. there might 3-4 four of them, and on top of that two buttons to play and help.

    Play button would then create a OpenGL context (onclick) and Game Engine would start.

    Is this right way to go..?

    Any code to display Images..?(No theory please.. code speaks a lot louder)



  • In C++ or in QML?

    In C++ is something like this:

    @SelectionWidget::SelectionWidget(QWidget* parent):
    QWidget(parent)
    {
    setWindowState(Qt::WindowFullScreen);

    QGridLayout gridLayout = new QGridLayout;
    gridLayout->setSpacing(0); // or the value you need
    gridLayout->setMargins(0); // or the value you need
    
    // Here you have to initialize 4 QLabels with your images
    // do not forget to call QLabel::setScaleableContents(true)
    
    
    gridLayout->addWidget( label1, 0, 0 );
    gridLayout->addWidget( label2, 1, 0 );
    gridLayout->addWidget( label3, 0, 1 );
    gridLayout->addWidget( label4, 1, 1 );
    
    setLayout(gridLayout);
    

    }@


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.