Source

Target

Commits (17)
Showing with 175 additions and 33 deletions
...@@ -43,6 +43,9 @@ Third party components ...@@ -43,6 +43,9 @@ Third party components
as count, which are based off of the data model will no longer update as count, which are based off of the data model will no longer update
immediately if queried. Updates are batched to happen once per frame (or immediately if queried. Updates are batched to happen once per frame (or
when properties are being set). when properties are being set).
- tryCompare now correctly fails when it only gets two parameters
**************************************************************************** ****************************************************************************
* Library * * Library *
**************************************************************************** ****************************************************************************
......
...@@ -6,5 +6,24 @@ SOURCES += main.cpp ...@@ -6,5 +6,24 @@ SOURCES += main.cpp
RESOURCES += calqlatr.qrc \ RESOURCES += calqlatr.qrc \
../../shared/shared.qrc ../../shared/shared.qrc
OTHER_FILES = calqlatr.qml \
content/Button.qml \
content/Display.qml \
content/NumberPad.qml \
content/StyleLabel.qml \
content/audio/touch.wav \
content/calculator.js \
content/images/icon-back.png \
content/images/icon-close.png \
content/images/icon-settings.png \
content/images/logo.png \
content/images/paper-edge-left.png \
content/images/paper-edge-right.png \
content/images/paper-grip.png \
content/images/settings-selected-a.png \
content/images/settings-selected-b.png \
content/images/touch-green.png \
content/images/touch-white.png
target.path = $$[QT_INSTALL_EXAMPLES]/quick/demos/calqlatr target.path = $$[QT_INSTALL_EXAMPLES]/quick/demos/calqlatr
INSTALLS += target INSTALLS += target
...@@ -57,7 +57,7 @@ Rectangle { ...@@ -57,7 +57,7 @@ Rectangle {
Item { Item {
id: pad id: pad
width: window.width * 0.58 width: 180
NumberPad { y: 10; anchors.horizontalCenter: parent.horizontalCenter } NumberPad { y: 10; anchors.horizontalCenter: parent.horizontalCenter }
} }
...@@ -77,7 +77,7 @@ Rectangle { ...@@ -77,7 +77,7 @@ Rectangle {
Display { Display {
id: display id: display
x: -16 x: -16
width: window.width * 0.42 width: window.width - pad.width
height: parent.height height: parent.height
MouseArea { MouseArea {
...@@ -85,7 +85,12 @@ Rectangle { ...@@ -85,7 +85,12 @@ Rectangle {
property real oldP: 0 property real oldP: 0
property bool rewind: false property bool rewind: false
anchors.fill: parent anchors {
bottom: parent.bottom
left: parent.left
right: parent.right
}
height: 50
onPositionChanged: { onPositionChanged: {
var reverse = startX > window.width / 2 var reverse = startX > window.width / 2
var mx = mapToItem(window, mouse.x).x var mx = mapToItem(window, mouse.x).x
......
...@@ -42,23 +42,38 @@ import QtQuick 2.0 ...@@ -42,23 +42,38 @@ import QtQuick 2.0
Item { Item {
id: display id: display
property bool enteringDigits: false
function displayOperator(operator) function displayOperator(operator)
{ {
listView.model.append({ "operator": operator, "operand": "" }) listView.model.append({ "operator": operator, "operand": "" })
enteringDigits = true
} }
function newLine(operator, operand) function newLine(operator, operand)
{ {
listView.model.append({ "operator": operator, "operand": operand }) listView.model.append({ "operator": operator, "operand": operand })
enteringDigits = false
listView.positionViewAtEnd()
} }
function appendDigit(digit) function appendDigit(digit)
{ {
if (!listView.model.count) if (!enteringDigits)
listView.model.append({ "operator": "", "operand": "" }) listView.model.append({ "operator": "", "operand": "" })
var i = listView.model.count - 1; var i = listView.model.count - 1;
listView.model.get(i).operand = listView.model.get(i).operand + digit; listView.model.get(i).operand = listView.model.get(i).operand + digit;
enteringDigits = true
}
function clear()
{
if (enteringDigits) {
var i = listView.model.count - 1
if (i >= 0)
listView.model.remove(i)
enteringDigits = false
}
} }
Item { Item {
...@@ -87,6 +102,7 @@ Item { ...@@ -87,6 +102,7 @@ Item {
} }
Image { Image {
id: grip
source: "images/paper-grip.png" source: "images/paper-grip.png"
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
...@@ -97,7 +113,7 @@ Item { ...@@ -97,7 +113,7 @@ Item {
id: listView id: listView
x: 16; y: 30 x: 16; y: 30
width: display.width width: display.width
height: display.height height: display.height - 50 - y
delegate: Item { delegate: Item {
height: 20 height: 20
width: parent.width width: parent.width
......
...@@ -60,7 +60,7 @@ Grid { ...@@ -60,7 +60,7 @@ Grid {
Button { text: "±"; color: "#6da43d"; operator: true } Button { text: "±"; color: "#6da43d"; operator: true }
Button { text: ""; color: "#6da43d"; operator: true } Button { text: ""; color: "#6da43d"; operator: true }
Button { text: "+"; color: "#6da43d"; operator: true } Button { text: "+"; color: "#6da43d"; operator: true }
Button { text: " "; color: "#6da43d"; operator: true } Button { text: ""; color: "#6da43d"; operator: true }
Button { text: "÷"; color: "#6da43d"; operator: true } Button { text: "÷"; color: "#6da43d"; operator: true }
Button { text: "×"; color: "#6da43d"; operator: true } Button { text: "×"; color: "#6da43d"; operator: true }
Button { text: "C"; color: "#6da43d"; operator: true } Button { text: "C"; color: "#6da43d"; operator: true }
......
...@@ -84,7 +84,7 @@ function operatorPressed(op) ...@@ -84,7 +84,7 @@ function operatorPressed(op)
} else if (previousOperator == "×") { } else if (previousOperator == "×") {
digits = Number(curVal) * Number(digits.valueOf()) digits = Number(curVal) * Number(digits.valueOf())
} else if (previousOperator == "÷") { } else if (previousOperator == "÷") {
digits = Number(Number(curVal) / Number(digits.valueOf())).toString() digits = Number(curVal) / Number(digits.valueOf())
} else if (previousOperator == "=") { } else if (previousOperator == "=") {
} }
...@@ -110,9 +110,9 @@ function operatorPressed(op) ...@@ -110,9 +110,9 @@ function operatorPressed(op)
digits = (Math.abs(digits.valueOf())).toString() digits = (Math.abs(digits.valueOf())).toString()
} else if (op == "Int") { } else if (op == "Int") {
digits = (Math.floor(digits.valueOf())).toString() digits = (Math.floor(digits.valueOf())).toString()
} else if (op == window.plusminus) { } else if (op == "±") {
digits = (digits.valueOf() * -1).toString() digits = (digits.valueOf() * -1).toString()
} else if (op == window.squareRoot) { } else if (op == "") {
digits = (Math.sqrt(digits.valueOf())).toString() digits = (Math.sqrt(digits.valueOf())).toString()
} else if (op == "mc") { } else if (op == "mc") {
memory = 0; memory = 0;
...@@ -130,7 +130,7 @@ function operatorPressed(op) ...@@ -130,7 +130,7 @@ function operatorPressed(op)
} else if (op == "Off") { } else if (op == "Off") {
Qt.quit(); Qt.quit();
} else if (op == "C") { } else if (op == "C") {
digits = "0" display.clear()
} else if (op == "AC") { } else if (op == "AC") {
curVal = 0 curVal = 0
memory = 0 memory = 0
......
...@@ -49,6 +49,7 @@ Rectangle { ...@@ -49,6 +49,7 @@ Rectangle {
SystemPalette { id: palette } SystemPalette { id: palette }
clip: true clip: true
//! [colordialog]
ColorDialog { ColorDialog {
id: colorDialog id: colorDialog
visible: colorDialogVisible.checked visible: colorDialogVisible.checked
...@@ -59,6 +60,7 @@ Rectangle { ...@@ -59,6 +60,7 @@ Rectangle {
onAccepted: { console.log("Accepted: " + color) } onAccepted: { console.log("Accepted: " + color) }
onRejected: { console.log("Rejected") } onRejected: { console.log("Rejected") }
} }
//! [colordialog]
Column { Column {
anchors.fill: parent anchors.fill: parent
......
...@@ -49,6 +49,7 @@ Rectangle { ...@@ -49,6 +49,7 @@ Rectangle {
SystemPalette { id: palette } SystemPalette { id: palette }
clip: true clip: true
//! [filedialog]
FileDialog { FileDialog {
id: fileDialog id: fileDialog
visible: fileDialogVisible.checked visible: fileDialogVisible.checked
...@@ -63,6 +64,7 @@ Rectangle { ...@@ -63,6 +64,7 @@ Rectangle {
onAccepted: { console.log("Accepted: " + fileUrls) } onAccepted: { console.log("Accepted: " + fileUrls) }
onRejected: { console.log("Rejected") } onRejected: { console.log("Rejected") }
} }
//! [filedialog]
Column { Column {
anchors.fill: parent anchors.fill: parent
......
TEMPLATE = app
QT += quick qml
SOURCES += main.cpp
RESOURCES += colorandfiledialogs.qrc ../../shared/shared.qrc
OTHER_FILES += \
dialogs.qml \
FileDialogs.qml \
ColorDialogs.qml
EXAMPLE_FILES = \
FileDialogs.qml \
ColorDialogs.qml
target.path = $$[QT_INSTALL_EXAMPLES]/quick/dialogs
INSTALLS += target
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\title Qt Quick ColorDialog and FileDialog Examples
\example colorandfiledialogs
\brief This example demonstrates the color and file dialog types in QML
\image qml-colorandfiledialogs-example.jpg
\ingroup qtquickdialog_examples
This example demonstrates the color and file system dialogs in the \l{Qt Quick Dialogs}
module. The appearance and behavior is platform-dependent.
A \l FileDialog is used to choose a single file, multiple files or a
single directory, depending on how it is configured.
\snippet colorandfiledialogs/FileDialogs.qml filedialog
A \l ColorDialog is used to choose a color, with or without alpha (transparency)
depending on how it is configured.
\snippet colorandfiledialogs/ColorDialogs.qml colordialog
*/
...@@ -37,5 +37,5 @@ ...@@ -37,5 +37,5 @@
** $QT_END_LICENSE$ ** $QT_END_LICENSE$
** **
****************************************************************************/ ****************************************************************************/
#include "../shared/shared.h" #include "../../shared/shared.h"
DECLARATIVE_EXAMPLE_MAIN(dialogs/dialogs) DECLARATIVE_EXAMPLE_MAIN(dialogs/dialogs)
TEMPLATE = app TEMPLATE = subdirs
QT += quick qml SUBDIRS = \
SOURCES += main.cpp colorandfiledialogs
RESOURCES += dialogs.qrc ../shared/shared.qrc
OTHER_FILES += \
dialogs.qml \
FileDialogs.qml \
ColorDialogs.qml
EXAMPLE_FILES = \
FileDialogs.qml \
ColorDialogs.qml
target.path = $$[QT_INSTALL_EXAMPLES]/quick/dialogs
INSTALLS += target
...@@ -43,6 +43,7 @@ import QtQuick.Window 2.1 ...@@ -43,6 +43,7 @@ import QtQuick.Window 2.1
//! [splash-properties] //! [splash-properties]
Window { Window {
id: splash
visible: true visible: true
width: splashImage.width width: splashImage.width
height: splashImage.height height: splashImage.height
...@@ -50,7 +51,8 @@ Window { ...@@ -50,7 +51,8 @@ Window {
title: "Splash Window" title: "Splash Window"
modality: Qt.ApplicationModal modality: Qt.ApplicationModal
flags: Qt.SplashScreen flags: Qt.SplashScreen
property int timeout: 2000 property int timeoutInterval: 2000
signal timeout
//! [splash-properties] //! [splash-properties]
//! [screen-properties] //! [screen-properties]
x: (Screen.width - splashImage.width) / 2 x: (Screen.width - splashImage.width) / 2
...@@ -67,8 +69,11 @@ Window { ...@@ -67,8 +69,11 @@ Window {
} }
//! [timer] //! [timer]
Timer { Timer {
interval: timeout; running: true; repeat: false interval: timeoutInterval; running: true; repeat: false
onTriggered: visible = false onTriggered: {
visible = false
splash.timeout()
}
} }
//! [timer] //! [timer]
} }
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include <QtGui/QGuiApplication> #include <QtGui/QGuiApplication>
#include <QtQml/QQmlEngine> #include <QtQml/QQmlEngine>
#include <QtQml/QQmlComponent> #include <QtQml/QQmlComponent>
#include <QtQuick/QQuickWindow>
#include <QtCore/QUrl> #include <QtCore/QUrl>
#include <QDebug> #include <QDebug>
...@@ -49,6 +50,7 @@ int main(int argc, char* argv[]) ...@@ -49,6 +50,7 @@ int main(int argc, char* argv[])
QGuiApplication app(argc, argv); QGuiApplication app(argc, argv);
QQmlEngine engine; QQmlEngine engine;
QQmlComponent component(&engine); QQmlComponent component(&engine);
QQuickWindow::setDefaultAlphaBuffer(true);
component.loadUrl(QUrl("qrc:///window/window.qml")); component.loadUrl(QUrl("qrc:///window/window.qml"));
if ( component.isReady() ) if ( component.isReady() )
component.create(); component.create();
......
...@@ -46,14 +46,11 @@ QtObject { ...@@ -46,14 +46,11 @@ QtObject {
property real defaultSpacing: 10 property real defaultSpacing: 10
property SystemPalette palette: SystemPalette { } property SystemPalette palette: SystemPalette { }
property var splashWindow: Splash { }
property var controlWindow: Window { property var controlWindow: Window {
width: 400 width: 400
height: col.implicitHeight + defaultSpacing * 2 height: col.implicitHeight + defaultSpacing * 2
color: palette.window color: palette.window
title: "Control Window" title: "Control Window"
visible: true
Column { Column {
id: col id: col
anchors.fill: parent anchors.fill: parent
...@@ -177,4 +174,8 @@ QtObject { ...@@ -177,4 +174,8 @@ QtObject {
} }
} }
} }
property var splashWindow: Splash {
onTimeout: controlWindow.visible = true
}
} }
...@@ -3,6 +3,8 @@ TARGET = dialogplugin ...@@ -3,6 +3,8 @@ TARGET = dialogplugin
TARGETPATH = QtQuick/Dialogs TARGETPATH = QtQuick/Dialogs
IMPORT_VERSION = 1.0 IMPORT_VERSION = 1.0
QMAKE_DOCS = $$PWD/doc/qtquickdialogs.qdocconf
SOURCES += \ SOURCES += \
qquickabstractfiledialog.cpp \ qquickabstractfiledialog.cpp \
qquickplatformfiledialog.cpp \ qquickplatformfiledialog.cpp \
......
include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
project = QtQuickDialogs
description = Qt Quick Dialogs Reference Documentation
url = http://qt-project.org/doc/qt-$QT_VER/qtquickdialogs/
version = $QT_VERSION
qhp.projects = QtQuickDialogs
qhp.QtQuickDialogs.file = qtquickdialogs.qhp
qhp.QtQuickDialogs.namespace = org.qt-project.qtquickdialogs.$QT_VERSION_TAG
qhp.QtQuickDialogs.virtualFolder = qtquickdialogs
qhp.QtQuickDialogs.indexTitle = Qt Quick Dialogs
qhp.QtQuickDialogs.indexRoot =
qhp.QtQuickDialogs.filterAttributes = qtquickdialogs $QT_VERSION qtrefdoc
qhp.QtQuickDialogs.customFilters.Qt.name = QtQuickDialogs $QT_VERSION
qhp.QtQuickDialogs.customFilters.Qt.filterAttributes = qtquickdialogs $QT_VERSION
qhp.QtQuickDialogs.subprojects = qtquickdialogsqmltypes
qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.title = QML Types
qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.indexTitle = Qt Quick Dialogs
qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.selectors = fake:qmlclass
qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.sortPages = true
qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.type = manual
depends = qtqml qtquick qtgui qtwidgets qtdoc
exampledirs += ../../../../examples/quick/dialogs
examplesinstallpath = quick/dialogs
headerdirs += ..
sourcedirs += ..
imagedirs += images