1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

[Flicker] Fixed flicker when opening new tabs with sites that loads instantly

Eg. this happens for internal qupzilla: pages
Also early set locationbar's url to newly opened tab's url.
This commit is contained in:
nowrep 2014-02-12 13:50:06 +01:00
parent 96b5ec1c50
commit 7cefc22c0a
4 changed files with 26 additions and 0 deletions

View File

@ -29,6 +29,7 @@
#include "webpage.h" #include "webpage.h"
#include "qzsettings.h" #include "qzsettings.h"
#include <QTimer>
#include <QSplitter> #include <QSplitter>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QStackedWidget> #include <QStackedWidget>
@ -241,6 +242,12 @@ void NavigationBar::setLayoutSpacing(int spacing)
m_layout->setSpacing(spacing); m_layout->setSpacing(spacing);
} }
void NavigationBar::pauseUpdates()
{
setUpdatesEnabled(false);
QTimer::singleShot(100, this, SLOT(enableUpdates()));
}
void NavigationBar::aboutToShowHistoryBackMenu() void NavigationBar::aboutToShowHistoryBackMenu()
{ {
if (!m_menuBack || !p_QupZilla->weView()) { if (!m_menuBack || !p_QupZilla->weView()) {
@ -316,6 +323,11 @@ void NavigationBar::clearHistory()
refreshHistory(); refreshHistory();
} }
void NavigationBar::enableUpdates()
{
setUpdatesEnabled(true);
}
void NavigationBar::contextMenuRequested(const QPoint &pos) void NavigationBar::contextMenuRequested(const QPoint &pos)
{ {
p_QupZilla->popupToolbarsMenu(mapToGlobal(pos)); p_QupZilla->popupToolbarsMenu(mapToGlobal(pos));

View File

@ -63,6 +63,9 @@ public:
int layoutSpacing() const; int layoutSpacing() const;
void setLayoutSpacing(int spacing); void setLayoutSpacing(int spacing);
// Pause updates for 100 msecs
void pauseUpdates();
signals: signals:
public slots: public slots:
@ -81,6 +84,7 @@ private slots:
void goAtHistoryIndexInNewTab(int index = -1); void goAtHistoryIndexInNewTab(int index = -1);
void clearHistory(); void clearHistory();
void enableUpdates();
void contextMenuRequested(const QPoint &pos); void contextMenuRequested(const QPoint &pos);

View File

@ -308,6 +308,7 @@ void ComboTabBar::closeTabFromButton()
void ComboTabBar::enableUpdates() void ComboTabBar::enableUpdates()
{ {
setUpdatesEnabled(true); setUpdatesEnabled(true);
updateTabBars();
} }
void ComboTabBar::updateTabBars() void ComboTabBar::updateTabBars()

View File

@ -324,6 +324,12 @@ int TabWidget::addView(QNetworkRequest req, const QString &title, const Qz::NewT
QtWin::extendFrameIntoClientArea(p_QupZilla); QtWin::extendFrameIntoClientArea(p_QupZilla);
} }
#endif #endif
// Pause updates, so pages that loads instantly (eg. qupzilla: internal pages) don't cause
// flickering in navigationbar (load button and locationbar)
// Also disable updates of tabwidget, so background of webview doesn't flashes
p_QupZilla->navigationBar()->pauseUpdates();
setUpdatesEnabled(false);
QUrl url = req.url(); QUrl url = req.url();
m_lastTabIndex = currentIndex(); m_lastTabIndex = currentIndex();
@ -361,6 +367,7 @@ int TabWidget::addView(QNetworkRequest req, const QString &title, const Qz::NewT
TabbedWebView* webView = weTab(index)->view(); TabbedWebView* webView = weTab(index)->view();
locBar->setWebView(webView); locBar->setWebView(webView);
locBar->showUrl(url);
setTabText(index, title); setTabText(index, title);
setTabIcon(index, qIconProvider->emptyWebIcon()); setTabIcon(index, qIconProvider->emptyWebIcon());
@ -400,6 +407,8 @@ int TabWidget::addView(QNetworkRequest req, const QString &title, const Qz::NewT
} }
} }
setUpdatesEnabled(true);
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
QTimer::singleShot(0, p_QupZilla, SLOT(applyBlurToMainWindow())); QTimer::singleShot(0, p_QupZilla, SLOT(applyBlurToMainWindow()));
#endif #endif