hlp:荆州版本
This commit is contained in:
+1000
-1000
File diff suppressed because it is too large
Load Diff
+126
-126
@@ -1,126 +1,126 @@
|
||||
#ifndef SCENEEDITOPTION_H
|
||||
#define SCENEEDITOPTION_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QTextEdit>
|
||||
#include <QMessageBox>
|
||||
#include <QFileDialog>
|
||||
#include <QTextCharFormat>
|
||||
#include <QXmlStreamReader>
|
||||
#include <QGraphicsView>
|
||||
#include "ParaSettingUI.h"
|
||||
#include "MyFileDialog.h"
|
||||
#include <QComboBox>
|
||||
#include <QPushButton>
|
||||
#include <QCheckBox>
|
||||
#include "DialogFileOperation.h"
|
||||
#include "DialogInsertVari.h"
|
||||
#include "DialogFontSize.h"
|
||||
#include "DialogLineSpace.h"
|
||||
#include "PicWidget.h"
|
||||
#include <QStackedWidget>
|
||||
#include "dlgQrCode.h"
|
||||
#include "QBarCode.h"
|
||||
#include "DialogSaveFile.h"
|
||||
#include "SceneEditOption.h"
|
||||
#include "pictextitem.h"
|
||||
#include "picscene.h"
|
||||
#include "moveinput.h"
|
||||
#include "formscenedlg.h"
|
||||
#include <mainwindow.h>
|
||||
#include "MyFileDialog.h"
|
||||
namespace Ui {
|
||||
class SceneEditOption;
|
||||
}
|
||||
|
||||
class SceneEditOption : public QWidget,public ParaSettingUI
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SceneEditOption(QWidget *parent = 0);
|
||||
~SceneEditOption();
|
||||
|
||||
void bindStackWidget(QStackedWidget *stackedWidgetOption,QStackedWidget *stackedWidgetText);
|
||||
void bindSysPara(SysPara *sysPara);
|
||||
void bindScene(PicScene *pPicScene, QGraphicsView *pGraphicViewer, QTextEdit *pTextEdit);
|
||||
bool createItemImage();
|
||||
void updatePicScene2Item();
|
||||
|
||||
QList<QGraphicsItem *> getPicSceneItems();
|
||||
signals:
|
||||
void previewScene();
|
||||
void addPicTextItem();
|
||||
void importFile(QString);
|
||||
void delItem();
|
||||
void saveScene(QString);
|
||||
void openSceneFile(QString);
|
||||
void editItem();
|
||||
void editItemMode();
|
||||
void fileNameChanged(QString);
|
||||
void generateQRCode(QString);
|
||||
public slots:
|
||||
void enableButtonSave();
|
||||
void onSaveASFile(QString filename,bool Flag);
|
||||
void saveFile();
|
||||
void onFileOpen(QString filePath,bool insertFlag);
|
||||
void onEditItemDone();
|
||||
void onCreateSceneImage(QString filePath);//生成场景图片
|
||||
void onStackedWidgetOptionCurrentChanged(int index);
|
||||
//edit@12-07
|
||||
void show_scene_new_dlg();
|
||||
void on_btn_test2();
|
||||
void onInkJetPrinterCurrentChanged(int index);
|
||||
void insertImageItem(QString,bool);
|
||||
private slots:
|
||||
void on_delButton_pressed();
|
||||
|
||||
void on_saveButton_pressed();
|
||||
void on_openfileButton_pressed();
|
||||
|
||||
void on_previewButton_pressed();
|
||||
|
||||
void on_addButton_pressed();
|
||||
|
||||
void on_EditItemButton_pressed();
|
||||
|
||||
void on_saveAsButton_pressed();
|
||||
|
||||
void on_newfileButton_pressed();
|
||||
void on_enlargeButton_pressed();
|
||||
void on_reduceButton_pressed();
|
||||
void on_test_pressed();
|
||||
|
||||
private:
|
||||
// 修复编辑时文本和变量错位问题
|
||||
QString fixVariableImagesAlignment(const QString &html);
|
||||
void parseVbfile(QXmlStreamReader &reader);
|
||||
bool maybeSave();
|
||||
Ui::SceneEditOption *ui;
|
||||
QStackedWidget *stackedWidgetOption;
|
||||
QStackedWidget *stackedWidgetText;
|
||||
PicScene *pPicScene; //保存Item的Html对应的图片 用于显示 解决场景模式文本无法放大的问题
|
||||
PicScene *pPicScene2; //保存Item的Html 用于编辑和保存 pPicScene和pPicScene2的Item一一对应
|
||||
QGraphicsView *pViewer;
|
||||
QTextEdit *textEdit;
|
||||
QGraphicsScene *m_pSavePicScene;
|
||||
bool m_CreateImageFlag;
|
||||
int getSelectedIndex();
|
||||
void syncAllPositions();
|
||||
|
||||
DialogFileOperation *dialogFileOperation;
|
||||
#ifdef MYSAVEFILEDLG
|
||||
DialogSaveFile *dialogSaveFile;
|
||||
#endif
|
||||
MyFileDialog *fileDialog;
|
||||
|
||||
PicTextItem *textItem;
|
||||
PicTextItem *textItem2;
|
||||
//PicScene *scene;
|
||||
QString currFileName;
|
||||
void onSceneAccepted(PicTextItem *pTextItem);
|
||||
int editMode;//保存当前的编辑模式
|
||||
QString xmlfileName;
|
||||
FormScenedlg *newScene;
|
||||
};
|
||||
|
||||
#endif // SCENEEDITOPTION_H
|
||||
#ifndef SCENEEDITOPTION_H
|
||||
#define SCENEEDITOPTION_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QTextEdit>
|
||||
#include <QMessageBox>
|
||||
#include <QFileDialog>
|
||||
#include <QTextCharFormat>
|
||||
#include <QXmlStreamReader>
|
||||
#include <QGraphicsView>
|
||||
#include "ParaSettingUI.h"
|
||||
#include "MyFileDialog.h"
|
||||
#include <QComboBox>
|
||||
#include <QPushButton>
|
||||
#include <QCheckBox>
|
||||
#include "DialogFileOperation.h"
|
||||
#include "DialogInsertVari.h"
|
||||
#include "DialogFontSize.h"
|
||||
#include "DialogLineSpace.h"
|
||||
#include "PicWidget.h"
|
||||
#include <QStackedWidget>
|
||||
#include "dlgQrCode.h"
|
||||
#include "QBarCode.h"
|
||||
#include "DialogSaveFile.h"
|
||||
#include "SceneEditOption.h"
|
||||
#include "pictextitem.h"
|
||||
#include "picscene.h"
|
||||
#include "moveinput.h"
|
||||
#include "formscenedlg.h"
|
||||
#include <mainwindow.h>
|
||||
#include "MyFileDialog.h"
|
||||
namespace Ui {
|
||||
class SceneEditOption;
|
||||
}
|
||||
|
||||
class SceneEditOption : public QWidget,public ParaSettingUI
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SceneEditOption(QWidget *parent = 0);
|
||||
~SceneEditOption();
|
||||
|
||||
void bindStackWidget(QStackedWidget *stackedWidgetOption,QStackedWidget *stackedWidgetText);
|
||||
void bindSysPara(SysPara *sysPara);
|
||||
void bindScene(PicScene *pPicScene, QGraphicsView *pGraphicViewer, QTextEdit *pTextEdit);
|
||||
bool createItemImage();
|
||||
void updatePicScene2Item();
|
||||
|
||||
QList<QGraphicsItem *> getPicSceneItems();
|
||||
signals:
|
||||
void previewScene();
|
||||
void addPicTextItem();
|
||||
void importFile(QString);
|
||||
void delItem();
|
||||
void saveScene(QString);
|
||||
void openSceneFile(QString);
|
||||
void editItem();
|
||||
void editItemMode();
|
||||
void fileNameChanged(QString);
|
||||
void generateQRCode(QString);
|
||||
public slots:
|
||||
void enableButtonSave();
|
||||
void onSaveASFile(QString filename,bool Flag);
|
||||
void saveFile();
|
||||
void onFileOpen(QString filePath,bool insertFlag);
|
||||
void onEditItemDone();
|
||||
void onCreateSceneImage(QString filePath);//生成场景图片
|
||||
void onStackedWidgetOptionCurrentChanged(int index);
|
||||
//edit@12-07
|
||||
void show_scene_new_dlg();
|
||||
void on_btn_test2();
|
||||
void onInkJetPrinterCurrentChanged(int index);
|
||||
void insertImageItem(QString,bool);
|
||||
private slots:
|
||||
void on_delButton_pressed();
|
||||
|
||||
void on_saveButton_pressed();
|
||||
void on_openfileButton_pressed();
|
||||
|
||||
void on_previewButton_pressed();
|
||||
|
||||
void on_addButton_pressed();
|
||||
|
||||
void on_EditItemButton_pressed();
|
||||
|
||||
void on_saveAsButton_pressed();
|
||||
|
||||
void on_newfileButton_pressed();
|
||||
void on_enlargeButton_pressed();
|
||||
void on_reduceButton_pressed();
|
||||
void on_test_pressed();
|
||||
|
||||
private:
|
||||
// 修复编辑时文本和变量错位问题
|
||||
QString fixVariableImagesAlignment(const QString &html);
|
||||
void parseVbfile(QXmlStreamReader &reader);
|
||||
bool maybeSave();
|
||||
Ui::SceneEditOption *ui;
|
||||
QStackedWidget *stackedWidgetOption;
|
||||
QStackedWidget *stackedWidgetText;
|
||||
PicScene *pPicScene; //保存Item的Html对应的图片 用于显示 解决场景模式文本无法放大的问题
|
||||
PicScene *pPicScene2; //保存Item的Html 用于编辑和保存 pPicScene和pPicScene2的Item一一对应
|
||||
QGraphicsView *pViewer;
|
||||
QTextEdit *textEdit;
|
||||
QGraphicsScene *m_pSavePicScene;
|
||||
bool m_CreateImageFlag;
|
||||
int getSelectedIndex();
|
||||
void syncAllPositions();
|
||||
|
||||
DialogFileOperation *dialogFileOperation;
|
||||
#ifdef MYSAVEFILEDLG
|
||||
DialogSaveFile *dialogSaveFile;
|
||||
#endif
|
||||
MyFileDialog *fileDialog;
|
||||
|
||||
PicTextItem *textItem;
|
||||
PicTextItem *textItem2;
|
||||
//PicScene *scene;
|
||||
QString currFileName;
|
||||
void onSceneAccepted(PicTextItem *pTextItem);
|
||||
int editMode;//保存当前的编辑模式
|
||||
QString xmlfileName;
|
||||
FormScenedlg *newScene;
|
||||
};
|
||||
|
||||
#endif // SCENEEDITOPTION_H
|
||||
|
||||
+559
-559
File diff suppressed because it is too large
Load Diff
+128
-128
@@ -1,128 +1,128 @@
|
||||
#ifndef FORMSCENEDLG_H
|
||||
#define FORMSCENEDLG_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QGraphicsView>
|
||||
#include <QKeyEvent>
|
||||
//#include <QWSServer>
|
||||
#include <QBoxLayout>
|
||||
#include <QTimer>
|
||||
#include <QLabel>
|
||||
#include <QTextEdit>
|
||||
#include <QFontDatabase>
|
||||
#include <qmath.h>
|
||||
#include "picscene.h"
|
||||
#include "DialogFileOperation.h"
|
||||
#include "pictextitem.h"
|
||||
#include "myinclude.h"
|
||||
#include "Public.h"
|
||||
namespace Ui {
|
||||
class FormScenedlg;
|
||||
}
|
||||
|
||||
class FormScenedlg : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FormScenedlg(QWidget *parent = 0);
|
||||
~FormScenedlg();
|
||||
void bindScene(PicScene *pPicScene, QGraphicsView *pGraphicViewer,QTextEdit *pTextEdit);
|
||||
|
||||
|
||||
static void showQLayout(QLayout *layout, bool visible=true);
|
||||
static QObject *findChildAll(const QLayout *layout, const QString &name);
|
||||
void Layout_ToNew();
|
||||
void Layout_ToDefault();
|
||||
public slots:
|
||||
//void onSceneRectChanged(const QString &text);
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
signals:
|
||||
void delButton();
|
||||
void saveButton();
|
||||
void openfileButton();
|
||||
void previewButton();
|
||||
void addButton();
|
||||
void EditItemButton();
|
||||
void saveAsButton();
|
||||
void newfileButton();
|
||||
void enlargeButton();
|
||||
void reduceButton();
|
||||
void ZoomOrigin();
|
||||
void btn_test2();
|
||||
void insertImage(QString,bool);
|
||||
private slots:
|
||||
void on_addButton_clicked();
|
||||
|
||||
void on_EditItemButton_clicked();
|
||||
|
||||
void on_delButton_clicked();
|
||||
|
||||
void on_newfileButton_clicked();
|
||||
|
||||
void on_openfileButton_clicked();
|
||||
|
||||
void on_previewButton_clicked();
|
||||
|
||||
void on_saveButton_clicked();
|
||||
|
||||
void on_saveAsButton_clicked();
|
||||
|
||||
void on_enlargeButton_clicked();
|
||||
|
||||
void on_reduceButton_clicked();
|
||||
|
||||
void on_KeyLeft_clicked();
|
||||
|
||||
void on_KeyUp_clicked();
|
||||
|
||||
void on_KeyRight_clicked();
|
||||
|
||||
void on_KeyDown_clicked();
|
||||
|
||||
void on_insertImage_clicked();
|
||||
|
||||
void on_ZoomOrigin_clicked();
|
||||
|
||||
void on_btn_test2_clicked();
|
||||
|
||||
void on_itemNext_clicked();
|
||||
|
||||
void on_itemPrev_clicked();
|
||||
|
||||
void PrintselectedItemInfo();
|
||||
void adjustItemsPos(bool bMoveScrollBar=true);
|
||||
void adjustItemsPosFalse(){adjustItemsPos(false);}
|
||||
void sceneRectChanged_timerHandler();
|
||||
void verticalScrollBar_valueChanged(int value);
|
||||
void horizontalScrollBar_valueChanged(int value);
|
||||
void onFileOpen(QString filePath, bool insertFlag);
|
||||
void reset_showTextWidthHeight();
|
||||
void on_itemFirst_clicked();
|
||||
|
||||
void on_itemLast_clicked();
|
||||
|
||||
|
||||
private:
|
||||
Ui::FormScenedlg *ui;
|
||||
PicScene *pPicScene;
|
||||
QGraphicsView *pViewer;
|
||||
|
||||
QSize SWmaximumSize1;
|
||||
QRect SWgeometry1;
|
||||
QRect FVgeometry2;
|
||||
QRect GVgeometry3;
|
||||
QPoint lastOriginScene;
|
||||
QWidget *tabMainWindow;
|
||||
DialogFileOperation *dialogFileOperation;
|
||||
QTextEdit *textEdit;
|
||||
PicTextItem *textItem;
|
||||
|
||||
|
||||
// QWidget interface
|
||||
protected:
|
||||
};
|
||||
|
||||
#endif // FORMSCENEDLG_H
|
||||
#ifndef FORMSCENEDLG_H
|
||||
#define FORMSCENEDLG_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QGraphicsView>
|
||||
#include <QKeyEvent>
|
||||
//#include <QWSServer>
|
||||
#include <QBoxLayout>
|
||||
#include <QTimer>
|
||||
#include <QLabel>
|
||||
#include <QTextEdit>
|
||||
#include <QFontDatabase>
|
||||
#include <qmath.h>
|
||||
#include "picscene.h"
|
||||
#include "DialogFileOperation.h"
|
||||
#include "pictextitem.h"
|
||||
#include "myinclude.h"
|
||||
#include "Public.h"
|
||||
namespace Ui {
|
||||
class FormScenedlg;
|
||||
}
|
||||
|
||||
class FormScenedlg : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FormScenedlg(QWidget *parent = 0);
|
||||
~FormScenedlg();
|
||||
void bindScene(PicScene *pPicScene, QGraphicsView *pGraphicViewer,QTextEdit *pTextEdit);
|
||||
|
||||
|
||||
static void showQLayout(QLayout *layout, bool visible=true);
|
||||
static QObject *findChildAll(const QLayout *layout, const QString &name);
|
||||
void Layout_ToNew();
|
||||
void Layout_ToDefault();
|
||||
public slots:
|
||||
//void onSceneRectChanged(const QString &text);
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
signals:
|
||||
void delButton();
|
||||
void saveButton();
|
||||
void openfileButton();
|
||||
void previewButton();
|
||||
void addButton();
|
||||
void EditItemButton();
|
||||
void saveAsButton();
|
||||
void newfileButton();
|
||||
void enlargeButton();
|
||||
void reduceButton();
|
||||
void ZoomOrigin();
|
||||
void btn_test2();
|
||||
void insertImage(QString,bool);
|
||||
private slots:
|
||||
void on_addButton_clicked();
|
||||
|
||||
void on_EditItemButton_clicked();
|
||||
|
||||
void on_delButton_clicked();
|
||||
|
||||
void on_newfileButton_clicked();
|
||||
|
||||
void on_openfileButton_clicked();
|
||||
|
||||
void on_previewButton_clicked();
|
||||
|
||||
void on_saveButton_clicked();
|
||||
|
||||
void on_saveAsButton_clicked();
|
||||
|
||||
void on_enlargeButton_clicked();
|
||||
|
||||
void on_reduceButton_clicked();
|
||||
|
||||
void on_KeyLeft_clicked();
|
||||
|
||||
void on_KeyUp_clicked();
|
||||
|
||||
void on_KeyRight_clicked();
|
||||
|
||||
void on_KeyDown_clicked();
|
||||
|
||||
void on_insertImage_clicked();
|
||||
|
||||
void on_ZoomOrigin_clicked();
|
||||
|
||||
void on_btn_test2_clicked();
|
||||
|
||||
void on_itemNext_clicked();
|
||||
|
||||
void on_itemPrev_clicked();
|
||||
|
||||
void PrintselectedItemInfo();
|
||||
void adjustItemsPos(bool bMoveScrollBar=true);
|
||||
void adjustItemsPosFalse(){adjustItemsPos(false);}
|
||||
void sceneRectChanged_timerHandler();
|
||||
void verticalScrollBar_valueChanged(int value);
|
||||
void horizontalScrollBar_valueChanged(int value);
|
||||
void onFileOpen(QString filePath, bool insertFlag);
|
||||
void reset_showTextWidthHeight();
|
||||
void on_itemFirst_clicked();
|
||||
|
||||
void on_itemLast_clicked();
|
||||
|
||||
|
||||
private:
|
||||
Ui::FormScenedlg *ui;
|
||||
PicScene *pPicScene;
|
||||
QGraphicsView *pViewer;
|
||||
|
||||
QSize SWmaximumSize1;
|
||||
QRect SWgeometry1;
|
||||
QRect FVgeometry2;
|
||||
QRect GVgeometry3;
|
||||
QPoint lastOriginScene;
|
||||
QWidget *tabMainWindow;
|
||||
DialogFileOperation *dialogFileOperation;
|
||||
QTextEdit *textEdit;
|
||||
PicTextItem *textItem;
|
||||
|
||||
|
||||
// QWidget interface
|
||||
protected:
|
||||
};
|
||||
|
||||
#endif // FORMSCENEDLG_H
|
||||
|
||||
+866
-866
File diff suppressed because it is too large
Load Diff
+64
-64
@@ -1,64 +1,64 @@
|
||||
#include "myview.h"
|
||||
#include <QWheelEvent>
|
||||
#include "picscene.h"
|
||||
#include <QDebug>
|
||||
MyView::MyView(QWidget *parent) :
|
||||
QGraphicsView(parent)
|
||||
{
|
||||
zoomRatio = 1;
|
||||
//setDragMode(QGraphicsView::ScrollHandDrag);//手型拖动
|
||||
//setAlignment(Qt::AlignLeft | Qt::AlignTop);
|
||||
//setFocusPolicy( Qt::NoFocus );
|
||||
}
|
||||
static float a = 1.61;
|
||||
void MyView::ZoomOut(void)
|
||||
{
|
||||
if(zoomRatio < 6)
|
||||
{
|
||||
zoomRatio++;
|
||||
// scale(2,2);
|
||||
scale(a,a);
|
||||
}
|
||||
}
|
||||
|
||||
void MyView::ZoomIn(void)
|
||||
{
|
||||
if(zoomRatio > 2)
|
||||
{
|
||||
zoomRatio--;
|
||||
scale(1/a,1/a);
|
||||
}
|
||||
}
|
||||
|
||||
//void MyView::wheelEvent(QWheelEvent*event) //滚轮事件
|
||||
//{
|
||||
//// if(event->delta() > 0) //如果鼠标滚轮远离使用者,则delta()返回正值
|
||||
//// scale(0.5,0.5); //视图缩放
|
||||
//// else scale(2,2);
|
||||
//}
|
||||
|
||||
|
||||
//void MyView::mousePressEvent(QMouseEvent*event)
|
||||
//{
|
||||
//// rotate(90); //视图旋转顺时针90度
|
||||
//}
|
||||
|
||||
void MyView::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
//event->accept();
|
||||
//parent()->event((QEvent*) event);
|
||||
if (event->key() == Qt::Key_Left || event->key() == Qt::Key_Right || event->key() == Qt::Key_Up || event->key() == Qt::Key_Down)
|
||||
{
|
||||
// 处理上下键事件
|
||||
PicScene* picScene = dynamic_cast<PicScene*>(this->scene());
|
||||
if(picScene)
|
||||
{
|
||||
picScene->keyPressEvent(event);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 其他键事件交给父类处理
|
||||
QGraphicsView::keyPressEvent(event);
|
||||
}
|
||||
}
|
||||
#include "myview.h"
|
||||
#include <QWheelEvent>
|
||||
#include "picscene.h"
|
||||
#include <QDebug>
|
||||
MyView::MyView(QWidget *parent) :
|
||||
QGraphicsView(parent)
|
||||
{
|
||||
zoomRatio = 1;
|
||||
//setDragMode(QGraphicsView::ScrollHandDrag);//手型拖动
|
||||
//setAlignment(Qt::AlignLeft | Qt::AlignTop);
|
||||
//setFocusPolicy( Qt::NoFocus );
|
||||
}
|
||||
static float a = 1.61;
|
||||
void MyView::ZoomOut(void)
|
||||
{
|
||||
if(zoomRatio < 6)
|
||||
{
|
||||
zoomRatio++;
|
||||
// scale(2,2);
|
||||
scale(a,a);
|
||||
}
|
||||
}
|
||||
|
||||
void MyView::ZoomIn(void)
|
||||
{
|
||||
if(zoomRatio > 2)
|
||||
{
|
||||
zoomRatio--;
|
||||
scale(1/a,1/a);
|
||||
}
|
||||
}
|
||||
|
||||
//void MyView::wheelEvent(QWheelEvent*event) //滚轮事件
|
||||
//{
|
||||
//// if(event->delta() > 0) //如果鼠标滚轮远离使用者,则delta()返回正值
|
||||
//// scale(0.5,0.5); //视图缩放
|
||||
//// else scale(2,2);
|
||||
//}
|
||||
|
||||
|
||||
//void MyView::mousePressEvent(QMouseEvent*event)
|
||||
//{
|
||||
//// rotate(90); //视图旋转顺时针90度
|
||||
//}
|
||||
|
||||
void MyView::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
//event->accept();
|
||||
//parent()->event((QEvent*) event);
|
||||
if (event->key() == Qt::Key_Left || event->key() == Qt::Key_Right || event->key() == Qt::Key_Up || event->key() == Qt::Key_Down)
|
||||
{
|
||||
// 处理上下键事件
|
||||
PicScene* picScene = dynamic_cast<PicScene*>(this->scene());
|
||||
if(picScene)
|
||||
{
|
||||
picScene->keyPressEvent(event);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 其他键事件交给父类处理
|
||||
QGraphicsView::keyPressEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
+29
-29
@@ -1,29 +1,29 @@
|
||||
#ifndef MYVIEW_H
|
||||
#define MYVIEW_H
|
||||
|
||||
#include <QGraphicsView>
|
||||
|
||||
class MyView : public QGraphicsView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MyView(QWidget *parent = 0);
|
||||
|
||||
void ZoomOut(void);
|
||||
void ZoomIn(void);
|
||||
//char getzoomRatio(){return zoomRatio;}
|
||||
private:
|
||||
char zoomRatio;
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
protected :
|
||||
// void wheelEvent(QWheelEvent *event);
|
||||
// void mousePressEvent(QMouseEvent *event);
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
|
||||
};
|
||||
|
||||
#endif // MYVIEW_H
|
||||
#ifndef MYVIEW_H
|
||||
#define MYVIEW_H
|
||||
|
||||
#include <QGraphicsView>
|
||||
|
||||
class MyView : public QGraphicsView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MyView(QWidget *parent = 0);
|
||||
|
||||
void ZoomOut(void);
|
||||
void ZoomIn(void);
|
||||
//char getzoomRatio(){return zoomRatio;}
|
||||
private:
|
||||
char zoomRatio;
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
protected :
|
||||
// void wheelEvent(QWheelEvent *event);
|
||||
// void mousePressEvent(QMouseEvent *event);
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
|
||||
};
|
||||
|
||||
#endif // MYVIEW_H
|
||||
|
||||
+117
-117
@@ -1,117 +1,117 @@
|
||||
#include "picscene.h"
|
||||
#include <QDebug>
|
||||
#include <QRectF>
|
||||
#include <QPainter>
|
||||
#include <QGraphicsView>
|
||||
PicScene::PicScene(QObject *parent) :
|
||||
QGraphicsScene(parent),IsdrawBackground(false)
|
||||
{
|
||||
}
|
||||
|
||||
void PicScene::setMode(Mode mode)
|
||||
{
|
||||
myMode = mode;
|
||||
}
|
||||
|
||||
void PicScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent)
|
||||
{
|
||||
if (mouseEvent->button() != Qt::LeftButton)
|
||||
return;
|
||||
|
||||
QGraphicsScene::mousePressEvent(mouseEvent);
|
||||
}
|
||||
|
||||
//! [9]
|
||||
|
||||
//! [10]
|
||||
void PicScene::mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent)
|
||||
{
|
||||
update();//edit@12-12
|
||||
QGraphicsScene::mouseMoveEvent(mouseEvent);
|
||||
}
|
||||
//! [10]
|
||||
|
||||
//! [11]
|
||||
void PicScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent)
|
||||
{
|
||||
QGraphicsScene::mouseReleaseEvent(mouseEvent);
|
||||
}
|
||||
//! [13]
|
||||
|
||||
//! [14]
|
||||
bool PicScene::isItemChange(int type)
|
||||
{
|
||||
foreach (QGraphicsItem *item, selectedItems()) {
|
||||
if (item->type() == type)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//! [14]
|
||||
|
||||
void PicScene::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
QGraphicsScene::keyPressEvent(event);
|
||||
}
|
||||
//edit@12-09
|
||||
void PicScene::drawBackground(QPainter *painter, const QRectF &rect)
|
||||
{
|
||||
QGraphicsScene::drawBackground(painter,rect);
|
||||
|
||||
if(IsdrawBackground)
|
||||
{
|
||||
Q_UNUSED(rect);
|
||||
QPen pen;
|
||||
|
||||
const qreal left=rect.left();
|
||||
const qreal right=rect.right();
|
||||
const qreal top=rect.top();
|
||||
const qreal bottom=rect.bottom();
|
||||
|
||||
const int step=1;
|
||||
//pen.setColor(QColor(60,60,60));
|
||||
pen.setColor(Qt::lightGray);
|
||||
//pen.setColor(Qt::darkCyan);
|
||||
pen.setWidth(0);
|
||||
//pen.setStyle(Qt::DashLine);
|
||||
painter->setPen(pen);
|
||||
//绘制横线
|
||||
//绘制Y轴正半轴
|
||||
for(int i=0;i>=top;i-=step)
|
||||
{
|
||||
painter->drawLine(left,i,right,i);
|
||||
}
|
||||
|
||||
//绘制Y轴负半轴
|
||||
for(int i=0;i<=bottom;i+=step)
|
||||
{
|
||||
painter->drawLine(left,i,right,i);
|
||||
}
|
||||
|
||||
//绘制竖线
|
||||
//绘制X轴正半轴
|
||||
for(int i=0;i<=right;i+=step)
|
||||
{
|
||||
painter->drawLine(i,top,i,bottom);
|
||||
}
|
||||
//绘制X轴负半轴
|
||||
for(int i=0;i>=left;i-=step)
|
||||
{
|
||||
painter->drawLine(i,top,i,bottom);
|
||||
}
|
||||
|
||||
//edit@12-11
|
||||
pen.setColor(Qt::green);
|
||||
painter->setPen(pen);
|
||||
QRectF BoundingRect=this->itemsBoundingRect();
|
||||
BoundingRect.setHeight(32);
|
||||
painter->drawRect(BoundingRect);
|
||||
}
|
||||
|
||||
emit showTextWidthHeight();
|
||||
}
|
||||
//edit@12-09
|
||||
void PicScene::setIsdrawBackground(bool newIsdrawBackground)
|
||||
{
|
||||
IsdrawBackground = newIsdrawBackground;
|
||||
}
|
||||
#include "picscene.h"
|
||||
#include <QDebug>
|
||||
#include <QRectF>
|
||||
#include <QPainter>
|
||||
#include <QGraphicsView>
|
||||
PicScene::PicScene(QObject *parent) :
|
||||
QGraphicsScene(parent),IsdrawBackground(false)
|
||||
{
|
||||
}
|
||||
|
||||
void PicScene::setMode(Mode mode)
|
||||
{
|
||||
myMode = mode;
|
||||
}
|
||||
|
||||
void PicScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent)
|
||||
{
|
||||
if (mouseEvent->button() != Qt::LeftButton)
|
||||
return;
|
||||
|
||||
QGraphicsScene::mousePressEvent(mouseEvent);
|
||||
}
|
||||
|
||||
//! [9]
|
||||
|
||||
//! [10]
|
||||
void PicScene::mouseMoveEvent(QGraphicsSceneMouseEvent *mouseEvent)
|
||||
{
|
||||
update();//edit@12-12
|
||||
QGraphicsScene::mouseMoveEvent(mouseEvent);
|
||||
}
|
||||
//! [10]
|
||||
|
||||
//! [11]
|
||||
void PicScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouseEvent)
|
||||
{
|
||||
QGraphicsScene::mouseReleaseEvent(mouseEvent);
|
||||
}
|
||||
//! [13]
|
||||
|
||||
//! [14]
|
||||
bool PicScene::isItemChange(int type)
|
||||
{
|
||||
foreach (QGraphicsItem *item, selectedItems()) {
|
||||
if (item->type() == type)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//! [14]
|
||||
|
||||
void PicScene::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
QGraphicsScene::keyPressEvent(event);
|
||||
}
|
||||
//edit@12-09
|
||||
void PicScene::drawBackground(QPainter *painter, const QRectF &rect)
|
||||
{
|
||||
QGraphicsScene::drawBackground(painter,rect);
|
||||
|
||||
if(IsdrawBackground)
|
||||
{
|
||||
Q_UNUSED(rect);
|
||||
QPen pen;
|
||||
|
||||
const qreal left=rect.left();
|
||||
const qreal right=rect.right();
|
||||
const qreal top=rect.top();
|
||||
const qreal bottom=rect.bottom();
|
||||
|
||||
const int step=1;
|
||||
//pen.setColor(QColor(60,60,60));
|
||||
pen.setColor(Qt::lightGray);
|
||||
//pen.setColor(Qt::darkCyan);
|
||||
pen.setWidth(0);
|
||||
//pen.setStyle(Qt::DashLine);
|
||||
painter->setPen(pen);
|
||||
//绘制横线
|
||||
//绘制Y轴正半轴
|
||||
for(int i=0;i>=top;i-=step)
|
||||
{
|
||||
painter->drawLine(left,i,right,i);
|
||||
}
|
||||
|
||||
//绘制Y轴负半轴
|
||||
for(int i=0;i<=bottom;i+=step)
|
||||
{
|
||||
painter->drawLine(left,i,right,i);
|
||||
}
|
||||
|
||||
//绘制竖线
|
||||
//绘制X轴正半轴
|
||||
for(int i=0;i<=right;i+=step)
|
||||
{
|
||||
painter->drawLine(i,top,i,bottom);
|
||||
}
|
||||
//绘制X轴负半轴
|
||||
for(int i=0;i>=left;i-=step)
|
||||
{
|
||||
painter->drawLine(i,top,i,bottom);
|
||||
}
|
||||
|
||||
//edit@12-11
|
||||
pen.setColor(Qt::green);
|
||||
painter->setPen(pen);
|
||||
QRectF BoundingRect=this->itemsBoundingRect();
|
||||
BoundingRect.setHeight(32);
|
||||
painter->drawRect(BoundingRect);
|
||||
}
|
||||
|
||||
emit showTextWidthHeight();
|
||||
}
|
||||
//edit@12-09
|
||||
void PicScene::setIsdrawBackground(bool newIsdrawBackground)
|
||||
{
|
||||
IsdrawBackground = newIsdrawBackground;
|
||||
}
|
||||
|
||||
+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
|
||||
|
||||
+100
-100
@@ -1,100 +1,100 @@
|
||||
#include <QtGui>
|
||||
#include "pictextitem.h"
|
||||
#include "picscene.h"
|
||||
#include "moveinput.h"
|
||||
|
||||
extern MoveInput* moveInput;
|
||||
PicTextItem::PicTextItem(QGraphicsItem *parent, QGraphicsScene *scene) :
|
||||
QGraphicsTextItem(parent)//edit@02-07
|
||||
{
|
||||
setFlag(QGraphicsItem::ItemIsMovable);
|
||||
setFlag(QGraphicsItem::ItemIsSelectable);
|
||||
setFlag(QGraphicsItem::ItemIsFocusable);
|
||||
QFont font;
|
||||
font.setFamily("wenquanyi");
|
||||
font.setPixelSize(12);
|
||||
document()->setDefaultStyleSheet("p { margin: 0; }");
|
||||
document()->setDocumentMargin(0);
|
||||
SpecialConditions = false;
|
||||
CatchCnt1CurrValue = -1;
|
||||
CatchCnt1StartValue = -1;
|
||||
|
||||
// 插入的变量贴底部,防止错位,修复打开文件时变量图片的垂直对齐
|
||||
document()->setDefaultStyleSheet("img { vertical-align: bottom; }");
|
||||
}
|
||||
//! [1]
|
||||
QVariant PicTextItem::itemChange(GraphicsItemChange change,
|
||||
const QVariant &value)
|
||||
{
|
||||
if (change == ItemSceneChange && scene()) {
|
||||
QPointF newPos = value.toPoint();
|
||||
QRectF rect = scene()->sceneRect();
|
||||
if (!rect.contains(newPos)) {
|
||||
newPos.setX(qMin(rect.right(), qMax(newPos.x(), rect.left())));
|
||||
newPos.setY(qMin(rect.bottom(), qMax(newPos.y(), rect.top())));
|
||||
}
|
||||
}
|
||||
return QGraphicsItem::itemChange(change, value);
|
||||
}
|
||||
//! [1]
|
||||
|
||||
//! [2]
|
||||
void PicTextItem::focusOutEvent(QFocusEvent *event)
|
||||
{
|
||||
moveInput->hide();
|
||||
emit lostFocus(this);
|
||||
QGraphicsTextItem::focusOutEvent(event);
|
||||
//
|
||||
}
|
||||
//! [2]
|
||||
|
||||
//! [5]
|
||||
void PicTextItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
//if (textInteractionFlags() == Qt::NoTextInteraction)
|
||||
// setTextInteractionFlags(Qt::TextEditorInteraction);
|
||||
//setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||
QGraphicsTextItem::mouseDoubleClickEvent(event);
|
||||
//emit itemEdit(toHtml());
|
||||
}
|
||||
//! [5]
|
||||
|
||||
//限制图元拖动范围
|
||||
void PicTextItem::mouseReleaseEvent ( QGraphicsSceneMouseEvent * event )
|
||||
{
|
||||
//edit@12-07
|
||||
QPointF newPos = this->pos();
|
||||
this->setPos(qCeil(newPos.x()),qCeil(newPos.y()));
|
||||
|
||||
if(scene())
|
||||
scene()->update();
|
||||
|
||||
QGraphicsTextItem::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
void PicTextItem::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
foreach (QGraphicsItem *item, scene()->selectedItems()) {
|
||||
if(event->key() == Qt::Key_Left)
|
||||
{
|
||||
item->moveBy(-1, 0);
|
||||
}
|
||||
else if(event->key() == Qt::Key_Right)
|
||||
{
|
||||
item->moveBy(1, 0);
|
||||
}
|
||||
else if(event->key() == Qt::Key_Up)
|
||||
{
|
||||
item->moveBy(0, -1);
|
||||
}
|
||||
else if(event->key() == Qt::Key_Down)
|
||||
{
|
||||
item->moveBy(0, 1);
|
||||
}
|
||||
}
|
||||
if(!scene()->selectedItems().empty())
|
||||
{
|
||||
scene()->update();
|
||||
}
|
||||
QGraphicsTextItem::keyPressEvent(event);
|
||||
}
|
||||
#include <QtGui>
|
||||
#include "pictextitem.h"
|
||||
#include "picscene.h"
|
||||
#include "moveinput.h"
|
||||
|
||||
extern MoveInput* moveInput;
|
||||
PicTextItem::PicTextItem(QGraphicsItem *parent, QGraphicsScene *scene) :
|
||||
QGraphicsTextItem(parent)//edit@02-07
|
||||
{
|
||||
setFlag(QGraphicsItem::ItemIsMovable);
|
||||
setFlag(QGraphicsItem::ItemIsSelectable);
|
||||
setFlag(QGraphicsItem::ItemIsFocusable);
|
||||
QFont font;
|
||||
font.setFamily("wenquanyi");
|
||||
font.setPixelSize(12);
|
||||
document()->setDefaultStyleSheet("p { margin: 0; }");
|
||||
document()->setDocumentMargin(0);
|
||||
SpecialConditions = false;
|
||||
CatchCnt1CurrValue = -1;
|
||||
CatchCnt1StartValue = -1;
|
||||
|
||||
// 插入的变量贴底部,防止错位,修复打开文件时变量图片的垂直对齐
|
||||
document()->setDefaultStyleSheet("img { vertical-align: bottom; }");
|
||||
}
|
||||
//! [1]
|
||||
QVariant PicTextItem::itemChange(GraphicsItemChange change,
|
||||
const QVariant &value)
|
||||
{
|
||||
if (change == ItemSceneChange && scene()) {
|
||||
QPointF newPos = value.toPoint();
|
||||
QRectF rect = scene()->sceneRect();
|
||||
if (!rect.contains(newPos)) {
|
||||
newPos.setX(qMin(rect.right(), qMax(newPos.x(), rect.left())));
|
||||
newPos.setY(qMin(rect.bottom(), qMax(newPos.y(), rect.top())));
|
||||
}
|
||||
}
|
||||
return QGraphicsItem::itemChange(change, value);
|
||||
}
|
||||
//! [1]
|
||||
|
||||
//! [2]
|
||||
void PicTextItem::focusOutEvent(QFocusEvent *event)
|
||||
{
|
||||
moveInput->hide();
|
||||
emit lostFocus(this);
|
||||
QGraphicsTextItem::focusOutEvent(event);
|
||||
//
|
||||
}
|
||||
//! [2]
|
||||
|
||||
//! [5]
|
||||
void PicTextItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
//if (textInteractionFlags() == Qt::NoTextInteraction)
|
||||
// setTextInteractionFlags(Qt::TextEditorInteraction);
|
||||
//setTextInteractionFlags(Qt::TextBrowserInteraction);
|
||||
QGraphicsTextItem::mouseDoubleClickEvent(event);
|
||||
//emit itemEdit(toHtml());
|
||||
}
|
||||
//! [5]
|
||||
|
||||
//限制图元拖动范围
|
||||
void PicTextItem::mouseReleaseEvent ( QGraphicsSceneMouseEvent * event )
|
||||
{
|
||||
//edit@12-07
|
||||
QPointF newPos = this->pos();
|
||||
this->setPos(qCeil(newPos.x()),qCeil(newPos.y()));
|
||||
|
||||
if(scene())
|
||||
scene()->update();
|
||||
|
||||
QGraphicsTextItem::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
void PicTextItem::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
foreach (QGraphicsItem *item, scene()->selectedItems()) {
|
||||
if(event->key() == Qt::Key_Left)
|
||||
{
|
||||
item->moveBy(-1, 0);
|
||||
}
|
||||
else if(event->key() == Qt::Key_Right)
|
||||
{
|
||||
item->moveBy(1, 0);
|
||||
}
|
||||
else if(event->key() == Qt::Key_Up)
|
||||
{
|
||||
item->moveBy(0, -1);
|
||||
}
|
||||
else if(event->key() == Qt::Key_Down)
|
||||
{
|
||||
item->moveBy(0, 1);
|
||||
}
|
||||
}
|
||||
if(!scene()->selectedItems().empty())
|
||||
{
|
||||
scene()->update();
|
||||
}
|
||||
QGraphicsTextItem::keyPressEvent(event);
|
||||
}
|
||||
|
||||
+42
-42
@@ -1,42 +1,42 @@
|
||||
#ifndef PICTEXTITEM_H
|
||||
#define PICTEXTITEM_H
|
||||
|
||||
#include <QGraphicsTextItem>
|
||||
#include <QPen>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
class QFocusEvent;
|
||||
class QGraphicsItem;
|
||||
class QGraphicsScene;
|
||||
class QGraphicsSceneMouseEvent;
|
||||
|
||||
class PicTextItem : public QGraphicsTextItem
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum { Type = UserType + 3 };
|
||||
explicit PicTextItem(QGraphicsItem *parent = 0, QGraphicsScene *scene = 0);
|
||||
|
||||
int type() const
|
||||
{ return Type; }
|
||||
|
||||
signals:
|
||||
void lostFocus(PicTextItem *item);
|
||||
void selectedChange(QGraphicsItem *item);
|
||||
void itemEdit(QString);
|
||||
|
||||
protected:
|
||||
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
|
||||
void focusOutEvent(QFocusEvent *event);
|
||||
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent * event);
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
|
||||
public slots:
|
||||
|
||||
public:
|
||||
bool SpecialConditions;
|
||||
int CatchCnt1StartValue;
|
||||
int CatchCnt1CurrValue;
|
||||
|
||||
};
|
||||
#endif // PICTEXTITEM_H
|
||||
#ifndef PICTEXTITEM_H
|
||||
#define PICTEXTITEM_H
|
||||
|
||||
#include <QGraphicsTextItem>
|
||||
#include <QPen>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
class QFocusEvent;
|
||||
class QGraphicsItem;
|
||||
class QGraphicsScene;
|
||||
class QGraphicsSceneMouseEvent;
|
||||
|
||||
class PicTextItem : public QGraphicsTextItem
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum { Type = UserType + 3 };
|
||||
explicit PicTextItem(QGraphicsItem *parent = 0, QGraphicsScene *scene = 0);
|
||||
|
||||
int type() const
|
||||
{ return Type; }
|
||||
|
||||
signals:
|
||||
void lostFocus(PicTextItem *item);
|
||||
void selectedChange(QGraphicsItem *item);
|
||||
void itemEdit(QString);
|
||||
|
||||
protected:
|
||||
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
|
||||
void focusOutEvent(QFocusEvent *event);
|
||||
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent * event);
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
|
||||
public slots:
|
||||
|
||||
public:
|
||||
bool SpecialConditions;
|
||||
int CatchCnt1StartValue;
|
||||
int CatchCnt1CurrValue;
|
||||
|
||||
};
|
||||
#endif // PICTEXTITEM_H
|
||||
|
||||
+186
-186
@@ -1,186 +1,186 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SceneEditOption</class>
|
||||
<widget class="QWidget" name="SceneEditOption">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>924</width>
|
||||
<height>58</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="previewButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>预览</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="newfileButton">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>新建</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="openfileButton">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>打开</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="saveButton">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>保存</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="saveAsButton">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>另存为</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="addButton">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>新增图元</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="EditItemButton">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>编辑图元</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="delButton">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>删除图元</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="enlargeButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>放大</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../image.qrc">
|
||||
<normaloff>:/icon/zoomin.png</normaloff>:/icon/zoomin.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="reduceButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>缩小</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../image.qrc">
|
||||
<normaloff>:/icon/zoomout.png</normaloff>:/icon/zoomout.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../image.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>SceneEditOption</class>
|
||||
<widget class="QWidget" name="SceneEditOption">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>924</width>
|
||||
<height>58</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="previewButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>预览</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="newfileButton">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>新建</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="openfileButton">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>打开</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="saveButton">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>保存</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="saveAsButton">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>另存为</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="addButton">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>新增图元</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="EditItemButton">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>编辑图元</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="delButton">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>删除图元</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="enlargeButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>放大</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../image.qrc">
|
||||
<normaloff>:/icon/zoomin.png</normaloff>:/icon/zoomin.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="reduceButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>缩小</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../image.qrc">
|
||||
<normaloff>:/icon/zoomout.png</normaloff>:/icon/zoomout.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../image.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "sceneviewwidget.h"
|
||||
#include <QGraphicsScene>
|
||||
|
||||
SceneViewWidget::SceneViewWidget(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
{
|
||||
|
||||
}
|
||||
#include "sceneviewwidget.h"
|
||||
#include <QGraphicsScene>
|
||||
|
||||
SceneViewWidget::SceneViewWidget(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
+18
-18
@@ -1,18 +1,18 @@
|
||||
#ifndef SCENEVIEWWIDGET_H
|
||||
#define SCENEVIEWWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QGraphicsView>
|
||||
class SceneViewWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SceneViewWidget(QWidget *parent = 0);
|
||||
QGraphicsView *pView;
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
};
|
||||
|
||||
#endif // SCENEVIEWWIDGET_H
|
||||
#ifndef SCENEVIEWWIDGET_H
|
||||
#define SCENEVIEWWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QGraphicsView>
|
||||
class SceneViewWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SceneViewWidget(QWidget *parent = 0);
|
||||
QGraphicsView *pView;
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
};
|
||||
|
||||
#endif // SCENEVIEWWIDGET_H
|
||||
|
||||
Reference in New Issue
Block a user