|
umbrello 26.03.70-f7b1fd3
Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology
|
Manages alignment guides and snapping for widget movement. More...
#include <alignmentguide.h>
Classes | |
| struct | AlignmentPoints |
| struct | GuideLine |
Public Types | |
| enum class | GuideType { None , LeftEdge , RightEdge , HorizontalCenter , TopEdge , BottomEdge , VerticalCenter } |
Public Member Functions | |
| AlignmentGuide (UMLScene *scene) | |
| ~AlignmentGuide () | |
| QPointF | snapPosition (UMLWidget *widget, const QPointF &proposedPos) |
| void | snapResize (UMLWidget *widget, qreal proposedWidth, qreal proposedHeight, qreal &newWidth, qreal &newHeight) |
| QList< GuideLine > | activeGuides () const |
| void | clear () |
| void | setSnapThreshold (qreal threshold) |
| qreal | snapThreshold () const |
| void | setEnabled (bool enabled) |
| bool | isEnabled () const |
Private Member Functions | |
| AlignmentPoints | getAlignmentPoints (UMLWidget *widget, const QPointF &pos) const |
| void | findBestSnap (qreal position, const QList< qreal > &candidates, qreal &minDistance, qreal &bestSnap, qreal &offset, GuideType &bestGuideType, GuideType guideType) const |
Private Attributes | |
| UMLScene * | m_scene |
| QList< GuideLine > | m_activeGuides |
| qreal | m_snapThreshold |
| bool | m_enabled |
Manages alignment guides and snapping for widget movement.
This class provides visual alignment guides and automatic snapping when dragging widgets near alignment points of other widgets.
Alignment points include:
|
strong |
|
explicit |
| AlignmentGuide::~AlignmentGuide | ( | ) |
| QList< AlignmentGuide::GuideLine > AlignmentGuide::activeGuides | ( | ) | const |
Get the list of active guide lines to render.
Get the list of active guide lines.
| void AlignmentGuide::clear | ( | ) |
Clear all active guides.
|
private |
Find the best snap among candidates for a given position.
| position | The position to check |
| candidates | List of candidate alignment values |
| minDistance | In/out parameter for minimum distance found |
| bestSnap | Out parameter for the best snap position |
| offset | Out parameter for the offset to apply |
| bestGuideType | In/out parameter for tracking the best guide type |
| guideType | The guide type to set if this is the best match |
Find the best snap among candidates for a given position.
|
private |
Calculate alignment points for a widget at a given position.
| bool AlignmentGuide::isEnabled | ( | ) | const |
Check if alignment guides are enabled.
Check if alignment guides are enabled.
| void AlignmentGuide::setEnabled | ( | bool | enabled | ) |
Enable or disable alignment guides.
| enabled | True to enable, false to disable |
Enable or disable alignment guides.
| void AlignmentGuide::setSnapThreshold | ( | qreal | threshold | ) |
Set the snap threshold distance in pixels (screen coordinates).
| threshold | Distance within which snapping occurs |
Set the snap threshold.
| QPointF AlignmentGuide::snapPosition | ( | UMLWidget * | widget, |
| const QPointF & | proposedPos | ||
| ) |
Check for alignment opportunities and snap the position if near an alignment.
| widget | The widget being moved |
| proposedPos | The proposed new position |
Snap the proposed position to nearby alignment guides.
| void AlignmentGuide::snapResize | ( | UMLWidget * | widget, |
| qreal | proposedWidth, | ||
| qreal | proposedHeight, | ||
| qreal & | newWidth, | ||
| qreal & | newHeight | ||
| ) |
Check for alignment opportunities and snap the size during resize.
| widget | The widget being resized |
| proposedWidth | The proposed new width |
| proposedHeight | The proposed new height |
| newWidth | Output parameter for snapped width |
| newHeight | Output parameter for snapped height |
Snap the size during resize operations.
| qreal AlignmentGuide::snapThreshold | ( | ) | const |
Get the current snap threshold in scene coordinates. This is adjusted based on the current zoom level to maintain a consistent screen-space distance.
Get the snap threshold in scene coordinates. Adjusts for zoom level to maintain consistent screen-space distance.
|
private |
|
private |
|
private |
|
private |