File indexing completed on 2024-04-28 04:32:20
0001 /* 0002 * SPDX-FileCopyrightText: 2019 Alexander Volkov <a.volkov@rusbitech.ru> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #include "hiderectitem.h" 0008 0009 #include <QPen> 0010 0011 namespace KSaneIface 0012 { 0013 0014 HideRectItem::HideRectItem() 0015 : m_devicePixelRatio(1.0) 0016 { 0017 setOpacity(0.4); 0018 setPen(Qt::NoPen); 0019 setBrush(Qt::black); 0020 } 0021 0022 QRectF HideRectItem::rect() const 0023 { 0024 QRectF r = QGraphicsRectItem::rect(); 0025 return QRectF(r.topLeft() * m_devicePixelRatio, r.size() * m_devicePixelRatio); 0026 } 0027 0028 void HideRectItem::setRect(const QRectF &rect) 0029 { 0030 QGraphicsRectItem::setRect(QRectF(rect.topLeft() / m_devicePixelRatio, rect.size() / m_devicePixelRatio)); 0031 } 0032 0033 qreal HideRectItem::devicePixelRatio() const 0034 { 0035 return m_devicePixelRatio; 0036 } 0037 0038 void HideRectItem::setDevicePixelRatio(qreal dpr) 0039 { 0040 m_devicePixelRatio = dpr; 0041 } 0042 0043 } // NameSpace KSaneIface