First commit for tool simple point

This commit is contained in:
dismine 2013-07-03 15:29:26 +03:00
parent 96cbc7b2d8
commit 65ad791e3e
20 changed files with 658 additions and 69 deletions

24
.hgignore Normal file
View File

@ -0,0 +1,24 @@
syntax: glob
# This line is a comment, and will be skipped.
# Empty lines are skipped too.
# Backup files left behind by the Emacs editor.
*~
# Lock files used by the Emacs editor.
# Notice that the "#" character is quoted with a backslash.
# This prevents it from being interpreted as starting a comment.
.\#*
# Temporary files used by the vim editor.
.*.swp
# A hidden file created by the Mac OS X Finder.
.DS_Store
# Ignore this directory.
html/
latex/
# Ignore file used QtCreator for user profile.
*.pro.user

View File

@ -13,8 +13,18 @@ TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp
mainwindow.cpp \
widgets/vmaingraphicsscene.cpp \
dialogs/dialogsinglepoint.cpp
HEADERS += mainwindow.h
HEADERS += mainwindow.h \
widgets/vmaingraphicsscene.h \
dialogs/dialogsinglepoint.h \
options.h
FORMS += mainwindow.ui
FORMS += mainwindow.ui \
dialogs/dialogsinglepoint.ui
RESOURCES += \
icon.qrc \
cursor.qrc

5
cursor.qrc Normal file
View File

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/">
<file>cursor/spoint_cursor.png</file>
</qresource>
</RCC>

BIN
cursor/spoint_cursor.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1,61 @@
#include "dialogsinglepoint.h"
#include "ui_dialogsinglepoint.h"
#include <QShowEvent>
#include <QPushButton>
#include "../options.h"
DialogSinglePoint::DialogSinglePoint(QWidget *parent) :
QDialog(parent),
ui(new Ui::DialogSinglePoint)
{
ui->setupUi(this);
isInitialized = false;
ui->spinBoxX->setRange(0,(qint32)(PaperSize*PrintDPI/25.4));
ui->spinBoxY->setRange(0,(qint32)(PaperSize*PrintDPI/25.4));
QPushButton* pOkButton = ui->buttonBox->button(QDialogButtonBox::Ok);
pOkButton->setEnabled(false);
connect(ui->lineEditName, &QLineEdit::textChanged, this, &DialogSinglePoint::NameChanged);
}
void DialogSinglePoint::mousePress(QPointF scenePos){
if(isInitialized == false){
ui->spinBoxX->setValue((qint32)(scenePos.x()*PrintDPI/25.4));
ui->spinBoxY->setValue((qint32)(scenePos.y()*PrintDPI/25.4));
this->show();
} else {
ui->spinBoxX->setValue((qint32)(scenePos.x()*PrintDPI/25.4));
ui->spinBoxY->setValue((qint32)(scenePos.y()*PrintDPI/25.4));
}
}
void DialogSinglePoint::showEvent( QShowEvent *event ){
QDialog::showEvent( event );
if( event->spontaneous() ){
return;
}
if(isInitialized){
return;
}
// do your init stuff here
isInitialized = true;//перший показ вікна вже відбувся
}
void DialogSinglePoint::NameChanged(){
QString name = ui->lineEditName->text();
if(name.isEmpty() || name.contains(" ")){
QPushButton* pOkButton = ui->buttonBox->button(QDialogButtonBox::Ok);
pOkButton->setEnabled(false);
} else {
QPushButton* pOkButton = ui->buttonBox->button(QDialogButtonBox::Ok);
pOkButton->setEnabled(true);
}
}
DialogSinglePoint::~DialogSinglePoint()
{
delete ui;
}

View File

@ -0,0 +1,27 @@
#ifndef DIALOGSINGLEPOINT_H
#define DIALOGSINGLEPOINT_H
#include <QDialog>
namespace Ui {
class DialogSinglePoint;
}
class DialogSinglePoint : public QDialog
{
Q_OBJECT
public:
explicit DialogSinglePoint(QWidget *parent = 0);
~DialogSinglePoint();
protected:
void showEvent( QShowEvent *event );
public slots:
void mousePress(QPointF scenePos);
void NameChanged();
private:
Ui::DialogSinglePoint *ui;
bool isInitialized;
};
#endif // DIALOGSINGLEPOINT_H

View File

@ -0,0 +1,132 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogSinglePoint</class>
<widget class="QDialog" name="DialogSinglePoint">
<property name="windowModality">
<enum>Qt::WindowModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>249</width>
<height>202</height>
</rect>
</property>
<property name="windowTitle">
<string>Параметри точки</string>
</property>
<property name="modal">
<bool>false</bool>
</property>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>10</x>
<y>40</y>
<width>241</width>
<height>129</height>
</rect>
</property>
<property name="title">
<string>Координати</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="QSpinBox" name="spinBoxY"/>
</item>
<item row="1" column="1">
<widget class="QLabel" name="labelYCor">
<property name="text">
<string>Y координата</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QSpinBox" name="spinBoxX"/>
</item>
<item row="0" column="1">
<widget class="QLabel" name="labelXCor">
<property name="text">
<string>Х координата</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QLabel" name="labelName">
<property name="geometry">
<rect>
<x>170</x>
<y>10</y>
<width>72</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>Ім'я точки</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEditName">
<property name="geometry">
<rect>
<x>15</x>
<y>9</y>
<width>146</width>
<height>27</height>
</rect>
</property>
</widget>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>20</x>
<y>170</y>
<width>221</width>
<height>27</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>DialogSinglePoint</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>DialogSinglePoint</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

9
icon.qrc Normal file
View File

@ -0,0 +1,9 @@
<RCC>
<qresource prefix="/">
<file>icon/64x64/icon64x64.png</file>
<file>icon/32x32/draw.png</file>
<file>icon/32x32/kontur.png</file>
<file>icon/32x32/spoint.png</file>
<file>icon/32x32/arrow_cursor.png</file>
</qresource>
</RCC>

BIN
icon/32x32/arrow_cursor.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
icon/32x32/draw.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
icon/32x32/kontur.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
icon/32x32/spoint.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
icon/64x64/icon64x64.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@ -1,11 +1,13 @@
#include "mainwindow.h"
#include <QApplication>
#include <QTextCodec>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QApplication app(argc, argv);
MainWindow w;
app.setWindowIcon(QIcon(":/icon/64x64/icon64x64.png"));
w.show();
return a.exec();
return app.exec();
}

View File

