Skip to content
Snippets Groups Projects
Commit 94abccb9 authored by roangel's avatar roangel
Browse files

Added resize, deletion, selection according with tabs, zoom, ...

parent 24f75cf7
No related branches found
No related tags found
No related merge requests found
#ifndef MYGRAPHICSVIEW_H
#define MYGRAPHICSVIEW_H
#include <vector>
#include <QGraphicsView>
#include <QWheelEvent>
class myGraphicsView : public QGraphicsView
{
Q_OBJECT
public:
explicit myGraphicsView(QWidget *parent = 0);
public slots:
signals:
protected:
void mousePressEvent(QMouseEvent *mouseEvent) override;
void mouseMoveEvent(QMouseEvent *mouseEvent) override;
void mouseReleaseEvent(QMouseEvent *mouseEvent) override;
virtual void wheelEvent(QWheelEvent* event) override; // TODO: right now, do it in the whole MainGUIWindow. Afterwards maybe do this only in the QGraphicsScene (need to do own class)
private:
bool translation_mode;
qreal translate_dx;
qreal translate_dy;
QPointF* tmp_point;
};
#endif
File added
......@@ -14,15 +14,14 @@
#include <QtWidgets/QApplication>
#include <QtWidgets/QButtonGroup>
#include <QtWidgets/QFrame>
#include <QtWidgets/QGraphicsView>
#include <QtWidgets/QHeaderView>
#include <QtWidgets/QMainWindow>
#include <QtWidgets/QMenuBar>
#include <QtWidgets/QSpinBox>
#include <QtWidgets/QStatusBar>
#include <QtWidgets/QTabWidget>
#include <QtWidgets/QToolBar>
#include <QtWidgets/QWidget>
#include "myGraphicsView.h"
QT_BEGIN_NAMESPACE
......@@ -33,9 +32,8 @@ public:
QFrame *frame;
QTabWidget *tabWidget;
QFrame *frame_drawing;
QGraphicsView *graphicsView;
myGraphicsView *graphicsView;
QFrame *frame_3;
QSpinBox *spinBoxNumCrazyflies;
QMenuBar *menuBar;
QToolBar *mainToolBar;
QStatusBar *statusBar;
......@@ -56,26 +54,21 @@ public:
tabWidget->setObjectName(QStringLiteral("tabWidget"));
tabWidget->setGeometry(QRect(20, 19, 1131, 401));
tabWidget->setLayoutDirection(Qt::LeftToRight);
tabWidget->setTabsClosable(true);
frame_drawing = new QFrame(centralWidget);
frame_drawing->setObjectName(QStringLiteral("frame_drawing"));
frame_drawing->setGeometry(QRect(30, 20, 582, 469));
frame_drawing->setGeometry(QRect(20, 20, 641, 469));
frame_drawing->setFrameShape(QFrame::StyledPanel);
frame_drawing->setFrameShadow(QFrame::Raised);
graphicsView = new QGraphicsView(frame_drawing);
graphicsView = new myGraphicsView(frame_drawing);
graphicsView->setObjectName(QStringLiteral("graphicsView"));
graphicsView->setGeometry(QRect(30, 20, 531, 430));
graphicsView->setGeometry(QRect(10, 9, 621, 451));
graphicsView->setMouseTracking(true);
frame_3 = new QFrame(centralWidget);
frame_3->setObjectName(QStringLiteral("frame_3"));
frame_3->setGeometry(QRect(629, 21, 581, 469));
frame_3->setGeometry(QRect(669, 21, 541, 469));
frame_3->setFrameShape(QFrame::StyledPanel);
frame_3->setFrameShadow(QFrame::Raised);
spinBoxNumCrazyflies = new QSpinBox(centralWidget);
spinBoxNumCrazyflies->setObjectName(QStringLiteral("spinBoxNumCrazyflies"));
spinBoxNumCrazyflies->setGeometry(QRect(1340, 560, 47, 23));
spinBoxNumCrazyflies->setReadOnly(false);
spinBoxNumCrazyflies->setAccelerated(false);
spinBoxNumCrazyflies->setMaximum(6);
MainGUIWindow->setCentralWidget(centralWidget);
menuBar = new QMenuBar(MainGUIWindow);
menuBar->setObjectName(QStringLiteral("menuBar"));
......
No preview for this file type
......@@ -17,10 +17,12 @@ SOURCES += main.cpp\
myGraphicsScene.cpp \
myGraphicsRectItem.cpp \
cornergrabber.cpp \
myGraphicsView.cpp
HEADERS += mainguiwindow.h \
myGraphicsScene.h \
myGraphicsRectItem.h \
cornergrabber.h
cornergrabber.h \
myGraphicsView.h
FORMS += mainguiwindow.ui
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.0.2, 2017-03-30T17:30:23. -->
<!-- Written by QtCreator 4.0.2, 2017-04-05T17:15:20. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment