Problème avec Qt::GlobalColor
Bonjour, j'ai récupéré le programme engauge digitizer disponible ici. Le programme est à la base écrit en qt3. J'ai donc utiliser le script qt3toqt4 pour le « convertir en qt4 ». À la suite de ça, je fait
Citation:
qmake digitizer.pro
make
Je tombe sur l'erreur de compilation suivante
Citation:
src/colorchooser.cpp: In member function ‘void ColorChooser::loadForegroundPixmap(QRgb)’:
src/colorchooser.cpp:261:23: erreur: request for member ‘rgb’ in ‘(Qt::GlobalColor)3u’, which is of non-class type ‘Qt::GlobalColor’
src/colorchooser.cpp:263:23: erreur: request for member ‘rgb’ in ‘(Qt::GlobalColor)2u’, which is of non-class type ‘Qt::GlobalColor’
make: *** [src/.objs/colorchooser.o] Erreur 1
Le problème c'est que je ne comprends pas ce que signifient les « 2u » et « 3u » et comment corriger cela.
Voici le code de la fonction qui pose soucis
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| void ColorChooser::loadForegroundPixmap(QRgb rgbBg)
{
// build foreground/background pixmap. for the foreground color we use black or white,
// whichever is furthest in rgb space from the background color
int width = ChooserWidth + 2 * ChooserPadding;
QImage imageScale(width, m_scaleHeight, 32);
int rBg, gBg, bBg;
QColor colorBg(rgbBg);
colorBg.rgb(&rBg, &gBg, &bBg);
QRgb rgbFg;
int distanceBlack = (rBg - 0) * (rBg - 0) + (gBg - 0) * (gBg - 0) + (bBg - 0) * (bBg - 0);
int distanceWhite = (rBg - 255) * (rBg - 255) + (gBg - 255) * (gBg - 255) + (bBg - 255) * (bBg - 255);
if (distanceWhite > distanceBlack)
rgbFg = Qt::white.rgb();
else
rgbFg = Qt::black.rgb();
for (int x = 0; x < width; x++)
for (int y = 0; y < m_scaleHeight; y++)
{
// show an triangle with bottom side on the left, and point on the right
if (x < (y * width) / (m_scaleHeight - 2 * ChooserFrame))
setPixelRGB(&imageScale, x, y, rgbBg);
else
setPixelRGB(&imageScale, x, y, rgbFg);
}
pixmapForeground.convertFromImage(imageScale, Qt::ThresholdDither);
if (m_discretizeMethod == DiscretizeForeground)
{
scaleCanvas->setBackgroundPixmap(pixmapForeground);
scaleCanvas->update();
}
} |
Qu'en pensez-vous ?