@ -2,21 +2,167 @@
#include "ui_mainwindow.h"
#include <QComboBox>
#include <QLabel>
#include <QSpinBox>
#include <QScrollBar>
#include <QShowEvent>
#include "options.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
QMainWindow(parent), ui(new Ui::MainWindow)
{
ui->setupUi(this);
tool = Tools::ArrayTool;
isInitialized = false;
ToolBarOption();
ToolBarDraws();
QRectF sceneRect = QRectF(0, 0, PaperSize*PrintDPI/25.4, PaperSize*PrintDPI/25.4);
scene = new VMainGraphicsScene(sceneRect);
ui->graphicsView->setScene(scene);
connect(scene, &VMainGraphicsScene::mouseMove, this, &MainWindow::mouseMove);
connect(ui->toolButtonSinglePoint, &QToolButton::clicked, this,
&MainWindow::clickedToolButtonSinglePoint);
helpLabel = new QLabel("Створіть новий файл для початку роботи.");
ui->statusBar->addWidget(helpLabel);
connect(ui->actionArrowTool, &QAction::triggered, this, &MainWindow::triggeredActionAroowTool);
}
/*
* Інструмет базова точка креслення.
*/
void MainWindow::clickedToolButtonSinglePoint(){
tool = Tools::SinglePointTool;
QPixmap pixmap(":/cursor/spoint_cursor.png");
QCursor cur(pixmap, 2, 3);
ui->graphicsView->setCursor(cur);
helpLabel->setText("Виберіть розташування для точки.");
dialogSinglePoint = new DialogSinglePoint;
connect(scene, &VMainGraphicsScene::mousePress, dialogSinglePoint, &DialogSinglePoint::mousePress);
}
void MainWindow::showEvent( QShowEvent *event ){
QMainWindow::showEvent( event );
if( event->spontaneous() ){
return;
}
if(isInitialized){
return;
}
// do your init stuff here
QScrollBar *horScrollBar = ui->graphicsView->horizontalScrollBar();
horScrollBar->setValue(horScrollBar->minimum());
QScrollBar *verScrollBar = ui->graphicsView->verticalScrollBar();
verScrollBar->setValue(verScrollBar->minimum());
isInitialized = true;//перший показ вікна вже відбувся
}
void MainWindow::ToolBarOption(){
QLabel * labelGrowth = new QLabel;
labelGrowth->setText("Зріст: ");
ui->toolBarOption->addWidget(labelGrowth);
QStringList list;
list << "104"<<"110"<<"116"<<"122"<<"128"<<"134"<<"140"<<"146"<<"152"<<"158"<<"164"<<"170"<<"176"
<< "182" << "188";
QComboBox* comboBoxGrow = new QComboBox;
comboBoxGrow->clear();
comboBoxGrow->addItems(list);
comboBoxGrow->setCurrentIndex(12);
ui->toolBarOption->addWidget(comboBoxGrow);
QLabel * labelSize = new QLabel;
labelSize->setText(" Розмір: ");
ui->toolBarOption->addWidget(labelSize);
list.clear();
list << "28"<<"30"<<"32"<<"34"<<"36"<<"38"<<"40"<<"42"<<"44"<<"46"<<"48"<<"50" << "52" << "54" << "56";
QComboBox* comboBoxSize = new QComboBox;
comboBoxSize ->clear();
comboBoxSize->clear();
comboBoxSize->addItems(list);
comboBoxSize->setCurrentIndex(11);
ui->toolBarOption->addWidget(comboBoxSize);
ui->toolBarOption->addSeparator();
mouseCoordinate = new QLabel;
mouseCoordinate ->setText("0, 0");
ui->toolBarOption->addWidget(mouseCoordinate);
}
void MainWindow::ToolBarDraws(){
QLabel * labelNameDraw = new QLabel;
labelNameDraw ->setText("Креслення: ");
ui->toolBarDraws->addWidget(labelNameDraw);
QComboBox* comboBoxDraws = new QComboBox;
ui->toolBarDraws->addWidget(comboBoxDraws);
ui->toolBarDraws->addSeparator();
QLabel* labelTranslateX = new QLabel;
labelTranslateX ->setText(" Зміщення по Х: ");
ui->toolBarDraws->addWidget(labelTranslateX);
QSpinBox* spinBoxTranslateX = new QSpinBox;
spinBoxTranslateX->setRange(0,(qint32)(PaperSize*PrintDPI/25.4));
spinBoxTranslateX->setFixedSize(80,25);
ui->toolBarDraws->addWidget(spinBoxTranslateX);
QLabel* labelTranslateY = new QLabel;
labelTranslateY ->setText(" Зміщення по Y: ");
ui->toolBarDraws->addWidget(labelTranslateY);
QSpinBox* spinBoxTranslateY = new QSpinBox;
spinBoxTranslateY->setRange(0,(qint32)(PaperSize*PrintDPI/25.4));
spinBoxTranslateY->setFixedSize(80,25);
ui->toolBarDraws->addWidget(spinBoxTranslateY);
QPushButton* pushButtonTranslate = new QPushButton;
pushButtonTranslate->setText("Застосувати");
ui->toolBarDraws->addWidget(pushButtonTranslate);
}
void MainWindow::mouseMove(QPointF scenePos){
QString string = QString("%1, %2")
.arg((qint32)(scenePos.x()*PrintDPI/25.4))
.arg((qint32)(scenePos.y()*PrintDPI/25.4));
mouseCoordinate->setText(string);
}
void MainWindow::CanselTool(){
switch( tool )
{
case Tools::ArrowTool:
//Покищо нічого тут не робимо.
break;
case Tools::SinglePointTool:
//Знищимо діалогове вікно.
delete dialogSinglePoint;
break;
}
}
void MainWindow::ArrowTool(){
CanselTool();
tool = Tools::ArrowTool;
QCursor cur(Qt::ArrowCursor);
ui->graphicsView->setCursor(cur);
helpLabel->setText("");
}
void MainWindow::triggeredActionAroowTool(){
ArrowTool();
}
MainWindow::~MainWindow()
{
CanselTool();
delete ui;
}

