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

Fix use of deprecated QStyleOptions

This commit is contained in:
David Rosca 2016-04-24 10:17:13 +02:00
parent b1ac8e3c31
commit f93ea0e199
11 changed files with 33 additions and 33 deletions

View File

@ -56,7 +56,7 @@ void FancyTabProxyStyle::drawControl(
QPainter* p, const QWidget* widget) const
{
const QStyleOptionTabV3* v_opt = qstyleoption_cast<const QStyleOptionTabV3*>(option);
const QStyleOptionTab* v_opt = qstyleoption_cast<const QStyleOptionTab*>(option);
if (element != CE_TabBarTab || !v_opt) {
QProxyStyle::drawControl(element, option, p, widget);

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2016 David Rosca <nowrep@gmail.com>
*
* 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()) {

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2016 David Rosca <nowrep@gmail.com>
*
* 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;

View File

@ -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;

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2016 David Rosca <nowrep@gmail.com>
*
* 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;

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2016 David Rosca <nowrep@gmail.com>
*
* 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;

View File

@ -1,7 +1,7 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2013-2014 S. Razi Alavizadeh <s.r.alavizadeh@gmail.com>
* Copyright (C) 2014-2016 David Rosca <nowrep@gmail.com>
* Copyright (C) 2013-2014 S. Razi Alavizadeh <s.r.alavizadeh@gmail.com>
* Copyright (C) 2014-2016 David Rosca <nowrep@gmail.com>
*
* 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);

View File

@ -1,7 +1,7 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2013-2014 S. Razi Alavizadeh <s.r.alavizadeh@gmail.com>
* Copyright (C) 2014 David Rosca <nowrep@gmail.com>
* Copyright (C) 2013-2014 S. Razi Alavizadeh <s.r.alavizadeh@gmail.com>
* Copyright (C) 2014-2016 David Rosca <nowrep@gmail.com>
*
* 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);

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2016 David Rosca <nowrep@gmail.com>
*
* 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;

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
* Copyright (C) 2010-2016 David Rosca <nowrep@gmail.com>
*
* 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);

View File

@ -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;