KSane

hiderectitem.cpp
1/*
2 * SPDX-FileCopyrightText: 2019 Alexander Volkov <a.volkov@rusbitech.ru>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5 */
6
7#include "hiderectitem.h"
8
9#include <QPen>
10
11namespace KSaneIface
12{
13
14HideRectItem::HideRectItem()
15 : m_devicePixelRatio(1.0)
16{
17 setOpacity(0.4);
18 setPen(Qt::NoPen);
19 setBrush(Qt::black);
20}
21
22QRectF HideRectItem::rect() const
23{
25 return QRectF(r.topLeft() * m_devicePixelRatio, r.size() * m_devicePixelRatio);
26}
27
28void HideRectItem::setRect(const QRectF &rect)
29{
30 QGraphicsRectItem::setRect(QRectF(rect.topLeft() / m_devicePixelRatio, rect.size() / m_devicePixelRatio));
31}
32
33qreal HideRectItem::devicePixelRatio() const
34{
35 return m_devicePixelRatio;
36}
37
38void HideRectItem::setDevicePixelRatio(qreal dpr)
39{
40 m_devicePixelRatio = dpr;
41}
42
43} // NameSpace KSaneIface
QRectF rect() const const
void setRect(const QRectF &rectangle)
QSizeF size() const const
QPointF topLeft() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 17 2024 11:55:40 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.