comparison mupdf-source/thirdparty/zint/frontend_qt/barcodeitem.cpp @ 2:b50eed0cc0ef upstream

ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4. The directory name has changed: no version number in the expanded directory now.
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 15 Sep 2025 11:43:07 +0200
parents
children
comparison
equal deleted inserted replaced
1:1d09e1dec1d9 2:b50eed0cc0ef
1 /***************************************************************************
2 * Copyright (C) 2008 by BogDan Vatra *
3 * bogdan@licentia.eu *
4 * Copyright (C) 2009-2023 by Robin Stuart <rstuart114@gmail.com> *
5 * *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 3 of the License, or *
9 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
16 ***************************************************************************/
17 /* vim: set ts=4 sw=4 et : */
18
19 //#include <QDebug>
20 #include "barcodeitem.h"
21
22 BarcodeItem::BarcodeItem()
23 : QGraphicsItem()
24 {
25 w = 693;
26 h = 378; // Default widget size when created
27 }
28
29 BarcodeItem::~BarcodeItem()
30 {
31 }
32
33 void BarcodeItem::setSize(int width, int height) {
34 w = width;
35 h = height;
36 }
37
38 void BarcodeItem::setColor(const QColor& color) {
39 m_color = color;
40 }
41
42 QRectF BarcodeItem::boundingRect() const
43 {
44 return QRectF(0, 0, w, h);
45 }
46
47 void BarcodeItem::paint(QPainter *painter, const QStyleOptionGraphicsItem * /*option*/, QWidget * /*widget*/)
48 {
49 QRectF painterRect = boundingRect();
50 if (m_color.isValid()) {
51 painter->fillRect(painterRect, m_color);
52 }
53 bc.render(*painter, painterRect);
54 }