Pergunta

I use Qt.4.6 in Nokia phone.

My window, derived from QWidget, has set nontiled background:

setStyleSheet("border:none; margin: 0px; background-image: url(:/images/background.png);");

In my vertical layout there I have 3 QLabels. I want the middle one that contains image to be resized to fill all available space. If it is not stretched then the background image get duplicated on the background of the label, making an ugly effect.

How can I force it to expand? Or at least how to find out the maximum available size to set with setMinimumHeight().

Foi útil?

Solução

You can set the size policy of the label to expand it.

ui->yourLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

See the official documentation for more details about sizePolicy.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top