QGIS API Documentation
3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
src
core
qgsscreenproperties.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsscreenproperties.h
3
---------------
4
Date : June 2023
5
Copyright : (C) 2023 by Nyall Dawson
6
Email : nyall dot dawson at gmail dot com
7
***************************************************************************
8
* *
9
* This program is free software; you can redistribute it and/or modify *
10
* it under the terms of the GNU General Public License as published by *
11
* the Free Software Foundation; either version 2 of the License, or *
12
* (at your option) any later version. *
13
* *
14
***************************************************************************/
15
#ifndef QGSSCREENPROPERTIES_H
16
#define QGSSCREENPROPERTIES_H
17
18
#include "qgis_core.h"
19
#include "
qgis_sip.h
"
20
#include "
qgis.h
"
21
22
class
QScreen;
23
class
QgsRenderContext
;
24
35
class
CORE_EXPORT
QgsScreenProperties
36
{
37
38
public
:
39
43
QgsScreenProperties
();
44
49
explicit
QgsScreenProperties
(
const
QScreen *screen );
50
51
bool
operator==
(
const
QgsScreenProperties
&other )
const
52
{
53
return
mValid == other.mValid
54
&& mDevicePixelRatio == other.mDevicePixelRatio
55
&& mPhysicalDpi == other.mPhysicalDpi;
56
}
57
58
bool
operator!=
(
const
QgsScreenProperties
&other )
const
59
{
60
return
!( *
this
== other );
61
}
62
66
bool
isValid
()
const
{
return
mValid; }
67
77
double
devicePixelRatio
()
const
{
return
mDevicePixelRatio; }
78
88
void
setDevicePixelRatio(
double
ratio );
89
101
double
physicalDpi
()
const
{
return
mPhysicalDpi; }
102
114
void
setPhysicalDpi(
double
dpi );
115
120
void
updateRenderContextForScreen(
QgsRenderContext
&context )
const
;
121
122
private
:
123
124
bool
mValid =
false
;
125
double
mDevicePixelRatio = 1;
126
double
mPhysicalDpi = 96;
127
};
128
134
CORE_EXPORT
inline
uint
qHash
(
const
QgsScreenProperties
&properties )
SIP_SKIP
135
{
136
return
qHash
( properties.devicePixelRatio() ) +
qHash
( properties.physicalDpi() );
137
}
138
139
#endif
// QGSSCREENPROPERTIES_H
QgsRenderContext
Contains information about the context of a rendering operation.
Definition
qgsrendercontext.h:62
QgsScreenProperties
Stores properties relating to a screen.
Definition
qgsscreenproperties.h:36
QgsScreenProperties::QgsScreenProperties
QgsScreenProperties()
Constructor for invalid properties.
QgsScreenProperties::physicalDpi
double physicalDpi() const
This property holds the number of physical dots or pixels per inch.
Definition
qgsscreenproperties.h:101
QgsScreenProperties::devicePixelRatio
double devicePixelRatio() const
Returns the ratio between physical pixels and device-independent pixels for the screen.
Definition
qgsscreenproperties.h:77
QgsScreenProperties::isValid
bool isValid() const
Returns true if the properties are valid.
Definition
qgsscreenproperties.h:66
QgsScreenProperties::operator==
bool operator==(const QgsScreenProperties &other) const
Definition
qgsscreenproperties.h:51
QgsScreenProperties::operator!=
bool operator!=(const QgsScreenProperties &other) const
Definition
qgsscreenproperties.h:58
qgis.h
qgis_sip.h
SIP_SKIP
#define SIP_SKIP
Definition
qgis_sip.h:126
qHash
CORE_EXPORT uint qHash(const QgsScreenProperties &properties)
Returns a hash for a screen properties.
Definition
qgsscreenproperties.h:134
Generated on Thu Dec 26 2024 02:19:01 for QGIS API Documentation by
1.9.8