Replace obsolete QStyleOptionViewItemV2-4

This commit is contained in:
Jonas Kvinge
2018-09-18 22:17:28 +02:00
parent db5679bbe9
commit 246f82bfad
6 changed files with 9 additions and 9 deletions

View File

@@ -81,7 +81,7 @@ void DeviceItemDelegate::paint(QPainter *p, const QStyleOptionViewItem &opt, con
} }
// Draw the background // Draw the background
const QStyleOptionViewItemV3 *vopt = qstyleoption_cast<const QStyleOptionViewItemV3*>(&opt); const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem*>(&opt);
const QWidget *widget = vopt->widget; const QWidget *widget = vopt->widget;
QStyle *style = widget->style() ? widget->style() : QApplication::style(); QStyle *style = widget->style() ? widget->style() : QApplication::style();
style->drawPrimitive(QStyle::PE_PanelItemViewItem, &opt, p, widget); style->drawPrimitive(QStyle::PE_PanelItemViewItem, &opt, p, widget);

View File

@@ -218,7 +218,7 @@ void PlaylistDelegateBase::paint(QPainter *painter, const QStyleOptionViewItem &
} }
QStyleOptionViewItemV4 PlaylistDelegateBase::Adjusted(const QStyleOptionViewItem &option, const QModelIndex &index) const { QStyleOptionViewItem PlaylistDelegateBase::Adjusted(const QStyleOptionViewItem &option, const QModelIndex &index) const {
if (!view_) return option; if (!view_) return option;
@@ -227,7 +227,7 @@ QStyleOptionViewItemV4 PlaylistDelegateBase::Adjusted(const QStyleOptionViewItem
if (view_->header()->logicalIndexAt(top_left) != index.column()) if (view_->header()->logicalIndexAt(top_left) != index.column())
return option; return option;
QStyleOptionViewItemV4 ret(option); QStyleOptionViewItem ret(option);
if (index.data(Playlist::Role_IsCurrent).toBool()) { if (index.data(Playlist::Role_IsCurrent).toBool()) {
// Move the text in a bit on the first column for the song that's currently playing // Move the text in a bit on the first column for the song that's currently playing

View File

@@ -84,7 +84,7 @@ class PlaylistDelegateBase : public QueuedItemDelegate {
QString displayText(const QVariant &value, const QLocale &locale) const; QString displayText(const QVariant &value, const QLocale &locale) const;
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
QStyleOptionViewItemV4 Adjusted(const QStyleOptionViewItem &option, const QModelIndex &index) const; QStyleOptionViewItem Adjusted(const QStyleOptionViewItem &option, const QModelIndex &index) const;
static const int kMinHeight; static const int kMinHeight;

View File

@@ -382,7 +382,7 @@ void PlaylistView::drawTree(QPainter *painter, const QRegion &region) const {
void PlaylistView::drawRow(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { void PlaylistView::drawRow(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const {
QStyleOptionViewItemV4 opt(option); QStyleOptionViewItem opt(option);
bool is_current = index.data(Playlist::Role_IsCurrent).toBool(); bool is_current = index.data(Playlist::Role_IsCurrent).toBool();
bool is_paused = index.data(Playlist::Role_IsPaused).toBool(); bool is_paused = index.data(Playlist::Role_IsPaused).toBool();
@@ -452,7 +452,7 @@ void PlaylistView::drawRow(QPainter *painter, const QStyleOptionViewItem &option
} }
void PlaylistView::UpdateCachedCurrentRowPixmap(QStyleOptionViewItemV4 option, const QModelIndex &index) { void PlaylistView::UpdateCachedCurrentRowPixmap(QStyleOptionViewItem option, const QModelIndex &index) {
cached_current_row_rect_ = option.rect; cached_current_row_rect_ = option.rect;
cached_current_row_row_ = index.row(); cached_current_row_row_ = index.row();

View File

@@ -189,7 +189,7 @@ class PlaylistView : public QTreeView {
private: private:
void ReloadBarPixmaps(); void ReloadBarPixmaps();
QList<QPixmap> LoadBarPixmap(const QString &filename); QList<QPixmap> LoadBarPixmap(const QString &filename);
void UpdateCachedCurrentRowPixmap(QStyleOptionViewItemV4 option, const QModelIndex &index); void UpdateCachedCurrentRowPixmap(QStyleOptionViewItem option, const QModelIndex &index);
void set_background_image_type(BackgroundImageType bg) { void set_background_image_type(BackgroundImageType bg) {
background_image_type_ = bg; background_image_type_ = bg;

View File

@@ -233,9 +233,9 @@ QModelIndex GroupedIconView::indexAt(const QPoint &p) const {
void GroupedIconView::paintEvent(QPaintEvent *e) { void GroupedIconView::paintEvent(QPaintEvent *e) {
// This code was adapted from QListView::paintEvent(), changed to use the visualRect() of items, and to draw headers. // This code was adapted from QListView::paintEvent(), changed to use the visualRect() of items, and to draw headers.
QStyleOptionViewItemV4 option(viewOptions()); QStyleOptionViewItem option(viewOptions());
if (isWrapping()) if (isWrapping())
option.features = QStyleOptionViewItemV2::WrapText; option.features = QStyleOptionViewItem::WrapText;
option.locale = locale(); option.locale = locale();
option.locale.setNumberOptions(QLocale::OmitGroupSeparator); option.locale.setNumberOptions(QLocale::OmitGroupSeparator);
option.widget = this; option.widget = this;