LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-22-2003, 06:58 PM   #1
StonedZealot
Member
 
Registered: May 2003
Location: St. Louis
Distribution: Slack 9
Posts: 42

Rep: Reputation: 15
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
 
Old 05-24-2003, 07:53 AM   #2
llama_meme
Member
 
Registered: Nov 2001
Location: London, England
Distribution: Gentoo, FreeBSD
Posts: 590

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

Alex
 
Old 05-24-2003, 05:27 PM   #3
StonedZealot
Member
 
Registered: May 2003
Location: St. Louis
Distribution: Slack 9
Posts: 42

Original Poster
Rep: Reputation: 15
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?
 
Old 10-11-2005, 10:00 PM   #4
atomas123
LQ Newbie
 
Registered: Oct 2005
Posts: 13

Rep: Reputation: 0
KHTMLPart

maybe you should add $(LIB_KHTML) to your "automake config" so it can link.
 
Old 10-12-2005, 01:47 PM   #5
yapp
Member
 
Registered: Apr 2003
Location: Netherlands
Distribution: SuSE (before: Gentoo, Slackware)
Posts: 613

Rep: Reputation: 30
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

Last edited by yapp; 10-12-2005 at 01:51 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
System wide KHTML colors ProtoformX Linux - Software 1 04-02-2005 10:13 AM
konqueror displaying raw html. no khtml embedding HriBB Linux - Software 1 06-21-2004 09:16 AM
where is my khtml.h ? linuxlah Programming 2 07-27-2003 06:36 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration