X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fchoosecolorwidget.cpp;h=d842a0a30d587612e0ccdbea40360db3e90c2eaa;hb=1d9ce4dd0538c76fb9513b9b05bf66c3186f44de;hp=26c18743e649ab9455c58669647ca5da7a496738;hpb=6b455ec7f0b45327eea2fd0bc8b5dab83821e0bf;p=kdenlive diff --git a/src/choosecolorwidget.cpp b/src/choosecolorwidget.cpp index 26c18743..d842a0a3 100644 --- a/src/choosecolorwidget.cpp +++ b/src/choosecolorwidget.cpp @@ -27,6 +27,7 @@ #include #include #include +#include static QColor stringToColor(QString strColor) { @@ -81,10 +82,14 @@ static QString colorToString(QColor color, bool alpha) { stream << color.alpha(); } + else { + // MLT always wants 0xRRGGBBAA format + stream << "ff"; + } return colorStr; } -ChooseColorWidget::ChooseColorWidget(QString text, QString color, QWidget *parent) : +ChooseColorWidget::ChooseColorWidget(QString text, QString color, bool alphaEnabled, QWidget *parent) : QWidget(parent) { QHBoxLayout *layout = new QHBoxLayout(this); @@ -99,6 +104,9 @@ ChooseColorWidget::ChooseColorWidget(QString text, QString color, QWidget *paren rightSideLayout->setSpacing(0); m_button = new KColorButton(stringToColor(color), rightSide); +#if KDE_IS_VERSION(4,5,0) + if (alphaEnabled) m_button->setAlphaChannelEnabled(alphaEnabled); +#endif // m_button->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); ColorPickerWidget *picker = new ColorPickerWidget(rightSide); @@ -109,6 +117,7 @@ ChooseColorWidget::ChooseColorWidget(QString text, QString color, QWidget *paren connect(picker, SIGNAL(colorPicked(QColor)), this, SLOT(setColor(QColor))); connect(picker, SIGNAL(displayMessage(const QString&, int)), this, SIGNAL(displayMessage(const QString&, int))); + connect(picker, SIGNAL(disableCurrentFilter(bool)), this, SIGNAL(disableCurrentFilter(bool))); connect(m_button, SIGNAL(changed(QColor)), this, SIGNAL(modified())); } @@ -121,13 +130,6 @@ QString ChooseColorWidget::getColor() return colorToString(m_button->color(), alphaChannel); } -void ChooseColorWidget::setAlphaChannelEnabled(bool enabled) -{ -#if KDE_IS_VERSION(4,5,0) - m_button->setAlphaChannelEnabled(enabled); -#endif -} - void ChooseColorWidget::setColor(QColor color) { m_button->setColor(color);