summaryrefslogtreecommitdiffstats
path: root/tools/qml
diff options
context:
space:
mode:
Diffstat (limited to 'tools/qml')
-rw-r--r--tools/qml/browser/Browser.qml6
-rw-r--r--tools/qml/deviceorientation.h4
-rw-r--r--tools/qml/main.cpp56
-rw-r--r--tools/qml/qdeclarativetester.cpp25
-rw-r--r--tools/qml/qdeclarativetester.h4
-rw-r--r--tools/qml/qml.pro4
-rw-r--r--tools/qml/qmlruntime.cpp6
-rw-r--r--tools/qml/startup/startup.qml6
-rw-r--r--tools/qml/texteditautoresizer_maemo5.h12
9 files changed, 66 insertions, 57 deletions
diff --git a/tools/qml/browser/Browser.qml b/tools/qml/browser/Browser.qml
index ebed72f..968d077 100644
--- a/tools/qml/browser/Browser.qml
+++ b/tools/qml/browser/Browser.qml
@@ -173,14 +173,14 @@ Rectangle {
width: parent.width
model: folders1
delegate: folderDelegate
- highlight: Rectangle {
+ highlight: Rectangle {
color: palette.highlight
visible: root.showFocusHighlight && view1.count != 0
gradient: Gradient {
GradientStop { id: t1; position: 0.0; color: palette.highlight }
GradientStop { id: t2; position: 1.0; color: Qt.lighter(palette.highlight) }
}
- width: view1.currentItem.width
+ width: view1.currentItem == null ? 0 : view1.currentItem.width
}
highlightMoveSpeed: 1000
pressDelay: 100
@@ -230,7 +230,7 @@ Rectangle {
GradientStop { id: t1; position: 0.0; color: palette.highlight }
GradientStop { id: t2; position: 1.0; color: Qt.lighter(palette.highlight) }
}
- width: view1.currentItem.width
+ width: view1.currentItem == null ? 0 : view1.currentItem.width
}
highlightMoveSpeed: 1000
pressDelay: 100
diff --git a/tools/qml/deviceorientation.h b/tools/qml/deviceorientation.h
index 487ebd4..88ceb1b 100644
--- a/tools/qml/deviceorientation.h
+++ b/tools/qml/deviceorientation.h
@@ -52,8 +52,8 @@ class DeviceOrientation : public QObject
Q_OBJECT
Q_ENUMS(Orientation)
public:
- enum Orientation {
- UnknownOrientation,
+ enum Orientation {
+ UnknownOrientation,
Portrait,
Landscape,
PortraitInverted,
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp
index 209c72f..b9513b9 100644
--- a/tools/qml/main.cpp
+++ b/tools/qml/main.cpp
@@ -59,6 +59,19 @@ QtMsgHandler systemMsgOutput = 0;
static QDeclarativeViewer *openFile(const QString &fileName);
static void showViewer(QDeclarativeViewer *viewer);
+QString warnings;
+void exitApp(int i)
+{
+#ifdef Q_OS_WIN
+ // Debugging output is not visible by default on Windows -
+ // therefore show modal dialog with errors instead.
+ if (!warnings.isEmpty()) {
+ QMessageBox::warning(0, QApplication::tr("Qt QML Viewer"), warnings);
+ }
+#endif
+ exit(i);
+}
+
#if defined (Q_OS_SYMBIAN)
#include <unistd.h>
#include <sys/types.h>
@@ -85,31 +98,22 @@ void myMessageOutput(QtMsgType type, const char *msg)
QWeakPointer<LoggerWidget> logger;
-QString warnings;
-void showWarnings()
-{
- if (!warnings.isEmpty()) {
- int argc = 0; char **argv = 0;
- QApplication application(argc, argv); // QApplication() in main has been destroyed already.
- Q_UNUSED(application)
- QMessageBox::warning(0, QApplication::tr("Qt QML Viewer"), warnings);
- }
-}
-
static QAtomicInt recursiveLock(0);
void myMessageOutput(QtMsgType type, const char *msg)
{
QString strMsg = QString::fromLatin1(msg);
- if (!logger.isNull() && !QCoreApplication::closingDown()) {
- if (recursiveLock.testAndSetOrdered(0, 1)) {
- QMetaObject::invokeMethod(logger.data(), "append", Q_ARG(QString, strMsg));
- recursiveLock = 0;
+ if (!QCoreApplication::closingDown()) {
+ if (!logger.isNull()) {
+ if (recursiveLock.testAndSetOrdered(0, 1)) {
+ QMetaObject::invokeMethod(logger.data(), "append", Q_ARG(QString, strMsg));
+ recursiveLock = 0;
+ }
+ } else {
+ warnings += strMsg;
+ warnings += QLatin1Char('\n');
}
- } else {
- warnings += strMsg;
- warnings += QLatin1Char('\n');
}
if (systemMsgOutput) { // Windows
systemMsgOutput(type, msg);
@@ -165,7 +169,8 @@ void usage()
qWarning(" ");
qWarning(" Press F1 for interactive help");
- exit(1);
+
+ exitApp(1);
}
void scriptOptsUsage()
@@ -184,7 +189,8 @@ void scriptOptsUsage()
qWarning(" saveonexit ............................... save recording on viewer exit");
qWarning(" ");
qWarning(" One of record, play or both must be specified.");
- exit(1);
+
+ exitApp(1);
}
enum WarningsConfig { ShowWarnings, HideWarnings, DefaultWarnings };
@@ -370,7 +376,7 @@ static void parseCommandLineOptions(const QStringList &arguments)
qApp->setStartDragDistance(arguments.at(++i).toInt());
} else if (arg == QLatin1String("-v") || arg == QLatin1String("-version")) {
qWarning("Qt QML Viewer version %s", QT_VERSION_STR);
- exit(0);
+ exitApp(0);
} else if (arg == "-translation") {
if (lastArg) usage();
opts.translationFile = arguments.at(++i);
@@ -400,7 +406,7 @@ static void parseCommandLineOptions(const QStringList &arguments)
QDeclarativeEngine tmpEngine;
QString paths = tmpEngine.importPathList().join(QLatin1String(":"));
qWarning("Current search path: %s", paths.toLocal8Bit().constData());
- exit(0);
+ exitApp(0);
}
opts.imports << arguments.at(++i);
} else if (arg == "-P") {
@@ -529,12 +535,6 @@ int main(int argc, char ** argv)
systemMsgOutput = qInstallMsgHandler(myMessageOutput);
#endif
-#if defined (Q_OS_WIN)
- // Debugging output is not visible by default on Windows -
- // therefore show modal dialog with errors instead.
- atexit(showWarnings);
-#endif
-
#if defined (Q_WS_X11) || defined (Q_WS_MAC)
//### default to using raster graphics backend for now
bool gsSpecified = false;
diff --git a/tools/qml/qdeclarativetester.cpp b/tools/qml/qdeclarativetester.cpp
index a516fd7..1bcdb04 100644
--- a/tools/qml/qdeclarativetester.cpp
+++ b/tools/qml/qdeclarativetester.cpp
@@ -54,9 +54,9 @@ QT_BEGIN_NAMESPACE
extern Q_GUI_EXPORT bool qt_applefontsmoothing_enabled;
-QDeclarativeTester::QDeclarativeTester(const QString &script, QDeclarativeViewer::ScriptOptions opts,
+QDeclarativeTester::QDeclarativeTester(const QString &script, QDeclarativeViewer::ScriptOptions opts,
QDeclarativeView *parent)
-: QAbstractAnimation(parent), m_script(script), m_view(parent), filterEvents(true), options(opts),
+: QAbstractAnimation(parent), m_script(script), m_view(parent), filterEvents(true), options(opts),
testscript(0), hasCompleted(false), hasFailed(false)
{
parent->viewport()->installEventFilter(this);
@@ -75,8 +75,8 @@ QDeclarativeTester::QDeclarativeTester(const QString &script, QDeclarativeViewer
QDeclarativeTester::~QDeclarativeTester()
{
- if (!hasFailed &&
- options & QDeclarativeViewer::Record &&
+ if (!hasFailed &&
+ options & QDeclarativeViewer::Record &&
options & QDeclarativeViewer::SaveOnExit)
save();
}
@@ -228,7 +228,7 @@ void QDeclarativeTester::save()
}
ts << " }\n";
- while (!mouseevents.isEmpty() &&
+ while (!mouseevents.isEmpty() &&
mouseevents.first().msec == fe.msec) {
MouseEvent me = mouseevents.takeFirst();
@@ -274,7 +274,16 @@ void QDeclarativeTester::updateCurrentTime(int msec)
if (options & QDeclarativeViewer::TestImages) {
img.fill(qRgb(255,255,255));
+
+#ifdef Q_WS_MAC
+ bool oldSmooth = qt_applefontsmoothing_enabled;
+ qt_applefontsmoothing_enabled = false;
+#endif
QPainter p(&img);
+#ifdef Q_WS_MAC
+ qt_applefontsmoothing_enabled = oldSmooth;
+#endif
+
m_view->render(&p);
}
@@ -336,7 +345,7 @@ void QDeclarativeTester::updateCurrentTime(int msec)
if (QDeclarativeVisualTestFrame *frame = qobject_cast<QDeclarativeVisualTestFrame *>(event)) {
if (frame->msec() < msec) {
if (options & QDeclarativeViewer::TestImages && !(options & QDeclarativeViewer::Record)) {
- qWarning() << "QDeclarativeTester(" << m_script << "): Extra frame. Seen:"
+ qWarning() << "QDeclarativeTester(" << m_script << "): Extra frame. Seen:"
<< msec << "Expected:" << frame->msec();
imagefailure();
}
@@ -362,7 +371,7 @@ void QDeclarativeTester::updateCurrentTime(int msec)
}
if (goodImage != img) {
QString reject(frame->image().toLocalFile() + ".reject.png");
- qWarning() << "QDeclarativeTester(" << m_script << "): Image mismatch. Reject saved to:"
+ qWarning() << "QDeclarativeTester(" << m_script << "): Image mismatch. Reject saved to:"
<< reject;
img.save(reject);
bool doDiff = (goodImage.size() == img.size());
@@ -415,7 +424,7 @@ void QDeclarativeTester::updateCurrentTime(int msec)
ke.destination = ViewPort;
}
m_savedKeyEvents.append(ke);
- }
+ }
testscriptidx++;
}
diff --git a/tools/qml/qdeclarativetester.h b/tools/qml/qdeclarativetester.h
index 0cf508a..6fdf495 100644
--- a/tools/qml/qdeclarativetester.h
+++ b/tools/qml/qdeclarativetester.h
@@ -122,7 +122,7 @@ public:
int type() const { return m_type; }
void setType(int t) { m_type = t; }
-
+
int button() const { return m_button; }
void setButton(int b) { m_button = b; }
@@ -237,7 +237,7 @@ private:
struct MouseEvent {
MouseEvent(QMouseEvent *e)
- : type(e->type()), button(e->button()), buttons(e->buttons()),
+ : type(e->type()), button(e->button()), buttons(e->buttons()),
pos(e->pos()), modifiers(e->modifiers()), destination(View) {}
QEvent::Type type;
diff --git a/tools/qml/qml.pro b/tools/qml/qml.pro
index 3927dd6..bdac6e3 100644
--- a/tools/qml/qml.pro
+++ b/tools/qml/qml.pro
@@ -4,7 +4,7 @@ DESTDIR = ../../bin
include(qml.pri)
-SOURCES += main.cpp
+SOURCES += main.cpp
INCLUDEPATH += ../../include/QtDeclarative
INCLUDEPATH += ../../src/declarative/util
@@ -26,7 +26,7 @@ wince* {
QT += xmlpatterns
}
contains(QT_CONFIG, webkit) {
- QT += webkit
+ QT += webkit
}
}
maemo5 {
diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp
index 7ea77d1..142e4c5 100644
--- a/tools/qml/qmlruntime.cpp
+++ b/tools/qml/qmlruntime.cpp
@@ -820,7 +820,7 @@ void QDeclarativeViewer::createMenu()
fileMenu->addAction(reloadAction);
fileMenu->addSeparator();
fileMenu->addAction(closeAction);
-#if !defined(Q_OS_SYMBIAN)
+#if !defined(Q_OS_SYMBIAN)
fileMenu->addAction(quitAction);
QMenu *recordMenu = menu->addMenu(tr("&Recording"));
@@ -836,7 +836,7 @@ void QDeclarativeViewer::createMenu()
settingsMenu->addAction(proxyAction);
#if defined(Q_OS_SYMBIAN)
settingsMenu->addAction(fullscreenAction);
-#else
+#else
settingsMenu->addAction(recordOptions);
settingsMenu->addMenu(loggerWindow->preferencesMenu());
#endif // !Q_OS_SYMBIAN
@@ -1520,7 +1520,7 @@ void QDeclarativeViewer::updateSizeHints(bool initial)
//qWarning() << "USH: R2V: setting free size ";
layout()->setSizeConstraint(QLayout::SetNoConstraint);
layout()->activate();
- setMinimumSize(QSize(1,1));
+ setMinimumSize(minimumSizeHint());
setMaximumSize(QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX));
canvas->setMinimumSize(QSize(0,0));
canvas->setMaximumSize(QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX));
diff --git a/tools/qml/startup/startup.qml b/tools/qml/startup/startup.qml
index 9ca50a3..35c44c2 100644
--- a/tools/qml/startup/startup.qml
+++ b/tools/qml/startup/startup.qml
@@ -92,8 +92,8 @@ Rectangle {
to: 360
loops: NumberAnimation.Infinite
running: true
- duration: 2000
- }
+ duration: 2000
+ }
}
}
}
@@ -168,6 +168,6 @@ Rectangle {
}
}
}
- ]
+ ]
} // treatsApp
diff --git a/tools/qml/texteditautoresizer_maemo5.h b/tools/qml/texteditautoresizer_maemo5.h
index bb5567a..fd35ca5 100644
--- a/tools/qml/texteditautoresizer_maemo5.h
+++ b/tools/qml/texteditautoresizer_maemo5.h
@@ -41,7 +41,7 @@
#include <QtGui/qplaintextedit.h>
#include <QtGui/qtextedit.h>
-#include <QtGui/qabstractkineticscroller.h>
+#include <QtGui/qscroller.h>
#include <QtGui/qscrollarea.h>
#include <QtDebug>
@@ -102,11 +102,11 @@ void TextEditAutoResizer::textEditChanged()
QPoint scrollto = area->widget()->mapFrom(edit, cursor.center());
QPoint margin(10 + cursor.width(), 2 * cursor.height());
- if (QAbstractKineticScroller *scroller = area->property("kineticScroller").value<QAbstractKineticScroller *>()) {
- scroller->ensureVisible(scrollto, margin.x(), margin.y());
- } else {
- area->ensureVisible(scrollto.x(), scrollto.y(), margin.x(), margin.y());
- }
+#ifdef Q_WS_MAEMO_5
+ QScroller::scroller(area)->ensureVisible(scrollto, margin.x(), margin.y());
+#else
+ area->ensureVisible(scrollto.x(), scrollto.y(), margin.x(), margin.y());
+#endif
}
}