Commit c7aecd12 authored by Mariano Lizarraga's avatar Mariano Lizarraga

Changed the dragging frame for a QWidget in the slugs camera control

parent ba356e1d
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
SlugsVideoCamControl::SlugsVideoCamControl(QWidget *parent) : SlugsVideoCamControl::SlugsVideoCamControl(QWidget *parent) :
QWidget(parent),
ui(new Ui::SlugsVideoCamControl) ui(new Ui::SlugsVideoCamControl)
{ {
ui->setupUi(this); ui->setupUi(this);
...@@ -25,8 +26,8 @@ SlugsVideoCamControl::SlugsVideoCamControl(QWidget *parent) : ...@@ -25,8 +26,8 @@ SlugsVideoCamControl::SlugsVideoCamControl(QWidget *parent) :
// setTransformationAnchor(AnchorUnderMouse); // setTransformationAnchor(AnchorUnderMouse);
// setResizeAnchor(AnchorViewCenter); // setResizeAnchor(AnchorViewCenter);
ui->CamControlPanel_graphicsView->installEventFilter(this); // ui->CamControlPanel_graphicsView->installEventFilter(this);
ui->label_x->installEventFilter(this); // ui->label_x->installEventFilter(this);
} }
...@@ -37,8 +38,15 @@ SlugsVideoCamControl::~SlugsVideoCamControl() ...@@ -37,8 +38,15 @@ SlugsVideoCamControl::~SlugsVideoCamControl()
void SlugsVideoCamControl::mouseMoveEvent(QMouseEvent *event) void SlugsVideoCamControl::mouseMoveEvent(QMouseEvent *event)
{ {
QPoint tL = ui->widget->frameGeometry().topLeft();
QPoint bR = ui->widget->frameGeometry().bottomRight();
if (!(event->x() > bR.x() || event->x() < tL.x() ||
event->y() > bR.y() || event->y() < tL.y() )){
ui->label_x->setText(QString::number(event->x())); ui->label_x->setText(QString::number(event->x()));
ui->label_y->setText(QString::number(event->y())); ui->label_y->setText(QString::number(event->y()));
}
} }
......
...@@ -11,7 +11,7 @@ namespace Ui { ...@@ -11,7 +11,7 @@ namespace Ui {
class SlugsVideoCamControl; class SlugsVideoCamControl;
} }
class SlugsVideoCamControl : public QGraphicsView class SlugsVideoCamControl : public QWidget
{ {
Q_OBJECT Q_OBJECT
......
...@@ -16,53 +16,40 @@ ...@@ -16,53 +16,40 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item row="0" column="0"> <item>
<widget class="QGraphicsView" name="CamControlPanel_graphicsView"> <widget class="QWidget" name="widget" native="true">
<property name="mouseTracking"> <property name="mouseTracking">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">background-color: rgb(255, 170, 0);</string> <string notr="true">background-color: rgb(255, 193, 76);</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> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item>
<widget class="QLabel" name="label_y"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="mouseTracking"> <item>
<bool>true</bool> <widget class="QLabel" name="label_y">
</property> <property name="mouseTracking">
<property name="text"> <bool>true</bool>
<string>TextLabel</string> </property>
</property> <property name="text">
</widget> <string>TextLabel</string>
</item> </property>
<item row="2" column="0"> </widget>
<widget class="QLabel" name="label_x"> </item>
<property name="mouseTracking"> <item>
<bool>true</bool> <widget class="QLabel" name="label_x">
</property> <property name="mouseTracking">
<property name="text"> <bool>true</bool>
<string>TextLabel</string> </property>
</property> <property name="text">
</widget> <string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</item> </item>
</layout> </layout>
</widget> </widget>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment