BornAgain
1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Button to move a widget vertically in a layout.
With this button, the "move layer" feature in the layer oriented sample editor is realized (it is the button on each LayerForm).
When pressing the button, the parent layout of the widget is deactivated, and the widget is moved to the position where the pressed mouse cursor is moved. When the mouse is released, the layout is again activated and a signal finishedMoving() is emitted. Any reordering of the widgets in the layout then has to be handled outside - no reordering is done in here.
Definition at line 35 of file WidgetMoverButton.h.
Signals | |
void | finishedMoving (QWidget *widgetToMove, QWidget *moveAboveThisWidget) |
void | startingToMove () |
Public Member Functions | |
WidgetMoverButton (QWidget *parent, QWidget *widgetToMove, int ignoreOnTop=0) | |
Create a widget mover button. More... | |
Protected Member Functions | |
void | mouseMoveEvent (QMouseEvent *event) override |
void | mousePressEvent (QMouseEvent *event) override |
void | mouseReleaseEvent (QMouseEvent *event) override |
Private Member Functions | |
void | scrollParent (bool up) |
Private Attributes | |
QMap< QWidget *, QPropertyAnimation * > | m_animations |
QTimer | m_dragScrollTimer |
QWidget * | m_dropAboveThisWidget |
int | m_globalMouseDownY |
QPoint | m_hotSpot |
The mouse-down coordinates in the widget to move. More... | |
int | m_ignoreOnTop |
QLayout * | m_layoutToDeactivate = nullptr |
int | m_originalWidgetY |
QScrollArea * | m_scrollArea |
bool | m_started = false |
QWidget * | m_widgetToMove |
int | m_yOfFirstRelevantWidget |
WidgetMoverButton::WidgetMoverButton | ( | QWidget * | parent, |
QWidget * | widgetToMove, | ||
int | ignoreOnTop = 0 |
||
) |
Create a widget mover button.
If the widget shall not be able to be dragged on the top position, this can be defined by ignoreOnTop (the number of widgets at the top of the layout which shall not be affected by the reordering). In the case of the layer moving, the topmost Form (the sample properties) shall not be part of reordering.
Definition at line 23 of file WidgetMoverButton.cpp.
References m_dragScrollTimer.
|
signal |
Referenced by LayerForm::LayerForm(), and mouseReleaseEvent().
|
overrideprotected |
Definition at line 67 of file WidgetMoverButton.cpp.
References m_animations, m_dragScrollTimer, m_dropAboveThisWidget, m_globalMouseDownY, m_hotSpot, m_ignoreOnTop, m_layoutToDeactivate, m_originalWidgetY, m_scrollArea, m_started, m_widgetToMove, m_yOfFirstRelevantWidget, scrollParent(), and startingToMove().
|
overrideprotected |
Definition at line 34 of file WidgetMoverButton.cpp.
References m_globalMouseDownY, m_hotSpot, m_scrollArea, and m_widgetToMove.
|
overrideprotected |
Definition at line 50 of file WidgetMoverButton.cpp.
References finishedMoving(), m_animations, m_dragScrollTimer, m_dropAboveThisWidget, m_layoutToDeactivate, m_started, and m_widgetToMove.
|
private |
Definition at line 155 of file WidgetMoverButton.cpp.
References m_scrollArea, and m_widgetToMove.
Referenced by mouseMoveEvent().
|
signal |
Referenced by LayerForm::LayerForm(), and mouseMoveEvent().
|
private |
Definition at line 70 of file WidgetMoverButton.h.
Referenced by mouseMoveEvent(), and mouseReleaseEvent().
|
private |
Definition at line 67 of file WidgetMoverButton.h.
Referenced by WidgetMoverButton(), mouseMoveEvent(), and mouseReleaseEvent().
|
private |
Definition at line 63 of file WidgetMoverButton.h.
Referenced by mouseMoveEvent(), and mouseReleaseEvent().
|
private |
Definition at line 60 of file WidgetMoverButton.h.
Referenced by mouseMoveEvent(), and mousePressEvent().
|
private |
The mouse-down coordinates in the widget to move.
Definition at line 69 of file WidgetMoverButton.h.
Referenced by mouseMoveEvent(), and mousePressEvent().
|
private |
Definition at line 66 of file WidgetMoverButton.h.
Referenced by mouseMoveEvent().
|
private |
Definition at line 61 of file WidgetMoverButton.h.
Referenced by mouseMoveEvent(), and mouseReleaseEvent().
|
private |
Definition at line 64 of file WidgetMoverButton.h.
Referenced by mouseMoveEvent().
|
private |
Definition at line 68 of file WidgetMoverButton.h.
Referenced by mouseMoveEvent(), mousePressEvent(), and scrollParent().
|
private |
Definition at line 59 of file WidgetMoverButton.h.
Referenced by mouseMoveEvent(), and mouseReleaseEvent().
|
private |
Definition at line 62 of file WidgetMoverButton.h.
Referenced by mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), and scrollParent().
|
private |
Definition at line 65 of file WidgetMoverButton.h.
Referenced by mouseMoveEvent().