/**************************************************************************** ** ** Copyright (C) 2006-2006 Trolltech ASA. All rights reserved. ** ** This file is part of the example classes of the Qt Toolkit. ** ** This file may be used under the terms of the GNU General Public ** License version 2.0 as published by the Free Software Foundation ** and appearing in the file LICENSE.GPL included in the packaging of ** this file. Please review the following information to ensure GNU ** General Public Licensing requirements will be met: ** http://www.trolltech.com/products/qt/opensource.html ** ** If you are unsure which license is appropriate for your use, please ** review the following information: ** http://www.trolltech.com/products/qt/licensing.html or contact the ** sales department at sales@trolltech.com. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ****************************************************************************/ #ifndef EXAMPLE_H #define EXAMPLE_H #include #include #include #include #include #include #include #include #include #include "elements.h" #include "printpreview.h" class FigureEditor : public QGraphicsView { Q_OBJECT public: FigureEditor(QGraphicsScene&, QMainWindow* parent=0, const char* name=0, Qt::WindowFlags f=0); void clear(); bool start_draw; bool drawing; QGraphicsScene *canvas; EdgeItem * newitem; QGraphicsItem* qnewitem; QList eitems; QMainWindow *mparent; protected: void mousePressEvent ( QMouseEvent * event ); void mouseReleaseEvent ( QMouseEvent * event ); void mouseMoveEvent ( QMouseEvent * event ); void contextMenuEvent(QContextMenuEvent *event); signals: void status(const QString&); }; class Main : public QMainWindow { Q_OBJECT public: Main(QGraphicsScene&, QWidget* parent=0, Qt::WindowFlags f=0); ~Main(); void load_file(QString fileName); qreal scale_; QLabel *zoominfo; QMenu *edit; public slots: private slots: void saveLabel(); void openLabel(); void newLabel(); void clear(); void antiAliasing(); void draw_template(); void init(); void addLine(); void addEllipse(); void addBox(); void addImage(); void addTextI(); void print(); void print_preview(); void about(); void zoomin(); void zoomout(); void zoomfit(); void zoom1(); void item_selected(EdgeItem *item); void del_item(); void ins_image(); void print_requested_page(PrintPreview *preview, int page, double scale, QPainter *p); private: void createToolBars(); QDomElement current_template; QDomElement current_paper; void print_label(double x, double y, double scale, QPainter *pp, QPrinter *pp1); void print_page(double scale, QPainter *pp, QPrinter *printer); QGraphicsScene& canvas; FigureEditor *editor; QTabWidget *properties; QAction *lineAct; QAction *ellipseAct; QAction *boxAct; QAction *imageAct; QAction *textAct; QAction *aaAct; QAction *pmarks; QAction *pborder; QAction *zoominAct; QAction *zoomoutAct; QAction *zoomfitAct; QAction *zoom1Act; QAction *delAct; QAction *insimageAct; QToolBar *fileToolBar; QToolBar *toolsToolBar; QPrinter* printer; QCursor cursor_line; QCursor cursor_rect; QCursor cursor_ellipse; QCursor cursor_text; QCursor cursor_image; int selected_item; double template_width, template_height; bool is_rotated; int dbf_id; }; #endif