barcodeitem.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. #ifndef BARCODEITEM_H
  19. #define BARCODEITEM_H
  20. #include <QGraphicsItem>
  21. #include <qzint.h>
  22. /**
  23. @author BogDan Vatra <taipan@licentia.eu>
  24. */
  25. class BarcodeItem : public QGraphicsItem
  26. {
  27. public:
  28. BarcodeItem();
  29. ~BarcodeItem();
  30. void setSize(int width, int height);
  31. void setColor(const QColor& color); /* Set colour of bounding rect */
  32. QRectF boundingRect() const;
  33. void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
  34. private:
  35. int w, h;
  36. QColor m_color;
  37. public:
  38. mutable Zint::QZint bc;
  39. };
  40. #endif