LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   KHTML, w t f? (https://www.linuxquestions.org/questions/programming-9/khtml-w-t-f-61256/)

StonedZealot 05-22-2003 06:58 PM

KHTML, w t f?
 
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:

Code:

52: undefined reference to `KHTMLPart::KHTMLPart[in-charge](QWidget*, char const*, QObject*, char const*, KHTMLPart::GUIProfile)'
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 :rolleyes:

llama_meme 05-24-2003 07:53 AM

Looks like you're neglecting to include some header files. Can you post the program that won't compile?

Alex

StonedZealot 05-24-2003 05:27 PM

I can't at the moment, sorry, but I do believe I had included: khtml_part.h for the main browser widget...I mean is there anything else needed?

atomas123 10-11-2005 10:00 PM

KHTMLPart
 
maybe you should add $(LIB_KHTML) to your "automake config" so it can link.

yapp 10-12-2005 01:47 PM

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


All times are GMT -5. The time now is 01:31 AM.