PDA

View Full Version : KColorCombo problem



Maxilys
8th May 2006, 15:15
Hi there,

I'm trying to use KColorCombo. Everything works except that I can't retrieve the selected color. Any attempt to use KColorCombo::color() leads to a failure during compile.



serenity.cpp:(.text+0x138d1): undefined reference to `KColorCombo::color() const'
collect2: ld returned 1 exit status


The include is there. What else can I do and that I don't know? :confused:

(My config: KDE 3.5.2)

jpn
9th May 2006, 15:53
I'm trying to use KColorCombo. Everything works except that I can't retrieve the selected color. Any attempt to use KColorCombo::color() leads to a failure during compile.

Could you show a snippet of the code where you call KColorCombo::color() method? Unless you have subclassed KColorCombo, the syntax KColorCombo::color() is wrong. It's not a static method. You should be calling it through the instance, eg. something like combo->color().

jacek
9th May 2006, 16:03
What else can I do and that I don't know?
Are you sure that you link your application with all required libraries?

Maxilys
10th May 2006, 04:43
The code snippet won't tell much since I don't actually want to use a KColorCombo but only access it for my style plugin. Here's what I do in the event filter:



if ( (::qt_cast<QComboBox*>(obj)) && (obj->inherits("KColorCombo"))
&& (ev->type() == QEvent::Paint) )
{
KColorCombo* combo = static_cast<KColorCombo*>(obj);
bool enabled = combo->isEnabled();
bool mouseOver = combo->hasMouse();
QColorGroup cg = combo->colorGroup();
QColor innerColor = combo->color(); // <-Splash!
//
// etc...
}


As for linking the necessary libs, I think I do. I already managed to style the very KDE specific widgets KKeyButton and KColorButton. I don't think KColorCombo has special needs. Am I wrong?

lum
17th May 2006, 05:27
undefined reference
maybe some library is not used when linking

wysota
18th May 2006, 12:02
Show us the compilation line which fails (especially the list of libraries it tries to link with).

Maxilys
18th May 2006, 13:18
Show us the compilation line which fails (especially the list of libraries it tries to link with).

Thanks but it's too late. I already solved the problem. The kdeui library wasn't linked because of a bad bad makefile. :o