From 56399c0fabe4efc8fb617335ee1b71d40c703c6a Mon Sep 17 00:00:00 2001 From: David Rosca Date: Sun, 24 Apr 2016 10:17:13 +0200 Subject: [PATCH] Fix use of deprecated QStyleOptions --- src/lib/3rdparty/fancytabwidget.cpp | 2 +- .../completer/locationcompleterdelegate.cpp | 8 ++++---- .../completer/locationcompleterdelegate.h | 4 ++-- src/lib/navigation/locationbar.cpp | 2 +- src/lib/other/iconchooser.cpp | 4 ++-- src/lib/preferences/pluginlistdelegate.cpp | 8 ++++---- src/lib/tabwidget/combotabbar.cpp | 16 ++++++++-------- src/lib/tabwidget/combotabbar.h | 6 +++--- src/lib/tools/listitemdelegate.cpp | 6 +++--- src/lib/tools/progressbar.cpp | 4 ++-- .../settings/gm_settingslistdelegate.cpp | 6 +++--- 11 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/lib/3rdparty/fancytabwidget.cpp b/src/lib/3rdparty/fancytabwidget.cpp index ecc965516..ee2ebbe27 100644 --- a/src/lib/3rdparty/fancytabwidget.cpp +++ b/src/lib/3rdparty/fancytabwidget.cpp @@ -56,7 +56,7 @@ void FancyTabProxyStyle::drawControl( QPainter* p, const QWidget* widget) const { - const QStyleOptionTabV3* v_opt = qstyleoption_cast(option); + const QStyleOptionTab* v_opt = qstyleoption_cast(option); if (element != CE_TabBarTab || !v_opt) { QProxyStyle::drawControl(element, option, p, widget); diff --git a/src/lib/navigation/completer/locationcompleterdelegate.cpp b/src/lib/navigation/completer/locationcompleterdelegate.cpp index 4ef9126b3..d66d15e01 100644 --- a/src/lib/navigation/completer/locationcompleterdelegate.cpp +++ b/src/lib/navigation/completer/locationcompleterdelegate.cpp @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2014 David Rosca +* Copyright (C) 2010-2016 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,7 +39,7 @@ LocationCompleterDelegate::LocationCompleterDelegate(LocationCompleterView* pare void LocationCompleterDelegate::paint(QPainter* painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { - QStyleOptionViewItemV4 opt = option; + QStyleOptionViewItem opt = option; initStyleOption(&opt, index); const QWidget* w = opt.widget; @@ -156,7 +156,7 @@ QSize LocationCompleterDelegate::sizeHint(const QStyleOptionViewItem &option, co Q_UNUSED(index) if (!m_rowHeight) { - QStyleOptionViewItemV4 opt(option); + QStyleOptionViewItem opt(option); initStyleOption(&opt, index); const QWidget* w = opt.widget; @@ -211,7 +211,7 @@ static QSizeF viewItemTextLayout(QTextLayout &textLayout, int lineWidth) // most of codes taken from QCommonStylePrivate::viewItemDrawText() // added highlighting and simplified for single-line textlayouts -void LocationCompleterDelegate::viewItemDrawText(QPainter *p, const QStyleOptionViewItemV4 *option, const QRect &rect, +void LocationCompleterDelegate::viewItemDrawText(QPainter *p, const QStyleOptionViewItem *option, const QRect &rect, const QString &text, const QPalette::ColorRole &role, const QString &searchText) const { if (text.isEmpty()) { diff --git a/src/lib/navigation/completer/locationcompleterdelegate.h b/src/lib/navigation/completer/locationcompleterdelegate.h index ea97215f7..448e80f5b 100644 --- a/src/lib/navigation/completer/locationcompleterdelegate.h +++ b/src/lib/navigation/completer/locationcompleterdelegate.h @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2014 David Rosca +* Copyright (C) 2010-2016 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -37,7 +37,7 @@ public: private: bool drawSwitchToTab() const; - void viewItemDrawText(QPainter *p, const QStyleOptionViewItemV4 *option, const QRect &rect, + void viewItemDrawText(QPainter *p, const QStyleOptionViewItem *option, const QRect &rect, const QString &text, const QPalette::ColorRole &role, const QString &searchText = QString()) const; diff --git a/src/lib/navigation/locationbar.cpp b/src/lib/navigation/locationbar.cpp index 1158e5bde..f76a394a2 100644 --- a/src/lib/navigation/locationbar.cpp +++ b/src/lib/navigation/locationbar.cpp @@ -589,7 +589,7 @@ void LocationBar::paintEvent(QPaintEvent* event) // Show loading progress if (qzSettings->showLoadingProgress && m_progressVisible) { - QStyleOptionFrameV3 option; + QStyleOptionFrame option; initStyleOption(&option); int lm, tm, rm, bm; diff --git a/src/lib/other/iconchooser.cpp b/src/lib/other/iconchooser.cpp index 977feb1f0..3682c8d5a 100644 --- a/src/lib/other/iconchooser.cpp +++ b/src/lib/other/iconchooser.cpp @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2014 David Rosca +* Copyright (C) 2010-2016 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -111,7 +111,7 @@ IconChooserDelegate::IconChooserDelegate(QWidget* parent) void IconChooserDelegate::paint(QPainter* painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { - QStyleOptionViewItemV4 opt = option; + QStyleOptionViewItem opt = option; initStyleOption(&opt, index); const QWidget* w = opt.widget; diff --git a/src/lib/preferences/pluginlistdelegate.cpp b/src/lib/preferences/pluginlistdelegate.cpp index 9e961a786..86d395ab0 100644 --- a/src/lib/preferences/pluginlistdelegate.cpp +++ b/src/lib/preferences/pluginlistdelegate.cpp @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2014 David Rosca +* Copyright (C) 2010-2016 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,7 +30,7 @@ PluginListDelegate::PluginListDelegate(QListWidget* parent) void PluginListDelegate::paint(QPainter* painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { - QStyleOptionViewItemV4 opt = option; + QStyleOptionViewItem opt = option; initStyleOption(&opt, index); const QWidget* w = opt.widget; @@ -61,7 +61,7 @@ void PluginListDelegate::paint(QPainter* painter, const QStyleOptionViewItem &op // Draw checkbox const int checkboxSize = 18; const int checkboxYPos = center - (checkboxSize / 2); - QStyleOptionViewItemV4 opt2 = opt; + QStyleOptionViewItem opt2 = opt; opt2.checkState == Qt::Checked ? opt2.state |= QStyle::State_On : opt2.state |= QStyle::State_Off; QRect styleCheckBoxRect = style->subElementRect(QStyle::SE_ViewItemCheckIndicator, &opt2, w); opt2.rect = QRect(leftPosition, checkboxYPos, styleCheckBoxRect.width(), styleCheckBoxRect.height()); @@ -112,7 +112,7 @@ QSize PluginListDelegate::sizeHint(const QStyleOptionViewItem &option, const QMo Q_UNUSED(index) if (!m_rowHeight) { - QStyleOptionViewItemV4 opt(option); + QStyleOptionViewItem opt(option); initStyleOption(&opt, index); const QWidget* w = opt.widget; diff --git a/src/lib/tabwidget/combotabbar.cpp b/src/lib/tabwidget/combotabbar.cpp index d8a823f4d..aa638daad 100644 --- a/src/lib/tabwidget/combotabbar.cpp +++ b/src/lib/tabwidget/combotabbar.cpp @@ -1,7 +1,7 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2013-2014 S. Razi Alavizadeh -* Copyright (C) 2014-2016 David Rosca +* Copyright (C) 2013-2014 S. Razi Alavizadeh +* Copyright (C) 2014-2016 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -670,7 +670,7 @@ void ComboTabBar::paintEvent(QPaintEvent* ev) #ifndef Q_OS_MAC // Draw tabbar base even on parts of ComboTabBar that are not directly QTabBar - QStyleOptionTabBarBaseV2 opt; + QStyleOptionTabBarBase opt; TabBarHelper::initStyleBaseOption(&opt, m_mainTabBar, size()); // Left container @@ -1061,7 +1061,7 @@ bool TabBarHelper::event(QEvent* ev) } // Taken from qtabbar.cpp -void TabBarHelper::initStyleBaseOption(QStyleOptionTabBarBaseV2* optTabBase, QTabBar* tabbar, QSize size) +void TabBarHelper::initStyleBaseOption(QStyleOptionTabBarBase *optTabBase, QTabBar* tabbar, QSize size) { QStyleOptionTab tabOverlap; tabOverlap.shape = tabbar->shape(); @@ -1103,7 +1103,7 @@ void TabBarHelper::paintEvent(QPaintEvent* event) return; } - QStyleOptionTabBarBaseV2 optTabBase; + QStyleOptionTabBarBase optTabBase; initStyleBaseOption(&optTabBase, this, size()); QStylePainter p(this); @@ -1123,7 +1123,7 @@ void TabBarHelper::paintEvent(QPaintEvent* event) int indexUnderMouse = isDisplayedOnViewPort(cursorPos.x(), cursorPos.x()) ? tabAt(mapFromGlobal(cursorPos)) : -1; for (int i = 0; i < count(); ++i) { - QStyleOptionTabV3 tab; + QStyleOptionTab tab; initStyleOption(&tab, i); if (i == selected) { @@ -1152,7 +1152,7 @@ void TabBarHelper::paintEvent(QPaintEvent* event) // Draw the selected tab last to get it "on top" if (selected >= 0) { - QStyleOptionTabV3 tab; + QStyleOptionTab tab; initStyleOption(&tab, selected); // Update mouseover state when scrolling @@ -1167,7 +1167,7 @@ void TabBarHelper::paintEvent(QPaintEvent* event) // If this is inactive tab, we still need to draw selected tab outside the tabbar // Some themes (eg. Oxygen) draws line under tabs with selected tab // Let's just move it outside rect(), it appears to work - QStyleOptionTabV3 tb = tab; + QStyleOptionTab tb = tab; tb.rect.moveRight((rect().x() + rect().width()) * 2); p.drawControl(QStyle::CE_TabBarTab, tb); diff --git a/src/lib/tabwidget/combotabbar.h b/src/lib/tabwidget/combotabbar.h index bfbca9429..67ff3cce1 100644 --- a/src/lib/tabwidget/combotabbar.h +++ b/src/lib/tabwidget/combotabbar.h @@ -1,7 +1,7 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2013-2014 S. Razi Alavizadeh -* Copyright (C) 2014 David Rosca +* Copyright (C) 2013-2014 S. Razi Alavizadeh +* Copyright (C) 2014-2016 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -230,7 +230,7 @@ public: bool isDisplayedOnViewPort(int globalLeft, int globalRight); bool isDragInProgress() const; - static void initStyleBaseOption(QStyleOptionTabBarBaseV2* optTabBase, QTabBar* tabbar, QSize size); + static void initStyleBaseOption(QStyleOptionTabBarBase* optTabBase, QTabBar* tabbar, QSize size); public slots: void setCurrentIndex(int index); diff --git a/src/lib/tools/listitemdelegate.cpp b/src/lib/tools/listitemdelegate.cpp index 2cafe7506..bc429de1a 100644 --- a/src/lib/tools/listitemdelegate.cpp +++ b/src/lib/tools/listitemdelegate.cpp @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2014 David Rosca +* Copyright (C) 2010-2016 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -50,7 +50,7 @@ int ListItemDelegate::itemHeight() const void ListItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { - QStyleOptionViewItemV4 opt = option; + QStyleOptionViewItem opt = option; initStyleOption(&opt, index); const QWidget* w = opt.widget; @@ -92,7 +92,7 @@ void ListItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem &opti QSize ListItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const { if (!m_itemHeight) { - QStyleOptionViewItemV4 opt(option); + QStyleOptionViewItem opt(option); initStyleOption(&opt, index); const QWidget* w = opt.widget; diff --git a/src/lib/tools/progressbar.cpp b/src/lib/tools/progressbar.cpp index 5aa490970..dc04ea702 100644 --- a/src/lib/tools/progressbar.cpp +++ b/src/lib/tools/progressbar.cpp @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2014 David Rosca +* Copyright (C) 2010-2016 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -55,7 +55,7 @@ void ProgressBar::paintEvent(QPaintEvent*) { QStylePainter paint(this); - QStyleOptionProgressBarV2 opt; + QStyleOptionProgressBar opt; initStyleOption(&opt); paint.drawControl(QStyle::CE_ProgressBar, opt); diff --git a/src/plugins/GreaseMonkey/settings/gm_settingslistdelegate.cpp b/src/plugins/GreaseMonkey/settings/gm_settingslistdelegate.cpp index ba436a354..1ebede1f1 100644 --- a/src/plugins/GreaseMonkey/settings/gm_settingslistdelegate.cpp +++ b/src/plugins/GreaseMonkey/settings/gm_settingslistdelegate.cpp @@ -44,7 +44,7 @@ void GM_SettingsListDelegate::paint(QPainter* painter, const QStyleOptionViewIte if (!script) return; - QStyleOptionViewItemV4 opt = option; + QStyleOptionViewItem opt = option; initStyleOption(&opt, index); const QWidget* w = opt.widget; @@ -78,7 +78,7 @@ void GM_SettingsListDelegate::paint(QPainter* painter, const QStyleOptionViewIte // Draw checkbox const int checkboxSize = 18; const int checkboxYPos = center - (checkboxSize / 2); - QStyleOptionViewItemV4 opt2 = opt; + QStyleOptionViewItem opt2 = opt; opt2.checkState == Qt::Checked ? opt2.state |= QStyle::State_On : opt2.state |= QStyle::State_Off; QRect styleCheckBoxRect = style->subElementRect(QStyle::SE_ViewItemCheckIndicator, &opt2, w); opt2.rect = QRect(leftPosition, checkboxYPos, styleCheckBoxRect.width(), styleCheckBoxRect.height()); @@ -138,7 +138,7 @@ QSize GM_SettingsListDelegate::sizeHint(const QStyleOptionViewItem &option, cons Q_UNUSED(index) if (!m_rowHeight) { - QStyleOptionViewItemV4 opt(option); + QStyleOptionViewItem opt(option); initStyleOption(&opt, index); const QWidget* w = opt.widget;