Last change
on this file since 44 was
44,
checked in by sven, 14 years ago
|
Import of the Punch Card Editor Project.
This is a C++/Qt project (using qmake) that I've started this weekend.
Of course it's supposed to be released as open source.
I've tried to start with a clean (but now still empty, of course)
directory structure. There will come the sourcecode for a complete
AVR ATmega microcontroller punch card device controller, soon.
I'm planing to finish this editing program and to implement the
communication protocol (over TTY, using some platform indepentent library).
Unfortunately that will take some time (and I don't have much time
any more...)
-- Sven @ workstation
|
File size:
1.3 KB
|
Line | |
---|
1 | #ifndef WIDGET_H |
---|
2 | #define WIDGET_H |
---|
3 | |
---|
4 | #include "card.h" |
---|
5 | |
---|
6 | #include <QWidget> |
---|
7 | #include <QPointer> |
---|
8 | #include <QtDebug> |
---|
9 | |
---|
10 | namespace QPunchCard { |
---|
11 | |
---|
12 | class CardWidget : public QWidget { |
---|
13 | Q_OBJECT |
---|
14 | //Q_ENUMS(Quality); |
---|
15 | //Q_PROPERTY(Quality quality READ quality WRITE setQuality); |
---|
16 | // geht irgendwie nicht... machen wirs halt erst mal so (siehe public) |
---|
17 | QPointer<Card> card; // ### something like Card* const card; |
---|
18 | |
---|
19 | public: |
---|
20 | enum Quality { HighQuality, ThumbnailQuality }; |
---|
21 | Quality _quality; |
---|
22 | |
---|
23 | CardWidget(QWidget * parent = 0, Qt::WFlags f = 0); |
---|
24 | CardWidget(Card* card, QWidget * parent = 0, Qt::WFlags f = 0) : card(card) { CardWidget(parent, f); } |
---|
25 | void setCard(Card* card) { this->card = card; } |
---|
26 | void unsetCard() { card = 0; } |
---|
27 | // void setCard(File* file, int index) { this->card = &( file->operator[](index) ); } |
---|
28 | Card* getCard() const { return card; } |
---|
29 | |
---|
30 | // size hints |
---|
31 | virtual QSize minimumSizeHint() const; |
---|
32 | virtual QSize sizeHint() const; |
---|
33 | virtual int heightForWidth(int i) const; |
---|
34 | |
---|
35 | // Quality issues (Property) |
---|
36 | void setQuality(const Quality quality) { _quality = quality; } // { setProperty("quality", quality); } |
---|
37 | Quality quality() const { return _quality; } // { getProperty("quality"); } |
---|
38 | |
---|
39 | ~CardWidget() {}; |
---|
40 | |
---|
41 | protected: |
---|
42 | void paintEvent(QPaintEvent *event); |
---|
43 | }; |
---|
44 | |
---|
45 | QDebug operator<<(QDebug dbg, const CardWidget &c); |
---|
46 | |
---|
47 | |
---|
48 | }; // namespace |
---|
49 | #endif // WIDGET_H |
---|
Note: See
TracBrowser
for help on using the repository browser.