Add function to get monitor name
This commit is contained in:
parent
86dbcfda4f
commit
994e08bebc
@ -10,6 +10,8 @@
|
|||||||
#include <physicalmonitorenumerationapi.h>
|
#include <physicalmonitorenumerationapi.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
extern BOOL enumMonitorsCallback(HMONITOR, HDC, LPRECT, LPARAM);
|
extern BOOL enumMonitorsCallback(HMONITOR, HDC, LPRECT, LPARAM);
|
||||||
@ -26,6 +28,8 @@ class Monitor {
|
|||||||
bool setBrightness(float percentage);
|
bool setBrightness(float percentage);
|
||||||
float getBrightness();
|
float getBrightness();
|
||||||
|
|
||||||
|
QString getName() const;
|
||||||
|
|
||||||
operator bool() const;
|
operator bool() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -113,6 +113,14 @@ float Monitor::getBrightness()
|
|||||||
return std::clamp(utils::map(brightness, minBrightness, maxBrightness, 0.f, 1.f), 0.f, 1.f);
|
return std::clamp(utils::map(brightness, minBrightness, maxBrightness, 0.f, 1.f), 0.f, 1.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString Monitor::getName() const
|
||||||
|
{
|
||||||
|
return QString("%1 (0x%2:0x%3)")
|
||||||
|
.arg(m_physicalMonitor.name)
|
||||||
|
.arg(reinterpret_cast<qulonglong>(m_hMonitor), 0, 16)
|
||||||
|
.arg(reinterpret_cast<qulonglong>(m_physicalMonitor.handle), 0, 16);
|
||||||
|
}
|
||||||
|
|
||||||
Monitor::operator bool() const
|
Monitor::operator bool() const
|
||||||
{
|
{
|
||||||
return !m_errorOccurred;
|
return !m_errorOccurred;
|
||||||
|
Loading…
Reference in New Issue
Block a user