[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-panel-devel
Subject:    Re: kickoff highlight -- please help
From:       Marco Martin <notmart () gmail ! com>
Date:       2008-02-28 19:36:39
Message-ID: 200802282036.39203.notmart () gmail ! com
[Download RAW message or body]

On Thursday 28 February 2008, Aaron J. Seigo wrote:
> On Thursday 28 February 2008, Marco Martin wrote:
> > created a little patch of my proposal (the last one)
>
> nice; some actual code. note that a screenshot would help some of the
> people on this list who may not be able to compile from source daily as we
> can who are involved in the discussion.
(sending again, too big attachment...)
ok, here is a version with drawing problems fixed and a screenshot with the 
default color scheme (http://www.notmart.org/misc/kickoff2.png)

Cheers,
Marco Martin

["kickoff_fulllightgradient2.diff" (text/x-diff)]

Index: flipscrollview.cpp
===================================================================
--- flipscrollview.cpp	(revision 779902)
+++ flipscrollview.cpp	(working copy)
@@ -309,7 +309,7 @@
 QRect FlipScrollView::visualRect(const QModelIndex& index) const
 {
     int topOffset = d->headerRect(index.parent()).height();
-    int leftOffset = d->backArrowRect().width() + ItemDelegate::BACK_ARROW_SPACING;
+    int leftOffset = 0;
 
     if (index.parent() != d->currentRoot() &&
         index.parent() != d->previousRoot() &&
@@ -337,7 +337,7 @@
     int scrollBarWidth = verticalScrollBar()->isVisible() ?
                                     verticalScrollBar()->width() : 0;
     QRectF itemRect(leftOffset, topOffset + index.row() * d->itemHeight,
-                   width() - leftOffset - scrollBarWidth - \
ItemDelegate::BACK_ARROW_SPACING, +                   width() - leftOffset - \
scrollBarWidth /*- ItemDelegate::BACK_ARROW_SPACING*/,  d->itemHeight);
 
     const qreal timeValue = d->flipAnimTimeLine->currentValue();
@@ -473,21 +473,16 @@
 {
     bool mouseOverBackArrow = d->backArrowRect().contains(event->pos());
 
-    if (mouseOverBackArrow != d->backArrowHover) {
-        d->backArrowHover = mouseOverBackArrow;
-        setDirtyRegion(d->backArrowRect());
-    } else {
-        const QModelIndex itemUnderMouse = indexAt(event->pos());
-        if (itemUnderMouse != d->hoveredIndex && itemUnderMouse.isValid()) {
-            update(itemUnderMouse);
-            update(d->hoveredIndex);
+    const QModelIndex itemUnderMouse = indexAt(event->pos());
+    if (itemUnderMouse != d->hoveredIndex && itemUnderMouse.isValid()) {
+        update(itemUnderMouse);
+        update(d->hoveredIndex);
 
-            d->hoveredIndex = itemUnderMouse;
-            setCurrentIndex(d->hoveredIndex);
-        }
-
-        QAbstractItemView::mouseMoveEvent(event);
+        d->hoveredIndex = itemUnderMouse;
+        setCurrentIndex(d->hoveredIndex);
     }
+
+    QAbstractItemView::mouseMoveEvent(event);
 }
 
 void FlipScrollView::keyPressEvent(QKeyEvent *event)
@@ -518,7 +513,7 @@
         QModelIndex index = model()->index(i, 0, root);
 
         QStyleOptionViewItem option = viewOptions();
-        option.rect = visualRect(index);
+        option.rect = visualRect(index).adjusted(d->backArrowRect().width() + \
ItemDelegate::BACK_ARROW_SPACING, 0, 0, 0);  
         // only draw items intersecting the region of the widget
         // being updated
@@ -555,8 +550,8 @@
 
             QRect triRect = option.rect;
             QPainterPath tPath = d->trianglePath();
-            triRect.setLeft(triRect.right() - ItemDelegate::ITEM_RIGHT_MARGIN);
-            painter.translate(triRect.center().x(), triRect.y() + \
(tPath.boundingRect().height() / 2)  + 3); +            \
triRect.setLeft(triRect.right() - ItemDelegate::ITEM_RIGHT_MARGIN - \
tPath.boundingRect().width()); +            painter.translate(triRect.center().x(), \
triRect.center().y());  painter.rotate(180);
             painter.drawPath(tPath);
             painter.resetTransform();
Index: itemdelegate.cpp
===================================================================
--- itemdelegate.cpp	(revision 779902)
+++ itemdelegate.cpp	(working copy)
@@ -102,7 +102,21 @@
     if (hover) {
         painter->save();
         painter->setPen(Qt::NoPen);
+
         QColor backgroundColor = option.palette.color(QPalette::Highlight);
+        QColor lightBackColor;
+
+        //lightBackColor is backgroundColor to gray and made transparent
+        lightBackColor.setHsv(0, 0, backgroundColor.value());
+
+        QLinearGradient backGradient(contentRect.topLeft(), \
contentRect.bottomLeft()); +        lightBackColor.setAlphaF(0.3);
+        backGradient.setColorAt(0, lightBackColor);
+        lightBackColor.setAlphaF(0.7);
+        backGradient.setColorAt(1, lightBackColor);
+
+        painter->fillRect(contentRect.adjusted(-ITEM_LEFT_MARGIN,0,ITEM_RIGHT_MARGIN,1), \
backGradient); +
         QFontMetrics titleMetrics(titleFont);
         QFontMetrics subTitleMetrics(subTitleFont);
         QRect textAreaRect = contentRect;
@@ -113,8 +127,11 @@
                             1);
         // use a slightly translucent version of the palette's highlight color
         // for the background
-        backgroundColor.setAlphaF(0.5);
-        painter->setBrush(QBrush(backgroundColor));
+        backgroundColor.setAlphaF(0.3);
+        backGradient.setColorAt(0, backgroundColor);
+        backgroundColor.setAlphaF(0.7);
+        backGradient.setColorAt(1, backgroundColor);
+        painter->setBrush(QBrush(backGradient));
         painter->drawPath(Plasma::roundedRectangle(textAreaRect, 5));
         painter->restore();
     }



_______________________________________________
Panel-devel mailing list
Panel-devel@kde.org
https://mail.kde.org/mailman/listinfo/panel-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic