Verified Commit 595d4b8f authored by Artem Sidyakin's avatar Artem Sidyakin
Browse files

Added another 3 projects

- gui-approaches
- profiling
- webengine-recipes
parent 68f3d0a9
......@@ -2,4 +2,35 @@
A set of rather simple projects that demonstrate various Qt features.
![Silly Walks](/img/mosw.png "Silly Walks")
\ No newline at end of file
<img src="/img/mosw.png" width="800">
- [API opensource.org](#api-opensource-org)
- [Commons](#commons)
- [DI](#di)
- [GUI approaches](#gui-approaches)
- [Profiling](#profiling)
- [Webengine Recipes](#webengine-recipes)
## API opensource.org
QML client applicaiton for https://api.opensource.org/licenses/
## Commons
A pack of very simply Qt features demonstrations.
## DI
Basic device information grabber.
## GUI approaches
Three different ways of creating a GUI with Qt.
## Profiling
Basic QML profiling example.
## Webengine Recipes
A bit modified standard WebEngine example.
\ No newline at end of file
......@@ -63,7 +63,7 @@ ApplicationWindow {
Text { text: "Author:"; font.bold: true; }
Text {
id: email
text: "<a href=\"mailto:retifrav@gmail.com\">retifrav@gmail.com</a>";
text: "<a href=\"mailto:artem.sidyakin@qt.io\">artem.sidyakin@qt.io</a>";
onLinkActivated: Qt.openUrlExternally(link)
MouseArea {
anchors.fill: parent
......@@ -85,7 +85,7 @@ ApplicationWindow {
Text { text: "Source:"; font.bold: true; }
Text {
id: repository
text: "<a href='https://github.com/retifrav/api-opensource-org'>repository</a>"
text: "<a href='https://git.qt.io/arsidyak/silly-demos/tree/master/demos/api-opensource-org/api-opensource-org'>repository</a>"
onLinkActivated: Qt.openUrlExternally(link)
MouseArea {
anchors.fill: parent
......@@ -102,9 +102,9 @@ ApplicationWindow {
Layout.fillWidth: true
text: "<p>Application uses
<a href='https://github.com/OpenSourceOrg/api/blob/master/doc/endpoints.md'>The Open Source API</a>
to list all the licenses available and get information about each one.</p>
<p>Built with <a href='https://www.qt.io/ide/'>Qt Creator</a> 4.0.0 using
<a href='https://www.qt.io/application-development/'>Qt</a> 5.6.0.</p>"
to list all the licenses available and get information about each one.</p>"
//<p>Built with <a href='https://www.qt.io/ide/'>Qt Creator</a> 4.0.0 using
//<a href='https://www.qt.io/application-development/'>Qt</a> 5.6.0.</p>"
wrapMode: Text.WordWrap
onLinkActivated: Qt.openUrlExternally(link)
MouseArea {
......
import QtQuick 2.7
Rectangle {
color: "white"
border.color: "gray"
border.width: 1
TextInput {
leftPadding: 5
rightPadding: 5
anchors.fill: parent
font.pointSize: 8
}
}
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
GridLayout {
columns: 2
rowSpacing: 8
Text {
id: frst
Layout.alignment: Qt.AlignRight
font.pointSize: 9
text: "First field:"
}
LineEdit {
id: le_frst
Layout.fillWidth: true
Layout.fillHeight: true
}
Text {
id: scnd
Layout.alignment: Qt.AlignRight
font.pointSize: 9
text: "Second field:"
}
LineEdit {
id: le_scnd
Layout.fillWidth: true
Layout.fillHeight: true
}
Text {
id: thrd
Layout.alignment: Qt.AlignRight
font.pointSize: 9
text: "Third field:"
}
LineEdit {
id: le_thrd
Layout.fillWidth: true
Layout.fillHeight: true
}
Button {
id: btn
Layout.columnSpan: 2
Layout.fillWidth: true
Layout.minimumHeight: 70
font.pointSize: 16
font.family: "Verdana"
text: qsTr("Some big button")
}
}
QT += qml quick
CONFIG += c++11
SOURCES += main.cpp
RESOURCES += qml.qrc
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
# Additional import path used to resolve QML modules just for Qt Quick Designer
QML_DESIGNER_IMPORT_PATH =
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
#include <QGuiApplication>
#include <QQmlApplicationEngine>
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
engine.load(QUrl(QLatin1String("qrc:/main.qml")));
if (engine.rootObjects().isEmpty())
return -1;
return app.exec();
}
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
ApplicationWindow {
visible: true
width: 400
height: 180
title: qsTr("Some widget")
PageForm {
anchors.margins: 15
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
}
}
<RCC>
<qresource prefix="/">
<file>main.qml</file>
<file>PageForm.ui.qml</file>
<file>qtquickcontrols2.conf</file>
<file>LineEdit.qml</file>
</qresource>
</RCC>
; This file can be edited to change the style of the application
; See Styling Qt Quick Controls 2 in the documentation for details:
; http://doc.qt.io/qt-5/qtquickcontrols2-styles.html
[Controls]
Style=Default
[Universal]
Theme=Light
;Accent=Steel
[Material]
Theme=Light
;Accent=BlueGrey
;Primary=BlueGray
#-------------------------------------------------
#
# Project created by QtCreator 2017-07-26T14:58:16
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = imperative-ui
TEMPLATE = app
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp
HEADERS +=
FORMS +=
#include <QApplication>
#include <QtWidgets>
class SomeWidget : public QWidget
{
public:
SomeWidget(QWidget *parent=0);
};
SomeWidget::SomeWidget(QWidget *parent)
: QWidget(parent)
{
QLabel *frst = new QLabel("First field:", this);
frst->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
QLabel *scnd = new QLabel("Second field:", this);
scnd->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
QLabel *thrd= new QLabel("Third field:", this);
thrd->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
QLineEdit *le_frst = new QLineEdit(this);
QLineEdit *le_scnd = new QLineEdit(this);
QLineEdit *le_thrd = new QLineEdit(this);
QPushButton *btn = new QPushButton("Some big button", this);
QFont verdanaFont("Verdana", 16, QFont::Normal);
btn->setFont(verdanaFont);
btn->setMinimumHeight(70);
QGridLayout *grid = new QGridLayout();
grid->addWidget(frst, 0, 0);
grid->addWidget(le_frst, 0, 1);
grid->addWidget(scnd, 1, 0);
grid->addWidget(le_scnd, 1, 1);
grid->addWidget(thrd, 2, 0);
grid->addWidget(le_thrd, 2, 1);
grid->addWidget(btn, 3, 0, 1, 2);
grid->setRowStretch(4, 1);
setLayout(grid);
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
SomeWidget window;
window.setWindowTitle("Some widget");
window.resize(400, 180);
window.show();
return a.exec();
}
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>493</width>
<height>188</height>
</rect>
</property>
<property name="windowTitle">
<string>Some widget</string>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout" rowstretch="0,0,0,0,0">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<item row="1" column="0">
<widget class="QLabel" name="scnd">
<property name="text">
<string>Second field:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QPushButton" name="btn">
<property name="minimumSize">
<size>
<width>0</width>
<height>70</height>
</size>
</property>
<property name="font">
<font>
<family>Verdana</family>
<pointsize>16</pointsize>
</font>
</property>
<property name="text">
<string>Some big button</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="thrd">
<property name="text">
<string>Third field:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="le_frst"/>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="le_third"/>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="le_scnd"/>
</item>
<item row="4" column="0" colspan="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QLabel" name="frst">
<property name="text">
<string>First field:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>
#-------------------------------------------------
#
# Project created by QtCreator 2017-07-26T15:34:35
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = wysiwyg-gui
TEMPLATE = app
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp \
mainwindow.cpp
HEADERS += \
mainwindow.h
FORMS += \
mainwindow.ui
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Window 2.0
Button {
id: control
topPadding: padding + 5
bottomPadding: padding + 5
leftPadding: padding + 10
rightPadding: padding + 10
contentItem: Text {
text: control.text
font.pointSize: 20
font.family: "Arial"
}
background: Rectangle {
color: control.checked || control.highlighted ?
(control.visualFocus ? (control.down ? "#599bff" : "#0066ff") : (control.down ? "#585a5c" : "#353637")) :
(control.visualFocus ? (control.down ? "#cce0ff" : "#f0f6ff") : (control.down ? "#d0d0d0" : "#e0e0e0"))
border.color: "#A3A3A3"
border.width: 3
radius: 9
}
}
#include "backend.h"
Backend::Backend(QObject *parent) : QObject(parent)
{
}
void Backend::doSome()
{
for (int i = 0; i < 9000; i++)
{
int x;
x = i;
}
}
#ifndef BACKEND_H
#define BACKEND_H
#include <QObject>
class Backend : public QObject
{
Q_OBJECT
public:
explicit Backend(QObject *parent = 0);
signals:
public slots:
void doSome();
};
#endif // BACKEND_H
unix:!android {
isEmpty(target.path) {
qnx {
target.path = /tmp/$${TARGET}/bin
} else {
target.path = /opt/$${TARGET}/bin
}
export(target.path)
}
INSTALLS += target
}
export(INSTALLS)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!