More WDraggableSpinBox fixes (prevent dragging with right click, disable context menu popups in World Editor)

This commit is contained in:
parax0 2015-07-30 23:08:18 -04:00
parent 2a0134fbfc
commit 4450606fbf
2 changed files with 32 additions and 8 deletions

View File

@ -153,7 +153,10 @@
</size> </size>
</property> </property>
<property name="focusPolicy"> <property name="focusPolicy">
<enum>Qt::NoFocus</enum> <enum>Qt::TabFocus</enum>
</property>
<property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum>
</property> </property>
<property name="correctionMode"> <property name="correctionMode">
<enum>QAbstractSpinBox::CorrectToNearestValue</enum> <enum>QAbstractSpinBox::CorrectToNearestValue</enum>
@ -203,7 +206,10 @@
</size> </size>
</property> </property>
<property name="focusPolicy"> <property name="focusPolicy">
<enum>Qt::NoFocus</enum> <enum>Qt::TabFocus</enum>
</property>
<property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum>
</property> </property>
<property name="correctionMode"> <property name="correctionMode">
<enum>QAbstractSpinBox::CorrectToNearestValue</enum> <enum>QAbstractSpinBox::CorrectToNearestValue</enum>
@ -253,7 +259,10 @@
</size> </size>
</property> </property>
<property name="focusPolicy"> <property name="focusPolicy">
<enum>Qt::ClickFocus</enum> <enum>Qt::TabFocus</enum>
</property>
<property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum>
</property> </property>
<property name="correctionMode"> <property name="correctionMode">
<enum>QAbstractSpinBox::CorrectToNearestValue</enum> <enum>QAbstractSpinBox::CorrectToNearestValue</enum>
@ -302,6 +311,9 @@
<property name="focusPolicy"> <property name="focusPolicy">
<enum>Qt::NoFocus</enum> <enum>Qt::NoFocus</enum>
</property> </property>
<property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum>
</property>
<property name="frame"> <property name="frame">
<bool>true</bool> <bool>true</bool>
</property> </property>
@ -458,6 +470,9 @@
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<widget class="QTabWidget" name="TabWidget"> <widget class="QTabWidget" name="TabWidget">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="tabPosition"> <property name="tabPosition">
<enum>QTabWidget::North</enum> <enum>QTabWidget::North</enum>
</property> </property>
@ -465,7 +480,7 @@
<enum>QTabWidget::Rounded</enum> <enum>QTabWidget::Rounded</enum>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>0</number>
</property> </property>
<property name="iconSize"> <property name="iconSize">
<size> <size>
@ -882,6 +897,12 @@
<header>WDraggableSpinBox.h</header> <header>WDraggableSpinBox.h</header>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<tabstops>
<tabstop>XSpinBox</tabstop>
<tabstop>YSpinBox</tabstop>
<tabstop>ZSpinBox</tabstop>
<tabstop>TabWidget</tabstop>
</tabstops>
<resources> <resources>
<include location="../Icons.qrc"/> <include location="../Icons.qrc"/>
</resources> </resources>

View File

@ -17,11 +17,14 @@ WDraggableSpinBox::~WDraggableSpinBox()
{ {
} }
void WDraggableSpinBox::mousePressEvent(QMouseEvent*) void WDraggableSpinBox::mousePressEvent(QMouseEvent *pEvent)
{ {
mBeingDragged = true; if (pEvent->button() == Qt::LeftButton)
mBeenDragged = false; {
mLastY = QCursor::pos().y(); mBeingDragged = true;
mBeenDragged = false;
mLastY = QCursor::pos().y();
}
} }
void WDraggableSpinBox::mouseReleaseEvent(QMouseEvent *Event) void WDraggableSpinBox::mouseReleaseEvent(QMouseEvent *Event)