-
Notifications
You must be signed in to change notification settings - Fork 5
/
FilterDialog.cpp
94 lines (81 loc) · 1.5 KB
/
FilterDialog.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/**
* @file
*/
#include <FilterDialog.hpp>
namespace demo { namespace ishapes {
FilterDialog::FilterDialog(ShapesWidget* widget)
: widget_(widget),
enabled_(false)
{
filterDialog_.setupUi(this);
this->setVisible(false);
int X0 = filterDialog_.x0Slider->value();
int Y0 = filterDialog_.y0Slider->value();
int X1 = filterDialog_.x1Slider->value();
int Y1 = filterDialog_.y1Slider->value();
int W = X1 - X0;
int H = Y1 - Y0;
filter_ = QRect(X0,Y0, W, H);
}
FilterDialog::~FilterDialog() { }
void
FilterDialog::accept()
{
this->setVisible(false);
}
void
FilterDialog::reject()
{
this->setVisible(false);
}
void
FilterDialog::updateX0(int x)
{
filter_.setX(x);
if (enabled_)
widget_->displayFilter(filter_);
}
void
FilterDialog::updateY0(int y)
{
filter_.setY(y);
if (enabled_)
widget_->displayFilter(filter_);
}
void
FilterDialog::updateX1(int x)
{
filter_.setWidth(abs(x-filter_.x()));
if (enabled_)
widget_->displayFilter(filter_);
}
void
FilterDialog::updateY1(int y)
{
filter_.setHeight(abs(y-filter_.y()));
if (enabled_)
widget_->displayFilter(filter_);
}
void
FilterDialog::updateFilterStatus(bool on)
{
if (on)
widget_->displayFilter(filter_);
enabled_ = on;
}
bool
FilterDialog::isEnabled()
{
return enabled_;
}
QRect
FilterDialog::getFilterBounds()
{
return filter_;
}
bool
FilterDialog::filterOutside()
{
return filterDialog_.filterCombo->currentIndex() == 0;
}
}}