comparison widgets/LEDButton.cpp @ 496:d01f2e406cc5

* recalculate LED cache pixmaps if size changes
author Chris Cannam
date Mon, 23 Feb 2009 19:23:20 +0000
parents 5b7472db612b
children f4960f8ce798
comparison
equal deleted inserted replaced
495:92b89764eb3b 496:d01f2e406cc5
137 137
138 QPixmap *tmpMap = 0; 138 QPixmap *tmpMap = 0;
139 139
140 if (led_state) { 140 if (led_state) {
141 if (d->on_map) { 141 if (d->on_map) {
142 paint.begin(this); 142 if (d->on_map->size() == size()) {
143 paint.drawPixmap(0, 0, *d->on_map); 143 paint.begin(this);
144 paint.end(); 144 paint.drawPixmap(0, 0, *d->on_map);
145 return; 145 paint.end();
146 return;
147 } else {
148 delete d->on_map;
149 d->on_map = 0;
150 }
146 } 151 }
147 } else { 152 } else {
148 if (d->off_map) { 153 if (d->off_map) {
149 paint.begin(this); 154 if (d->off_map->size() == size()) {
150 paint.drawPixmap(0, 0, *d->off_map); 155 paint.begin(this);
151 paint.end(); 156 paint.drawPixmap(0, 0, *d->off_map);
152 return; 157 paint.end();
158 return;
159 } else {
160 delete d->off_map;
161 d->off_map = 0;
162 }
153 } 163 }
154 } 164 }
155 165
156 int scale = 1; 166 int scale = 1;
157 width *= scale; 167 width *= scale;