-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d5a94ed
Showing
25 changed files
with
684 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Miroslav Bendík <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Copyright (c) 2014, Miroslav Bendík and various contributors (see AUTHORS) | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
The views and conclusions contained in the software and documentation are those | ||
of the authors and should not be interpreted as representing official policies, | ||
either expressed or implied, of the FreeBSD Project. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
TEMPLATE = subdirs | ||
SUBDIRS = \ | ||
keyboardview \ | ||
textedit \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
TEMPLATE = app | ||
QT += gui quick | ||
include($$PWD/../../src/components.pri) | ||
SOURCES += \ | ||
main.cpp | ||
RESOURCES = resources.qrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include <QGuiApplication> | ||
#include <QQuickView> | ||
#include <QUrl> | ||
#include "../../src/KeyboardItem.h" | ||
#include "../../src/ModeItem.h" | ||
#include "../../src/ButtonItem.h" | ||
#include "../../src/LayoutItem.h" | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
QGuiApplication app(argc, argv); | ||
|
||
qmlRegisterType<KeyboardItem>("QuickKeyboard", 1, 0, "Keyboard"); | ||
qmlRegisterType<ModeItem>("QuickKeyboard", 1, 0, "Mode"); | ||
qmlRegisterType<ButtonItem>("QuickKeyboard", 1, 0, "Button"); | ||
qmlRegisterType<LayoutItemAttached>(); | ||
qmlRegisterType<LayoutItem>("QuickKeyboard", 1, 0, "Layout"); | ||
|
||
QQuickView view; | ||
view.setResizeMode(QQuickView::SizeRootObjectToView); | ||
view.setSource(QUrl("qrc:/keyboard.qml")); | ||
view.show(); | ||
|
||
return app.exec(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<!DOCTYPE RCC><RCC version="1.0"> | ||
<qresource prefix="/"> | ||
<file alias="keyboard.qml">../../qml/keyboard.qml</file> | ||
<file alias="Btn.qml">../../qml/Btn.qml</file> | ||
</qresource> | ||
</RCC> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import QtQuick 2.0 | ||
|
||
Rectangle { | ||
width: 800; height: 600 | ||
color: "white" | ||
|
||
Rectangle { | ||
anchors.fill: input | ||
color: "#eee" | ||
border { width: 1; color: "gray" } | ||
} | ||
|
||
TextEdit { | ||
id: input | ||
anchors { top: parent.top; left: parent.left; right: parent.right; margins: 10 } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include <QGuiApplication> | ||
#include <QQuickView> | ||
#include <QUrl> | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
QGuiApplication app(argc, argv); | ||
app.addLibraryPath(app.applicationDirPath() + "/../../"); | ||
QQuickView view; | ||
view.setSource(QUrl("qrc:/example.qml")); | ||
view.show(); | ||
return app.exec(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<!DOCTYPE RCC><RCC version="1.0"> | ||
<qresource prefix="/"> | ||
<file>example.qml</file> | ||
</qresource> | ||
</RCC> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
TEMPLATE = app | ||
QT += gui quick | ||
SOURCES = \ | ||
main.cpp | ||
RESOURCES = resources.qrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import QtQuick 2.0 | ||
import QuickKeyboard 1.0 | ||
|
||
Button { | ||
property int row | ||
property int col | ||
Layout.row: row | ||
Layout.col: col | ||
Layout.colSpan: 2 | ||
Layout.rowSpan: 2 | ||
width: 50 | ||
height: 50 | ||
Rectangle { | ||
color: "green" | ||
anchors.fill: parent | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import QtQuick 2.0 | ||
import QuickKeyboard 1.0 | ||
|
||
Keyboard { | ||
width: 200; height: 100 | ||
Mode { | ||
id: standard | ||
anchors.fill: parent | ||
Btn{ col: 0; row: 0; label: "A"; symbols: ["A"] } | ||
Btn{ col: 3; row: 3; label: "B"; symbols: ["B"] } | ||
Btn{ col: 5; row: 5; label: "C"; symbols: ["C"] } | ||
} | ||
mode: standard | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
TEMPLATE = subdirs | ||
SUBDIRS = \ | ||
examples \ | ||
src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include "ButtonItem.h" | ||
#include "BaseLayoutItem.h" | ||
|
||
BaseLayoutItem::BaseLayoutItem(QQuickItem *parent): | ||
QQuickItem(parent) | ||
{ | ||
} | ||
|
||
BaseLayoutItem::~BaseLayoutItem() | ||
{ | ||
} | ||
|
||
void BaseLayoutItem::addButton(ButtonItem *button) | ||
{ | ||
m_buttons.append(button); | ||
} | ||
|
||
void BaseLayoutItem::clearButtons() | ||
{ | ||
m_buttons.clear(); | ||
} | ||
|
||
const QList<ButtonItem *> &BaseLayoutItem::buttons() const | ||
{ | ||
return m_buttons; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#ifndef BASELAYOUTITEM_H_ZHXO0UI7 | ||
#define BASELAYOUTITEM_H_ZHXO0UI7 | ||
|
||
#include <QQuickItem> | ||
#include <QList> | ||
class ButtonItem; | ||
|
||
class BaseLayoutItem: public QQuickItem | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit BaseLayoutItem(QQuickItem *parent = 0); | ||
~BaseLayoutItem(); | ||
|
||
virtual void addButton(ButtonItem *button); | ||
virtual void clearButtons(); | ||
|
||
protected: | ||
const QList<ButtonItem *> &buttons() const; | ||
|
||
private: | ||
QList<ButtonItem *> m_buttons; | ||
}; /* ----- end of class BaseLayoutItem ----- */ | ||
|
||
#endif /* end of include guard: BASELAYOUTITEM_H_ZHXO0UI7 */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include "ButtonItem.h" | ||
|
||
ButtonItem::ButtonItem(QQuickItem *parent): | ||
QQuickItem(parent), | ||
m_pressed(false), | ||
m_modifier(false), | ||
m_col(0), | ||
m_row(0), | ||
m_colSpan(1), | ||
m_rowSpan(1) | ||
{ | ||
} | ||
|
||
ButtonItem::~ButtonItem() | ||
{ | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#ifndef BUTTONITEM_H_VNF1QLCU | ||
#define BUTTONITEM_H_VNF1QLCU | ||
|
||
#include <QQuickItem> | ||
#include <QStringList> | ||
|
||
class ButtonItem: public QQuickItem | ||
{ | ||
Q_OBJECT | ||
Q_PROPERTY(bool pressed MEMBER m_pressed NOTIFY pressedChanged DESIGNABLE false) | ||
Q_PROPERTY(bool modifier MEMBER m_modifier NOTIFY modifierChanged DESIGNABLE false) | ||
Q_PROPERTY(QString label MEMBER m_label NOTIFY labelChanged) | ||
Q_PROPERTY(QStringList symbols MEMBER m_symbols NOTIFY symbolsChanged) | ||
|
||
// position | ||
Q_PROPERTY(int col MEMBER m_col NOTIFY colChanged) | ||
Q_PROPERTY(int row MEMBER m_row NOTIFY rowChanged) | ||
Q_PROPERTY(int colSpan MEMBER m_colSpan NOTIFY colSpanChanged) | ||
Q_PROPERTY(int rowSpan MEMBER m_rowSpan NOTIFY rowSpanChanged) | ||
public: | ||
explicit ButtonItem(QQuickItem *parent = 0); | ||
~ButtonItem(); | ||
|
||
signals: | ||
void pressedChanged(bool is_pressed); | ||
void modifierChanged(bool is_modifier); | ||
void labelChanged(const QString &label); | ||
void symbolsChanged(const QStringList &symbols); | ||
|
||
void colChanged(int col); | ||
void rowChanged(int row); | ||
void colSpanChanged(int colSpan); | ||
void rowSpanChanged(int rowSpan); | ||
|
||
private: | ||
bool m_pressed; | ||
bool m_modifier; | ||
QString m_label; | ||
QStringList m_symbols; | ||
int m_col; | ||
int m_row; | ||
int m_colSpan; | ||
int m_rowSpan; | ||
}; /* ----- end of class ButtonItem ----- */ | ||
|
||
#endif /* end of include guard: BUTTONITEM_H_VNF1QLCU */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include "KeyboardItem.h" | ||
|
||
KeyboardItem::KeyboardItem(QQuickItem *parent): | ||
QQuickItem(parent), | ||
m_mode(0) | ||
{ | ||
} | ||
|
||
KeyboardItem::~KeyboardItem() | ||
{ | ||
} | ||
|
||
void KeyboardItem::setMode(ModeItem *mode) | ||
{ | ||
if (m_mode == mode) { | ||
return; | ||
} | ||
|
||
m_mode = mode; | ||
emit modeChanged(m_mode); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#ifndef KEYBOARDITEM_H_PT4SCIAV | ||
#define KEYBOARDITEM_H_PT4SCIAV | ||
|
||
#include <QQuickItem> | ||
#include <QList> | ||
#include "ModeItem.h" | ||
|
||
class KeyboardItem: public QQuickItem | ||
{ | ||
Q_OBJECT | ||
Q_PROPERTY(ModeItem* mode MEMBER m_mode WRITE setMode NOTIFY modeChanged DESIGNABLE false) | ||
public: | ||
explicit KeyboardItem(QQuickItem *parent = 0); | ||
~KeyboardItem(); | ||
|
||
void setMode(ModeItem *mode); | ||
|
||
signals: | ||
void modeChanged(ModeItem *mode); | ||
|
||
private: | ||
ModeItem *m_mode; | ||
}; /* ----- end of class KeyboardItem ----- */ | ||
|
||
#endif /* end of include guard: KEYBOARDITEM_H_PT4SCIAV */ | ||
|
Oops, something went wrong.