summaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
Diffstat (limited to 'demos')
-rw-r--r--demos/declarative/calculator/CalcButton.qml64
-rw-r--r--demos/declarative/calculator/calculator.qml208
-rw-r--r--demos/declarative/mediabrowser/content/PhoneInfoContainer.qml6
-rw-r--r--demos/qtdemo/colors.cpp31
-rw-r--r--demos/qtdemo/colors.h4
-rw-r--r--demos/qtdemo/mainwindow.cpp15
-rw-r--r--demos/qtdemo/xml/examples.xml7
7 files changed, 189 insertions, 146 deletions
diff --git a/demos/declarative/calculator/CalcButton.qml b/demos/declarative/calculator/CalcButton.qml
index c925314..f240000 100644
--- a/demos/declarative/calculator/CalcButton.qml
+++ b/demos/declarative/calculator/CalcButton.qml
@@ -1,12 +1,13 @@
-<Item id="Button" width="50" height="30">
+Item {
+ id: Button; width: 50; height: 30
- <properties>
- <Property name="operation" type="string"/>
- <Property name="toggable" value="false"/>
- <Property name="toggled" value="false"/>
- </properties>
+ properties: [
+ Property { name: "operation"; type: "string" },
+ Property { name: "toggable"; value: false },
+ Property { name: "toggled"; value: false }
+ ]
- <Script>
+ Script {
function buttonClicked(operation) {
if (Button.toggable == true) {
if (Button.toggled == true) {
@@ -20,21 +21,42 @@
else
doOp(operation);
}
- </Script>
+ }
- <Image id="Image" src="pics/button.sci" width="{Button.width}" height="{Button.height}"/>
- <Image id="ImagePressed" src="pics/button-pressed.sci" width="{Button.width}" height="{Button.height}" opacity="0"/>
- <Text anchors.centeredIn="{Image}" text="{Button.operation}" color="white" font.bold="true"/>
- <MouseRegion id="MouseRegion" anchors.fill="{Button}" onClicked="buttonClicked(Button.operation)"/>
+ Image {
+ id: Image
+ src: "pics/button.sci"
+ width: Button.width; height: Button.height
+ }
- <states>
- <State name="Pressed" when="{MouseRegion.pressed == true}">
- <SetProperties target="{ImagePressed}" opacity="1"/>
- </State>
- <State name="Toggled" when="{Button.toggled == true}">
- <SetProperties target="{ImagePressed}" opacity="1"/>
- </State>
- </states>
+ Image {
+ id: ImagePressed
+ src: "pics/button-pressed.sci"
+ width: Button.width; height: Button.height
+ opacity: 0
+ }
-</Item>
+ Text {
+ anchors.centeredIn: Image
+ text: Button.operation
+ color: "white"
+ font.bold: true
+ }
+ MouseRegion {
+ id: MouseRegion
+ anchors.fill: Button
+ onClicked: { buttonClicked(Button.operation) }
+ }
+
+ states: [
+ State {
+ name: "Pressed"; when: MouseRegion.pressed == true
+ SetProperties { target: ImagePressed; opacity: 1 }
+ },
+ State {
+ name: "Toggled"; when: Button.toggled == true
+ SetProperties { target: ImagePressed; opacity: 1 }
+ }
+ ]
+}
diff --git a/demos/declarative/calculator/calculator.qml b/demos/declarative/calculator/calculator.qml
index 4ada896..1e7c30a 100644
--- a/demos/declarative/calculator/calculator.qml
+++ b/demos/declarative/calculator/calculator.qml
@@ -1,83 +1,127 @@
-<Rect id="MainWindow" width="320" height="270" color="black">
- <Script src="calculator.js"/>
-
- <VerticalLayout spacing="2" margin="2">
- <Rect id="Container" height="60" z="2" width="316" pen.color="white" color="#343434">
- <Text id="CurNum" font.bold="true" color="white" font.size="16" anchors.right="{Container.right}" anchors.rightMargin="5"
- anchors.verticalCenter="{Container.verticalCenter}"/>
- <Text id="CurrentOperation" color="white" font.bold="true" font.size="16" anchors.left="{Container.left}" anchors.leftMargin="5"
- anchors.verticalCenter="{Container.verticalCenter}"/>
- </Rect>
-
- <Item width="320" height="30">
- <CalcButton id="AdvancedCheckBox" x="55" width="206" operation="Advanced Mode" toggable="true"/>
- </Item>
-
- <Item width="320">
- <Item id="BasicButtons" x="55" width="160" height="160">
- <CalcButton operation="Bksp" id="Bksp" width="67" opacity="0"/>
- <CalcButton operation="C" id="C" width="76"/>
- <CalcButton operation="AC" id="AC" x="78" width="76"/>
-
- <GridLayout id="NumKeypad" y="32" spacing="2" columns="3">
- <CalcButton operation="7"/>
- <CalcButton operation="8"/>
- <CalcButton operation="9"/>
- <CalcButton operation="4"/>
- <CalcButton operation="5"/>
- <CalcButton operation="6"/>
- <CalcButton operation="1"/>
- <CalcButton operation="2"/>
- <CalcButton operation="3"/>
- </GridLayout>
-
- <HorizontalLayout y="128" spacing="2">
- <CalcButton operation="0" width="50"/>
- <CalcButton operation="." x="77" width="50"/>
- <CalcButton operation="=" id="Equals" x="77" width="102"/>
- </HorizontalLayout>
-
- <VerticalLayout id="SimpleOperations" x="156" y="0" spacing="2">
- <CalcButton operation="x"/>
- <CalcButton operation="/"/>
- <CalcButton operation="-"/>
- <CalcButton operation="+"/>
- </VerticalLayout>
- </Item>
-
- <GridLayout id="AdvancedButtons" x="350" spacing="2" columns="2" opacity="0">
- <CalcButton operation="Abs"/>
- <CalcButton operation="Int"/>
- <CalcButton operation="MC"/>
- <CalcButton operation="Sqrt"/>
- <CalcButton operation="MR"/>
- <CalcButton operation="^2"/>
- <CalcButton operation="MS"/>
- <CalcButton operation="1/x"/>
- <CalcButton operation="M+"/>
- <CalcButton operation="+/-"/>
- </GridLayout>
- </Item>
- </VerticalLayout>
-
- <states>
- <State name="Advanced" when="{AdvancedCheckBox.toggled == true}">
- <SetProperties target="{BasicButtons}" x="0"/>
- <SetProperties target="{SimpleOperations}" y="32"/>
- <SetProperties target="{Bksp}" opacity="1"/>
- <SetProperties target="{C}" x="69" width="67"/>
- <SetProperties target="{AC}" x="138" width="67"/>
- <SetProperties target="{Equals}" width="50"/>
- <SetProperties target="{AdvancedButtons}" x="210" opacity="1"/>
- </State>
- </states>
-
- <transitions>
- <Transition>
- <NumericAnimation properties="x,y,width" easing="easeOutBounce" duration="500"/>
- <NumericAnimation properties="opacity" easing="easeInOutQuad" duration="500"/>
- </Transition>
- </transitions>
-
-</Rect>
+Rect {
+ id: MainWindow;
+ width: 320; height: 270; color: "black"
+ Script { src: "calculator.js" }
+
+ VerticalLayout {
+ spacing: 2; margin: 2
+
+ Rect {
+ id: Container
+ width: 316; height: 60; z: 2
+ pen.color: "white"; color: "#343434"
+
+ Text {
+ id: CurNum
+ font.bold: true; font.size: 16
+ color: "white"
+ anchors.right: Container.right
+ anchors.rightMargin: 5
+ anchors.verticalCenter: Container.verticalCenter
+ }
+
+ Text {
+ id: CurrentOperation
+ color: "white"
+ font.bold: true; font.size: 16
+ anchors.left: Container.left
+ anchors.leftMargin: 5
+ anchors.verticalCenter: Container.verticalCenter
+ }
+ }
+
+ Item {
+ width: 320; height: 30
+
+ CalcButton {
+ id: AdvancedCheckBox
+ x: 55; width: 206
+ operation: "Advanced Mode"
+ toggable: true
+ }
+ }
+
+ Item {
+ width: 320
+
+ Item {
+ id: BasicButtons
+ x: 55; width: 160; height: 160
+
+ CalcButton { operation: "Bksp"; id: Bksp; width: 67; opacity: 0 }
+ CalcButton { operation: "C"; id: C; width: 76 }
+ CalcButton { operation: "AC"; id: AC; x: 78; width: 76 }
+
+ GridLayout {
+ id: NumKeypad; y: 32; spacing: 2; columns: 3
+
+ CalcButton { operation: 7 }
+ CalcButton { operation: 8 }
+ CalcButton { operation: 9 }
+ CalcButton { operation: 4 }
+ CalcButton { operation: 5 }
+ CalcButton { operation: 6 }
+ CalcButton { operation: 1 }
+ CalcButton { operation: 2 }
+ CalcButton { operation: 3 }
+ }
+
+ HorizontalLayout {
+ y: 128; spacing: 2
+
+ CalcButton { operation: 0; width: 50 }
+ CalcButton { operation: "."; x: 77; width: 50 }
+ CalcButton { operation: "="; id: Equals; x: 77; width: 102 }
+ }
+
+ VerticalLayout {
+ id: SimpleOperations
+ x: 156; y: 0; spacing: 2
+
+ CalcButton { operation: "x" }
+ CalcButton { operation: "/" }
+ CalcButton { operation: "-" }
+ CalcButton { operation: "+" }
+ }
+ }
+
+ GridLayout {
+ id: AdvancedButtons
+ x: 350; spacing: 2; columns: 2; opacity: 0
+
+ CalcButton { operation: "Abs" }
+ CalcButton { operation: "Int" }
+ CalcButton { operation: "MC" }
+ CalcButton { operation: "Sqrt" }
+ CalcButton { operation: "MR" }
+ CalcButton { operation: "^2" }
+ CalcButton { operation: "MS" }
+ CalcButton { operation: "1/x" }
+ CalcButton { operation: "M+" }
+ CalcButton { operation: "+/-" }
+ }
+
+ }
+ }
+
+ states: [
+ State {
+ name: "Advanced"; when: AdvancedCheckBox.toggled == true
+ SetProperties { target: BasicButtons; x: 0 }
+ SetProperties { target: SimpleOperations; y: 32 }
+ SetProperties { target: Bksp; opacity: 1 }
+ SetProperties { target: C; x: 69; width: 67 }
+ SetProperties { target: AC; x: 138; width: 67 }
+ SetProperties { target: Equals; width: 50 }
+ SetProperties { target: AdvancedButtons; x: 210; opacity: 1 }
+ }
+ ]
+
+ transitions: [
+ Transition {
+ NumericAnimation { properties: "x,y,width"; easing: "easeOutBounce"; duration: 500 }
+ NumericAnimation { properties: "opacity"; easing: "easeInOutQuad"; duration: 500 }
+ }
+ ]
+}
diff --git a/demos/declarative/mediabrowser/content/PhoneInfoContainer.qml b/demos/declarative/mediabrowser/content/PhoneInfoContainer.qml
index dbf25f5..5e387dd 100644
--- a/demos/declarative/mediabrowser/content/PhoneInfoContainer.qml
+++ b/demos/declarative/mediabrowser/content/PhoneInfoContainer.qml
@@ -14,7 +14,7 @@
</signals>
<transform>
- <Axis id="Axis" xStart="{Container.width / 2}" xEnd="{Container.width / 2}" yEnd="1" />
+ <AxisRotation id="Axis" axis.startX="{Container.width / 2}" axis.endX="{Container.width / 2}" axis.endY="1" />
</transform>
<front>
@@ -53,13 +53,13 @@
<states>
<State name="Back">
- <SetProperty target="{Axis}" property="rotation" value="180"/>
+ <SetProperty target="{Axis}" property="angle" value="180"/>
</State>
</states>
<transitions>
<Transition>
- <NumericAnimation easing="easeInOutQuad" properties="rotation" duration="500"/>
+ <NumericAnimation easing="easeInOutQuad" properties="angle" duration="500"/>
</Transition>
</transitions>
diff --git a/demos/qtdemo/colors.cpp b/demos/qtdemo/colors.cpp
index 41bbfb3..733b285 100644
--- a/demos/qtdemo/colors.cpp
+++ b/demos/qtdemo/colors.cpp
@@ -72,10 +72,8 @@ int Colors::contentHeight = 510;
// Properties:
bool Colors::openGlRendering = false;
-bool Colors::direct3dRendering = false;
bool Colors::softwareRendering = false;
-bool Colors::openGlAwailable = true;
-bool Colors::direct3dAwailable = true;
+bool Colors::openGlAvailable = true;
bool Colors::xRenderPresent = true;
bool Colors::noTicker = false;
@@ -206,8 +204,6 @@ void Colors::parseArgs(int argc, char *argv[])
QString s(argv[i]);
if (s == "-opengl")
Colors::openGlRendering = true;
- else if (s == "-direct3d")
- Colors::direct3dRendering = true;
else if (s == "-software")
Colors::softwareRendering = true;
else if (s == "-no-opengl") // support old style
@@ -270,7 +266,7 @@ void Colors::parseArgs(int argc, char *argv[])
Colors::fps = int(parseFloat(s, "-fps"));
else if (s.startsWith("-h") || s.startsWith("-help")){
QMessageBox::warning(0, "Arguments",
- QString("Usage: qtdemo [-verbose] [-no-adapt] [-opengl] [-direct3d] [-software] [-fullscreen] [-ticker[0|1]] ")
+ QString("Usage: qtdemo [-verbose] [-no-adapt] [-opengl] [-software] [-fullscreen] [-ticker[0|1]] ")
+ "[-animations[0|1]] [-no-blending] [-no-sync] [-use-timer-update[0|1]] [-pause[0|1]] "
+ "[-use-window-mask] [-no-rescale] "
+ "[-use-pixmaps] [-show-fps] [-show-br] [-8bit[0|1]] [-menu<int>] [-use-loop] [-use-balls] "
@@ -290,7 +286,6 @@ void Colors::parseArgs(int argc, char *argv[])
void Colors::setLowSettings()
{
Colors::openGlRendering = false;
- Colors::direct3dRendering = false;
Colors::softwareRendering = true;
Colors::noTicker = true;
Colors::noTimerUpdate = true;
@@ -325,15 +320,11 @@ void Colors::detectSystemResources()
qDebug() << "- OpenGL not supported by current build of Qt";
#endif
{
- Colors::openGlAwailable = false;
+ Colors::openGlAvailable = false;
if (Colors::verbose)
qDebug("- OpenGL not recommended on this system");
}
-#if defined(Q_WS_WIN)
- Colors::direct3dAwailable = false; // for now.
-#endif
-
#if defined(Q_WS_X11)
// check if X render is present:
QPixmap tmp(1, 1);
@@ -369,21 +360,9 @@ void Colors::postConfigure()
}
}
-#if !defined(Q_WS_WIN)
- if (Colors::direct3dRendering){
- Colors::direct3dRendering = false;
- qDebug() << "- WARNING: Direct3D specified, but not supported on this platform";
- }
-#endif
-
- if (!Colors::openGlRendering && !Colors::direct3dRendering && !Colors::softwareRendering){
+ if (!Colors::openGlRendering && !Colors::softwareRendering){
// The user has not decided rendering system. So we do it instead:
-#if defined(Q_WS_WIN)
- if (Colors::direct3dAwailable)
- Colors::direct3dRendering = true;
- else
-#endif
- if (Colors::openGlAwailable)
+ if (Colors::openGlAvailable)
Colors::openGlRendering = true;
else
Colors::softwareRendering = true;
diff --git a/demos/qtdemo/colors.h b/demos/qtdemo/colors.h
index 58865c6..31eb93b 100644
--- a/demos/qtdemo/colors.h
+++ b/demos/qtdemo/colors.h
@@ -81,11 +81,9 @@ public:
static int contentHeight;
// properties:
+ static bool openGlAvailable;
static bool openGlRendering;
- static bool direct3dRendering;
static bool softwareRendering;
- static bool openGlAwailable;
- static bool direct3dAwailable;
static bool xRenderPresent;
static bool noAdapt;
static bool noTicker;
diff --git a/demos/qtdemo/mainwindow.cpp b/demos/qtdemo/mainwindow.cpp
index 8723823..0da69b2 100644
--- a/demos/qtdemo/mainwindow.cpp
+++ b/demos/qtdemo/mainwindow.cpp
@@ -100,14 +100,8 @@ void MainWindow::setRenderingSystem()
{
QWidget *viewport = 0;
- if (Colors::direct3dRendering){
- viewport->setAttribute(Qt::WA_MSWindowsUseDirect3D);
- setCacheMode(QGraphicsView::CacheNone);
- if (Colors::verbose)
- qDebug() << "- using Direct3D";
- }
#ifndef QT_NO_OPENGL
- else if (Colors::openGlRendering){
+ if (Colors::openGlRendering) {
QGLWidget *glw = new QGLWidget(QGLFormat(QGL::SampleBuffers));
if (Colors::noScreenSync)
glw->format().setSwapInterval(0);
@@ -116,9 +110,10 @@ void MainWindow::setRenderingSystem()
setCacheMode(QGraphicsView::CacheNone);
if (Colors::verbose)
qDebug() << "- using OpenGL";
- }
+ } else // software rendering
#endif
- else{ // software rendering
+ {
+ // software rendering
viewport = new QWidget;
setCacheMode(QGraphicsView::CacheBackground);
if (Colors::verbose)
@@ -389,8 +384,6 @@ void MainWindow::keyPressEvent(QKeyEvent *event)
s += "Rendering system: ";
if (Colors::openGlRendering)
s += "OpenGL";
- else if (Colors::direct3dRendering)
- s += "Direct3D";
else
s += "software";
diff --git a/demos/qtdemo/xml/examples.xml b/demos/qtdemo/xml/examples.xml
index 03b59f3..96a3e80 100644
--- a/demos/qtdemo/xml/examples.xml
+++ b/demos/qtdemo/xml/examples.xml
@@ -118,6 +118,7 @@
<example filename="threadedfortuneserver" name="Threaded Fort. Server" />
<example filename="torrent" name="Torrent Client" />
<example filename="securesocketclient" name="Secure Socket Client" />
+ <example filename="googlesuggest" name="Google Suggest" />
</category>
<category dirname="opengl" name="OpenGL">
<example filename="2dpainting" name="2D Painting" />
@@ -213,6 +214,12 @@
<example filename="wiggly" name="Wiggly" />
<example filename="windowflags" name="Window Flags" />
</category>
+ <category dirname="webkit" name="WebKit">
+ <example filename="formextractor" name="Form Extractor" />
+ <example filename="previewer" name="HTML Previewer" />
+ <example filename="fancybrowser" name="Fancy Browser" />
+ <example filename="googlechat" name="Google Chat" />
+ </category>
<category dirname="xml" name="XML">
<example filename="saxbookmarks" name="SAX Bookmarks" />
<example filename="dombookmarks" name="DOM Bookmarks" />