diff options
Diffstat (limited to 'demos')
-rw-r--r-- | demos/browser/browsermainwindow.cpp | 1 | ||||
-rw-r--r-- | demos/declarative/samegame/SameGame.qml | 4 | ||||
-rw-r--r-- | demos/declarative/samegame/content/BoomBlock.qml | 5 | ||||
-rw-r--r-- | demos/declarative/samegame/content/FastBlock.qml | 7 | ||||
-rw-r--r-- | demos/declarative/samegame/content/SpinBlock.qml | 9 | ||||
-rw-r--r-- | demos/declarative/samegame/content/samegame.js | 20 | ||||
-rw-r--r-- | demos/qtdemo/qtdemo.rc | 30 | ||||
-rw-r--r-- | demos/textedit/textedit.cpp | 15 |
8 files changed, 74 insertions, 17 deletions
diff --git a/demos/browser/browsermainwindow.cpp b/demos/browser/browsermainwindow.cpp index 88abb6a..0636f1d 100644 --- a/demos/browser/browsermainwindow.cpp +++ b/demos/browser/browsermainwindow.cpp @@ -81,6 +81,7 @@ BrowserMainWindow::BrowserMainWindow(QWidget *parent, Qt::WindowFlags flags) , m_stop(0) , m_reload(0) { + setToolButtonStyle(Qt::ToolButtonFollowStyle); setAttribute(Qt::WA_DeleteOnClose, true); statusBar()->setSizeGripEnabled(true); setupMenu(); diff --git a/demos/declarative/samegame/SameGame.qml b/demos/declarative/samegame/SameGame.qml index 28b7133..231de03 100644 --- a/demos/declarative/samegame/SameGame.qml +++ b/demos/declarative/samegame/SameGame.qml @@ -22,10 +22,6 @@ Rect { anchors.fill: parent } - MouseRegion { id: gameMR; anchors.fill: parent; - onClicked: handleClick(mouseX, mouseY); - onPositionChanged: handleHover(mouseX, mouseY); - } } HorizontalLayout { anchors.top: gameCanvas.bottom diff --git a/demos/declarative/samegame/content/BoomBlock.qml b/demos/declarative/samegame/content/BoomBlock.qml index 0f5d4da..9637bd6 100644 --- a/demos/declarative/samegame/content/BoomBlock.qml +++ b/demos/declarative/samegame/content/BoomBlock.qml @@ -11,6 +11,11 @@ Item { id:block x: Follow { enabled: spawned; source: targetX; spring: 2; damping: 0.2 } y: Follow { source: targetY; spring: 2; damping: 0.2 } + MouseRegion { + id: gameMR; anchors.fill: parent + onClicked: handleClick(Math.floor(parent.x/width), Math.floor(parent.y/height)); + } + Image { id: img source: { if(type == 0){ diff --git a/demos/declarative/samegame/content/FastBlock.qml b/demos/declarative/samegame/content/FastBlock.qml index 15664a3..f30d8da 100644 --- a/demos/declarative/samegame/content/FastBlock.qml +++ b/demos/declarative/samegame/content/FastBlock.qml @@ -15,8 +15,11 @@ Rect { id:block opacity: 0 y: targetY x: targetX - //y: Behavior { NumberAnimation { properties:"y"; duration: 200 } } - //opacity: Behavior { NumberAnimation { properties:"opacity"; duration: 200 } } + + MouseRegion { + id: gameMR; anchors.fill: parent + onClicked: handleClick(Math.floor(parent.x/width), Math.floor(parent.y/height)); + } states: [ diff --git a/demos/declarative/samegame/content/SpinBlock.qml b/demos/declarative/samegame/content/SpinBlock.qml index 1e92d9e..4c8f123 100644 --- a/demos/declarative/samegame/content/SpinBlock.qml +++ b/demos/declarative/samegame/content/SpinBlock.qml @@ -18,6 +18,9 @@ Item { id:block "pics/gnome/greenStone.gif"; } paused: !selected + paused: Behavior { to: true; from: false; + NumberAnimation { properties:"currentFrame"; to:0; duration: 200} + } } opacity: 0 y: targetY @@ -25,6 +28,12 @@ Item { id:block y: Behavior { NumberAnimation { properties:"y"; duration: 200 } } x: Behavior { NumberAnimation { properties:"x"; duration: 200 } } opacity: Behavior { NumberAnimation { properties:"opacity"; duration: 200 } } + MouseRegion { + id: gameMR; anchors.fill: parent + onClicked: handleClick(Math.floor(parent.x/width), Math.floor(parent.y/height)); + onEntered: handleHover(Math.floor(parent.x/width), Math.floor(parent.y/height)); + onExited: handleHover(Math.floor(parent.x/width), Math.floor(parent.y/height)); + } states: [ diff --git a/demos/declarative/samegame/content/samegame.js b/demos/declarative/samegame/content/samegame.js index b1b2c50..6bcfd17 100644 --- a/demos/declarative/samegame/content/samegame.js +++ b/demos/declarative/samegame/content/samegame.js @@ -50,10 +50,8 @@ var fillFound; var floodBoard; var lastHoveredIdx = -2 -function handleHover(x,y, btn) +function handleHover(xIdx,yIdx, btn) { - xIdx = Math.floor(x/tileSize); - yIdx = Math.floor(y/tileSize); if(index(xIdx, yIdx) == lastHoveredIdx) return; lastHoveredIdx = index(xIdx, yIdx); @@ -67,11 +65,9 @@ function handleHover(x,y, btn) //Could use the fillFound value to tell the player how many stones/points } -function handleClick(x,y) +function handleClick(xIdx,yIdx) { //NOTE: Be careful with vars named x,y - they can set to the calling object - xIdx = Math.floor(x/tileSize); - yIdx = Math.floor(y/tileSize); if(xIdx >= maxX || xIdx < 0 || yIdx >= maxY || yIdx < 0) return; if(board[index(xIdx, yIdx)] == null) @@ -166,9 +162,8 @@ function victoryCheck() { //awards bonuses deservesBonus = true; - for(xIdx=maxX-1; xIdx>=0; xIdx--) - if(board[index(xIdx, maxY - 1)] != null) - deservesBonus = false; + if(board[index(0, maxY - 1)] != null) + deservesBonus = false; if(deservesBonus) gameCanvas.score += 500; //Checks for game over @@ -180,7 +175,8 @@ function victoryCheck() function noMoreMoves() { - return !floodMoveCheck(0, maxY-1, -1); + moreMoves = floodMoveCheck(0, maxY-1, -1); + return !moreMoves; } function floodMoveCheck(xIdx, yIdx, type) @@ -192,7 +188,9 @@ function floodMoveCheck(xIdx, yIdx, type) myType = board[index(xIdx, yIdx)].type; if(type == myType) return true; - return floodMoveCheck(xIdx + 1, yIdx, myType) || floodMoveCheck(xIdx, yIdx - 1, myType); + var at = myType; + var bt = myType; + return floodMoveCheck(xIdx + 1, yIdx, at) || floodMoveCheck(xIdx, yIdx - 1, bt); } //Need a simpler method of doing this? diff --git a/demos/qtdemo/qtdemo.rc b/demos/qtdemo/qtdemo.rc index 4cf2a63..882b355 100644 --- a/demos/qtdemo/qtdemo.rc +++ b/demos/qtdemo/qtdemo.rc @@ -1,2 +1,32 @@ +#include "winver.h" + IDI_ICON1 ICON DISCARDABLE "qtdemo.ico" +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,0 + PRODUCTVERSION 1,0,0,0 + FILEFLAGS 0x0L + FILEFLAGSMASK 0x3fL + FILEOS 0x00040004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "000004b0" + BEGIN + VALUE "CompanyName", "Nokia Corporation and/or its subsidiary(-ies)" + VALUE "FileDescription", "Qt Examples and Demos" + VALUE "FileVersion", "1.0.0.0" + VALUE "LegalCopyright", "Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)." + VALUE "InternalName", "qtdemo" + VALUE "OriginalFilename", "qtdemo.exe" + VALUE "ProductName", "Qt Examples and Demos" + VALUE "ProductVersion", "1.0.0.0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0, 1200 + END +END diff --git a/demos/textedit/textedit.cpp b/demos/textedit/textedit.cpp index 5eee855..d1e12bb 100644 --- a/demos/textedit/textedit.cpp +++ b/demos/textedit/textedit.cpp @@ -75,6 +75,7 @@ const QString rsrcPath = ":/images/win"; TextEdit::TextEdit(QWidget *parent) : QMainWindow(parent) { + setToolButtonStyle(Qt::ToolButtonFollowStyle); setupFileActions(); setupEditActions(); setupTextActions(); @@ -158,6 +159,7 @@ void TextEdit::setupFileActions() QAction *a; a = new QAction(QIcon(rsrcPath + "/filenew.png"), tr("&New"), this); + a->setPriority(QAction::LowPriority); a->setShortcut(QKeySequence::New); connect(a, SIGNAL(triggered()), this, SLOT(fileNew())); tb->addAction(a); @@ -179,6 +181,7 @@ void TextEdit::setupFileActions() menu->addAction(a); a = new QAction(tr("Save &As..."), this); + a->setPriority(QAction::LowPriority); connect(a, SIGNAL(triggered()), this, SLOT(fileSaveAs())); menu->addAction(a); menu->addSeparator(); @@ -195,6 +198,7 @@ void TextEdit::setupFileActions() menu->addAction(a); a = new QAction(QIcon(rsrcPath + "/exportpdf.png"), tr("&Export PDF..."), this); + a->setPriority(QAction::LowPriority); a->setShortcut(Qt::CTRL + Qt::Key_D); connect(a, SIGNAL(triggered()), this, SLOT(filePrintPdf())); tb->addAction(a); @@ -224,19 +228,23 @@ void TextEdit::setupEditActions() tb->addAction(a); menu->addAction(a); a = actionRedo = new QAction(QIcon(rsrcPath + "/editredo.png"), tr("&Redo"), this); + a->setPriority(QAction::LowPriority); a->setShortcut(QKeySequence::Redo); tb->addAction(a); menu->addAction(a); menu->addSeparator(); a = actionCut = new QAction(QIcon(rsrcPath + "/editcut.png"), tr("Cu&t"), this); + a->setPriority(QAction::LowPriority); a->setShortcut(QKeySequence::Cut); tb->addAction(a); menu->addAction(a); a = actionCopy = new QAction(QIcon(rsrcPath + "/editcopy.png"), tr("&Copy"), this); + a->setPriority(QAction::LowPriority); a->setShortcut(QKeySequence::Copy); tb->addAction(a); menu->addAction(a); a = actionPaste = new QAction(QIcon(rsrcPath + "/editpaste.png"), tr("&Paste"), this); + a->setPriority(QAction::LowPriority); a->setShortcut(QKeySequence::Paste); tb->addAction(a); menu->addAction(a); @@ -253,6 +261,7 @@ void TextEdit::setupTextActions() menuBar()->addMenu(menu); actionTextBold = new QAction(QIcon(rsrcPath + "/textbold.png"), tr("&Bold"), this); + actionTextBold->setPriority(QAction::LowPriority); actionTextBold->setShortcut(Qt::CTRL + Qt::Key_B); QFont bold; bold.setBold(true); @@ -263,6 +272,7 @@ void TextEdit::setupTextActions() actionTextBold->setCheckable(true); actionTextItalic = new QAction(QIcon(rsrcPath + "/textitalic.png"), tr("&Italic"), this); + actionTextItalic->setPriority(QAction::LowPriority); actionTextItalic->setShortcut(Qt::CTRL + Qt::Key_I); QFont italic; italic.setItalic(true); @@ -273,6 +283,7 @@ void TextEdit::setupTextActions() actionTextItalic->setCheckable(true); actionTextUnderline = new QAction(QIcon(rsrcPath + "/textunder.png"), tr("&Underline"), this); + actionTextUnderline->setPriority(QAction::LowPriority); actionTextUnderline->setShortcut(Qt::CTRL + Qt::Key_U); QFont underline; underline.setUnderline(true); @@ -301,12 +312,16 @@ void TextEdit::setupTextActions() actionAlignLeft->setShortcut(Qt::CTRL + Qt::Key_L); actionAlignLeft->setCheckable(true); + actionAlignLeft->setPriority(QAction::LowPriority); actionAlignCenter->setShortcut(Qt::CTRL + Qt::Key_E); actionAlignCenter->setCheckable(true); + actionAlignCenter->setPriority(QAction::LowPriority); actionAlignRight->setShortcut(Qt::CTRL + Qt::Key_R); actionAlignRight->setCheckable(true); + actionAlignRight->setPriority(QAction::LowPriority); actionAlignJustify->setShortcut(Qt::CTRL + Qt::Key_J); actionAlignJustify->setCheckable(true); + actionAlignJustify->setPriority(QAction::LowPriority); tb->addActions(grp->actions()); menu->addActions(grp->actions()); |