165 // ============================================================================= |
165 // ============================================================================= |
166 // ----------------------------------------------------------------------------- |
166 // ----------------------------------------------------------------------------- |
167 void ColorSelector::mousePressEvent (QMouseEvent* event) |
167 void ColorSelector::mousePressEvent (QMouseEvent* event) |
168 { QPointF scenepos = ui->viewport->mapToScene (event->pos()); |
168 { QPointF scenepos = ui->viewport->mapToScene (event->pos()); |
169 |
169 |
170 ulong x = ( (ulong) scenepos.x() - (g_squareSize / 2)) / g_squareSize; |
170 int x = (scenepos.x() - (g_squareSize / 2)) / g_squareSize; |
171 ulong y = ( (ulong) scenepos.y() - (g_squareSize / 2)) / g_squareSize; |
171 int y = (scenepos.y() - (g_squareSize / 2)) / g_squareSize; |
172 ulong idx = (y * g_numColumns) + x; |
172 int idx = (y * g_numColumns) + x; |
173 |
173 |
174 LDColor* col = ::getColor (idx); |
174 LDColor* col = ::getColor (idx); |
175 |
175 |
176 if (!col) |
176 if (!col) |
177 return; |
177 return; |