mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-23 21:14:33 +00:00
Replace deprecated classes
This commit is contained in:
parent
ab187f06da
commit
ce3c53b3c4
@ -32,8 +32,8 @@
|
|||||||
#define PREVIEWLISTDELEGATE_H
|
#define PREVIEWLISTDELEGATE_H
|
||||||
|
|
||||||
#include <QItemDelegate>
|
#include <QItemDelegate>
|
||||||
#include <QStyleOptionProgressBarV2>
|
#include <QStyleOptionProgressBar>
|
||||||
#include <QStyleOptionViewItemV2>
|
#include <QStyleOptionViewItem>
|
||||||
#include <QModelIndex>
|
#include <QModelIndex>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@ -59,7 +59,7 @@ class PreviewListDelegate: public QItemDelegate {
|
|||||||
|
|
||||||
void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const {
|
void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const {
|
||||||
painter->save();
|
painter->save();
|
||||||
QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option);
|
QStyleOptionViewItem opt = QItemDelegate::setOptions(index, option);
|
||||||
|
|
||||||
switch(index.column()) {
|
switch(index.column()) {
|
||||||
case PreviewSelect::SIZE:
|
case PreviewSelect::SIZE:
|
||||||
@ -67,7 +67,7 @@ class PreviewListDelegate: public QItemDelegate {
|
|||||||
QItemDelegate::drawDisplay(painter, opt, option.rect, Utils::Misc::friendlyUnit(index.data().toLongLong()));
|
QItemDelegate::drawDisplay(painter, opt, option.rect, Utils::Misc::friendlyUnit(index.data().toLongLong()));
|
||||||
break;
|
break;
|
||||||
case PreviewSelect::PROGRESS:{
|
case PreviewSelect::PROGRESS:{
|
||||||
QStyleOptionProgressBarV2 newopt;
|
QStyleOptionProgressBar newopt;
|
||||||
qreal progress = index.data().toDouble()*100.;
|
qreal progress = index.data().toDouble()*100.;
|
||||||
newopt.rect = opt.rect;
|
newopt.rect = opt.rect;
|
||||||
newopt.text = ((progress == 100.0) ? QString("100%") : Utils::String::fromDouble(progress, 1) + "%");
|
newopt.text = ((progress == 100.0) ? QString("100%") : Utils::String::fromDouble(progress, 1) + "%");
|
||||||
|
@ -50,7 +50,7 @@ public:
|
|||||||
|
|
||||||
void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const {
|
void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const {
|
||||||
painter->save();
|
painter->save();
|
||||||
QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option);
|
QStyleOptionViewItem opt = QItemDelegate::setOptions(index, option);
|
||||||
switch(index.column()) {
|
switch(index.column()) {
|
||||||
case TOT_DOWN:
|
case TOT_DOWN:
|
||||||
case TOT_UP:
|
case TOT_UP:
|
||||||
|
@ -28,8 +28,8 @@
|
|||||||
* Contact : chris@qbittorrent.org
|
* Contact : chris@qbittorrent.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QStyleOptionProgressBarV2>
|
#include <QStyleOptionProgressBar>
|
||||||
#include <QStyleOptionViewItemV2>
|
#include <QStyleOptionViewItem>
|
||||||
#include <QStyleOptionComboBox>
|
#include <QStyleOptionComboBox>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QModelIndex>
|
#include <QModelIndex>
|
||||||
@ -60,7 +60,7 @@ PropListDelegate::PropListDelegate(PropertiesWidget *properties, QObject *parent
|
|||||||
void PropListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
void PropListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
painter->save();
|
painter->save();
|
||||||
QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option);
|
QStyleOptionViewItem opt = QItemDelegate::setOptions(index, option);
|
||||||
|
|
||||||
switch(index.column()) {
|
switch(index.column()) {
|
||||||
case PCSIZE:
|
case PCSIZE:
|
||||||
@ -78,7 +78,7 @@ void PropListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
|
|||||||
break;
|
break;
|
||||||
case PROGRESS:
|
case PROGRESS:
|
||||||
if (index.data().toDouble() >= 0) {
|
if (index.data().toDouble() >= 0) {
|
||||||
QStyleOptionProgressBarV2 newopt;
|
QStyleOptionProgressBar newopt;
|
||||||
qreal progress = index.data().toDouble() * 100.;
|
qreal progress = index.data().toDouble() * 100.;
|
||||||
newopt.rect = opt.rect;
|
newopt.rect = opt.rect;
|
||||||
newopt.text = ((progress == 100.0) ? QString("100%") : Utils::String::fromDouble(progress, 1) + "%");
|
newopt.text = ((progress == 100.0) ? QString("100%") : Utils::String::fromDouble(progress, 1) + "%");
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
* Contact : chris@qbittorrent.org
|
* Contact : chris@qbittorrent.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QStyleOptionViewItemV2>
|
#include <QStyleOptionViewItem>
|
||||||
#include <QModelIndex>
|
#include <QModelIndex>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QProgressBar>
|
#include <QProgressBar>
|
||||||
@ -46,7 +46,7 @@ void SearchListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op
|
|||||||
{
|
{
|
||||||
painter->save();
|
painter->save();
|
||||||
|
|
||||||
QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option);
|
QStyleOptionViewItem opt = QItemDelegate::setOptions(index, option);
|
||||||
switch(index.column()) {
|
switch(index.column()) {
|
||||||
case SearchSortModel::SIZE:
|
case SearchSortModel::SIZE:
|
||||||
QItemDelegate::drawBackground(painter, opt, index);
|
QItemDelegate::drawBackground(painter, opt, index);
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
#include "transferlistdelegate.h"
|
#include "transferlistdelegate.h"
|
||||||
|
|
||||||
#include <QModelIndex>
|
#include <QModelIndex>
|
||||||
#include <QStyleOptionViewItemV2>
|
#include <QStyleOptionViewItem>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include "base/utils/misc.h"
|
#include "base/utils/misc.h"
|
||||||
@ -67,7 +67,7 @@ void TransferListDelegate::paint(QPainter * painter, const QStyleOptionViewItem
|
|||||||
}
|
}
|
||||||
const bool hideValues = Preferences::instance()->getHideZeroValues() & isHideState;
|
const bool hideValues = Preferences::instance()->getHideZeroValues() & isHideState;
|
||||||
|
|
||||||
QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option);
|
QStyleOptionViewItem opt = QItemDelegate::setOptions(index, option);
|
||||||
QItemDelegate::drawBackground(painter, opt, index);
|
QItemDelegate::drawBackground(painter, opt, index);
|
||||||
switch (index.column()) {
|
switch (index.column()) {
|
||||||
case TorrentModel::TR_AMOUNT_DOWNLOADED:
|
case TorrentModel::TR_AMOUNT_DOWNLOADED:
|
||||||
@ -162,7 +162,7 @@ void TransferListDelegate::paint(QPainter * painter, const QStyleOptionViewItem
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TorrentModel::TR_PROGRESS: {
|
case TorrentModel::TR_PROGRESS: {
|
||||||
QStyleOptionProgressBarV2 newopt;
|
QStyleOptionProgressBar newopt;
|
||||||
qreal progress = index.data().toDouble() * 100.;
|
qreal progress = index.data().toDouble() * 100.;
|
||||||
newopt.rect = opt.rect;
|
newopt.rect = opt.rect;
|
||||||
newopt.text = ((progress == 100.0) ? QString("100%") : Utils::String::fromDouble(progress, 1) + "%");
|
newopt.text = ((progress == 100.0) ? QString("100%") : Utils::String::fromDouble(progress, 1) + "%");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user