[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: Qt layout messed up with rich text labels
From:       Michael Goffioul <goffioul () imec ! be>
Date:       2001-11-06 9:49:32
[Download RAW message or body]

> Well, I immidiately started using my scrollwheel and found that its just
> a content area without sliders.
> I doubt it has anything to do with the QLabel, just that someone made the
> content inside the module (probably the widget which does the administrator
> mode button as well) scrollable, and somehow the scrollbars are lost.

I don't think so. As I told you, I aldeady had 3 or 4 times that problem.
Each time it involved a layout with a QLabel containing rich text. In each
case, there were clipping problems. The solution was each time to remove
the rich format tags from the QLabel. I really think there's something
miscomputed in the layout or QLabel size.

To illustrate this, I wrote this little example (attached). Compile it and
run it, then try to reduce the height to its minimum, you'll see that
the button is clipped (at least here). Then edit the code and remove the
rich format tags from the QLabel, and it works OK. A candy to anybody who
explains/solves this... ;-)

Bye.
Michael.

-- 
------------------------------------------------------------------
Michael Goffioul		IMEC-DESICS-MIRA
e-mail: goffioul@imec.be	(Mixed-Signal and RF Applications)
Tel:    +32/16/28-8510		Kapeldreef, 75
Fax:    +32/16/28-1515		3001 HEVERLEE, BELGIUM
------------------------------------------------------------------
["layout.cpp" (text/plain)]

#include <qlabel.h>
#include <qlayout.h>
#include <qpushbutton.h>
#include <qframe.h>
#include <qlistview.h>
#include <qapplication.h>

int main(int argc, char **argv)
{
	QApplication	app(argc, argv);

	QWidget	*mainw = new QWidget;
	QLabel	*label = new QLabel(mainw);
	QPushButton	*btn = new QPushButton( "Push Me To Exit", mainw);
	QFrame	*frame = new QFrame(mainw);
	frame->setFrameStyle(QFrame::HLine|QFrame::Sunken);
	frame->setLineWidth(1);
	QListView	*list = new QListView(mainw);
	list->addColumn("Column 1");
	new QListViewItem(list, "Item 1");
	new QListViewItem(new QListViewItem(list, "Item 2"), "Item 3");
	QObject::connect(btn, SIGNAL(clicked()), &app, SLOT(quit()));

	label->setText("<b>Label Text</b>");

	QVBoxLayout	*lay0 = new QVBoxLayout(mainw, 10, 10);
	QHBoxLayout	*lay1 = new QHBoxLayout(0, 0, 0);
	lay0->addWidget(label);
	lay0->addWidget(frame);
	lay0->addWidget(list);
	lay0->addLayout(lay1);
	lay1->addStretch(1);
	lay1->addWidget(btn);

	mainw->show();
	app.setMainWidget(mainw);

	return app.exec();
}


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic