6

I'm building a commandline version of an an application that utilizes QColor for cross-platform handling of color data.

For some reason, this datatype is a part of QtGUI even thou it doesn't have anything to do with Widgets - any way to get this class without linking with GUI?

qdot
  • 6,195
  • 5
  • 44
  • 95
  • Nope, it's part of QtGui, so you'll have to use that. What's the problem in doing so anyway? If QColor is all you're using from Qt, you might consider writing your own Color class. It's nothing special. – Bart Sep 12 '12 at 14:39
  • 2
    It seems to be mostly inline code. Do you get any errors when not linking against gui ? – count0 Sep 12 '12 at 14:39

1 Answers1

3

Probably because it includes all the hooks into the QPainter class to draw colors. Yes in a perfect design it would be possible to abstract all that away, but Qt is mostly a gui library and time is money.

But since it's open source you can just copy the Qcolor .h/.cpp and modif them yourself. If you only need the color space conversion routines you can probably just use the.h

Note: Qt is LGPL so the source to any modifications to the Qt code (but not your own app) must be offered to any users of your app.

Martin Beckett
  • 94,801
  • 28
  • 188
  • 263
  • "But since it's open source you can just copy the Qcolor .h/.cpp and modif them yourself". Only if you respect the terms of the license under which you are using Qt. – John Bartholomew Sep 12 '12 at 15:00
  • @JohnBartholomew - the license is LGPL so as long as you offer your new QColor src it's fine. Assuming that the OP was intending to distribute anything anyway. – Martin Beckett Sep 12 '12 at 15:02
  • The way it's phrased in your answer currently, it sounds like you can just grab the file and modify it without any restrictions, which is clearly not the case. I see no particular reason to assume the OP was already intending to distribute source code. – John Bartholomew Sep 12 '12 at 15:09