QGIS API Documentation 3.41.0-Master (45a0abf3bec)
Loading...
Searching...
No Matches
Signals | Public Member Functions | Protected Member Functions | Properties | List of all members
QgsRatioLockButton Class Reference

A cross platform button subclass used to represent a locked / unlocked ratio state. More...

#include <qgsratiolockbutton.h>

Inheritance diagram for QgsRatioLockButton:
Inheritance graph
[legend]

Signals

void lockChanged (bool locked)
 Emitted whenever the lock state changes.
 

Public Member Functions

 QgsRatioLockButton (QWidget *parent=nullptr)
 Construct a new ratio lock button.
 
bool locked () const
 Returns whether the button state is locked.
 
void resetRatio ()
 Resets the current width/height ratio, taking the width and height from the current values of the width and height spin boxes.
 
void setHeightSpinBox (QDoubleSpinBox *widget)
 Registers a spin box widget as the linked "height" spin box.
 
void setLocked (bool locked)
 Sets whether the button state is locked.
 
void setWidthSpinBox (QDoubleSpinBox *widget)
 Registers a spin box widget as the linked "width" spin box.
 

Protected Member Functions

void changeEvent (QEvent *e) override
 
void resizeEvent (QResizeEvent *event) override
 
void showEvent (QShowEvent *e) override
 

Properties

bool locked
 

Detailed Description

A cross platform button subclass used to represent a locked / unlocked ratio state.

Definition at line 33 of file qgsratiolockbutton.h.

Constructor & Destructor Documentation

◆ QgsRatioLockButton()

QgsRatioLockButton::QgsRatioLockButton ( QWidget *  parent = nullptr)

Construct a new ratio lock button.

Use parent to attach a parent QWidget to the button.

Definition at line 29 of file qgsratiolockbutton.cpp.

Member Function Documentation

◆ changeEvent()

void QgsRatioLockButton::changeEvent ( QEvent *  e)
overrideprotected

Definition at line 87 of file qgsratiolockbutton.cpp.

◆ lockChanged

void QgsRatioLockButton::lockChanged ( bool  locked)
signal

Emitted whenever the lock state changes.

◆ locked()

bool QgsRatioLockButton::locked ( ) const
inline

Returns whether the button state is locked.

Returns
true if the button state is locked.
See also
setLocked

Definition at line 58 of file qgsratiolockbutton.h.

◆ resetRatio()

void QgsRatioLockButton::resetRatio ( )

Resets the current width/height ratio, taking the width and height from the current values of the width and height spin boxes.

Definition at line 174 of file qgsratiolockbutton.cpp.

◆ resizeEvent()

void QgsRatioLockButton::resizeEvent ( QResizeEvent *  event)
overrideprotected

Definition at line 102 of file qgsratiolockbutton.cpp.

◆ setHeightSpinBox()

void QgsRatioLockButton::setHeightSpinBox ( QDoubleSpinBox *  widget)

Registers a spin box widget as the linked "height" spin box.

If both a width and height spin box are linked to the button, they will automatically have their values updates when if the other spin box value is changed. I.e. changing the width spin box will automatically update the height spin box to a value which keeps the same locked ratio.

See also
setWidthSpinBox()

Definition at line 167 of file qgsratiolockbutton.cpp.

◆ setLocked()

void QgsRatioLockButton::setLocked ( bool  locked)

Sets whether the button state is locked.

Parameters
lockedlocked state
See also
locked

Definition at line 39 of file qgsratiolockbutton.cpp.

◆ setWidthSpinBox()

void QgsRatioLockButton::setWidthSpinBox ( QDoubleSpinBox *  widget)

Registers a spin box widget as the linked "width" spin box.

If both a width and height spin box are linked to the button, they will automatically have their values updates when if the other spin box value is changed. I.e. changing the width spin box will automatically update the height spin box to a value which keeps the same locked ratio.

See also
setHeightSpinBox()

Definition at line 160 of file qgsratiolockbutton.cpp.

◆ showEvent()

void QgsRatioLockButton::showEvent ( QShowEvent *  e)
overrideprotected

Definition at line 96 of file qgsratiolockbutton.cpp.

Property Documentation

◆ locked

bool QgsRatioLockButton::locked
readwrite

Definition at line 36 of file qgsratiolockbutton.h.


The documentation for this class was generated from the following files: