PDA

View Full Version : KDE/QWT doubt on debian sarge



hildebrand
16th April 2007, 05:24
I have got Debian Sarge installed on my system. I have the following doubts:-
(1) I want to use kde widgets within qt3 designer. In particular i wanted to use the KDoubleSpinBox widget. I am not finding the relevant header file in /usr/include/kde which also i had to manually specify in the make file. Where are they? Do i need some other package to be installed to get the header file. Other kde widgets seem to be there. (some are missing like kintspinbox). My code refuses to compile here due to this. Any suggestions anybody? The widget works fine in preview though!!

(2) I want to add my qwt widgets also to the designer toolbox. how can I do that?

(3) Where is the help available for the kde widgets? (qt widget help is ofcourse got through qt3-doc). It would be really useful.

If anybody can guide I would appreciate it.

guilugi
16th April 2007, 09:21
For your KDE issue, here are source files..not sure they are up to date though :)
http://api.kde.org/3.4-api/kdeui/html/files.html

EDIT : Here is the up-to-date link !
http://api.kde.org/3.5-api/kdelibs-apidocs/kdeui/html/files.html

To include QWT widgets, you should browse Google, but the most simple would be to write
your own Designer plugin for that purpose.
Check the Qt4 Designer docs ;)

Guilugi.

Uwe
16th April 2007, 10:38
To include QWT widgets, you should browse Google, but the most simple would be to write
your own Designer plugin for that purpose.
Check the Qt4 Designer docs ;)
Guilugi.

Qwt comes with a designer plugin (Qt3 + Qt4). I don't use Debian myself, but I'm pretty sure, that all you have to do is to install the Debian packages. If you want to install Qwt from source code, the INSTALL file explains how to build and install the Qwt designer plugin.

Uwe

jacek
16th April 2007, 12:51
I am not finding the relevant header file in /usr/include/kde which also i had to manually specify in the make file. Where are they? Do i need some other package to be installed to get the header file.
Try looking for a package called kde-devel or kdelibs-devel.

hildebrand
19th April 2007, 06:46
Debian Sarge has qt3.3 and designer installed.

The kde-devel package is installed. Package of Qwt (libqwt-dev) is also installed but i don't see any plugin installed. (I had installed the kdesdk package along with libqt3-mt-dev and qt3-designer, qt3-doc etc to get my system ready for qt programming). Also funny thing, I went throug kde core api available somewhere in /usr/share/doc/kde (which is what i was looking for not the online version) and the classes nowhere mentions KDoubleSpinBox although it is mentioned in the kdialog.h header file also. I am not able to connect where is it available.
I request anybody who has debian 3.3 installed to put the widget in a form and compile it. It doesn't work. And to begin with where is the class if it is not there in kde core. Preview works very fine in qte-designer but make fails. What is the mismatch?

Awaiting an early reply
Hildebrand Victor

