-rw-r--r-- | korganizer/kolistview.cpp | 2 | ||||
-rw-r--r-- | microkde/KDGanttMinimizeSplitter.cpp | 32 | ||||
-rw-r--r-- | microkde/KDGanttMinimizeSplitter.h | 2 |
3 files changed, 34 insertions, 2 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index 09d70f1..15e094d 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -1212,13 +1212,13 @@ void KOListViewListView::contentsMousePressEvent(QMouseEvent *e) | |||
1212 | mEventPos = e->pos(); | 1212 | mEventPos = e->pos(); |
1213 | mEventGlobalPos = e->globalPos(); | 1213 | mEventGlobalPos = e->globalPos(); |
1214 | } | 1214 | } |
1215 | KListView::contentsMousePressEvent( e ); | 1215 | KListView::contentsMousePressEvent( e ); |
1216 | if ( e->button() == RightButton ) { | 1216 | if ( e->button() == RightButton ) { |
1217 | QListViewItem* ci = currentItem(); | 1217 | QListViewItem* ci = currentItem(); |
1218 | clearSelection(); | 1218 | //clearSelection(); |
1219 | if ( ci ) | 1219 | if ( ci ) |
1220 | ci->setSelected( true ); | 1220 | ci->setSelected( true ); |
1221 | } | 1221 | } |
1222 | } | 1222 | } |
1223 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) | 1223 | void KOListViewListView::contentsMouseReleaseEvent(QMouseEvent *e) |
1224 | { | 1224 | { |
diff --git a/microkde/KDGanttMinimizeSplitter.cpp b/microkde/KDGanttMinimizeSplitter.cpp index 029f14b..ea3a329 100644 --- a/microkde/KDGanttMinimizeSplitter.cpp +++ b/microkde/KDGanttMinimizeSplitter.cpp | |||
@@ -186,12 +186,14 @@ void KDGanttSplitterHandle::mouseReleaseEvent( QMouseEvent *e ) | |||
186 | QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos())) | 186 | QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos())) |
187 | - mouseOffset; | 187 | - mouseOffset; |
188 | s->setRubberband( -1 ); | 188 | s->setRubberband( -1 ); |
189 | s->moveSplitter( pos, id() ); | 189 | s->moveSplitter( pos, id() ); |
190 | } | 190 | } |
191 | } | 191 | } |
192 | if ( s->rubberBand() ) | ||
193 | s->rubberBand()->hide(); | ||
192 | repaint(); | 194 | repaint(); |
193 | } | 195 | } |
194 | 196 | ||
195 | int KDGanttSplitterHandle::onButton( const QPoint& p ) | 197 | int KDGanttSplitterHandle::onButton( const QPoint& p ) |
196 | { | 198 | { |
197 | QValueList<QPointArray> list = buttonRegions(); | 199 | QValueList<QPointArray> list = buttonRegions(); |
@@ -431,20 +433,20 @@ static QSize minSizeHint( const QWidget* w ) | |||
431 | if ( min.width() > 0 ) | 433 | if ( min.width() > 0 ) |
432 | s.setWidth( min.width() ); | 434 | s.setWidth( min.width() ); |
433 | return s.expandedTo(QSize(0,0)); | 435 | return s.expandedTo(QSize(0,0)); |
434 | } | 436 | } |
435 | 437 | ||
436 | 438 | ||
437 | |||
438 | /*! | 439 | /*! |
439 | Constructs a horizontal splitter with the \a parent and \a | 440 | Constructs a horizontal splitter with the \a parent and \a |
440 | name arguments being passed on to the QFrame constructor. | 441 | name arguments being passed on to the QFrame constructor. |
441 | */ | 442 | */ |
442 | KDGanttMinimizeSplitter::KDGanttMinimizeSplitter( QWidget *parent, const char *name ) | 443 | KDGanttMinimizeSplitter::KDGanttMinimizeSplitter( QWidget *parent, const char *name ) |
443 | :QFrame(parent,name,WPaintUnclipped) | 444 | :QFrame(parent,name,WPaintUnclipped) |
444 | { | 445 | { |
446 | mRubberBand = 0; | ||
445 | mFirstHandle = 0; | 447 | mFirstHandle = 0; |
446 | #if QT_VERSION >= 232 | 448 | #if QT_VERSION >= 232 |
447 | orient = Horizontal; | 449 | orient = Horizontal; |
448 | init(); | 450 | init(); |
449 | #endif | 451 | #endif |
450 | } | 452 | } |
@@ -453,12 +455,14 @@ KDGanttMinimizeSplitter::KDGanttMinimizeSplitter( QWidget *parent, const char *n | |||
453 | Constructs a splitter with orientation \a o with the \a parent | 455 | Constructs a splitter with orientation \a o with the \a parent |
454 | and \a name arguments being passed on to the QFrame constructor. | 456 | and \a name arguments being passed on to the QFrame constructor. |
455 | */ | 457 | */ |
456 | KDGanttMinimizeSplitter::KDGanttMinimizeSplitter( Orientation o, QWidget *parent, const char *name ) | 458 | KDGanttMinimizeSplitter::KDGanttMinimizeSplitter( Orientation o, QWidget *parent, const char *name ) |
457 | :QFrame(parent,name,WPaintUnclipped) | 459 | :QFrame(parent,name,WPaintUnclipped) |
458 | { | 460 | { |
461 | |||
462 | mRubberBand = 0; | ||
459 | mFirstHandle = 0; | 463 | mFirstHandle = 0; |
460 | #if QT_VERSION >= 232 | 464 | #if QT_VERSION >= 232 |
461 | orient = o; | 465 | orient = o; |
462 | init(); | 466 | init(); |
463 | #endif | 467 | #endif |
464 | } | 468 | } |
@@ -469,12 +473,14 @@ KDGanttMinimizeSplitter::KDGanttMinimizeSplitter( Orientation o, QWidget *parent | |||
469 | KDGanttMinimizeSplitter::~KDGanttMinimizeSplitter() | 473 | KDGanttMinimizeSplitter::~KDGanttMinimizeSplitter() |
470 | { | 474 | { |
471 | #if QT_VERSION >= 232 | 475 | #if QT_VERSION >= 232 |
472 | data->list.setAutoDelete( TRUE ); | 476 | data->list.setAutoDelete( TRUE ); |
473 | delete data; | 477 | delete data; |
474 | #endif | 478 | #endif |
479 | if ( mRubberBand ) | ||
480 | delete mRubberBand; | ||
475 | } | 481 | } |
476 | 482 | ||
477 | 483 | ||
478 | #if QT_VERSION >= 232 | 484 | #if QT_VERSION >= 232 |
479 | void KDGanttMinimizeSplitter::init() | 485 | void KDGanttMinimizeSplitter::init() |
480 | { | 486 | { |
@@ -639,12 +645,13 @@ void KDGanttMinimizeSplitter::childEvent( QChildEvent *c ) | |||
639 | /*! | 645 | /*! |
640 | Shows a rubber band at position \a p. If \a p is negative, the | 646 | Shows a rubber band at position \a p. If \a p is negative, the |
641 | rubber band is removed. | 647 | rubber band is removed. |
642 | */ | 648 | */ |
643 | void KDGanttMinimizeSplitter::setRubberband( int p ) | 649 | void KDGanttMinimizeSplitter::setRubberband( int p ) |
644 | { | 650 | { |
651 | #ifdef DESKTOP_VERSION | ||
645 | QPainter paint( this ); | 652 | QPainter paint( this ); |
646 | paint.setPen( gray ); | 653 | paint.setPen( gray ); |
647 | paint.setBrush( gray ); | 654 | paint.setBrush( gray ); |
648 | paint.setRasterOp( XorROP ); | 655 | paint.setRasterOp( XorROP ); |
649 | QRect r = contentsRect(); | 656 | QRect r = contentsRect(); |
650 | const int rBord = 3; //Themable???? | 657 | const int rBord = 3; //Themable???? |
@@ -664,12 +671,35 @@ void KDGanttMinimizeSplitter::setRubberband( int p ) | |||
664 | paint.drawRect( r.x(), opaqueOldPos + sw/2 - rBord, | 671 | paint.drawRect( r.x(), opaqueOldPos + sw/2 - rBord, |
665 | r.width(), 2*rBord ); | 672 | r.width(), 2*rBord ); |
666 | if ( p >= 0 ) | 673 | if ( p >= 0 ) |
667 | paint.drawRect( r.x(), p + sw/2 - rBord, r.width(), 2*rBord ); | 674 | paint.drawRect( r.x(), p + sw/2 - rBord, r.width(), 2*rBord ); |
668 | } | 675 | } |
669 | opaqueOldPos = p; | 676 | opaqueOldPos = p; |
677 | #else | ||
678 | if ( !mRubberBand ) { | ||
679 | mRubberBand = new QFrame( 0, "rubber", WStyle_NoBorder | WStyle_Customize | WStyle_StaysOnTop); | ||
680 | mRubberBand->setFrameStyle( Box | Raised ); | ||
681 | mRubberBand->setPalette( QPalette ( Qt::green.light(),Qt::green.dark() ) ); | ||
682 | } | ||
683 | QRect r = contentsRect(); | ||
684 | const int rBord = 5; //Themable???? | ||
685 | int sw = style().splitterWidth(); | ||
686 | if ( orient == Horizontal ) { | ||
687 | if ( p >= 0 ) { | ||
688 | QPoint geo = mapToGlobal (QPoint ( p + sw/2 - rBord, r.y())); | ||
689 | mRubberBand->setGeometry( geo.x(), geo.y(), 2*rBord, r.height() ); | ||
690 | } | ||
691 | } else { | ||
692 | if ( p >= 0 ) { | ||
693 | QPoint geo = mapToGlobal (QPoint ( r.x(), p + sw/2 - rBord)); | ||
694 | mRubberBand->setGeometry( geo.x(), geo.y(), r.width(), 2*rBord); | ||
695 | } | ||
696 | } | ||
697 | opaqueOldPos = p; | ||
698 | mRubberBand->show(); | ||
699 | #endif | ||
670 | } | 700 | } |
671 | 701 | ||
672 | 702 | ||
673 | /*! \reimp */ | 703 | /*! \reimp */ |
674 | bool KDGanttMinimizeSplitter::event( QEvent *e ) | 704 | bool KDGanttMinimizeSplitter::event( QEvent *e ) |
675 | { | 705 | { |
diff --git a/microkde/KDGanttMinimizeSplitter.h b/microkde/KDGanttMinimizeSplitter.h index 84d3d8e..585298d 100644 --- a/microkde/KDGanttMinimizeSplitter.h +++ b/microkde/KDGanttMinimizeSplitter.h | |||
@@ -77,12 +77,13 @@ public: | |||
77 | QSize minimumSizeHint() const; | 77 | QSize minimumSizeHint() const; |
78 | 78 | ||
79 | QValueList<int> sizes() const; | 79 | QValueList<int> sizes() const; |
80 | void setSizes( QValueList<int> ); | 80 | void setSizes( QValueList<int> ); |
81 | KDGanttSplitterHandle* firstHandle(){ return mFirstHandle;} | 81 | KDGanttSplitterHandle* firstHandle(){ return mFirstHandle;} |
82 | void expandPos( int id, int* min, int* max ); | 82 | void expandPos( int id, int* min, int* max ); |
83 | QFrame* rubberBand() { return mRubberBand ;} | ||
83 | public slots: | 84 | public slots: |
84 | void toggle(); | 85 | void toggle(); |
85 | protected: | 86 | protected: |
86 | void childEvent( QChildEvent * ); | 87 | void childEvent( QChildEvent * ); |
87 | 88 | ||
88 | bool event( QEvent * ); | 89 | bool event( QEvent * ); |
@@ -96,12 +97,13 @@ protected: | |||
96 | void styleChange( QStyle& ); | 97 | void styleChange( QStyle& ); |
97 | int adjustPos( int , int ); | 98 | int adjustPos( int , int ); |
98 | virtual void setRubberband( int ); | 99 | virtual void setRubberband( int ); |
99 | void getRange( int id, int*, int* ); | 100 | void getRange( int id, int*, int* ); |
100 | 101 | ||
101 | private: | 102 | private: |
103 | QFrame* mRubberBand; | ||
102 | void init(); | 104 | void init(); |
103 | void recalc( bool update = FALSE ); | 105 | void recalc( bool update = FALSE ); |
104 | void doResize(); | 106 | void doResize(); |
105 | void storeSizes(); | 107 | void storeSizes(); |
106 | void processChildEvents(); | 108 | void processChildEvents(); |
107 | QSplitterLayoutStruct *addWidget( QWidget*, bool first = FALSE ); | 109 | QSplitterLayoutStruct *addWidget( QWidget*, bool first = FALSE ); |