Bug in KHMTLPart::gotoAnchor, RenderBox x and y are not right
Eeli Kaikkonen
eekaikko at mail.student.oulu.fi
Mon Jan 7 19:51:30 GMT 2008
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 at mailx.studentx.oulux.fix (with no x)
More information about the kfm-devel
mailing list