PDA

View Full Version : QColorDialog Apperance?



antonio.r.tome
5th April 2006, 12:18
Hi,

I would like to change the text labels and pushup buttons text labels of the QcolorDialog.

I wasn't able to find how to do that after reading the documentation. Is it possible to do that changes:) ? or that labels are nor supose to change:( ?

my best regards,

António tomé

fullmetalcoder
5th April 2006, 12:36
You can't modify the appearance of such a widget. the only way to get a different color dialog that fit your needs is to craft your own from more basic components (widgets) and maybe looking at the source to see how the color stuff are handled

Good luck.

BTW I'm looking for a color combobox widget to use in a Qt app, anyone has clue?

wysota
5th April 2006, 12:39
It is possible to change them, at least it should be. One way is to use i18n mechanisms integrated with Qt (QTranslator and stuff), another is to look at the dialog's sources to find names of those widgets you need and then ask the dialog to return a pointer to a named child using QObject::findChildren() and when you have them, you can alter them the way you want.

jpn
5th April 2006, 13:05
another is to look at the dialog's sources to find names of those widgets you need and then ask the dialog to return a pointer to a named child using QObject::findChildren() and when you have them, you can alter them the way you want.
QColorDialog has only static methods (and a private constructor) so I'm afraid this is not possible.

wysota
5th April 2006, 13:33
True. So only the translator solution is possible.

Lemming
5th April 2006, 14:56
The feature your want to achieve may be somehow achieved using the native platform code. Or at least it is possible to get inside the dialog and change something using the WinAPI code on Windows. If this suits your needs, you can poke around the CodeProject - there definetely was a nice example.

But anyway, I would rather use the Qt sources and implement my own color dialog basing on them.

antonio.r.tome
5th April 2006, 18:40
But anyway, I would rather use the Qt sources and implement my own color dialog basing on them.

Yes I've done it.
I copied to my work directory the files
qcolordialog.cpp
qcolordialog.h
qdialog_p.h
created a subdirectory named private and copy there the files
qobject_p.h qwidget_p.h

after that I only need to change the qcolordialog.cpp source and everthing seems to be working fine.

I would have thought that it should be possible to change those thinks. The Qt developers didn't seem to agree with me, and complaining about a free thing is nonsense.

Many thanks,

Chicken Blood Machine
6th April 2006, 00:58
I would have thought that it should be possible to change those thinks. The Qt developers didn't seem to agree with me, and complaining about a free thing is nonsense.

Many thanks,
Why did you need to change it anyway?

antonio.r.tome
6th April 2006, 10:20
Why did you need to change it anyway?

I don't need it! I want it. I intend to use the custom color mecanism, and the facilities associated with it. Then I use the color dialog as a tool to choose a discret color patern table (user made) through the custom color mechanism.
So instead of "add to custom color" I want "accept as labels colors" and instead of "custom colors" I want "labels colors" and for the windows title I obviously want "labels colors". As you see nothing important. No extra functionality, only more user friendness.:)

best regards,

António Tomé

dimitri
16th April 2006, 08:43
You could still have used the i18n mechanism to avoid re-coding QColorDialog.

Oh, and about the "complaining about a free thing is nonsense" part, you can report bugs here:
http://www.trolltech.com/forms/feedbackform.html
It's just that this is not a bug, and Trolltech will probably not implement a new feature if you're the only one asking for it.