mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-05 21:52:10 +01:00
Corrected GUI widget spacers, added OpenGL rendering.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2617 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
f6805de71e
commit
7c73f9c2c8
@ -1,6 +1,7 @@
|
||||
TEMPLATE = lib
|
||||
TARGET = GCSControl
|
||||
QT += svg
|
||||
QT += opengl
|
||||
|
||||
include(../../openpilotgcsplugin.pri)
|
||||
include(../../plugins/coreplugin/coreplugin.pri)
|
||||
|
@ -20,6 +20,12 @@
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
@ -43,6 +49,9 @@
|
||||
<property name="text">
|
||||
<string>Flight Mode:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -53,20 +62,7 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout" columnstretch="0,0">
|
||||
<layout class="QGridLayout" name="gridLayout" columnstretch="0,0,0">
|
||||
<property name="horizontalSpacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
@ -83,8 +79,8 @@
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>200</height>
|
||||
<width>100</width>
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="mouseTracking">
|
||||
@ -92,7 +88,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<item row="0" column="2">
|
||||
<widget class="JoystickControl" name="widgetRightStick" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
@ -102,12 +98,25 @@
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>200</height>
|
||||
<width>100</width>
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>2</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -71,6 +71,9 @@ GCSControlGadgetWidget::GCSControlGadgetWidget(QWidget *parent) : QLabel(parent)
|
||||
leftY = 0;
|
||||
rightX = 0;
|
||||
rightY = 0;
|
||||
|
||||
m_gcscontrol->widgetLeftStick->enableOpenGL(true);
|
||||
m_gcscontrol->widgetRightStick->enableOpenGL(true);
|
||||
}
|
||||
|
||||
GCSControlGadgetWidget::~GCSControlGadgetWidget()
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QMouseEvent>
|
||||
#include <QtOpenGL/QGLWidget>
|
||||
#include <QtGlobal>
|
||||
|
||||
/**
|
||||
@ -73,6 +74,17 @@ JoystickControl::~JoystickControl()
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Enables/Disables OpenGL
|
||||
*/
|
||||
void JoystickControl::enableOpenGL(bool flag)
|
||||
{
|
||||
if (flag)
|
||||
setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
|
||||
else
|
||||
setViewport(new QWidget);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Update the displayed position based on an MCC update
|
||||
*/
|
||||
|
@ -46,6 +46,7 @@ class JoystickControl : public QGraphicsView
|
||||
public:
|
||||
explicit JoystickControl(QWidget *parent = 0);
|
||||
~JoystickControl();
|
||||
void enableOpenGL(bool flag);
|
||||
void paint();
|
||||
|
||||
protected:
|
||||
|
Loading…
x
Reference in New Issue
Block a user