+69
-69
@@ -1,69 +1,69 @@
|
||||
#ifndef PICSCENE_H
|
||||
#define PICSCENE_H
|
||||
#include <QGraphicsScene>
|
||||
#include "pictextitem.h"
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QGraphicsSceneMouseEvent;
|
||||
class QMenu;
|
||||
class QPointF;
|
||||
class QGraphicsLineItem;
|
||||
class QFont;
|
||||
class QGraphicsTextItem;
|
||||
class QColor;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class PicScene : public QGraphicsScene
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Mode { InsertItem, InsertLine, InsertText, InsertPic, MoveItem };
|
||||
explicit PicScene(QObject *parent = 0);
|
||||
|
||||
QFont font() const
|
||||
{ return myFont; }
|
||||
QColor textColor() const
|
||||
{ return myTextColor; }
|
||||
QColor itemColor() const
|
||||
{ return myItemColor; }
|
||||
QColor lineColor() const
|
||||
{ return myLineColor; }
|
||||
void setLineColor(const QColor &color);
|
||||
void setTextColor(const QColor &color);
|
||||
void setItemColor(const QColor &color);
|
||||
void setFont(const QFont &font);
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
|
||||
public slots:
|
||||
void setMode(Mode mode);
|
||||
void setIsdrawBackground(bool newIsdrawBackground);
|
||||
signals:
|
||||
void textInserted(QGraphicsTextItem *item);
|
||||
void itemSelected(QGraphicsItem *item);
|
||||
void xmlContentChanged();
|
||||
void showTextWidthHeight();
|
||||
void adjustItemsPos();
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent);
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent);
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent);
|
||||
void drawBackground(QPainter *painter, const QRectF &rect);
|
||||
private:
|
||||
bool isItemChange(int type);
|
||||
|
||||
QMenu *myItemMenu;
|
||||
Mode myMode;
|
||||
bool leftButtonDown;
|
||||
QPointF startPoint;
|
||||
QGraphicsLineItem *line;
|
||||
QFont myFont;
|
||||
PicTextItem *textItem;
|
||||
QColor myTextColor;
|
||||
QColor myItemColor;
|
||||
QColor myLineColor;
|
||||
private:
|
||||
bool IsdrawBackground;
|
||||
};
|
||||
#endif // PICSCENE_H
|
||||
#ifndef PICSCENE_H
|
||||
#define PICSCENE_H
|
||||
#include <QGraphicsScene>
|
||||
#include "pictextitem.h"
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QGraphicsSceneMouseEvent;
|
||||
class QMenu;
|
||||
class QPointF;
|
||||
class QGraphicsLineItem;
|
||||
class QFont;
|
||||
class QGraphicsTextItem;
|
||||
class QColor;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class PicScene : public QGraphicsScene
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Mode { InsertItem, InsertLine, InsertText, InsertPic, MoveItem };
|
||||
explicit PicScene(QObject *parent = 0);
|
||||
|
||||
QFont font() const
|
||||
{ return myFont; }
|
||||
QColor textColor() const
|
||||
{ return myTextColor; }
|
||||
QColor itemColor() const
|
||||
{ return myItemColor; }
|
||||
QColor lineColor() const
|
||||
{ return myLineColor; }
|
||||
void setLineColor(const QColor &color);
|
||||
void setTextColor(const QColor &color);
|
||||
void setItemColor(const QColor &color);
|
||||
void setFont(const QFont &font);
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
|
||||
public slots:
|
||||
void setMode(Mode mode);
|
||||
void setIsdrawBackground(bool newIsdrawBackground);
|
||||
signals:
|
||||
void textInserted(QGraphicsTextItem *item);
|
||||
void itemSelected(QGraphicsItem *item);
|
||||
void xmlContentChanged();
|
||||
void showTextWidthHeight();
|
||||
void adjustItemsPos();
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent);
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent);
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent);
|
||||
void drawBackground(QPainter *painter, const QRectF &rect);
|
||||
private:
|
||||
bool isItemChange(int type);
|
||||
|
||||
QMenu *myItemMenu;
|
||||
Mode myMode;
|
||||
bool leftButtonDown;
|
||||
QPointF startPoint;
|
||||
QGraphicsLineItem *line;
|
||||
QFont myFont;
|
||||
PicTextItem *textItem;
|
||||
QColor myTextColor;
|
||||
QColor myItemColor;
|
||||
QColor myLineColor;
|
||||
private:
|
||||
bool IsdrawBackground;
|
||||
};
|
||||
#endif // PICSCENE_H
|
||||
|
||||
Reference in New Issue
Block a user