QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
gui
qgsratiolockbutton.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsratiolockbutton.cpp - Lock button
3
--------------------------------------
4
Date : July, 2017
5
Copyright : (C) 2017 by Mathieu Pellerin
6
Email : nirvn dot asia at gmail dot com
7
***************************************************************************
8
* *
9
* This program is free software; you can redistribute it and/or modify *
10
* it under the terms of the GNU General Public License as published by *
11
* the Free Software Foundation; either version 2 of the License, or *
12
* (at your option) any later version. *
13
* *
14
***************************************************************************/
15
16
#ifndef QGSLOCKBUTTON_H
17
#define QGSLOCKBUTTON_H
18
19
#include "
qgsratiolockbutton.h
"
20
21
#include "qgis_gui.h"
22
#include "
qgis_sip.h
"
23
24
#include <QPointer>
25
#include <QToolButton>
26
27
class
QDoubleSpinBox;
28
34
class
GUI_EXPORT
QgsRatioLockButton
:
public
QToolButton
35
{
36
Q_OBJECT
37
Q_PROPERTY(
bool
locked
READ
locked
WRITE
setLocked
)
38
39
public
:
44
QgsRatioLockButton
( QWidget *parent
SIP_TRANSFERTHIS
=
nullptr
);
45
51
void
setLocked
(
bool
locked
);
52
58
bool
locked
()
const
{
return
mLocked; }
59
70
void
setWidthSpinBox( QDoubleSpinBox *widget );
71
82
void
setHeightSpinBox( QDoubleSpinBox *widget );
83
88
void
resetRatio();
89
90
signals:
91
95
void
lockChanged
(
bool
locked
);
96
97
protected
:
98
void
changeEvent
( QEvent *e )
override
;
99
void
showEvent
( QShowEvent *e )
override
;
100
void
resizeEvent
( QResizeEvent *event )
override
;
101
102
private
:
103
void
drawButton();
104
105
bool
mLocked =
false
;
106
107
QPointer<QDoubleSpinBox> mWidthSpinBox;
108
double
mPrevWidth = 0;
109
QPointer<QDoubleSpinBox> mHeightSpinBox;
110
double
mPrevHeight = 0;
111
bool
mUpdatingRatio =
false
;
112
113
private
slots:
114
115
void
buttonClicked();
116
117
void
widthSpinBoxChanged(
double
value );
118
void
heightSpinBoxChanged(
double
value );
119
};
120
121
#endif
QgsRatioLockButton::setLocked
void setLocked(bool locked)
Sets whether the button state is locked.
Definition
qgsratiolockbutton.cpp:44
QgsRatioLockButton::changeEvent
void changeEvent(QEvent *e) override
Definition
qgsratiolockbutton.cpp:90
QgsRatioLockButton::resizeEvent
void resizeEvent(QResizeEvent *event) override
Definition
qgsratiolockbutton.cpp:105
QgsRatioLockButton::QgsRatioLockButton
QgsRatioLockButton(QWidget *parent=nullptr)
Construct a new ratio lock button.
Definition
qgsratiolockbutton.cpp:34
QgsRatioLockButton::locked
bool locked() const
Returns whether the button state is locked.
Definition
qgsratiolockbutton.h:58
QgsRatioLockButton::showEvent
void showEvent(QShowEvent *e) override
Definition
qgsratiolockbutton.cpp:99
QgsRatioLockButton::lockChanged
void lockChanged(bool locked)
Emitted whenever the lock state changes.
QgsRatioLockButton::locked
bool locked
Definition
qgsratiolockbutton.h:37
qgis_sip.h
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition
qgis_sip.h:52
qgsratiolockbutton.h
Generated on
for QGIS API Documentation by
1.17.0