Browse Source

Add helper function: Get DPI scaled icon size (device-dependent)

adaptive-webui-19844
Chocobo1 9 years ago
parent
commit
e275c3ba52
  1. 10
      src/core/utils/misc.cpp
  2. 1
      src/core/utils/misc.h
  3. 2
      src/gui/transferlistfilterswidget.cpp

10
src/core/utils/misc.cpp

@ -43,6 +43,7 @@ @@ -43,6 +43,7 @@
#else
#include <QApplication>
#include <QDesktopWidget>
#include <QStyle>
#endif
#ifdef Q_OS_WIN
@ -543,3 +544,12 @@ void Utils::Misc::msleep(unsigned long msecs) @@ -543,3 +544,12 @@ void Utils::Misc::msleep(unsigned long msecs)
{
SleeperThread::msleep(msecs);
}
#ifndef DISABLE_GUI
QSize Utils::Misc::smallIconSize()
{
// Get DPI scaled icon size (device-dependent), see QT source
int s = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize);
return QSize(s, s);
}
#endif

1
src/core/utils/misc.h

@ -54,6 +54,7 @@ namespace Utils @@ -54,6 +54,7 @@ namespace Utils
void shutdownComputer(ShutdownAction action);
// Get screen center
QPoint screenCenter(QWidget *win);
QSize smallIconSize();
#endif
int pythonVersion();
QString pythonExecutable();

2
src/gui/transferlistfilterswidget.cpp

@ -67,7 +67,7 @@ FiltersBase::FiltersBase(QWidget *parent, TransferListWidget *transferList) @@ -67,7 +67,7 @@ FiltersBase::FiltersBase(QWidget *parent, TransferListWidget *transferList)
setUniformItemSizes(true);
setSpacing(0);
setIconSize(QSize(16, 16));
setIconSize(Utils::Misc::smallIconSize());
#if defined(Q_OS_MAC)
setAttribute(Qt::WA_MacShowFocusRect, false);

Loading…
Cancel
Save