Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Port away from deprecated QStyleOptionViewItemV4/QStyleOptionViewItemV2

parent f550611a
......@@ -130,7 +130,7 @@ void K3b::DeviceDelegate::paint( QPainter* painter, const QStyleOptionViewItem&
painter->setRenderHint(QPainter::Antialiasing);
// HACK: we erase the branch
QStyleOptionViewItemV4 option( optionOrig );
QStyleOptionViewItem option( optionOrig );
option.rect.setLeft( 0 );
painter->fillRect( option.rect, option.palette.base() );
......
......@@ -63,10 +63,9 @@ void AudioProjectDelegate::setPlayingTrack( const QModelIndex& index )
void AudioProjectDelegate::initStyleOption( QStyleOptionViewItem* option, const QModelIndex& index ) const
{
QStyledItemDelegate::initStyleOption( option, index );
if( option->version == 4 && index.isValid() && index == m_playingTrack ) {
QStyleOptionViewItemV4* optionV4 = static_cast<QStyleOptionViewItemV4*>( option );
optionV4->icon = QIcon::fromTheme( "media-playback-start" );
optionV4->features |= QStyleOptionViewItemV2::HasDecoration;
if( index.isValid() && index == m_playingTrack ) {
option->icon = QIcon::fromTheme( "media-playback-start" );
option->features |= QStyleOptionViewItem::HasDecoration;
}
}
......
......@@ -21,7 +21,7 @@
#include <QApplication>
#include <QStyle>
#include <QStyleOptionButton>
#include <QStyleOptionViewItemV4>
#include <QStyleOptionViewItem>
namespace K3b {
......@@ -46,7 +46,7 @@ void VideoDVDTitleDelegate::paint( QPainter* painter, const QStyleOptionViewItem
painter->save();
QStyle& style = *QApplication::style();
QStyleOptionViewItemV4 option = opt;
QStyleOptionViewItem option = opt;
initStyleOption( &option, index );
style.drawControl( QStyle::CE_ItemViewItem, &option, painter );
......@@ -203,13 +203,11 @@ void VideoDVDTitleDelegate::initStyleOption( QStyleOptionViewItem* option, const
{
if( index.isValid() && index.column() == VideoDVDTitleModel::TitleColumn )
{
if( QStyleOptionViewItemV4 *v4 = qstyleoption_cast<QStyleOptionViewItemV4 *>(option) ) {
v4->index = index;
QVariant value = index.data( Qt::CheckStateRole );
if( value.isValid() && !value.isNull() ) {
v4->features |= QStyleOptionViewItemV2::HasCheckIndicator;
v4->checkState = static_cast<Qt::CheckState>( value.toInt() );
}
option->index = index;
QVariant value = index.data( Qt::CheckStateRole );
if( value.isValid() && !value.isNull() ) {
option->features |= QStyleOptionViewItem::HasCheckIndicator;
option->checkState = static_cast<Qt::CheckState>( value.toInt() );
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment