From 65ad791e3ec5d8aaf177121ed4edd36303fea86b Mon Sep 17 00:00:00 2001 From: dismine Date: Wed, 3 Jul 2013 15:29:26 +0300 Subject: [PATCH] First commit for tool simple point --- .hgignore | 24 ++++ Valentina.pro | 16 ++- cursor.qrc | 5 + cursor/spoint_cursor.png | Bin 0 -> 1264 bytes dialogs/dialogsinglepoint.cpp | 61 ++++++++++ dialogs/dialogsinglepoint.h | 27 +++++ dialogs/dialogsinglepoint.ui | 132 +++++++++++++++++++++ icon.qrc | 9 ++ icon/32x32/arrow_cursor.png | Bin 0 -> 1141 bytes icon/32x32/draw.png | Bin 0 -> 2829 bytes icon/32x32/kontur.png | Bin 0 -> 1917 bytes icon/32x32/spoint.png | Bin 0 -> 1764 bytes icon/64x64/icon64x64.png | Bin 0 -> 5572 bytes main.cpp | 6 +- mainwindow.cpp | 152 +++++++++++++++++++++++- mainwindow.h | 37 +++++- mainwindow.ui | 209 ++++++++++++++++++++++++--------- options.h | 7 ++ widgets/vmaingraphicsscene.cpp | 21 ++++ widgets/vmaingraphicsscene.h | 21 ++++ 20 files changed, 658 insertions(+), 69 deletions(-) create mode 100644 .hgignore create mode 100644 cursor.qrc create mode 100644 cursor/spoint_cursor.png create mode 100644 dialogs/dialogsinglepoint.cpp create mode 100644 dialogs/dialogsinglepoint.h create mode 100644 dialogs/dialogsinglepoint.ui create mode 100644 icon.qrc create mode 100644 icon/32x32/arrow_cursor.png create mode 100644 icon/32x32/draw.png create mode 100644 icon/32x32/kontur.png create mode 100644 icon/32x32/spoint.png create mode 100644 icon/64x64/icon64x64.png create mode 100644 options.h create mode 100644 widgets/vmaingraphicsscene.cpp create mode 100644 widgets/vmaingraphicsscene.h diff --git a/.hgignore b/.hgignore new file mode 100644 index 000000000..6f58ef173 --- /dev/null +++ b/.hgignore @@ -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 diff --git a/Valentina.pro b/Valentina.pro index 620921789..0a3e5acd1 100644 --- a/Valentina.pro +++ b/Valentina.pro @@ -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 diff --git a/cursor.qrc b/cursor.qrc new file mode 100644 index 000000000..bacb46320 --- /dev/null +++ b/cursor.qrc @@ -0,0 +1,5 @@ + + + cursor/spoint_cursor.png + + diff --git a/cursor/spoint_cursor.png b/cursor/spoint_cursor.png new file mode 100644 index 0000000000000000000000000000000000000000..6aaeb759ef717e05277d1ebce1d93378940f7fd3 GIT binary patch literal 1264 zcmVVl&|00006VoOIv0RI60 z0RN!9r;`8x010qNS#tmY3ljhU3ljkVnw%H_000McNliru-3I{@DmvaRe4qdT06}y` zSad^gZEa<4bO1wAML|?gQaT`KWG!lNWoICEF)lD5D0OpbZf77#N=G0{P(?=|b~Z98 zEFf`pVQgu1c_2L?IWP*aMOc#n00b~eL_t(Y$HiA|NLyDJeopR)tjP~~SUGs*926n6kw6?Y` z+U<6#sHh+!I&-Ya%gf8}0HEC5TuNM@n3zavUJ(F9Q3L=4gF*6mJfziXk(Za}aXOt> zl78~a%E~(cNDu^Kj1d6xdcD2L&Z|kB$g&Kg9psmnmrpl0H@A4b-jZWExq5naFvh5) zq=b5Vdoz;8d15Gv0stT)XfzsFtya|3)T}2BcE)zDHe)RQtQOMM)dj{F*=#l{C@9b; zjdPXn#9)j;6h#mb#>U1%>Uv*aA4?kSiNQHXAP^w8+fAHvxZQ44S63fR^1V*1h9C%# zWf=ficXu}cpscLy=waUra?Ux32t*V&qq(^`0I(Dl6+LsLS1oaU4n+#(NilV?|GLh5i zWZT=@yBv>m9(O(>f+R@*0K473KOU>9s^a||0BJOu_!V=xT>HLGqobp2-<&Io0*yu! z?`W#9dU|^H)lv%!3+cjzdW0k4^s7H!gw+Ke7-LvNt!#TZ8~3mDR6u27Hw{AvW3*RLZQ4YNS-AvQL{Ad*2~AOH+> z{+2EUQY3In{dE2qfO&d)nkFYFD;y5Tz+oCjBoYGWGPo=u7L7tyIR1VR06<95>ac8> zg3+ko5!~S5;DD-nhr@B`E_v=;A?9cQfId}+bh8l)^D9t@AtuR?BndL##+m2xBn^@f zXC02WPCjizW`+r|C`X#f0FzM +#include + +#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; +} diff --git a/dialogs/dialogsinglepoint.h b/dialogs/dialogsinglepoint.h new file mode 100644 index 000000000..70d861d2c --- /dev/null +++ b/dialogs/dialogsinglepoint.h @@ -0,0 +1,27 @@ +#ifndef DIALOGSINGLEPOINT_H +#define DIALOGSINGLEPOINT_H + +#include + +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 diff --git a/dialogs/dialogsinglepoint.ui b/dialogs/dialogsinglepoint.ui new file mode 100644 index 000000000..a57a23848 --- /dev/null +++ b/dialogs/dialogsinglepoint.ui @@ -0,0 +1,132 @@ + + + DialogSinglePoint + + + Qt::WindowModal + + + + 0 + 0 + 249 + 202 + + + + Параметри точки + + + false + + + + + 10 + 40 + 241 + 129 + + + + Координати + + + + + + + + + Y координата + + + + + + + + + + Х координата + + + + + + + + + 170 + 10 + 72 + 17 + + + + Ім'я точки + + + + + + 15 + 9 + 146 + 27 + + + + + + + 20 + 170 + 221 + 27 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + buttonBox + accepted() + DialogSinglePoint + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + DialogSinglePoint + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/icon.qrc b/icon.qrc new file mode 100644 index 000000000..257b236f6 --- /dev/null +++ b/icon.qrc @@ -0,0 +1,9 @@ + + + icon/64x64/icon64x64.png + icon/32x32/draw.png + icon/32x32/kontur.png + icon/32x32/spoint.png + icon/32x32/arrow_cursor.png + + diff --git a/icon/32x32/arrow_cursor.png b/icon/32x32/arrow_cursor.png new file mode 100644 index 0000000000000000000000000000000000000000..b0df739d1c4d7a11e2456f01a50605b85f9f2fe6 GIT binary patch literal 1141 zcmV-*1d98KP)Yinzq0z*SX3IGB?Hk*yY;V@Zw{*wxn%Vhun z&+`xj0XCZr0II4kK004MA z9`y9|Ad|@;l}e$hsR<2Lz(i+fC$_h@q3b&B?(UMNX_%dz{XQHHe_<&B^J23Y>k)}W zkk9AY#KeTzvVVTq!!yPzmJl#6HdF9Oao)z`@lR|v8&p-DnwpxLh{a-k08T6!6oZ3< z3ILj$o1>@D-Q7(ehSp~QaC&;mEK9+|8h8xBU=S{s3zL(RzvptfZ+V z@u3$HFyDZOxVyW9*#))n%5h+fVQXtk1Q6vo?&S&yf>5i4dNt~6!|8OAuIr3329Dz( ziXt>kgU93fcmh2CK1A1b0KnnlAwr>0O%);nV+=%uwY9Y$$HvCKE|p5e^E?WL0whU7 zwOUON3=Cj+c=+SHfa5qQiULj3;Pd%l7zVQ0EQkmk$DvxS;_B)uZ@1fzEHxy7K%izw zTrL-dLLn-b%Ri)2sgfi~HKPK6Ha0dkEPsyc^PSJKg#Kxw-i=nM^Jx5{aKog}h!bdA(lh=;-LOj6g6L zQ~=P($Oxs=Y4^kRgM))80OB~#9K$4v;uaH*1d7EXDwV&Sn6B$Q5pkA0 z$IpQ*%TN>rJkO(4DxtTxml$J4L-N15x%sI5+TY**&wcLzzBuS2wN^=h00000NkvXX Hu0mjfU0Vfx literal 0 HcmV?d00001 diff --git a/icon/32x32/draw.png b/icon/32x32/draw.png new file mode 100644 index 0000000000000000000000000000000000000000..db49026c4fe3e1344f971e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BO2MGxa4Gj+w5fc>^Q&m-0Sy@$9R>;uLD={zB z+SuIU-ykC)cGS+Q!h$qOkI@8AfYk6=_n%x`=#b?IO{3jR)Oi(^L0`yM58_gg$w^_C?7xz20J(nw_6;oRS9}4oTm*PH*Y%)DEk= zr{)JweE!k&bx1E;%(evxTCf^tmzw~aq#344)QXi#u~rp!Nj2XYY_}n3&ivK<;RSTGjUXcB zaxRxES8BqNbXsk&E!|nN8OIiR1DZ-#i@Uj8JP_N7mn$M+$E9ht$+oa$Gc_&pds!kA zS&L!k&-hU+wq2=-`T+rcWybvNECe}RQHF?wLuY$?5u|4ejpd3}FzNKy#!0JLJLQBp zI-AObpJQiw5ETr=TY>E|Ao?$jtBoepl_5J61VCi%4chZLtW?MqFdEw~S9n6#tu<=L zCZHh2;Ja%96ybH5tPbXgH;EA)c(x{x#$UuSKQNHXT3TA<@CF($7hAi)!a4`1Zb5k} zO^^UUV1>NiXtc-_Dt?Zd=!+4J#iG9jhD_rC*!oAM{883uH0lZ%!FF=Rwtne^Uazx5 zPMX0!(vAU#*3!DTPr_%DqaWcU>Hfjze!_1GMtaT%;^mrv zIuQ5So8k3P4{&nxzt!LGZ)|{V_x64U464k2VPNGj+{^UC#{}tn8bDG1mfwH&|4=wn zO_%l$xYvh)fmrIVKQ>8UDE0;mV1ZaDyqh6}r2@+ywZla{{FB)9`P|!~wddg%kxZ2- z74ly1hgiE3kM5o8oJ_2Qqe2} z#3=PLk?;fuPqmZtcoOv9OPWq5U99)h1$S^kmSw#kRr?*q@3VtPHj6g^0000jc( literal 0 HcmV?d00001 diff --git a/icon/64x64/icon64x64.png b/icon/64x64/icon64x64.png new file mode 100644 index 0000000000000000000000000000000000000000..d6cc04903f539377c7f862ebd11eeee447dac67b GIT binary patch literal 5572 zcmV;#6+7yQP)&s!4MVZ@TxMv-8Kp0!(4t z9ZHB^*=yBW@720{pZ)Fn_Bs3PeM|U|$v@79Q-1OG-~IK3aY0*@))^Ev;`5Zt*RJjN zZ+&L*o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*`@cS5`$Z@4aX$ZaSjSbcqB2kyi zxSwCJYU?|ce)83>?&8RYzq+ir%8g*1n>wxcb<(cecc)jbp{yZmLceMd-L(;I)ubDLR7} zA#o}h>j==Z?_Srvi~S^~l9;+z25du2?Ft$hs0&~)F;u*%4o@3>q0Vpx>Wh6DnsIugi^}Rn{G;{oZ z>($D+liSC5u^X-7An{5l9)~cP;1bUX_dnP3liEsSgPdR^DVfNU-{iY%0kh-w;x^90eB&r&y(w=pD!$8hoymrUXH>QkX ze~bC?i`!k+xEB-eDf`-+*4{%~og*7C{lTuLO95_L^M?%}7SCzt_BW2M3#J!twZi{Y zk-S&bd6A)5us~DbMey;VWBex<|Dt!xqM4mswqe))4*1S`W{%`!uAHBoKe>v&RPF2sKv6s$nKWx#g!qbuE{Gn9p(?qqJs8}Eq zpiQA?z?uF8Gxc--uw(t-p4`ICPj~S_$iBP4*Jc!+%Vp%qri`+uRC`AkAZt~#sP0V6 zwXWiBxa+yTcsN7fJ1tM&*7`r`E!(qG_;e_0#^tKV<}E?Ft)NVK9arCA2a0 zk~K==Ayz|Z1m{&V#!KSOs@+vi`Tmyf{)ICNEL+pV2Q6=Fir#okXY{L*z93!?X$;UX z5UDzY7)ZU6GY%0*)R3sqkf{wY$}#Lp1mis3E4e^0Mo3gp@rXz3#NC?zDrXVjguY-8_30E=gKvg8BW@P2PUV8!|_&YE0c`NqCtOD3MT zyUfqLSILMp z<>9LHx7@e6XFb5hQ`@;|eJ=;13_BWIFlj8eKeH2n(n&NsqeI^Ge|J-t|MH{`?s=x016kg4IQpfD1-`ra&E5K($;}yW zbK{zA>SJ$YW@~llU;d9h18>zi@9;M6_+=meU&+c(zIUB|+7bM_{JVU} +#include 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(); } diff --git a/mainwindow.cpp b/mainwindow.cpp index 39c3d43de..d4035deac 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -2,21 +2,167 @@ #include "ui_mainwindow.h" #include +#include +#include +#include +#include + +#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; } diff --git a/mainwindow.h b/mainwindow.h index 112fda1c4..1fadc45c5 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -2,21 +2,46 @@ #define MAINWINDOW_H #include +#include + +#include "widgets/vmaingraphicsscene.h" +#include "dialogs/dialogsinglepoint.h" namespace Ui { class MainWindow; } +namespace Tools{ + enum Enum + { + ArrowTool, + SinglePointTool + }; +} + class MainWindow : public QMainWindow { - Q_OBJECT - + 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 diff --git a/mainwindow.ui b/mainwindow.ui index d9f56532d..300d96322 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -6,7 +6,7 @@ 0 0 - 1000 + 1100 700 @@ -14,9 +14,37 @@ Valentina - - + + + + + + 6 + 0 + + + + + 922 + 582 + + + + true + + + Qt::AlignBottom|Qt::AlignRight|Qt::AlignTrailing + + + + + + + 1 + 0 + + 0 @@ -25,42 +53,72 @@ 0 0 - 117 - 111 + 154 + 81 + + + 0 + 0 + + Точка - - - + + + - PushButton + ... - - buttonGroup - - - + + - PushButton + ... - - buttonGroup - - - + + - PushButton + ... + + + + + + + Точка + + + + + + Точка + + + + :/icon/32x32/spoint.png:/icon/32x32/spoint.png + + + + 24 + 24 + + + + true + + + + + + + ... - - buttonGroup - @@ -70,15 +128,21 @@ 0 0 - 117 + 154 111 + + + 0 + 0 + + Лінія - - + + PushButton @@ -88,7 +152,7 @@ - + PushButton @@ -98,7 +162,7 @@ - + PushButton @@ -115,15 +179,21 @@ 0 0 - 117 - 73 + 154 + 45 + + + 0 + 0 + + Сплайн - - + + PushButton @@ -137,15 +207,21 @@ 0 0 - 117 - 73 + 154 + 45 + + + 0 + 0 + + Дуга - - + + PushButton @@ -156,16 +232,6 @@ - - - - - 2 - 0 - - - - @@ -173,7 +239,7 @@ 0 0 - 1000 + 1100 25 @@ -203,6 +269,7 @@ + @@ -223,7 +290,7 @@ BottomToolBarArea - true + false @@ -282,6 +349,16 @@ true + + true + + + true + + + + :/icon/32x32/draw.png:/icon/32x32/draw.png + Креслення @@ -290,6 +367,13 @@ + + true + + + + :/icon/32x32/kontur.png:/icon/32x32/kontur.png + Деталі @@ -297,9 +381,29 @@ Режим деталі + + + true + + + true + + + + :/icon/32x32/arrow_cursor.png:/icon/32x32/arrow_cursor.png + + + Інструмент вказівник + + + Інструмент вказівник + + - + + + @@ -307,10 +411,5 @@ false - - - false - - diff --git a/options.h b/options.h new file mode 100644 index 000000000..25772ccc6 --- /dev/null +++ b/options.h @@ -0,0 +1,7 @@ +#ifndef OPTIONS_H +#define OPTIONS_H + +#define PrintDPI 96 +#define PaperSize 50000 + +#endif // OPTIONS_H diff --git a/widgets/vmaingraphicsscene.cpp b/widgets/vmaingraphicsscene.cpp new file mode 100644 index 000000000..1633c1d6d --- /dev/null +++ b/widgets/vmaingraphicsscene.cpp @@ -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); +} diff --git a/widgets/vmaingraphicsscene.h b/widgets/vmaingraphicsscene.h new file mode 100644 index 000000000..1a7a2bf39 --- /dev/null +++ b/widgets/vmaingraphicsscene.h @@ -0,0 +1,21 @@ +#ifndef VMAINGRAPHICSSCENE_H +#define VMAINGRAPHICSSCENE_H + +#include +#include + +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