Make QStyleHints usable in QML
Change-Id: Ia8f143d12c754b4af4a29bb9542cd050b5ae2ab0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Liang Qi <liang.qi@theqtcompany.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
This commit is contained in:
parent
75f2a0b4ef
commit
9d5b1fd151
@ -104,11 +104,15 @@ QStyleHints::QStyleHints()
|
|||||||
void QStyleHints::setMouseDoubleClickInterval(int mouseDoubleClickInterval)
|
void QStyleHints::setMouseDoubleClickInterval(int mouseDoubleClickInterval)
|
||||||
{
|
{
|
||||||
Q_D(QStyleHints);
|
Q_D(QStyleHints);
|
||||||
|
if (d->m_mouseDoubleClickInterval == mouseDoubleClickInterval)
|
||||||
|
return;
|
||||||
d->m_mouseDoubleClickInterval = mouseDoubleClickInterval;
|
d->m_mouseDoubleClickInterval = mouseDoubleClickInterval;
|
||||||
|
emit mouseDoubleClickIntervalChanged(mouseDoubleClickInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the time limit in milliseconds that distinguishes a double click
|
\property QStyleHints::mouseDoubleClickInterval
|
||||||
|
\brief the time limit in milliseconds that distinguishes a double click
|
||||||
from two consecutive mouse clicks.
|
from two consecutive mouse clicks.
|
||||||
*/
|
*/
|
||||||
int QStyleHints::mouseDoubleClickInterval() const
|
int QStyleHints::mouseDoubleClickInterval() const
|
||||||
@ -120,7 +124,8 @@ int QStyleHints::mouseDoubleClickInterval() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the time limit in milliseconds that activates
|
\property QStyleHints::mousePressAndHoldInterval
|
||||||
|
\brief the time limit in milliseconds that activates
|
||||||
a press and hold.
|
a press and hold.
|
||||||
|
|
||||||
\since 5.3
|
\since 5.3
|
||||||
@ -139,11 +144,15 @@ int QStyleHints::mousePressAndHoldInterval() const
|
|||||||
void QStyleHints::setStartDragDistance(int startDragDistance)
|
void QStyleHints::setStartDragDistance(int startDragDistance)
|
||||||
{
|
{
|
||||||
Q_D(QStyleHints);
|
Q_D(QStyleHints);
|
||||||
|
if (d->m_startDragDistance == startDragDistance)
|
||||||
|
return;
|
||||||
d->m_startDragDistance = startDragDistance;
|
d->m_startDragDistance = startDragDistance;
|
||||||
|
emit startDragDistanceChanged(startDragDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the distance, in pixels, that the mouse must be moved with a button
|
\property QStyleHints::startDragDistance
|
||||||
|
\brief the distance, in pixels, that the mouse must be moved with a button
|
||||||
held down before a drag and drop operation will begin.
|
held down before a drag and drop operation will begin.
|
||||||
|
|
||||||
If you support drag and drop in your application, and want to start a drag
|
If you support drag and drop in your application, and want to start a drag
|
||||||
@ -157,7 +166,7 @@ void QStyleHints::setStartDragDistance(int startDragDistance)
|
|||||||
|
|
||||||
\snippet code/src_gui_kernel_qapplication.cpp 6
|
\snippet code/src_gui_kernel_qapplication.cpp 6
|
||||||
|
|
||||||
\sa startDragTime(), QPoint::manhattanLength(), {Drag and Drop}
|
\sa startDragTime, QPoint::manhattanLength(), {Drag and Drop}
|
||||||
*/
|
*/
|
||||||
int QStyleHints::startDragDistance() const
|
int QStyleHints::startDragDistance() const
|
||||||
{
|
{
|
||||||
@ -176,18 +185,22 @@ int QStyleHints::startDragDistance() const
|
|||||||
void QStyleHints::setStartDragTime(int startDragTime)
|
void QStyleHints::setStartDragTime(int startDragTime)
|
||||||
{
|
{
|
||||||
Q_D(QStyleHints);
|
Q_D(QStyleHints);
|
||||||
|
if (d->m_startDragTime == startDragTime)
|
||||||
|
return;
|
||||||
d->m_startDragTime = startDragTime;
|
d->m_startDragTime = startDragTime;
|
||||||
|
emit startDragTimeChanged(startDragTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the time, in milliseconds, that a mouse button must be held down
|
\property QStyleHints::startDragTime
|
||||||
|
\brief the time, in milliseconds, that a mouse button must be held down
|
||||||
before a drag and drop operation will begin.
|
before a drag and drop operation will begin.
|
||||||
|
|
||||||
If you support drag and drop in your application, and want to start a drag
|
If you support drag and drop in your application, and want to start a drag
|
||||||
and drop operation after the user has held down a mouse button for a
|
and drop operation after the user has held down a mouse button for a
|
||||||
certain amount of time, you should use this property's value as the delay.
|
certain amount of time, you should use this property's value as the delay.
|
||||||
|
|
||||||
\sa startDragDistance(), {Drag and Drop}
|
\sa startDragDistance, {Drag and Drop}
|
||||||
*/
|
*/
|
||||||
int QStyleHints::startDragTime() const
|
int QStyleHints::startDragTime() const
|
||||||
{
|
{
|
||||||
@ -198,11 +211,12 @@ int QStyleHints::startDragTime() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the limit for the velocity, in pixels per second, that the mouse may
|
\property QStyleHints::startDragVelocity
|
||||||
|
\brief the limit for the velocity, in pixels per second, that the mouse may
|
||||||
be moved, with a button held down, for a drag and drop operation to begin.
|
be moved, with a button held down, for a drag and drop operation to begin.
|
||||||
A value of 0 means there is no such limit.
|
A value of 0 means there is no such limit.
|
||||||
|
|
||||||
\sa startDragDistance(), {Drag and Drop}
|
\sa startDragDistance, {Drag and Drop}
|
||||||
*/
|
*/
|
||||||
int QStyleHints::startDragVelocity() const
|
int QStyleHints::startDragVelocity() const
|
||||||
{
|
{
|
||||||
@ -218,11 +232,15 @@ int QStyleHints::startDragVelocity() const
|
|||||||
void QStyleHints::setKeyboardInputInterval(int keyboardInputInterval)
|
void QStyleHints::setKeyboardInputInterval(int keyboardInputInterval)
|
||||||
{
|
{
|
||||||
Q_D(QStyleHints);
|
Q_D(QStyleHints);
|
||||||
|
if (d->m_keyboardInputInterval == keyboardInputInterval)
|
||||||
|
return;
|
||||||
d->m_keyboardInputInterval = keyboardInputInterval;
|
d->m_keyboardInputInterval = keyboardInputInterval;
|
||||||
|
emit keyboardInputIntervalChanged(keyboardInputInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the time limit, in milliseconds, that distinguishes a key press
|
\property QStyleHints::keyboardInputInterval
|
||||||
|
\brief the time limit, in milliseconds, that distinguishes a key press
|
||||||
from two consecutive key presses.
|
from two consecutive key presses.
|
||||||
*/
|
*/
|
||||||
int QStyleHints::keyboardInputInterval() const
|
int QStyleHints::keyboardInputInterval() const
|
||||||
@ -234,7 +252,8 @@ int QStyleHints::keyboardInputInterval() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the rate, in events per second, in which additional repeated key
|
\property QStyleHints::keyboardAutoRepeatRate
|
||||||
|
\brief the rate, in events per second, in which additional repeated key
|
||||||
presses will automatically be generated if a key is being held down.
|
presses will automatically be generated if a key is being held down.
|
||||||
*/
|
*/
|
||||||
int QStyleHints::keyboardAutoRepeatRate() const
|
int QStyleHints::keyboardAutoRepeatRate() const
|
||||||
@ -251,11 +270,15 @@ int QStyleHints::keyboardAutoRepeatRate() const
|
|||||||
void QStyleHints::setCursorFlashTime(int cursorFlashTime)
|
void QStyleHints::setCursorFlashTime(int cursorFlashTime)
|
||||||
{
|
{
|
||||||
Q_D(QStyleHints);
|
Q_D(QStyleHints);
|
||||||
|
if (d->m_cursorFlashTime == cursorFlashTime)
|
||||||
|
return;
|
||||||
d->m_cursorFlashTime = cursorFlashTime;
|
d->m_cursorFlashTime = cursorFlashTime;
|
||||||
|
emit cursorFlashTimeChanged(cursorFlashTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the text cursor's flash (blink) time in milliseconds.
|
\property QStyleHints::cursorFlashTime
|
||||||
|
\brief the text cursor's flash (blink) time in milliseconds.
|
||||||
|
|
||||||
The flash time is the time used to display, invert and restore the
|
The flash time is the time used to display, invert and restore the
|
||||||
caret display. Usually the text cursor is displayed for half the cursor
|
caret display. Usually the text cursor is displayed for half the cursor
|
||||||
@ -270,11 +293,12 @@ int QStyleHints::cursorFlashTime() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns \c true if the platform defaults to windows being fullscreen,
|
\property QStyleHints::showIsFullScreen
|
||||||
|
\brief \c true if the platform defaults to windows being fullscreen,
|
||||||
otherwise \c false.
|
otherwise \c false.
|
||||||
|
|
||||||
\note The platform may still choose to show certain windows non-fullscreen,
|
\note The platform may still choose to show certain windows non-fullscreen,
|
||||||
such as popups or dialogs. This method only returns the default behavior.
|
such as popups or dialogs. This property only reports the default behavior.
|
||||||
|
|
||||||
\sa QWindow::show()
|
\sa QWindow::show()
|
||||||
*/
|
*/
|
||||||
@ -284,7 +308,8 @@ bool QStyleHints::showIsFullScreen() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the time, in milliseconds, a typed letter is displayed unshrouded
|
\property QStyleHints::passwordMaskDelay
|
||||||
|
\brief the time, in milliseconds, a typed letter is displayed unshrouded
|
||||||
in a text input field in password mode.
|
in a text input field in password mode.
|
||||||
*/
|
*/
|
||||||
int QStyleHints::passwordMaskDelay() const
|
int QStyleHints::passwordMaskDelay() const
|
||||||
@ -293,7 +318,8 @@ int QStyleHints::passwordMaskDelay() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the character used to mask the characters typed into text input
|
\property QStyleHints::passwordMaskCharacter
|
||||||
|
\brief the character used to mask the characters typed into text input
|
||||||
fields in password mode.
|
fields in password mode.
|
||||||
*/
|
*/
|
||||||
QChar QStyleHints::passwordMaskCharacter() const
|
QChar QStyleHints::passwordMaskCharacter() const
|
||||||
@ -302,7 +328,8 @@ QChar QStyleHints::passwordMaskCharacter() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the gamma value used in font smoothing.
|
\property QStyleHints::fontSmoothingGamma
|
||||||
|
\brief the gamma value used in font smoothing.
|
||||||
*/
|
*/
|
||||||
qreal QStyleHints::fontSmoothingGamma() const
|
qreal QStyleHints::fontSmoothingGamma() const
|
||||||
{
|
{
|
||||||
@ -310,7 +337,8 @@ qreal QStyleHints::fontSmoothingGamma() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns \c true if right-to-left writing direction is enabled,
|
\property QStyleHints::useRtlExtensions
|
||||||
|
\brief \c true if right-to-left writing direction is enabled,
|
||||||
otherwise \c false.
|
otherwise \c false.
|
||||||
*/
|
*/
|
||||||
bool QStyleHints::useRtlExtensions() const
|
bool QStyleHints::useRtlExtensions() const
|
||||||
@ -319,7 +347,8 @@ bool QStyleHints::useRtlExtensions() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns \c true if focus objects (line edits etc) should receive
|
\property QStyleHints::setFocusOnTouchRelease
|
||||||
|
\brief \c true if focus objects (line edits etc) should receive
|
||||||
input focus after a touch/mouse release. This is normal behavior on
|
input focus after a touch/mouse release. This is normal behavior on
|
||||||
touch platforms. On desktop platforms, the standard is to set
|
touch platforms. On desktop platforms, the standard is to set
|
||||||
focus already on touch/mouse press.
|
focus already on touch/mouse press.
|
||||||
|
@ -46,6 +46,21 @@ class Q_GUI_EXPORT QStyleHints : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_DECLARE_PRIVATE(QStyleHints)
|
Q_DECLARE_PRIVATE(QStyleHints)
|
||||||
|
Q_PROPERTY(int cursorFlashTime READ cursorFlashTime NOTIFY cursorFlashTimeChanged FINAL)
|
||||||
|
Q_PROPERTY(qreal fontSmoothingGamma READ fontSmoothingGamma STORED false FINAL)
|
||||||
|
Q_PROPERTY(int keyboardAutoRepeatRate READ keyboardAutoRepeatRate STORED false FINAL)
|
||||||
|
Q_PROPERTY(int keyboardInputInterval READ keyboardInputInterval NOTIFY keyboardInputIntervalChanged FINAL)
|
||||||
|
Q_PROPERTY(int mouseDoubleClickInterval READ mouseDoubleClickInterval NOTIFY mouseDoubleClickIntervalChanged FINAL)
|
||||||
|
Q_PROPERTY(int mousePressAndHoldInterval READ mousePressAndHoldInterval STORED false FINAL)
|
||||||
|
Q_PROPERTY(QChar passwordMaskCharacter READ passwordMaskCharacter STORED false FINAL)
|
||||||
|
Q_PROPERTY(int passwordMaskDelay READ passwordMaskDelay STORED false FINAL)
|
||||||
|
Q_PROPERTY(bool setFocusOnTouchRelease READ setFocusOnTouchRelease STORED false FINAL)
|
||||||
|
Q_PROPERTY(bool showIsFullScreen READ showIsFullScreen STORED false FINAL)
|
||||||
|
Q_PROPERTY(int startDragDistance READ startDragDistance NOTIFY startDragDistanceChanged FINAL)
|
||||||
|
Q_PROPERTY(int startDragTime READ startDragTime NOTIFY startDragTimeChanged FINAL)
|
||||||
|
Q_PROPERTY(int startDragVelocity READ startDragVelocity STORED false FINAL)
|
||||||
|
Q_PROPERTY(bool useRtlExtensions READ useRtlExtensions STORED false FINAL)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void setMouseDoubleClickInterval(int mouseDoubleClickInterval);
|
void setMouseDoubleClickInterval(int mouseDoubleClickInterval);
|
||||||
int mouseDoubleClickInterval() const;
|
int mouseDoubleClickInterval() const;
|
||||||
@ -67,6 +82,13 @@ public:
|
|||||||
bool useRtlExtensions() const;
|
bool useRtlExtensions() const;
|
||||||
bool setFocusOnTouchRelease() const;
|
bool setFocusOnTouchRelease() const;
|
||||||
|
|
||||||
|
Q_SIGNALS:
|
||||||
|
void cursorFlashTimeChanged(int cursorFlashTime);
|
||||||
|
void keyboardInputIntervalChanged(int keyboardInputInterval);
|
||||||
|
void mouseDoubleClickIntervalChanged(int mouseDoubleClickInterval);
|
||||||
|
void startDragDistanceChanged(int startDragDistance);
|
||||||
|
void startDragTimeChanged(int startDragTime);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class QGuiApplication;
|
friend class QGuiApplication;
|
||||||
QStyleHints();
|
QStyleHints();
|
||||||
|
Loading…
Reference in New Issue
Block a user