From aebdde89e26a06b73e3c402cb86cbced9772593e Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 3 Jun 2010 16:25:08 +0200 Subject: Cleaning TabBar::showPreview code --- src/tabbar.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/tabbar.cpp') diff --git a/src/tabbar.cpp b/src/tabbar.cpp index 5d6b7b2c..8df8560f 100644 --- a/src/tabbar.cpp +++ b/src/tabbar.cpp @@ -148,6 +148,10 @@ void TabBar::detachTab() void TabBar::showTabPreview(int tab) { + //delete previous tab preview + delete m_previewPopup.data(); + m_previewPopup.clear(); + MainView *mv = qobject_cast(parent()); WebTab *indexedTab = mv->webTab(tab); @@ -157,15 +161,12 @@ void TabBar::showTabPreview(int tab) if (!currentTab || !indexedTab) return; - int w = tabSizeHint(tab).width(); - int h = w * ((0.0 + currentTab->height()) / currentTab->width()); - - //delete previous tab preview - delete m_previewPopup.data(); - m_previewPopup.clear(); - + // no previews during load if (indexedTab->progress() != 0) return; + + int w = tabSizeHint(tab).width(); + int h = w * ((0.0 + currentTab->height()) / currentTab->width()); m_previewPopup = new KPassivePopup(this); m_previewPopup.data()->setFrameShape(QFrame::StyledPanel); -- cgit v1.2.1