Krita Source Code Documentation
Loading...
Searching...
No Matches
black_white_point_chooser.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2014 Dmitry Kazakov <dimula73@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
8
9#include "klocalizedstring.h"
10
11#include "kis_global.h"
12
13#include <QApplication>
14#include <QScreen>
15
16#include <QFormLayout>
17#include "kis_slider_spin_box.h"
18
19
21 : QFrame(parent, Qt::Popup)
22{
23 setFrameStyle(QFrame::Panel|QFrame::Raised);
24
26 m_black->setRange(0.0, 10000, 4);
27 m_black->setValue(0.0);
28 m_black->setSingleStep(0.01);
29 m_black->setMinimumWidth(120);
31
33 m_white->setRange(0.0, 10000, 4);
34 m_white->setValue(1.0);
35 m_white->setSingleStep(0.01);
36 m_white->setMinimumWidth(120);
38
39 connect(m_black, SIGNAL(valueChanged(qreal)), SIGNAL(sigBlackPointChanged(qreal)));
40 connect(m_white, SIGNAL(valueChanged(qreal)), SIGNAL(sigWhitePointChanged(qreal)));
41
42 QFormLayout *layout = new QFormLayout(this);
43 layout->addRow(i18n("Black:"), m_black);
44 layout->addRow(i18n("White:"), m_white);
45}
46
50
51void BlackWhitePointChooser::showPopup(const QPoint &basePoint)
52{
53 show();
54
55 QSize popupSize = size();
56 QRect popupRect(basePoint - QPoint(0, popupSize.height()), popupSize);
57 QRect screenRect = this->screen()->availableGeometry();
58
59 popupRect = kisEnsureInRect(popupRect, screenRect);
60 setGeometry(popupRect);
61}
62
64{
65 return m_black->value();
66}
67
72
74{
75 return m_white->value();
76}
77
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
void sigWhitePointChanged(qreal value)
void showPopup(const QPoint &basePoint)
KisDoubleSliderSpinBox * m_black
KisDoubleSliderSpinBox * m_white
void sigBlackPointChanged(qreal value)
This class is a spinbox in which you can click and drag to set the value. A slider like bar is displa...
void setValue(qreal newValue)
void setRange(qreal newMinimum, qreal newMaximum, int newNumberOfDecimals=0, bool computeNewFastSliderStep=true)
Set the minimum and the maximum values of the range.
void setExponentRatio(qreal newExponentRatio)
QRect kisEnsureInRect(QRect rc, const QRect &bounds)
Definition kis_global.h:267