View File

@ -2,21 +2,46 @@
#define MAINWINDOW_H
#include <QMainWindow>
#include <QLabel>
#include "widgets/vmaingraphicsscene.h"
#include "dialogs/dialogsinglepoint.h"
namespace Ui {
class MainWindow;
}
namespace Tools{
enum Enum
{
ArrowTool,
SinglePointTool
};
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
public slots:
void mouseMove(QPointF scenePos);
void showEvent( QShowEvent *event );
void clickedToolButtonSinglePoint();
void triggeredActionAroowTool();
private:
Ui::MainWindow *ui;
Ui::MainWindow *ui;
Tools::Enum tool;
VMainGraphicsScene *scene;
QLabel *mouseCoordinate;
QLabel *helpLabel;
bool isInitialized;
DialogSinglePoint *dialogSinglePoint;
void ToolBarOption();
void ToolBarDraws();
void CanselTool();
void ArrowTool();
};
#endif // MAINWINDOW_H

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>1000</width>
<width>1100</width>
<height>700</height>
</rect>
</property>
@ -14,9 +14,37 @@
<string>Valentina</string>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" alignment="Qt::AlignTop">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="2">
<widget class="QGraphicsView" name="graphicsView">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>6</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>922</width>
<height>582</height>
</size>
</property>
<property name="mouseTracking">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignRight|Qt::AlignTrailing</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QToolBox" name="toolBox">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="currentIndex">
<number>0</number>
</property>
@ -25,42 +53,72 @@
<rect>
<x>0</x>
<y>0</y>
<width>117</width>
<height>111</height>
<width>154</width>
<height>81</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<attribute name="label">
<string>Точка</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QPushButton" name="pushButton">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="3">
<widget class="QToolButton" name="toolButton_5">
<property name="text">
<string>PushButton</string>
<string>...</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup</string>
</attribute>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_2">
<item row="0" column="1">
<widget class="QToolButton" name="toolButton_2">
<property name="text">
<string>PushButton</string>
<string>...</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup</string>
</attribute>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_3">
<item row="0" column="2">
<widget class="QToolButton" name="toolButton_3">
<property name="text">
<string>PushButton</string>
<string>...</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QToolButton" name="toolButtonSinglePoint">
<property name="toolTip">
<string>Точка</string>
</property>
<property name="statusTip">
<string/>
</property>
<property name="text">
<string>Точка</string>
</property>
<property name="icon">
<iconset resource="icon.qrc">
<normaloff>:/icon/32x32/spoint.png</normaloff>:/icon/32x32/spoint.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QToolButton" name="toolButton_4">
<property name="text">
<string>...</string>
</property>
<attribute name="buttonGroup">
<string notr="true">buttonGroup</string>
</attribute>
</widget>
</item>
</layout>
@ -70,15 +128,21 @@
<rect>
<x>0</x>
<y>0</y>
<width>117</width>
<width>154</width>
<height>111</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<attribute name="label">
<string>Лінія</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QPushButton" name="pushButton_4">
<property name="text">
<string>PushButton</string>
@ -88,7 +152,7 @@
</attribute>
</widget>
</item>
<item>
<item row="1" column="0">
<widget class="QPushButton" name="pushButton_5">
<property name="text">
<string>PushButton</string>
@ -98,7 +162,7 @@
</attribute>
</widget>
</item>
<item>
<item row="2" column="0">
<widget class="QPushButton" name="pushButton_6">
<property name="text">
<string>PushButton</string>
@ -115,15 +179,21 @@
<rect>
<x>0</x>
<y>0</y>
<width>117</width>
<height>73</height>
<width>154</width>
<height>45</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<attribute name="label">
<string>Сплайн</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QPushButton" name="pushButton_7">
<property name="text">
<string>PushButton</string>
@ -137,15 +207,21 @@
<rect>
<x>0</x>
<y>0</y>
<width>117</width>
<height>73</height>
<width>154</width>
<height>45</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<attribute name="label">
<string>Дуга</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QPushButton" name="pushButton_8">
<property name="text">
<string>PushButton</string>
@ -156,16 +232,6 @@
</widget>
</widget>
</item>
<item row="0" column="1">
<widget class="QGraphicsView" name="graphicsView">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>2</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QMenuBar" name="menuBar">
@ -173,7 +239,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>1000</width>
<width>1100</width>
<height>25</height>
</rect>
</property>
@ -203,6 +269,7 @@
</attribute>
<addaction name="actionDraw"/>
<addaction name="actionDetails"/>
<addaction name="actionArrowTool"/>
</widget>
<widget class="QToolBar" name="toolBarDraws">
<property name="windowTitle">
@ -223,7 +290,7 @@
<enum>BottomToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>true</bool>
<bool>false</bool>
</attribute>
</widget>
<action name="actionNew">
@ -282,6 +349,16 @@
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="enabled">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="icon.qrc">
<normaloff>:/icon/32x32/draw.png</normaloff>:/icon/32x32/draw.png</iconset>
</property>
<property name="text">
<string>Креслення</string>
</property>
@ -290,6 +367,13 @@
</property>
</action>
<action name="actionDetails">
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="icon.qrc">
<normaloff>:/icon/32x32/kontur.png</normaloff>:/icon/32x32/kontur.png</iconset>
</property>
<property name="text">
<string>Деталі</string>
</property>
@ -297,9 +381,29 @@
<string>Режим деталі</string>
</property>
</action>
<action name="actionArrowTool">
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="icon.qrc">
<normaloff>:/icon/32x32/arrow_cursor.png</normaloff>:/icon/32x32/arrow_cursor.png</iconset>
</property>
<property name="text">
<string>Інструмент вказівник</string>
</property>
<property name="toolTip">
<string>Інструмент вказівник</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<resources>
<include location="icon.qrc"/>
</resources>
<connections/>
<buttongroups>
<buttongroup name="buttonGroup_2">
@ -307,10 +411,5 @@
<bool>false</bool>
</property>
</buttongroup>
<buttongroup name="buttonGroup">
<property name="exclusive">
<bool>false</bool>
</property>
</buttongroup>
</buttongroups>
</ui>

7
options.h Normal file
View File

@ -0,0 +1,7 @@
#ifndef OPTIONS_H
#define OPTIONS_H
#define PrintDPI 96
#define PaperSize 50000
#endif // OPTIONS_H

View File

@ -0,0 +1,21 @@
#include "vmaingraphicsscene.h"
VMainGraphicsScene::VMainGraphicsScene():QGraphicsScene()
{
}
VMainGraphicsScene::VMainGraphicsScene(const QRectF & sceneRect, QObject * parent):QGraphicsScene ( sceneRect, parent )
{
}
void VMainGraphicsScene::mouseMoveEvent(QGraphicsSceneMouseEvent* event){
emit mouseMove(event->scenePos());
QGraphicsScene::mouseMoveEvent(event);
}
void VMainGraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent *event){
emit mousePress(event->scenePos());
QGraphicsScene::mousePressEvent(event);
}

View File

@ -0,0 +1,21 @@
#ifndef VMAINGRAPHICSSCENE_H
#define VMAINGRAPHICSSCENE_H
#include <QGraphicsScene>
#include <QGraphicsSceneMouseEvent>
class VMainGraphicsScene : public QGraphicsScene
{
Q_OBJECT
public:
VMainGraphicsScene();
VMainGraphicsScene(const QRectF & sceneRect, QObject * parent = 0);
private:
void mouseMoveEvent(QGraphicsSceneMouseEvent* event);
void mousePressEvent(QGraphicsSceneMouseEvent *event);
signals:
void mouseMove(QPointF scenePos);
void mousePress(QPointF scenePos);
};
#endif // VMAINGRAPHICSSCENE_H