3 changed files with 167 additions and 0 deletions
@ -0,0 +1,58 @@ |
|||||||
|
#include "SlugsVideoCamControl.h" |
||||||
|
#include "ui_SlugsVideoCamControl.h" |
||||||
|
|
||||||
|
#include <QGraphicsScene> |
||||||
|
#include <QGraphicsTextItem> |
||||||
|
#include <QTextStream> |
||||||
|
#include <QScrollBar> |
||||||
|
#include <QMouseEvent> |
||||||
|
#include <QWheelEvent> |
||||||
|
#include <QDebug> |
||||||
|
|
||||||
|
|
||||||
|
SlugsVideoCamControl::SlugsVideoCamControl(QWidget *parent) : |
||||||
|
ui(new Ui::SlugsVideoCamControl) |
||||||
|
{ |
||||||
|
ui->setupUi(this); |
||||||
|
|
||||||
|
// QGraphicsScene *scene = new QGraphicsScene(ui->CamControlPanel_graphicsView);
|
||||||
|
// scene->setItemIndexMethod(QGraphicsScene::NoIndex);
|
||||||
|
// scene->setSceneRect(-200, -200, 400, 400);
|
||||||
|
// setScene(scene);
|
||||||
|
// setCacheMode(CacheBackground);
|
||||||
|
// setViewportUpdateMode(BoundingRectViewportUpdate);
|
||||||
|
// setRenderHint(QPainter::Antialiasing);
|
||||||
|
// setTransformationAnchor(AnchorUnderMouse);
|
||||||
|
// setResizeAnchor(AnchorViewCenter);
|
||||||
|
|
||||||
|
ui->CamControlPanel_graphicsView->installEventFilter(this); |
||||||
|
ui->label_x->installEventFilter(this); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
SlugsVideoCamControl::~SlugsVideoCamControl() |
||||||
|
{ |
||||||
|
delete ui; |
||||||
|
} |
||||||
|
|
||||||
|
void SlugsVideoCamControl::mouseMoveEvent(QMouseEvent *event) |
||||||
|
{ |
||||||
|
ui->label_x->setText(QString::number(event->x())); |
||||||
|
ui->label_y->setText(QString::number(event->y())); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
//void SlugsVideoCamControl::mousePressEvent(QMouseEvent *evnt)
|
||||||
|
//{
|
||||||
|
|
||||||
|
//}
|
||||||
|
|
||||||
|
//void SlugsVideoCamControl::mouseReleaseEvent(QMouseEvent *evnt)
|
||||||
|
//{
|
||||||
|
|
||||||
|
//}
|
||||||
|
|
||||||
|
//void SlugsVideoCamControl::mouseDoubleClickEvent(QMouseEvent *evnt)
|
||||||
|
//{
|
||||||
|
|
||||||
|
//}
|
@ -0,0 +1,38 @@ |
|||||||
|
#ifndef SLUGSVIDEOCAMCONTROL_H |
||||||
|
#define SLUGSVIDEOCAMCONTROL_H |
||||||
|
|
||||||
|
#include <QWidget> |
||||||
|
#include <QMouseEvent> |
||||||
|
#include <QGraphicsView> |
||||||
|
#include <QGraphicsSceneMouseEvent> |
||||||
|
#include <QGraphicsScene> |
||||||
|
|
||||||
|
namespace Ui { |
||||||
|
class SlugsVideoCamControl; |
||||||
|
} |
||||||
|
|
||||||
|
class SlugsVideoCamControl : public QGraphicsView |
||||||
|
|
||||||
|
{ |
||||||
|
Q_OBJECT |
||||||
|
|
||||||
|
public: |
||||||
|
explicit SlugsVideoCamControl(QWidget *parent = 0); |
||||||
|
~SlugsVideoCamControl(); |
||||||
|
|
||||||
|
protected: |
||||||
|
// virtual void mousePressEvent(QMouseEvent* event);
|
||||||
|
//virtual void mouseReleaseEvent(QMouseEvent* event);
|
||||||
|
//void mouseMoveEvent(QMouseEvent* event);
|
||||||
|
void mouseMoveEvent(QMouseEvent* event); |
||||||
|
// virtual void wheelEvent(QWheelEvent* event);
|
||||||
|
//virtual void resizeEvent(QResizeEvent* event);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private: |
||||||
|
Ui::SlugsVideoCamControl *ui; |
||||||
|
}; |
||||||
|
|
||||||
|
#endif // SLUGSVIDEOCAMCONTROL_H
|
@ -0,0 +1,71 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<ui version="4.0"> |
||||||
|
<class>SlugsVideoCamControl</class> |
||||||
|
<widget class="QWidget" name="SlugsVideoCamControl"> |
||||||
|
<property name="geometry"> |
||||||
|
<rect> |
||||||
|
<x>0</x> |
||||||
|
<y>0</y> |
||||||
|
<width>443</width> |
||||||
|
<height>351</height> |
||||||
|
</rect> |
||||||
|
</property> |
||||||
|
<property name="mouseTracking"> |
||||||
|
<bool>true</bool> |
||||||
|
</property> |
||||||
|
<property name="windowTitle"> |
||||||
|
<string>Form</string> |
||||||
|
</property> |
||||||
|
<layout class="QGridLayout" name="gridLayout"> |
||||||
|
<item row="0" column="0"> |
||||||
|
<widget class="QGraphicsView" name="CamControlPanel_graphicsView"> |
||||||
|
<property name="mouseTracking"> |
||||||
|
<bool>true</bool> |
||||||
|
</property> |
||||||
|
<property name="styleSheet"> |
||||||
|
<string notr="true">background-color: rgb(255, 170, 0);</string> |
||||||
|
</property> |
||||||
|
<property name="frameShape"> |
||||||
|
<enum>QFrame::WinPanel</enum> |
||||||
|
</property> |
||||||
|
<property name="verticalScrollBarPolicy"> |
||||||
|
<enum>Qt::ScrollBarAlwaysOff</enum> |
||||||
|
</property> |
||||||
|
<property name="horizontalScrollBarPolicy"> |
||||||
|
<enum>Qt::ScrollBarAlwaysOff</enum> |
||||||
|
</property> |
||||||
|
<property name="sceneRect"> |
||||||
|
<rectf> |
||||||
|
<x>0.000000000000000</x> |
||||||
|
<y>0.000000000000000</y> |
||||||
|
<width>200.000000000000000</width> |
||||||
|
<height>200.000000000000000</height> |
||||||
|
</rectf> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
<item row="1" column="0"> |
||||||
|
<widget class="QLabel" name="label_y"> |
||||||
|
<property name="mouseTracking"> |
||||||
|
<bool>true</bool> |
||||||
|
</property> |
||||||
|
<property name="text"> |
||||||
|
<string>TextLabel</string> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
<item row="2" column="0"> |
||||||
|
<widget class="QLabel" name="label_x"> |
||||||
|
<property name="mouseTracking"> |
||||||
|
<bool>true</bool> |
||||||
|
</property> |
||||||
|
<property name="text"> |
||||||
|
<string>TextLabel</string> |
||||||
|
</property> |
||||||
|
</widget> |
||||||
|
</item> |
||||||
|
</layout> |
||||||
|
</widget> |
||||||
|
<resources/> |
||||||
|
<connections/> |
||||||
|
</ui> |
Loading…
Reference in new issue