Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
9.2.2023: Due to updates GitLab will be unavailable for some minutes between 9:00 and 11:00.
Open sidebar
CAMP
campvis-public
Commits
c50cc709
Commit
c50cc709
authored
Nov 28, 2013
by
Christian Schulte zu Berge
Browse files
Merge branch 'mdi-improvements' of /mnt/bigone/git/repositories/berge/campvis into development
parents
32ccb358
f77eb3bb
Changes
8
Hide whitespace changes
Inline
Side-by-side
application/gui/mainwindow.cpp
View file @
c50cc709
...
...
@@ -56,7 +56,7 @@ namespace campvis {
,
_pipelineWidget
(
0
)
,
_propCollectionWidget
(
0
)
,
_dcInspectorWidget
(
0
)
,
_dcInspector
Dock
(
0
)
,
_dcInspector
Window
(
0
)
,
_btnExecute
(
0
)
,
_btnShowDataContainerInspector
(
0
)
,
_selectedPipeline
(
0
)
...
...
@@ -251,15 +251,14 @@ namespace campvis {
void
MainWindow
::
onBtnShowDataContainerInspectorClicked
()
{
if
(
_selectedPipeline
!=
0
)
{
if
(
_dcInspectorDock
==
0
)
{
_dcInspectorDock
=
dockPrimaryWidget
(
"Data Container inspector"
,
_dcInspectorWidget
);
}
else
{
// Activate the dock's tab
_dcInspectorDock
->
setVisible
(
true
);
_dcInspectorDock
->
raise
();
if
(
_dcInspectorWindow
==
0
)
{
_dcInspectorWindow
=
_mdiArea
->
addWidget
(
_dcInspectorWidget
);
_dcInspectorWindow
->
setWindowTitle
(
tr
(
"Data Container Inspector"
));
}
_dcInspectorWidget
->
setDataContainer
(
&
(
_selectedPipeline
->
getDataContainer
()));
_dcInspectorWindow
->
show
();
_dcInspectorWindow
->
activateWindow
();
}
}
...
...
application/gui/mainwindow.h
View file @
c50cc709
...
...
@@ -50,6 +50,7 @@
namespace
campvis
{
class
DataContainerInspectorWidget
;
class
DataContainerInspectorCanvas
;
class
MdiDockableWindow
;
/**
* Main Window for the CAMPVis application.
...
...
@@ -176,7 +177,7 @@ namespace campvis {
QScrollArea
*
_pipelinePropertiesScrollArea
;
///< Scroll area for _pipelinePropertiesWidget
PropertyCollectionWidget
*
_propCollectionWidget
;
///< Widget for brosing the PropertyCollection of the selected pipeline/processor
DataContainerInspectorWidget
*
_dcInspectorWidget
;
///< Widget for inspecting the DataContainer of the selected pipeline.
Q
Dock
Widget
*
_dcInspector
Dock
;
///< Dock stor
ing the above DataContainerInspectorWidget instance.
Mdi
Dock
ableWindow
*
_dcInspector
Window
;
///< Window display
ing the above DataContainerInspectorWidget instance.
QPushButton
*
_btnExecute
;
///< Button to execute the selected pipeline/processor
QPushButton
*
_btnShowDataContainerInspector
;
///< Button to show the DataContainerInspector for the selected pipeline
...
...
application/gui/mdi/mdidockablewindow.cpp
View file @
c50cc709
...
...
@@ -42,8 +42,8 @@ namespace campvis {
,
_floatingWindow
(
0
)
,
_toggleViewAction
(
0
)
{
this
->
setWindowFlags
(
windowFlags
);
_dockedWindow
=
this
->
newDockedWindow
(
widget
);
_dockedWindow
->
setWindowFlags
(
windowFlags
);
_toggleViewAction
=
new
QAction
(
this
);
_toggleViewAction
->
setCheckable
(
true
);
...
...
@@ -61,6 +61,13 @@ namespace campvis {
_floatingWindow
->
setWindowTitle
(
title
);
}
void
MdiDockableWindow
::
activateWindow
()
{
if
(
_docked
)
_dockedWindow
->
setFocus
();
else
_floatingWindow
->
activateWindow
();
}
QAction
*
MdiDockableWindow
::
toggleViewAction
()
const
{
return
_toggleViewAction
;
}
...
...
@@ -70,7 +77,7 @@ namespace campvis {
}
MdiDockedWindow
*
MdiDockableWindow
::
newDockedWindow
(
QWidget
*
widget
)
{
MdiDockedWindow
*
dockedWindow
=
new
MdiDockedWindow
(
_mdiArea
);
MdiDockedWindow
*
dockedWindow
=
new
MdiDockedWindow
(
_mdiArea
,
this
->
windowFlags
()
);
dockedWindow
->
setWidget
(
widget
);
this
->
connect
(
dockedWindow
,
SIGNAL
(
s_positionChanged
(
const
QPoint
&
)),
SLOT
(
trackDockedWindowPosition
(
QPoint
)));
...
...
@@ -139,17 +146,26 @@ namespace campvis {
_dockedWindow
->
setWidget
(
0
);
_mdiArea
->
removeSubWindow
(
_dockedWindow
);
_floatingWindow
=
new
MdiFloatingWindow
(
widget
);
_floatingWindow
=
new
MdiFloatingWindow
(
widget
,
this
);
_floatingWindow
->
setWindowTitle
(
this
->
windowTitle
());
_floatingWindow
->
forceWindowDrag
();
this
->
connect
(
_floatingWindow
,
SIGNAL
(
s_positionChanged
(
const
QPoint
&
)),
SLOT
(
trackFloatingWindowPosition
(
const
QPoint
&
)));
this
->
connect
(
_floatingWindow
,
SIGNAL
(
s_closed
()),
SLOT
(
handleWindowClosing
()));
_dockedWindow
->
deleteLater
();
_dockedWindow
=
0
;
_docked
=
false
;
_floatingWindow
->
show
();
_floatingWindow
->
activateWindow
();
_floatingWindow
->
forceWindowDrag
();
/*
* Connect signals last so that the floating window's initial move events are ignored.
* They mustn't be handled because they may contain outdated position information which
* could, in extreme cases, trigger immediate re-docking of the floating window,
* leading to all sorts of problems.
*/
this
->
connect
(
_floatingWindow
,
SIGNAL
(
s_closed
()),
SLOT
(
handleWindowClosing
()));
this
->
connect
(
_floatingWindow
,
SIGNAL
(
s_positionChanged
(
const
QPoint
&
)),
SLOT
(
trackFloatingWindowPosition
(
const
QPoint
&
)));
}
}
...
...
application/gui/mdi/mdidockablewindow.h
View file @
c50cc709
...
...
@@ -67,6 +67,13 @@ namespace campvis {
*/
void
setWindowTitle
(
const
QString
&
title
);
/**
* Set this window to be the active window.
*
* Calling this function causes the window to get the keyboard input focus.
*/
void
activateWindow
();
/**
* Change the window's visibility.
*
...
...
application/gui/mdi/mdidockedwindow.cpp
View file @
c50cc709
...
...
@@ -36,10 +36,12 @@
namespace
campvis
{
MdiDockedWindow
::
MdiDockedWindow
(
QWidget
*
parent
/*= 0*/
,
Qt
::
WindowFlags
flags
/*= 0*/
)
:
QMdiSubWindow
(
parent
,
flags
)
:
QMdiSubWindow
(
parent
)
,
_dragActive
(
false
)
,
_lastMousePos
()
{}
{
this
->
setWindowFlags
(
flags
|
Qt
::
Tool
);
}
void
MdiDockedWindow
::
forceWindowDrag
()
{
_dragActive
=
true
;
...
...
@@ -63,15 +65,12 @@ namespace campvis {
}
void
MdiDockedWindow
::
mouseMoveEvent
(
QMouseEvent
*
event
)
{
if
(
event
->
buttons
().
testFlag
(
Qt
::
LeftButton
))
{
/*
* Only intercept mouse move events if the window is being dragged and the left mouse
* button is pressed.
*/
if
(
_dragActive
&&
event
->
buttons
().
testFlag
(
Qt
::
LeftButton
))
{
const
QPoint
&
mousePos
=
event
->
globalPos
();
if
(
!
_dragActive
)
{
_dragActive
=
true
;
_lastMousePos
=
mousePos
;
return
QMdiSubWindow
::
mouseMoveEvent
(
event
);
}
QPoint
newPos
=
pos
()
+
(
mousePos
-
_lastMousePos
);
/*
...
...
@@ -91,16 +90,29 @@ namespace campvis {
move
(
newPos
);
emit
s_positionChanged
(
newPos
);
}
else
{
else
QMdiSubWindow
::
mouseMoveEvent
(
event
);
}
void
MdiDockedWindow
::
mousePressEvent
(
QMouseEvent
*
event
)
{
const
QPoint
&
widgetPos
=
this
->
widget
()
->
mapFromParent
(
event
->
pos
());
/*
* Mouse drag detection starts only in response to non-resize (the window's current cursor
* is the default one) drag (the left mouse button is pressed) events; additionally, the
* mouse pointer has to be on the title bar.
*/
if
(
event
->
button
()
==
Qt
::
LeftButton
&&
widgetPos
.
y
()
<
0
&&
this
->
cursor
().
shape
()
==
Qt
::
ArrowCursor
)
{
_dragActive
=
true
;
_lastMousePos
=
event
->
globalPos
();
}
QMdiSubWindow
::
mousePressEvent
(
event
);
}
void
MdiDockedWindow
::
mouseReleaseEvent
(
QMouseEvent
*
event
)
{
if
(
event
->
button
()
==
Qt
::
LeftButton
)
{
if
(
event
->
button
()
==
Qt
::
LeftButton
)
stopWindowDrag
();
mdiArea
()
->
tileSubWindows
();
}
// The default implementation detects clicks on the close, maximize and minimize buttons,
// among other things
...
...
application/gui/mdi/mdidockedwindow.h
View file @
c50cc709
...
...
@@ -90,6 +90,11 @@ namespace campvis {
*/
virtual
void
mouseMoveEvent
(
QMouseEvent
*
event
);
/**
* Event handler that receives mouse press events for the window.
*/
virtual
void
mousePressEvent
(
QMouseEvent
*
event
);
/**
* Event handler that receives mouse release events for the window.
*/
...
...
application/gui/mdi/mdifloatingwindow.cpp
View file @
c50cc709
...
...
@@ -37,7 +37,7 @@
namespace
campvis
{
MdiFloatingWindow
::
MdiFloatingWindow
(
QWidget
*
widget
,
QWidget
*
parent
/*= 0*/
)
:
QWidget
(
parent
)
:
QWidget
(
parent
,
Qt
::
Tool
)
,
_widget
(
widget
)
,
_dragActive
(
false
)
{
...
...
@@ -49,7 +49,7 @@ namespace campvis {
}
void
MdiFloatingWindow
::
forceWindowDrag
()
{
if
(
!
_dragActive
&&
parent
()
==
0
)
{
if
(
!
_dragActive
)
{
_dragActive
=
true
;
this
->
snapToCursor
(
QCursor
::
pos
());
grabMouse
();
...
...
@@ -63,12 +63,15 @@ namespace campvis {
}
}
QWidget
*
MdiFloatingWindow
::
widget
()
{
QWidget
*
MdiFloatingWindow
::
widget
()
const
{
return
_widget
;
}
void
MdiFloatingWindow
::
mouseMoveEvent
(
QMouseEvent
*
event
)
{
this
->
snapToCursor
(
event
->
globalPos
());
if
(
_dragActive
)
this
->
snapToCursor
(
event
->
globalPos
());
else
QWidget
::
mouseMoveEvent
(
event
);
}
void
MdiFloatingWindow
::
mouseReleaseEvent
(
QMouseEvent
*
event
)
{
...
...
application/gui/mdi/mdifloatingwindow.h
View file @
c50cc709
...
...
@@ -76,7 +76,7 @@ namespace campvis {
/**
* Return the widget this window wraps.
*/
QWidget
*
widget
();
QWidget
*
widget
()
const
;
signals:
/**
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment