2
* Copyright (C) 2013 Canonical, Ltd.
4
* Redistribution and use in source and binary forms, with or without modification,
5
* are permitted provided that the following conditions are met:
7
* Redistributions of source code must retain the above copyright notice, this list
8
* of conditions and the following disclaimer.
9
* Redistributions in binary form must reproduce the above copyright notice, this list
10
* of conditions and the following disclaimer in the documentation and/or other materials
11
* provided with the distribution.
12
* Neither the name of Nokia Corporation nor the names of its contributors may be
13
* used to endorse or promote products derived from this software without specific
14
* prior written permission.
16
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
17
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
19
* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
#include "keyboardgeometry.h"
32
KeyboardGeometry::KeyboardGeometry(QObject *parent) :
37
, m_orientation(Qt::PrimaryOrientation)
42
//! \brief KeyboardGeometry::keypadHeight returns the height of the keypad
43
//! The keypad is the part of the keyboard containing alls the keys and the
45
//! But it does not include for example the extra height for items like the
48
int KeyboardGeometry::keypadHeight() const
50
return m_keypadHeight;
53
//! \brief KeyboardGeometry::setKeypadHeight
54
//! \param height height of the keypad in pixel
55
void KeyboardGeometry::setKeypadHeight(int height)
57
if (height == m_keypadHeight)
60
m_keypadHeight = height;
61
Q_EMIT keypadHeightChanged();
64
//! \brief KeyboardGeometry::canvasHeight height for the canvas item
65
//! FIXME this should not be needed, and calculated in QML directly
67
int KeyboardGeometry::canvasHeight() const
69
return m_canvasHeight;
72
//! \brief KeyboardGeometry::setCanvasHeight
73
//! FIXME this should not be needed, and calculated in QML directly
75
void KeyboardGeometry::setCanvasHeight(int height)
77
if (height == m_canvasHeight)
80
m_canvasHeight = height;
81
Q_EMIT canvasHeightChanged();
84
//! \brief KeyboardGeometry::visibleRect returns the size and position of the total
85
//! keyboard for the windowing system
87
const QRectF &KeyboardGeometry::visibleRect() const
92
//! \brief KeyboardGeometry::setVisibleRect
94
void KeyboardGeometry::setVisibleRect(const QRectF &rect)
96
if (rect == m_visibleRect)
100
Q_EMIT visibleRectChanged();
103
//! \brief KeyboardGeometry::orientation
105
Qt::ScreenOrientation KeyboardGeometry::orientation() const
107
return m_orientation;
110
//! \brief KeyboardGeometry::setOrientation sets the orientation of the keyboard
113
void KeyboardGeometry::setOrientation(Qt::ScreenOrientation orient)
115
if (orient == m_orientation)
118
m_orientation = orient;
119
Q_EMIT orientationChanged();
122
//! \brief KeyboardGeometry::shown property to indicate if the OSK is visible
124
bool KeyboardGeometry::shown() const
129
//! \brief KeyboardGeometry::setShown
131
void KeyboardGeometry::setShown(bool show)
137
Q_EMIT shownChanged();