World Editor UI reshuffling + WDraggableSpinBox improvements
This commit is contained in:
parent
c16c0899bf
commit
7c2c1c9088
|
@ -14,7 +14,10 @@
|
|||
<string>Prime World Editor</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
|
@ -28,7 +31,290 @@
|
|||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="CEditorGLWidget" name="MainViewport" native="true"/>
|
||||
<widget class="CEditorGLWidget" name="MainViewport" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>1</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<zorder>YLabel</zorder>
|
||||
<zorder>YSpinBox</zorder>
|
||||
<zorder>XSpinBox</zorder>
|
||||
<zorder>XLabel</zorder>
|
||||
<zorder>ZSpinBox</zorder>
|
||||
<zorder>ZLabel</zorder>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="BottomFrame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QFrame" name="SelectionInfoFrame">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Panel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="midLineWidth">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="SelectionInfoLabel">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="midLineWidth">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="XLabel">
|
||||
<property name="text">
|
||||
<string>X:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="WDraggableSpinBox" name="XSpinBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>70</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>70</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-1000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>1000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="YLabel">
|
||||
<property name="text">
|
||||
<string>Y:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="WDraggableSpinBox" name="YSpinBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>70</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-1000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>1000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="ZLabel">
|
||||
<property name="text">
|
||||
<string>Z:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="WDraggableSpinBox" name="ZSpinBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>70</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="decimals">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>-1000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>1000000.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="BottomFrameDivider">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Speed:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="WDraggableSpinBox" name="CamSpeedSpinBox">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frame">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="correctionMode">
|
||||
<enum>QAbstractSpinBox::CorrectToNearestValue</enum>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<double>0.010000000000000</double>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<double>10.000000000000000</double>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<double>0.100000000000000</double>
|
||||
</property>
|
||||
<property name="value">
|
||||
<double>1.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="BottomFrameSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
@ -143,52 +429,6 @@
|
|||
</attribute>
|
||||
<widget class="QWidget" name="MainDockContents">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QFrame" name="SelectionInfoFrame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Panel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="midLineWidth">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="leftMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="SelectionInfoLabel">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="midLineWidth">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="TabWidget">
|
||||
<property name="tabPosition">
|
||||
|
@ -609,6 +849,11 @@
|
|||
<header>WorldEditor/WInstancesTab.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>WDraggableSpinBox</class>
|
||||
<extends>QDoubleSpinBox</extends>
|
||||
<header>WDraggableSpinBox.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../Icons.qrc"/>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "WDraggableSpinBox.h"
|
||||
#include <QMouseEvent>
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QMouseEvent>
|
||||
|
||||
WDraggableSpinBox::WDraggableSpinBox(QWidget *parent) : QDoubleSpinBox(parent)
|
||||
{
|
||||
|
@ -8,19 +9,17 @@ WDraggableSpinBox::WDraggableSpinBox(QWidget *parent) : QDoubleSpinBox(parent)
|
|||
mDefaultValue = value();
|
||||
setMinimum(-1000000.0);
|
||||
setMaximum(1000000.0);
|
||||
setDecimals(4);
|
||||
}
|
||||
|
||||
WDraggableSpinBox::~WDraggableSpinBox()
|
||||
{
|
||||
}
|
||||
|
||||
void WDraggableSpinBox::mousePressEvent(QMouseEvent *Event)
|
||||
void WDraggableSpinBox::mousePressEvent(QMouseEvent*)
|
||||
{
|
||||
mBeingDragged = true;
|
||||
mBeenDragged = false;
|
||||
mInitialY = Event->y();
|
||||
mInitialValue = value();
|
||||
mLastY = QCursor::pos().y();
|
||||
}
|
||||
|
||||
void WDraggableSpinBox::mouseReleaseEvent(QMouseEvent *Event)
|
||||
|
@ -36,6 +35,11 @@ void WDraggableSpinBox::mouseReleaseEvent(QMouseEvent *Event)
|
|||
else
|
||||
stepDown();
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
setCursor(Qt::ArrowCursor);
|
||||
}
|
||||
}
|
||||
|
||||
else if (Event->button() == Qt::RightButton)
|
||||
|
@ -44,12 +48,32 @@ void WDraggableSpinBox::mouseReleaseEvent(QMouseEvent *Event)
|
|||
}
|
||||
}
|
||||
|
||||
void WDraggableSpinBox::mouseMoveEvent(QMouseEvent *Event)
|
||||
void WDraggableSpinBox::mouseMoveEvent(QMouseEvent*)
|
||||
{
|
||||
if (mBeingDragged)
|
||||
{
|
||||
double DragAmount = (singleStep() / 10.0) * (mInitialY - Event->y());
|
||||
setValue(mInitialValue + DragAmount);
|
||||
if (DragAmount != 0) mBeenDragged = true;
|
||||
QPoint cursorPos = QCursor::pos();
|
||||
|
||||
// Update value
|
||||
double DragAmount = (singleStep() / 10.0) * (mLastY - cursorPos.y());
|
||||
setValue(value() + DragAmount);
|
||||
|
||||
// Wrap cursor
|
||||
int screenHeight = QApplication::desktop()->screenGeometry().height();
|
||||
|
||||
if (cursorPos.y() == screenHeight - 1)
|
||||
QCursor::setPos(cursorPos.x(), 1);
|
||||
if (cursorPos.y() == 0)
|
||||
QCursor::setPos(cursorPos.x(), screenHeight - 2);
|
||||
|
||||
// Set cursor shape
|
||||
if (DragAmount != 0)
|
||||
{
|
||||
mBeenDragged = true;
|
||||
setCursor(Qt::SizeVerCursor);
|
||||
}
|
||||
|
||||
// Update last Y
|
||||
mLastY = QCursor::pos().y();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,9 +8,8 @@ class WDraggableSpinBox : public QDoubleSpinBox
|
|||
Q_OBJECT
|
||||
bool mBeingDragged;
|
||||
bool mBeenDragged;
|
||||
double mInitialValue;
|
||||
double mDefaultValue;
|
||||
int mInitialY;
|
||||
int mLastY;
|
||||
|
||||
public:
|
||||
explicit WDraggableSpinBox(QWidget *parent = 0);
|
||||
|
|
|
@ -130,6 +130,7 @@ void WPropertyEditor::CreateEditor()
|
|||
CFloatProperty *pFloatCast = static_cast<CFloatProperty*>(mpProperty);
|
||||
WDraggableSpinBox *pDraggableSpinBox = new WDraggableSpinBox(this);
|
||||
|
||||
pDraggableSpinBox->setDecimals(4);
|
||||
pDraggableSpinBox->setValue(pFloatCast->Get());
|
||||
|
||||
mUI.EditorWidget = pDraggableSpinBox;
|
||||
|
|
Loading…
Reference in New Issue