Skip to content

Commit

Permalink
ENH: Initial VR home widget implementation
Browse files Browse the repository at this point in the history
Squashed commits:

ENH: Create framework for registering VR modules

Adds registerModule function to qMRMLVRView which can be called to create a new button for that module on the Modules bar in the VR home widget

KitwareMedical#43

ENH: Make VR home widget controls functional

These changes make it so that changes in the module widget (viewable in Slicer) are reflected in the home widget (viewable in VR) and vice versa
KitwareMedical#43

ENH: Add VR optimized Qt Style Sheet

This style sheet makes the text in the VR menu widget bigger, and gives the buttons and slider handles different colors for unpressed, hover, and pressed statuses.
KitwareMedical#43

ENH: Add VR home widget WIP

Its UI is more or less complete but events are not handled and style sheet is needed

ENH: Add virtual widget from arbitrary Qt Widget !WIP!
  • Loading branch information
SalehChoueib authored and cpinter committed Sep 19, 2021
1 parent b79dd5e commit bb65154
Show file tree
Hide file tree
Showing 12 changed files with 902 additions and 4 deletions.
Binary file added VirtualReality/Resources/menuTextureImage2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions VirtualReality/Widgets/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,24 @@ set(${KIT}_SRCS
qMRML${MODULE_NAME}View.h
qMRML${MODULE_NAME}TransformWidget.cxx
qMRML${MODULE_NAME}TransformWidget.h
qMRMLVirtualRealityHomeWidget.cxx
qMRMLVirtualRealityHomeWidget.h
)

set(${KIT}_MOC_SRCS
qMRML${MODULE_NAME}View.h
qMRML${MODULE_NAME}TransformWidget.h
qMRML${MODULE_NAME}View_p.h
qMRMLVirtualRealityHomeWidget.h
)

set(${KIT}_UI_SRCS
Resources/UI/qMRMLVirtualRealityHomeWidget.ui
Resources/UI/qMRML${MODULE_NAME}TransformWidget.ui
)

set(${KIT}_RESOURCES
Resources/${KIT}.qrc
Resources/qMRML${MODULE_NAME}TransformWidget.qrc
)

Expand Down
50 changes: 50 additions & 0 deletions VirtualReality/Widgets/Resources/StyleSheets/VrWidgetStyle.qss
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
QWidget {
font: 20px;
}

QAbstractButton {
color: #3a3a3a;
border-color: #3a3a3a;
border-style: solid;
border-width: 1px;
border-radius: 10px;
padding: 4px;
}

QAbstractButton:hover {
background-color:#ABABAB;
}

QAbstractButton:pressed {
background-color: #525252;
}

QSlider {
min-height: 68px;
max-height: 68px;
background: white;
}

QSlider::groove:horizontal {
border: 1px solid #262626;
height: 5px;
background: #399aef;
margin: 0 12px;
}

QSlider::handle:horizontal {
background: white;
border: 2px solid black;
border-radius: 10px;
width: 23px;
height: 100px;
margin: -24px -12px;
}

QSlider::handle:horizontal:hover {
background: #ABABAB;
}

QSlider::handle:horizontal:pressed {
background: #525252;
}
206 changes: 206 additions & 0 deletions VirtualReality/Widgets/Resources/UI/qMRMLVirtualRealityHomeWidget.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>qMRMLVirtualRealityHomeWidget</class>
<widget class="qMRMLWidget" name="qMRMLVirtualRealityHomeWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>532</width>
<height>262</height>
</rect>
</property>
<property name="windowTitle">
<string>VR Home</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QPushButton" name="backButton">
<property name="text">
<string>Back</string>
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="HomeWidgetFrame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0" colspan="2">
<widget class="QPushButton" name="SyncViewToReferenceViewButton">
<property name="text">
<string>Sync view to reference view</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Fly speed:</string>
</property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="ctkSliderWidget" name="FlySpeedSliderWidget" native="true">
<property name="decimals" stdset="0">
<number>1</number>
</property>
<property name="singleStep" stdset="0">
<double>0.500000000000000</double>
</property>
<property name="pageStep" stdset="0">
<double>2.000000000000000</double>
</property>
<property name="minimum" stdset="0">
<double>0.100000000000000</double>
</property>
<property name="maximum" stdset="0">
<double>10.000000000000000</double>
</property>
<property name="value" stdset="0">
<double>1.660000000000000</double>
</property>
<property name="suffix" stdset="0">
<string>m/s</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Magnification:</string>
</property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="3">
<widget class="QPushButton" name="Magnification10xButton">
<property name="text">
<string>10x</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3">
<widget class="QCheckBox" name="LockMagnificationCheckBox">
<property name="text">
<string>Lock magnification</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="Magnification001xButton">
<property name="text">
<string>0.01x</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="Magnification1xButton">
<property name="text">
<string>1x</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="Magnification01xButton">
<property name="text">
<string>0.1x</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QPushButton" name="Magnification100xButton">
<property name="text">
<string>100x</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="minimumSize">
<size>
<width>0</width>
<height>13</height>
</size>
</property>
<property name="text">
<string>Motion sensitivity:</string>
</property>
<property name="alignment">
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="ctkSliderWidget" name="MotionSensitivitySliderWidget" native="true">
<property name="decimals" stdset="0">
<number>0</number>
</property>
<property name="maximum" stdset="0">
<double>100.000000000000000</double>
</property>
<property name="value" stdset="0">
<double>50.000000000000000</double>
</property>
<property name="suffix" stdset="0">
<string>%</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="ModuleWidgetFrame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QFormLayout" name="formLayout_3"/>
</widget>
</item>
<item>
<widget class="QGroupBox" name="ModulesGroupBox">
<property name="title">
<string>Modules</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QHBoxLayout" name="ModulesGroupBoxLayout"/>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>qMRMLWidget</class>
<extends>QWidget</extends>
<header>qMRMLWidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>ctkSliderWidget</class>
<extends>QWidget</extends>
<header>ctkSliderWidget.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>StyleSheets/VrWidgetStyle.qss</file>
</qresource>
</RCC>
Loading

0 comments on commit bb65154

Please sign in to comment.