P
P
Pavel2012-08-19 15:43:34
Programming
Pavel, 2012-08-19 15:43:34

Qt: Widget is not displayed on stage. how to fix?

there is a piece of code that sets QLabel to the stage

void MainWindow::setBackGround(QString path)
{
    QPixmap pix(path);
    pBackGround->setPixmap(pix);
    pBackGround->resize(pix.size());
    scene.setSceneRect(pix.rect());
    scene.addWidget(pBackGround);
}

where pBackGround is on my computer (QtSDK installed) everything works, that is, the QLabel is added to the stage and displayed. but it doesn't work on other computers. As far as I understand, QLabel is added without a picture (empty background). I thought what libraries were missing, I tried to put the cool libraries next to the application: multimedia.dll, designer.dll. but didn't help. tell me what is the problem.
pBackGround = new QLabel;

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
ixSci, 2012-08-19
@FluffyMan

where does path point to? In resources?
do you ship imageformats with the binary?

P
Pavel, 2012-08-19
@FluffyMan

path points to a file on the file system.
it is possible more in detail about imageformats?

P
Pavel, 2012-08-19
@FluffyMan

the path is selected from the file selection dialog, so that's not the problem. indeed, one should have placed the Qt/plugins/imageformats folder with its contents next to the executable. thank.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question