Diffstat (limited to 'microkde/KDGanttMinimizeSplitter.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | microkde/KDGanttMinimizeSplitter.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/microkde/KDGanttMinimizeSplitter.cpp b/microkde/KDGanttMinimizeSplitter.cpp index 84edc0d..c60b566 100644 --- a/microkde/KDGanttMinimizeSplitter.cpp +++ b/microkde/KDGanttMinimizeSplitter.cpp @@ -67,32 +67,33 @@ static int opaqueOldPos = -1; //### there's only one mouse, but this is a bit ri KDGanttSplitterHandle::KDGanttSplitterHandle( Qt::Orientation o, KDGanttMinimizeSplitter *parent, const char * name ) : QWidget( parent, name ), _activeButton( 0 ), _collapsed( false ) { if ( QApplication::desktop()->width() > 320 && QApplication::desktop()->width() < 650 ) { mSizeHint = QSize(7,7); mUseOffset = true; } else { mSizeHint = QSize(6,6); mUseOffset = false; } s = parent; setOrientation(o); setMouseTracking( true ); + mMouseDown = false; //setMaximumHeight( 5 ); // test only } QSize KDGanttSplitterHandle::sizeHint() const { return mSizeHint; } void KDGanttSplitterHandle::setOrientation( Qt::Orientation o ) { orient = o; #ifndef QT_NO_CURSOR if ( o == KDGanttMinimizeSplitter::Horizontal ) setCursor( splitHCursor ); else setCursor( splitVCursor ); @@ -113,33 +114,33 @@ void KDGanttSplitterHandle::mouseMoveEvent( QMouseEvent *e ) - mouseOffset; if ( true /*opaque()*/ ) { s->moveSplitter( pos, id() ); } else { int min = pos; int max = pos; s->getRange( id(), &min, &max ); s->setRubberband( QMAX( min, QMIN(max, pos ))); } _collapsed = false; } void KDGanttSplitterHandle::mousePressEvent( QMouseEvent *e ) { if ( e->button() == LeftButton ) { _activeButton = onButton( e->pos() ); mouseOffset = s->pick(e->pos()); - if ( _activeButton != 0) + mMouseDown = true; repaint(); updateCursor( e->pos() ); } } void KDGanttSplitterHandle::updateCursor( const QPoint& p) { if ( onButton( p ) != 0 ) { setCursor( arrowCursor ); } else { if ( orient == KDGanttMinimizeSplitter::Horizontal ) setCursor( splitHCursor ); else setCursor( splitVCursor ); } @@ -158,32 +159,33 @@ void KDGanttSplitterHandle::toggle() pos = max; } _origPos = s->pick(mapToParent( QPoint( 0,0 ) )); s->moveSplitter( pos, id() ); _collapsed = true; } else { s->moveSplitter( _origPos, id() ); _collapsed = false; } repaint(); } void KDGanttSplitterHandle::mouseReleaseEvent( QMouseEvent *e ) { + mMouseDown = false; if ( _activeButton != 0 ) { if ( onButton( e->pos() ) == _activeButton ) { toggle(); } _activeButton = 0; updateCursor( e->pos() ); } else { if ( !opaque() && e->button() == LeftButton ) { QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos())) - mouseOffset; s->setRubberband( -1 ); s->moveSplitter( pos, id() ); } } @@ -264,34 +266,38 @@ void KDGanttSplitterHandle::paintEvent( QPaintEvent * ) //LR // Draw the splitter rectangle p.setBrush( colorGroup().background() ); p.setPen( colorGroup().foreground() ); //p.drawRect( rect() ); buffer.fill( colorGroup().background() ); //buffer.fill( backgroundColor() ); // parentWidget()->style().drawPrimitive( QStyle::PE_Panel, &p, rect(), parentWidget()->colorGroup()); int sw = 8; // Hardcoded, given I didn't use styles anymore, I didn't like to use their size // arrow color QColor col; if ( _activeButton ) col = colorGroup().background().dark( 250 ); + else { + if ( mMouseDown ) + col = Qt::white; else col = colorGroup().background().dark( 150 ); + } //QColor col = backgroundColor().dark( 130 ); p.setBrush( col ); p.setPen( col ); QValueList<QPointArray> list = buttonRegions(); int index = 1; if ( mUseOffset ) p.translate( 0, 1 ); for ( QValueList<QPointArray>::Iterator it = list.begin(); it != list.end(); ++it ) { if ( index == _activeButton ) { /* if ( ! _collapsed ) { p.save(); // p.translate( parentWidget()->style().pixelMetric( QStyle::PM_ButtonShiftHorizontal ), // parentWidget()->style().pixelMetric( QStyle::PM_ButtonShiftVertical ) ); |