Skip to content

Commit a6877b1

Browse files
committed
Add Chapter13(Appendix)
1 parent 34bc90d commit a6877b1

File tree

188 files changed

+20964
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

188 files changed

+20964
-2
lines changed

Chapter10/HelloQt/.qmake.stash

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
QMAKE_CXX.INCDIRS = \
2+
/usr/include/c++/8 \
3+
/usr/include/arm-linux-gnueabihf/c++/8 \
4+
/usr/include/c++/8/backward \
5+
/usr/lib/gcc/arm-linux-gnueabihf/8/include \
6+
/usr/local/include \
7+
/usr/lib/gcc/arm-linux-gnueabihf/8/include-fixed \
8+
/usr/include/arm-linux-gnueabihf \
9+
/usr/include
10+
QMAKE_CXX.LIBDIRS = \
11+
/usr/lib/gcc/arm-linux-gnueabihf/8 \
12+
/usr/lib/arm-linux-gnueabihf \
13+
/usr/lib \
14+
/lib/arm-linux-gnueabihf \
15+
/lib
16+
QMAKE_CXX.QT_COMPILER_STDCXX = 201402L
17+
QMAKE_CXX.QMAKE_GCC_MAJOR_VERSION = 8
18+
QMAKE_CXX.QMAKE_GCC_MINOR_VERSION = 3
19+
QMAKE_CXX.QMAKE_GCC_PATCH_VERSION = 0
20+
QMAKE_CXX.COMPILER_MACROS = \
21+
QT_COMPILER_STDCXX \
22+
QMAKE_GCC_MAJOR_VERSION \
23+
QMAKE_GCC_MINOR_VERSION \
24+
QMAKE_GCC_PATCH_VERSION

Chapter10/HelloQt/HelloQt.pro

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#-------------------------------------------------
2+
#
3+
# Project created by QtCreator 2019-10-21T07:19:32
4+
#
5+
#-------------------------------------------------
6+
7+
QT += core gui
8+
9+
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
10+
11+
TARGET = HelloQt
12+
TEMPLATE = app
13+
14+
# The following define makes your compiler emit warnings if you use
15+
# any feature of Qt which has been marked as deprecated (the exact warnings
16+
# depend on your compiler). Please consult the documentation of the
17+
# deprecated API in order to know how to port your code away from it.
18+
DEFINES += QT_DEPRECATED_WARNINGS
19+
20+
# You can also make your code fail to compile if you use deprecated APIs.
21+
# In order to do so, uncomment the following line.
22+
# You can also select to disable deprecated APIs only up to a certain version of Qt.
23+
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
24+
25+
CONFIG += c++11
26+
27+
SOURCES += \
28+
main.cpp \
29+
widget.cpp
30+
31+
HEADERS += \
32+
widget.h
33+
34+
FORMS += \
35+
widget.ui
36+
37+
# Default rules for deployment.
38+
qnx: target.path = /tmp/$${TARGET}/bin
39+
else: unix:!android: target.path = /opt/$${TARGET}/bin
40+
!isEmpty(target.path): INSTALLS += target

Chapter10/HelloQt/Makefile

Lines changed: 461 additions & 0 deletions
Large diffs are not rendered by default.

Chapter10/HelloQt/main.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#include "widget.h"
2+
#include <QApplication>
3+
4+
int main(int argc, char *argv[])
5+
{
6+
QApplication a(argc, argv);
7+
Widget w;
8+
w.show();
9+
10+
return a.exec();
11+
}

Chapter10/HelloQt/widget.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#include "widget.h"
2+
#include "ui_widget.h"
3+
4+
Widget::Widget(QWidget *parent) :
5+
QWidget(parent),
6+
ui(new Ui::Widget)
7+
{
8+
ui->setupUi(this);
9+
}
10+
11+
Widget::~Widget()
12+
{
13+
delete ui;
14+
}
15+
16+
void Widget::on_lineEdit_textChanged(const QString &arg1)
17+
{
18+
ui->spinBox->blockSignals(true);
19+
ui->dial->setValue(arg1.toInt());
20+
ui->spinBox->blockSignals(false);
21+
}

