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

Fix use of deprecated QStyleOptions

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

View File

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

View File

@ -1,6 +1,6 @@
/* ============================================================ /* ============================================================
* QupZilla - WebKit based browser * 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 * 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 * 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 void LocationCompleterDelegate::paint(QPainter* painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{ {
QStyleOptionViewItemV4 opt = option; QStyleOptionViewItem opt = option;
initStyleOption(&opt, index); initStyleOption(&opt, index);
const QWidget* w = opt.widget; const QWidget* w = opt.widget;
@ -156,7 +156,7 @@ QSize LocationCompleterDelegate::sizeHint(const QStyleOptionViewItem &option, co
Q_UNUSED(index) Q_UNUSED(index)
if (!m_rowHeight) { if (!m_rowHeight) {
QStyleOptionViewItemV4 opt(option); QStyleOptionViewItem opt(option);
initStyleOption(&opt, index); initStyleOption(&opt, index);
const QWidget* w = opt.widget; const QWidget* w = opt.widget;
@ -211,7 +211,7 @@ static QSizeF viewItemTextLayout(QTextLayout &textLayout, int lineWidth)
// most of codes taken from QCommonStylePrivate::viewItemDrawText() // most of codes taken from QCommonStylePrivate::viewItemDrawText()
// added highlighting and simplified for single-line textlayouts // 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 const QString &text, const QPalette::ColorRole &role, const QString &searchText) const
{ {
if (text.isEmpty()) { if (text.isEmpty()) {

View File

@ -1,6 +1,6 @@
/* ============================================================ /* ============================================================
* QupZilla - WebKit based browser * 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 * 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 * it under the terms of the GNU General Public License as published by
@ -37,7 +37,7 @@ public:
private: private:
bool drawSwitchToTab() const; 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 &text, const QPalette::ColorRole &role,
const QString &searchText = QString()) const; const QString &searchText = QString()) const;

View File

@ -589,7 +589,7 @@ void LocationBar::paintEvent(QPaintEvent* event)
// Show loading progress // Show loading progress
if (qzSettings->showLoadingProgress && m_progressVisible) { if (qzSettings->showLoadingProgress && m_progressVisible) {
QStyleOptionFrameV3 option; QStyleOptionFrame option;
initStyleOption(&option); initStyleOption(&option);
int lm, tm, rm, bm; int lm, tm, rm, bm;

View File

@ -1,6 +1,6 @@
/* ============================================================ /* ============================================================
* QupZilla - WebKit based browser * 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 * 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 * 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 void IconChooserDelegate::paint(QPainter* painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{ {
QStyleOptionViewItemV4 opt = option; QStyleOptionViewItem opt = option;
initStyleOption(&opt, index); initStyleOption(&opt, index);
const QWidget* w = opt.widget; const QWidget* w = opt.widget;

View File

@ -1,6 +1,6 @@
/* ============================================================ /* ============================================================
* QupZilla - WebKit based browser * 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 * 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 * 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 void PluginListDelegate::paint(QPainter* painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{ {
QStyleOptionViewItemV4 opt = option; QStyleOptionViewItem opt = option;
initStyleOption(&opt, index); initStyleOption(&opt, index);
const QWidget* w = opt.widget; const QWidget* w = opt.widget;
@ -61,7 +61,7 @@ void PluginListDelegate::paint(QPainter* painter, const QStyleOptionViewItem &op
// Draw checkbox // Draw checkbox
const int checkboxSize = 18; const int checkboxSize = 18;
const int checkboxYPos = center - (checkboxSize / 2); 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; opt2.checkState == Qt::Checked ? opt2.state |= QStyle::State_On : opt2.state |= QStyle::State_Off;
QRect styleCheckBoxRect = style->subElementRect(QStyle::SE_ViewItemCheckIndicator, &opt2, w); QRect styleCheckBoxRect = style->subElementRect(QStyle::SE_ViewItemCheckIndicator, &opt2, w);
opt2.rect = QRect(leftPosition, checkboxYPos, styleCheckBoxRect.width(), styleCheckBoxRect.height()); opt2.rect = QRect(leftPosition, checkboxYPos, styleCheckBoxRect.width(), styleCheckBoxRect.height());
@ -112,7 +112,7 @@ QSize PluginListDelegate::sizeHint(const QStyleOptionViewItem &option, const QMo
Q_UNUSED(index) Q_UNUSED(index)
if (!m_rowHeight) { if (!m_rowHeight) {
QStyleOptionViewItemV4 opt(option); QStyleOptionViewItem opt(option);
initStyleOption(&opt, index); initStyleOption(&opt, index);
const QWidget* w = opt.widget; const QWidget* w = opt.widget;

View File

@ -670,7 +670,7 @@ void ComboTabBar::paintEvent(QPaintEvent* ev)
#ifndef Q_OS_MAC #ifndef Q_OS_MAC
// Draw tabbar base even on parts of ComboTabBar that are not directly QTabBar // Draw tabbar base even on parts of ComboTabBar that are not directly QTabBar
QStyleOptionTabBarBaseV2 opt; QStyleOptionTabBarBase opt;
TabBarHelper::initStyleBaseOption(&opt, m_mainTabBar, size()); TabBarHelper::initStyleBaseOption(&opt, m_mainTabBar, size());
// Left container // Left container
@ -1061,7 +1061,7 @@ bool TabBarHelper::event(QEvent* ev)
} }
// Taken from qtabbar.cpp // Taken from qtabbar.cpp
void TabBarHelper::initStyleBaseOption(QStyleOptionTabBarBaseV2* optTabBase, QTabBar* tabbar, QSize size) void TabBarHelper::initStyleBaseOption(QStyleOptionTabBarBase *optTabBase, QTabBar* tabbar, QSize size)
{ {
QStyleOptionTab tabOverlap; QStyleOptionTab tabOverlap;
tabOverlap.shape = tabbar->shape(); tabOverlap.shape = tabbar->shape();
@ -1103,7 +1103,7 @@ void TabBarHelper::paintEvent(QPaintEvent* event)
return; return;
} }
QStyleOptionTabBarBaseV2 optTabBase; QStyleOptionTabBarBase optTabBase;
initStyleBaseOption(&optTabBase, this, size()); initStyleBaseOption(&optTabBase, this, size());
QStylePainter p(this); QStylePainter p(this);
@ -1123,7 +1123,7 @@ void TabBarHelper::paintEvent(QPaintEvent* event)
int indexUnderMouse = isDisplayedOnViewPort(cursorPos.x(), cursorPos.x()) ? tabAt(mapFromGlobal(cursorPos)) : -1; int indexUnderMouse = isDisplayedOnViewPort(cursorPos.x(), cursorPos.x()) ? tabAt(mapFromGlobal(cursorPos)) : -1;
for (int i = 0; i < count(); ++i) { for (int i = 0; i < count(); ++i) {
QStyleOptionTabV3 tab; QStyleOptionTab tab;
initStyleOption(&tab, i); initStyleOption(&tab, i);
if (i == selected) { if (i == selected) {
@ -1152,7 +1152,7 @@ void TabBarHelper::paintEvent(QPaintEvent* event)
// Draw the selected tab last to get it "on top" // Draw the selected tab last to get it "on top"
if (selected >= 0) { if (selected >= 0) {
QStyleOptionTabV3 tab; QStyleOptionTab tab;
initStyleOption(&tab, selected); initStyleOption(&tab, selected);
// Update mouseover state when scrolling // 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 // 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 // Some themes (eg. Oxygen) draws line under tabs with selected tab
// Let's just move it outside rect(), it appears to work // 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); tb.rect.moveRight((rect().x() + rect().width()) * 2);
p.drawControl(QStyle::CE_TabBarTab, tb); p.drawControl(QStyle::CE_TabBarTab, tb);

View File

@ -1,7 +1,7 @@
/* ============================================================ /* ============================================================
* QupZilla - WebKit based browser * QupZilla - WebKit based browser
* Copyright (C) 2013-2014 S. Razi Alavizadeh <s.r.alavizadeh@gmail.com> * Copyright (C) 2013-2014 S. Razi Alavizadeh <s.r.alavizadeh@gmail.com>
* Copyright (C) 2014 David Rosca <nowrep@gmail.com> * Copyright (C) 2014-2016 David Rosca <nowrep@gmail.com>
* *
* This program is free software: you can redistribute it and/or modify * 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 * 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 isDisplayedOnViewPort(int globalLeft, int globalRight);
bool isDragInProgress() const; bool isDragInProgress() const;
static void initStyleBaseOption(QStyleOptionTabBarBaseV2* optTabBase, QTabBar* tabbar, QSize size); static void initStyleBaseOption(QStyleOptionTabBarBase* optTabBase, QTabBar* tabbar, QSize size);
public slots: public slots:
void setCurrentIndex(int index); void setCurrentIndex(int index);

View File

@ -1,6 +1,6 @@
/* ============================================================ /* ============================================================
* QupZilla - WebKit based browser * 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 * 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 * 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 void ListItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{ {
QStyleOptionViewItemV4 opt = option; QStyleOptionViewItem opt = option;
initStyleOption(&opt, index); initStyleOption(&opt, index);
const QWidget* w = opt.widget; 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 QSize ListItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{ {
if (!m_itemHeight) { if (!m_itemHeight) {
QStyleOptionViewItemV4 opt(option); QStyleOptionViewItem opt(option);
initStyleOption(&opt, index); initStyleOption(&opt, index);
const QWidget* w = opt.widget; const QWidget* w = opt.widget;

View File

@ -1,6 +1,6 @@
/* ============================================================ /* ============================================================
* QupZilla - WebKit based browser * 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 * 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 * it under the terms of the GNU General Public License as published by
@ -55,7 +55,7 @@ void ProgressBar::paintEvent(QPaintEvent*)
{ {
QStylePainter paint(this); QStylePainter paint(this);
QStyleOptionProgressBarV2 opt; QStyleOptionProgressBar opt;
initStyleOption(&opt); initStyleOption(&opt);
paint.drawControl(QStyle::CE_ProgressBar, opt); paint.drawControl(QStyle::CE_ProgressBar, opt);

View File

@ -44,7 +44,7 @@ void GM_SettingsListDelegate::paint(QPainter* painter, const QStyleOptionViewIte
if (!script) if (!script)
return; return;
QStyleOptionViewItemV4 opt = option; QStyleOptionViewItem opt = option;
initStyleOption(&opt, index); initStyleOption(&opt, index);
const QWidget* w = opt.widget; const QWidget* w = opt.widget;
@ -78,7 +78,7 @@ void GM_SettingsListDelegate::paint(QPainter* painter, const QStyleOptionViewIte
// Draw checkbox // Draw checkbox
const int checkboxSize = 18; const int checkboxSize = 18;
const int checkboxYPos = center - (checkboxSize / 2); 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; opt2.checkState == Qt::Checked ? opt2.state |= QStyle::State_On : opt2.state |= QStyle::State_Off;
QRect styleCheckBoxRect = style->subElementRect(QStyle::SE_ViewItemCheckIndicator, &opt2, w); QRect styleCheckBoxRect = style->subElementRect(QStyle::SE_ViewItemCheckIndicator, &opt2, w);
opt2.rect = QRect(leftPosition, checkboxYPos, styleCheckBoxRect.width(), styleCheckBoxRect.height()); opt2.rect = QRect(leftPosition, checkboxYPos, styleCheckBoxRect.width(), styleCheckBoxRect.height());
@ -138,7 +138,7 @@ QSize GM_SettingsListDelegate::sizeHint(const QStyleOptionViewItem &option, cons
Q_UNUSED(index) Q_UNUSED(index)
if (!m_rowHeight) { if (!m_rowHeight) {
QStyleOptionViewItemV4 opt(option); QStyleOptionViewItem opt(option);
initStyleOption(&opt, index); initStyleOption(&opt, index);
const QWidget* w = opt.widget; const QWidget* w = opt.widget;