mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 06:07:37 +02:00
* Properly calculate ACLJobDelegate's sizeHint, taking current font settings into account.
This commit is contained in:
@@ -19,20 +19,17 @@
|
|||||||
|
|
||||||
#include "AclJobItem.h"
|
#include "AclJobItem.h"
|
||||||
|
|
||||||
#include "JobStatusModel.h"
|
|
||||||
#include "utils/TomahawkUtils.h"
|
|
||||||
#include "utils/TomahawkUtilsGui.h"
|
|
||||||
#include "infosystem/InfoSystem.h"
|
|
||||||
#include "utils/Logger.h"
|
|
||||||
|
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include <QListView>
|
#include <QListView>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
|
||||||
|
#include "JobStatusModel.h"
|
||||||
|
#include "infosystem/InfoSystem.h"
|
||||||
|
#include "utils/TomahawkUtilsGui.h"
|
||||||
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
#define ROW_HEIGHT 20
|
|
||||||
#define ICON_PADDING 1
|
#define ICON_PADDING 1
|
||||||
#define PADDING 2
|
#define PADDING 2
|
||||||
|
|
||||||
@@ -65,7 +62,6 @@ ACLJobDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co
|
|||||||
QApplication::style()->drawPrimitive( QStyle::PE_PanelItemViewItem, &opt, painter, opt.widget );
|
QApplication::style()->drawPrimitive( QStyle::PE_PanelItemViewItem, &opt, painter, opt.widget );
|
||||||
|
|
||||||
painter->setRenderHint( QPainter::Antialiasing );
|
painter->setRenderHint( QPainter::Antialiasing );
|
||||||
|
|
||||||
painter->fillRect( opt.rect, Qt::lightGray );
|
painter->fillRect( opt.rect, Qt::lightGray );
|
||||||
|
|
||||||
QString mainText = QString( tr( "Allow %1 to\nconnect and stream from you?" ) ).arg( item->username() );
|
QString mainText = QString( tr( "Allow %1 to\nconnect and stream from you?" ) ).arg( item->username() );
|
||||||
@@ -105,10 +101,11 @@ ACLJobDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co
|
|||||||
m_savedDenyRect = denyBtnRect;
|
m_savedDenyRect = denyBtnRect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QSize
|
QSize
|
||||||
ACLJobDelegate::sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const
|
ACLJobDelegate::sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const
|
||||||
{
|
{
|
||||||
QSize size( QStyledItemDelegate::sizeHint ( option, index ).width(), ROW_HEIGHT * 3 );
|
QSize size( QStyledItemDelegate::sizeHint( option, index ).width(), ( TomahawkUtils::defaultFontHeight() + 6 ) * 3.5 );
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -88,7 +88,6 @@ JobStatusSortModel::lessThan( const QModelIndex& left, const QModelIndex& right
|
|||||||
if ( leftSort == rightSort )
|
if ( leftSort == rightSort )
|
||||||
return left.data( JobStatusModel::AgeRole ).toUInt() > right.data( JobStatusModel::AgeRole ).toUInt();
|
return left.data( JobStatusModel::AgeRole ).toUInt() > right.data( JobStatusModel::AgeRole ).toUInt();
|
||||||
|
|
||||||
|
|
||||||
return leftSort < rightSort;
|
return leftSort < rightSort;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user