hildebrand
19th April 2007, 08:22
I have found the solution but problem is still not over.
The kde documents i got from kdesdk-doc-html and kdelibs4-doc packages.
I found out that the Makefile generated by qmake by default does not contain the following:-
(i) It does not contain the setting for the knuminput.h header which actually contains the kdoublespinbox class. (I erroneously thought the file would be called kdoublespinbox.h it is actually knuminput.h which i included in the main form's file). This I added as -I/usr/include/kde3 for the header file in INCPATH in the header
(2) Since this class is part of the kdeui library I needed to include -lkdeui (qmake should have done this by default along with qt designer but somehow didn't do.) :)
This has to be done everytime you call qmake(very boring thing to do!!). Then it compiles without problem. (The same problem was there with qwt also where I needed -I/usr/include/qwt and -lqwt to be put)

But now what is my new problem, my code is now compiling. However, when I click on the KDoubleSpinBox icon to increment or decrement the count, It is exiting the program and shows me "Segmentation Fault" in Konsole. Why is this segmentation fault occuring? I noticed this does not occur for KNumInput also in the same header which I used.:confused:
Can anyone give a pointer on why this is happening?

jacek
19th April 2007, 21:43
It does not contain the setting for the knuminput.h header which actually contains the kdoublespinbox class.
You have to add "INCLUDEPATH += /usr/include/kde3 /usr/include/qwt" to your .pro file.


qmake should have done this by default along with qt designer but somehow didn't do.
Because you haven't told it to do it. Add "LIBS += -lkdeui -lqwt" to your .pro file.


However, when I click on the KDoubleSpinBox icon to increment or decrement the count, It is exiting the program and shows me "Segmentation Fault" in Konsole. Why is this segmentation fault occuring?
It might be caused by lack of KApplication instance, which you should create instead of QApplication.

hildebrand
20th April 2007, 11:57
It might be caused by lack of KApplication instance, which you should create instead of QApplication.

I tried putting KApplication instead of QApplication in the main.cpp file. Output says some initialisation needs to be done. Whats the format?

I am also not completely convinced that this is the problem. I ran an strace of the said file and it seems to have got a signal at the end which terminated it. The last portion is shown below:-
open("/etc/mtab", O_RDONLY) = 7
fstat64(7, {st_mode=S_IFREG|0644, st_size=239, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x412f3000
read(7, "/dev/hda10 / ext2 rw,errors=remo"..., 4096) = 239
close(7) = 0
munmap(0x412f3000, 4096) = 0
open("/proc/meminfo", O_RDONLY) = 7
fstat64(7, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x412f3000
read(7, "MemTotal: 256740 kB\nMemFre"..., 1024) = 572
close(7) = 0
munmap(0x412f3000, 4096) = 0
ioctl(5, FIONREAD, [1]) = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++

I can't make out whats this happening which caused the problem. whats this ioctl for ?

Hildebrand

jacek
21st April 2007, 23:51
I tried putting KApplication instead of QApplication in the main.cpp file. Output says some initialisation needs to be done. Whats the format?
See this: http://api.kde.org/3.5-api/kdelibs-apidocs/kdecore/html/classKCmdLineArgs.html


I am also not completely convinced that this is the problem. I ran an strace of the said file and it seems to have got a signal at the end which terminated it.
...
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
Strace only shows you system calls. A debugger might give more information, but probably it's caused by a null pointer (for example something might be trying to use unitialized KApp variable).

hildebrand
23rd April 2007, 05:27
I ran gdb with this program. The result is as follows:-
GNU gdb 6.3-debian
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-linux"...Using host libthread_db library "/lib/tls/libthread_db.so.1".

(gdb)
(gdb)
(gdb) start
Breakpoint 1 at 0x804b7ac: file main.cpp, line 6.
Starting program: /home/gajendra/test/testkdoublespinbox/testkdoublespinbox
[Thread debugging using libthread_db enabled]
[New Thread 1092003168 (LWP 3732)]
[Switching to Thread 1092003168 (LWP 3732)]
main (argc=1, argv=0x0) at main.cpp:6
6 QApplication a( argc, argv );
(gdb) next
5 {
(gdb) next
7 Form1 w;
(gdb)
6 QApplication a( argc, argv );
(gdb)
5 {
(gdb)
7 Form1 w;
(gdb)
6 QApplication a( argc, argv );
(gdb)


Session management error: Could not open network socket
7 Form1 w;
(gdb)

Program received signal SIGSEGV, Segmentation fault.
0x40dbf92a in KLocale::doFormatInit () from /usr/lib/libkdecore.so.4
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Couldn't get registers: No such process.
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)
Single stepping until exit from function _ZNK7KLocale12doFormatInitEv,
which has no line number information.
Cannot fetch general-purpose registers for thread 1092003168: generic error
(gdb)

I cannot make any head or tail of it. I tried replacing the QApplication definition with KApplication but I got some Message about some init function not being defined.
Can you offer some explanation from the gdb output?

jacek
24th April 2007, 00:56
I ran gdb with this program. The result is as follows:-
[...]
I cannot make any head or tail of it.
Better try:

(gdb) run
...
Program received signal SIGSEGV, Segmentation fault.
0x40dbf92a in KLocale::doFormatInit () from /usr/lib/libkdecore.so.4
(gdb) bt


Program received signal SIGSEGV, Segmentation fault.
0x40dbf92a in KLocale::doFormatInit () from /usr/lib/libkdecore.so.4
Again, this can be caused by lack of KApplication instance.


I tried replacing the QApplication definition with KApplication but I got some Message about some init function not being defined.
You mean this message:
FAILURE (KCmdLineArgs):
Application has not called KCmdLineArgs::init(...).
Just as it says, your application didn't invoke KCmdLineArgs::init(). See the link in my previous post and check the attached files.

hildebrand
24th April 2007, 06:43
Yes thats the message I was getting when I tried KApplication. I'll do as you say and get back. I think this is the problem.

hildebrand
25th April 2007, 05:18
I modified the main.cpp file to be similar to the one you sent. My code is now compiling and working!! Thanks a lot.
As for the Qwt plugin, I knew that qwt4.2 is coming default with Debian Sarge. They do not seem to be bundling the plugin with the package. From the qwt website qwt.sourceforge.net I downloaded the source package for qwt4.2 which comes with plugin also within it. I compiled it and copied the libqwtplugin.so to the correct plugin location manually as root(make install was not copying it to correct location). Once I did that my qwt widgets now appear in qwt designer. Now I have to start using them!!

Uwe
25th April 2007, 07:13
As for the Qwt plugin, I knew that qwt4.2 is coming default with Debian Sarge. They do not seem to be bundling the plugin with the package. From the qwt website qwt.sourceforge.net I downloaded the source package for qwt4.2 which comes with plugin also within it.

Qwt 4.2 is several years old. You already build your own Qwt library, so consider to start with Qwt 5.0.x: it works with Qt 3.3 and Qt 4.

Uwe