diff --git a/include/gui/tracks/track_content_object_item.h b/include/gui/tracks/track_content_object_item.h index 0bf56be49..721625d04 100644 --- a/include/gui/tracks/track_content_object_item.h +++ b/include/gui/tracks/track_content_object_item.h @@ -59,6 +59,7 @@ protected: TrackItem * m_trackItem; trackContentObject * m_tco; + bool m_hover; }; #endif diff --git a/src/gui/tracks/bb_tco_item.cpp b/src/gui/tracks/bb_tco_item.cpp index 0ca10385f..9b2920853 100644 --- a/src/gui/tracks/bb_tco_item.cpp +++ b/src/gui/tracks/bb_tco_item.cpp @@ -10,6 +10,8 @@ #include "gui/tracks/track_item.h" #include "track.h" +// Just some stuff while playing with theming ideas, +// will be moved to lmmsStyle namespace BBTcoStuff { QLinearGradient getGradient( const QColor & _col, const QRectF & _rect ) { @@ -42,7 +44,7 @@ QLinearGradient darken( const QLinearGradient & _gradient ) QGradientStops stops = _gradient.stops(); for (int i = 0; i < stops.size(); ++i) { QColor color = stops.at(i).second; - stops[i].second = color.darker(160); + stops[i].second = color.lighter(150); } QLinearGradient g = _gradient; @@ -85,7 +87,7 @@ void drawPath( QPainter *p, const QPainterPath &path, // highlight if (dark) - p->strokePath(path, QPen(col.lighter(160).darker(160), 2)); + p->strokePath(path, QPen(col.lighter(160).lighter(160), 2)); else p->strokePath(path, QPen(col.lighter(160), 2)); @@ -121,7 +123,7 @@ void BbTrackContentObjectItem::paint( QPainter * _painter, QPainterPath path; path.addRoundedRect(2, 2, rc.width()-4, rc.height()-4, 4, 4); - drawPath( _painter, path, col, "hah", false ); + drawPath( _painter, path, col, "hah", m_hover ); const float cellW = TrackContainerScene::DEFAULT_CELL_WIDTH; _painter->setOpacity(0.2); diff --git a/src/gui/tracks/pattern_item.cpp b/src/gui/tracks/pattern_item.cpp index eacfbdf73..90d4183ed 100644 --- a/src/gui/tracks/pattern_item.cpp +++ b/src/gui/tracks/pattern_item.cpp @@ -10,6 +10,8 @@ #include "gui/tracks/track_item.h" #include "track.h" +// Just some stuff while playing with theming ideas, +// will be moved to lmmsStyle namespace PatternItemStuff { QLinearGradient getGradient( const QColor & _col, const QRectF & _rect ) { @@ -42,7 +44,7 @@ QLinearGradient darken( const QLinearGradient & _gradient ) QGradientStops stops = _gradient.stops(); for (int i = 0; i < stops.size(); ++i) { QColor color = stops.at(i).second; - stops[i].second = color.darker(160); + stops[i].second = color.lighter(150); } QLinearGradient g = _gradient; @@ -86,7 +88,7 @@ void drawPath( QPainter *p, const QPainterPath &path, // highlight if (dark) - p->strokePath(path, QPen(borderCol.darker(160), 2)); + p->strokePath(path, QPen(borderCol.lighter(150), 2)); else p->strokePath(path, QPen(borderCol, 2)); @@ -126,7 +128,7 @@ void PatternItem::paint( QPainter * _painter, QPainterPath path; path.addRoundedRect(2, 2, rc.width()-4, rc.height()-4, 4, 4); - drawPath( _painter, path, col0, colBorder, false ); + drawPath( _painter, path, col0, colBorder, m_hover ); _painter->restore(); diff --git a/src/gui/tracks/track_content_object_item.cpp b/src/gui/tracks/track_content_object_item.cpp index 47b47533a..c92bce418 100644 --- a/src/gui/tracks/track_content_object_item.cpp +++ b/src/gui/tracks/track_content_object_item.cpp @@ -15,10 +15,12 @@ TrackContentObjectItem::TrackContentObjectItem( TrackItem * _track, trackContent QGraphicsItem(), m_trackItem( _track ), m_tco( _object ), - m_snapBackAnimation( NULL ) + m_snapBackAnimation( NULL ), + m_hover( false ) { //m_object = _object; setFlags( QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable ); + setAcceptHoverEvents( true ); setCursor( Qt::OpenHandCursor ); midiTime startPos = _object->startPosition(); @@ -205,7 +207,9 @@ void TrackContentObjectItem::mouseReleaseEvent( QGraphicsSceneMouseEvent * event void TrackContentObjectItem::hoverEnterEvent( QGraphicsSceneHoverEvent * event ) { + m_hover = true; QGraphicsItem::hoverEnterEvent( event ); + update(); } @@ -213,6 +217,8 @@ void TrackContentObjectItem::hoverEnterEvent( QGraphicsSceneHoverEvent * event ) void TrackContentObjectItem::hoverLeaveEvent( QGraphicsSceneHoverEvent * event ) { QGraphicsItem::hoverLeaveEvent( event ); + m_hover = false; + update(); }