source: projects/punch-card/punch-card-editor/src/qpunchcard/widget.h @ 47

Last change on this file since 47 was 47, checked in by sven, 10 years ago

Continued implementation:

  • removed bugs
  • improved features

Programming continues, but quite slow since I've got few time... unfortunately

File size: 1.4 KB
Line 
1#ifndef WIDGET_H
2#define WIDGET_H
3
4namespace QPunchCard {
5        class CardWidget;
6}
7
8#include "card.h"
9
10#include <QWidget>
11#include <QPointer>
12#include <QtDebug>
13
14namespace QPunchCard {
15
16class CardWidget : public QWidget {
17        Q_OBJECT
18        //Q_ENUMS(Quality);
19        //Q_PROPERTY(Quality quality READ quality WRITE setQuality);
20        // geht irgendwie nicht... machen wirs halt erst mal so (siehe public)
21        QPointer<Card> card; // ### something like Card* const card;
22
23public:
24        enum Quality { HighQuality, ThumbnailQuality };
25        Quality _quality;
26
27        CardWidget(QWidget * parent = 0, Qt::WFlags f = 0);
28        CardWidget(Card* card, QWidget * parent = 0, Qt::WFlags f = 0) : card(card) { CardWidget(parent, f); }
29        void setCard(Card* card) { this->card = card; }
30        void unsetCard() { card = 0; }
31//      void setCard(File* file, int index) { this->card = &( file->operator[](index) ); }
32        Card* getCard() const { return card; }
33
34        // size hints
35        virtual QSize minimumSizeHint() const;
36        virtual QSize sizeHint() const;
37        virtual int heightForWidth(int i) const;
38
39        // Quality issues (Property)
40        void setQuality(const Quality quality) { _quality = quality; } // { setProperty("quality", quality); }
41        Quality quality() const { return _quality; } // { getProperty("quality"); }
42
43        ~CardWidget() {};
44
45protected:
46        void paintEvent(QPaintEvent *event);
47};
48
49QDebug operator<<(QDebug dbg, const CardWidget &c);
50
51
52}; // namespace
53#endif // WIDGET_H
Note: See TracBrowser for help on using the repository browser.
© 2008 - 2013 technikum29 • Sven Köppel • Some rights reserved
Powered by Trac
Expect where otherwise noted, content on this site is licensed under a Creative Commons 3.0 License