On Thursday 27 May 2010 02:41:16 Andrea Diamantini wrote:
> Hi all,
> Can someone please take a look at Mr. Gwenview patch against urlbar? :)
> (http://gitorious.org/rekonq/mainline/merge_requests/2282)
> 
> I think that such change needs a bit of discussion. But please, compile &
> test before commenting ;)
> 
> Regards,
> 
> PS: before someone asks..
> To import it:
> 
> $ git co master
> (you are in master, now)
> 
> $ git co -b testbranch
> (you created a new branch from master called 'testbranch')
> 
> $ git pull \
>   git://gitorious.org/rekonq/mainline.git \
>   refs/merge-requests/2282
> (import code in your branch & merge there)
> $ ..compile & test..
> Reply here ;)

Hi,

I like to have a more solid progress indicator, but since during loading state 
the urlbar is not much more than a progressbar, I attached a patch that is not 
finished but draws during loading the urlbar as a progressbar.
So we are always in line with the current Qt/KDE theme.

If you like it, I will work on that to iron it out.

Thanks,
Johannes
diff --git a/src/urlbar/urlbar.cpp b/src/urlbar/urlbar.cpp
index 4d38f17..2f5ef89 100644
--- a/src/urlbar/urlbar.cpp
+++ b/src/urlbar/urlbar.cpp
@@ -174,20 +174,37 @@ void UrlBar::paintEvent(QPaintEvent *event)
             backgroundColor = QColor(255, 255, 171);  // light yellow
         }
         p.setBrush(QPalette::Base, backgroundColor);
+        setPalette(p);
+
+        // you need this before our code to draw inside the line edit..
+        KLineEdit::paintEvent(event);
     }
     else
     {
-        QColor loadingColor = QColor(116, 192, 250);
+        QPainter painter(this);
 
-        QLinearGradient gradient(0, 0, width(), 0);
-        gradient.setColorAt(0, loadingColor);
-        gradient.setColorAt(((double)progr) / 100, backgroundColor);
-        p.setBrush(QPalette::Base, gradient);
+        QPalette p2;
+        p2.setBrush(QPalette::Background, Qt::white);
+        p2.setBrush(QPalette::Base, Qt::white);
+        p2.setBrush(QPalette::Dark, Qt::white);
+        p2.setBrush(QPalette::Shadow, Qt::white);
+
+        QStyleOptionProgressBar option;
+        option.initFrom(this);
+        option.palette = p2;
+        option.progress = progr;
+        option.minimum = 0;
+        option.maximum = 100;
+        option.text = text();
+        option.textAlignment = Qt::AlignLeft | Qt::AlignVCenter;
+        QStyleOptionFrame option1;
+        initStyleOption(&option1);
+        option.rect = style()->subElementRect(QStyle::SE_LineEditContents, &option1, this);;
+
+        style()->drawControl(QStyle::CE_ProgressBar, &option, &painter, this);
+        style()->drawControl(QStyle::CE_ProgressBarLabel, &option, &painter, this);
     }
-    setPalette(p);
 
-    // you need this before our code to draw inside the line edit..
-    KLineEdit::paintEvent(event);
 
     if( text().isEmpty() && progr == 0 )
     {
_______________________________________________
rekonq mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/rekonq

Reply via email to