22 #include <QWidget> |
22 #include <QWidget> |
23 #include <QHBoxLayout> |
23 #include <QHBoxLayout> |
24 #include <QPushButton> |
24 #include <QPushButton> |
25 #include <QGraphicsView> |
25 #include <QGraphicsView> |
26 #include <QLabel> |
26 #include <QLabel> |
|
27 #include <QSizePolicy> |
27 |
28 |
28 #include "drawmapscene.h" |
29 #include "drawmapscene.h" |
29 |
30 |
30 |
31 |
31 class DrawMapView : public QGraphicsView |
32 class DrawMapView : public QGraphicsView |
57 |
58 |
58 void setupUi(QWidget *drawMapWidget) |
59 void setupUi(QWidget *drawMapWidget) |
59 { |
60 { |
60 QVBoxLayout * vbox = new QVBoxLayout(drawMapWidget); |
61 QVBoxLayout * vbox = new QVBoxLayout(drawMapWidget); |
61 vbox->setMargin(0); |
62 vbox->setMargin(0); |
62 lblPoints = new QLabel("0", drawMapWidget); |
|
63 QLayout * arLayout = new QVBoxLayout(); |
63 QLayout * arLayout = new QVBoxLayout(); |
64 arLayout->setAlignment(Qt::AlignCenter); |
64 arLayout->setAlignment(Qt::AlignCenter); |
65 vbox->addLayout(arLayout); |
65 vbox->addLayout(arLayout); |
66 |
66 |
|
67 lblPoints = new QLabel("0", drawMapWidget); |
|
68 lblPoints->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum); |
|
69 arLayout->addWidget(lblPoints); |
|
70 |
67 graphicsView = new DrawMapView(drawMapWidget); |
71 graphicsView = new DrawMapView(drawMapWidget); |
68 graphicsView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
72 graphicsView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
69 graphicsView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
73 graphicsView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
|
74 graphicsView->setRenderHint(QPainter::Antialiasing, true); |
|
75 graphicsView->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum); |
70 arLayout->addWidget(graphicsView); |
76 arLayout->addWidget(graphicsView); |
71 |
77 |
72 retranslateUi(drawMapWidget); |
78 retranslateUi(drawMapWidget); |
73 |
79 |
74 QMetaObject::connectSlotsByName(drawMapWidget); |
80 QMetaObject::connectSlotsByName(drawMapWidget); |
100 void optimize(); |
106 void optimize(); |
101 void setErasing(bool erasing); |
107 void setErasing(bool erasing); |
102 void save(const QString & fileName); |
108 void save(const QString & fileName); |
103 void load(const QString & fileName); |
109 void load(const QString & fileName); |
104 void setPathType(DrawMapScene::PathType pathType); |
110 void setPathType(DrawMapScene::PathType pathType); |
|
111 void setBrushSize(int brushSize); |
|
112 |
|
113 signals: |
|
114 void brushSizeChanged(int brushSize); |
105 |
115 |
106 protected: |
116 protected: |
107 void changeEvent(QEvent *e); |
117 void changeEvent(QEvent *e); |
108 virtual void resizeEvent(QResizeEvent * event); |
118 virtual void resizeEvent(QResizeEvent * event); |
109 virtual void showEvent(QShowEvent * event); |
119 virtual void showEvent(QShowEvent * event); |