문제

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().

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top