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 @@
SlugsVideoCamControl::SlugsVideoCamControl(QWidget *parent) :
QWidget(parent),
ui(new Ui::SlugsVideoCamControl)
{
ui->setupUi(this);
......@@ -25,8 +26,8 @@ SlugsVideoCamControl::SlugsVideoCamControl(QWidget *parent) :
// setTransformationAnchor(AnchorUnderMouse);
// setResizeAnchor(AnchorViewCenter);
ui->CamControlPanel_graphicsView->installEventFilter(this);
ui->label_x->installEventFilter(this);
// ui->CamControlPanel_graphicsView->installEventFilter(this);
// ui->label_x->installEventFilter(this);
}
......@@ -37,8 +38,15 @@ SlugsVideoCamControl::~SlugsVideoCamControl()
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_y->setText(QString::number(event->y()));
}
}
......
......@@ -11,7 +11,7 @@ namespace Ui {
class SlugsVideoCamControl;
}
class SlugsVideoCamControl : public QGraphicsView
class SlugsVideoCamControl : public QWidget
{
Q_OBJECT
......
......@@ -16,53 +16,40 @@
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QGraphicsView" name="CamControlPanel_graphicsView">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QWidget" name="widget" native="true">
<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>
<string notr="true">background-color: rgb(255, 193, 76);</string>
</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 class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label_y">
<property name="mouseTracking">
<bool>true</bool>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_x">
<property name="mouseTracking">
<bool>true</bool>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</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