DrawingView.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef DRAWINGGUI_DRAWINGVIEW_H
00025 #define DRAWINGGUI_DRAWINGVIEW_H
00026
00027 #include <Gui/MDIView.h>
00028 #include <QGraphicsView>
00029
00030 QT_BEGIN_NAMESPACE
00031 class QSlider;
00032 class QAction;
00033 class QActionGroup;
00034 class QFile;
00035 class QPopupMenu;
00036 class QToolBar;
00037 class QSvgWidget;
00038 class QScrollArea;
00039 class QPrinter;
00040 QT_END_NAMESPACE
00041
00042 namespace DrawingGui
00043 {
00044
00045 class DrawingGuiExport SvgView : public QGraphicsView
00046 {
00047 Q_OBJECT
00048
00049 public:
00050 enum RendererType { Native, OpenGL, Image };
00051
00052 SvgView(QWidget *parent = 0);
00053
00054 void openFile(const QFile &file);
00055 void setRenderer(RendererType type = Native);
00056 void drawBackground(QPainter *p, const QRectF &rect);
00057
00058 public Q_SLOTS:
00059 void setHighQualityAntialiasing(bool highQualityAntialiasing);
00060 void setViewBackground(bool enable);
00061 void setViewOutline(bool enable);
00062
00063 protected:
00064 void wheelEvent(QWheelEvent *event);
00065 void paintEvent(QPaintEvent *event);
00066
00067 private:
00068 RendererType m_renderer;
00069
00070 QGraphicsItem *m_svgItem;
00071 QGraphicsRectItem *m_backgroundItem;
00072 QGraphicsRectItem *m_outlineItem;
00073
00074 QImage m_image;
00075 };
00076
00077 class DrawingGuiExport DrawingView : public Gui::MDIView
00078 {
00079 Q_OBJECT
00080
00081 public:
00082 DrawingView(QWidget* parent = 0);
00083
00084 public Q_SLOTS:
00085 void load(const QString &path = QString());
00086 void setRenderer(QAction *action);
00087 void viewAll();
00088
00089 public:
00090 bool onMsg(const char* pMsg,const char** ppReturn);
00091 bool onHasMsg(const char* pMsg) const;
00092 void print();
00093 void printPdf();
00094 void printPreview();
00095
00096 protected Q_SLOTS:
00097 void print(QPrinter* printer);
00098
00099 protected:
00100 void contextMenuEvent(QContextMenuEvent *event);
00101
00102 private:
00103 QAction *m_nativeAction;
00104 QAction *m_glAction;
00105 QAction *m_imageAction;
00106 QAction *m_highQualityAntialiasingAction;
00107 QAction *m_backgroundAction;
00108 QAction *m_outlineAction;
00109
00110 SvgView *m_view;
00111
00112 QString m_currentPath;
00113 };
00114
00115 }
00116
00117 #endif // DRAWINGGUI_DRAWINGVIEW_H