void RichTextEditor::updateColor(const QColor &col) { if (col == qcColor) return; qcColor = col; QRect r(0,0,24,24); QPixmap qpm(r.size()); QPainter qp(&qpm); qp.fillRect(r, col); qp.setPen(col.darker()); qp.drawRect(r.adjusted(0, 0, -1, -1)); qaColor->setIcon(qpm); }
/** * Loads an image using Qt and converts it to a CGImage. * * @returns CGImageRef for the new image. (Remember to release it when finished with it.) * @param aSource The source name. */ CGImageRef darwinToCGImageRef(const char *pczSource) { QPixmap qpm(QString(":/") + pczSource); Assert(!qpm.isNull()); return ::darwinToCGImageRef(&qpm); }