Krita Source Code Documentation
Loading...
Searching...
No Matches
KisLightnessStrengthOptionWidget.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2022 Dmitry Kazakov <dimula73@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
7
8#include <QLabel>
9#include <QVBoxLayout>
10#include <KisLager.h>
12
13
15{
16 Private(lager::reader<bool> lightnessModeEnabled)
17 : warningLabelVisible{lightnessModeEnabled.map(std::logical_not{})}
18 {
19 }
20
21 lager::reader<bool> warningLabelVisible;
22};
23
24KisLightnessStrengthOptionWidget::KisLightnessStrengthOptionWidget(lager::cursor<KisLightnessStrengthOptionData> optionData, lager::reader<bool> lightnessModeEnabled)
25 : KisCurveOptionWidget(optionData.zoom(kislager::lenses::to_base<KisCurveOptionDataCommon>), KisPaintOpOption::GENERAL, lightnessModeEnabled)
26 , m_d(new Private(lightnessModeEnabled))
27{
28 QWidget* page = new QWidget;
29
30 QLabel *enabledLabel = new QLabel(i18n("Disabled: brush must be in Lightness mode for this option to apply"), page);
31 enabledLabel->setEnabled(true);
32 enabledLabel->setAlignment(Qt::AlignHCenter);
33
34 QVBoxLayout* pageLayout = new QVBoxLayout(page);
35 pageLayout->setContentsMargins(0, 0, 0, 0);
36 pageLayout->addWidget(enabledLabel);
37 pageLayout->addWidget(configurationPage());
38
39 m_d->warningLabelVisible.bind(std::bind(&QWidget::setVisible, enabledLabel, std::placeholders::_1));
40
42}
43
KisLightnessStrengthOptionWidget(lager::cursor< KisLightnessStrengthOptionData > optionData, lager::reader< bool > lightnessModeEnabled)
void setConfigurationPage(QWidget *page)
QWidget * configurationPage() const
@ GENERAL
Definition nugrid.h:26
Private(lager::reader< bool > lightnessModeEnabled)