[Interest] QLabel and QScrollArea

igor.mironchik at gmail.com igor.mironchik at gmail.com
Tue Feb 18 12:57:58 CET 2014


Hi.

I’ve looked at QLabel code and concluded that QLabel doesn’t support shrinking less than 80 characters long.

Fix me if I’m wrong.

If I’m right then even QLabel not suitable for mobile development, and I have to write something simple, that will for example use QStaticText, to draw text labels and will automatically shrink for the mobile screen width.

Am I right?

Thnaks.

From: igor.mironchik at gmail.com 
Sent: Tuesday, February 18, 2014 12:46 PM
To: interest at qt-project.org 
Subject: QLabel and QScrollArea

Hi.

Is it possible to make the QLabel shrinkable with QScrollArea. I.e. when QScrollArea reduces its width, QLabel should shring its width to the QScrollArea::viewport().width() but grows in height... I tell about QLabel with text, not with pixmap...

class Widget	:	public QWidget{public:	Widget()	{		QVBoxLayout * l = new QVBoxLayout( this );		QScrollArea * scrollArea =			new QScrollArea( this );		QLabel * label = new QLabel;		label->setWordWrap( true );		label->setSizePolicy( QSizePolicy::Minimum,			QSizePolicy::Expanding );		label->setText( QLatin1String( "The volume of the ringer and alerts "			"can be adjusted using the volume buttons. "			"The volume of the ringer and alerts "			"can be adjusted using the volume buttons. "			"The volume of the ringer and alerts "			"can be adjusted using the volume buttons. "			"The volume of the ringer and alerts "			"can be adjusted using the volume buttons. " ) );		scrollArea->setWidget( label );		scrollArea->setWidgetResizable( true );		l->addWidget( scrollArea );	}};

The code above doesn’t work as I expected...

Any ideas?

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140218/e46604db/attachment.html>


More information about the Interest mailing list