Results 1 to 7 of 7

Thread: KColorCombo problem

  1. #1
    Join Date
    Jan 2006
    Posts
    14
    Thanks
    1
    Qt products
    Qt3
    Platforms
    Unix/X11

    Question KColorCombo problem

    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?

    (My config: KDE 3.5.2)

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: KColorCombo problem

    Quote Originally Posted by Maxilys
    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().
    J-P Nurmi

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: KColorCombo problem

    Quote Originally Posted by Maxilys
    What else can I do and that I don't know?
    Are you sure that you link your application with all required libraries?

  4. #4
    Join Date
    Jan 2006
    Posts
    14
    Thanks
    1
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: KColorCombo problem

    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:

    Qt Code:
    1. if ( (::qt_cast<QComboBox*>(obj)) && (obj->inherits("KColorCombo"))
    2. && (ev->type() == QEvent::Paint) )
    3. {
    4. KColorCombo* combo = static_cast<KColorCombo*>(obj);
    5. bool enabled = combo->isEnabled();
    6. bool mouseOver = combo->hasMouse();
    7. QColorGroup cg = combo->colorGroup();
    8. QColor innerColor = combo->color(); // <-Splash!
    9. //
    10. // etc...
    11. }
    To copy to clipboard, switch view to plain text mode 

    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?

  5. #5
    Join Date
    Apr 2006
    Posts
    12
    Thanks
    3
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default

    undefined reference
    maybe some library is not used when linking
    Last edited by lum; 17th May 2006 at 10:07.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: KColorCombo problem

    Show us the compilation line which fails (especially the list of libraries it tries to link with).

  7. #7
    Join Date
    Jan 2006
    Posts
    14
    Thanks
    1
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: KColorCombo problem

    Quote Originally Posted by wysota
    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.

Similar Threads

  1. Very strange socket programming problem
    By montylee in forum Qt Programming
    Replies: 5
    Last Post: 11th November 2008, 13:05
  2. Weird problem: multithread QT app kills my linux
    By Ishark in forum Qt Programming
    Replies: 2
    Last Post: 8th August 2008, 10:12
  3. Steps in solving a programming problem?
    By triperzonak in forum General Programming
    Replies: 8
    Last Post: 5th August 2008, 09:47
  4. problem with paint and erase in frame
    By M.A.M in forum Qt Programming
    Replies: 9
    Last Post: 4th May 2008, 21:17
  5. Replies: 16
    Last Post: 7th March 2006, 16:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.