/usr/include/qwt-qt4/qwt_layout_metrics.h is in libqwt5-qt4-dev 5.2.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_LAYOUT_METRICS_H
#define QWT_LAYOUT_METRICS_H
#include <qsize.h>
#include <qrect.h>
#include "qwt_polygon.h"
#include "qwt_global.h"
class QPainter;
class QString;
class QFontMetrics;
#if QT_VERSION < 0x040000
class QWMatrix;
#else
class QMatrix;
#endif
class QPaintDevice;
/*!
\brief A Map to translate between layout, screen and paint device metrics
Qt3 supports painting in integer coordinates only. Therefore it is not
possible to scale the layout in screen coordinates to layouts in higher
resolutions ( f.e printing ) without losing the higher precision.
QwtMetricsMap is used to incorporate the various widget attributes
( always in screen resolution ) into the layout/printing code of QwtPlot.
Qt4 is able to paint floating point based coordinates, what makes it
possible always to render in screen coordinates
( with a common scale factor ).
QwtMetricsMap will be obsolete as soon as Qt3 support has been
dropped ( Qwt 6.x ).
*/
class QWT_EXPORT QwtMetricsMap
{
public:
QwtMetricsMap();
bool isIdentity() const;
void setMetrics(const QPaintDevice *layoutMetrics,
const QPaintDevice *deviceMetrics);
int layoutToDeviceX(int x) const;
int deviceToLayoutX(int x) const;
int screenToLayoutX(int x) const;
int layoutToScreenX(int x) const;
int layoutToDeviceY(int y) const;
int deviceToLayoutY(int y) const;
int screenToLayoutY(int y) const;
int layoutToScreenY(int y) const;
QPoint layoutToDevice(const QPoint &, const QPainter * = NULL) const;
QPoint deviceToLayout(const QPoint &, const QPainter * = NULL) const;
QPoint screenToLayout(const QPoint &) const;
QPoint layoutToScreen(const QPoint &point) const;
QSize layoutToDevice(const QSize &) const;
QSize deviceToLayout(const QSize &) const;
QSize screenToLayout(const QSize &) const;
QSize layoutToScreen(const QSize &) const;
QRect layoutToDevice(const QRect &, const QPainter * = NULL) const;
QRect deviceToLayout(const QRect &, const QPainter * = NULL) const;
QRect screenToLayout(const QRect &) const;
QRect layoutToScreen(const QRect &) const;
QwtPolygon layoutToDevice(const QwtPolygon &,
const QPainter * = NULL) const;
QwtPolygon deviceToLayout(const QwtPolygon &,
const QPainter * = NULL) const;
#if QT_VERSION < 0x040000
static QwtPolygon translate(const QWMatrix &, const QwtPolygon &);
static QRect translate(const QWMatrix &, const QRect &);
#else
static QwtPolygon translate(const QMatrix &, const QwtPolygon &);
static QRect translate(const QMatrix &, const QRect &);
#endif
private:
double d_screenToLayoutX;
double d_screenToLayoutY;
double d_deviceToLayoutX;
double d_deviceToLayoutY;
};
inline bool QwtMetricsMap::isIdentity() const
{
return d_deviceToLayoutX == 1.0 && d_deviceToLayoutY == 1.0;
}
inline int QwtMetricsMap::layoutToDeviceX(int x) const
{
return qRound(x / d_deviceToLayoutX);
}
inline int QwtMetricsMap::deviceToLayoutX(int x) const
{
return qRound(x * d_deviceToLayoutX);
}
inline int QwtMetricsMap::screenToLayoutX(int x) const
{
return qRound(x * d_screenToLayoutX);
}
inline int QwtMetricsMap::layoutToScreenX(int x) const
{
return qRound(x / d_screenToLayoutX);
}
inline int QwtMetricsMap::layoutToDeviceY(int y) const
{
return qRound(y / d_deviceToLayoutY);
}
inline int QwtMetricsMap::deviceToLayoutY(int y) const
{
return qRound(y * d_deviceToLayoutY);
}
inline int QwtMetricsMap::screenToLayoutY(int y) const
{
return qRound(y * d_screenToLayoutY);
}
inline int QwtMetricsMap::layoutToScreenY(int y) const
{
return qRound(y / d_screenToLayoutY);
}
inline QSize QwtMetricsMap::layoutToDevice(const QSize &size) const
{
return QSize(layoutToDeviceX(size.width()),
layoutToDeviceY(size.height()));
}
inline QSize QwtMetricsMap::deviceToLayout(const QSize &size) const
{
return QSize(deviceToLayoutX(size.width()),
deviceToLayoutY(size.height()));
}
inline QSize QwtMetricsMap::screenToLayout(const QSize &size) const
{
return QSize(screenToLayoutX(size.width()),
screenToLayoutY(size.height()));
}
inline QSize QwtMetricsMap::layoutToScreen(const QSize &size) const
{
return QSize(layoutToScreenX(size.width()),
layoutToScreenY(size.height()));
}
#endif
|