Merge qtquickcontrols2 into qtdeclarative

Task-number: QTBUG-95173
Change-Id: I2cf31e30127e8cc2f10304cabf4ff7f5050633b8
This commit is contained in:
Mitch Curtis 2021-07-28 11:21:25 +02:00
commit 16436239cd
4513 changed files with 368901 additions and 7 deletions

9
.gitattributes vendored
View File

@ -1,4 +1,5 @@
*_crlf.* eol=crlf
.tag export-subst
.gitignore export-ignore
.gitattributes export-ignore
*_crlf.* eol=crlf
.tag export-subst
.gitignore export-ignore
.gitattributes export-ignore
.commit-template export-ignore

64
.gitignore vendored
View File

@ -85,12 +85,32 @@ bin/qml*
bin/qttracereplay*
configure.cache
config.status
examples/quickcontrols2/chattutorial/chapter1-settingup/chapter1-settingup
examples/quickcontrols2/chattutorial/chapter2-lists/chapter2-lists
examples/quickcontrols2/chattutorial/chapter3-navigation/chapter3-navigation
examples/quickcontrols2/chattutorial/chapter4-models/chapter4-models
examples/quickcontrols2/chattutorial/chapter5-styling/chapter5-styling
examples/quickcontrols2/contactlist/contactlist
examples/quickcontrols2/flatstyle/flatstyle
examples/quickcontrols2/gallery/gallery
examples/quickcontrols2/imagine/automotive/automotive
examples/quickcontrols2/imagine/musicplayer/musicplayer
examples/quickcontrols2/sidepanel/sidepanel
examples/quickcontrols2/swipetoremove/swipetoremove
examples/quickcontrols2/texteditor/texteditor
examples/quickcontrols2/wearable/wearable
moc_*.cpp
qmake/qmake.exe
qmake/Makefile.bak
src/corelib/global/qconfig.cpp
src/corelib/global/qconfig.h
src/corelib/global/qconfig.h.qmake
src/quickcontrols2/qtquickcontrols2-config.h
src/quickcontrols2/qtquickcontrols2-config.pri
src/quickcontrols2/qtquickcontrols2-config_p.h
src/quicktemplates2/qtquicktemplates2-config.h
src/quicktemplates2/qtquicktemplates2-config.pri
src/quicktemplates2/qtquicktemplates2-config_p.h
ui_*.h
tests/auto/cmake/build
tests/auto/installed_cmake/build
@ -107,6 +127,50 @@ tests/auto/qprocess/fileWriterProcess.txt
.com.apple.timemachine.supported
tests/auto/qlibrary/libmylib.so*
tests/auto/qresourceengine/runtime_resource.rcc
tests/auto/quickcontrols2/accessibility/tst_accessibility
tests/auto/quickcontrols2/calendar/tst_calendar
tests/auto/quickcontrols2/controls/basic/tst_basic
tests/auto/quickcontrols2/controls/fusion/tst_fusion
tests/auto/quickcontrols2/controls/imagine/tst_imagine
tests/auto/quickcontrols2/controls/material/tst_material
tests/auto/quickcontrols2/controls/universal/tst_universal
tests/auto/quickcontrols2/cursor/tst_cursor
tests/auto/quickcontrols2/customization/tst_customization
tests/auto/quickcontrols2/focus/tst_focus
tests/auto/quickcontrols2/font/tst_font
tests/auto/quickcontrols2/palette/tst_palette
tests/auto/quickcontrols2/platform/tst_platform
tests/auto/quickcontrols2/pressandhold/tst_pressandhold
tests/auto/quickcontrols2/qquickapplicationwindow/tst_qquickapplicationwindow
tests/auto/quickcontrols2/qquickcolor/tst_qquickcolor
tests/auto/quickcontrols2/qquickdrawer/tst_qquickdrawer
tests/auto/quickcontrols2/qquickiconimage/tst_qquickiconimage
tests/auto/quickcontrols2/qquickiconlabel/tst_qquickiconlabel
tests/auto/quickcontrols2/qquickimaginestyle/tst_qquickimaginestyle
tests/auto/quickcontrols2/qquickmaterialstyle/tst_qquickmaterialstyle
tests/auto/quickcontrols2/qquickmaterialstyleconf/tst_qquickmaterialstyleconf
tests/auto/quickcontrols2/qquickmenu/tst_qquickmenu
tests/auto/quickcontrols2/qquickmenubar/tst_qquickmenubar
tests/auto/quickcontrols2/qquickninepatchimage/tst_qquickninepatchimage
tests/auto/quickcontrols2/qquickpopup/tst_qquickpopup
tests/auto/quickcontrols2/qquickstyle/tst_qquickstyle
tests/auto/quickcontrols2/qquickstyleselector/tst_qquickstyleselector
tests/auto/quickcontrols2/qquickuniversalstyle/tst_qquickuniversalstyle
tests/auto/quickcontrols2/qquickuniversalstyleconf/tst_qquickuniversalstyleconf
tests/auto/quickcontrols2/revisions/tst_revisions
tests/auto/quickcontrols2/sanity/tst_sanity
tests/auto/quickcontrols2/snippets/tst_snippets
tests/auto/quickcontrols2/styles/tst_styles
tests/auto/quickcontrols2/snippets/screenshots/*.png
tests/benchmarks/creationtime/tst_creationtime
tests/benchmarks/objectcount/tst_objectcount
tests/manual/quickcontrols2/buttons/buttons
tests/manual/quickcontrols2/fonts/fonts
tests/manual/quickcontrols2/gifs/tst_gifs
tests/manual/quickcontrols2/styles/styles
tests/manual/quickcontrols2/testbench/testbench
tests/manual/quickcontrols2/screenshots/screenshots
tests/manual/quickcontrols2/gifs/gifs/*.gif
tools/qtestlib/chart/chart*
tools/qtestlib/updater/updater*
tools/qmleasing/qmleasing

View File

@ -3,4 +3,6 @@ CONFIG += warning_clean
DEFINES += QT_NO_JAVA_STYLE_ITERATORS
QQC2_SOURCE_TREE = $$PWD
MODULE_VERSION = 6.2.0

686
LICENSE.GPLv3 Normal file
View File

@ -0,0 +1,686 @@
GNU GENERAL PUBLIC LICENSE
The Qt Toolkit is Copyright (C) 2017 The Qt Company Ltd.
Contact: http://www.qt.io/licensing/
You may use, distribute and copy the Qt Toolkit under the terms of
GNU Lesser General Public License version 3. That license references
the General Public License version 3, that is displayed below. Other
portions of the Qt Toolkit may be licensed directly under this license.
-------------------------------------------------------------------------
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

174
LICENSE.LGPLv3 Normal file
View File

@ -0,0 +1,174 @@
GNU LESSER GENERAL PUBLIC LICENSE
The Qt Toolkit is Copyright (C) 2017 The Qt Company Ltd.
Contact: http://www.qt.io/licensing/
You may use, distribute and copy the Qt Toolkit under the terms of
GNU Lesser General Public License version 3, which is displayed below.
This license makes reference to the version 3 of the GNU General
Public License, which you can find in the LICENSE.GPLv3 file.
-------------------------------------------------------------------------
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this
licensedocument, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, “this License” refers to version 3 of the GNU Lesser
General Public License, and the “GNU GPL” refers to version 3 of the
GNU General Public License.
“The Library” refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An “Application” is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A “Combined Work” is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the “Linked
Version”.
The “Minimal Corresponding Source” for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The “Corresponding Application Code” for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort
to ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this
license document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that, taken
together, effectively do not restrict modification of the portions of
the Library contained in the Combined Work and reverse engineering for
debugging such modifications, if you also do each of the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this
license document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of
this License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with
the Library. A suitable mechanism is one that (a) uses at run
time a copy of the Library already present on the user's
computer system, and (b) will operate properly with a modified
version of the Library that is interface-compatible with the
Linked Version.
e) Provide Installation Information, but only if you would
otherwise be required to provide such information under section 6
of the GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the Application
with a modified version of the Linked Version. (If you use option
4d0, the Installation Information must accompany the Minimal
Corresponding Source and Corresponding Application Code. If you
use option 4d1, you must provide the Installation Information in
the manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the Library
side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities, conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of
it is a work based on the Library, and explaining where to find
the accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
as you received it specifies that a certain numbered version of the
GNU Lesser General Public License “or any later version” applies to
it, you have the option of following the terms and conditions either
of that published version or of any later version published by the
Free Software Foundation. If the Library as you received it does not
specify a version number of the GNU Lesser General Public License,
you may choose any version of the GNU Lesser General Public License
ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the Library.

57
README.md Normal file
View File

@ -0,0 +1,57 @@
Qt Quick Controls 2
===================
![Qt Quick Controls 2 Styles](https://doc.qt.io/qt-5/images/qtquickcontrols2-styles.png)
The Qt Quick Controls 2 module delivers the next generation user interface
controls based on Qt Quick. In comparison to the desktop-oriented Qt Quick
Controls 1, Qt Quick Controls 2 are an order of magnitude simpler, lighter and
faster, and are primarily targeted towards embedded and mobile platforms.
Qt Quick Controls 2 are based on a flexible template system that enables rapid
development of entire custom styles and user experiences. Qt Quick Controls 2
comes with a selection of built-in styles:
- Default style - a simple and minimal all-round style that offers the maximum performance
- Fusion style - a platform-agnostic style that offers a desktop-oriented look and feel
- Imagine style - a designer-friendly style based on image assets
- Material style - a style based on the Google Material Design Guidelines
- Universal style - a style based on the Microsoft Universal Design Guidelines
- Windows style - a style that looks native on Windows
- macOS style - a style that looks native on macOS
More information can be found in the following blog posts:
- http://blog.qt.io/blog/2015/03/31/qt-quick-controls-for-embedded/
- http://blog.qt.io/blog/2015/11/23/qt-quick-controls-re-engineered-status-update/
- http://blog.qt.io/blog/2016/06/10/qt-quick-controls-2-0-a-new-beginning/
- http://blog.qt.io/blog/2016/10/06/qt-quick-controls-2-1-and-beyond/
- http://blog.qt.io/blog/2017/05/31/ready-made-ui-controls-qt-quick-controls-2-summary/
- http://blog.qt.io/blog/2017/11/23/qt-quick-controls-2-imagine-style/
- http://blog.qt.io/blog/2017/11/23/ready-qt-quick-controls-2-3/
## Help
If you have problems or questions, don't hesitate to:
- ask on the Qt Interest mailing list http://lists.qt-project.org/mailman/listinfo/interest
- ask on the Qt Forum http://forum.qt.io/category/12/qt-quick
- report issues to the Qt Bug Tracker https://bugreports.qt.io (component: *Qt Quick: Controls 2*)
## Installation
The MINIMUM REQUIREMENT for building this project is to use the same branch
of Qt 5. The dependencies are *qtbase* and *qtdeclarative*.
To install the controls into your Qt directory (```QTDIR/qml```):
qmake
make
make install
If you are compiling against a system Qt on Linux, you might have to use
```sudo make install``` to install the project.
## Usage
Please refer to the [Getting Started with Qt Quick Controls 2](https://doc.qt.io/qt-5/qtquickcontrols2-gettingstarted.html) documentation.

21
configure.cmake Normal file
View File

@ -0,0 +1,21 @@
#### Inputs
#### Libraries
#### Tests
#### Features
qt_extra_definition("QT_VERSION_STR" "\"${PROJECT_VERSION}\"" PUBLIC)
qt_extra_definition("QT_VERSION_MAJOR" ${PROJECT_VERSION_MAJOR} PUBLIC)
qt_extra_definition("QT_VERSION_MINOR" ${PROJECT_VERSION_MINOR} PUBLIC)
qt_extra_definition("QT_VERSION_PATCH" ${PROJECT_VERSION_PATCH} PUBLIC)

View File

@ -8,3 +8,6 @@ dependencies:
../qtsvg:
ref: ceb0cb16621913a9f8e45a3e438b221279a7d907
required: false
../qtimageformats:
ref: 22113e2bd887cf84871eb04a7130a52d9c25730f
required: false

View File

@ -0,0 +1,166 @@
Qt 5.10 introduces many new features and improvements as well as bugfixes
over the 5.9.x series. For more details, refer to the online documentation
included in this distribution. The documentation is also available online:
http://doc.qt.io/qt-5/index.html
The Qt version 5.10 series is binary compatible with the 5.10.x series.
Applications compiled for 5.9 will continue to run with 5.10.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* Important Behavior Changes *
****************************************************************************
- [QTBUG-58060] DialogButtonBox with Material style now uses the Android
button layout.
****************************************************************************
* Controls *
****************************************************************************
- AbstractButton:
* [QTBUG-49820] Added support for icons. The following properties are
now available for derived types to use: icon.name, icon.source,
icon.width, icon.height, icon.color.
* [QTBUG-49820] Added display property to allow control over how icons
and text are displayed within buttons, without having to implement
custom delegates.
* [QTBUG-50705] Added AbstractButton::action property.
- Action:
* [QTBUG-50705] Introduced Action, an abstract user interface action
that can have shortcuts and be assigned to buttons.
- ActionGroup:
* [QTBUG-50705] Introduced ActionGroup, a non-visual group of actions
that is mutually exclusive by default.
- ApplicationWindow:
* [QTBUG-61336] The attached activeFocusControl property has been made
functional with a plain QML Window to make the functionality available
when using QQuickWindow/View/Widget instead of ApplicationWindow.
* [QTBUG-61336] Deprecated the overlay grouped property in favor of the
newly introduced Overlay attached properties.
- ButtonGroup:
* Added exclusive property to allow creating non-exclusive button
groups.
- Container:
* Deprecated removeItem(int) in favor of removeItem(Item) and
takeItem(int) with clearer semantics. The former destroys the item,
whereas the latter transfers ownership to the caller.
- Dialog:
* Added "result" property that holds whether the dialog was previously
accepted or rejected.
* Added a standardButton() method for accessing the standard buttons in
the dialog's button box.
* [QTBUG-59423] Added missing applied(), discarded(), helpRequested(),
and reset() signals that are emitted when the respective standard
buttons are clicked.
- DialogButtonBox:
* [QTBUG-59423] Added missing applied(), reset(), and discarded()
signals.
- Menu:
* [QTBUG-50471] Added a popup() method that opens a menu at the mouse
cursor on desktop platforms that have a mouse cursor available, and
otherwise centers the menu over its parent item.
* Added support for declaring Actions. The new "delegate" property is
used to define a Component that is used to create menu items that
present the actions.
* Deprecated removeItem(int) in favor of removeItem(Item) and
takeItem(int) with clearer semantics. The former destroys the item,
whereas the latter transfers ownership to the caller.
* [QTBUG-60351] Added support for cascading sub-menus.
* Added addMenu(), insertMenu(), removeMenu(), and takeMenu() methods
for adding and removing sub-menus programmatically.
* Added addAction(), insertAction(), removeAction(), and takeAction()
methods for adding and removing actions programmatically.
* Added currentIndex property for styling purposes.
* Added actionAt() and menuAt() accessors.
* Added a dismiss() method. Unlike close() that only closes a menu and
its sub-menus, dismiss() closes the whole hierarchy of menus,
including the parent menus.
* Added "count" property.
- MenuBar:
* [QTBUG-60350] Introduced a MenuBar control.
- MenuItem:
* Added a "menu" property that provides access to the menu that contains
the menu item.
* Menu has been fixed to highlight its items while key navigating and
mouse hovering to ensure seamless item highlight between mouse hover
and key navigation. In order to provide appropriate highlighting that
works for key navigation and mouse hover, styles should bind their
visual highlight to MenuItem::highlighted instead of
Control::activeFocus or Control::hovered.
- Overlay:
* [QTBUG-61336] Introduced Overlay attached properties and signals that
supersede the overlay grouped property in Application Window. The
Overlay attached type allows providing background dimming for popups
without requiring an ApplicationWindow instance.
- Popup:
* Added an "opened" boolean property that holds whether a popup is fully
open. That is, the popup is visible and neither the enter nor exit
transitions are running.
* Added "enabled" property.
* Added a read-only "mirrored" property that is true when the popup's
locale is right-to-left.
- RangeSlider:
* Added horizontal and vertical properties to make it more convenient to
create orientation-dependent bindings in styles.
- ScrollBar:
* Added horizontal and vertical properties to make it more convenient to
create orientation-dependent bindings in styles.
- ScrollIndicator:
* Added horizontal and vertical properties to make it more convenient to
create orientation-dependent bindings in styles.
- Slider:
* Added horizontal and vertical properties to make it more convenient to
create orientation-dependent bindings in styles.
- SpinBox:
* [QTBUG-58760] Added wrap-property to allow wrapping circular
spinboxes.
- StackView:
* Allowed specifying a transition when clearing the stack view.
- SwipeView:
* Added horizontal and vertical properties to make it more convenient to
create orientation-dependent bindings in styles.
- TabBar:
* Added index/tabBar/position attached properties.
****************************************************************************
* Styles *
****************************************************************************
- Introduced a Fusion style that offers a platform agnostic
desktop-oriented look'n'feel.
- Added the Imagine style, which is based on image assets that can be
provided using a predefined naming convention.
- Added support for specifying the default font for different styles in
qtquickcontrols2.conf.
- Fixed the style selection mechanism so that now it is possible to
organize platform and locale-specific files into sub-directories, such
as "+linux", "+macos", and "+windows".

View File

@ -0,0 +1,49 @@
Qt 5.10.1 is a bug-fix release. It maintains both forward and backward
compatibility (source and binary) with Qt 5.10.0.
For more details, refer to the online documentation included in this
distribution. The documentation is also available online:
http://doc.qt.io/qt-5/index.html
The Qt version 5.10 series is binary compatible with the 5.9.x series.
Applications compiled for 5.9 will continue to run with 5.10.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
This release contains all fixes included in the Qt 5.9.4 release.
****************************************************************************
* Qt 5.10.1 Changes *
****************************************************************************
Controls
--------
- AbstractButton:
* [QTBUG-65193] Made button's text win over action's when both are
specified.
- Action:
* [QTBUG-65108] Fixed an issue where a checkable action would toggle
twice when toggling an associated checkable button.
* [QTBUG-65889] Fixed shortcuts in Repeater.
Styles
------
- Imagine:
* [QTBUG-65500] Fixed to respect user font settings from
qtquickcontrols2.conf.
Third-Party Code
----------------
- [QTBUG-65409] Document constants from AngularJS in
src/imports/controls/material/ElevationEffect.qml

View File

@ -0,0 +1,161 @@
Qt 5.11 introduces many new features and improvements as well as bugfixes
over the 5.10.x series. For more details, refer to the online documentation
included in this distribution. The documentation is also available online:
http://doc.qt.io/qt-5/index.html
The Qt version 5.11 series is binary compatible with the 5.10.x series.
Applications compiled for 5.10 will continue to run with 5.11.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* Qt 5.11.0 Changes *
****************************************************************************
Important Behavior Changes
--------------------------
- [QTBUG-56295] CheckBox and CheckDelegate no longer force the tristate
property to true when setting checkState to Qt.PartiallyChecked. This
allows the controls to present a partially checked state without being
interactively tri-state.
- [QTBUG-56295] CheckBox and CheckDelegate no longer consider the partially
checked state as a checked state. This fixes check state cycling for non-
tri-state controls so that the check state goes from partially checked to
fully checked state.
Controls
--------
- AbstractButton:
* The autoRepeat property was promoted from Button to AbstractButton.
* Added autoRepeatDelay and autoRepeatInterval properties.
* [QTBUG-62811] Added pressX and pressY properties.
* [QTBUG-66625] Fixed the icon property group type registration.
- Action:
* [QTBUG-65193] Made AbstractButton's icon properties win over Action's
when both are set.
* [QTBUG-66625] Fixed the icon property group type registration.
- ButtonGroup:
* [QTBUG-56295][QTBUG-63782] Added checkState property that indicates
the combined check state of the entire group.
- CheckBox:
* [QTBUG-63238] Made it possible to implement nextCheckState() in QML.
- CheckDelegate:
* [QTBUG-63238] Made it possible to implement nextCheckState() in QML.
- ComboBox:
* [QTBUG-61348] Fixed key search in the popup.
* [QTBUG-66044] Fixed wheel event propagation.
- Control:
* [QTBUG-66133] Fixed focus scope controls, such as Frame, GroupBox,
Page, and Pane, to respect click focus policy by clearing a potential
sub-focus child. This makes it possible to close the virtual keyboard
by clicking the background of a Pane that has Qt.ClickFocus set as its
focusPolicy, for example.
* [QTBUG-66133] Fixed focus scope controls to respect wheel focus
policy.
- Dial:
* [QTBUG-66637] Fixed to keep mouse grab on mouse press.
- DialogButtonBox:
* [QTBUG-59719] Fixed implicit size calculation with one button.
- Drawer:
* [QTBUG-66637] Fixed to no steal mouse/touch grab when e.g. dragging a
horizontal Slider in a horizontal Drawer.
- Label:
* [QTBUG-65880] Fixed a background size regression caused by deferred
execution.
- Popup:
* [QTBUG-66113] Fixed restoring focus for popups that did not originally
request focus, but gained focus after opening.
* Fixed Shortcuts in Popups with window context not being activated.
- RangeSlider:
* [QTBUG-66637] Fixed to keep mouse grab on mouse press.
- ScrollBar:
* [QTBUG-56557] Added minimumSize, visualSize, and visualPosition
properties.
- ScrollIndicator:
* [QTBUG-56557] Added minimumSize, visualSize, and visualPosition
properties.
- Slider:
* [QTBUG-66637] Fixed to keep mouse grab on mouse press.
- SpinBox:
* Added a displayText property that allows styles to create a simple
and efficient QML binding to display the textual value instead of
calling the textFromValue() JS-function.
* [QTBUG-66044] Fixed wheel event propagation.
- StackView:
* [QTBUG-51321] Fixed to transfer focus to the current item.
* [QTBUG-67118] Fixed a crash with initialItem.
- TextArea:
* [QTBUG-67334] Fixed the background to not scroll when TextArea is
placed in a ScrollView.
* [QTBUG-65880] Fixed a background size regression caused by deferred
execution.
- TextField:
* [QTBUG-65880] Fixed a background size regression caused by deferred
execution.
Styles
------
- [QTBUG-66430] Fixed to not override/reset platform default fonts and
palettes if :/qtquickcontrols2.conf exists but doesn't define fonts
or palettes.
- Fusion:
* [QTBUG-66752] Fixed BusyIndicator to show up when running is set to
true after creation.
* [QTBUG-66276] Added missing plugins.qmltypes.
- Material:
* Decreased Dial's handle size from 14 to 10.
* [QTBUG-64872] Made BusyIndicator's line size adapt to the size of the
control.
* [QTBUG-58646] Fixed artifacts in ripple effects.
* [QTBUG-67442] Fixed CheckBox's, CheckDelegate's, RadioButton's and
RadioDelegate's indicator in disabled state.
- Universal:
* Decreased Dial's handle size from 20 to 14.
Platform
--------
- ColorDialog:
* [QT3DS-1363] Fixed currentColor to get correctly updated when opening
the dialog first time.
- Menu:
* [QTBUG-55251] Fixed positioning on high-DPI screens.
* [QTBUG-66876] Fixed menu titles not being visible if they were defined
using qsTr() or bindings.
* [QTBUG-66889] Fixed a crash on exist with sub-menus on Windows.
- MenuItem:
* [QTBUG-66386] Fixed checked state handling.

View File

@ -0,0 +1,25 @@
Qt 5.11.1 is a bug-fix release. It maintains both forward and backward
compatibility (source and binary) with Qt 5.11.0.
For more details, refer to the online documentation included in this
distribution. The documentation is also available online:
http://doc.qt.io/qt-5/index.html
The Qt version 5.11 series is binary compatible with the 5.10.x series.
Applications compiled for 5.10 will continue to run with 5.11.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* Qt 5.11.1 Changes *
****************************************************************************
- [QTBUG-67684] ComboBox: don't block the escape/back key
- [QTBUG-67684] ComboBox: reset when hidden

View File

@ -0,0 +1,32 @@
Qt 5.11.2 is a bug-fix release. It maintains both forward and backward
compatibility (source and binary) with Qt 5.11.0 through 5.11.1.
For more details, refer to the online documentation included in this
distribution. The documentation is also available online:
http://doc.qt.io/qt-5/index.html
The Qt version 5.11 series is binary compatible with the 5.10.x series.
Applications compiled for 5.10 will continue to run with 5.11.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* Qt 5.11.2 Changes *
****************************************************************************
- [QTBUG-69897] StackView: fixed a crash in viewItemTransitionFinished()
- [QTBUG-69839] ColorDialog: fixed a crash when initializing the platform dialog helper
- [QTBUG-69506] IconImage: prevented the color from being applied twice
- [QTBUG-66483] Popup: fixed a crash on exit when using a shader
- [QTBUG-68219] Styles: fixed handling of QRC paths in QT_QUICK_CONTROLS_STYLE_PATH
- [QTBUG-68858] Menu: fixed items not being scrollable when using Window
- [QTBUG-68737] Tumbler: fixed to respect currentIndex changes in onModelChanged
- [QTBUG-68769] TextArea, TextField: fixed to use the control's renderType in placeholder text
- SpinBox: fixed "function expressions as statements" warnings

View File

@ -0,0 +1,20 @@
Qt 5.11.3 is a bug-fix release. It maintains both forward and backward
compatibility (source and binary) with Qt 5.11.0 through 5.11.2.
For more details, refer to the online documentation included in this
distribution. The documentation is also available online:
http://doc.qt.io/qt-5/index.html
The Qt version 5.11 series is binary compatible with the 5.10.x series.
Applications compiled for 5.10 will continue to run with 5.11.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
- This release contains only minor code improvements.

View File

@ -0,0 +1,171 @@
Qt 5.12 introduces many new features and improvements as well as bugfixes
over the 5.11.x series. For more details, refer to the online documentation
included in this distribution. The documentation is also available online:
https://doc.qt.io/qt-5/index.html
The Qt version 5.12 series is binary compatible with the 5.11.x series.
Applications compiled for 5.11 will continue to run with 5.12.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* Controls *
****************************************************************************
- AbstractButton:
* Added implicitIndicatorWidth and implicitIndicatorHeight properties.
- ComboBox:
* Added implicitIndicatorWidth and implicitIndicatorHeight properties.
- Control:
* Added horizontalPadding and verticalPadding properties as a convenient
way to set both left and right, or top and bottom paddings in one go.
* Unless explicitly specified, baselineOffset is now automatically
updated based on the top padding of the control and the baselineOffset
of the contentItem. Styles no longer need to specify the
baselineOffset in QML.
* [QTBUG-60156] Added implicitBackgroundWidth and
implicitBackgroundHeight properties that can be used to simplify
complex implicit size bindings.
* Added implicitContentWidth and implicitContentHeight properties that
can be used to simplify complex implicit size bindings.
* [QTBUG-60156] Added topInset, bottomInset, leftInset, and rightInset
properties to control the geometry of the background similarly to how
paddings control the geometry of the contentItem.
- Dial:
* [QTBUG-56323] Added the inputMode property. This property controls how
the dial is interacted with. The circular input mode (default, old
behavior) operates on an absolute input system, whereas the horizontal
and vertical input modes use a relative input system.
- Dialog:
* Added implicitHeaderWidth, implicitHeaderHeight, implicitFooterWidth,
and implicitFooterHeight properties.
- DialogButtonBox:
* Added buttonLayout property that can be used to arrange the buttons.
* Added contentWidth and contentHeight properties.
- GroupBox:
* Added implicitLabelWidth and implicitLabelHeight properties.
- Label:
* Added implicitBackgroundWidth and implicitBackgroundHeight properties
that can be used to simplify complex implicit size bindings.
[ChangeLog][Controls][TextArea] Added implicitBackgroundWidth and
implicitBackgroundHeight properties that can be used to simplify
complex implicit size bindings. [ChangeLog][Controls][TextField] Added
implicitBackgroundWidth and implicitBackgroundHeight properties that
can be used to simplify complex implicit size bindings.
* Added topInset, bottomInset, leftInset, and rightInset properties to
control the geometry of the background similarly to how paddings
control the geometry of the contentItem.
- Page:
* Added implicitHeaderWidth, implicitHeaderHeight, implicitFooterWidth,
and implicitFooterHeight properties.
- Popup:
* Added horizontalPadding and verticalPadding properties as a convenient
way to set both left and right, or top and bottom paddings in one go.
* [QTBUG-60354] Added anchors.centerIn to Popup to allow a covenient way
of centering a popup.
* Added implicitBackgroundWidth, implicitBackgroundHeight,
implicitContentWidth, and implicitContentHeight properties.
* [QTBUG-60156] Added topInset, bottomInset, leftInset, and rightInset
properties to control the geometry of the background similarly to how
paddings control the geometry of the contentItem.
- QQuickStyle:
* [QTBUG-67062] Added stylePathList() and addStylePath() methods for
managing the list of directories where Qt Quick Controls 2 searches
for available styles.
- RangeSlider:
* [QTBUG-67311] Added a moved() signal to each handle (similar to the
Slider's moved() signal) to react to the values being interactively
changed by the user.
* [QTBUG-67317] Added a valueAt() function to allow accessing each
handle's value when the live property is set to false.
* Added first.implicitHandleWidth, first.implicitHandleHeight,
second.implicitHandleWidth, and second.implicitHandleHeight
properties.
* [QTBUG-62784] Added touchDragThreshold property for configuring the
threshold to initiate the touch 'drag' of the handle of the slider. The
mouse 'drag' won't be affected by the property.
- Slider:
* Added implicitHandleWidth and implicitHandleHeight properties.
* [QTBUG-62784] Added touchDragThreshold property for configuring the
threshold to initiate the touch 'drag' of the handle of the slider. The
mouse 'drag' won't be affected by the property.
- SpinBox:
* Added up.implicitIndicatorWidth, up.implicitIndicatorHeight,
down.implicitIndicatorWidth, and down.implicitIndicatorHeight
properties.
- SwipeView:
* Added contentWidth and contentHeight properties.
- TextArea:
* Added topInset, bottomInset, leftInset, and rightInset properties to
control the geometry of the background similarly to how paddings
control the geometry of the contentItem.
* Added placeholderTextColor property for user convenience to customize
the placeholderText color to fit the backgrounds.
- TextField:
* Added topInset, bottomInset, leftInset, and rightInset properties to
control the geometry of the background similarly to how paddings
control the geometry of the contentItem.
* [QTBUG-66260] Added placeholderTextColor property for user convenience
to customize the placeholderText color to fit the backgrounds.
- ToolTip:
* [QTBUG-62890] Added non-attached show() and hide() methods to make it
more flexible to meet certain requirements.
- Tumbler:
* [QTBUG-66358] Added positionViewAtIndex() function that calls the
respective PathView/ListView function, depending on the value of wrap.
This allows changing currentIndex without animations.
****************************************************************************
* Material *
****************************************************************************
- [QTBUG-51109] Added Dense variant of the Material style for use on
desktop platforms. Some controls are slightly smaller in height and use
smaller font sizes. The variant can be enabled by setting
QT_QUICK_CONTROLS_MATERIAL_VARIANT to Dense or setting Variant=Dense in
the qtquickcontrols.conf file.
****************************************************************************
* Platform *
****************************************************************************
- Menu:
* [QTBUG-67730] Deprecated iconName and iconSource properties in favor
of icon.name and icon.source grouped properties.
* [QTBUG-67730] Added icon.mask grouped property.
[ChangeLog][Platform][MenuItem] Added icon.mask grouped property.
[ChangeLog][Platform][SystemTrayIcon] Added icon.mask grouped
property.
- MenuItem:
* [QTBUG-67730] Deprecated iconName and iconSource properties in favor
of icon.name and icon.source grouped properties.
- SystemTrayIcon:
* [QTBUG-67730] Deprecated iconName and iconSource properties in favor
of icon.name and icon.source grouped properties.

View File

@ -0,0 +1,20 @@
Qt 5.12.1 is a bug-fix release. It maintains both forward and backward
compatibility (source and binary) with Qt 5.12.0.
For more details, refer to the online documentation included in this
distribution. The documentation is also available online:
http://doc.qt.io/qt-5/index.html
The Qt version 5.12 series is binary compatible with the 5.11.x series.
Applications compiled for 5.11 will continue to run with 5.12.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
- This release contains only minor code improvements.

View File

@ -0,0 +1,27 @@
Qt 5.12.10 is a bug-fix release. It maintains both forward and backward
compatibility (source and binary) with Qt 5.12.9.
For more details, refer to the online documentation included in this
distribution. The documentation is also available online:
https://doc.qt.io/qt-5.12/index.html
The Qt version 5.12 series is binary compatible with the 5.11.x series.
Applications compiled for 5.11 will continue to run with 5.12.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* Controls *
****************************************************************************
- [QTBUG-84579] Fixed crash on exit when centering Popup within Overlay in
StackView item.
- [QTBUG-79464] QQuickPopup: fixed focus not being transferred to the
appropriate item when multiple popups were closing.

View File

@ -0,0 +1,60 @@
Qt 5.12.2 is a bug-fix release. It maintains both forward and backward
compatibility (source and binary) with Qt 5.12.0 through 5.12.1.
For more details, refer to the online documentation included in this
distribution. The documentation is also available online:
https://doc.qt.io/qt-5/index.html
The Qt version 5.12 series is binary compatible with the 5.11.x series.
Applications compiled for 5.11 will continue to run with 5.12.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* Controls *
****************************************************************************
- [QTBUG-73849] Fixed incorrect documentation link to
Number.toLocaleString().
- [QTBUG-72536] Fixed bug with long text in ScrollView.
- [QTBUG-73447] Fixed Menu's appearance not changing when enabled state
changes
- [QTBUG-70181] Fixed disabled menu items getting focus.
- [QTBUG-69540] Fixed disabled sub-menu items being highlighted.
- [QTBUG-72023] Fixed font and palette settings in .conf files not being
respected.
- [QTBUG-69682] Fixed Menu not being dismissed when the triggered item
disables itself.
- [QTBUG-73412] Fixed Dial's new properties not being detected by Creator.
- [QTBUG-73202] Documented how to move active focus out of TextArea with
tab.
- [QTBUG-72786] Fixed palette colors not propagating to ComboBox's popup.
- [QTBUG-73179] Fixed Qt.labs.platform.FileDialog not honoring folder
property.
- [QTBUG-72811] Fixed AbstractButton's clicked() signal not being emitted
after long press.
- [QTBUG-72746] Fixed crash on exit when using popups.
- [QTBUG-72372] Fixed issue where a button would go outside of
DialogButtonBox.
- [QTBUG-71902] Fixed incorrect font size in certain styles on Windows.
- [QTBUG-72750] Fixed Slider's wheel event propagation.
****************************************************************************
* Controls *
****************************************************************************
Fusion
------
- [QTBUG-70819] Made Active and Disabled button colors closer to Widgets'
Fusion style.
- [QTBUG-70819] Use white ButtonText when a dark system theme is in use.
- [QTBUG-70652] Use system palette for highlightedText instead of a fixed
white color.

View File

@ -0,0 +1,46 @@
Qt 5.12.3 is a bug-fix release. It maintains both forward and backward
compatibility (source and binary) with Qt 5.12.0 through 5.12.2.
For more details, refer to the online documentation included in this
distribution. The documentation is also available online:
https://doc.qt.io/qt-5/index.html
The Qt version 5.12 series is binary compatible with the 5.11.x series.
Applications compiled for 5.11 will continue to run with 5.12.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* Controls *
****************************************************************************
- [QTBUG-70451] DialogButtonBox: fixed buttons with equal roles being
randomly sorted.
- [QTBUG-70161] ComboBox: fixed popup immediately closing on iOS
- [QTBUG-72886] DialogButtonBox: fixed content size calculation
- [QTBUG-74226] Fixed attached ToolTips using the timeout of the last shown
tool tip
- [QTBUG-72536] ScrollView now respects the content size set on/by
the flickable
- [QTBUG-73354] Menu: enter/return can now be used to activate items,
rather than just space.
- [QTBUG-71290] Drawer: fixed infinite positioning loop
- [QTBUG-66494] Page: fixed binding loop
****************************************************************************
* Styles *
****************************************************************************
Default
--------
- [QTBUG-72786] Made ItemDelegate respect highlightedText and improved
highlightedText color so that text shows up against a highlighted background.
This also allows easily switching ComboBox to a dark style via palette
customization.

View File

@ -0,0 +1,20 @@
Qt 5.12.4 is a bug-fix release. It maintains both forward and backward
compatibility (source and binary) with Qt 5.12.0 through 5.12.3.
For more details, refer to the online documentation included in this
distribution. The documentation is also available online:
https://doc.qt.io/qt-5/index.html
The Qt version 5.12 series is binary compatible with the 5.11.x series.
Applications compiled for 5.11 will continue to run with 5.12.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
- This release contains only minor code improvements.

View File

@ -0,0 +1,28 @@
Qt 5.12.5 is a bug-fix release. It maintains both forward and backward
compatibility (source and binary) with Qt 5.12.0 through 5.12.4.
For more details, refer to the online documentation included in this
distribution. The documentation is also available online:
https://doc.qt.io/qt-5/index.html
The Qt version 5.12 series is binary compatible with the 5.11.x series.
Applications compiled for 5.11 will continue to run with 5.12.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* Controls *
****************************************************************************
- TextArea:
* [QTBUG-76369] Fixed rendering issue using the Material style.
- Container
* [QTBUG-76164] Fixed crash when removing items.

View File

@ -0,0 +1,33 @@
Qt 5.13 introduces many new features and improvements as well as bugfixes
over the 5.12.x series. For more details, refer to the online documentation
included in this distribution. The documentation is also available online:
https://doc.qt.io/qt-5/index.html
The Qt version 5.13 series is binary compatible with the 5.12.x series.
Applications compiled for 5.12 will continue to run with 5.13.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* Controls *
****************************************************************************
- Added SplitView, a control that lays out items horizontally or vertically
with a draggable splitter between each item.
- Added cache property to icon.
- [QTBUG-75072] ScrollBar: fixed value not changing when scrolling via
VoiceOver.
- [QTBUG-74661] QQuickComboBox: we no longer hide popup when it's focused.
- [QTBUG-69096] Doc: expanded upon Pane's Content Sizing section.
- [QTBUG-74902] Doc: added a Size section to explain StackView's sizing
behavior.
- [QTBUG-74688] SpinBox: fixed indicators being hovered when mouse is moved
while pressed.
- [QTBUG-74276] Fix SplitView crash when using certain attached properties.

View File

@ -0,0 +1,31 @@
Qt 5.13.1 is a bug-fix release. It maintains both forward and backward
compatibility (source and binary) with Qt 5.13.0.
For more details, refer to the online documentation included in this
distribution. The documentation is also available online:
https://doc.qt.io/qt-5/index.html
The Qt version 5.13 series is binary compatible with the 5.12.x series.
Applications compiled for 5.12 will continue to run with 5.13.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* Controls *
****************************************************************************
- [QTBUG-76356] Accessibility: a Switch now has checkbox as its accessibleRole.
- [QTBUG-75572] Fixed an issue with transforming Shortcut.sequence to string.
- [QTBUG-75844] The text cursor no longer disappears while dragging it
around on iOS with the magnifier showing.
- [QTBUG-75972] The countChanged signal now will be emitted when a new
model is set on a ComboBox.
- [QTBUG-67343] It's now OK to use a ShaderEffect in a ComboBox delegate
(fixed in Qt Quick, tested in Controls 2)

View File

@ -0,0 +1,25 @@
Qt 5.13.2 is a bug-fix release. It maintains both forward and backward
compatibility (source and binary) with Qt 5.13.0 through 5.13.1.
For more details, refer to the online documentation included in this
distribution. The documentation is also available online:
https://doc.qt.io/qt-5/index.html
The Qt version 5.13 series is binary compatible with the 5.12.x series.
Applications compiled for 5.12 will continue to run with 5.13.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* Controls *
****************************************************************************
- QQuickTextArea:
* Fixed rendering issue when using TextArea in a ScrollView.

View File

@ -0,0 +1,51 @@
Qt 5.14 introduces many new features and improvements as well as bugfixes
over the 5.13.x series. For more details, refer to the online documentation
included in this distribution. The documentation is also available online:
https://doc.qt.io/qt-5/index.html
The Qt version 5.14 series is binary compatible with the 5.13.x series.
Applications compiled for 5.13 will continue to run with 5.14.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* Controls *
****************************************************************************
- ComboBox:
* Added valueRole, currentValue and indexOfValue(). These allow
convenient management of data for a role associated with the text
role.
- QQuickMenuBar:
* Fixed issue with dynamically menu bar items not losing their highlight
when their menu was dismissed.
- QQuickPopup:
* Fixed the issue that Popup doesn't respond to CloseOnEscape if the
initial value of visible is true
- [QTBUG-79790] Fixed issue where font changes would result in an extra
signal being emitted.
- [QTBUG-59330] The documentation now advises against naming root resource
directories with the same name as a style name.
- [QTBUG-79302] SplitView: fix issue where Repeater items were not created.
- [QTBUG-79302] SplitView: fix cursor shape staying as Split*Cursor in some
cases.
- [QTBUG-79270] Fixed assertion failure when hiding a SplitView with only
one item.
****************************************************************************
* Universal *
****************************************************************************
- TabBar:
* Disabled wrapping. The Universal style TabBar now behaves like TabBar
from other styles.

View File

@ -0,0 +1,29 @@
Qt 5.14.1 is a bug-fix release. It maintains both forward and backward
compatibility (source and binary) with Qt 5.14.0.
For more details, refer to the online documentation included in this
distribution. The documentation is also available online:
https://doc.qt.io/qt-5/index.html
The Qt version 5.14 series is binary compatible with the 5.13.x series.
Applications compiled for 5.13 will continue to run with 5.14.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* Controls *
****************************************************************************
- StackView:
* [QTBUG-80353] fixed crash when recursively removing items.
* [QTBUG-57267] fix an issue where the current item became hidden.
- SplitView:
* [QTBUG-79846] fixed hoverable child items breaking handle hover state.

View File

@ -0,0 +1,40 @@
Qt 5.14.2 is a bug-fix release. It maintains both forward and backward
compatibility (source and binary) with Qt 5.14.0 through 5.14.1.
For more details, refer to the online documentation included in this
distribution. The documentation is also available online:
https://doc.qt.io/qt-5/index.html
The Qt version 5.14 series is binary compatible with the 5.13.x series.
Applications compiled for 5.13 will continue to run with 5.14.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* Controls *
****************************************************************************
- [QTBUG-82032] AbstractButton: fixed clicked() being emitted after
doubleClicked().
- [QTBUG-81935] ToolTip: fixed timeout not activating if opened during exit
transition.
- [QTBUG-77202] Control: we now account for when a touch event is
synthesized by Qt as a mouse event.
- [QTBUG-81796] DialogButtonBox: fixed explicitly set button text not being
rendered.
- [QTBUG-75682] Fixed issue where Qt Quick Designer was not able to work
with the module on WebAssembly/static builds.
- [QTBUG-80970] RangeSlider: fixed errors in the documentation's example
code.
- [QDS-456] placeholderText is now set by default in Qt Design Studio
instead of text when dragging a TextField or TextArea onto the form
editor.
- [QTBUG-81216] Fixed QQuickStyle::setFallbackStyle() not working on
Android.

View File

@ -0,0 +1,80 @@
Qt 5.15 introduces many new features and improvements as well as bugfixes
over the 5.14.x series. For more details, refer to the online documentation
included in this distribution. The documentation is also available online:
https://doc.qt.io/qt-5/index.html
The Qt version 5.15 series is binary compatible with the 5.14.x series.
Applications compiled for 5.14 will continue to run with 5.15.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
Qt 5.15 introduces many new features and improvements as well as bugfixes
over the 5.14.x series. For more details, refer to the online documentation
included in this distribution. The documentation is also available online:
https://doc.qt.io/qt-5.15/index.html
The Qt version 5.15 series is binary compatible with the 5.14.x series.
Applications compiled for 5.14 will continue to run with 5.15.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* Important Behavior Changes *
****************************************************************************
- [QTBUG-72085] Old delegate items (background, contentItem, etc.) are no
longer destroyed, as they are technically owned by user code. Instead,
they are hidden, unparented from the control (QQuickItem parent, not
QObject), and Accessible.ignored is set to true. This prevents them from
being unintentionally visible and interfering with the accessibility
tree when a new delegate item is set.
See the following page for more information:
https://doc.qt.io/qt-5/qtquickcontrols2-customize.html#considerations-for-custom-styles
****************************************************************************
* Controls *
****************************************************************************
- Added HorizontalHeaderView and VerticalHeaderView for use with TableView.
- Added selectTextByMouse property to ComboBox.
- [QTBUG-82473] Fixed Menu not taking padding into account when checking
if it is interactive.
- [QTBUG-73687] Fixed Menu positioning when a scale is set.
- [QTBUG-81867] Fixed hidden SplitView items causing visible items to not
be resizable.
- [QTBUG-82020] Fixed ComboBox text not being retranslated after a
translator is installed.
- [QTBUG-79501] Fixed keyboard navigation via tab in non-modal popups
(i.e. Drawer).
- [QTBUG-78858] Fixed Editable ComboBox's auto-completion performance.
****************************************************************************
* Styles *
****************************************************************************
Material
--------
- [QTBUG-70768] Added missing visual distinction between enabled and
disabled sliders.
- [QTBUG-70768] Aligned Slider's visuals closer to the Material Design
guidelines.
Imagine
-------
- [QTBUG-82463] Fixed squished Dial.

View File

@ -0,0 +1,49 @@
Qt 5.15.1 is a bug-fix release. It maintains both forward and backward
compatibility (source and binary) with Qt 5.15.0.
For more details, refer to the online documentation included in this
distribution. The documentation is also available online:
https://doc.qt.io/qt-5.15/index.html
The Qt version 5.15 series is binary compatible with the 5.14.x series.
Applications compiled for 5.14 will continue to run with 5.15.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* Controls *
****************************************************************************
- [QTBUG-64151] QQuickSpinBox: fixed "function expressions as statements"
warning.
- [QTBUG-85804] SwipeDelegate: fixed being able to call close() when
pressed. This conflicts with the behavior of SwipeDelegate. The
released() or clicked() signals should be used instead.
- [QTBUG-85806] SwipeDelegate: fixed closed() being emitted when already
closed.
- [QTBUG-85884] Fixed Dialog not releasing focus when it was hidden as a
result of losing focus.
- [QTBUG-84488] Fixed ComboBox popup position jumping when opened with
styles that user enter transitions.
- [QTBUG-84579] Fixed crash on exit when centering Popup within Overlay in
StackView item.
- [QTBUG-81976][QTBUG-86131] Fixed various "Cannot read property 'width'
of null" errors.
- [QTBUG-84381] StackView: fixed heap-use-after-free when pushing after clear.
- [QTBUG-83554] ComboBox: fixed currentValue not being updated on model
changes.
Platform
--------
- MenuItem:
* [QTBUG-84102] Fix MenuItem.icon.* properties not being accessible when
importing version 1.1.

View File

@ -0,0 +1,42 @@
Qt 5.15.2 is a bug-fix release. It maintains both forward and backward
compatibility (source and binary) with Qt 5.15.1.
For more details, refer to the online documentation included in this
distribution. The documentation is also available online:
https://doc.qt.io/qt-5.15/index.html
The Qt version 5.15 series is binary compatible with the 5.14.x series.
Applications compiled for 5.14 will continue to run with 5.15.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* Controls *
****************************************************************************
- [QTBUG-83698] Fixed issue where a menu opened by pressing enter (handled
via attached Keys property) would instantly trigger the first menu
item.
- [QTBUG-86851] QQuickMenu: fixed memory leak due to contentModel not being
deleted. Also fixed a heap-use-after-free that was exposed by the
previously mentioned fix.
- [QTBUG-85884] Fixed expected item not getting focus when a dialog closes.
- [QTBUG-85719] Fixed SpinBox failing to validate input correctly after
previous input was out of range.
****************************************************************************
* Styles *
****************************************************************************
Material
--------
- [QTBUG-85699] Fixed binding loops when binding between attached
properties.

View File

@ -0,0 +1,196 @@
Qt 5.7.1 is a bug-fix release. It maintains both forward and backward
compatibility (source and binary) with Qt 5.7.0.
For more details, refer to the online documentation included in this
distribution. The documentation is also available online:
http://doc.qt.io/qt-5/index.html
The Qt version 5.7 series is binary compatible with the 5.6.x series.
Applications compiled for 5.6 will continue to run with 5.7.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* Important Behavior Changes *
****************************************************************************
- AbstractButton, Control, and Container now calculate their implicit size
based on the implicit size of the content item plus paddings, and the
implicit size of the background item. This makes it convenient to implement
custom controls and buttons, because the implicit size calculation for
these abstract/non-visual base types works as expected out of the box, but
may cause surprises if an application relies on the old behavior that a
custom control does not have any implicit size by default.
- Drawers have been changed to follow the same visibility rules than all
other types of popups do. This means that drawers no longer stay visible
at the window edge in order to intercept input events, because that caused
severe conflicts in input handling and stacking order between multiple
drawers and other popups.
- Popups have been fixed to respect explicitly set width and height.
Previously, explicitly set size was accidentally ignored when a popup had
implicit size set.
****************************************************************************
* Controls *
****************************************************************************
- ApplicationWindow:
* [QTBUG-55143] Fixed the content layout to take header and footer
visibility into account.
- ComboBox:
* [QTBUG-54573] Fixed a bug which caused ghost items, from outside the
popup's visible area, to appear in the popup.
* [QTBUG-55118] Fixed the display text to be properly updated on model
changes.
* [QTBUG-55050] Fixed the default delegates to respect the popup width.
* [QTBUG-55030] Fixed the highlighted item to be visible in the popup when
it is opened.
- Control:
* [QTBUG-56007] Fixed the hovered state to get cleared when hidden.
- Dial:
* [QTBUG-55228] Fixed step size and snap mode handling with ranges starting
from a non-zero value.
- Drawer:
* [QTBUG-54578] Fixed a closed drawer to not peek out from the window edge
while resizing the window.
* [QTBUG-54629] Fixed a bug in drag margin handling that allowed the user
to sometimes drag out the drawer even if dragging was disabled.
* Fixed a bug in the calculation of swipe velocity.
* [QTBUG-54800] Fixed conflicts between multiple drawers.
* [QTBUG-54794][QTBUG-55022] Fixed conflicts between drawers and other
popups.
* [QTBUG-55703] Fixed the stacking order of multiple drawers and popups.
* [QTBUG-55995] Fixed flickering on touch release.
* [QTBUG-55360] Made it possible to control the vertical position of
a horizontal drawer, and vice versa. This allows placing a drawer below
a header/toolbar, for instance.
- Page:
* [QTBUG-55143] Fixed the content layout to take header and footer
visibility into account.
- RangeSlider:
* [QTBUG-55015] Fixed step size and snap mode handling with ranges starting
from a non-zero value.
- Slider:
* [QTBUG-54140] Fixed step size and snap mode handling with ranges starting
from a non-zero value.
- Popup:
* [QTBUG-56025] Fixed to respect explicitly set width and height.
* [QTBUG-53419] Fixed hover events to not leak through popups or modal
background dimming.
* [QTBUG-55004] Fixed popups to appear above the QML-based dialogs from
QtQuick.Dialogs 1.x.
* [QTBUG-55347] Fixed a crash on dynamic parent item changes.
* [QTBUG-54797] Fixed the background dimming to update accordingly on
dynamic changes to the dim and modal properties.
* [QTBUG-55729] Fixed popups to close on touch events when using a plain
Window instead of ApplicationWindow.
* [QTBUG-54913] Fixed hover event delivery with plain Window.
* [QTBUG-55769] Fixed wheel events to not leak through modal background
dimming.
- ScrollIndicator:
* [QTBUG-55620] Fixed to respect the paddings when overshooting, so that
the indicator doesn't move outside the bounds of the attached flickable.
- SpinBox:
* [QTBUG-56215] Fixed valueFromText() to not get called for non-editable
spinboxes.
- StackView:
* Fixed the "unknown argument" warning when popping down to the current
item.
* [QTBUG-54552] Fixed to claim ownership of dynamically created items.
* [QTBUG-56158] Fixed a crash in pop() when attempting to pop an item that
is still activating from a previous popup.
* [QTBUG-55749] Allowed loading remote URLs.
- SwipeDelegate:
* [QTBUG-54648] Fixed the use of buttons or other interactive controls at
the sides or behind the delegate.
* [QTBUG-54660][QTBUG-54780] Fixed content re-layouting issues.
* [QTBUG-55040] Added a warning for conflicting anchors.
- Switch:
* [QTBUG-55647] Fixed focus on tap/click over the handle.
* Fixed missing pressed() and released() signals.
* Fixed dragging of the handle on touch.
- SwitchDelegate:
* Made the handle draggable.
- TabBar:
* [QTBUG-55129] Fixed a bug which caused ghost items, from outside the
tabbar's visible area, to appear in the tabbar.
* [QTBUG-55129] Improved the behavior of flickable tabs.
* [QTBUG-56265] Fixed mixing of fixed and implicitly resized tabs.
* Fixed to re-layout as appropriate when tabs are resized at run-time.
- TabButton:
* [QTBUG-55129] Fixed implicit width calculation.
- TextArea:
* [QTBUG-54615] Fixed mouse double click to select a word.
* [QTBUG-54897] Fixed to not intercept input events outside the visual
bounds when attached to a Flickable.
* Set a caret or ibeam mouse cursor, indicating that the control can accept
and display text input.
- TextField:
* [QTBUG-54615] Fixed mouse double click to select a word.
* Set a caret or ibeam mouse cursor, indicating that the control can accept
and display text input.
* [QTBUG-55684] Improved the implicit size calculation.
- ToolTip:
* Fixed the shared tooltip instance to get destructed when the associated
QML engine is destructed.
* [QTBUG-55347] Fixed attached properties to apply to the shared tooltip
instance only when the shared tooltip is visible for the respective item
that the property is attached to.
* [QTBUG-54206] Fixed a bug that caused the shared tooltip to sometimes
fade out when it should stay visible.
* [QTBUG-55572] Fixed delay and visibility handling for standlone tooltips.
Material
--------
- Fixed (optional) elevation effects for Frame, GroupBox, Pane, and TabBar.
- Fixed SpinBox text color in disabled state.
- [QTBUG-54269] Added documentation for Material.Shade and the related
parameter of Material.color().
- [QTBUG-54935] Fixed white text on white background in ComboBox that is
placed in a ToolBar.
- [QTBUG-54472] Fixed rendering issues with multiple BusyIndicators.
- [QTBUG-55366] Fixed the default foreground and background colors read from
:/qtquickcontrols2.conf or environment variables.
- [QTBUG-55687] Fixed several issues with accent and background inheritance.
- Fixed the accent color, where the shade depends on the theme, to update as
appropriate on run-time theme changes.
- [QTBUG-52631] Fixed style inheritance issues with popups.
- [QTBUG-53266] Fixed the background color of dialogs in the dark theme.
- Fixed text cursor blink period.
Universal
---------
- Fixed Dial press effect.
- [QTBUG-52738] Fixed editor colors in the dark theme.
- [QTBUG-55366] Fixed the default foreground and background colors read from
:/qtquickcontrols2.conf or environment variables.

View File

@ -0,0 +1,208 @@
Qt 5.8 introduces many new features and improvements as well as bugfixes
over the 5.7.x series. For more details, refer to the online documentation
included in this distribution. The documentation is also available online:
http://doc.qt.io/qt-5/index.html
The Qt version 5.8 series is binary compatible with the 5.7.x series.
Applications compiled for 5.7 will continue to run with 5.8.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* Important Behavior Changes *
****************************************************************************
- Control:
* Control::hoverEnabled has been made to inherit to children, to make it
possible to disable hover effects for a tree of controls in one place.
- Tumbler:
* Changed the default value of visibleItemCount to 5 to make it visually
clearer that it's a Tumbler.
* [QTBUG-53587] Changed the default value of wrap to be false when count
is less than visibleItemCount. Explicitly setting wrap overrides this
behavior.
****************************************************************************
* Controls *
****************************************************************************
- AbstractButton:
* A plain AbstractButton now calculates its implicit size based on the
implicit size of the content item plus paddings, and the implicit size
of the background item.
* [QTBUG-51554] The checkable property has been made accessible from
QML. Previously it was only exposed for Button and MenuItem, but it is
now available for any AbstractButton to make it possible to create
custom QML-based checkable buttons.
* [QTBUG-57085] Fixed auto-repeat to not cancel on the tiniest mouse/touch
move, but keep repeating until moved outside the button.
* Fixed press-and-hold for checkable buttons to not toggle the checked
state on release after press-and-hold.
- ButtonGroup:
* Added clicked(AbstractButton) signal for centralized click handling for
grouped buttons.
- ComboBox:
* [QTBUG-56884] Added handling for Home and End keys.
* [QTBUG-56884] Added missing keyboard search functionality.
* [QTBUG-54935] Added a flat property that provides more suitable looks
for using ComboBox in a ToolBar.
- Container:
* Added incrementCurrentIndex() and decrementCurrentIndex() methods for
changing the current index without losing its property binding.
* A plain Container now calculates its implicit size based on the
implicit size of the content item plus paddings, and the implicit size
of the background item.
- Control:
* A plain Control now calculates its implicit size based on the implicit
size of the content item plus paddings, and the implicit size of the
background item.
- Dialog:
* Added a new Dialog type to provide convenience for handling dialog
popups. Dialog integrates with DialogButtonBox, and provides convenient
accepted() and rejected() signals.
- DialogButtonBox:
* Added DialogButtonBox to provide convenience for handling dialog buttons.
DialogButtonBox is able to create a set of standard buttons with a single
line of QML code, and provides convenient accepted() and rejected() signals.
- Drawer:
* [QTBUG-55360] Made it possible to control the vertical position of a
horizontal drawer, and vice versa. This allows placing a drawer below
a header/toolbar, for instance.
- MenuSeparator:
* [QTBUG-54862] Added MenuSeparator to visually distinguish between groups
of items in a menu.
- Page:
* [QTBUG-56709] Page has been made to calculate its implicit size based
on the implicit size of the header, content, and footer plus paddings,
and the implicit size of the background item.
- Popup:
* [QTBUG-56025] Fixed to respect explicitly set width and height.
* [QTBUG-56562] The QML Shortcut type from QtQuick has been fixed to
respect modal popups from QtQuick Controls 2.
* [QTBUG-56755] Fixed binding loops with size-dependent positioning.
- RangeSlider:
* [QTBUG-50003] Added first.hovered and second.hovered properties that
hold whether the respective handles are hovered.
- RoundButton:
* [QTBUG-54967] Added RoundButton.
- Slider:
* [QTBUG-53847] Added valueAt() method for converting any position to a
value in the slider's range. It is also possible to use valueAt() to get
continuous value updates.
- SpinBox:
* [QTBUG-50003] Added up.hovered and down.hovered properties that hold
whether the respective buttons are hovered.
* [QTBUG-57085] Fixed auto-repeat to not cancel on the tiniest mouse/touch
move, but keep repeating until moved outside the button.
- StackView:
* Added attached StackView.activated(), StackView.deactivated(),
StackView.activating(), and StackView.deactivating() signals that are
convenient for initializing and cleaning up item-specific resources.
* [QTBUG-55405] Added StackView.removed() attached signal to provide a
way to delete items that StackView won't.
* Made it possible to choose the visual transition type for any operation.
This allows using for example push and pop transitions with replace(),
which allows implementing an "infinite" back and forward navigation
pattern while keeping the amount of instantiated items constant.
- SwipeDelegate:
* [QTBUG-54651] Added swipe.close() for setting swipe.position to 0.
* [QTBUG-54651] Added swipe.completed() for responding to completion of
swipes.
* [QTBUG-54651] Added attached SwipeDelegate.pressed property and
SwipeDelegate.clicked() signal for detecting when non-interactive
left/right/behind items are pressed and clicked.
* [QTBUG-56312][QTBUG-57285] Fixed spurious clicked() signal emission when
released outside the delegate.
* [QTBUG-57271] Fixed swipes that begin over a child item of a delegate.
- SwipeView:
* Added SwipeView.isNextItem and SwipeView.isPreviousItem attached
properties to make it straight-forward to use Loader for unloading
pages that are outside the reach.
* [QTBUG-54268] Added interactive property for controlling whether swipe
interaction is enabled.
- TextArea:
* [QTBUG-51009] Added pressed() and released() signals.
- TextField:
* [QTBUG-51009] Added pressed() and released() signals.
* Aligned the name of the pressAndHold() argument with TextArea
- ToolSeparator:
* [QTBUG-54862] Added ToolSeparator to visually distinguish between groups
of items in a toolbar by separating them with a line. It can be used in
horizontal or vertical toolbars.
- Tumbler:
* [QTBUG-53587] Added wrap property to control whether or not tumbler
wraps when it reaches the top and bottom.
****************************************************************************
* Styles *
****************************************************************************
- Added support for specifying the fallback style for custom styles via
:/qtquickcontrols2.conf, QT_QUICK_CONTROLS_FALLBACK_STYLE or
QQuickStyle::setFallbackStyle().
Material
--------
- [QTBUG-50003] Implemented ripple and hover effects.
- Fixed (optional) elevation effects for Frame, GroupBox, Pane, and
TabBar.
- Added Material.System theme enum value, that can be used to let the
Material style choose either the light or dark theme based on the
system theme colors.
Universal
---------
- [QTBUG-50003] Implemented hover effects
- Added Universal.System theme enum value, that can be used to let the
Universal style choose either the light or dark theme based on the
system theme colors.
****************************************************************************
* Platform *
****************************************************************************
- Introduced a new experimental Qt Labs Platform module that provides the
following native (Qt Widgets fallback when not available) QML types:
* ColorDialog
* FileDialog
* FolderDialog
* FontDialog
* Menu
* MenuBar
* MenuItem
* MenuItemGroup
* MenuSeparator
* MessageDialog
* StandardPaths
* SystemTrayIcon

View File

@ -0,0 +1,208 @@
Qt 5.9 introduces many new features and improvements as well as bugfixes
over the 5.8.x series. For more details, refer to the online documentation
included in this distribution. The documentation is also available online:
http://doc.qt.io/qt-5/index.html
The Qt version 5.9 series is binary compatible with the 5.8.x series.
Applications compiled for 5.8 will continue to run with 5.9.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* Important Behavior Changes *
****************************************************************************
- Added multi-touch support for buttons and sliders. It is now possible to
touch-interact with multiple sliders and buttons at the same time.
- By popular demand, Slider, RangeSlider, and Dial have been changed to
report live value updates by default. This can be disabled by setting the
"live" property to false.
- [QTBUG-59920] Sliders and Dials now react immediately when using a
mouse. Now the initial drag threshold applies only on touch, to avoid
conflicting with flickables.
- [QTBUG-58667] ScrollBar now reacts immediately when using a mouse.
- [QTBUG-59629] Set explicit cursors on all interactive controls.
****************************************************************************
* Controls *
****************************************************************************
- AbstractButton:
* Added support for multi-touch.
* [QTBUG-57203] Added a toggled() signal that is emitted whenever a
checkable button is interactively toggled by the user by using either
touch, mouse, or keys.
- ApplicationWindow:
* [QTBUG-58932] The "data" property has been renamed to contentData, as it
was documented. Notice that a "data" property still exists in QML
Window, but is no longer overshadowed in ApplicationWindow.
- Control:
* [QTBUG-50992] Resolved the "Object destroyed during incubation" issue
that occurred randomly when customizing built-in delegates.
- ComboBox:
* [QTBUG-53876] Added "editable" property.
* Added "down" property.
- DelayButton:
* Added DelayButton that incorporates a delay before the button becomes
activated, to prevent accidental triggers.
- Dial:
* Added a "live" property that determines whether the dial provides live
updates for the "value" property while the handle is dragged.
* Added support for wheel handling when wheelEnabled is set to true.
* [QTBUG-57203] Added a moved() signal that is emitted whenever the dial
is interactively moved by the user by using either touch, mouse, or
keys.
* Fixed handling of inverted wheel events (natural touchpad scrolling
direction on macOS).
- Drawer:
* [QTBUG-53169] Added "interactive" property that specifies whether the
drawer reacts to swipes. This can be used to make drawer a
non-closable persistent side-bar.
- Menu:
* Fixed populating Menus with a Repeater.
- Popup:
* Allowed passing a Window as a parent when creating dynamic Popup
instances using eg. Component.createObject(). Previously, Popup
assumed the parent to be an Item, and would complain "cannot find
any window to open popup in" if a Window was passed.
* [QTBUG-58196] Allowed dynamic window changes after construction.
* Fixed the CloseOnRelease close policy for non-modal popups.
- RangeSlider:
* Added a "live" property that determines whether the range slider
provides live updates for the first.value and second.value properties
while the respective handle is dragged.
- ScrollBar:
* [QTBUG-56569] Added snapMode property for incremental or discrete
scrolling.
* Added an "interactive "property. A non-interactive ScrollBar is visually
and behaviorally similar to ScrollIndicator. This property is useful
for switching between typical mouse- and touch-orientated UIs with
interactive and non- interactive scroll bars, respectively.
* Added a "policy" property, which holds whether the scroll bar is shown
always/never/as needed (default).
- ScrollView:
* Added ScrollView. On touch, ScrollView enables flicking and makes
the scroll bars non-interactive. When interacted with a mouse device,
flicking is disabled and the scroll bars are interactive.
- Slider:
* Added support for multi-touch.
* Added a "live" property that determines whether the slider provides live
updates for the "value" property while the handle is dragged.
* [QTBUG-57203] Added a moved() signal that is emitted whenever the
slider is interactively moved by the user by using either touch,
mouse, wheel, or keys.
* Fixed handling of inverted wheel events (natural touchpad scrolling
direction on macOS).
- SpinBox:
* [QTBUG-56837] Added inputMethodHints and inputMethodComposing
properties for controlling the input method when using editable spin
boxes.
* [QTBUG-57203] Added a valueModified() signal that is emitted whenever
the value of a spin box has been interactively modified by the user by
using either touch, mouse, wheel, or keys.
* [QTBUG-60356] Forwarded focus to the internal editor of an editable
spin box.
- StackView:
* [QTBUG-56801] Added attached "StackView.visible" property that can be
used to control whether items below the top- most item are kept
visible.
* [QTBUG-57266] Prevented pushing duplicate items.
* [QTBUG-59034] Fixed pop/replace exit transition leak, sometimes leading
to random crashes since a transition could have been left running in the
background at destruction time.
* [QTBUG-59098] Prevented StackView filtering mouse ungrab events to avoid
MouseAreas being stuck in the pressed state.
* [QTBUG-59634] Improved component creation errors by using the standard
QML warning system that gives a context/location for the error.
- SwipeDelegate:
* [QTBUG-57192] Added "swipe.enabled" property to allow disabling of
swiping.
* Added swipe.open(side) method that can be used to programmatically
open the side item on the specified side, which can be either
SwipeDelegate.Left or SwipeDelegate.Right.
* Added swipe.opened() and swipe.closed() signals, which are emitted
when the delegate has been opened or closed by swipe, and the
respective transition has finished.
* Added a swipe.transition property that holds the transition that is
applied when a swipe is released, or swipe.open() or swipe.close() is
called.
- SwipeView:
* [QTBUG-56031] Added "orientation" property.
- TabBar:
* [QTBUG-57858] Added contentWidth and contentHeight properties that are
automatically calculated based on the total size of the tab items, but
can be manually overridden if desired. This fixes an issue that TabBar
was not able to reliably calculate an implicit size, and could in
certain scenarios enter an infinite loop due to a circular dependency
between the items' sizes and the tabbar's size.
- TextArea:
* [QTBUG-55999] Fixed the horizontal alignment of the placeholder text
in right-to-left UIs.
* TextArea has been made to work inside ScrollView, providing necessary
scroll bars out of the box.
- TextField:
* [QTBUG-55999] Fixed the horizontal alignment of the placeholder text
in right-to-left UIs.
- Tumbler:
* Added a "moving" property that describes whether the tumbler is
currently moving, due to the user either dragging or flicking the
tumbler.
****************************************************************************
* Styles *
****************************************************************************
- Added support for a QT_QUICK_CONTROLS_STYLE_PATH environment variable,
which can be used to specify lookup paths for Qt Quick Controls 2
styles. This allows device manufacturers and Linux distributions to
specify a system-wide style installation folder that may be located
outside the Qt installation tree.
- Added support for a QT_QUICK_CONTROLS_STYLE_CONF environment variable,
which can be used to override the default location of the Qt Quick
2 Controls configuration file (:/qtquickcontrols2.conf).
- QQuickStyle:
* Added availableStyles() method that returns the list of available
built-in styles.
Default
--------
- Visualized RangeSliders's range.
Material
--------
- [QTBUG-58797] Fixed cursor visibility for read-only editors.
****************************************************************************
* Platform *
****************************************************************************
- Menu:
* Fixed sub-menu handling when using the Qt Widgets fallbacks on
platforms that do not support native menus (Windows, for example).

View File

@ -0,0 +1,75 @@
Qt 5.9.1 is a bug-fix release. It maintains both forward and backward
compatibility (source and binary) with Qt 5.9.0.
For more details, refer to the online documentation included in this
distribution. The documentation is also available online:
http://doc.qt.io/qt-5/index.html
The Qt version 5.9 series is binary compatible with the 5.8.x series.
Applications compiled for 5.8 will continue to run with 5.9.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* General *
****************************************************************************
- [QTBUG-58571] Enabled the use of QML caching at build time.
- [QTBUG-61144] Added a configure feature for disabling multi- touch
support (configure -no-feature-quicktemplates2-multitouch).
****************************************************************************
* Controls *
****************************************************************************
- ApplicationWindow:
* [QTBUG-60893] Fixed access to revisioned members in base classes.
- ComboBox:
* [QTBUG-60684] Fixed an empty popup being shown after model is cleared.
- Container:
* [QTBUG-61310] Fixed a crash that occurred with Repeater under certain
circumstances.
- Menu:
* Fixed key navigation to skip separators.
- Page:
* [QTBUG-61109] Fixed the initial content layouting of dynamically created
Page instances.
- Popup:
* [QTBUG-61114] Fixed font inheritance for popups.
- SpinBox:
* [QTBUG-61426] Fixed valueModified() to get emitted on repeated value
changes during long press.
- StackView:
* Fixed clear() to not emit depthChanged() when the view is empty.
****************************************************************************
* Styles *
****************************************************************************
- QQuickStyle:
* [QTBUG-60973] Fixed availableStyles() to exclude debug symbol folders
(.dSYM) on macOS.
Default
--------
- RangeSlider:
* Fixed the second handle to visualize its pressed state.
Material & Universal
--------------------
- ScrollBar:
* Fixed flashing when calling decrease() or increase() for key navigation.

View File

@ -0,0 +1,79 @@
Qt 5.9.2 is a bug-fix release. It maintains both forward and backward
compatibility (source and binary) with Qt 5.9.0.
For more details, refer to the online documentation included in this
distribution. The documentation is also available online:
http://doc.qt.io/qt-5/index.html
The Qt version 5.9 series is binary compatible with the 5.8.x series.
Applications compiled for 5.8 will continue to run with 5.9.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* Controls *
****************************************************************************
- BusyIndicator:
* [QTBUG-61785] Fixed busy indicators to not block touch events.
- Control:
* [QTBUG-63119] Fixed font inheritance in item views.
- Drawer:
* [QTBUG-61581] Fixed multi-touch leaking through modal overlay.
* [QTBUG-59652] Fixed non-modal drawer drag/swipe open and close.
- Menu:
* [QTBUG-61608] Fixed press-and-hold support by removing OnReleaseOutside
from the default close policy, to avoid closing on release when opened
from an onPressAndHold signal handler.
- Popup:
* [QTBUG-61698] Fixed multi-touch leaking through modal overlay
* Fixed focus handling for chained popups. When a popup is closed, focus
is now restored to the next popup in chain instead of transferring focus
to the window content.
* [QTBUG-62158] Fixed popups to take Window::contentOrientation into
account.
- PageIndicator:
* Fixed interactive page indicators to work on touch.
* [QTBUG-61785] Fixed non-interactive page indicators to not block touch
events.
- ScrollIndicator:
* [QTBUG-61785] Fixed scroll indicators to not block touch events.
- SpinBox:
* [QTBUG-61426] Fixed to emit valueModified() on long press.
* [QTBUG-62508] Fixed initial value validation.
- StackView:
* [QTBUG-62153] Fixed a crash that would occur when pushing new items
from a StackView.onRemoved signal handler.
* Fixed resolving of the initialItem URL.
- TextArea:
- TextField:
* [QTBUG-62854] Improved the Default style.
- ToolTip:
* [QTBUG-60492] Fixed tooltips to not block shortcuts.
- Tumbler:
* [QTBUG-61374] Fixed a regression with currentIndex and currentItem.
****************************************************************************
* Calendar *
****************************************************************************
- MonthGrid:
* [QTBUG-61585] Fixed the clicked() signal to be emitted on touch.

View File

@ -0,0 +1,52 @@
Qt 5.9.3 is a bug-fix release. It maintains both forward and backward
compatibility (source and binary) with Qt 5.9.0.
For more details, refer to the online documentation included in this
distribution. The documentation is also available online:
http://doc.qt.io/qt-5/index.html
The Qt version 5.9 series is binary compatible with the 5.8.x series.
Applications compiled for 5.8 will continue to run with 5.9.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* Qt 5.9.3 Changes *
****************************************************************************
- ButtonGroup:
* [QTBUG-62946][QTBUG-63470] Fixed an issue in tracking of the currently
checked button that caused a crash under certain circumstances.
- DialogButtonBox:
* [QTBUG-63898] Fixed a potential crash when using DialogButtonBox without
a contentItem.
- Popup:
* [QTBUG-63672] Fixed a dangling QML context that was causing random
crashes in the QML engine debug service.
- ScrollView:
* [QTBUG-62325] Fixed a binding loop when using a wrapping TextArea as
content.
- StackView:
* Fixed a resource leak that occurred when the creation of the initial
item failed.
- TextArea & TextField:
* [QTBUG-62854] Improved the Default style.
- Removed top-level opacity assignments to allow full customization.
- Added more distinction between disabled and placeholder text.
- Made disabled text more visible.
- ToolTip:
* [QTBUG-63644] Disabled hover to avoid tooltips blocking hover events,
which are typically used for showing tooltips on desktop platforms.

View File

@ -0,0 +1,63 @@
Qt 5.9.4 is a bug-fix release. It maintains both forward and backward
compatibility (source and binary) with Qt 5.9.0.
For more details, refer to the online documentation included in this
distribution. The documentation is also available online:
http://doc.qt.io/qt-5/index.html
The Qt version 5.9 series is binary compatible with the 5.8.x series.
Applications compiled for 5.8 will continue to run with 5.9.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* Important Behavior Changes *
****************************************************************************
- As a fix to QTBUG-50992, execution of delegates, such as contentItem and
background, is deferred until the construction of a control is complete,
or a delegate is accessed. Consequently, if a delegate is replaced with
a custom delegate, the default delegate is not created. Previously, when
a default delegate was replaced by a custom delegate, the default
delegate was nevertheless created and destroyed during the construction
of the control.
****************************************************************************
* Controls *
****************************************************************************
- [QTBUG-64548] Fixed shortcuts in QQuickWidget
- [QTBUG-65016] Fixed QQuickStyle::setFallbackStyle() in static builds
- [QTBUG-50992] Fixed a bug which caused delegates of customized controls
to often be "destroyed during incubation" when asynchronously incubated
by item views or asynchronous loaders.
- BusyIndicator:
* [QTBUG-62874] Fixed busy animation in QQuickWidget
- ProgressBar:
* [QTBUG-62874] Fixed indeterminate animation in QQuickWidget
- StackView:
* [QTBUG-65084] Fixed to not block touch events.
- SwipeView:
* [QTBUG-62110] Fixed slow swiping in large views
- ToolButton:
* [QTBUG-65052] Fixed round ripple for square buttons in the Material style
- Tumbler:
* [QTBUG-65165] Made currentIndex animations take a constant amount of
time (1 second) regardless of how many items are in the model. This
prevents Tumblers with large amounts of items from scrolling too
slowly when changing the currentIndex.

View File

@ -0,0 +1,56 @@
Qt 5.9.5 is a bug-fix release. It maintains both forward and backward
compatibility (source and binary) with Qt 5.9.0.
For more details, refer to the online documentation included in this
distribution. The documentation is also available online:
http://doc.qt.io/qt-5/index.html
The Qt version 5.9 series is binary compatible with the 5.8.x series.
Applications compiled for 5.8 will continue to run with 5.9.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* Qt 5.9.5 Changes *
****************************************************************************
Controls
--------
- Control:
* [QTBUG-65880] Fixed a bug in deferred execution, that caused the
background item to not follow the size of the control under certain
circumstances, leading to a visually missing background.
* [QTBUG-66133] Fixed focus scope controls, such as Frame, GroupBox,
Page, and Pane, to respect click and wheel focus policies by clearing
a potential sub-focus child. This makes it possible to close the virtual
keyboard by clicking the background of a Pane that has Qt.ClickFocus
set as its focusPolicy, for example.
- ComboBox:
* [QTBUG-65962] Fixed a bug in deferred execution, that caused the popup's
bindings to not get finalized under certain circumstances, leading to
a visually missing popup.
- Popup:
* [QTBUG-66113] Fixed restoring focus to popups that did not request
focus when opened, but gained focus later.
Platform
--------
- Menu:
* [QTBUG-55251] Fixed opening position on high-DPI screens.
Third-Party Code
----------------
- [QTBUG-65409] Document constants from AngularJS in
src/imports/controls/material/ElevationEffect.qml

View File

@ -0,0 +1,39 @@
Qt 5.9.6 is a bug-fix release. It maintains both forward and backward
compatibility (source and binary) with Qt 5.9.0 through 5.9.5.
For more details, refer to the online documentation included in this
distribution. The documentation is also available online:
http://doc.qt.io/qt-5/index.html
The Qt version 5.9 series is binary compatible with the 5.8.x series.
Applications compiled for 5.8 will continue to run with 5.9.
Some of the changes listed in this file include issue tracking numbers
corresponding to tasks in the Qt Bug Tracker:
https://bugreports.qt.io/
Each of these identifiers can be entered in the bug tracker to obtain more
information about a particular change.
****************************************************************************
* Qt 5.9.6 Changes *
****************************************************************************
Controls
--------
- Label:
* [QTBUG-65880] Fixed a background size regression caused by deferred
execution.
- TextArea:
* [QTBUG-67334] Fixed the background to not scroll when TextArea is
placed in a ScrollView.
* [QTBUG-65880] Fixed a background size regression caused by deferred
execution.
- TextField:
* [QTBUG-65880] Fixed a background size regression caused by deferred
execution.

View File

@ -0,0 +1,17 @@
Qt 6.0.0 is a new major version release of Qt. It is not binary compatible with
earlier Qt releases.
The goal has been to retain as much source compatibility with Qt 5.15 as
possible, but some changes were inevitable to make Qt a better framework.
To make it easier to port to Qt 6.0, we have created a porting guide to
summarize those changes and provide guidance to handle them. In the guide, you
can find links to articles about changes that may affect your application and
help you transition from Qt 5.15 to Qt 6.0:
https://doc.qt.io/qt-6/portingguide.html
For more details refer to the online documentation of Qt 6.0:
https://doc.qt.io/qt-6/index.html

View File

@ -9,5 +9,6 @@ endif()
if(TARGET Qt::Quick)
add_subdirectory(quick)
endif()
add_subdirectory(quickcontrols2)
qt_examples_build_end()

View File

@ -1,3 +1,5 @@
find_package(Qt6 COMPONENTS Sql) # special case
qt_examples_build_begin(EXTERNAL_BUILD)
add_subdirectory(qml)
@ -7,5 +9,8 @@ endif()
if(TARGET Qt::Quick)
add_subdirectory(quick)
endif()
if(TARGET Qt::QuickTemplates2)
add_subdirectory(quickcontrols2)
endif()
qt_examples_build_end()

View File

@ -1,4 +1,5 @@
TEMPLATE = subdirs
qtHaveModule(qmltest): SUBDIRS += qmltest
SUBDIRS += qml
qtHaveModule(quick): SUBDIRS += quick
qtHaveModule(quick): SUBDIRS += quick quickcontrols2

View File

@ -0,0 +1,14 @@
# Generated from quickcontrols2.pro.
add_subdirectory(gallery)
add_subdirectory(chattutorial)
add_subdirectory(texteditor)
add_subdirectory(contactlist)
add_subdirectory(sidepanel)
add_subdirectory(swipetoremove)
add_subdirectory(wearable)
add_subdirectory(imagine/automotive)
add_subdirectory(imagine/musicplayer)
if(TARGET Qt::Widgets)
add_subdirectory(flatstyle)
endif()

View File

@ -0,0 +1,7 @@
# Generated from chattutorial.pro.
add_subdirectory(chapter1-settingup)
add_subdirectory(chapter2-lists)
add_subdirectory(chapter3-navigation)
add_subdirectory(chapter4-models)
add_subdirectory(chapter5-styling)

View File

@ -0,0 +1,54 @@
# Generated from chapter1-settingup.pro.
cmake_minimum_required(VERSION 3.14)
project(chapter1-settingup LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/chattutorial/chapter1-settingup")
find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Qml)
find_package(Qt6 COMPONENTS Quick)
qt_add_executable(chapter1-settingup
main.cpp
)
set_target_properties(chapter1-settingup PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
target_link_libraries(chapter1-settingup PUBLIC
Qt::Core
Qt::Gui
Qt::Qml
Qt::Quick
)
# Resources:
set(qml_resource_files
"main.qml"
)
qt6_add_resources(chapter1-settingup "qml"
PREFIX
"/"
FILES
${qml_resource_files}
)
install(TARGETS chapter1-settingup
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)

View File

@ -0,0 +1,11 @@
TEMPLATE = app
QT += qml quick
CONFIG += c++11
SOURCES += main.cpp
RESOURCES += qml.qrc
target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/chattutorial/chapter1-settingup
INSTALLS += target

View File

@ -0,0 +1,63 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * 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.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** 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."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QGuiApplication>
#include <QQmlApplicationEngine>
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
return app.exec();
}

View File

@ -0,0 +1,70 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * 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.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** 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."
**
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick
import QtQuick.Controls
ApplicationWindow {
width: 540
height: 960
visible: true
Page {
anchors.fill: parent
header: Label {
padding: 10
text: qsTr("Contacts")
font.pixelSize: 20
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
}
}

View File

@ -0,0 +1,6 @@
<RCC>
<qresource prefix="/">
<file>main.qml</file>
</qresource>
</RCC>

View File

@ -0,0 +1,77 @@
# Generated from chapter2-lists.pro.
cmake_minimum_required(VERSION 3.14)
project(chapter2-lists LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/chattutorial/chapter2-lists")
find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Qml)
find_package(Qt6 COMPONENTS Quick)
qt_add_executable(chapter2-lists
main.cpp
)
set_target_properties(chapter2-lists PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
target_link_libraries(chapter2-lists PUBLIC
Qt::Core
Qt::Gui
Qt::Qml
Qt::Quick
)
# Resources:
set(qml_resource_files
"main.qml"
)
qt6_add_resources(chapter2-lists "qml"
PREFIX
"/"
FILES
${qml_resource_files}
)
set(shared_resource_files
"../shared/Albert_Einstein.png"
"../shared/Albert_Einstein@2x.png"
"../shared/Albert_Einstein@3x.png"
"../shared/Albert_Einstein@4x.png"
"../shared/Ernest_Hemingway.png"
"../shared/Ernest_Hemingway@2x.png"
"../shared/Ernest_Hemingway@3x.png"
"../shared/Ernest_Hemingway@4x.png"
"../shared/Hans_Gude.png"
"../shared/Hans_Gude@2x.png"
"../shared/Hans_Gude@3x.png"
"../shared/Hans_Gude@4x.png"
)
qt6_add_resources(chapter2-lists "shared"
PREFIX
"/"
BASE
"../shared"
FILES
${shared_resource_files}
)
install(TARGETS chapter2-lists
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)

View File

@ -0,0 +1,12 @@
TEMPLATE = app
QT += qml quick
CONFIG += c++11
SOURCES += main.cpp
RESOURCES += qml.qrc \
../shared/shared.qrc
target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/chattutorial/chapter2-lists
INSTALLS += target

View File

@ -0,0 +1,63 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * 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.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** 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."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QGuiApplication>
#include <QQmlApplicationEngine>
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
return app.exec();
}

View File

@ -0,0 +1,92 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * 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.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** 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."
**
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick
import QtQuick.Controls
ApplicationWindow {
width: 540
height: 960
visible: true
Page {
anchors.fill: parent
header: Label {
padding: 10
text: qsTr("Contacts")
font.pixelSize: 20
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
ListView {
id: listView
anchors.fill: parent
topMargin: 48
leftMargin: 48
bottomMargin: 48
rightMargin: 48
spacing: 20
model: ["Albert Einstein", "Ernest Hemingway", "Hans Gude"]
delegate: ItemDelegate {
text: modelData
width: listView.width - listView.leftMargin - listView.rightMargin
height: avatar.implicitHeight
leftPadding: avatar.implicitWidth + 32
Image {
id: avatar
source: "qrc:/" + modelData.replace(" ", "_") + ".png"
}
}
}
}
}

View File

@ -0,0 +1,6 @@
<RCC>
<qresource prefix="/">
<file>main.qml</file>
</qresource>
</RCC>

View File

@ -0,0 +1,79 @@
# Generated from chapter3-navigation.pro.
cmake_minimum_required(VERSION 3.14)
project(chapter3-navigation LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/chattutorial/chapter3-navigation")
find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Qml)
find_package(Qt6 COMPONENTS Quick)
qt_add_executable(chapter3-navigation
main.cpp
)
set_target_properties(chapter3-navigation PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
target_link_libraries(chapter3-navigation PUBLIC
Qt::Core
Qt::Gui
Qt::Qml
Qt::Quick
)
# Resources:
set(qml_resource_files
"ContactPage.qml"
"ConversationPage.qml"
"main.qml"
)
qt6_add_resources(chapter3-navigation "qml"
PREFIX
"/"
FILES
${qml_resource_files}
)
set(shared_resource_files
"../shared/Albert_Einstein.png"
"../shared/Albert_Einstein@2x.png"
"../shared/Albert_Einstein@3x.png"
"../shared/Albert_Einstein@4x.png"
"../shared/Ernest_Hemingway.png"
"../shared/Ernest_Hemingway@2x.png"
"../shared/Ernest_Hemingway@3x.png"
"../shared/Ernest_Hemingway@4x.png"
"../shared/Hans_Gude.png"
"../shared/Hans_Gude@2x.png"
"../shared/Hans_Gude@3x.png"
"../shared/Hans_Gude@4x.png"
)
qt6_add_resources(chapter3-navigation "shared"
PREFIX
"/"
BASE
"../shared"
FILES
${shared_resource_files}
)
install(TARGETS chapter3-navigation
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)

View File

@ -0,0 +1,88 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * 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.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** 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."
**
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick
import QtQuick.Controls
Page {
id: root
header: ToolBar {
Label {
text: qsTr("Contacts")
font.pixelSize: 20
anchors.centerIn: parent
}
}
ListView {
id: listView
anchors.fill: parent
topMargin: 48
leftMargin: 48
bottomMargin: 48
rightMargin: 48
spacing: 20
model: ["Albert Einstein", "Ernest Hemingway", "Hans Gude"]
delegate: ItemDelegate {
text: modelData
width: listView.width - listView.leftMargin - listView.rightMargin
height: avatar.implicitHeight
leftPadding: avatar.implicitWidth + 32
onClicked: root.StackView.view.push("qrc:/ConversationPage.qml", { inConversationWith: modelData })
Image {
id: avatar
source: "qrc:/" + modelData.replace(" ", "_") + ".png"
}
}
}
}

View File

@ -0,0 +1,143 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * 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.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** 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."
**
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
Page {
id: root
property string inConversationWith
header: ToolBar {
ToolButton {
text: qsTr("Back")
anchors.left: parent.left
anchors.leftMargin: 10
anchors.verticalCenter: parent.verticalCenter
onClicked: root.StackView.view.pop()
}
Label {
id: pageTitle
text: inConversationWith
font.pixelSize: 20
anchors.centerIn: parent
}
}
ColumnLayout {
anchors.fill: parent
ListView {
id: listView
Layout.fillWidth: true
Layout.fillHeight: true
Layout.margins: pane.leftPadding + messageField.leftPadding
displayMarginBeginning: 40
displayMarginEnd: 40
verticalLayoutDirection: ListView.BottomToTop
spacing: 12
model: 10
delegate: Row {
readonly property bool sentByMe: index % 2 == 0
anchors.right: sentByMe ? listView.contentItem.right : undefined
spacing: 6
Rectangle {
id: avatar
width: height
height: parent.height
color: "grey"
visible: !sentByMe
}
Rectangle {
width: 80
height: 40
color: sentByMe ? "lightgrey" : "steelblue"
Label {
anchors.centerIn: parent
text: index
color: sentByMe ? "black" : "white"
}
}
}
ScrollBar.vertical: ScrollBar {}
}
Pane {
id: pane
Layout.fillWidth: true
RowLayout {
width: parent.width
TextArea {
id: messageField
Layout.fillWidth: true
placeholderText: qsTr("Compose message")
wrapMode: TextArea.Wrap
}
Button {
id: sendButton
text: qsTr("Send")
enabled: messageField.length > 0
}
}
}
}
}

View File

@ -0,0 +1,12 @@
TEMPLATE = app
QT += qml quick
CONFIG += c++11
SOURCES += main.cpp
RESOURCES += qml.qrc \
../shared/shared.qrc
target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/chattutorial/chapter3-navigation
INSTALLS += target

View File

@ -0,0 +1,63 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * 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.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** 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."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QGuiApplication>
#include <QQmlApplicationEngine>
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
return app.exec();
}

View File

@ -0,0 +1,66 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * 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.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** 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."
**
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick
import QtQuick.Controls
ApplicationWindow {
id: window
width: 540
height: 960
visible: true
StackView {
id: stackView
anchors.fill: parent
initialItem: ContactPage {}
}
}

View File

@ -0,0 +1,7 @@
<RCC>
<qresource prefix="/">
<file>main.qml</file>
<file>ContactPage.qml</file>
<file>ConversationPage.qml</file>
</qresource>
</RCC>

View File

@ -0,0 +1,83 @@
# Generated from chapter4-models.pro.
cmake_minimum_required(VERSION 3.14)
project(chapter4-models LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/chattutorial/chapter4-models")
find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Qml)
find_package(Qt6 COMPONENTS Quick)
find_package(Qt6 COMPONENTS Sql)
qt_add_executable(chapter4-models
main.cpp
sqlcontactmodel.cpp sqlcontactmodel.h
sqlconversationmodel.cpp sqlconversationmodel.h
)
set_target_properties(chapter4-models PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
target_link_libraries(chapter4-models PUBLIC
Qt::Core
Qt::Gui
Qt::Qml
Qt::Quick
Qt::Sql
)
# Resources:
set(qml_resource_files
"ContactPage.qml"
"ConversationPage.qml"
"main.qml"
)
qt6_add_resources(chapter4-models "qml"
PREFIX
"/"
FILES
${qml_resource_files}
)
set(shared_resource_files
"../shared/Albert_Einstein.png"
"../shared/Albert_Einstein@2x.png"
"../shared/Albert_Einstein@3x.png"
"../shared/Albert_Einstein@4x.png"
"../shared/Ernest_Hemingway.png"
"../shared/Ernest_Hemingway@2x.png"
"../shared/Ernest_Hemingway@3x.png"
"../shared/Ernest_Hemingway@4x.png"
"../shared/Hans_Gude.png"
"../shared/Hans_Gude@2x.png"
"../shared/Hans_Gude@3x.png"
"../shared/Hans_Gude@4x.png"
)
qt6_add_resources(chapter4-models "shared"
PREFIX
"/"
BASE
"../shared"
FILES
${shared_resource_files}
)
install(TARGETS chapter4-models
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)

View File

@ -0,0 +1,90 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * 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.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** 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."
**
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick
import QtQuick.Controls
import io.qt.examples.chattutorial
Page {
id: root
header: ToolBar {
Label {
text: qsTr("Contacts")
font.pixelSize: 20
anchors.centerIn: parent
}
}
ListView {
id: listView
anchors.fill: parent
topMargin: 48
leftMargin: 48
bottomMargin: 48
rightMargin: 48
spacing: 20
model: SqlContactModel {}
delegate: ItemDelegate {
text: model.display
width: listView.width - listView.leftMargin - listView.rightMargin
height: avatar.implicitHeight
leftPadding: avatar.implicitWidth + 32
onClicked: root.StackView.view.push("qrc:/ConversationPage.qml", { inConversationWith: model.display })
Image {
id: avatar
source: "qrc:/" + model.display.replace(" ", "_") + ".png"
}
}
}
}

View File

@ -0,0 +1,165 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * 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.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** 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."
**
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import io.qt.examples.chattutorial
Page {
id: root
property string inConversationWith
header: ToolBar {
ToolButton {
text: qsTr("Back")
anchors.left: parent.left
anchors.leftMargin: 10
anchors.verticalCenter: parent.verticalCenter
onClicked: root.StackView.view.pop()
}
Label {
id: pageTitle
text: inConversationWith
font.pixelSize: 20
anchors.centerIn: parent
}
}
ColumnLayout {
anchors.fill: parent
ListView {
id: listView
Layout.fillWidth: true
Layout.fillHeight: true
Layout.margins: pane.leftPadding + messageField.leftPadding
displayMarginBeginning: 40
displayMarginEnd: 40
verticalLayoutDirection: ListView.BottomToTop
spacing: 12
model: SqlConversationModel {
recipient: inConversationWith
}
delegate: Column {
anchors.right: sentByMe ? listView.contentItem.right : undefined
spacing: 6
readonly property bool sentByMe: model.recipient !== "Me"
Row {
id: messageRow
spacing: 6
anchors.right: sentByMe ? parent.right : undefined
Image {
id: avatar
source: !sentByMe ? "qrc:/" + model.author.replace(" ", "_") + ".png" : ""
}
Rectangle {
width: Math.min(messageText.implicitWidth + 24,
listView.width - (!sentByMe ? avatar.width + messageRow.spacing : 0))
height: messageText.implicitHeight + 24
color: sentByMe ? "lightgrey" : "steelblue"
Label {
id: messageText
text: model.message
color: sentByMe ? "black" : "white"
anchors.fill: parent
anchors.margins: 12
wrapMode: Label.Wrap
}
}
}
Label {
id: timestampText
text: Qt.formatDateTime(model.timestamp, "d MMM hh:mm")
color: "lightgrey"
anchors.right: sentByMe ? parent.right : undefined
}
}
ScrollBar.vertical: ScrollBar {}
}
Pane {
id: pane
Layout.fillWidth: true
RowLayout {
width: parent.width
TextArea {
id: messageField
Layout.fillWidth: true
placeholderText: qsTr("Compose message")
wrapMode: TextArea.Wrap
}
Button {
id: sendButton
text: qsTr("Send")
enabled: messageField.length > 0
onClicked: {
listView.model.sendMessage(inConversationWith, messageField.text);
messageField.text = "";
}
}
}
}
}
}

View File

@ -0,0 +1,18 @@
TEMPLATE = app
QT += qml quick sql
CONFIG += c++11
HEADERS += sqlcontactmodel.h \
sqlconversationmodel.h
SOURCES += main.cpp \
sqlcontactmodel.cpp \
sqlconversationmodel.cpp
RESOURCES += \
qml.qrc \
../shared/shared.qrc
target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/chattutorial/chapter4-models
INSTALLS += target

View File

@ -0,0 +1,99 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * 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.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** 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."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtCore>
#include <QGuiApplication>
#include <QSqlDatabase>
#include <QSqlError>
#include <QtQml>
#include "sqlcontactmodel.h"
#include "sqlconversationmodel.h"
static void connectToDatabase()
{
QSqlDatabase database = QSqlDatabase::database();
if (!database.isValid()) {
database = QSqlDatabase::addDatabase("QSQLITE");
if (!database.isValid())
qFatal("Cannot add database: %s", qPrintable(database.lastError().text()));
}
const QDir writeDir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
if (!writeDir.mkpath("."))
qFatal("Failed to create writable directory at %s", qPrintable(writeDir.absolutePath()));
// Ensure that we have a writable location on all devices.
const QString fileName = writeDir.absolutePath() + "/chat-database.sqlite3";
// When using the SQLite driver, open() will create the SQLite database if it doesn't exist.
database.setDatabaseName(fileName);
if (!database.open()) {
qFatal("Cannot open database: %s", qPrintable(database.lastError().text()));
QFile::remove(fileName);
}
}
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
qmlRegisterType<SqlContactModel>("io.qt.examples.chattutorial", 1, 0, "SqlContactModel");
qmlRegisterType<SqlConversationModel>("io.qt.examples.chattutorial", 1, 0, "SqlConversationModel");
connectToDatabase();
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
if (engine.rootObjects().isEmpty())
return -1;
return app.exec();
}

View File

@ -0,0 +1,66 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * 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.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** 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."
**
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick
import QtQuick.Controls
ApplicationWindow {
id: window
width: 540
height: 960
visible: true
StackView {
id: stackView
anchors.fill: parent
initialItem: ContactPage {}
}
}

View File

@ -0,0 +1,7 @@
<RCC>
<qresource prefix="/">
<file>main.qml</file>
<file>ContactPage.qml</file>
<file>ConversationPage.qml</file>
</qresource>
</RCC>

View File

@ -0,0 +1,90 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * 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.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** 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."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "sqlcontactmodel.h"
#include <QDebug>
#include <QSqlError>
#include <QSqlQuery>
static void createTable()
{
if (QSqlDatabase::database().tables().contains(QStringLiteral("Contacts"))) {
// The table already exists; we don't need to do anything.
return;
}
QSqlQuery query;
if (!query.exec(
"CREATE TABLE IF NOT EXISTS 'Contacts' ("
" 'name' TEXT NOT NULL,"
" PRIMARY KEY(name)"
")")) {
qFatal("Failed to query database: %s", qPrintable(query.lastError().text()));
}
query.exec("INSERT INTO Contacts VALUES('Albert Einstein')");
query.exec("INSERT INTO Contacts VALUES('Ernest Hemingway')");
query.exec("INSERT INTO Contacts VALUES('Hans Gude')");
}
SqlContactModel::SqlContactModel(QObject *parent) :
QSqlQueryModel(parent)
{
createTable();
QSqlQuery query;
if (!query.exec("SELECT * FROM Contacts"))
qFatal("Contacts SELECT query failed: %s", qPrintable(query.lastError().text()));
setQuery(query);
if (lastError().isValid())
qFatal("Cannot set query on SqlContactModel: %s", qPrintable(lastError().text()));
}

View File

@ -0,0 +1,62 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * 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.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** 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."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef SQLCONTACTMODEL_H
#define SQLCONTACTMODEL_H
#include <QSqlQueryModel>
class SqlContactModel : public QSqlQueryModel
{
public:
SqlContactModel(QObject *parent = 0);
};
#endif // SQLCONTACTMODEL_H

View File

@ -0,0 +1,154 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * 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.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** 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."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "sqlconversationmodel.h"
#include <QDateTime>
#include <QDebug>
#include <QSqlError>
#include <QSqlRecord>
#include <QSqlQuery>
static const char *conversationsTableName = "Conversations";
static void createTable()
{
if (QSqlDatabase::database().tables().contains(conversationsTableName)) {
// The table already exists; we don't need to do anything.
return;
}
QSqlQuery query;
if (!query.exec(
"CREATE TABLE IF NOT EXISTS 'Conversations' ("
"'author' TEXT NOT NULL,"
"'recipient' TEXT NOT NULL,"
"'timestamp' TEXT NOT NULL,"
"'message' TEXT NOT NULL,"
"FOREIGN KEY('author') REFERENCES Contacts ( name ),"
"FOREIGN KEY('recipient') REFERENCES Contacts ( name )"
")")) {
qFatal("Failed to query database: %s", qPrintable(query.lastError().text()));
}
query.exec("INSERT INTO Conversations VALUES('Me', 'Ernest Hemingway', '2016-01-07T14:36:06', 'Hello!')");
query.exec("INSERT INTO Conversations VALUES('Ernest Hemingway', 'Me', '2016-01-07T14:36:16', 'Good afternoon.')");
query.exec("INSERT INTO Conversations VALUES('Me', 'Albert Einstein', '2016-01-01T11:24:53', 'Hi!')");
query.exec("INSERT INTO Conversations VALUES('Albert Einstein', 'Me', '2016-01-07T14:36:16', 'Good morning.')");
query.exec("INSERT INTO Conversations VALUES('Hans Gude', 'Me', '2015-11-20T06:30:02', 'God morgen. Har du fått mitt maleri?')");
query.exec("INSERT INTO Conversations VALUES('Me', 'Hans Gude', '2015-11-20T08:21:03', 'God morgen, Hans. Ja, det er veldig fint. Tusen takk! "
"Hvor mange timer har du brukt på den?')");
}
SqlConversationModel::SqlConversationModel(QObject *parent) :
QSqlTableModel(parent)
{
createTable();
setTable(conversationsTableName);
setSort(2, Qt::DescendingOrder);
// Ensures that the model is sorted correctly after submitting a new row.
setEditStrategy(QSqlTableModel::OnManualSubmit);
}
QString SqlConversationModel::recipient() const
{
return m_recipient;
}
void SqlConversationModel::setRecipient(const QString &recipient)
{
if (recipient == m_recipient)
return;
m_recipient = recipient;
const QString filterString = QString::fromLatin1(
"(recipient = '%1' AND author = 'Me') OR (recipient = 'Me' AND author='%1')").arg(m_recipient);
setFilter(filterString);
select();
emit recipientChanged();
}
QVariant SqlConversationModel::data(const QModelIndex &index, int role) const
{
if (role < Qt::UserRole)
return QSqlTableModel::data(index, role);
const QSqlRecord sqlRecord = record(index.row());
return sqlRecord.value(role - Qt::UserRole);
}
QHash<int, QByteArray> SqlConversationModel::roleNames() const
{
QHash<int, QByteArray> names;
names[Qt::UserRole] = "author";
names[Qt::UserRole + 1] = "recipient";
names[Qt::UserRole + 2] = "timestamp";
names[Qt::UserRole + 3] = "message";
return names;
}
void SqlConversationModel::sendMessage(const QString &recipient, const QString &message)
{
const QString timestamp = QDateTime::currentDateTime().toString(Qt::ISODate);
QSqlRecord newRecord = record();
newRecord.setValue("author", "Me");
newRecord.setValue("recipient", recipient);
newRecord.setValue("timestamp", timestamp);
newRecord.setValue("message", message);
if (!insertRecord(rowCount(), newRecord)) {
qWarning() << "Failed to send message:" << lastError().text();
return;
}
submitAll();
}

View File

@ -0,0 +1,79 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * 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.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** 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."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef SQLCONVERSATIONMODEL_H
#define SQLCONVERSATIONMODEL_H
#include <QSqlTableModel>
class SqlConversationModel : public QSqlTableModel
{
Q_OBJECT
Q_PROPERTY(QString recipient READ recipient WRITE setRecipient NOTIFY recipientChanged)
public:
SqlConversationModel(QObject *parent = 0);
QString recipient() const;
void setRecipient(const QString &recipient);
QVariant data(const QModelIndex &index, int role) const override;
QHash<int, QByteArray> roleNames() const override;
Q_INVOKABLE void sendMessage(const QString &recipient, const QString &message);
signals:
void recipientChanged();
private:
QString m_recipient;
};
#endif // SQLCONVERSATIONMODEL_H

View File

@ -0,0 +1,56 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * 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.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** 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."
**
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick.Controls
import QtQuick.Controls.Material
ToolBar {
Material.theme: Material.Dark
}

View File

@ -0,0 +1,86 @@
# Generated from chapter5-styling.pro.
cmake_minimum_required(VERSION 3.14)
project(chapter5-styling LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/chattutorial/chapter5-styling")
find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Qml)
find_package(Qt6 COMPONENTS Quick)
find_package(Qt6 COMPONENTS Sql)
qt_add_executable(chapter5-styling
main.cpp
sqlcontactmodel.cpp sqlcontactmodel.h
sqlconversationmodel.cpp sqlconversationmodel.h
)
set_target_properties(chapter5-styling PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
target_link_libraries(chapter5-styling PUBLIC
Qt::Core
Qt::Gui
Qt::Qml
Qt::Quick
Qt::Sql
)
# Resources:
set(qml_resource_files
"+Material/ChatToolBar.qml"
"ChatToolBar.qml"
"ContactPage.qml"
"ConversationPage.qml"
"main.qml"
"qtquickcontrols2.conf"
)
qt6_add_resources(chapter5-styling "qml"
PREFIX
"/"
FILES
${qml_resource_files}
)
set(shared_resource_files
"../shared/Albert_Einstein.png"
"../shared/Albert_Einstein@2x.png"
"../shared/Albert_Einstein@3x.png"
"../shared/Albert_Einstein@4x.png"
"../shared/Ernest_Hemingway.png"
"../shared/Ernest_Hemingway@2x.png"
"../shared/Ernest_Hemingway@3x.png"
"../shared/Ernest_Hemingway@4x.png"
"../shared/Hans_Gude.png"
"../shared/Hans_Gude@2x.png"
"../shared/Hans_Gude@3x.png"
"../shared/Hans_Gude@4x.png"
)
qt6_add_resources(chapter5-styling "shared"
PREFIX
"/"
BASE
"../shared"
FILES
${shared_resource_files}
)
install(TARGETS chapter5-styling
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)

View File

@ -0,0 +1,54 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * 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.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** 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."
**
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick.Controls
ToolBar {
}

View File

@ -0,0 +1,90 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * 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.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** 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."
**
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick
import QtQuick.Controls
import io.qt.examples.chattutorial
Page {
id: root
header: ChatToolBar {
Label {
text: qsTr("Contacts")
font.pixelSize: 20
anchors.centerIn: parent
}
}
ListView {
id: listView
anchors.fill: parent
topMargin: 48
leftMargin: 48
bottomMargin: 48
rightMargin: 48
spacing: 20
model: SqlContactModel {}
delegate: ItemDelegate {
text: model.display
width: listView.width - listView.leftMargin - listView.rightMargin
height: avatar.implicitHeight
leftPadding: avatar.implicitWidth + 32
onClicked: root.StackView.view.push("qrc:/ConversationPage.qml", { inConversationWith: model.display })
Image {
id: avatar
source: "qrc:/" + model.display.replace(" ", "_") + ".png"
}
}
}
}

View File

@ -0,0 +1,164 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * 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.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** 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."
**
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick
import QtQuick.Layouts
import QtQuick.Controls
import io.qt.examples.chattutorial
Page {
id: root
property string inConversationWith
header: ChatToolBar {
ToolButton {
text: qsTr("Back")
anchors.left: parent.left
anchors.leftMargin: 10
anchors.verticalCenter: parent.verticalCenter
onClicked: root.StackView.view.pop()
}
Label {
id: pageTitle
text: inConversationWith
font.pixelSize: 20
anchors.centerIn: parent
}
}
ColumnLayout {
anchors.fill: parent
ListView {
id: listView
Layout.fillWidth: true
Layout.fillHeight: true
Layout.margins: pane.leftPadding + messageField.leftPadding
displayMarginBeginning: 40
displayMarginEnd: 40
verticalLayoutDirection: ListView.BottomToTop
spacing: 12
model: SqlConversationModel {
recipient: inConversationWith
}
delegate: Column {
anchors.right: sentByMe ? listView.contentItem.right : undefined
spacing: 6
readonly property bool sentByMe: model.recipient !== "Me"
Row {
id: messageRow
spacing: 6
anchors.right: sentByMe ? parent.right : undefined
Image {
id: avatar
source: !sentByMe ? "qrc:/" + model.author.replace(" ", "_") + ".png" : ""
}
Rectangle {
width: Math.min(messageText.implicitWidth + 24, listView.width - avatar.width - messageRow.spacing)
height: messageText.implicitHeight + 24
color: sentByMe ? "lightgrey" : "steelblue"
Label {
id: messageText
text: model.message
color: sentByMe ? "black" : "white"
anchors.fill: parent
anchors.margins: 12
wrapMode: Label.Wrap
}
}
}
Label {
id: timestampText
text: Qt.formatDateTime(model.timestamp, "d MMM hh:mm")
color: "lightgrey"
anchors.right: sentByMe ? parent.right : undefined
}
}
ScrollBar.vertical: ScrollBar {}
}
Pane {
id: pane
Layout.fillWidth: true
RowLayout {
width: parent.width
TextArea {
id: messageField
Layout.fillWidth: true
placeholderText: qsTr("Compose message")
wrapMode: TextArea.Wrap
}
Button {
id: sendButton
text: qsTr("Send")
enabled: messageField.length > 0
onClicked: {
listView.model.sendMessage(inConversationWith, messageField.text);
messageField.text = "";
}
}
}
}
}
}

View File

@ -0,0 +1,18 @@
TEMPLATE = app
QT += qml quick sql
CONFIG += c++11
HEADERS += sqlcontactmodel.h \
sqlconversationmodel.h
SOURCES += main.cpp \
sqlcontactmodel.cpp \
sqlconversationmodel.cpp
RESOURCES += \
qml.qrc \
../shared/shared.qrc
target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/chattutorial/chapter5-styling
INSTALLS += target

View File

@ -0,0 +1,99 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * 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.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** 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."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtCore>
#include <QGuiApplication>
#include <QSqlDatabase>
#include <QSqlError>
#include <QtQml>
#include "sqlcontactmodel.h"
#include "sqlconversationmodel.h"
static void connectToDatabase()
{
QSqlDatabase database = QSqlDatabase::database();
if (!database.isValid()) {
database = QSqlDatabase::addDatabase("QSQLITE");
if (!database.isValid())
qFatal("Cannot add database: %s", qPrintable(database.lastError().text()));
}
const QDir writeDir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
if (!writeDir.mkpath("."))
qFatal("Failed to create writable directory at %s", qPrintable(writeDir.absolutePath()));
// Ensure that we have a writable location on all devices.
const QString fileName = writeDir.absolutePath() + "/chat-database.sqlite3";
// When using the SQLite driver, open() will create the SQLite database if it doesn't exist.
database.setDatabaseName(fileName);
if (!database.open()) {
qFatal("Cannot open database: %s", qPrintable(database.lastError().text()));
QFile::remove(fileName);
}
}
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
qmlRegisterType<SqlContactModel>("io.qt.examples.chattutorial", 1, 0, "SqlContactModel");
qmlRegisterType<SqlConversationModel>("io.qt.examples.chattutorial", 1, 0, "SqlConversationModel");
connectToDatabase();
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
if (engine.rootObjects().isEmpty())
return -1;
return app.exec();
}

View File

@ -0,0 +1,66 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * 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.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** 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."
**
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick
import QtQuick.Controls
ApplicationWindow {
id: window
width: 540
height: 960
visible: true
StackView {
id: stackView
anchors.fill: parent
initialItem: ContactPage {}
}
}

View File

@ -0,0 +1,10 @@
<RCC>
<qresource prefix="/">
<file>main.qml</file>
<file>ContactPage.qml</file>
<file>ConversationPage.qml</file>
<file>qtquickcontrols2.conf</file>
<file>ChatToolBar.qml</file>
<file>+Material/ChatToolBar.qml</file>
</qresource>
</RCC>

View File

@ -0,0 +1,7 @@
[material]
Primary=Indigo
Accent=Indigo
Theme=Dark
[Universal]
Theme=Dark

View File

@ -0,0 +1,90 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * 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.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** 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."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "sqlcontactmodel.h"
#include <QDebug>
#include <QSqlError>
#include <QSqlQuery>
static void createTable()
{
if (QSqlDatabase::database().tables().contains(QStringLiteral("Contacts"))) {
// The table already exists; we don't need to do anything.
return;
}
QSqlQuery query;
if (!query.exec(
"CREATE TABLE IF NOT EXISTS 'Contacts' ("
" 'name' TEXT NOT NULL,"
" PRIMARY KEY(name)"
")")) {
qFatal("Failed to query database: %s", qPrintable(query.lastError().text()));
}
query.exec("INSERT INTO Contacts VALUES('Albert Einstein')");
query.exec("INSERT INTO Contacts VALUES('Ernest Hemingway')");
query.exec("INSERT INTO Contacts VALUES('Hans Gude')");
}
SqlContactModel::SqlContactModel(QObject *parent) :
QSqlQueryModel(parent)
{
createTable();
QSqlQuery query;
if (!query.exec("SELECT * FROM Contacts"))
qFatal("Contacts SELECT query failed: %s", qPrintable(query.lastError().text()));
setQuery(query);
if (lastError().isValid())
qFatal("Cannot set query on SqlContactModel: %s", qPrintable(lastError().text()));
}

View File

@ -0,0 +1,62 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * 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.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** 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."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef SQLCONTACTMODEL_H
#define SQLCONTACTMODEL_H
#include <QSqlQueryModel>
class SqlContactModel : public QSqlQueryModel
{
public:
SqlContactModel(QObject *parent = 0);
};
#endif // SQLCONTACTMODEL_H

View File

@ -0,0 +1,154 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * 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.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** 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."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "sqlconversationmodel.h"
#include <QDateTime>
#include <QDebug>
#include <QSqlError>
#include <QSqlRecord>
#include <QSqlQuery>
static const char *conversationsTableName = "Conversations";
static void createTable()
{
if (QSqlDatabase::database().tables().contains(conversationsTableName)) {
// The table already exists; we don't need to do anything.
return;
}
QSqlQuery query;
if (!query.exec(
"CREATE TABLE IF NOT EXISTS 'Conversations' ("
"'author' TEXT NOT NULL,"
"'recipient' TEXT NOT NULL,"
"'timestamp' TEXT NOT NULL,"
"'message' TEXT NOT NULL,"
"FOREIGN KEY('author') REFERENCES Contacts ( name ),"
"FOREIGN KEY('recipient') REFERENCES Contacts ( name )"
")")) {
qFatal("Failed to query database: %s", qPrintable(query.lastError().text()));
}
query.exec("INSERT INTO Conversations VALUES('Me', 'Ernest Hemingway', '2016-01-07T14:36:06', 'Hello!')");
query.exec("INSERT INTO Conversations VALUES('Ernest Hemingway', 'Me', '2016-01-07T14:36:16', 'Good afternoon.')");
query.exec("INSERT INTO Conversations VALUES('Me', 'Albert Einstein', '2016-01-01T11:24:53', 'Hi!')");
query.exec("INSERT INTO Conversations VALUES('Albert Einstein', 'Me', '2016-01-07T14:36:16', 'Good morning.')");
query.exec("INSERT INTO Conversations VALUES('Hans Gude', 'Me', '2015-11-20T06:30:02', 'God morgen. Har du fått mitt maleri?')");
query.exec("INSERT INTO Conversations VALUES('Me', 'Hans Gude', '2015-11-20T08:21:03', 'God morgen, Hans. Ja, det er veldig fint. Tusen takk! "
"Hvor mange timer har du brukt på den?')");
}
SqlConversationModel::SqlConversationModel(QObject *parent) :
QSqlTableModel(parent)
{
createTable();
setTable(conversationsTableName);
setSort(2, Qt::DescendingOrder);
// Ensures that the model is sorted correctly after submitting a new row.
setEditStrategy(QSqlTableModel::OnManualSubmit);
}
QString SqlConversationModel::recipient() const
{
return m_recipient;
}
void SqlConversationModel::setRecipient(const QString &recipient)
{
if (recipient == m_recipient)
return;
m_recipient = recipient;
const QString filterString = QString::fromLatin1(
"(recipient = '%1' AND author = 'Me') OR (recipient = 'Me' AND author='%1')").arg(m_recipient);
setFilter(filterString);
select();
emit recipientChanged();
}
QVariant SqlConversationModel::data(const QModelIndex &index, int role) const
{
if (role < Qt::UserRole)
return QSqlTableModel::data(index, role);
const QSqlRecord sqlRecord = record(index.row());
return sqlRecord.value(role - Qt::UserRole);
}
QHash<int, QByteArray> SqlConversationModel::roleNames() const
{
QHash<int, QByteArray> names;
names[Qt::UserRole] = "author";
names[Qt::UserRole + 1] = "recipient";
names[Qt::UserRole + 2] = "timestamp";
names[Qt::UserRole + 3] = "message";
return names;
}
void SqlConversationModel::sendMessage(const QString &recipient, const QString &message)
{
const QString timestamp = QDateTime::currentDateTime().toString(Qt::ISODate);
QSqlRecord newRecord = record();
newRecord.setValue("author", "Me");
newRecord.setValue("recipient", recipient);
newRecord.setValue("timestamp", timestamp);
newRecord.setValue("message", message);
if (!insertRecord(rowCount(), newRecord)) {
qWarning() << "Failed to send message:" << lastError().text();
return;
}
submitAll();
}

View File

@ -0,0 +1,79 @@
/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * 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.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** 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."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef SQLCONVERSATIONMODEL_H
#define SQLCONVERSATIONMODEL_H
#include <QSqlTableModel>
class SqlConversationModel : public QSqlTableModel
{
Q_OBJECT
Q_PROPERTY(QString recipient READ recipient WRITE setRecipient NOTIFY recipientChanged)
public:
SqlConversationModel(QObject *parent = 0);
QString recipient() const;
void setRecipient(const QString &recipient);
QVariant data(const QModelIndex &index, int role) const override;
QHash<int, QByteArray> roleNames() const override;
Q_INVOKABLE void sendMessage(const QString &recipient, const QString &message);
signals:
void recipientChanged();
private:
QString m_recipient;
};
#endif // SQLCONVERSATIONMODEL_H

View File

@ -0,0 +1,8 @@
TEMPLATE = subdirs
SUBDIRS += \
chapter1-settingup \
chapter2-lists \
chapter3-navigation \
chapter4-models \
chapter5-styling

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Some files were not shown because too many files have changed in this diff Show More