Chapter10/HelloQt/widget.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#ifndef WIDGET_H
2+
#define WIDGET_H
3+
4+
#include <QWidget>
5+
6+
namespace Ui {
7+
class Widget;
8+
}
9+
10+
class Widget : public QWidget
11+
{
12+
Q_OBJECT
13+
14+
public:
15+
explicit Widget(QWidget *parent = nullptr);
16+
~Widget();
17+
18+
private slots:
19+
void on_lineEdit_textChanged(const QString &arg1);
20+
21+
private:
22+
Ui::Widget *ui;
23+
};
24+
25+
#endif // WIDGET_H

Chapter10/HelloQt/widget.ui

Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>Widget</class>
4+
<widget class="QWidget" name="Widget">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>400</width>
10+
<height>300</height>
11+
</rect>
12+
</property>
13+
<property name="windowTitle">
14+
<string>Widget</string>
15+
</property>
16+
<layout class="QVBoxLayout" name="verticalLayout">
17+
<item>
18+
<widget class="QDial" name="dial">
19+
<property name="wrapping">
20+
<bool>true</bool>
21+
</property>
22+
<property name="notchesVisible">
23+
<bool>true</bool>
24+
</property>
25+
</widget>
26+
</item>
27+
<item>
28+
<widget class="QSlider" name="horizontalSlider">
29+
<property name="orientation">
30+
<enum>Qt::Horizontal</enum>
31+
</property>
32+
<property name="tickPosition">
33+
<enum>QSlider::TicksBothSides</enum>
34+
</property>
35+
</widget>
36+
</item>
37+
<item>
38+
<widget class="QSpinBox" name="spinBox">
39+
<property name="wrapping">
40+
<bool>true</bool>
41+
</property>
42+
</widget>
43+
</item>
44+
<item>
45+
<layout class="QHBoxLayout" name="horizontalLayout">
46+
<item>
47+
<widget class="QLabel" name="label">
48+
<property name="text">
49+
<string>&amp;Value</string>
50+
</property>
51+
<property name="buddy">
52+
<cstring>lineEdit</cstring>
53+
</property>
54+
</widget>
55+
</item>
56+
<item>
57+
<widget class="QLineEdit" name="lineEdit">
58+
<property name="inputMask">
59+
<string>99</string>
60+
</property>
61+
</widget>
62+
</item>
63+
</layout>
64+
</item>
65+
<item>
66+
<spacer name="verticalSpacer">
67+
<property name="orientation">
68+
<enum>Qt::Vertical</enum>
69+
</property>
70+
<property name="sizeType">
71+
<enum>QSizePolicy::Maximum</enum>
72+
</property>
73+
<property name="sizeHint" stdset="0">
74+
<size>
75+
<width>20</width>
76+
<height>20</height>
77+
</size>
78+
</property>
79+
</spacer>
80+
</item>
81+
<item>
82+
<widget class="QPushButton" name="pushButton">
83+
<property name="text">
84+
<string>&amp;Quit</string>
85+
</property>
86+
</widget>
87+
</item>
88+
</layout>
89+
</widget>
90+
<layoutdefault spacing="6" margin="11"/>
91+
<resources/>
92+
<connections>
93+
<connection>
94+
<sender>dial</sender>
95+
<signal>valueChanged(int)</signal>
96+
<receiver>horizontalSlider</receiver>
97+
<slot>setValue(int)</slot>
98+
<hints>
99+
<hint type="sourcelabel">
100+
<x>65</x>
101+
<y>68</y>
102+
</hint>
103+
<hint type="destinationlabel">
104+
<x>73</x>
105+
<y>124</y>
106+
</hint>
107+
</hints>
108+
</connection>
109+
<connection>
110+
<sender>horizontalSlider</sender>
111+
<signal>valueChanged(int)</signal>
112+
<receiver>spinBox</receiver>
113+
<slot>setValue(int)</slot>
114+
<hints>
115+
<hint type="sourcelabel">
116+
<x>122</x>
117+
<y>126</y>
118+
</hint>
119+
<hint type="destinationlabel">
120+
<x>120</x>
121+
<y>155</y>
122+
</hint>
123+
</hints>
124+
</connection>
125+
<connection>
126+
<sender>spinBox</sender>
127+
<signal>valueChanged(int)</signal>
128+
<receiver>dial</receiver>
129+
<slot>setValue(int)</slot>
130+
<hints>
131+
<hint type="sourcelabel">
132+
<x>240</x>
133+
<y>153</y>
134+
</hint>
135+
<hint type="destinationlabel">
136+
<x>246</x>
137+
<y>96</y>
138+
</hint>
139+
</hints>
140+
</connection>
141+
<connection>
142+
<sender>spinBox</sender>
143+
<signal>valueChanged(QString)</signal>
144+
<receiver>lineEdit</receiver>
145+
<slot>setText(QString)</slot>
146+
<hints>
147+
<hint type="sourcelabel">
148+
<x>187</x>
149+
<y>162</y>
150+
</hint>
151+
<hint type="destinationlabel">
152+
<x>198</x>
153+
<y>197</y>
154+
</hint>
155+
</hints>
156+
</connection>
157+
<connection>
158+
<sender>pushButton</sender>
159+
<signal>clicked()</signal>
160+
<receiver>Widget</receiver>
161+
<slot>close()</slot>
162+
<hints>
163+
<hint type="sourcelabel">
164+
<x>41</x>
165+
<y>265</y>
166+
</hint>
167+
<hint type="destinationlabel">
168+
<x>27</x>
169+
<y>236</y>
170+
</hint>
171+
</hints>
172+
</connection>
173+
</connections>
174+
</ui>

