mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-04-21 08:21:54 +02:00
Get rid of deprecated typedefs (QStyleOptionViewItemV4 and co)
This commit is contained in:
parent
092313cd7f
commit
4375c8e0c4
@ -64,7 +64,7 @@ PlaylistDelegate::PlaylistDelegate()
|
||||
void
|
||||
PlaylistDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
|
||||
{
|
||||
QStyleOptionViewItemV4 opt = option;
|
||||
QStyleOptionViewItem opt = option;
|
||||
initStyleOption( &opt, QModelIndex() );
|
||||
qApp->style()->drawControl( QStyle::CE_ItemViewItem, &opt, painter );
|
||||
|
||||
|
@ -64,7 +64,7 @@ AccountDelegate::sizeHint( const QStyleOptionViewItem& option, const QModelIndex
|
||||
if ( m_accountRowHeight < 0 )
|
||||
{
|
||||
// Haven't calculated normal item height yet, do it once and save it
|
||||
QStyleOptionViewItemV4 opt( option );
|
||||
QStyleOptionViewItem opt( option );
|
||||
initStyleOption( &opt, index );
|
||||
m_accountRowHeight = ACCOUNT_DELEGATE_ROW_HEIGHT_MULTIPLIER * opt.fontMetrics.height();
|
||||
}
|
||||
@ -98,7 +98,7 @@ AccountDelegate::sizeHint( const QStyleOptionViewItem& option, const QModelIndex
|
||||
void
|
||||
AccountDelegate::paint ( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
|
||||
{
|
||||
QStyleOptionViewItemV4 opt = option;
|
||||
QStyleOptionViewItem opt = option;
|
||||
initStyleOption( &opt, index );
|
||||
|
||||
// draw the background
|
||||
@ -139,7 +139,7 @@ AccountDelegate::paint ( QPainter* painter, const QStyleOptionViewItem& option,
|
||||
// draw checkbox first
|
||||
const int checkboxYPos = ( center ) - ( WRENCH_SIZE / 2 );
|
||||
QRect checkRect = QRect( leftEdge, checkboxYPos, WRENCH_SIZE, WRENCH_SIZE );
|
||||
QStyleOptionViewItemV4 opt2 = opt;
|
||||
QStyleOptionViewItem opt2 = opt;
|
||||
opt2.rect = checkRect;
|
||||
|
||||
if ( !m_loadingSpinners.contains( index ) )
|
||||
@ -392,7 +392,7 @@ AccountDelegate::paint ( QPainter* painter, const QStyleOptionViewItem& option,
|
||||
|
||||
|
||||
int
|
||||
AccountDelegate::drawAccountList( QPainter* painter, QStyleOptionViewItemV4& opt, const QList< Account* > accts, int rightEdge ) const
|
||||
AccountDelegate::drawAccountList( QPainter* painter, QStyleOptionViewItem& opt, const QList< Account* > accts, int rightEdge ) const
|
||||
{
|
||||
// list each account name, and show the online, offline icon
|
||||
const int textHeight = painter->fontMetrics().height() + 1;
|
||||
@ -615,7 +615,7 @@ AccountDelegate::drawStatus( QPainter* painter, const QPointF& rightTopEdge, Acc
|
||||
|
||||
|
||||
void
|
||||
AccountDelegate::drawCheckBox( QStyleOptionViewItemV4& opt, QPainter* p, const QWidget* w ) const
|
||||
AccountDelegate::drawCheckBox( QStyleOptionViewItem& opt, QPainter* p, const QWidget* w ) const
|
||||
{
|
||||
QStyle* style = w ? w->style() : QApplication::style();
|
||||
opt.checkState == Qt::Checked ? opt.state |= QStyle::State_On : opt.state |= QStyle::State_Off;
|
||||
@ -624,7 +624,7 @@ AccountDelegate::drawCheckBox( QStyleOptionViewItemV4& opt, QPainter* p, const Q
|
||||
|
||||
|
||||
void
|
||||
AccountDelegate::drawConfigWrench ( QPainter* painter, QStyleOptionViewItemV4& opt, QStyleOptionToolButton& topt ) const
|
||||
AccountDelegate::drawConfigWrench ( QPainter* painter, QStyleOptionViewItem& opt, QStyleOptionToolButton& topt ) const
|
||||
{
|
||||
const QWidget* w = opt.widget;
|
||||
QStyle* style = w ? w->style() : QApplication::style();
|
||||
@ -648,7 +648,7 @@ AccountDelegate::drawConfigWrench ( QPainter* painter, QStyleOptionViewItemV4& o
|
||||
QRect
|
||||
AccountDelegate::checkRectForIndex( const QStyleOptionViewItem& option, const QModelIndex& idx ) const
|
||||
{
|
||||
QStyleOptionViewItemV4 opt = option;
|
||||
QStyleOptionViewItem opt = option;
|
||||
initStyleOption( &opt, idx );
|
||||
|
||||
// Top level item, return the corresponding rect
|
||||
@ -661,7 +661,7 @@ AccountDelegate::checkRectForIndex( const QStyleOptionViewItem& option, const QM
|
||||
|
||||
|
||||
int
|
||||
AccountDelegate::removeBtnWidth( QStyleOptionViewItemV4 opt ) const
|
||||
AccountDelegate::removeBtnWidth( QStyleOptionViewItem opt ) const
|
||||
{
|
||||
const QString btnText = tr( "Remove" );
|
||||
QFont font = opt.font;
|
||||
@ -674,7 +674,7 @@ void
|
||||
AccountDelegate::startInstalling( const QPersistentModelIndex& idx )
|
||||
{
|
||||
qDebug() << "START INSTALLING:" << idx.data( Qt::DisplayRole ).toString();
|
||||
QStyleOptionViewItemV4 opt;
|
||||
QStyleOptionViewItem opt;
|
||||
initStyleOption( &opt, idx );
|
||||
|
||||
AnimatedSpinner* anim = new AnimatedSpinner( checkRectForIndex( opt, idx ).size(), true );
|
||||
|
@ -71,14 +71,14 @@ private:
|
||||
void drawRoundedButton( QPainter* painter, const QRect& buttonRect, bool red = false ) const;
|
||||
// Returns new left edge
|
||||
int drawStatus( QPainter* painter, const QPointF& rightTopEdge, Account* acct, bool drawText = false ) const;
|
||||
void drawCheckBox( QStyleOptionViewItemV4& opt, QPainter* p, const QWidget* w ) const;
|
||||
void drawConfigWrench( QPainter* painter, QStyleOptionViewItemV4& option, QStyleOptionToolButton& topt ) const;
|
||||
void drawCheckBox( QStyleOptionViewItem& opt, QPainter* p, const QWidget* w ) const;
|
||||
void drawConfigWrench( QPainter* painter, QStyleOptionViewItem& option, QStyleOptionToolButton& topt ) const;
|
||||
// returns new left edge
|
||||
int drawAccountList( QPainter* painter, QStyleOptionViewItemV4& option, const QList< Account* > accounts, int rightEdge ) const;
|
||||
int drawAccountList( QPainter* painter, QStyleOptionViewItem& option, const QList< Account* > accounts, int rightEdge ) const;
|
||||
|
||||
QRect checkRectForIndex( const QStyleOptionViewItem &option, const QModelIndex &idx ) const;
|
||||
|
||||
int removeBtnWidth( QStyleOptionViewItemV4 opt ) const;
|
||||
int removeBtnWidth( QStyleOptionViewItem opt ) const;
|
||||
|
||||
int m_hoveringOver;
|
||||
QPersistentModelIndex m_hoveringItem, m_configPressed;
|
||||
|
@ -44,7 +44,7 @@ AccountFactoryWrapperDelegate::AccountFactoryWrapperDelegate( QObject* parent )
|
||||
void
|
||||
AccountFactoryWrapperDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
|
||||
{
|
||||
QStyleOptionViewItemV4 opt = option;
|
||||
QStyleOptionViewItem opt = option;
|
||||
initStyleOption( &opt, index );
|
||||
|
||||
const int center = opt.rect.height() / 2 + opt.rect.top();
|
||||
@ -61,7 +61,7 @@ AccountFactoryWrapperDelegate::paint(QPainter* painter, const QStyleOptionViewIt
|
||||
// Checkbox on left edge, then text
|
||||
const QRect checkRect( PADDING/4, PADDING/4 + opt.rect.top(), opt.rect.height() - PADDING/4, opt.rect.height() - PADDING/4 );
|
||||
m_cachedCheckRects[ index ] = checkRect;
|
||||
QStyleOptionViewItemV4 opt2 = opt;
|
||||
QStyleOptionViewItem opt2 = opt;
|
||||
opt2.rect = checkRect;
|
||||
opt.checkState == Qt::Checked ? opt2.state |= QStyle::State_On : opt2.state |= QStyle::State_Off;
|
||||
style->drawPrimitive( QStyle::PE_IndicatorViewItemCheck, &opt2, painter, w );
|
||||
|
@ -54,7 +54,7 @@ ACLJobDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co
|
||||
if ( !item )
|
||||
return;
|
||||
//tDebug( LOGVERBOSE ) << Q_FUNC_INFO;
|
||||
QStyleOptionViewItemV4 opt = option;
|
||||
QStyleOptionViewItem opt = option;
|
||||
initStyleOption( &opt, index );
|
||||
QFontMetrics fm( opt.font );
|
||||
|
||||
|
@ -47,7 +47,7 @@ JobStatusDelegate::~JobStatusDelegate()
|
||||
void
|
||||
JobStatusDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
|
||||
{
|
||||
QStyleOptionViewItemV4 opt = option;
|
||||
QStyleOptionViewItem opt = option;
|
||||
initStyleOption( &opt, index );
|
||||
QFontMetrics fm( painter->font() );
|
||||
const bool allowMultiLine = index.data( JobStatusModel::AllowMultiLineRole ).toBool();
|
||||
@ -106,7 +106,7 @@ JobStatusDelegate::sizeHint( const QStyleOptionViewItem& option, const QModelInd
|
||||
return QSize( QStyledItemDelegate::sizeHint( option, index ).width(), m_cachedMultiLineHeights[ index ] );
|
||||
|
||||
// Don't elide, but stretch across as many rows as required
|
||||
QStyleOptionViewItemV4 opt = option;
|
||||
QStyleOptionViewItem opt = option;
|
||||
initStyleOption( &opt, index );
|
||||
|
||||
const QString text = index.data( Qt::DisplayRole ).toString();
|
||||
|
@ -108,7 +108,7 @@ ColumnItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option
|
||||
QColor textColor = TomahawkUtils::alphaBlend( option.palette.color( QPalette::Foreground ), option.palette.color( QPalette::Background ), opacity );
|
||||
|
||||
{
|
||||
QStyleOptionViewItemV4 o = option;
|
||||
QStyleOptionViewItem o = option;
|
||||
initStyleOption( &o, QModelIndex() );
|
||||
|
||||
painter->save();
|
||||
@ -190,7 +190,7 @@ ColumnItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option
|
||||
if ( text.trimmed().isEmpty() )
|
||||
text = tr( "Unknown" );
|
||||
|
||||
QStyleOptionViewItemV4 opt = option;
|
||||
QStyleOptionViewItem opt = option;
|
||||
initStyleOption( &opt, QModelIndex() );
|
||||
|
||||
const QModelIndex curIndex = m_view->currentIndex();
|
||||
|
@ -129,7 +129,7 @@ GridItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
|
||||
if ( !item || !index.isValid() )
|
||||
return;
|
||||
|
||||
QStyleOptionViewItemV4 opt = option;
|
||||
QStyleOptionViewItem opt = option;
|
||||
initStyleOption( &opt, QModelIndex() );
|
||||
// qApp->style()->drawControl( QStyle::CE_ItemViewItem, &opt, painter );
|
||||
|
||||
|
@ -106,7 +106,7 @@ PlaylistItemDelegate::sizeHint( const QStyleOptionViewItem& option, const QModel
|
||||
|
||||
|
||||
void
|
||||
PlaylistItemDelegate::prepareStyleOption( QStyleOptionViewItemV4* option, const QModelIndex& index, PlayableItem* item ) const
|
||||
PlaylistItemDelegate::prepareStyleOption( QStyleOptionViewItem* option, const QModelIndex& index, PlayableItem* item ) const
|
||||
{
|
||||
initStyleOption( option, index );
|
||||
|
||||
@ -176,7 +176,7 @@ PlaylistItemDelegate::paintDetailed( QPainter* painter, const QStyleOptionViewIt
|
||||
QTextOption textOption( Qt::AlignVCenter | (Qt::Alignment)index.data( Qt::TextAlignmentRole ).toUInt() );
|
||||
textOption.setWrapMode( QTextOption::NoWrap );
|
||||
|
||||
QStyleOptionViewItemV4 opt = option;
|
||||
QStyleOptionViewItem opt = option;
|
||||
prepareStyleOption( &opt, index, item );
|
||||
opt.text.clear();
|
||||
qApp->style()->drawControl( QStyle::CE_ItemViewItem, &opt, painter );
|
||||
|
@ -59,7 +59,7 @@ private slots:
|
||||
void doUpdateIndex( const QPersistentModelIndex& index );
|
||||
|
||||
protected:
|
||||
void prepareStyleOption( QStyleOptionViewItemV4* option, const QModelIndex& index, PlayableItem* item ) const;
|
||||
void prepareStyleOption( QStyleOptionViewItem* option, const QModelIndex& index, PlayableItem* item ) const;
|
||||
|
||||
void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const;
|
||||
QWidget* createEditor( QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index ) const;
|
||||
|
@ -93,7 +93,7 @@ TrackItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
|
||||
PlayableItem* item = m_model->itemFromIndex( m_model->mapToSource( index ) );
|
||||
Q_ASSERT( item );
|
||||
|
||||
QStyleOptionViewItemV4 opt = option;
|
||||
QStyleOptionViewItem opt = option;
|
||||
prepareStyleOption( &opt, index, item );
|
||||
|
||||
if ( item->source() )
|
||||
|
@ -286,7 +286,7 @@ DynamicView::backgroundBetween( QRect rect, int rowStart )
|
||||
QPixmap bg = QPixmap( rect.size() );
|
||||
bg.fill( Qt::white );
|
||||
QPainter p( &bg );
|
||||
QStyleOptionViewItemV4 opt = viewOptions();
|
||||
QStyleOptionViewItem opt = viewOptions();
|
||||
// code taken from QTreeViewPrivate::paintAlternatingRowColors
|
||||
m_fadebg = !style()->styleHint( QStyle::SH_ItemView_PaintAlternatingRowColorsForEmptyArea, &opt );
|
||||
// qDebug() << "PAINTING ALTERNATING ROW BG!: " << fadingRectViewport;
|
||||
@ -299,9 +299,9 @@ DynamicView::backgroundBetween( QRect rect, int rowStart )
|
||||
// qDebug() << "PAINTING BG ROW IN RECT" << y << "to" << y + rowHeight << ":" << opt.rect;
|
||||
if ( current & 1 )
|
||||
{
|
||||
opt.features |= QStyleOptionViewItemV2::Alternate;
|
||||
opt.features |= QStyleOptionViewItem::Alternate;
|
||||
} else {
|
||||
opt.features &= ~QStyleOptionViewItemV2::Alternate;
|
||||
opt.features &= ~QStyleOptionViewItem::Alternate;
|
||||
}
|
||||
++current;
|
||||
style()->drawPrimitive( QStyle::PE_PanelItemViewRow, &opt, &p );
|
||||
|
@ -781,7 +781,7 @@ defaultPixmap( ImageType type, ImageMode mode, const QSize& size )
|
||||
|
||||
|
||||
void
|
||||
prepareStyleOption( QStyleOptionViewItemV4* option, const QModelIndex& index, PlayableItem* item )
|
||||
prepareStyleOption( QStyleOptionViewItem* option, const QModelIndex& index, PlayableItem* item )
|
||||
{
|
||||
Q_UNUSED( index );
|
||||
|
||||
|
@ -69,7 +69,7 @@ namespace TomahawkUtils
|
||||
DLLEXPORT void setSystemFont( QFont font );
|
||||
DLLEXPORT QFont systemFont();
|
||||
|
||||
DLLEXPORT void prepareStyleOption( QStyleOptionViewItemV4* option, const QModelIndex& index, PlayableItem* item );
|
||||
DLLEXPORT void prepareStyleOption( QStyleOptionViewItem* option, const QModelIndex& index, PlayableItem* item );
|
||||
|
||||
DLLEXPORT void drawRoundedButton( QPainter* painter, const QRect& btnRect, const QColor& color, const QColor &gradient1bottom = QColor(), const QColor& gradient2top = QColor(), const QColor& gradient2bottom = QColor() );
|
||||
|
||||
|
@ -171,7 +171,7 @@ void LineEdit::updateTextMargins()
|
||||
|
||||
void LineEdit::updateSideWidgetLocations()
|
||||
{
|
||||
QStyleOptionFrameV2 opt;
|
||||
QStyleOptionFrame opt;
|
||||
initStyleOption(&opt);
|
||||
QRect textRect = style()->subElementRect(QStyle::SE_LineEditContents, &opt, this);
|
||||
int spacing = m_rightLayout->spacing();
|
||||
@ -214,7 +214,7 @@ void LineEdit::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
QLineEdit::paintEvent(event);
|
||||
if (text().isEmpty() && !m_inactiveText.isEmpty() && !hasFocus()) {
|
||||
QStyleOptionFrameV2 panel;
|
||||
QStyleOptionFrame panel;
|
||||
initStyleOption(&panel);
|
||||
QRect textRect = style()->subElementRect(QStyle::SE_LineEditContents, &panel, this);
|
||||
int horizontalMargin = 2;
|
||||
|
@ -39,7 +39,7 @@ ResolverConfigDelegate::ResolverConfigDelegate( QObject* parent )
|
||||
void
|
||||
ResolverConfigDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
|
||||
{
|
||||
QStyleOptionViewItemV4 opt = option;
|
||||
QStyleOptionViewItem opt = option;
|
||||
initStyleOption( &opt, index );
|
||||
QRect itemRect = opt.rect;
|
||||
int top = itemRect.top();
|
||||
@ -124,7 +124,7 @@ ResolverConfigDelegate::paint( QPainter* painter, const QStyleOptionViewItem& op
|
||||
QRect
|
||||
ResolverConfigDelegate::configRectForIndex( const QStyleOptionViewItem& option, const QModelIndex& idx ) const
|
||||
{
|
||||
QStyleOptionViewItemV4 opt = option;
|
||||
QStyleOptionViewItem opt = option;
|
||||
initStyleOption( &opt, idx );
|
||||
QRect itemRect = opt.rect;
|
||||
int top = itemRect.top();
|
||||
@ -138,7 +138,7 @@ ResolverConfigDelegate::checkRectForIndex( const QStyleOptionViewItem &option, c
|
||||
{
|
||||
Q_UNUSED( role );
|
||||
|
||||
QStyleOptionViewItemV4 opt = option;
|
||||
QStyleOptionViewItem opt = option;
|
||||
initStyleOption( &opt, idx );
|
||||
QRect itemRect = opt.rect;
|
||||
int top = itemRect.top();
|
||||
|
@ -108,7 +108,7 @@ SourceDelegate::paintStandardItem( QPainter* painter, const QStyleOptionViewItem
|
||||
type == SourcesModel::Station ||
|
||||
type == SourcesModel::TemporaryPage );
|
||||
|
||||
QStyleOptionViewItemV4 opt = option;
|
||||
QStyleOptionViewItem opt = option;
|
||||
initStyleOption( &opt, index );
|
||||
opt.showDecorationSelected = false;
|
||||
|
||||
@ -450,8 +450,8 @@ SourceDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co
|
||||
if ( option.rect.height() == 0 )
|
||||
return;
|
||||
|
||||
QStyleOptionViewItemV4 optIndentation = option;
|
||||
QStyleOptionViewItemV4 opt = option;
|
||||
QStyleOptionViewItem optIndentation = option;
|
||||
QStyleOptionViewItem opt = option;
|
||||
|
||||
painter->save();
|
||||
painter->setRenderHint( QPainter::TextAntialiasing );
|
||||
@ -673,7 +673,7 @@ SourceDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, const QSt
|
||||
SourceTreeItem* gpi = index.data( SourcesModel::SourceTreeItemRole ).value< SourceTreeItem* >();
|
||||
Q_ASSERT( gpi );
|
||||
|
||||
QStyleOptionViewItemV4 o = option;
|
||||
QStyleOptionViewItem o = option;
|
||||
initStyleOption( &o, index );
|
||||
const int padding = m_margin / 8;
|
||||
const QRect r( o.rect.right() - padding - m_iconHeight, padding + o.rect.y(), m_iconHeight, m_iconHeight );
|
||||
|
@ -951,7 +951,7 @@ SourceTreeView::paintEvent( QPaintEvent* event )
|
||||
QPainter painter( viewport() );
|
||||
const QRect itemRect = visualRect( m_dropIndex );
|
||||
|
||||
QStyleOptionViewItemV4 opt;
|
||||
QStyleOptionViewItem opt;
|
||||
opt.initFrom( this );
|
||||
opt.rect = itemRect;
|
||||
opt.state = QStyle::State_Enabled | QStyle::State_Selected;
|
||||
|
Loading…
x
Reference in New Issue
Block a user