Diffstat (limited to 'microkde/KDGanttMinimizeSplitter.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | microkde/KDGanttMinimizeSplitter.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/microkde/KDGanttMinimizeSplitter.cpp b/microkde/KDGanttMinimizeSplitter.cpp index ea3a329..d675517 100644 --- a/microkde/KDGanttMinimizeSplitter.cpp +++ b/microkde/KDGanttMinimizeSplitter.cpp | |||
@@ -633,114 +633,122 @@ void KDGanttMinimizeSplitter::childEvent( QChildEvent *c ) | |||
633 | } | 633 | } |
634 | recalcId(); | 634 | recalcId(); |
635 | doResize(); | 635 | doResize(); |
636 | return; | 636 | return; |
637 | } | 637 | } |
638 | p = s; | 638 | p = s; |
639 | s = data->list.next(); | 639 | s = data->list.next(); |
640 | } | 640 | } |
641 | } | 641 | } |
642 | } | 642 | } |
643 | 643 | ||
644 | 644 | ||
645 | /*! | 645 | /*! |
646 | 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 |
647 | rubber band is removed. | 647 | rubber band is removed. |
648 | */ | 648 | */ |
649 | void KDGanttMinimizeSplitter::setRubberband( int p ) | 649 | void KDGanttMinimizeSplitter::setRubberband( int p ) |
650 | { | 650 | { |
651 | #ifdef DESKTOP_VERSION | 651 | #ifdef DESKTOP_VERSION |
652 | QPainter paint( this ); | 652 | QPainter paint( this ); |
653 | paint.setPen( gray ); | 653 | paint.setPen( gray ); |
654 | paint.setBrush( gray ); | 654 | paint.setBrush( gray ); |
655 | paint.setRasterOp( XorROP ); | 655 | paint.setRasterOp( XorROP ); |
656 | QRect r = contentsRect(); | 656 | QRect r = contentsRect(); |
657 | const int rBord = 3; //Themable???? | 657 | const int rBord = 3; //Themable???? |
658 | #if QT_VERSION >= 0x030000 | 658 | #if QT_VERSION >= 0x030000 |
659 | int sw = style().pixelMetric(QStyle::PM_SplitterWidth, this); | 659 | int sw = style().pixelMetric(QStyle::PM_SplitterWidth, this); |
660 | #else | 660 | #else |
661 | int sw = style().splitterWidth(); | 661 | int sw = style().splitterWidth(); |
662 | #endif | 662 | #endif |
663 | if ( orient == Horizontal ) { | 663 | if ( orient == Horizontal ) { |
664 | if ( opaqueOldPos >= 0 ) | 664 | if ( opaqueOldPos >= 0 ) |
665 | paint.drawRect( opaqueOldPos + sw/2 - rBord , r.y(), | 665 | paint.drawRect( opaqueOldPos + sw/2 - rBord , r.y(), |
666 | 2*rBord, r.height() ); | 666 | 2*rBord, r.height() ); |
667 | if ( p >= 0 ) | 667 | if ( p >= 0 ) |
668 | paint.drawRect( p + sw/2 - rBord, r.y(), 2*rBord, r.height() ); | 668 | paint.drawRect( p + sw/2 - rBord, r.y(), 2*rBord, r.height() ); |
669 | } else { | 669 | } else { |
670 | if ( opaqueOldPos >= 0 ) | 670 | if ( opaqueOldPos >= 0 ) |
671 | paint.drawRect( r.x(), opaqueOldPos + sw/2 - rBord, | 671 | paint.drawRect( r.x(), opaqueOldPos + sw/2 - rBord, |
672 | r.width(), 2*rBord ); | 672 | r.width(), 2*rBord ); |
673 | if ( p >= 0 ) | 673 | if ( p >= 0 ) |
674 | 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 ); |
675 | } | 675 | } |
676 | opaqueOldPos = p; | 676 | opaqueOldPos = p; |
677 | #else | 677 | #else |
678 | if ( !mRubberBand ) { | 678 | if ( !mRubberBand ) { |
679 | mRubberBand = new QFrame( 0, "rubber", WStyle_NoBorder | WStyle_Customize | WStyle_StaysOnTop); | 679 | mRubberBand = new QFrame( 0, "rubber", WStyle_NoBorder | WStyle_Customize | WStyle_StaysOnTop); |
680 | mRubberBand->setFrameStyle( Box | Raised ); | 680 | mRubberBand->setFrameStyle( Box | Raised ); |
681 | mRubberBand->setPalette( QPalette ( Qt::green.light(),Qt::green.dark() ) ); | 681 | mRubberBand->setPalette( QPalette ( Qt::red.light(),Qt::red.dark() ) ); |
682 | } | 682 | } |
683 | QRect r = contentsRect(); | 683 | QRect r = contentsRect(); |
684 | const int rBord = 5; //Themable???? | 684 | static int rBord = 0; //Themable???? |
685 | if ( !rBord ) { | ||
686 | if (QApplication::desktop()->width() <= 320 ) | ||
687 | rBord = 4; | ||
688 | else | ||
689 | rBord = 5; | ||
690 | } | ||
685 | int sw = style().splitterWidth(); | 691 | int sw = style().splitterWidth(); |
686 | if ( orient == Horizontal ) { | 692 | if ( orient == Horizontal ) { |
687 | if ( p >= 0 ) { | 693 | if ( p >= 0 ) { |
688 | QPoint geo = mapToGlobal (QPoint ( p + sw/2 - rBord, r.y())); | 694 | QPoint geo = mapToGlobal (QPoint ( p + sw/2 - rBord, r.y())); |
689 | mRubberBand->setGeometry( geo.x(), geo.y(), 2*rBord, r.height() ); | 695 | mRubberBand->setGeometry( geo.x(), geo.y(), 2*rBord, r.height() ); |
690 | } | 696 | } |
691 | } else { | 697 | } else { |
692 | if ( p >= 0 ) { | 698 | if ( p >= 0 ) { |
693 | QPoint geo = mapToGlobal (QPoint ( r.x(), p + sw/2 - rBord)); | 699 | QPoint geo = mapToGlobal (QPoint ( r.x(), p + sw/2 - rBord)); |
694 | mRubberBand->setGeometry( geo.x(), geo.y(), r.width(), 2*rBord); | 700 | mRubberBand->setGeometry( geo.x(), geo.y(), r.width(), 2*rBord); |
695 | } | 701 | } |
696 | } | 702 | } |
697 | opaqueOldPos = p; | 703 | opaqueOldPos = p; |
704 | if ( ! mRubberBand->isVisible() ) { | ||
698 | mRubberBand->show(); | 705 | mRubberBand->show(); |
706 | } | ||
699 | #endif | 707 | #endif |
700 | } | 708 | } |
701 | 709 | ||
702 | 710 | ||
703 | /*! \reimp */ | 711 | /*! \reimp */ |
704 | bool KDGanttMinimizeSplitter::event( QEvent *e ) | 712 | bool KDGanttMinimizeSplitter::event( QEvent *e ) |
705 | { | 713 | { |
706 | if ( e->type() == QEvent::LayoutHint || ( e->type() == QEvent::Show && data->firstShow ) ) { | 714 | if ( e->type() == QEvent::LayoutHint || ( e->type() == QEvent::Show && data->firstShow ) ) { |
707 | recalc( isVisible() ); | 715 | recalc( isVisible() ); |
708 | if ( e->type() == QEvent::Show ) | 716 | if ( e->type() == QEvent::Show ) |
709 | data->firstShow = FALSE; | 717 | data->firstShow = FALSE; |
710 | } | 718 | } |
711 | return QWidget::event( e ); | 719 | return QWidget::event( e ); |
712 | } | 720 | } |
713 | 721 | ||
714 | 722 | ||
715 | /*! | 723 | /*! |
716 | \obsolete | 724 | \obsolete |
717 | 725 | ||
718 | Draws the splitter handle in the rectangle described by \a x, \a y, | 726 | Draws the splitter handle in the rectangle described by \a x, \a y, |
719 | \a w, \a h using painter \a p. | 727 | \a w, \a h using painter \a p. |
720 | \sa QStyle::drawPrimitive() | 728 | \sa QStyle::drawPrimitive() |
721 | */ | 729 | */ |
722 | void KDGanttMinimizeSplitter::drawSplitter( QPainter *p, | 730 | void KDGanttMinimizeSplitter::drawSplitter( QPainter *p, |
723 | QCOORD x, QCOORD y, QCOORD w, QCOORD h ) | 731 | QCOORD x, QCOORD y, QCOORD w, QCOORD h ) |
724 | { | 732 | { |
725 | #if 0 | 733 | #if 0 |
726 | // LR | 734 | // LR |
727 | style().drawPrimitive(QStyle::PE_Splitter, p, QRect(x, y, w, h), colorGroup(), | 735 | style().drawPrimitive(QStyle::PE_Splitter, p, QRect(x, y, w, h), colorGroup(), |
728 | (orientation() == Qt::Horizontal ? | 736 | (orientation() == Qt::Horizontal ? |
729 | QStyle::Style_Horizontal : 0)); | 737 | QStyle::Style_Horizontal : 0)); |
730 | #endif | 738 | #endif |
731 | } | 739 | } |
732 | 740 | ||
733 | 741 | ||
734 | /*! | 742 | /*! |
735 | Returns the id of the splitter to the right of or below the widget \a w, | 743 | Returns the id of the splitter to the right of or below the widget \a w, |
736 | or 0 if there is no such splitter | 744 | or 0 if there is no such splitter |
737 | (i.e. it is either not in this KDGanttMinimizeSplitter or it is at the end). | 745 | (i.e. it is either not in this KDGanttMinimizeSplitter or it is at the end). |
738 | */ | 746 | */ |
739 | int KDGanttMinimizeSplitter::idAfter( QWidget* w ) const | 747 | int KDGanttMinimizeSplitter::idAfter( QWidget* w ) const |
740 | { | 748 | { |
741 | QSplitterLayoutStruct *s = data->list.first(); | 749 | QSplitterLayoutStruct *s = data->list.first(); |
742 | bool seen_w = FALSE; | 750 | bool seen_w = FALSE; |
743 | while ( s ) { | 751 | while ( s ) { |
744 | if ( s->isSplitter && seen_w ) | 752 | if ( s->isSplitter && seen_w ) |
745 | return data->list.at(); | 753 | return data->list.at(); |
746 | if ( !s->isSplitter && s->wid == w ) | 754 | if ( !s->isSplitter && s->wid == w ) |