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

List:       kfm-devel
Subject:    Re: Bug in KHMTLPart::gotoAnchor, RenderBox x and y are not right
From:       Eeli Kaikkonen <eekaikko () mail ! student ! oulu ! fi>
Date:       2008-01-07 19:51:30
Message-ID: Pine.GSO.4.58.0801072127460.18458 () paju ! oulu ! fi
[Download RAW message or body]

On Sun, 30 Dec 2007, Eeli Kaikkonen wrote:

> I have problem with KHTMLPart::gotoAnchor. With our application it does
> not go to an anchor.I tested the html code with Konqueror (RC2) and it
> works, which means that the bug is triggered by some special situation.

I suspected that this happens because we use KHTMLPart
begin()/write()/end(). Probably I hit the bullseye because this kind of
simple application reproduces the problem. (testiView is the main widget
for a simple application made with a KDevelop wizard.)

testiView::testiView(QWidget *)
{
	//opens the html file named "html.html" from the cwd.
	QFile file("html.html");
	file.open(QIODevice::ReadOnly);
	QTextStream in(&file);
	m_text = in.readAll();
	file.close();

	// adds a line editor and khtmlview.
	// line editor let's the user give the anchor
	// without restarting.
	m_part = new KHTMLPart(this);
	QVBoxLayout* lo = new QVBoxLayout(this);
	m_lineEdit = new QLineEdit(this);
	lo->addWidget(m_lineEdit);
	lo->addWidget(m_part->view());
	QObject::connect(m_lineEdit, SIGNAL(returnPressed()), this,
SLOT(go()));
	go();
}
void testiView::go()
{
	m_part->begin();
	m_part->write(m_text);
	m_part->end();
	m_part->gotoAnchor(QString(m_lineEdit->text()));
}

This will work and show the bug with any html file which has anchors.

I will soon report this with bugs.kde.org and add the complete test
application so that you don't have to write it manually.

  Yours,
	Eeli Kaikkonen (Mr.), Oulu, Finland
	e-mail: eekaikko@mailx.studentx.oulux.fix (with no x)
[prev in list] [next in list] [prev in thread] [next in thread] 

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