1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

[Windows] Fixed first moment black background of new tab.

This commit is contained in:
S. Razi Alavizadeh 2013-03-24 00:09:55 +04:30
parent dc659e2fa4
commit 334f90b12b
3 changed files with 27 additions and 5 deletions

View File

@ -836,8 +836,7 @@ void QupZilla::loadSettings()
m_usingTransparentBackground = true;
QtWin::enableBlurBehindWindow(m_tabWidget->getTabBar(), true);
applyBlurToMainWindow();
update();
QtWin::extendFrameIntoClientArea(this);
//install event filter
menuBar()->installEventFilter(this);
@ -909,6 +908,11 @@ void QupZilla::popupToolbarsMenu(const QPoint &pos)
aboutToHideViewMenu();
}
bool QupZilla::isTransparentBackgroundAllowed()
{
return m_usingTransparentBackground && !isFullScreen();
}
void QupZilla::setWindowTitle(const QString &t)
{
QString title = t;
@ -1561,7 +1565,6 @@ SideBar* QupZilla::addSideBar()
#ifdef Q_OS_WIN
if (QtWin::isCompositionEnabled()) {
applyBlurToMainWindow();
m_sideBar.data()->installEventFilter(this);
}
#endif
@ -1657,6 +1660,13 @@ void QupZilla::triggerTabsOnTop(bool enable)
Settings settings;
settings.setValue("Browser-Tabs-Settings/TabsOnTop", enable);
qzSettings->tabsOnTop = enable;
#ifdef Q_OS_WIN
// workaround for changing TabsOnTop state when sidebar is visible
// TODO: we need a solution that changing TabsOnTop state
// doesn't call applyBlurToMainWindow() from eventFilter()
QTimer::singleShot(0, this, SLOT(applyBlurToMainWindow()));
#endif
}
void QupZilla::refreshHistory()
@ -2459,11 +2469,11 @@ void QupZilla::paintEvent(QPaintEvent* event)
void QupZilla::applyBlurToMainWindow(bool force)
{
if (isClosing()) {
if (isClosing() || m_isStarting) {
return;
}
if (!force && (m_actionShowFullScreen->isChecked() || !m_usingTransparentBackground)) {
if (!force && !isTransparentBackgroundAllowed()) {
return;
}
int topMargin = 0;

View File

@ -111,6 +111,8 @@ public:
bool isClosing() { return m_isClosing; }
QUrl homepageUrl() { return m_homepage; }
bool isTransparentBackgroundAllowed();
signals:
void startingCompleted();
void message(Qz::AppMessageType mes, bool state);

View File

@ -31,7 +31,9 @@
#include "websearchbar.h"
#include "settings.h"
#include "qzsettings.h"
#include "qtwin.h"
#include <QTimer>
#include <QMovie>
#include <QMenu>
#include <QMimeData>
@ -282,6 +284,11 @@ int TabWidget::addView(const QUrl &url, const QString &title, const Qz::NewTabPo
int TabWidget::addView(QNetworkRequest req, const QString &title, const Qz::NewTabPositionFlags &openFlags, bool selectLine, int position)
{
#ifdef Q_OS_WIN
if (p_QupZilla->isTransparentBackgroundAllowed()) {
QtWin::extendFrameIntoClientArea(p_QupZilla);
}
#endif
QUrl url = req.url();
m_lastTabIndex = currentIndex();
@ -358,6 +365,9 @@ int TabWidget::addView(QNetworkRequest req, const QString &title, const Qz::NewT
}
}
#ifdef Q_OS_WIN
QTimer::singleShot(0, p_QupZilla, SLOT(applyBlurToMainWindow()));
#endif
return index;
}