| Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date | |
| All threads index page 2 | |
Hello all, We are using very much Tool Buttons with pixmaps and often disable these Buttons if the associated functionality can not be used. But the grey pixmaps really don't look good. Whe the pixmap is greyed out i only see an outline and cannot recognize the pixmaop any more. Here are my questions: - is the grey-algorithm of Qt not good? - do i have to use special color palettes to get better results? - am i doing something else wrong? Please see attached a screenshot. Thanks for hints, Stefan Löcher EUKLID Software GmbH EUKLID Entwicklung Niederkasseler Lohweg 20 D-40547 Düsseldorf mailto:Stefan.Loecher@euklid-software.de WWW: www.euklid-software.de Büro Düsseldorf: 0211-52740-227 Büro Aachen: 0241-9127706 Fax: 0211-52740-280 Mobil: 0170-8275533
Attachment:
pix.jpg
Description: pix.jpg
Hi Stefan!
We had the same problem when graying toolbar buttons in our Qt based
application. Thus we had to ask our designer to create disabled variant for
all buttons which can be disabled. Other solution is to write your own
algorithm of graying but we didn't have enough time for that.
Please, see code by Paul Curtis, which may help you to create disabled
buttons look on fly (it produces not very good result for light icons):
(Thanks a lot anyway Paul! :)) )
QPixmap generateDisabledPixmap(QPixmap &p, QColorGroup cg)
{
// Convert to a 32-bit image, for simplicity.
QImage img = p.convertToImage().convertDepth(32);
QImage newimg(img.width(), img.height(), 32);
newimg.setAlphaBuffer(TRUE);
newimg.fill(cg.button().rgb());
for (int y = 0; y < img.height(); ++y)
for (int x = 0; x < img.width(); ++x)
{
QRgb rgb = img.pixel(x, y);
if (rgb >= 0xFF000000 &&
(rgb & 0xFFFFFF) != 0xFFFFFF &&
(rgb & 0xFFFFFF) != 0xC0C0C0)
{
newimg.setPixel(x, y, cg.dark().rgb());
if (x+1 < newimg.width() && y+1 < newimg.height())
newimg.setPixel(x+1, y+1, cg.light().rgb());
}
}
p.convertFromImage(newimg);
p.setMask(p.createHeuristicMask());
return p;
}
Best regards,
Dima Ivanest
-----Original Message-----
From: owner-qt-interest@trolltech.com
[mailto:owner-qt-interest@trolltech.com]On Behalf Of Stefan Löcher
Sent: Wednesday, March 06, 2002 10:32 AM
To: qt-interest@trolltech.com
Subject: Disabling (greying out) pixmaps
Hello all,
We are using very much Tool Buttons with pixmaps and often disable these
Buttons if the associated functionality can not be used. But the grey
pixmaps really don't look good. Whe the pixmap is greyed out i only see
an outline and cannot recognize the pixmaop any more. Here are my
questions:
- is the grey-algorithm of Qt not good?
- do i have to use special color palettes to get better results?
- am i doing something else wrong?
Please see attached a screenshot.
Thanks for hints,
Stefan Löcher
EUKLID Software GmbH
EUKLID Entwicklung
Niederkasseler Lohweg 20
D-40547 Düsseldorf
mailto:Stefan.Loecher@euklid-software.de
WWW: www.euklid-software.de
Büro Düsseldorf: 0211-52740-227
Büro Aachen: 0241-9127706
Fax: 0211-52740-280
Mobil: 0170-8275533