X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fchoosecolorwidget.cpp;h=f8b8d3024b7050e30d4883316808a8948ae64a9b;hb=c3302003093710ee247ad84c0fe2ef3c579d417f;hp=ca4e28154866fee79924e479d88cc1f525a8bb1d;hpb=32c8c40056e65b230f058b168e8e078ba066038b;p=kdenlive diff --git a/src/choosecolorwidget.cpp b/src/choosecolorwidget.cpp index ca4e2815..f8b8d302 100644 --- a/src/choosecolorwidget.cpp +++ b/src/choosecolorwidget.cpp @@ -68,7 +68,7 @@ static QColor stringToColor(QString strColor) return color; } -static QString colorToString(QColor color, bool alpha) +static QString colorToString(const QColor &color, bool alpha) { QString colorStr; QTextStream stream(&colorStr); @@ -78,18 +78,16 @@ static QString colorToString(QColor color, bool alpha) stream.setFieldAlignment(QTextStream::AlignRight); stream.setPadChar('0'); stream << color.red() << color.green() << color.blue(); - if(alpha) - { + if (alpha) { stream << color.alpha(); - } - else { + } else { // MLT always wants 0xRRGGBBAA format stream << "ff"; } return colorStr; } -ChooseColorWidget::ChooseColorWidget(QString text, QString color, bool alphaEnabled, QWidget *parent) : +ChooseColorWidget::ChooseColorWidget(const QString &text, const QString &color, bool alphaEnabled, QWidget *parent) : QWidget(parent) { QHBoxLayout *layout = new QHBoxLayout(this); @@ -121,7 +119,7 @@ ChooseColorWidget::ChooseColorWidget(QString text, QString color, bool alphaEnab connect(m_button, SIGNAL(changed(QColor)), this, SIGNAL(modified())); } -QString ChooseColorWidget::getColor() +QString ChooseColorWidget::getColor() const { bool alphaChannel = false; #if KDE_IS_VERSION(4,5,0) @@ -130,7 +128,7 @@ QString ChooseColorWidget::getColor() return colorToString(m_button->color(), alphaChannel); } -void ChooseColorWidget::setColor(QColor color) +void ChooseColorWidget::setColor(const QColor& color) { m_button->setColor(color); }