Changeset View
Changeset View
Standalone View
Standalone View
src/view/kateviewhelpers.cpp
Show First 20 Lines • Show All 728 Lines • ▼ Show 20 Line(s) | 706 | { | |||
---|---|---|---|---|---|
729 | } | 729 | } | ||
730 | if (style()->subControlRect(QStyle::CC_ScrollBar, &opt, QStyle::SC_ScrollBarAddLine, this).height() == 0) { | 730 | if (style()->subControlRect(QStyle::CC_ScrollBar, &opt, QStyle::SC_ScrollBarAddLine, this).height() == 0) { | ||
731 | int alignMargin = style()->pixelMetric(QStyle::PM_FocusFrameVMargin, &opt, this); | 731 | int alignMargin = style()->pixelMetric(QStyle::PM_FocusFrameVMargin, &opt, this); | ||
732 | grooveRect.setHeight(grooveRect.height() - alignMargin); | 732 | grooveRect.setHeight(grooveRect.height() - alignMargin); | ||
733 | } | 733 | } | ||
734 | m_grooveHeight = grooveRect.height(); | 734 | m_grooveHeight = grooveRect.height(); | ||
735 | 735 | | |||
736 | const int docXMargin = 1; | 736 | const int docXMargin = 1; | ||
737 | QRect sliderRect = style()->subControlRect(QStyle::CC_ScrollBar, &opt, QStyle::SC_ScrollBarSlider, this); | | |||
738 | sliderRect.adjust(docXMargin, 0, 0, 0); | | |||
739 | | ||||
740 | //style()->drawControl(QStyle::CE_ScrollBarAddLine, &opt, &painter, this); | 737 | //style()->drawControl(QStyle::CE_ScrollBarAddLine, &opt, &painter, this); | ||
741 | //style()->drawControl(QStyle::CE_ScrollBarSubLine, &opt, &painter, this); | 738 | //style()->drawControl(QStyle::CE_ScrollBarSubLine, &opt, &painter, this); | ||
742 | 739 | | |||
743 | // calculate the document size and position | 740 | // calculate the document size and position | ||
744 | const int docHeight = qMin(grooveRect.height(), int(m_pixmap.height() / m_pixmap.devicePixelRatio() * 2)) - 2 * docXMargin; | 741 | const int docHeight = qMin(grooveRect.height(), int(m_pixmap.height() / m_pixmap.devicePixelRatio() * 2)) - 2 * docXMargin; | ||
745 | const int yoffset = 1; // top-aligned in stead of center-aligned (grooveRect.height() - docHeight) / 2; | 742 | const int yoffset = 1; // top-aligned in stead of center-aligned (grooveRect.height() - docHeight) / 2; | ||
746 | const QRect docRect(QPoint(grooveRect.left() + docXMargin, yoffset + grooveRect.top()), QSize(grooveRect.width() - docXMargin, docHeight)); | 743 | const QRect docRect(QPoint(grooveRect.left() + docXMargin, yoffset + grooveRect.top()), QSize(grooveRect.width() - docXMargin, docHeight)); | ||
747 | m_mapGroveRect = docRect; | 744 | m_mapGroveRect = docRect; | ||
Show All 34 Lines | |||||
782 | outlineColor.setHsl(hue, sat, backgroundLightness + lighnessDiff * 0.5); | 779 | outlineColor.setHsl(hue, sat, backgroundLightness + lighnessDiff * 0.5); | ||
783 | 780 | | |||
784 | // draw the grove background in case the document is small | 781 | // draw the grove background in case the document is small | ||
785 | painter.setPen(Qt::NoPen); | 782 | painter.setPen(Qt::NoPen); | ||
786 | painter.setBrush(backgroundColor); | 783 | painter.setBrush(backgroundColor); | ||
787 | painter.drawRect(grooveRect); | 784 | painter.drawRect(grooveRect); | ||
788 | 785 | | |||
789 | // adjust the rectangles | 786 | // adjust the rectangles | ||
787 | QRect sliderRect = style()->subControlRect(QStyle::CC_ScrollBar, &opt, QStyle::SC_ScrollBarSlider, this); | ||||
788 | sliderRect.setX(docXMargin); | ||||
789 | sliderRect.setWidth(width() - docXMargin*2); | ||||
790 | | ||||
790 | if ((docHeight + 2 * docXMargin >= grooveRect.height()) && (sliderRect.height() > visibleRect.height() + 2)) { | 791 | if ((docHeight + 2 * docXMargin >= grooveRect.height()) && (sliderRect.height() > visibleRect.height() + 2)) { | ||
791 | visibleRect.adjust(2, 0, -3, 0); | 792 | visibleRect.adjust(2, 0, -3, 0); | ||
792 | } else { | 793 | } else { | ||
793 | visibleRect.adjust(1, 0, -1, 2); | 794 | visibleRect.adjust(1, 0, -1, 2); | ||
794 | sliderRect.setTop(visibleRect.top() - 1); | 795 | sliderRect.setTop(visibleRect.top() - 1); | ||
795 | sliderRect.setBottom(visibleRect.bottom() + 1); | 796 | sliderRect.setBottom(visibleRect.bottom() + 1); | ||
796 | } | 797 | } | ||
797 | 798 | | |||
▲ Show 20 Lines • Show All 2405 Lines • Show Last 20 Lines |