ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm an uber noob at programming in KDE/Qt and it's a bit different from Delphi in Windows but I think I'm getting the hang of it. Anyway, I'm trying to lay down a KHTMLPart onto this form with this code:
Code:
browser = new KHTMLPart(view_box, "browser");
where browser is a KHTMLPart defined in the mainwindow's class definition and view_box is a QVBox. Seems like pretty basic code but then I get the error:
so in an effort to just get *something* working, I use the example code here
which is straight from KDE 3.1 Reference material and it blew up as well! So weird, I thought this would be easy
Here is some additional code to make the browsing optimal, this information is somewhat hidden in the KDE docs.
Code:
#include <qlayout.h>
#include <khtml_part.h>
#include <khtmlview.h>
#include <kparts/browserextension.h>
WebSidebar::WebSidebar(QWidget *parent, const char *name)
: QWidget(parent, name)
{
QBoxLayout *layout = new QHBoxLayout( this );
khtml_ = new KHTMLPart(this, "KHTMLPart");
layout->addWidget( khtml_->view() ); // Streches widget
khtml_->setJScriptEnabled(true);
khtml_->setJavaEnabled(true);
khtml_->setMetaRefreshEnabled(true);
khtml_->setOnlyLocalReferences(false);
khtml_->setPluginsEnabled(true);
// Connect signals for browsing
connect( khtml_->browserExtension(), SIGNAL( openURLRequest(const KURL&, const KParts::URLArgs&) ) ,
this, SLOT( slotOpenURLRequest(const KURL&, const KParts::URLArgs&) ) );
}
// Open a new url in the khtml widget
void WebSidebar::slotOpenURLRequest(const KURL &url, const KParts::URLArgs & /* args */)
{
khtml_->openURL(url);
}
And indeed, you need $(LIB_KHTML) in the LDADD rule of the Makefile.am. If you look in your admin/ folder, you notice LIB_KHTML is an alias for '-lkhtml', which tells g++ to link to libkhtml.so
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.