File indexing completed on 2024-05-12 04:01:30

0001 /*
0002     SPDX-FileCopyrightText: 2010-2016 Sune Vuorela <sune@vuorela.dk>
0003 
0004     SPDX-License-Identifier: MIT
0005 */
0006 
0007 #ifndef PRISON_ABSTRACTBARCODE_P_H
0008 #define PRISON_ABSTRACTBARCODE_P_H
0009 
0010 #include "barcode.h"
0011 #include "prison.h"
0012 
0013 #include <QImage>
0014 #include <QVariant>
0015 
0016 namespace Prison
0017 {
0018 class AbstractBarcodePrivate
0019 {
0020 public:
0021     explicit AbstractBarcodePrivate(Barcode::Dimensions dim);
0022     virtual ~AbstractBarcodePrivate();
0023 
0024     /**
0025      * Doing the actual painting of the image
0026      * @param size unused - will be removed in KF6
0027      * @return image with barcode, or null image
0028      */
0029     virtual QImage paintImage() = 0;
0030 
0031     /** @see Barcode::preferredSize */
0032     virtual QSizeF preferredSize(qreal devicePixelRatio) const;
0033 
0034     bool isEmpty() const;
0035     bool sizeTooSmall(const QSizeF &size) const;
0036     void recompute();
0037 
0038     QVariant m_data;
0039     QImage m_cache;
0040     QColor m_foreground = Qt::black;
0041     QColor m_background = Qt::white;
0042     Barcode::Dimensions m_dimension = Barcode::NoDimensions;
0043     Prison::BarcodeType m_format;
0044 };
0045 
0046 }
0047 
0048 #endif