~timo-jyrinki/ubuntu/trusty/maliit-framework/fix_qt52

« back to all changes in this revision

Viewing changes to examples/apps/plainqt/mainwindow.cpp

  • Committer: Package Import Robot
  • Author(s): Ricardo Salveti de Araujo, Sergio Schvezov, Ricardo Salveti de Araujo
  • Date: 2013-07-23 19:47:04 UTC
  • mfrom: (1.1.2) (1.2.1 experimental)
  • Revision ID: package-import@ubuntu.com-20130723194704-1lsy1kmlda069cea
Tags: 0.99.0+git20130615+97e8335-0ubuntu1
[ Sergio Schvezov ]
* New build from HEAD 97e8335.
* Packaging import from lp:phablet-extras/maliit-framework.

[ Ricardo Salveti de Araujo ]
* debian/control: adding vcs and fixing dependencies
* General package cleanup

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#include "mainwindow.h"
2
2
 
3
 
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
4
3
#include <QGuiApplication>
5
4
#include <QScreen>
6
5
#include <QWindow>
7
 
#else
8
 
#include <maliit/namespace.h>
9
 
#include <maliit/inputmethod.h>
10
 
#endif
11
6
 
12
7
#include <QtCore>
13
8
#include <QVBoxLayout>
74
69
    initUI();
75
70
    onServerStateChanged();
76
71
 
77
 
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
78
72
    // Work around a bug in maliit input method support where primary orientation is always portrait
79
73
    windowHandle()->reportContentOrientationChange(windowHandle()->screen()->primaryOrientation());
80
 
#endif
81
74
}
82
75
 
83
76
void MainWindow::initUI()
172
165
 
173
166
    // Let the input method show up on focus-in, not on second click:
174
167
    if (event->type() == QFocusEvent::FocusIn) {
175
 
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
176
168
        qApp->inputMethod()->show();
177
 
#else
178
 
        if (QInputContext *ic = qApp->inputContext()) {
179
 
            QEvent im_request(QEvent::RequestSoftwareInputPanel);
180
 
            ic->filterEvent(&im_request);
181
 
        }
182
 
#endif
183
169
    }
184
170
 
185
171
    return false;
227
213
{
228
214
    ++m_orientation_index;
229
215
 
230
 
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
231
216
    static const Qt::ScreenOrientation orientations[] = {
232
217
        Qt::LandscapeOrientation,
233
218
        Qt::PortraitOrientation,
236
221
    };
237
222
 
238
223
    windowHandle()->reportContentOrientationChange(orientations[m_orientation_index % 4]);
239
 
#else
240
 
    static const Maliit::OrientationAngle orientations[] = {
241
 
        Maliit::Angle0,
242
 
        Maliit::Angle90,
243
 
        Maliit::Angle180,
244
 
        Maliit::Angle270
245
 
    };
246
 
 
247
 
    Maliit::InputMethod::instance()->setOrientationAngle(orientations[m_orientation_index % 4]);
248
 
#endif
249
224
}