Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
f11da5db
Commit
f11da5db
authored
3 years ago
by
Matthias Puchner
Browse files
Options
Downloads
Patches
Plain Diff
improve moving of layers
parent
7978105e
No related branches found
No related tags found
1 merge request
!434
Improve moving of layers in layer editor
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GUI/View/SampleDesigner/WidgetMoverButton.cpp
+14
-3
14 additions, 3 deletions
GUI/View/SampleDesigner/WidgetMoverButton.cpp
GUI/View/SampleDesigner/WidgetMoverButton.h
+3
-0
3 additions, 0 deletions
GUI/View/SampleDesigner/WidgetMoverButton.h
with
17 additions
and
3 deletions
GUI/View/SampleDesigner/WidgetMoverButton.cpp
+
14
−
3
View file @
f11da5db
...
...
@@ -48,6 +48,9 @@ void WidgetMoverButton::mousePressEvent(QMouseEvent* event)
void
WidgetMoverButton
::
mouseReleaseEvent
(
QMouseEvent
*
)
{
qDeleteAll
(
m_animations
.
values
());
m_animations
.
clear
();
m_dragScrollTimer
.
stop
();
m_started
=
false
;
if
(
m_layoutToDeactivate
!=
nullptr
)
{
...
...
@@ -107,14 +110,22 @@ void WidgetMoverButton::mouseMoveEvent(QMouseEvent* event)
QWidget
*
w
=
layoutItem
->
widget
();
if
(
w
==
nullptr
)
{
layoutItem
->
setGeometry
(
r
);
}
else
{
QPropertyAnimation
*
animation
=
new
QPropertyAnimation
(
w
,
"geometry"
);
}
else
if
(
!
m_animations
.
contains
(
w
))
{
auto
animation
=
new
QPropertyAnimation
(
w
,
"geometry"
);
animation
->
setDuration
(
100
);
animation
->
setEasingCurve
(
QEasingCurve
::
OutQuad
);
animation
->
setStartValue
(
w
->
geometry
());
animation
->
setEndValue
(
r
);
animation
->
start
();
m_animations
[
w
]
=
animation
;
}
else
{
auto
animation
=
m_animations
[
w
];
if
(
animation
->
endValue
()
!=
r
)
{
animation
->
stop
();
animation
->
setStartValue
(
w
->
geometry
());
animation
->
setEndValue
(
r
);
animation
->
start
();
}
}
}
...
...
This diff is collapsed.
Click to expand it.
GUI/View/SampleDesigner/WidgetMoverButton.h
+
3
−
0
View file @
f11da5db
...
...
@@ -15,10 +15,12 @@
#ifndef BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_WIDGETMOVERBUTTON_H
#define BORNAGAIN_GUI_VIEW_SAMPLEDESIGNER_WIDGETMOVERBUTTON_H
#include
<QMap>
#include
<QTimer>
#include
<QToolButton>
class
QScrollArea
;
class
QPropertyAnimation
;
//! Button to move a widget vertically in a layout.
//!
...
...
@@ -65,6 +67,7 @@ private:
QTimer
m_dragScrollTimer
;
QScrollArea
*
m_scrollArea
;
QPoint
m_hotSpot
;
//!< The mouse-down coordinates in the widget to move
QMap
<
QWidget
*
,
QPropertyAnimation
*>
m_animations
;
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment