mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-14 16:57:55 +00:00
Fix text size problem on Windows with custom DPI. (closes #758)
On Windows FontMetrics seem to be broken when custom DPI is set by the user.
This commit is contained in:
parent
fca0c8ace4
commit
102b2dc738
@ -29,7 +29,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QFontMetrics>
|
|
||||||
|
|
||||||
#include "torrentmodel.h"
|
#include "torrentmodel.h"
|
||||||
#include "torrentpersistentdata.h"
|
#include "torrentpersistentdata.h"
|
||||||
@ -305,19 +304,6 @@ QVariant TorrentModel::data(const QModelIndex &index, int role) const
|
|||||||
if (!index.isValid()) return QVariant();
|
if (!index.isValid()) return QVariant();
|
||||||
try {
|
try {
|
||||||
if (index.row() >= 0 && index.row() < rowCount() && index.column() >= 0 && index.column() < columnCount())
|
if (index.row() >= 0 && index.row() < rowCount() && index.column() >= 0 && index.column() < columnCount())
|
||||||
if (role == Qt::SizeHintRole)
|
|
||||||
{
|
|
||||||
QSize size(m_torrents[index.row()]->data(index.column(), role).toSize());
|
|
||||||
QFont font;
|
|
||||||
QFontMetrics fm(font);
|
|
||||||
QIcon icon(":/Icons/skin/downloading.png");
|
|
||||||
int fm_height(fm.height());
|
|
||||||
QList<QSize> ic_sizes(icon.availableSizes());
|
|
||||||
int icon_height(ic_sizes[0].height());
|
|
||||||
size.setHeight(fm_height > icon_height ? fm_height : icon_height);
|
|
||||||
return QVariant(size);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return m_torrents[index.row()]->data(index.column(), role);
|
return m_torrents[index.row()]->data(index.column(), role);
|
||||||
} catch(invalid_handle&) {}
|
} catch(invalid_handle&) {}
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user