Lines 1201-1220
Link Here
|
1201 |
{ |
1201 |
{ |
1202 |
static QMap<QRgb, QPixmap*> pxCache; |
1202 |
static QMap<QRgb, QPixmap*> pxCache; |
1203 |
|
1203 |
|
1204 |
QPixmap * pm = pxCache[rgb.rgb()]; |
1204 |
QRgb index=rgb.rgb(); |
1205 |
if (!pm) |
1205 |
if (pxCache.contains(index)) |
1206 |
{ |
1206 |
return pxCache[index]; |
1207 |
pm = new QPixmap(15, 15); |
1207 |
|
1208 |
pm->fill(rgb); |
1208 |
QPixmap *pm = new QPixmap(15, 15); |
1209 |
QPainter p; |
1209 |
pm->fill(rgb); |
1210 |
p.begin(pm); |
1210 |
QPainter p; |
1211 |
p.setBrush(Qt::NoBrush); |
1211 |
p.begin(pm); |
1212 |
QPen b(Qt::black, 1); |
1212 |
p.setBrush(Qt::NoBrush); |
1213 |
p.setPen(b); |
1213 |
QPen b(Qt::black, 1); |
1214 |
p.drawRect(0, 0, 15, 15); |
1214 |
p.setPen(b); |
1215 |
p.end(); |
1215 |
p.drawRect(0, 0, 15, 15); |
1216 |
pxCache[rgb.rgb()] = pm; |
1216 |
p.end(); |
1217 |
} |
1217 |
pxCache.insert(index, pm); |
1218 |
return pm; |
1218 |
return pm; |
1219 |
} |
1219 |
} |
1220 |
|
1220 |
|
Lines 1222-1233
Link Here
|
1222 |
{ |
1222 |
{ |
1223 |
static QMap<QRgb, QPixmap*> pxCache; |
1223 |
static QMap<QRgb, QPixmap*> pxCache; |
1224 |
|
1224 |
|
1225 |
QPixmap * pm = pxCache[rgb.rgb()]; |
1225 |
QRgb index=rgb.rgb(); |
1226 |
if (!pm) { |
1226 |
if (pxCache.contains(index)) |
1227 |
pm = new QPixmap(30, 15); |
1227 |
return pxCache[index]; |
1228 |
pm->fill(rgb); |
1228 |
|
1229 |
pxCache[rgb.rgb()] = pm; |
1229 |
QPixmap *pm = new QPixmap(30, 15); |
1230 |
} |
1230 |
pm->fill(rgb); |
|
|
1231 |
pxCache.insert(index, pm); |
1231 |
return pm; |
1232 |
return pm; |
1232 |
} |
1233 |
} |
1233 |
|
1234 |
|