Commit 7a78f296 authored by Tomaz Canabrava's avatar Tomaz Canabrava

Removed code for Qt < 4.0.0

We rely in Qt 5.4+
Signed-off-by: 's avatarTomaz Canabrava <tomaz.canabrava@intel.com>
parent 69004c9b
...@@ -99,9 +99,7 @@ ScrollBar *ScrollZoomer::scrollBar(Qt::Orientation o) ...@@ -99,9 +99,7 @@ ScrollBar *ScrollZoomer::scrollBar(Qt::Orientation o)
if ( sb == NULL ) { if ( sb == NULL ) {
sb = new ScrollBar(o, canvas()); sb = new ScrollBar(o, canvas());
sb->hide(); sb->hide();
connect(sb, connect(sb, &ScrollBar::valueChanged, this, &ScrollZoomer::scrollBarMoved);
SIGNAL(valueChanged(Qt::Orientation, double, double)),
SLOT(scrollBarMoved(Qt::Orientation, double, double)));
} }
return sb; return sb;
} }
...@@ -116,11 +114,7 @@ ScrollBar *ScrollZoomer::verticalScrollBar() const ...@@ -116,11 +114,7 @@ ScrollBar *ScrollZoomer::verticalScrollBar() const
return d_vScrollData->scrollBar; return d_vScrollData->scrollBar;
} }
#if QT_VERSION < 0x040000
void ScrollZoomer::setHScrollBarMode(QScrollView::ScrollBarMode mode)
#else
void ScrollZoomer::setHScrollBarMode(Qt::ScrollBarPolicy mode) void ScrollZoomer::setHScrollBarMode(Qt::ScrollBarPolicy mode)
#endif
{ {
if ( hScrollBarMode() != mode ) { if ( hScrollBarMode() != mode ) {
d_hScrollData->mode = mode; d_hScrollData->mode = mode;
...@@ -128,11 +122,7 @@ void ScrollZoomer::setHScrollBarMode(Qt::ScrollBarPolicy mode) ...@@ -128,11 +122,7 @@ void ScrollZoomer::setHScrollBarMode(Qt::ScrollBarPolicy mode)
} }
} }
#if QT_VERSION < 0x040000
void ScrollZoomer::setVScrollBarMode(QScrollView::ScrollBarMode mode)
#else
void ScrollZoomer::setVScrollBarMode(Qt::ScrollBarPolicy mode) void ScrollZoomer::setVScrollBarMode(Qt::ScrollBarPolicy mode)
#endif
{ {
if ( vScrollBarMode() != mode ) { if ( vScrollBarMode() != mode ) {
d_vScrollData->mode = mode; d_vScrollData->mode = mode;
...@@ -140,20 +130,12 @@ void ScrollZoomer::setVScrollBarMode(Qt::ScrollBarPolicy mode) ...@@ -140,20 +130,12 @@ void ScrollZoomer::setVScrollBarMode(Qt::ScrollBarPolicy mode)
} }
} }
#if QT_VERSION < 0x040000
QScrollView::ScrollBarMode ScrollZoomer::hScrollBarMode() const
#else
Qt::ScrollBarPolicy ScrollZoomer::hScrollBarMode() const Qt::ScrollBarPolicy ScrollZoomer::hScrollBarMode() const
#endif
{ {
return d_hScrollData->mode; return d_hScrollData->mode;
} }
#if QT_VERSION < 0x040000
QScrollView::ScrollBarMode ScrollZoomer::vScrollBarMode() const
#else
Qt::ScrollBarPolicy ScrollZoomer::vScrollBarMode() const Qt::ScrollBarPolicy ScrollZoomer::vScrollBarMode() const
#endif
{ {
return d_vScrollData->mode; return d_vScrollData->mode;
} }
...@@ -191,11 +173,7 @@ void ScrollZoomer::setCornerWidget(QWidget *w) ...@@ -191,11 +173,7 @@ void ScrollZoomer::setCornerWidget(QWidget *w)
delete d_cornerWidget; delete d_cornerWidget;
d_cornerWidget = w; d_cornerWidget = w;
if ( d_cornerWidget->parent() != canvas() ) { if ( d_cornerWidget->parent() != canvas() ) {
#if QT_VERSION < 0x040000
d_cornerWidget->reparent(canvas(), QPoint(0, 0));
#else
d_cornerWidget->setParent(canvas()); d_cornerWidget->setParent(canvas());
#endif
} }
updateScrollBars(); updateScrollBars();
...@@ -242,11 +220,7 @@ bool ScrollZoomer::eventFilter(QObject *o, QEvent *e) ...@@ -242,11 +220,7 @@ bool ScrollZoomer::eventFilter(QObject *o, QEvent *e)
bool ScrollZoomer::needScrollBar(Qt::Orientation o) const bool ScrollZoomer::needScrollBar(Qt::Orientation o) const
{ {
#if QT_VERSION < 0x040000
QScrollView::ScrollBarMode mode;
#else
Qt::ScrollBarPolicy mode; Qt::ScrollBarPolicy mode;
#endif
double zoomMin, zoomMax, baseMin, baseMax; double zoomMin, zoomMax, baseMin, baseMax;
if ( o == Qt::Horizontal ) { if ( o == Qt::Horizontal ) {
...@@ -265,18 +239,10 @@ bool ScrollZoomer::needScrollBar(Qt::Orientation o) const ...@@ -265,18 +239,10 @@ bool ScrollZoomer::needScrollBar(Qt::Orientation o) const
bool needed = false; bool needed = false;
switch(mode) { switch(mode) {
#if QT_VERSION < 0x040000
case QScrollView::AlwaysOn:
#else
case Qt::ScrollBarAlwaysOn: case Qt::ScrollBarAlwaysOn:
#endif
needed = true; needed = true;
break; break;
#if QT_VERSION < 0x040000
case QScrollView::AlwaysOff:
#else
case Qt::ScrollBarAlwaysOff: case Qt::ScrollBarAlwaysOff:
#endif
needed = false; needed = false;
break; break;
default: { default: {
...@@ -360,9 +326,6 @@ void ScrollZoomer::updateScrollBars() ...@@ -360,9 +326,6 @@ void ScrollZoomer::updateScrollBars()
if ( showHScrollBar && showVScrollBar ) { if ( showHScrollBar && showVScrollBar ) {
if ( d_cornerWidget == NULL ) { if ( d_cornerWidget == NULL ) {
d_cornerWidget = new QWidget(canvas()); d_cornerWidget = new QWidget(canvas());
#if QT_VERSION >= 0x040100
d_cornerWidget->setAutoFillBackground(true);
#endif
d_cornerWidget->setPalette(plot()->palette()); d_cornerWidget->setPalette(plot()->palette());
} }
d_cornerWidget->show(); d_cornerWidget->show();
......
...@@ -32,8 +32,8 @@ void ScrollBar::init() ...@@ -32,8 +32,8 @@ void ScrollBar::init()
d_maxBase = 1.0; d_maxBase = 1.0;
moveSlider(d_minBase, d_maxBase); moveSlider(d_minBase, d_maxBase);
connect(this, SIGNAL(sliderMoved(int)), SLOT(catchSliderMoved(int))); connect(this, &ScrollBar::sliderMoved, this, &ScrollBar::catchSliderMoved);
connect(this, SIGNAL(valueChanged(int)), SLOT(catchValueChanged(int))); connect(this, &ScrollBar::valueChanged, this, &ScrollBar::catchValueChanged);
} }
void ScrollBar::setInverted(bool inverted) void ScrollBar::setInverted(bool inverted)
...@@ -75,23 +75,14 @@ void ScrollBar::moveSlider(double min, double max) ...@@ -75,23 +75,14 @@ void ScrollBar::moveSlider(double min, double max)
if ( steps <= 0 ) if ( steps <= 0 )
steps = 1; steps = 1;
#if QT_VERSION < 0x040000
setSteps(steps, sliderTicks);
#else
setSingleStep(steps); setSingleStep(steps);
setPageStep(sliderTicks); setPageStep(sliderTicks);
#endif
int tick = mapToTick(min + (max - min) / 2); int tick = mapToTick(min + (max - min) / 2);
if ( isInverted() ) if ( isInverted() )
tick = d_baseTicks - tick; tick = d_baseTicks - tick;
#if QT_VERSION < 0x040000
directSetValue(tick);
rangeChange();
#else
setSliderPosition(tick); setSliderPosition(tick);
#endif
blockSignals(false); blockSignals(false);
} }
...@@ -158,9 +149,6 @@ void ScrollBar::catchSliderMoved(int value) ...@@ -158,9 +149,6 @@ void ScrollBar::catchSliderMoved(int value)
int ScrollBar::extent() const int ScrollBar::extent() const
{ {
#if QT_VERSION < 0x040000
return style().pixelMetric(QStyle::PM_ScrollBarExtent, this);
#else
QStyleOptionSlider opt; QStyleOptionSlider opt;
opt.init(this); opt.init(this);
opt.subControls = QStyle::SC_None; opt.subControls = QStyle::SC_None;
...@@ -176,5 +164,4 @@ int ScrollBar::extent() const ...@@ -176,5 +164,4 @@ int ScrollBar::extent() const
if (orientation() == Qt::Horizontal) if (orientation() == Qt::Horizontal)
opt.state |= QStyle::State_Horizontal; opt.state |= QStyle::State_Horizontal;
return style()->pixelMetric(QStyle::PM_ScrollBarExtent, &opt, this); return style()->pixelMetric(QStyle::PM_ScrollBarExtent, &opt, this);
#endif
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment