void ScaleManipulator::UpdateColours () { m_arrow_x.setColour(colourSelected(g_colour_x, m_selectable_x.isSelected())); m_arrow_y.setColour(colourSelected(g_colour_y, m_selectable_y.isSelected())); m_arrow_z.setColour(colourSelected(g_colour_z, m_selectable_z.isSelected())); m_quad_screen.setColour(colourSelected(g_colour_screen, m_selectable_screen.isSelected())); }
void RotateManipulator::UpdateColours () { m_circle_x.setColour(colourSelected(g_colour_x, m_selectable_x.isSelected())); m_circle_y.setColour(colourSelected(g_colour_y, m_selectable_y.isSelected())); m_circle_z.setColour(colourSelected(g_colour_z, m_selectable_z.isSelected())); m_circle_screen.setColour(colourSelected(g_colour_screen, m_selectable_screen.isSelected())); m_circle_sphere.setColour(colourSelected(g_colour_sphere, false)); }
void PaletteView::mousePressEvent(QMouseEvent* event){ if (mLabel){ QPoint pt = mLabel->mapFromParent( event->pos()); // QPointF pt = this->mapFrom(mLabel, event->pos()); // this->mapToScene(event->pos().x(),event->pos().y()); int px = pt.x(); int py = pt.y(); // qDebug() << px << py << mLabel->pixmap()->width() << mLabel->pixmap()->height(); if (px < 0 || px >= mLabel->width() || py < 0 || py >= mLabel->height()){ // do nothing } else { QImage img = mLabel->pixmap()->toImage(); int w = mLabel->width(), h = mLabel->height(); float dx = ((float)pt.x())/w; float dy = ((float)pt.y())/h; // qDebug() << mLabel->contentsRect(); // qDebug() << pt.x() << pt.y() << dx << dy << dx*img.width() << dy*img.height(); QRgb rgb = img.pixel(dx*img.width(), dy*img.height()); // QRgb rgb = img.pixel(pt.x(),pt.y()); QColor colour = QColor(rgb); emit(colourSelected(colour)); } } }
void TranslateManipulator::UpdateColours() { _arrowX.setColour(colourSelected(g_colour_x, _selectableX.isSelected())); _arrowHeadX.setColour(colourSelected(g_colour_x, _selectableX.isSelected())); _arrowY.setColour(colourSelected(g_colour_y, _selectableY.isSelected())); _arrowHeadY.setColour(colourSelected(g_colour_y, _selectableY.isSelected())); _arrowZ.setColour(colourSelected(g_colour_z, _selectableZ.isSelected())); _arrowHeadZ.setColour(colourSelected(g_colour_z, _selectableZ.isSelected())); _quadScreen.setColour(colourSelected(Manipulator::COLOUR_SCREEN(), _selectableScreen.isSelected())); }