! \class BackgroundWidget \brief Widget for editing the properties of a Background object, mostly used in an appropriate dock widget. \ingroup frontend */
| 22 | \ingroup frontend |
| 23 | */ |
| 24 | BackgroundWidget::BackgroundWidget(QWidget* parent) |
| 25 | : QWidget(parent) { |
| 26 | ui.setupUi(this); |
| 27 | |
| 28 | ui.cbColorStyle->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon); |
| 29 | ui.bOpen->setIcon(QIcon::fromTheme(QStringLiteral("document-open"))); |
| 30 | ui.leFileName->setCompleter(new QCompleter(new QFileSystemModel, this)); |
| 31 | |
| 32 | connect(ui.chkEnabled, &QCheckBox::toggled, this, &BackgroundWidget::enabledChanged); |
| 33 | connect(ui.cbPosition, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &BackgroundWidget::positionChanged); |
| 34 | connect(ui.cbType, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &BackgroundWidget::typeChanged); |
| 35 | connect(ui.cbColorStyle, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &BackgroundWidget::colorStyleChanged); |
| 36 | connect(ui.cbImageStyle, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &BackgroundWidget::imageStyleChanged); |
| 37 | connect(ui.cbBrushStyle, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &BackgroundWidget::brushStyleChanged); |
| 38 | connect(ui.bOpen, &QPushButton::clicked, this, &BackgroundWidget::selectFile); |
| 39 | connect(ui.leFileName, &QLineEdit::returnPressed, this, &BackgroundWidget::fileNameChanged); |
| 40 | connect(ui.leFileName, &QLineEdit::textChanged, this, &BackgroundWidget::fileNameChanged); |
| 41 | connect(ui.kcbFirstColor, &KColorButton::changed, this, &BackgroundWidget::firstColorChanged); |
| 42 | connect(ui.kcbSecondColor, &KColorButton::changed, this, &BackgroundWidget::secondColorChanged); |
| 43 | connect(ui.sbOpacity, QOverload<int>::of(&QSpinBox::valueChanged), this, &BackgroundWidget::opacityChanged); |
| 44 | |
| 45 | retranslateUi(); |
| 46 | } |
| 47 | |
| 48 | void BackgroundWidget::setBackgrounds(const QList<Background*>& backgrounds) { |
| 49 | m_backgrounds = backgrounds; |