diff --git a/src/qtui/columnhandleitem.cpp b/src/qtui/columnhandleitem.cpp index cf0e5d7..6eb6856 100644 --- a/src/qtui/columnhandleitem.cpp +++ b/src/qtui/columnhandleitem.cpp @@ -36,10 +36,13 @@ ColumnHandleItem::ColumnHandleItem(qreal w, QGraphicsItem *parent) _moving(false), _minXPos(0), _maxXPos(0), - _timeLine(150) + _timeLine(350), + _rulerColor(QApplication::palette().windowText().color()) { setAcceptsHoverEvents(true); setZValue(10); + // Over 350 ms, the default update interval (40) only gives us nine frame, it looks a bit blocky. 20ms = 18frames, much smoother + _timeLine.setUpdateInterval(20); setCursor(QCursor(Qt::OpenHandCursor)); connect(&_timeLine, SIGNAL(valueChanged(qreal)), this, SLOT(hoverChanged(qreal))); @@ -122,11 +125,10 @@ void ColumnHandleItem::paint(QPainter *painter, const QStyleOptionGraphicsItem * Q_UNUSED(widget); QLinearGradient gradient(boundingRect().topLeft(), boundingRect().topRight()); - QColor rulerColor = QApplication::palette().windowText().color(); - rulerColor.setAlphaF(_hover); + _rulerColor.setAlphaF(_hover); gradient.setColorAt(0, Qt::transparent); - gradient.setColorAt(0.4, rulerColor); - gradient.setColorAt(0.6, rulerColor); + gradient.setColorAt(0.4, _rulerColor); + gradient.setColorAt(0.6, _rulerColor); gradient.setColorAt(1, Qt::transparent); painter->fillRect(boundingRect(), gradient); } diff --git a/src/qtui/columnhandleitem.h b/src/qtui/columnhandleitem.h index c96c687..fa2f3a5 100644 --- a/src/qtui/columnhandleitem.h +++ b/src/qtui/columnhandleitem.h @@ -24,6 +24,7 @@ #include #include #include +#include #include class ColumnHandleItem : public QObject, public QGraphicsItem { @@ -57,6 +58,7 @@ class ColumnHandleItem : public QObject, public QGraphicsItem { void hoverChanged(qreal value); private: + QColor _rulerColor; qreal _width; qreal _hover; bool _moving;