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

List:       kde-commits
Subject:    [marble] src/lib: Proper repainting of webpopups triggered by changes in the webview
From:       Torsten Rahn <rahn () kde ! org>
Date:       2013-01-19 0:53:36
Message-ID: 20130119005336.EC0CEA60C8 () git ! kde ! org
[Download RAW message or body]

Git commit d2b0c48cb0bb9afccc6f5b078288fe4778165a40 by Torsten Rahn.
Committed on 19/01/2013 at 01:50.
Pushed by rahn into branch 'master'.

Proper repainting of webpopups triggered by changes in the webview

M  +5    -1    src/lib/MapInfoDialog.cpp
M  +6    -3    src/lib/PopupItem.cpp
M  +1    -1    src/lib/PopupItem.h

http://commits.kde.org/marble/d2b0c48cb0bb9afccc6f5b078288fe4778165a40

diff --git a/src/lib/MapInfoDialog.cpp b/src/lib/MapInfoDialog.cpp
index 164d6f3..5959b4e 100644
--- a/src/lib/MapInfoDialog.cpp
+++ b/src/lib/MapInfoDialog.cpp
@@ -25,7 +25,7 @@ MapInfoDialog::MapInfoDialog(QObject *parent) :
     QObject( parent ),
     m_popupItem( new PopupItem )
 {
-    connect( m_popupItem, SIGNAL(dirty()), this, SIGNAL(repaintNeeded()) );
+    connect( m_popupItem, SIGNAL(repaintNeeded()), this, SIGNAL(repaintNee=
ded()) );
     connect( m_popupItem, SIGNAL(hide()), this, SLOT(hidePopupItem()) );
 }
 =

@@ -71,9 +71,13 @@ void MapInfoDialog::setVisible( bool visible )
 {
     m_popupItem->setVisible( visible );
     if ( !visible ) {
+        disconnect( m_popupItem, SIGNAL(repaintNeeded()), this, SIGNAL(rep=
aintNeeded()) );
         m_popupItem->clearHistory();
         emit repaintNeeded();
     }
+    else {
+        connect( m_popupItem, SIGNAL(repaintNeeded()), this, SIGNAL(repain=
tNeeded()) );
+    }
 }
 =

 void MapInfoDialog::setCoordinates(const GeoDataCoordinates &coordinates ,=
 Qt::Alignment alignment)
diff --git a/src/lib/PopupItem.cpp b/src/lib/PopupItem.cpp
index 372fda8..e52e1b4 100644
--- a/src/lib/PopupItem.cpp
+++ b/src/lib/PopupItem.cpp
@@ -90,6 +90,9 @@ PopupItem::PopupItem( QObject* parent ) :
     connect( m_webView, SIGNAL(titleChanged(QString)), m_titleText, SLOT(s=
etText(QString)) );
     connect( m_webView, SIGNAL(urlChanged(QUrl)), this, SLOT(updateBackBut=
ton()) );
     connect( hideButton, SIGNAL(clicked()), this, SIGNAL(hide()) );
+
+    // Update the popupitem on changes while loading the webpage
+    connect(m_webView->page(), SIGNAL(repaintRequested(QRect)), this, SIGN=
AL(repaintNeeded()));
 }
 =

 PopupItem::~PopupItem()
@@ -121,7 +124,7 @@ void PopupItem::setUrl( const QUrl &url )
 	m_webView->page()->setPalette(palette);
 	m_webView->setAttribute(Qt::WA_OpaquePaintEvent, false);
 =

-        emit dirty();
+        emit repaintNeeded();
     }
 }
 =

@@ -278,7 +281,7 @@ bool PopupItem::eventFilter( QObject *object, QEvent *e=
 )
                                                     event->modifiers() );
             if ( QApplication::sendEvent( child, &shiftedEvent ) ) {
                 widget->setCursor( child->cursor() );
-                emit dirty();
+                emit repaintNeeded();
                 return true;
             }
         }
@@ -293,7 +296,7 @@ bool PopupItem::eventFilter( QObject *object, QEvent *e=
 )
                                                     event->modifiers() );
             if ( QApplication::sendEvent( child, &shiftedEvent ) ) {
                 widget->setCursor( child->cursor() );
-                emit dirty();
+                emit repaintNeeded();
                 return true;
             }
         }
diff --git a/src/lib/PopupItem.h b/src/lib/PopupItem.h
index 587aaca..ee551b8 100644
--- a/src/lib/PopupItem.h
+++ b/src/lib/PopupItem.h
@@ -160,7 +160,7 @@ protected:
     void paint( QPainter *painter );
 =

 Q_SIGNALS:
-    void dirty();
+    void repaintNeeded();
     void hide();
 =

 private:
[prev in list] [next in list] [prev in thread] [next in thread] 

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