Chapter10/HelloWorld/.gitignore

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# This file is used to ignore files which are generated
2+
# ----------------------------------------------------------------------------
3+
4+
*~
5+
*.autosave
6+
*.a
7+
*.core
8+
*.moc
9+
*.o
10+
*.obj
11+
*.orig
12+
*.rej
13+
*.so
14+
*.so.*
15+
*_pch.h.cpp
16+
*_resource.rc
17+
*.qm
18+
.#*
19+
*.*#
20+
core
21+
!core/
22+
tags
23+
.DS_Store
24+
.directory
25+
*.debug
26+
Makefile*
27+
*.prl
28+
*.app
29+
moc_*.cpp
30+
ui_*.h
31+
qrc_*.cpp
32+
Thumbs.db
33+
*.res
34+
*.rc
35+
/.qmake.cache
36+
/.qmake.stash
37+
38+
# qtcreator generated files
39+
*.pro.user*
40+
41+
# xemacs temporary files
42+
*.flc
43+
44+
# Vim temporary files
45+
.*.swp
46+
47+
# Visual Studio generated files
48+
*.ib_pdb_index
49+
*.idb
50+
*.ilk
51+
*.pdb
52+
*.sln
53+
*.suo
54+
*.vcproj
55+
*vcproj.*.*.user
56+
*.ncb
57+
*.sdf
58+
*.opensdf
59+
*.vcxproj
60+
*vcxproj.*
61+
62+
# MinGW generated files
63+
*.Debug
64+
*.Release
65+
66+
# Python byte code
67+
*.pyc
68+
69+
# Binaries
70+
# --------
71+
*.dll
72+
*.exe
73+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
TEMPLATE = app
2+
CONFIG += console
3+
CONFIG -= app_bundle
4+
CONFIG -= qt
5+
6+
SOURCES += \
7+
main.c

Chapter10/HelloWorld/main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include <stdio.h>
2+
3+
int main()
4+
{
5+
printf("Hello World!\n");
6+
return 0;
7+
}

0 commit comments

Comments
 (0)