QGIS API Documentation
4.1.0-Master (60fea48833c)
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.h
"
19
#include "qgis_core.h"
20
#include "
qgis_sip.h
"
21
22
class
QScreen;
23
class
QgsRenderContext
;
24
35
class
CORE_EXPORT
QgsScreenProperties
36
{
37
public
:
41
QgsScreenProperties
();
42
47
explicit
QgsScreenProperties
(
const
QScreen *screen );
48
49
bool
operator==
(
const
QgsScreenProperties
&other )
const
{
return
mValid == other.mValid && mDevicePixelRatio == other.mDevicePixelRatio && mPhysicalDpi == other.mPhysicalDpi; }
50
51
bool
operator!=
(
const
QgsScreenProperties
&other )
const
{
return
!( *
this
== other ); }
52
56
bool
isValid
()
const
{
return
mValid; }
57
67
double
devicePixelRatio
()
const
{
return
mDevicePixelRatio; }
68
78
void
setDevicePixelRatio(
double
ratio );
79
91
double
physicalDpi
()
const
{
return
mPhysicalDpi; }
92
104
void
setPhysicalDpi(
double
dpi );
105
110
void
updateRenderContextForScreen(
QgsRenderContext
&context )
const
;
111
112
private
:
113
bool
mValid =
false
;
114
double
mDevicePixelRatio = 1;
115
double
mPhysicalDpi = 96;
116
};
117
118
#ifndef SIP_RUN
119
#if ( __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 6 ) ) || defined( __clang__ )
120
#pragma GCC diagnostic push
121
#pragma GCC diagnostic ignored "-Wattributes"
122
#elif defined( _MSC_VER )
123
__pragma( warning( push ) ) __pragma( warning( disable : 4273 ) )
124
#endif
125
#endif
126
132
CORE_EXPORT
inline
uint
qHash
(
const
QgsScreenProperties
&properties )
SIP_SKIP
133
{
134
return
qHash
( properties.devicePixelRatio() ) +
qHash
( properties.physicalDpi() );
135
}
136
137
#ifndef SIP_RUN
138
#if ( __GNUC__ > 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ >= 6 ) ) || defined( __clang__ )
139
#pragma GCC diagnostic pop
140
#elif defined( _MSC_VER )
141
__pragma( warning( pop ) )
142
#endif
143
#endif
144
145
#endif
// QGSSCREENPROPERTIES_H
QgsRenderContext
Contains information about the context of a rendering operation.
Definition
qgsrendercontext.h:63
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:91
QgsScreenProperties::devicePixelRatio
double devicePixelRatio() const
Returns the ratio between physical pixels and device-independent pixels for the screen.
Definition
qgsscreenproperties.h:67
QgsScreenProperties::isValid
bool isValid() const
Returns true if the properties are valid.
Definition
qgsscreenproperties.h:56
QgsScreenProperties::operator==
bool operator==(const QgsScreenProperties &other) const
Definition
qgsscreenproperties.h:49
QgsScreenProperties::operator!=
bool operator!=(const QgsScreenProperties &other) const
Definition
qgsscreenproperties.h:51
qgis.h
qgis_sip.h
SIP_SKIP
#define SIP_SKIP
Definition
qgis_sip.h:133
qHash
CORE_EXPORT uint qHash(const QgsScreenProperties &properties)
Returns a hash for a screen properties.
Definition
qgsscreenproperties.h:132
Generated on
for QGIS API Documentation by
1.15.0