Merge remote-tracking branch 'origin/dev' into merge-dev

Change-Id: I31b761cfd5ea01373c60d02a5da8c33398d34739
This commit is contained in:
Leander Beernaert 2020-01-22 13:47:08 +01:00
commit 502d3d6744
2199 changed files with 189355 additions and 93753 deletions

1331
LICENSE.QT-LICENSE-AGREEMENT Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,913 +0,0 @@
QT LICENSE AGREEMENT
Agreement version 4.0
This License Agreement ("Agreement") is a legal agreement between The Qt
Company (as defined below) and the Licensee (as defined below) for the license
of Licensed Software (as defined below). Capitalized terms used herein are
defined in Section 1.
WHEREAS:
(A). Licensee wishes to use the Licensed Software for the purpose of developing
and distributing Applications and/or Devices; and
(B). The Qt Company is willing to grant the Licensee a right to use Licensed
Software for such purpose pursuant to term and conditions of this Agreement.
NOW, THEREFORE, THE PARTIES HEREBY AGREE AS FOLLOWS:
1. DEFINITIONS
"Affiliate" of a Party shall mean an entity (i) which is directly or indirectly
controlling such Party; (ii) which is under the same direct or indirect
ownership or control as such Party; or (iii) which is directly or indirectly
owned or controlled by such Party. For these purposes, an entity shall be
treated as being controlled by another if that other entity has fifty percent
(50 %) or more of the votes in such entity, is able to direct its affairs
and/or to control the composition of its board of directors or equivalent body.
"Applications" shall mean Licensee's software products created using the
Licensed Software, which may include the Redistributables, or part
thereof.
"Contractor(s)" shall mean third party consultants, distributors and
contractors performing services to a Party under applicable contractual
arrangement.
"Customer(s)" shall mean Licensee's end users to whom Licensee, directly or
indirectly, distributes copies of the Redistributables.
"Deployment Platforms" shall mean operating systems specified in the License
Certificate, in which the Redistributables can be distributed pursuant to the
terms and conditions of this Agreement.
"Designated User(s)" shall mean the employee(s) of Licensee or Licensee's
Affiliates acting within the scope of their employment or Licensee's
Contractors acting within the scope of their services for Licensee and on
behalf of Licensee. Designated Users shall be named in the License Certificate.
"Development License" shall mean the license needed by the Licensee for each
Designated User to use the Licensed Software under the license grant described
in Section 3.1 of this Agreement.
"Development Platforms" shall mean those operating systems specified in the
License Certificate, in which the Licensed Software can be used under the
Development License, but not distributed in any form or used for any other
purpose.
"Devices" shall mean hardware devices or products that 1) are manufactured
and/or distributed by the Licensee or its Affiliates or Contractors, and
(2)(i) incorporate or integrate the Redistributables or parts thereof; or (ii)
do not incorporate or integrate the Redistributables at the time of
distribution, but where, when used by a Customer, the main user interface or
substantial functionality of such device is provided by Application(s) or
otherwise depends on the Licensed Software.
"Distribution License(s)" shall mean the license required for distribution of
Redistributables in connection with Devices pursuant to license grant described
in Section 3.3 of this Agreement.
"Distribution License Packs" shall mean set of prepaid Distribution Licenses
for distribution of Redistributables, as defined in The Qt Company's standard
price list, quote, Purchase Order confirmation or in an appendix hereto,
as the case may be.
"Intellectual Property Rights" shall mean patents (including utility models),
design patents, and designs (whether or not capable of registration), chip
topography rights and other like protection, copyrights, trademarks, service
marks, trade names, logos or other words or symbols and any other form of
statutory protection of any kind and applications for any of the foregoing as
well as any trade secrets.
"License Certificate" shall mean a certificate generated by The Qt Company for
each Designated User respectively upon them downloading the licensed Software.
License Certificate will be available under respective Designated User's Qt
Account at account.qt.io and it will specify the Designated User, the
Development Platforms, Deployment Platforms and the License Term. The terms of
the License Certificate are considered part of this Agreement and shall be
updated from time to time to reflect any agreed changes to the foregoing terms
relating to Designated User's rights to the Licensed Software.
"License Fee" shall mean the fee charged to the Licensee for rights granted
under the terms of this Agreement.
"License Term" shall mean the agreed validity period of the Development
License of the respective Designated User, during which time the
Designated User is entitled to use the Licensed Software, as set forth in the
respective License Certificate.
"Licensed Software" shall mean all versions of the
(i) Qt Toolkit (including Qt Essentials, Qt Add-Ons and Value-Add modules) as
described in http://doc.qt.io/qt-5/qtmodules.html,
(ii) Qt Creator (including Creator IDE tool) as described in
http://doc.qt.io/qtcreator/index.html,
(iii) Qt 3D Studio as described in http://doc.qt.io/qt3dstudio/index.html, and
as well as corresponding online or electronic documentation, associated media
and printed materials, including the source code, example programs and the
documentation, licensed to the Licensee under this Agreement. Licensed Software
does not include Third Party Software (as defined in Section 4), Open Source
Qt, or other software products of The Qt Company (for example Qt Safe Renderer
and Qt for Automation), unless such other software products of The Qt Company
are separately agreed in writing to be included in scope of the Licensed
Software.
"Licensee" shall mean the individual or legal entity that is party to this
Agreement, as identified on the signature page hereof.
"Licensee's Records" shall mean books and records that are likely to contain
information bearing on Licensee's compliance with this Agreement or the
payments due to The Qt Company under this Agreement, including, but not limited
to: assembly logs, sales records and distribution records.
"Modified Software" shall have the meaning as set forth in Section 2.3.
"Online Services" shall mean any services or access to systems made available
by The Qt Company to the Licensee over the Internet relating to the Licensed
Software or for the purpose of use by the Licensee of the Licensed Software or
Support. Use of any such Online Services is discretionary for the Licensee and
some of them may be subject to additional fees.
"Open Source Qt" shall mean the non-commercial Qt computer software products,
licensed under the terms of the GNU Lesser General Public License, version
2.1 or later ("LGPL") or the GNU General Public License, version 2.0 or later
("GPL"). For clarity, Open Source Qt shall not be provided nor governed under
this Agreement.
"Party" or "Parties" shall mean Licensee and/or The Qt Company.
"Redistributables" shall mean the portions of the Licensed Software set forth
in Appendix 1, Section 1 that may be distributed pursuant to the terms of this
Agreement in object code form only, including any relevant documentation.
Where relevant, any reference to Licensed Software in this Agreement shall
include and refer also to Redistributables.
"Renewal Term" shall mean an extension of previous License Term as agreed
between the Parties.
"Submitted Modified Software" shall have the meaning as set forth in
Section 2.3.
"Support" shall mean standard developer support that is provided by The Qt
Company to assist Designated Users in using the Licensed Software in
accordance with The Qt Company's standard support terms and as further
defined in Section 8 hereunder.
"Taxes" shall have the meaning set forth in Section 10.5.
"Term" shall have the meaning set forth in Section 12.
"The Qt Company" shall mean:
(i) in the event Licensee is an individual residing in the United States or a
legal entity incorporated in the United States or having its headquarters in
the United States, The Qt Company Inc., a Delaware corporation with its office
at 2350 Mission College Blvd., Suite 1020, Santa Clara, CA 95054, USA.; or
(ii) in the event the Licensee is an individual residing outside of the United
States or a legal entity incorporated outside of the United States or having
its registered office outside of the United States, The Qt Company Ltd., a
Finnish company with its registered office at Bertel Jungin aukio D3A, 02600
Espoo, Finland.
"Third Party Software " shall have the meaning set forth in Section 4.
"Updates" shall mean a release or version of the Licensed Software containing
bug fixes, error corrections and other changes that are generally made
available to users of the Licensed Software that have contracted for Support.
Updates are generally depicted as a change to the digits following the decimal
in the Licensed Software version number. The Qt Company shall make Updates
available to the Licensee under the Support. Updates shall be considered as
part of the Licensed Software hereunder.
"Upgrades" shall mean a release or version of the Licensed Software containing
enhancements and new features and are generally depicted as a change to the
first digit of the Licensed Software version number. In the event Upgrades are
provided to the Licensee under this Agreement, they shall be considered as
part of the Licensed Software hereunder.
2. OWNERSHIP
2.1 Ownership of The Qt Company
The Licensed Software is protected by copyright laws and international
copyright treaties, as well as other intellectual property laws and treaties.
The Licensed Software is licensed, not sold.
All The Qt Company's Intellectual Property Rights are and shall remain the
exclusive property of The Qt Company or its licensors respectively.
2.2 Ownership of Licensee
All the Licensee's Intellectual Property Rights are and shall remain the
exclusive property of the Licensee or its licensors respectively.
All Intellectual Property Rights to the Modified Software, Applications and
Devices shall remain with the Licensee and no rights thereto shall be granted
by the Licensee to The Qt Company under this Agreement (except as set forth in
Section 2.3 below).
2.3 Modified Software
Licensee may create bug-fixes, error corrections, patches or modifications to
the Licensed Software ("Modified Software"). Such Modified Software may break
the source or binary compatibility with the Licensed Software (including
without limitation through changing the application programming interfaces
("API") or by adding, changing or deleting any variable, method, or class
signature in the Licensed Software and/or any inter-process protocols, services
or standards in the Licensed Software libraries). To the extent that Licensee's
Modified Software so breaks source or binary compatibility with the Licensed
Software, Licensee acknowledges that The Qt Company's ability to provide
Support may be prevented or limited and Licensee's ability to make use of
Updates may be restricted.
Licensee may, at its sole and absolute discretion, choose to submit Modified
Software to The Qt Company ("Submitted Modified Software") in connection with
Licensee's Support request, service request or otherwise. In the event Licensee
does so, then, Licensee hereby grants The Qt Company a sublicensable,
assignable, irrevocable, perpetual, worldwide, non-exclusive, royalty-free and
fully paid-up license, under all of Licensee's Intellectual Property Rights, to
reproduce, adapt, translate, modify, and prepare derivative works of, publicly
display, publicly perform, sublicense, make available and distribute such
Submitted Modified Software as The Qt Company sees fit at its free and absolute
discretion.
3. LICENSES GRANTED
3.1 Development with Licensed Software
Subject to the terms of this Agreement, The Qt Company grants to Licensee a
personal, worldwide, non-exclusive, non-transferable license, valid for the
License Term, to use, modify and copy the Licensed Software by Designated Users
on the Development Platforms for the sole purposes of designing, developing,
demonstrating and testing Application(s) and/or Devices, and to provide thereto
related support and other related services to end-user Customers.
Licensee may install copies of the Licensed Software on an unlimited number of
computers provided that (i) only the Designated Users may use the Licensed
Software, and (ii) all Designated Users must have a valid Development License
to use Licensed Software.
Licensee may at any time designate another Designated User to replace a then-
current Designated User by notifying The Qt Company in writing, provided that
any Designated User may be replaced only once during any six-month period.
Upon expiry of the initially agreed License Term, the respective License Terms
shall be automatically extended to one or more Renewal Term(s), unless and
until either Party notifies the other Party in writing that it does not wish to
continue the License Term, such notification to be provided to the other Party
no less than ninety (90) days before expiry of the respective License Term.
Unless otherwise agreed between the Parties, Renewal Term shall be of equal
length with the initial Term.
Any such Renewal Term shall be subject to License Fees agreed between the
Parties or, if no advance agreement exists, subject to The Qt Company's
standard pricing applicable at the commencement date of any such Renewal Term.
3.2 Distribution of Applications
Subject to the terms of this Agreement, The Qt Company grants to Licensee a
personal, worldwide, non-exclusive, non-transferable, revocable (for cause
pursuant to this Agreement) right and license, valid for the Term, to
(i) distribute, by itself or through its Contractors, Redistributables as
installed, incorporated or integrated into Applications for execution on the
Deployment Platforms, and
(ii) grant sublicenses to Redistributables, as distributed hereunder, for
Customers solely for Customer's internal use and to the extent necessary in
order for the Customers to use the Applications for their respective intended
purposes.
Right to distribute the Redistributables as part of an Application as provided
herein is not royalty-bearing but is conditional upon the Licensee having paid
the agreed Development Licenses from The Qt Company before distributing any
Redistributables to Customers.
3.3 Distribution of Devices
Subject to the terms of this Agreement, The Qt Company grants to Licensee a
personal, worldwide, non-exclusive, non-transferable, revocable (for cause
pursuant to this Agreement) right and license, valid for the Term, to
(i) distribute, by itself or through one or more tiers of Contractors,
Redistributables as installed, incorporated or integrated, or intended to be
installed, incorporated or integrated into Devices for execution on the
Deployment Platforms, and
(ii) grant sublicenses to Redistributables, as distributed hereunder, for
Customers solely for Customer's internal use and to the extent necessary in
order for the Customers to use the Devices for their respective intended
purposes.
Right to distribute the Redistributables with Devices as provided herein is
conditional upon the Licensee having purchased and paid the appropriate amount
of Development and Distribution Licenses from The Qt Company before
distributing any Redistributables to Customers.
3.4 Further Requirements
The licenses granted above in this Section 3 by The Qt Company to Licensee are
conditional and subject to Licensee's compliance with the following terms:
(i) Licensee shall not remove or alter any copyright, trademark or other
proprietary rights notice contained in any portion of the Licensed Software;
(ii) Applications must add primary and substantial functionality to the
Licensed Software;
(iii) Applications may not pass on functionality which in any way makes it
possible for others to create software with the Licensed Software; provided
however that Licensee may use the Licensed Software's scripting and QML ("Qt
Quick") functionality solely in order to enable scripting, themes and styles
that augment the functionality and appearance of the Application(s) without
adding primary and substantial functionality to the Application(s);
(iv) Applications must not compete with the Licensed Software;
(v) Licensee shall not use The Qt Company's or any of its suppliers' names,
logos, or trademarks to market Applications, except that Licensee may use
"Built with Qt" logo to indicate that Application(s) was developed using the
Licensed Software;
(vi) Licensee shall not distribute, sublicense or disclose source code of
Licensed Software to any third party (provided however that Licensee may
appoint employee(s) of Contractors as Designated Users to use Licensed
Software pursuant to this Agreement). Such right may be available for the
Licensee subject to a separate software development kit ("SDK") license
agreement to be concluded with The Qt Company;
(vii) Licensee shall not grant the Customers a right to (i) make copies of the
Redistributables except when and to the extent required to use the Applications
and/or Devices for their intended purpose, (ii) modify the Redistributables or
create derivative works thereof, (iii) decompile, disassemble or otherwise
reverse engineer Redistributables, or (iv) redistribute any copy or portion of
the Redistributables to any third party, except as part of the onward sale of
the Device on which the Redistributables are installed;
(viii) Licensee shall not and shall cause that its Affiliates or Contractors
shall not a) in any way combine, incorporate or integrate Licensed Software
with, or use Licensed Software for creation of, any software created with or
incorporating Open Source Qt, or b) incorporate or integrate Applications
into a hardware device or product other than a Device, unless Licensee has
received an advance written permission from The Qt Company to do so. Absent
such written permission, any and all distribution by the Licensee during the
Term of a hardware device or product a) which incorporate or integrate any
part of Licensed Software or Open Source Qt; or b) where the main user
interface or substantial functionality is provided by software build with
Licensed Software or Open Source Qt or otherwise depends on the Licensed
Software or Open Source Qt, shall be considered as a Device distribution under
this Agreement and dependent on compliance thereof (including but not limited
to obligation to pay applicable License Fees for such distribution);
(ix) Licensee shall cause all of its Affiliates and Contractors entitled to
make use of the licenses granted under this Agreement, to be contractually
bound to comply with the relevant terms of this Agreement and not to use the
Licensed Software beyond the terms hereof and for any purposes other than
operating within the scope of their services for Licensee. Licensee shall be
responsible for any and all actions and omissions of its Affiliates and
Contractors relating to the Licensed Software and use thereof (including but
not limited to payment of all applicable License Fees);
(x) Except when and to the extent explicitly provided in this Section 3,
Licensee shall not transfer, publish, disclose, display or otherwise make
available the Licensed Software;
; and
(xi) Licensee shall not attempt or enlist a third party to conduct or attempt
to conduct any of the above.
Above terms shall not be applicable if and to the extent they conflict with any
mandatory provisions of any applicable laws.
Any use of Licensed Software beyond the provisions of this Agreement is
strictly prohibited and requires an additional license from The Qt Company.
4. THIRD PARTY SOFTWARE
The Licensed Software may provide links to third party libraries or code
(collectively "Third Party Software") to implement various functions. Third
Party Software does not comprise part of the Licensed Software. In some cases,
access to Third Party Software may be included in the Licensed Software. Such
Third Party Software will be listed in the ".../src/3rdparty" source tree
delivered with the Licensed Software or documented in the Licensed Software, as
such may be amended from time to time. Licensee acknowledges that use or
distribution of Third Party Software is in all respects subject to applicable
license terms of applicable third party right holders.
5. PRE-RELEASE CODE
The Licensed Software may contain pre-release code and functionality marked or
otherwise stated as "Technology Preview", "Alpha", "Beta" or similar
designation. Such pre-release code may be present in order to provide
experimental support for new platforms or preliminary versions of one or more
new functionalities. The pre-release code may not be at the level of
performance and compatibility of a final, generally available, product
offering of the Licensed Software. The pre-release parts of the Licensed
Software may not operate correctly, may contain errors and may be substantially
modified by The Qt Company prior to the first commercial product release, if
any. The Qt Company is under no obligation to make pre-release code
commercially available, or provide any Support or Updates relating thereto. The
Qt Company assumes no liability whatsoever regarding any pre-release code, but
any use thereof is exclusively at Licensee's own risk and expense.
6. LIMITED WARRANTY AND WARRANTY DISCLAIMER
The Qt Company hereby represents and warrants that it has the power and
authority to grant the rights and licenses granted to Licensee under this
Agreement.
Except as set forth above, the Licensed Software is licensed to Licensee
"as is" and Licensee's exclusive remedy and The Qt Company's entire liability
for errors in the Licensed Software shall be limited, at The Qt Company's
option, to correction of the error, replacement of the Licensed Software or
return of the applicable fees paid for the defective Licensed Software for the
time period during which the License is not able to utilize the Licensed
Software under the terms of this Agreement.
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE QT COMPANY ON BEHALF OF
ITSELF AND ITS LICENSORS, SUPPLIERS AND AFFILIATES, DISCLAIMS ALL OTHER
WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, ANY IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-
INFRINGEMENT WITH REGARD TO THE LICENSED SOFTWARE. THE QT COMPANY DOES NOT
WARRANT THAT THE LICENSED SOFTWARE WILL SATISFY LICENSEE'S REQUIREMENTS OR THAT
IT WILL OPERATE WITHOUT DEFECT OR ERROR OR THAT THE OPERATION THEREOF WILL BE
UNINTERRUPTED. ALL USE OF AND RELIANCE ON THE LICENSED SOFTWARE IS AT THE SOLE
RISK OF AND RESPONSIBILITY OF LICENSEE.
7. INDEMNIFICATION AND LIMITATION OF LIABILITY
7.1 Limitation of Liability
EXCEPT FOR (I) CASES OF GROSS NEGLIGENCE OR INTENTIONAL MISCONDUCT, AND (II)
BREACH OF CONFIDENTIALITY, AND TO THE EXTENT PERMITTED BY APPLICABLE LAW, IN NO
EVENT SHALL EITHER PARTY BE LIABLE TO THE OTHER PARTY FOR ANY LOSS OF PROFIT,
LOSS OF DATA, LOSS OF BUSINESS OR GOODWILL OR ANY OTHER INDIRECT, SPECIAL,
CONSEQUENTIAL, INCIDENTAL OR PUNITIVE COST, DAMAGES OR EXPENSE OF ANY KIND,
HOWSOEVER ARISING UNDER OR IN CONNECTION WITH THIS AGREEMENT. PARTIES
SPECIFICALLY AGREE THAT LICENSEE'S OBLIGATION TO PAY LICENSE AND OTHER FEES
CORRESPONDING TO ACTUAL USAGE OF LICENSED SOFTWARE HEREUNDER SHALL BE
CONSIDERED AS A DIRECT DAMAGE.
EXCEPT FOR (I) CASES OF GROSS NEGLIGENCE OR INTENTIONAL MISCONDUCT, AND (II)
BREACH OF CONFIDENTIALITY, AND TO THE EXTENT PERMITTED BY APPLICABLE LAW, IN
NO EVENT SHALL EITHER PARTY'S TOTAL AGGREGATE LIABILITY UNDER THIS AGREEMENT
EXCEED THE AGGREGATE LICENSE FEES PAID OR PAYABLE TO THE QT COMPANY FROM
LICENSEE DURING THE PERIOD OF TWELVE (12) MONTHS IMMEDIATELY PRECEDING THE
EVENT RESULTING IN SUCH LIABILITY.
THE PROVISIONS OF THIS SECTION 7 ALLOCATE THE RISKS UNDER THIS AGREEMENT
BETWEEN THE QT COMPANY AND LICENSEE AND THE PARTIES HAVE RELIED UPON THE
LIMITATIONS SET FORTH HEREIN IN DETERMINING WHETHER TO ENTER INTO THIS AGREEMENT.
7.2 Licensee's Indemnification
Licensee shall indemnify and hold harmless The Qt Company from and against any
claim, injury, judgment, settlement, loss or expense, including attorneys' fees
related to: (a) Licensee's misrepresentation in connection with The Qt Company
or the Licensed Software or breach of this Agreement, (b) the Application or
Device (except where such cause of liability is solely attributable to the
Licensed Software).
8. SUPPORT, UPDATES AND ONLINE SERVICES
Upon due payment of the agreed License Fees the Licensee will be eligible to
receive Support and Updates and to use the Online Services during the License
Term, provided, however, that in the event the License Term is longer than 36
months, Support is provided only for the first 12 months, unless the Parties
specifically otherwise agree.
Unless otherwise decided by The Company at its free and absolute discretion,
Upgrades will not be included in the Support but may be available subject to
additional fees.
From time to time The Qt Company may change the Support terms, provided that
during the respective ongoing License Term the level of Support provided by The
Qt Company may not be reduced without the consent of the Licensee.
Unless otherwise agreed, The Qt Company shall not be responsible for providing
any service or support to Customers.
9. CONFIDENTIALITY
Each Party acknowledges that during the Term of this Agreement each Party may
receive information about the other Party's business, business methods,
business plans, customers, business relations, technology, and other
information, including the terms of this Agreement, that is confidential and
of great value to the other Party, and the value of which would be
significantly reduced if disclosed to third parties ("Confidential
Information"). Accordingly, when a Party (the "Receiving Party") receives
Confidential Information from the other Party (the "Disclosing Party"), the
Receiving Party shall only disclose such information to employees and
Contractors on a need to know basis, and shall cause its employees and
employees of its Affiliates to: (i) maintain any and all Confidential
Information in confidence; (ii) not disclose the Confidential Information to a
third party without the Disclosing Party's prior written approval; and (iii)
not, directly or indirectly, use the Confidential Information for any purpose
other than for exercising its rights and fulfilling its responsibilities
pursuant to this Agreement. Each Party shall take reasonable measures to
protect the Confidential Information of the other Party, which measures shall
not be less than the measures taken by such Party to protect its own
confidential and proprietary information.
Obligation of confidentiality shall not apply to information that (i) is or
becomes generally known to the public through no act or omission of the
Receiving Party; (ii) was in the Receiving Party's lawful possession prior to
the disclosure hereunder and was not subject to limitations on disclosure or
use; (iii) is developed independently by employees or Contractors of the
Receiving Party or other persons working for the Receiving Party who have not
had access to the Confidential Information of the Disclosing Party, as proven
by the written records of the Receiving Party; (iv) is lawfully disclosed to
the Receiving Party without restrictions, by a third party not under an
obligation of confidentiality; or (v) the Receiving Party is legally compelled
to disclose, in which case the Receiving Party shall notify the Disclosing
Party of such compelled disclosure and assert the privileged and confidential
nature of the information and cooperate fully with the Disclosing Party to
limit the scope of disclosure and the dissemination of disclosed Confidential
Information to the minimum extent necessary.
The obligations under this Section 9 shall continue to remain in force for a
period of five (5) years after the last disclosure, and, with respect to trade
secrets, for so long as such trade secrets are protected under applicable trade
secret laws.
10. FEES, DELIVERY AND PAYMENT
10.1 License Fees
License Fees are described in The Qt Company's standard price list, quote or
Purchase Order confirmation or in an appendix hereto, as the case may be.
The License Fees shall not be refunded or claimed as a credit in any event or
for any reason whatsoever.
10.2 Ordering Licenses
Licensee may purchase Development Licenses and Distribution Licenses pursuant
to agreed pricing terms or, if no specific pricing terms have been agreed upon,
at The Qt Company's standard pricing terms applicable at the time of purchase.
Licensee shall submit all purchase orders for Development Licenses and
Distribution Licenses to The Qt Company by email or any other method acceptable
to The Qt Company (each such order is referred to herein as a "Purchase Order")
for confirmation, whereupon the Purchase Order shall become binding between the
Parties.
10.3 Distribution License Packs
Unless otherwise agreed, Distribution Licenses shall be purchased by way of
Distribution License Packs.
Upon due payment of the ordered Distribution License Pack(s), the Licensee will
have an account of Distribution Licenses available for installing, bundling or
integrating (all jointly "installing") the Redistributables with the Devices or
for otherwise distributing the Redistributables in accordance with this
Agreement.
Each time Licensee "installs" or distributes a copy of Redistributables, then
one Distribution License is used, and Licensee's account of available
Distribution Licenses is decreased accordingly.
Licensee may "install" copies of the Redistributables so long as Licensee has
Distribution Licenses remaining on its account.
Redistributables will be deemed to have been "installed" into a Device when one
of the following circumstances shall have occurred: a) the Redistributables
have been loaded onto the Device and used outside of the Licensee's premises or
b) the Device has been fully tested and placed into Licensee's inventory
(or sold) for the first time (i.e., Licensee will not be required to use
(or pay for) more than one Distribution License for each individual Device,
e.g. in a situation where a Device is returned to Licensee's inventory after
delivery to a distributor or sale to a Customer). In addition, if Licensee
includes a back-up copy of the Redistributables on a CD-ROM or other storage
medium along with the product, that backup copy of the Redistributables will
not be deemed to have been "installed" and will not require an additional
Distribution License.
10.4 Payment Terms
License Fees and any other charges under this Agreement shall be paid by
Licensee no later than thirty (30) days from the date of the applicable invoice
from The Qt Company.
The Qt Company will submit an invoice to Licensee after the date of this
Agreement and/or after The Qt Company receives a Purchase Order from
Licensee.
A late payment charge of the lower of (a) one percent per month; or (b) the
interest rate stipulated by applicable law, shall be charged on any unpaid
balances that remain past due.
The Qt Company shall have the right to suspend, terminate or withhold grants
of all rights to the Licensed Software hereunder, including but not limited to
the Developer License, Distribution License, and Support, should Licensee fail
to make payment in timely fashion.
10.5 Taxes
All License Fees and other charges payable hereunder are gross amounts but
exclusive of any value added tax, use tax, sales tax and other taxes, duties or
tariffs ("Taxes"). Such applicable Taxes shall be paid by Licensee, or, where
applicable, in lieu of payment of such Taxes, Licensee shall provide an
exemption certificate to The Qt Company and any applicable authority.
11 RECORD-KEEPING AND REPORTING OBLIGATIONS; AUDIT RIGHTS
11.1 Licensee's Record-keeping
Licensee shall at all times maintain accurate and up-to-date written records of
Licensee's activities related to the use of Licensed Software and distribution
of Redistributables. The records shall be adequate to determine Licensee's
compliance with the provisions of this Agreement and to demonstrate the number
of Designated Users and Redistributables distributed by Licensee. The records
shall conform to good accounting practices reasonably acceptable to The Qt
Company.
Licensee shall, within thirty (30) days from receiving The Qt Company's request
to that effect, deliver to The Qt Company a report on Licensee's usage of
Licensed Software, such report to copies of Redistributables distributed by
Licensee during that calendar quarter, and also detailing the number of
undistributed copies of Redistributables made by Licensee and remaining in its
account contain information, in sufficient detail, on (i) amount of users
working with Licensed Software, (ii) copies of Redistributables distributed by
Licensee during that calendar quarter, (iii) number of undistributed copies of
Redistributables and corresponding number of unused Distribution Licenses
remaining on Licensee's account, and (iv) any other information as The Qt
Company may reasonably require from time to time.
11.2. The Qt Company's Audit Rights
The Qt Company or an independent auditor acting on behalf of The Qt Company's,
may, upon at least five (5) business days' prior written notice and at its
expense, audit Licensee with respect to the use of the Redistributables, but
not more frequently than once during each 6-month period. Such audit may be
conducted by mail, electronic means or through an in-person visit to Licensee's
place of business. Any such in-person audit shall be conducted during regular
business hours at Licensee's facilities and shall not unreasonably interfere
with Licensee's business activities. The Qt Company or the independent auditor
acting on behalf of The Qt Company shall be entitled to inspect Licensee's
Records. All such Licensee's Records and use thereof shall be subject to an
obligation of confidentiality under this Agreement.
If an audit reveals that Licensee is using the Licensed Software beyond scope
of the licenses Licensee has paid for, Licensee agrees to immediately pay The
Qt Company any amounts owed for such unauthorized use.
In addition, in the event the audit reveals a material violation of the terms
of this Agreement (underpayment of more than 5% of License Fees shall always be
deemed a material violation for purposes of this section), then the Licensee
shall pay The Qt Company's reasonable cost of conducting such audit.
12 TERM AND TERMINATION
12.1 Term
This Agreement shall enter into force upon due acceptance by both Parties and
remain in force for as long as there is any Development License(s) in force
("Term"), unless and until terminated pursuant to the terms of this Section 12.
12.2 Termination by The Qt Company
The Qt Company shall have the right to terminate this Agreement upon thirty
(30) days prior written notice if the Licensee is in material breach of any
obligation of this Agreement and fails to remedy such breach within such notice
period.
12.3 Mutual Right to Terminate
Either Party shall have the right to terminate this Agreement immediately upon
written notice in the event that the other Party becomes insolvent, files for
any form of bankruptcy, makes any assignment for the benefit of creditors, has
a receiver, administrative receiver or officer appointed over the whole or a
substantial part of its assets, ceases to conduct business, or an act
equivalent to any of the above occurs under the laws of the jurisdiction of the
other Party.
12.4 Parties' Rights and Duties upon Termination
Upon expiry or termination of the Agreement Licensee shall cease and shall
cause all Designated Users (including those of its Affiliates' and
Contractors') to cease using the Licensed Software and distribution of the
Redistributables under this Agreement.
Notwithstanding the above, in the event the Agreement expires or is terminated:
(i) as a result of The Qt Company choosing not to renew the Development
License(s) as set forth in Section 3.1, then all valid licenses possessed by
the Licensee at such date shall be extended to be valid in perpetuity under the
terms of this Agreement and Licensee is entitled to purchase additional
licenses as set forth in Section 10.2; or
(ii) for reason other than by The Qt Company pursuant to item (i) above or
pursuant to Section 12.2, then the Licensee is entitled, for a period of six
(6) months after the effective date of termination, to continue distribution of
Devices under the Distribution Licenses paid but unused at such effective date
of termination.
Upon any such termination the Licensee shall destroy or return to The Qt
Company all copies of the Licensed Software and all related materials and will
certify the same to The Qt Company upon its request, provided however that
Licensee may retain and exploit such copies of the Licensed Software as it may
reasonably require in providing continued support to Customers.
Expiry or termination of this Agreement for any reason whatsoever shall not
relieve Licensee of its obligation to pay any License Fees accrued or payable
to The Qt Company prior to the effective date of termination, and Licensee
shall immediately pay to The Qt Company all such fees upon the effective date
of termination. Termination of this Agreement shall not affect any rights of
Customers to continue use of Applications and Devices (and therein incorporated
Redistributables).
12.5 Extension in case of bankruptcy
In the event The Qt Company is declared bankrupt under a final, non-cancellable
decision by relevant court of law, and this Agreement is not, at the date of
expiry of the Development License(s) pursuant to Section 3.1, assigned to
party, who has assumed The Qt Company's position as a legitimate licensor of
Licensed Software under this Agreement, then all valid licenses possessed by
the Licensee at such date of expiry, and which the Licensee has not notified
for expiry, shall be extended to be valid in perpetuity under the terms of
this Agreement.
13. GOVERNING LAW AND LEGAL VENUE
In the event this Agreement is in the name of The Qt Company Inc., a Delaware
Corporation, then:
(i) this Agreement shall be construed and interpreted in accordance with the
laws of the State of California, USA, excluding its choice of law provisions;
(ii) the United Nations Convention on Contracts for the International Sale of
Goods will not apply to this Agreement; and
(iii) any dispute, claim or controversy arising out of or relating to this
Agreement or the breach, termination, enforcement, interpretation or validity
thereof, including the determination of the scope or applicability of this
Agreement to arbitrate, shall be determined by arbitration in San Francisco,
USA, before one arbitrator. The arbitration shall be administered by JAMS
pursuant to JAMS' Streamlined Arbitration Rules and Procedures. Judgment on the
Award may be entered in any court having jurisdiction. This Section shall not
preclude parties from seeking provisional remedies in aid of arbitration from a
court of appropriate jurisdiction.
In the event this Agreement is in the name of The Qt Company Ltd., a Finnish
Company, then:
(i) this Agreement shall be construed and interpreted in accordance with the
laws of Finland, excluding its choice of law provisions;
(ii) the United Nations Convention on Contracts for the International Sale of
Goods will not apply to this Agreement; and
(iii) any disputes, controversy or claim arising out of or relating to this
Agreement, or the breach, termination or validity thereof shall be shall be
finally settled by arbitration in accordance with the Arbitration Rules of
Finland Chamber of Commerce. The arbitration tribunal shall consist of one (1),
or if either Party so requires, of three (3), arbitrators. The award shall be
final and binding and enforceable in any court of competent jurisdiction. The
arbitration shall be held in Helsinki, Finland and the process shall be
conducted in the English language. This Section shall not preclude parties from
seeking provisional remedies in aid of arbitration from a court of appropriate
jurisdiction.
14. GENERAL PROVISIONS
14.1 No Assignment
Except in the case of a merger or sale of substantially all of its corporate
assets, Licensee shall not be entitled to assign or transfer all or any of its
rights, benefits and obligations under this Agreement without the prior written
consent of The Qt Company, which shall not be unreasonably withheld or delayed.
The Qt Company shall be entitled to freely assign or transfer any of its
rights, benefits or obligations under this Agreement.
14.2 No Third Party Representations
Licensee shall make no representations or warranties concerning the Licensed
Software on behalf of The Qt Company. Any representation or warranty Licensee
makes or purports to make on The Qt Company's behalf shall be void as to The
Qt Company.
14.3 Surviving Sections
Any terms and conditions that by their nature or otherwise reasonably should
survive termination of this Agreement shall so be deemed to survive.
14.4 Entire Agreement
This Agreement, the exhibits hereto, the License Certificate and any applicable
Purchase Order constitute the complete agreement between the Parties and
supersedes all prior or contemporaneous discussions, representations, and
proposals, written or oral, with respect to the subject matters discussed
herein.
In the event of any conflict or inconsistency between this Agreement and any
Purchase Order, the terms of this Agreement will prevail over the terms of the
Purchase Order with respect to such conflict or inconsistency.
Parties specifically acknowledge and agree that this Agreement prevails over
any click-to-accept or similar agreements the Designated Users may need to
accept online upon download of the Licensed Software, as may be required by
The Qt Company's applicable processes relating to Licensed Software.
14.5 Modifications
No modification of this Agreement shall be effective unless contained in a
writing executed by an authorized representative of each Party. No term or
condition contained in Licensee's Purchase Order shall apply unless expressly
accepted by The Qt Company in writing.
14.6 Force Majeure
Except for the payment obligations hereunder, neither Party shall be liable to
the other for any delay or non-performance of its obligations hereunder in the
event and to the extent that such delay or non-performance is due to an event
of act of God, terrorist attack or other similar unforeseeable catastrophic
event that prevents either Party for fulfilling its obligations under this
Agreement and which such Party cannot avoid or circumvent ("Force Majeure
Event"). If the Force Majeure Event results in a delay or non-performance of a
Party for a period of three (3) months or longer, then either Party shall have
the right to terminate this Agreement with immediate effect without any
liability (except for the obligations of payment arising prior to the event of
Force Majeure) towards the other Party.
14.7 Notices
Any notice given by one Party to the other shall be deemed properly given and
deemed received if specifically acknowledged by the receiving Party in writing
or when successfully delivered to the recipient by hand, fax, or special
courier during normal business hours on a business day to the addresses
specified for each Party on the signature page. Each communication and document
made or delivered by one Party to the other Party pursuant to this Agreement
shall be in the English language.
14.8 Export Control
Licensee acknowledges that the Redistributables may be subject to export
control restrictions under the applicable laws of respective countries.
Licensee shall fully comply with all applicable export license restrictions
and requirements as well as with all laws and regulations relating to the
Redistributables and exercise of licenses hereunder and shall procure all
necessary governmental authorizations, including without limitation, all
necessary licenses, approvals, permissions or consents, where necessary for the
re-exportation of the Redistributables, Applications and/or Devices.
14.9 No Implied License
There are no implied licenses or other implied rights granted under this
Agreement, and all rights, save for those expressly granted hereunder, shall
remain with The Qt Company and its licensors. In addition, no licenses or
immunities are granted to the combination of the Licensed Software with any
other software or hardware not delivered by The Qt Company under this Agreement.
14.10 Attorney Fees
The prevailing Party in any action to enforce this Agreement shall be entitled
to recover its attorney's fees and costs in connection with such action.
14.11 Severability
If any provision of this Agreement shall be adjudged by any court of competent
jurisdiction to be unenforceable or invalid, that provision shall be limited or
eliminated to the minimum extent necessary so that this Agreement shall
otherwise remain in full force and effect and enforceable.
IN WITNESS WHEREOF, the Parties hereto, intending to be legally bound hereby,
have caused this Agreement to be executed by Licensee's authorized
representative installing the Licensed Software and accepting the terms
hereof in connection therewith.
Appendix 1
1. Parts of the Licensed Software that are permitted for distribution in
object code form only ("Redistributables") under this Agreement:
- The Licensed Software's Qt Essentials and Qt Add-on libraries
- The Licensed Software's configuration tool ("qtconfig")
- The Licensed Software's help tool ("Qt Assistant")
- The Licensed Software's internationalization tools ("Qt Linguist", "lupdate",
"lrelease")
- The Licensed Software's QML ("Qt Quick") launcher tool ("qmlscene" or
"qmlviewer")
- The Licensed Software's installer framework
2. Parts of the Licensed Software that are not permitted for distribution
include, but are not limited to:
- The Licensed Software's source code and header files
- The Licensed Software's documentation
- The Licensed Software's documentation generation tool ("qdoc")
- The Licensed Software's tool for writing makefiles ("qmake")
- The Licensed Software's Meta Object Compiler ("moc")
- The Licensed Software's User Interface Compiler ("uic")
- The Licensed Software's Resource Compiler ("rcc")
- The Licensed Software's parts of the IDE tool ("Qt Creator")
- The Licensed Software's parts of the Design tools ("Qt 3D Studio" or
"Qt Quick Designer")
- The Licensed Software's Emulator

View File

@ -209,6 +209,7 @@ sub classNames {
$$clean = 1;
$$requires = "";
my $suspended = 0;
my $ihdrbase = basename($iheader);
my $parsable = "";
@ -221,9 +222,11 @@ sub classNames {
$$clean = 0 if ($line =~ m/^#pragma qt_sync_skip_header_check/);
return @ret if($line =~ m/^#pragma qt_sync_stop_processing/);
push(@ret, $1) if($line =~ m/^#pragma qt_class\(([^)]*)\)[\r\n]*$/);
$suspended = 1 if ($line =~ m/^#pragma qt_sync_suspend_processing/);
$suspended = 0 if ($line =~ m/^#pragma qt_sync_resume_processing/);
$line = 0;
}
if($line) {
if ($line && !$suspended) {
$line =~ s,//.*$,,; #remove c++ comments
$line .= ";" if($line =~ m/^Q_[A-Z_0-9]*\(.*\)[\r\n]*$/); #qt macro
$line .= ";" if($line =~ m/^QT_(BEGIN|END)_HEADER[\r\n]*$/); #qt macro

View File

@ -130,7 +130,7 @@ Build options:
Currently supported backends are 'etw' (Windows) and
'lttng' (Linux), or 'yes' for auto-detection. [no]
-sanitize {address|thread|memory|undefined}
-sanitize {address|thread|memory|fuzzer-no-link|undefined}
Instrument with the specified compiler sanitizer.
Note that some sanitizers cannot be combined;
for example, -sanitize address cannot be combined with
@ -162,6 +162,8 @@ Build options:
-reduce-exports ...... Reduce amount of exported symbols [auto]
-reduce-relocations .. Reduce amount of relocations [auto] (Unix only)
-relocatable ......... Enable the Qt installation to be relocated [auto]
-plugin-manifests .... Embed manifests into plugins [no] (Windows only)
-static-runtime ...... With -static, use static runtime [no] (Windows only)
@ -255,6 +257,7 @@ Network options:
-no-openssl .......... Do not use OpenSSL [default on Apple and WinRT]
-openssl-linked ...... Use OpenSSL and link to libssl [no]
-openssl-runtime ..... Use OpenSSL and dynamically load libssl [auto]
-schannel ............ Use Secure Channel [no] (Windows only)
-securetransport ..... Use SecureTransport [auto] (Apple only)
-sctp ................ Enable SCTP support [no]

3
configure vendored
View File

@ -525,8 +525,7 @@ while [ "$#" -gt 0 ]; do
-android-ndk| \
-android-ndk-platform| \
-android-ndk-host| \
-android-arch| \
-android-toolchain-version)
-android-arch)
VAR=`echo $1 | sed 's,^-\(.*\),\1,'`
shift
VAL="$1"

View File

@ -775,12 +775,12 @@
},
"debug": {
"label": "Build for debugging",
"autoDetect": "features.developer-build || config.win32 || config.darwin"
"autoDetect": "features.developer-build || (config.win32 && !config.gcc) || config.darwin"
},
"debug_and_release": {
"label": "Compile libs in debug and release mode",
"autoDetect": "input.debug == ''",
"condition": "config.darwin || (config.win32 && !config.gcc)",
"autoDetect": "input.debug == '' && !(config.win32 && config.gcc)",
"condition": "config.darwin || config.win32",
"output": [ "publicFeature", "publicQtConfig", "debugAndRelease" ]
},
"force_debug_info": {
@ -894,6 +894,12 @@
"autoDetect": false,
"output": [ "publicConfig" ]
},
"sanitize_fuzzer_no_link": {
"label": "Fuzzer (instrumentation only)",
"autoDetect": false,
"output": [ "publicConfig" ],
"purpose": [ "Adds instrumentation for fuzzing to the binaries but links to the usual main function instead of a fuzzer's." ]
},
"sanitize_undefined": {
"label": "Undefined",
"autoDetect": false,
@ -901,7 +907,7 @@
},
"sanitizer": {
"label": "Sanitizers",
"condition": "features.sanitize_address || features.sanitize_thread || features.sanitize_memory || features.sanitize_undefined",
"condition": "features.sanitize_address || features.sanitize_thread || features.sanitize_memory || features.sanitize_fuzzer_no_link || features.sanitize_undefined",
"output": [ "sanitizer", "publicConfig" ]
},
"coverage_trace_pc_guard": {
@ -1441,6 +1447,11 @@
"type": "error",
"condition": "features.coverage && !config.clang",
"message": "Command line option -coverage is only supported with clang compilers."
},
{
"type": "error",
"condition": "features.sanitize_fuzzer_no_link && !config.clang",
"message": "Command line option -sanitize fuzzer-no-link is only supported with clang compilers."
}
],
@ -1464,6 +1475,15 @@
"type": "error",
"condition": "!features.stl",
"message": "Qt requires a compliant STL library."
},
{
"type": "emccVersion",
"condition": "config.wasm"
},
{
"type": "error",
"condition": "config.ios && features.debug && !features.debug_and_release",
"message": "Debug build wihtout Release build is not currently supported on ios see QTBUG-71990. Use -debug-and-release."
}
],
@ -1575,7 +1595,13 @@
{
"section": "Sanitizers",
"condition": "features.sanitizer",
"entries": [ "sanitize_address", "sanitize_thread", "sanitize_memory", "sanitize_undefined" ]
"entries": [
"sanitize_address",
"sanitize_thread",
"sanitize_memory",
"sanitize_fuzzer_no_link",
"sanitize_undefined"
]
},
{
"message": "Code Coverage Instrumentation",

View File

@ -53,6 +53,8 @@ defineTest(qtConfCommandline_sanitize) {
qtConfCommandlineSetInput("sanitize_thread", "yes")
} else: equals(val, "memory") {
qtConfCommandlineSetInput("sanitize_memory", "yes")
} else: equals(val, "fuzzer-no-link") {
qtConfCommandlineSetInput("sanitize_fuzzer_no_link", "yes")
} else: equals(val, "undefined") {
qtConfCommandlineSetInput("sanitize_undefined", "yes")
} else {
@ -92,7 +94,7 @@ defineReplace(qtConfFunc_licenseCheck) {
hasOpenSource = true
else: \
hasOpenSource = false
exists($$QT_SOURCE_TREE/LICENSE.QT-LICENSE-AGREEMENT-4.0): \
exists($$QT_SOURCE_TREE/LICENSE.QT-LICENSE-AGREEMENT): \
hasCommercial = true
else: \
hasCommercial = false
@ -222,7 +224,7 @@ defineReplace(qtConfFunc_licenseCheck) {
affix = either
}
} else {
theLicense = $$cat($$QT_SOURCE_TREE/LICENSE.QT-LICENSE-AGREEMENT-4.0, lines)
theLicense = $$cat($$QT_SOURCE_TREE/LICENSE.QT-LICENSE-AGREEMENT, lines)
theLicense = $$first(theLicense)
showWhat = "Type '?' to view the $${theLicense}."
}
@ -249,7 +251,7 @@ defineReplace(qtConfFunc_licenseCheck) {
} else: equals(val, n)|equals(val, no) {
return(false)
} else: equals(commercial, yes):equals(val, ?) {
licenseFile = $$QT_SOURCE_TREE/LICENSE.QT-LICENSE-AGREEMENT-4.0
licenseFile = $$QT_SOURCE_TREE/LICENSE.QT-LICENSE-AGREEMENT
} else: equals(commercial, no):equals(val, l) {
licenseFile = $$QT_SOURCE_TREE/LICENSE.LGPL3
} else: equals(commercial, no):equals(val, g):$$gpl2Ok {
@ -607,8 +609,11 @@ defineTest(qtConfOutput_prepareOptions) {
qtConfAddNote("Available Android host does not match host architecture.")
}
} else {
!exists($$ndk_tc_pfx/$$ndk_host/*): \
qtConfFatalError("Specified Android NDK host is invalid.")
!exists($$ndk_tc_pfx/$$ndk_host/*) {
err = "Specified Android NDK host '$$ndk_host' is invalid. Expected files in the following directory to exist:"
err += '$${ndk_tc_pfx}/$${ndk_host}/'
qtConfFatalError($$err)
}
}
android_abis = $$eval(config.input.android-abis)
@ -818,6 +823,8 @@ defineTest(qtConfOutput_preparePaths) {
libloc_absolute_path = $$absolute_path($$config.rel_input.libdir, $$config.input.prefix)
}
config.input.liblocation_to_prefix = $$relative_path($$config.input.prefix, $$libloc_absolute_path)
config.qtbase.features.shared.available =
export(config.qtbase.features.shared.available)
hostbindir_absolute_path = $$absolute_path($$config.rel_input.hostbindir, $$config.input.hostprefix)
config.input.hostbindir_to_hostprefix = $$relative_path($$config.input.hostprefix, $$hostbindir_absolute_path)
@ -1218,6 +1225,12 @@ defineReplace(qtConfOutputPostProcess_publicPro) {
"QT_RELEASE_DATE = $$config.input.qt_release_date"
}
wasm: {
qt_emcc_version = $$qtSystemEmccVersion()
output += \
"QT_EMCC_VERSION = $$qt_emcc_version"
}
return($$output)
}
@ -1250,6 +1263,12 @@ defineReplace(qtConfOutputPostProcess_publicHeader) {
!isEmpty(config.input.qt_libinfix): \
output += "$${LITERAL_HASH}define QT_LIBINFIX \"$$eval(config.input.qt_libinfix)\""
wasm: {
qt_emcc_version = $$qtSystemEmccVersion()
output += \
"$${LITERAL_HASH}define QT_EMCC_VERSION \"$$qt_emcc_version\""
}
return($$output)
}
@ -1332,6 +1351,14 @@ defineTest(qtConfReport_buildMode) {
qtConfReportPadded($$1, $$build_mode)
}
defineTest(qtConfReport_emccVersion) {
EMCC_VERSION = $$qtSystemEmccVersion()
REQ_VERSION = $$qtEmccRecommendedVersion()
!equals(EMCC_VERSION, $$REQ_VERSION) {
qtConfAddReport("You should use the recommended Emscripten version $$REQ_VERSION with this Qt. You have $$EMCC_VERSION $$QT_EMCC_VERSION")
}
}
# ensure pristine environment for configuration
discard_from($$[QT_HOST_DATA/get]/mkspecs/qconfig.pri)
discard_from($$[QT_HOST_DATA/get]/mkspecs/qmodule.pri)

69
dist/changes-5.13.2 vendored Normal file
View File

@ -0,0 +1,69 @@
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.
****************************************************************************
* QtCore *
****************************************************************************
- Fixed a bug that made qErrnoWarning() say there was no error when
generating the error message.
- QBitArray:
* Fixed two bugs that caused QBitArrays created using fromBits() not to
compare equal to the equivalent QBitArray created using other methods
if the size was zero or not a multiple of 4. If the size modulus 8 was
5, 6, or 7, the data was actually incorrect.
- QCryptographicHash:
* Fixed a bug that caused the SHA-3 and Keccak algorithms to crash if
passed 256 MB of data or more.
- QObject:
* Fixed a resource leak caused by a race condition if multiple QObjects
were created at the same time, for the first time in an application,
from multiple threads (implies threads not started with QThread).
****************************************************************************
* QtGui *
****************************************************************************
- Text:
* [QTBUG-69546] Fixed a crash bug in
QTextDocument::clearUndoRedoStacks(QTextDocument::UndoStack).
****************************************************************************
* QtSQL *
****************************************************************************
- sqlite:
* Updated to v3.29.0
****************************************************************************
* Platform-Specific Changes *
****************************************************************************
- Linux:
* [QTBUG-61916] Added an environment variable
QT_QPA_PRESERVE_CONSOLE_STATE that can be used to prevent Qt from
altering the tty screen and cursor settings when running with
platforms like linuxfb and eglfs.
- Android:
* [QTBUG-76036] Fixed an issue where menus would not work on 64 bit
builds.

542
dist/changes-5.14.0 vendored Normal file
View File

@ -0,0 +1,542 @@
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.
****************************************************************************
* Important Behavioral Change *
****************************************************************************
- [QTBUG-47644] WrapWord now correctly prefers line breaks between words
in Korean text. WrapAnywhere can still be used to get breaks between
syllables instead.
****************************************************************************
* Potentially Source-Incompatible Changes *
****************************************************************************
- qstringlist.h no longer includes qregexp.h.
- Prefixing Q_NAMESPACE with an export macro may no longer work. Use the
new Q_NAMESPACE_EXPORT macro for that use case.
****************************************************************************
* QtCore *
****************************************************************************
- Added support of deduction guides for QPair
- Added new Qt::SplitBehavior, for use as eventual replacement for
QString::SplitBehavior.
- Added the new Q_NAMESPACE_EXPORT macro. It can be used just like
Q_NAMESPACE to add meta-object information to a namespace; however it
also supports exporting of such information from shared libraries.
- [QTBUG-15234] Qt installations on the host system can now be relocated,
i.e. moved to other directories.
- JSON:
* Added overloads of functions taking key strings as QStringView; in
QJsonObject, QJsonValue and QJsonDocument.
- QAtomicInteger:
* Added loadRelaxed() and storeRelaxed(), to be used as replacements of
load() / store().
- QAtomicPointer:
* Added loadRelaxed() and storeRelaxed(), to be used as replacements of
load() / store().
- QBasicTimer:
* QBasicTimer is now a move-only class. Copying is now deprecated and
will be removed in Qt 6.
* Added swap() member and free function.
- QByteArray::operator[]:
* Detach immediately, instead of deferring until modification via
the returned QByteRef.
* Deprecate reliance on its implicit resizing behavior. Support for
writing past the end of QByteArray shall be removed in a future
version of Qt.
- QCalendar:
* Added QCalendar to support diverse calendars, supported by
implementing QCalendarBackend.
* Added support for Julian and Milankovic calendars. These are enabled
by default, except in bootstrap builds.
* Added support for the Jalali (Persian or Solar Hijri) calendar,
controlled by feature jalalicalendar.
* Added support for the Islamic Civil calendar, controlled by feature
islamiccivilcalendar, with locale data that can be shared with other
implementations, controlled by feature hijricalendar.
- QChar:
* Added FormFeed (FF) special character.
- QCollator:
* Added support for QStringView.
* The default QCollator now uses the system's collation locale, rather
than the system locale itself.
- QDataStream:
* Enumerations can now be serialized through QDataStream without the
need of manually defining streaming operators.
- QDate:
* [QTBUG-64485] Added startOfDay() and endOfDay() methods to provide a
QDateTime at the start and end of a given date, taking account of any
time skipped by transitions, e.g. a DST spring-forward, which can lead
to a day starting at 01:00 or ending just before 23:00.
* Allow choice of calendar in various operations, with Gregorian
remaining the default.
- QDateTime:
* Invalid datetimes are now treated as equal and less than all valid
ones. They could previously be found equal to valid datetimes.
- QDir:
* Remove Windows specific long path markers when handling file paths
with native separators.
- QEasingCurve:
* QEasingCurve now properly streams all the data needed to QDataStream.
- QFileInfo:
* [QTBUG-75869] Introduced QFileInfo::isJunction() to detect NTFS Junctions
on Windows.
- QHash:
* Added range constructor.
- QJsonObject:
* Added insert(), remove(), and take() overloads taking QLatin1String.
- QLatin1Char:
* Comparison against char now works even in QT_NO_CAST_FROM_ASCII
builds.
- QLatin1Literal:
* The undocumented QLatin1Literal type alias for QLatin1String is now
deprecated. Use QLatin1String instead.
- QLatin1String:
* Added indexOf().
* Added contains().
* Added lastIndexOf().
- QLineF:
* added QLineF::intersects() as a replacement for QLineF::intersect()
- QLinkedList:
* Added range constructor.
- QList:
* Added range constructor.
- QLocale:
* The system locale now knows what to use for collation,
QLocale::system().collation().
* The NaN obtained when reading "nan" as a floating-point value is now
quiet rather than signaling.
* The system locale's UI languages list now includes, as for that of an
ordinary locale, the results of adding likely sub-tags from each
locale name, and of removing some, where this doesn't change which
locale is specified. This gives searches for translation files a
better chance of finding a suitable file.
- QMetaObject:
* [QTBUG-38876] Some internal members of the QMetaObject class have
changed types. Those members are not public API and thus should not
cause source incompatibilities.
- QMultiHash:
* Added range constructor.
- QMutex:
* Added QRecursiveMutex as a replacement of QMutex(QMutex::Recursive).
- QPoint/QPointF:
* Added transposed().
- QPointer:
* Added a free swap function.
- QSet:
* Added range constructor.
- QSharedPointer:
* Overloads of qSharedPointerObjectCast have been added to work on
std::shared_ptr.
* The swap overload for QSharedPointer in the std namespace has been
removed; a new overload has been added in the Qt namespace.
- QSize/QSizeF:
* Added grownBy(QMargin(F))/shrunkBy(QMargin(F)).
- QString:
* The behavior of operator[] to allow implicit resizing of the string
has been deprecated, and will be removed in a future version of Qt.
* QString::operator[] detaches immediately. Previously, the detach was
delayed until a modification was made to the string through the
returned QCharRef.
* QString::arg(QString, ..., QString) can now be called with more than
nine arguments, as well as with QStringViews.
- QString/QStringRef:
* The split functions now optionally take Qt::SplitBehavior.
- QStringList:
* Added range constructor.
* Added QStringView overloads of join(), filter(), and
replaceInStrings().
- QStringView:
* Added indexOf().
* Added contains().
* Added lastIndexOf().
* Deprecated the (undocumented) QStringViewLiteral macro. Just use u""
or QStringView(u"") instead.
- QStringView/QLatin1String:
* Added arg(), taking arbitrarily many strings.
- QTextStream:
* The NaN obtained when reading "nan" as a floating-point value is now
quiet rather than signaling.
- QTimeZone:
* [QTBUG-75565] The TZDB back-end now recognizes the contents of /etc/TZ
as a fall-back for $TZ (as used by uClibc).
- QVarLengthArray:
* Added range constructor.
* Added a qHash overload.
- QVariant:
* Fixed a bug that caused isNull() to be true after downcasting a
QObject* payload using convert().
- QVector:
* Added range constructor.
- QWeakPointer:
* The data() function has been deprecated.
* A swap overload has been added.
- QtGlobal:
* Add new macros QT_DEPRECATED_VERSION and QT_DEPRECATED_VERSION_X to
conditionally display deprecation warnings
* Added qExchange(), a drop-in for C++14's std::exchange()
- Windows:
* QSysInfo::prettyProductName() now returns a version including the
Windows 10 release id or Windows 7 build number respectively,
resembling the version string displayed by the winver tool.
****************************************************************************
* QtDBus *
****************************************************************************
- QDBusAbstractInterface:
* The call() and asyncCall() methods now accept more than eight QVariant
arguments.
- QDBusObjectPath:
* Added explicit cast operator to QVariant.
****************************************************************************
* QtGui *
****************************************************************************
- QColor:
* Added QColorConstants, a namespace containing constexpr QColor
instances.
- A QColorSpace class has been added, and color spaces are now parsed from
PNG and JPEG images. No automatic color space conversion is done
however, and applications must request it.
- Added support for filtering Vulkan debug messages in QVulkanInstance.
This is especially useful for processing or suppressing messages from
the validation layers.
- Obsolete constructors and accessors in QWheelEvent now have proper
deprecation macros, and are no longer in use in any Qt modules.
What is left is intended to be compatible with planned changes in Qt 6.
- QFont:
* [QTBUG-77908] Fixed kerning error with certain fonts.
* [QTBUG-76239] Fixed an issue where application fonts would be parsed
multiple times, causing some unnecessary overhead when during
application startup.
* [QTBUG-46322] Resolving a font that just has a family set with
families set will prepend the family to the families so that it is
still the first preference for the font.
- QImage:
* [QTBUG-42540], [QTBUG-68787] Loading of image files having a file
name suffix for a different image file type has been
fixed. QImageReader will now ask the suffix format handler to
confirm the file contents (canRead()), and fall back to normal
file content recognition on failure. This implies a slight
behavior change in QImageReader::loopCount(), ::imageCount() and
::nextImageDelay(): For an unreadable file with a recognized
suffix, they would earlier return 0, while they now will
return -1, i.e. error, as per the documentation.
- QPainter:
* HighQualityAntialiasing and NonCosmeticDefaultPen are marked as
deprecated and don't have an effect anymore
- QTextDocument:
* [QTBUG-36152] CSS styling of table cell borders (styling <td> and <th>
elements) is now supported during HTML import and export, including
border-color, border-width and border-style. Setting the table's
border-width to a value >= 1 and enabling border-collapse will now draw
a simple, clean table grid (1px) with an outer border of the specified
width and color. A manual test was added, which allows editing HTML
with live preview.
* [QTBUG-43589] Fixed incorrect rounding of widths of variable-width
columns in tables, to avoid border drawing artifacts.
* [QTBUG-78318] QTextFrameFormat margins, padding and borders are now
scaled to device coordinates, and thus correctly sized on high-dpi
displays and printers.
* Markdown (CommonMark or GitHub dialect) is now a supported format for
reading into and writing from QTextDocument, via the setMarkdown() and
toMarkdown() functions. We do not guarantee that every markdown
document can be re-written exactly as it was read; but that does work
in many cases, and it's OK to report bugs about cases that don't work.
- Touch:
* [QTBUG-77142] When a stationary touchpoint contains some "interesting"
property change (pressure or velocity, so far), it is delivered normally.
****************************************************************************
* QtNetwork *
****************************************************************************
- QAuthenticator:
* [QTBUG-4117] Add support for SPNEGO/Negotiate
- QHostInfo:
* Added move contructor.
- QNetworkAccessManager:
* [QTBUG-69477] Don't fail when FTP does not implement the HELP command.
* Added setAutoDeleteReplies to QNetworkAccessManager to enable the
AutoDeleteReplyOnFinishAttribute attribute for all QNetworkRequests
that are passed to QNetworkAccessManager.
- QNetworkRequest:
* Added the AutoDeleteReplyOnFinishAttribute attribute to
QNetworkRequest, which makes QNetworkAccessManager delete the
QNetworkReply after it has emitted the "finished" signal.
* Add an ability to configure HTTP/2 protocol
- QSslKey:
* Key data is cleared as soon as possible when move-assigning.
- QSslSocket:
* [QTBUG-72016] Added runtime validation of the SSL private key when it
is loaded through a file path.
****************************************************************************
* QtSql *
****************************************************************************
- QPSQL:
* [QTBUG-79033][QTBUG-79064] added support for PostgreSQL 12
- QSqlite:
* Updated to v3.30.1
- QSqlite2:
* Marked QSQLITE2 plugin as obsolete - it will be removed with Qt6
together with the QTDS plugin
****************************************************************************
* QtTestLib *
****************************************************************************
- Comparison of QImage, QPixmap now checks for the device pixel ratio.
- It is now possible to perform static initialization before QApplication
instantiation by implementing a initMain() function in the test class.
****************************************************************************
* QtWidgets *
****************************************************************************
- QActionGroup:
* Added new exclusionPolicy property. Set it to ExclusiveOptional to
allow unchecking the active checkable action in an exclusive group.
- QCalendarWidget:
* Allow choice of calendar, with Gregorian remaining the default.
- QComboBox:
* Two new signals textHighlighted() and textActivated() were added to
replace highlighted()/activated() QString overloads.
- QDateTimeEdit:
* Allow choice of calendar, with Gregorian remaining the default.
- QFileDialog:
* The widgets-based dialog now remembers the selected files when
navigating the history.
- QFormLayout:
* Honor the vertical expanding state of a widget inside a QFormLayout.
- QGraphicsWidget:
* Added QMarginsF overloads of setContentsMargins() and
setWindowFrameMargins().
- QGroupBox:
* [QTBUG-259389 Always disable children of a checkable, unchecked group
box before showing.
- QLabel:
* Markdown is now a supported textFormat for QLabel.
- QLayout:
* Prevent clipping of group box titles on macOS (and similar styles that
draw into layout margins)
- QLineEdit:
* Behavior change: now the editingFinished signal is emitted only once
after the line edit content was edited.
* The getTextMargins() member function has been deprecated in favor of
textMargins().
- QStyle:
* Style sheets now only use the part of the stylesheet font that it
knows about. The remaining will be resolved/inherited from the
context.
- QTextBrowser:
* Markdown is now a supported format. QTextBrowser::setSource() detects
the common file extensions (.md, .mkd and .markdown). In case it
cannot be detected that way, setSource() now takes an optional
ResourceType enum argument so that the type can be overridden.
QTextBrowser inherits all the QTextEdit features: if readOnly is set
to false, the user can perform the editing operations that QTextEdit
allows. If readOnly is set to true (the default), the user can click
Markdown hyperlinks to emit the anchorClicked() signal, as with HTML.
- QTextEdit:
* [QTBUG-75931] Added support for copy-pasting foreground brushes with
textures within same document.
* Markdown (CommonMark or GitHub dialect) is now a supported format,
via the markdown property. GitHub dialect is the default, and supports
all features such as hyperlinks, images, tables, lists, checklists, etc.
* If the text was loaded from a Markdown document that contains checkboxes,
the user can click on them to toggle the states. The cursor changes to
PointingHandCursor when the mouse is hovering over a checkbox.
- QTreeView:
* Don't emit clicked signal after a doubleClicked signal.
- QWidget:
* The getContentsMargins() member function has been deprecated in favor
of contentsMargins().
****************************************************************************
* Platform Specific Changes *
****************************************************************************
- Android
* Fixed an issue where an application installation would be irrecoverably
broken if power loss or a crash occurred during its first initialization
run.
* Make it easy to run Qt tests on Android. "$ make check" is all that's
needed to run a test on an Android device.
* Remove ant support from androiddeployqt
* Introduce "make apk" target, an easy way to create an apk.
* Android depends on NDK r20+
* Android multi arch build in one go, needed to support the new .aab
packaging format.
* -android-abis configure script parameter useful to compile Qt only for a
selected Android ABIs.
* Instead of bundling QML resources in assets and extracting them on first
start, Qt now creates an .rcc file and register it before invoking the
main function.
* Fixed regression that made it impossible for an application to use the
tap-and-hold gesture.
- Linux:
* Added a device spec for Raspberry Pi 4 (32-bit, V3D)
* Added a device spec for 64-bit i.MX8 systems (Vivante graphics stack)
- MinGW:
* [QTBUG-4155] Added a suffix to debug mode pkgconfig files.
- macOS:
* The drawableSize of Metal layers is no longer updated automatically on
window resize or screen change. Update the size manually in response to
resizeEvent(), or at the start of each frame, as needed.
- Mir:
* The Mir platform plugin has been removed: use the Wayland plugin when
connecting to a Mir display server.
- Windows:
* It is now possible to enable RTL mode by passing the option -platform
windows:reverse.
* [QTBUG-74748] Fixed a bug where it would be impossible to
request different faces of a font family after a specific type face
has been in use.
****************************************************************************
* Third-Party Code *
****************************************************************************
- Upgraded bundled Freetype version to 2.10.1.
- Build sqlite without SQLITE_OMIT_LOAD_EXTENSION
- Qt Gui: Added md4c markdown parser to src/3rdparty/md4c (MIT licensed).
- [QTBUG-79418] Updated double-conversion code to upstream version 3.1.5.
- [QTBUG-79420] libjpeg-turbo was updated to version 2.0.3
- [QTBUG-79418] Updated DNS public suffix list
****************************************************************************
* Tools *
****************************************************************************
- rcc:
* Added -d option to generate a dependency file.
* Added support for Python as output format.
****************************************************************************
* configure *
****************************************************************************
- Added the configure option -qtlibinfix-plugins to rename plugins
according to QT_LIBINFIX. This option is off by default.
****************************************************************************
* CMake *
****************************************************************************
- [QTBUG-38913][QTBUG-76562] Added ability to auto-import non-qml plugins
on CMake builds
****************************************************************************
* qmake *
****************************************************************************
- Installation targets do not ignore the exit code of QINSTALL and
QINSTALL_PROGRAM anymore.
- Introduced the variables LEX_DIR and YACC_DIR which determine the
location of lex/yacc output. Fixed parallel execution of lex/yacc for
debug_and_release builds.
- The syntax 'LIBS += -frameworkFoo', or 'LIBS += "-framework Foo"' is no
longer supported. Use the canonical 'LIBS += -framework Foo' instead.
- Fixed precompiled headers for the Clang compiler.
- Android:
* Remove gcc-style PCH directives from the android-clang mkspec.

View File

@ -3,7 +3,7 @@
dita.metadata.default.author = Qt Project
dita.metadata.default.permissions = all
dita.metadata.default.publisher = Qt Project
dita.metadata.default.copyryear = 2019
dita.metadata.default.copyryear = 2020
dita.metadata.default.copyrholder = The Qt Company Ltd
dita.metadata.default.audience = programmer

View File

@ -78,7 +78,7 @@ HTML.footer += \
" <ul id=\"menu-footer-submenu\" class=\"right clearfix\"><li id=\"menu-item-1795\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-1795\"><a title=\"Sign into your account.\" href=\"https://account.qt.io/login\">Sign In</a></li>\n" \
" <li id=\"menu-item-10375\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-10375\"><a href=\"mailto:feedback@theqtcompany.com?Subject=Feedback%20about%20doc.qt.io%20site\">Feedback</a></li>\n" \
" <li id=\"menu-item-1494\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1494\"><a href=\"http://qt.io/contact-us/\">Contact us</a></li>\n" \
" <li id=\"menu-item-4472\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-4472\"><a href=\"http://qt.io/about-us/\">© 2019 The Qt Company</a></li>\n" \
" <li id=\"menu-item-4472\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-4472\"><a href=\"http://qt.io/about-us/\">© 2020 The Qt Company</a></li>\n" \
" </ul>\n" \
"</div>\n" \
"</div>\n" \

View File

@ -8,7 +8,7 @@ HTML.footer = \
"</div>\n" \
"<div class=\"footer\">\n" \
" <p>\n" \
" <acronym title=\"Copyright\">&copy;</acronym> 2019 The Qt Company Ltd.\n" \
" <acronym title=\"Copyright\">&copy;</acronym> 2020 The Qt Company Ltd.\n" \
" Documentation contributions included herein are the copyrights of\n" \
" their respective owners.<br/>" \
" The documentation provided herein is licensed under the terms of the" \

View File

@ -0,0 +1,129 @@
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** 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.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
//! [displayName]
Returns a localized display name for the given location \a type
or an empty QString if no relevant location can be found.
//! [displayName]
//! [findExecutable]
Finds the executable named \a executableName in the specified
\a paths, or the system paths if paths is empty.
On most operating systems the system path is determined by the
\c PATH environment variable. The directories where to search for
the executable can be set in the paths argument. To search in
both your own paths and the system paths, call findExecutable
twice, once with paths set and once with paths empty.
Symlinks are not resolved in order to preserve behavior for the
case of executables whose behavior depends on the name they are
invoked with
.
\note On Windows, the usual executable extensions (from the PATHEXT
environment variable) are automatically appended. For example, the
findExecutable("foo") call finds \c foo.exe or \c foo.bat if
present.
Returns the absolute file path to the executable, or an empty
string if not found.
//! [findExecutable]
//! [locate]
Finds a file or directory called \a fileName in the standard
locations for \a type.
The \a options flag lets you specify whether to look for files
or directories. By default, this flag is set to \c LocateFile.
Returns the absolute path to the first file or directory found,
otherwise returns an empty string.
//! [locate]
//! [locateAll]
Finds all files or directories by the name, \a fileName, in the
standard locations for \a type.
The \a options flag lets you specify whether to look for files
or directories. By default, this flag is set to \c LocateFile.
Returns the list of all the files that were found.
//! [locateAll]
//! [setTestModeEnabled]
If \a testMode is \c true, this enables a special "test mode" in
QStandardPaths, which changes writable locations to point to
test directories. This prevents auto tests from reading
or writing to the current user's configuration.
It affects the locations into which test programs might write
files: \c GenericDataLocation, \c DataLocation, \c ConfigLocation,
\c GenericConfigLocation, \c AppConfigLocation,
\c GenericCacheLocation, and \c CacheLocation. Other locations
are not affected.
On Unix, \c XDG_DATA_HOME is set to \c{~/.qttest/share},
\c XDG_CONFIG_HOME is set to \c{~/.qttest/config}, and
\c XDG_CACHE_HOME is set to \c{~/.qttest/cache}.
On macOS, data goes to \c{~/.qttest/Application Support},
cache goes to \c{~/.qttest/Cache}, and config goes to
\c{~/.qttest/Preferences}.
On Windows, everything goes to a "qttest" directory under
\c{%APPDATA%}.
//! [setTestModeEnabled]
//! [standardLocations]
Returns all the directories where files of \a type belong.
The list of directories is sorted from high to low priority,
starting with writableLocation() if it can be determined.
This list is empty if no locations for type are defined.
//! [standardLocations]
//! [writableLocation]
Returns the directory where files of \a type should be written to,
or an empty string if the location cannot be determined.
\note The storage location returned may not exist; that is,
it may need to be created by the system or the user.
//! [writableLocation]

View File

@ -24,8 +24,10 @@ macro.QtVersion = "$QT_VERSION"
macro.QtVer = "$QT_VER"
macro.param = "\\e"
macro.raisedaster.HTML = "<sup>*</sup>"
macro.raisedaster.DocBook = "\\sup{*}"
macro.rarrow.HTML = "&rarr;"
macro.reg.HTML = "<sup>&reg;</sup>"
macro.rego.DocBook = "\\sup{&#174;}"
macro.return = "Returns"
macro.starslash = "\\c{*/}"
macro.begincomment = "\\c{/*}"

View File

@ -5,7 +5,7 @@
HTML.footer = \
" </div>\n" \
" <p class=\"copy-notice\">\n" \
" <acronym title=\"Copyright\">&copy;</acronym> 2019 The Qt Company Ltd.\n" \
" <acronym title=\"Copyright\">&copy;</acronym> 2020 The Qt Company Ltd.\n" \
" Documentation contributions included herein are the copyrights of\n" \
" their respective owners. " \
" The documentation provided herein is licensed under the terms of the" \

View File

@ -0,0 +1,54 @@
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** 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.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/
/*!
\page portingguide.html
\title Porting Qt5 to Qt6 Guide
\brief Provides guidance to migrate your Qt 5 application to Qt 6.
Qt 6 is a result of the conscious effort to make this C++ framework more
efficient and easy to use. This release replaces quite a few legacy APIs with
more meaningful ones, such as the newer version of Qt Quick.
We try to maintain binary and source compatibility for all the public APIs in
each release, but some changes were inevitable in an effort to make Qt a
better framework. In this topic, we try to summarize those changes and
provide guidance to handle them.
The following list summarizes the changes in Qt 6:
\list
\li The major version number.
\endlist
\section1 Related Topics
\list
\li \l {C++ API Changes}
\li \l {Porting C++ Applications to Qt 6}
\li \l {Porting QML Applications to Qt 6}
\li \l {Porting QML Applications to Qt 6 Example}
\endlist
*/

View File

@ -95,7 +95,7 @@ QVariant MimetypeModel::data(const QModelIndex &index, int role) const
if (role != Qt::DecorationRole || !index.isValid() || index.data(iconQueriedRole).toBool())
return QStandardItemModel::data(index, role);
QStandardItem *item = itemFromIndex(index);
const QString iconName = item->data(mimeTypeRole).value<QMimeType>().iconName();
const QString iconName = qvariant_cast<QMimeType>(item->data(mimeTypeRole)).iconName();
if (!iconName.isEmpty())
item->setIcon(QIcon::fromTheme(iconName));
item->setData(QVariant(true), iconQueriedRole);
@ -104,7 +104,7 @@ QVariant MimetypeModel::data(const QModelIndex &index, int role) const
QMimeType MimetypeModel::mimeType(const QModelIndex &index) const
{
return index.data(mimeTypeRole).value<QMimeType>();
return qvariant_cast<QMimeType>(index.data(mimeTypeRole));
}
void MimetypeModel::populate()

View File

@ -144,7 +144,7 @@ static QCborValue convertFromVariant(const QVariant &v, TrimFloatingPoint fpTrim
}
if (v.userType() == qMetaTypeId<VariantOrderedMap>()) {
const auto m = v.value<VariantOrderedMap>();
const auto m = qvariant_cast<VariantOrderedMap>(v);
QCborMap map;
for (const auto &pair : m)
map.insert(convertFromVariant(pair.first, fpTrimming),

View File

@ -98,7 +98,7 @@ static QString dumpVariant(const QVariant &v, const QString &indent = QLatin1Str
int type = v.userType();
if (type == qMetaTypeId<VariantOrderedMap>() || type == QVariant::Map) {
const auto map = (type == QVariant::Map) ?
VariantOrderedMap(v.toMap()) : v.value<VariantOrderedMap>();
VariantOrderedMap(v.toMap()) : qvariant_cast<VariantOrderedMap>(v);
result = QLatin1String("Map {");
for (const auto &pair : map) {

View File

@ -57,7 +57,6 @@
#include <QJsonValue>
static JsonConverter jsonConverter;
static BinaryJsonConverter BinaryJsonConverter;
static const char optionHelp[] =
"compact=no|yes Use compact JSON form.\n";
@ -151,62 +150,3 @@ void JsonConverter::saveFile(QIODevice *f, const QVariant &contents, const QStri
f->write(convertFromVariant(contents).toJson(format));
}
QString BinaryJsonConverter::name()
{
return "binary-json";
}
Converter::Direction BinaryJsonConverter::directions()
{
return InOut;
}
Converter::Options BinaryJsonConverter::outputOptions()
{
return {};
}
const char *BinaryJsonConverter::optionsHelp()
{
return nullptr;
}
bool BinaryJsonConverter::probeFile(QIODevice *f)
{
return f->isReadable() && f->peek(4) == "qbjs";
}
QVariant BinaryJsonConverter::loadFile(QIODevice *f, Converter *&outputConverter)
{
if (!outputConverter)
outputConverter = &jsonConverter;
QJsonDocument doc;
if (auto file = qobject_cast<QFile *>(f)) {
uchar *ptr = file->map(0, file->size());
if (ptr)
doc = QJsonDocument::fromRawData(reinterpret_cast<char *>(ptr), file->size());
}
if (doc.isNull())
doc = QJsonDocument::fromBinaryData(f->readAll());
if (!doc.isObject() && !doc.isArray()) {
fprintf(stderr, "Failed to load Binary JSON.\n");
exit(EXIT_FAILURE);
}
if (outputConverter == null)
return QVariant();
return doc.toVariant();
}
void BinaryJsonConverter::saveFile(QIODevice *f, const QVariant &contents, const QStringList &options)
{
if (!options.isEmpty()) {
fprintf(stderr, "Unknown option '%s' to JSON output. This format has no options.\n", qPrintable(options.first()));
exit(EXIT_FAILURE);
}
f->write(convertFromVariant(contents).toBinaryData());
}

View File

@ -69,17 +69,4 @@ public:
void saveFile(QIODevice *f, const QVariant &contents, const QStringList &options) override;
};
class BinaryJsonConverter : public Converter
{
// Converter interface
public:
QString name() override;
Direction directions() override;
Options outputOptions() override;
const char *optionsHelp() override;
bool probeFile(QIODevice *f) override;
QVariant loadFile(QIODevice *f, Converter *&outputConverter) override;
void saveFile(QIODevice *f, const QVariant &contents, const QStringList &options) override;
};
#endif // JSONCONVERTER_H

View File

@ -336,7 +336,7 @@ static void variantToXml(QXmlStreamWriter &xml, const QVariant &v)
} else if (type == QVariant::Map || type == qMetaTypeId<VariantOrderedMap>()) {
const VariantOrderedMap map = (type == QVariant::Map) ?
VariantOrderedMap(v.toMap()) :
v.value<VariantOrderedMap>();
qvariant_cast<VariantOrderedMap>(v);
xml.writeStartElement("map");
for (const auto &pair : map) {
@ -425,10 +425,10 @@ static void variantToXml(QXmlStreamWriter &xml, const QVariant &v)
default:
if (type == qMetaTypeId<qfloat16>()) {
xml.writeAttribute(typeString, "number");
xml.writeCharacters(QString::number(float(v.value<qfloat16>())));
xml.writeCharacters(QString::number(float(qvariant_cast<qfloat16>(v))));
} else if (type == qMetaTypeId<QCborSimpleType>()) {
xml.writeAttribute(typeString, "CBOR simple type");
xml.writeCharacters(QString::number(int(v.value<QCborSimpleType>())));
xml.writeCharacters(QString::number(int(qvariant_cast<QCborSimpleType>(v))));
} else {
// does this convert to string?
const char *typeName = v.typeName();

View File

@ -37,8 +37,8 @@
game generally involves serializing each game object's member variables
to a file. Many formats can be used for this purpose, one of which is JSON.
With QJsonDocument, you also have the ability to serialize a document in a
binary format, which is great if you don't want the save file to be
readable, or if you need to keep the file size down.
\l {https://tools.ietf.org/html/rfc7049} {CBOR} format, which is great if you
don't want the save file to be readable, or if you need to keep the file size down.
In this example, we'll demonstrate how to save and load a simple game to
and from JSON and binary formats.
@ -133,7 +133,7 @@
When loading a saved game in loadGame(), the first thing we do is open the
save file based on which format it was saved to; \c "save.json" for JSON,
and \c "save.dat" for binary. We print a warning and return \c false if the
and \c "save.dat" for CBOR. We print a warning and return \c false if the
file couldn't be opened.
Since QJsonDocument's \l{QJsonDocument::fromJson()}{fromJson()} and
@ -172,7 +172,7 @@
\snippet serialization/savegame/main.cpp 1
When the player has finished, we save their game. For demonstration
purposes, we can serialize to either JSON or binary. You can examine the
purposes, we can serialize to either JSON or CBOR. You can examine the
contents of the files in the same directory as the executable (or re-run
the example, making sure to also specify the "load" option), although the
binary save file will contain some garbage characters (which is normal).

View File

@ -50,6 +50,8 @@
#include "game.h"
#include <QCborMap>
#include <QCborValue>
#include <QFile>
#include <QJsonArray>
#include <QJsonDocument>
@ -122,14 +124,14 @@ bool Game::loadGame(Game::SaveFormat saveFormat)
QJsonDocument loadDoc(saveFormat == Json
? QJsonDocument::fromJson(saveData)
: QJsonDocument::fromBinaryData(saveData));
: QJsonDocument(QCborValue::fromCbor(saveData).toMap().toJsonObject()));
read(loadDoc.object());
QTextStream(stdout) << "Loaded save for "
<< loadDoc["player"]["name"].toString()
<< " using "
<< (saveFormat != Json ? "binary " : "") << "JSON...\n";
<< (saveFormat != Json ? "CBOR" : "JSON") << "...\n";
return true;
}
//! [3]
@ -148,10 +150,9 @@ bool Game::saveGame(Game::SaveFormat saveFormat) const
QJsonObject gameObject;
write(gameObject);
QJsonDocument saveDoc(gameObject);
saveFile.write(saveFormat == Json
? saveDoc.toJson()
: saveDoc.toBinaryData());
? QJsonDocument(gameObject).toJson()
: QCborValue::fromJsonValue(gameObject).toCbor());
return true;
}

View File

@ -238,8 +238,7 @@
\snippet threads/mandelbrot/mandelbrotwidget.cpp 1
The interesting part of the constructor is the
qRegisterMetaType() and QObject::connect() calls. Let's start
with the \l{QObject::connect()}{connect()} call.
QObject::connect() call.
Although it looks like a standard signal-slot connection between
two \l{QObject}s, because the signal is emitted in a different
@ -254,9 +253,10 @@
With queued connections, Qt must store a copy of the arguments
that were passed to the signal so that it can pass them to the
slot later on. Qt knows how to take of copy of many C++ and Qt
types, but QImage isn't one of them. We must therefore call the
template function qRegisterMetaType() before we can use QImage
as a parameter in queued connections.
types, so, no further action is needed for QImage.
If a custom type was used, a call to the template function
qRegisterMetaType() would be required before the type
could be used as a parameter in queued connections.
\snippet threads/mandelbrot/mandelbrotwidget.cpp 2
\snippet threads/mandelbrot/mandelbrotwidget.cpp 3

View File

@ -74,7 +74,7 @@ int main(int argc, char *argv[])
qDebug() << "Stored:" << stored;
//! [retrieving a custom value]
Message retrieved = stored.value<Message>();
Message retrieved = qvariant_cast<Message>(stored);
qDebug() << "Retrieved:" << retrieved;
retrieved = qvariant_cast<Message>(stored);
qDebug() << "Retrieved:" << retrieved;

View File

@ -144,7 +144,7 @@ public:
private slots:
void handleNetworkData(QNetworkReply *networkReply) {
if (!networkReply->error()) {
if (!networkReply->networkError()) {
if (!mapReplies.contains(networkReply)) {
// Assume UTF-8 encoded
QByteArray data = networkReply->readAll();

View File

@ -162,7 +162,7 @@ void SlippyMap::handleNetworkData(QNetworkReply *reply)
{
QImage img;
QPoint tp = reply->request().attribute(QNetworkRequest::User).toPoint();
if (!reply->error())
if (!reply->networkError())
if (!img.load(reply, 0))
img = QImage();
reply->deleteLater();

View File

@ -80,34 +80,37 @@ BearerMonitor::BearerMonitor(QWidget *parent)
break;
}
}
connect(&manager, SIGNAL(onlineStateChanged(bool)), this ,SLOT(onlineStateChanged(bool)));
connect(&manager, SIGNAL(configurationAdded(const QNetworkConfiguration&)),
this, SLOT(configurationAdded(const QNetworkConfiguration&)));
connect(&manager, SIGNAL(configurationRemoved(const QNetworkConfiguration&)),
this, SLOT(configurationRemoved(const QNetworkConfiguration&)));
connect(&manager, SIGNAL(configurationChanged(const QNetworkConfiguration&)),
this, SLOT(configurationChanged(const QNetworkConfiguration)));
connect(&manager, SIGNAL(updateCompleted()), this, SLOT(updateConfigurations()));
connect(&manager, &QNetworkConfigurationManager::onlineStateChanged,
this, &BearerMonitor::onlineStateChanged);
connect(&manager, &QNetworkConfigurationManager::configurationAdded,
this, [this](const QNetworkConfiguration &config) { configurationAdded(config); });
connect(&manager, &QNetworkConfigurationManager::configurationRemoved,
this, &BearerMonitor::configurationRemoved);
connect(&manager, &QNetworkConfigurationManager::configurationChanged,
this, &BearerMonitor::configurationChanged);
connect(&manager, &QNetworkConfigurationManager::updateCompleted,
this, &BearerMonitor::updateConfigurations);
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
connect(registerButton, SIGNAL(clicked()), this, SLOT(registerNetwork()));
connect(unregisterButton, SIGNAL(clicked()), this, SLOT(unregisterNetwork()));
connect(registerButton, &QPushButton::clicked,
this, &BearerMonitor::registerNetwork);
connect(unregisterButton, &QPushButton::clicked,
this, &BearerMonitor::unregisterNetwork);
#else // Q_OS_WIN && !Q_OS_WINRT
nlaGroup->hide();
#endif
connect(treeWidget, SIGNAL(itemActivated(QTreeWidgetItem*,int)),
this, SLOT(createSessionFor(QTreeWidgetItem*)));
connect(treeWidget, &QTreeWidget::itemActivated,
this, &BearerMonitor::createSessionFor);
connect(treeWidget, &QTreeWidget::currentItemChanged,
this, &BearerMonitor::showConfigurationFor);
connect(treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
this, SLOT(showConfigurationFor(QTreeWidgetItem*)));
connect(newSessionButton, SIGNAL(clicked()),
this, SLOT(createNewSession()));
connect(deleteSessionButton, SIGNAL(clicked()),
this, SLOT(deleteSession()));
connect(scanButton, SIGNAL(clicked()),
this, SLOT(performScan()));
connect(newSessionButton, &QPushButton::clicked,
this, &BearerMonitor::createNewSession);
connect(deleteSessionButton, &QPushButton::clicked,
this, &BearerMonitor::deleteSession);
connect(scanButton, &QPushButton::clicked,
this, &BearerMonitor::performScan);
// Just in case update all configurations so that all
// configurations are up to date.
@ -124,7 +127,7 @@ static void updateItem(QTreeWidgetItem *item, const QNetworkConfiguration &confi
item->setData(0, Qt::UserRole, config.identifier());
QFont font = item->font(1);
font.setBold((config.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active);
font.setBold(config.state().testFlag(QNetworkConfiguration::Active));
item->setFont(0, font);
}
@ -333,8 +336,6 @@ void BearerMonitor::showConfigurationFor(QTreeWidgetItem *item)
case QNetworkConfiguration::Undefined:
configurationState->setText(tr("Undefined"));
break;
default:
configurationState->setText(QString());
}
switch (conf.type()) {
@ -350,8 +351,6 @@ void BearerMonitor::showConfigurationFor(QTreeWidgetItem *item)
case QNetworkConfiguration::Invalid:
configurationType->setText(tr("Invalid"));
break;
default:
configurationType->setText(QString());
}
switch (conf.purpose()) {
@ -367,8 +366,6 @@ void BearerMonitor::showConfigurationFor(QTreeWidgetItem *item)
case QNetworkConfiguration::ServiceSpecificPurpose:
configurationPurpose->setText(tr("Service Specific"));
break;
default:
configurationPurpose->setText(QString());
}
configurationIdentifier->setText(conf.identifier());

View File

@ -51,8 +51,7 @@
#ifndef BEARERMONITOR_H
#define BEARERMONITOR_H
#include <qnetworkconfigmanager.h>
#include <qnetworksession.h>
#include <QNetworkConfigurationManager>
#include "ui_bearermonitor_640_480.h"
QT_USE_NAMESPACE
@ -64,11 +63,11 @@ class BearerMonitor : public QWidget, public Ui_BearerMonitor
Q_OBJECT
public:
BearerMonitor(QWidget *parent = 0);
BearerMonitor(QWidget *parent = nullptr);
~BearerMonitor();
private slots:
void configurationAdded(const QNetworkConfiguration &config, QTreeWidgetItem *parent = 0);
void configurationAdded(const QNetworkConfiguration &config, QTreeWidgetItem *parent = nullptr);
void configurationRemoved(const QNetworkConfiguration &config);
void configurationChanged(const QNetworkConfiguration &config);
void updateSnapConfiguration(QTreeWidgetItem *parent, const QNetworkConfiguration &snap);
@ -90,7 +89,7 @@ private slots:
private:
QNetworkConfigurationManager manager;
QList<SessionWidget *> sessionWidgets;
QVector<SessionWidget *> sessionWidgets;
};
#endif //BEARERMONITOR_H

View File

@ -48,8 +48,8 @@
**
****************************************************************************/
#include <QtWidgets/QApplication>
#include <QtWidgets/QMainWindow>
#include <QApplication>
#include <QMainWindow>
#include "bearermonitor.h"

View File

@ -49,10 +49,10 @@
****************************************************************************/
#include "sessionwidget.h"
#include "qnetworkconfigmanager.h"
#include <QNetworkConfigurationManager>
SessionWidget::SessionWidget(const QNetworkConfiguration &config, QWidget *parent)
: QWidget(parent), statsTimer(-1)
: QWidget(parent)
{
setupUi(this);
@ -65,10 +65,10 @@ SessionWidget::SessionWidget(const QNetworkConfiguration &config, QWidget *paren
session = new QNetworkSession(config, this);
connect(session, SIGNAL(stateChanged(QNetworkSession::State)),
this, SLOT(updateSession()));
connect(session, SIGNAL(error(QNetworkSession::SessionError)),
this, SLOT(updateSessionError(QNetworkSession::SessionError)));
connect(session, &QNetworkSession::stateChanged,
this, &SessionWidget::updateSession);
connect(session, QOverload<QNetworkSession::SessionError>::of(&QNetworkSession::error),
this, &SessionWidget::updateSessionError);
updateSession();
@ -76,14 +76,14 @@ SessionWidget::SessionWidget(const QNetworkConfiguration &config, QWidget *paren
configuration->setText(session->configuration().name());
connect(openSessionButton, SIGNAL(clicked()),
this, SLOT(openSession()));
connect(openSyncSessionButton, SIGNAL(clicked()),
this, SLOT(openSyncSession()));
connect(closeSessionButton, SIGNAL(clicked()),
this, SLOT(closeSession()));
connect(stopSessionButton, SIGNAL(clicked()),
this, SLOT(stopSession()));
connect(openSessionButton, &QPushButton::clicked,
this, &SessionWidget::openSession);
connect(openSyncSessionButton, &QPushButton::clicked,
this, &SessionWidget::openSyncSession);
connect(closeSessionButton, &QPushButton::clicked,
this, &SessionWidget::closeSession);
connect(stopSessionButton, &QPushButton::clicked,
this, &SessionWidget::stopSession);
}
SessionWidget::~SessionWidget()

View File

@ -51,7 +51,7 @@
#ifndef SESSIONWIDGET_H
#define SESSIONWIDGET_H
#include <qnetworksession.h>
#include <QNetworkSession>
#include "ui_sessionwidget.h"
@ -62,10 +62,10 @@ class SessionWidget : public QWidget, public Ui_SessionWidget
Q_OBJECT
public:
explicit SessionWidget(const QNetworkConfiguration &config, QWidget *parent = 0);
explicit SessionWidget(const QNetworkConfiguration &config, QWidget *parent = nullptr);
~SessionWidget();
void timerEvent(QTimerEvent *) override;
void timerEvent(QTimerEvent *e) override;
private:
void updateSessionState(QNetworkSession::State state);
@ -80,8 +80,8 @@ private Q_SLOTS:
void updateSessionError(QNetworkSession::SessionError error);
private:
QNetworkSession *session;
int statsTimer;
QNetworkSession *session = nullptr;
int statsTimer = -1;
};
#endif

View File

@ -96,20 +96,21 @@ BlockingClient::BlockingClient(QWidget *parent)
buttonBox->addButton(getFortuneButton, QDialogButtonBox::ActionRole);
buttonBox->addButton(quitButton, QDialogButtonBox::RejectRole);
connect(getFortuneButton, SIGNAL(clicked()), this, SLOT(requestNewFortune()));
connect(quitButton, SIGNAL(clicked()), this, SLOT(close()));
connect(getFortuneButton, &QPushButton::clicked,
this, &BlockingClient::requestNewFortune);
connect(quitButton, &QPushButton::clicked,
this, &BlockingClient::close);
connect(hostLineEdit, SIGNAL(textChanged(QString)),
this, SLOT(enableGetFortuneButton()));
connect(portLineEdit, SIGNAL(textChanged(QString)),
this, SLOT(enableGetFortuneButton()));
connect(hostLineEdit, &QLineEdit::textChanged,
this, &BlockingClient::enableGetFortuneButton);
connect(portLineEdit, &QLineEdit::textChanged,
this, &BlockingClient::enableGetFortuneButton);
//! [0]
connect(&thread, &FortuneThread::newFortune,
this, &BlockingClient::showFortune);
connect(&thread, &FortuneThread::error,
this, &BlockingClient::displayError);
//! [0]
connect(&thread, SIGNAL(newFortune(QString)),
this, SLOT(showFortune(QString)));
//! [0] //! [1]
connect(&thread, SIGNAL(error(int,QString)),
this, SLOT(displayError(int,QString)));
//! [1]
QGridLayout *mainLayout = new QGridLayout;
mainLayout->addWidget(hostLabel, 0, 0);
@ -124,30 +125,30 @@ BlockingClient::BlockingClient(QWidget *parent)
portLineEdit->setFocus();
}
//! [2]
//! [1]
void BlockingClient::requestNewFortune()
{
getFortuneButton->setEnabled(false);
thread.requestNewFortune(hostLineEdit->text(),
portLineEdit->text().toInt());
}
//! [2]
//! [1]
//! [3]
//! [2]
void BlockingClient::showFortune(const QString &nextFortune)
{
if (nextFortune == currentFortune) {
requestNewFortune();
return;
}
//! [3]
//! [2]
//! [4]
//! [3]
currentFortune = nextFortune;
statusLabel->setText(currentFortune);
getFortuneButton->setEnabled(true);
}
//! [4]
//! [3]
void BlockingClient::displayError(int socketError, const QString &message)
{

View File

@ -69,7 +69,7 @@ class BlockingClient : public QWidget
Q_OBJECT
public:
BlockingClient(QWidget *parent = 0);
BlockingClient(QWidget *parent = nullptr);
private slots:
void requestNewFortune();

View File

@ -103,7 +103,7 @@ void FortuneThread::run()
//! [6] //! [8]
if (!socket.waitForConnected(Timeout)) {
emit error(socket.error(), socket.errorString());
emit error(socket.socketError(), socket.errorString());
return;
}
//! [8] //! [11]
@ -115,7 +115,7 @@ void FortuneThread::run()
do {
if (!socket.waitForReadyRead(Timeout)) {
emit error(socket.error(), socket.errorString());
emit error(socket.socketError(), socket.errorString());
return;
}

View File

@ -61,7 +61,7 @@ class FortuneThread : public QThread
Q_OBJECT
public:
FortuneThread(QObject *parent = 0);
FortuneThread(QObject *parent = nullptr);
~FortuneThread();
void requestNewFortune(const QString &hostName, quint16 port);

View File

@ -48,8 +48,10 @@
**
****************************************************************************/
#include <QtWidgets>
#include <QtNetwork>
#include <QLabel>
#include <QPushButton>
#include <QUdpSocket>
#include <QVBoxLayout>
#include "receiver.h"
@ -67,10 +69,11 @@ Receiver::Receiver(QWidget *parent)
//! [0]
//! [1]
connect(udpSocket, SIGNAL(readyRead()),
this, SLOT(processPendingDatagrams()));
connect(udpSocket, &QUdpSocket::readyRead,
this, &Receiver::processPendingDatagrams);
//! [1]
connect(quitButton, SIGNAL(clicked()), this, SLOT(close()));
connect(quitButton, &QPushButton::clicked,
this, &Receiver::close);
auto buttonLayout = new QHBoxLayout;
buttonLayout->addStretch(1);

View File

@ -151,9 +151,9 @@ CommandLineParseResult parseCommandLine(QCommandLineParser &parser, DnsQuery *qu
//! [0]
DnsManager::DnsManager()
: dns(new QDnsLookup(this))
{
dns = new QDnsLookup(this);
connect(dns, SIGNAL(finished()), this, SLOT(showResults()));
connect(dns, &QDnsLookup::finished, this, &DnsManager::showResults);
}
void DnsManager::execute()

View File

@ -176,21 +176,20 @@
but its implementation is slightly different:
\snippet blockingfortuneclient/blockingclient.cpp 0
\snippet blockingfortuneclient/blockingclient.cpp 1
We connect our FortuneThread's two signals newFortune() and error() (which
are somewhat similar to QTcpSocket::readyRead() and QTcpSocket::error() in
the previous example) to requestNewFortune() and displayError().
\snippet blockingfortuneclient/blockingclient.cpp 2
\snippet blockingfortuneclient/blockingclient.cpp 1
The requestNewFortune() slot calls FortuneThread::requestNewFortune(),
which \e shedules the request. When the thread has received a new fortune
and emits newFortune(), our showFortune() slot is called:
\snippet blockingfortuneclient/blockingclient.cpp 3
\snippet blockingfortuneclient/blockingclient.cpp 2
\codeline
\snippet blockingfortuneclient/blockingclient.cpp 4
\snippet blockingfortuneclient/blockingclient.cpp 3
Here, we simply display the fortune we received as the argument.

View File

@ -80,8 +80,8 @@ public slots:
DownloadManager::DownloadManager()
{
connect(&manager, SIGNAL(finished(QNetworkReply*)),
SLOT(downloadFinished(QNetworkReply*)));
connect(&manager, &QNetworkAccessManager::finished,
this, &DownloadManager::downloadFinished);
}
void DownloadManager::doDownload(const QUrl &url)
@ -90,8 +90,8 @@ void DownloadManager::doDownload(const QUrl &url)
QNetworkReply *reply = manager.get(request);
#if QT_CONFIG(ssl)
connect(reply, SIGNAL(sslErrors(QList<QSslError>)),
SLOT(sslErrors(QList<QSslError>)));
connect(reply, &QNetworkReply::sslErrors,
this, &DownloadManager::sslErrors);
#endif
currentDownloads.append(reply);
@ -175,7 +175,7 @@ void DownloadManager::sslErrors(const QList<QSslError> &sslErrors)
void DownloadManager::downloadFinished(QNetworkReply *reply)
{
QUrl url = reply->url();
if (reply->error()) {
if (reply->networkError()) {
fprintf(stderr, "Download of %s failed: %s\n",
url.toEncoded().constData(),
qPrintable(reply->errorString()));

View File

@ -67,13 +67,13 @@ void DownloadManager::append(const QStringList &urls)
append(QUrl::fromEncoded(urlAsString.toLocal8Bit()));
if (downloadQueue.isEmpty())
QTimer::singleShot(0, this, SIGNAL(finished()));
QTimer::singleShot(0, this, &DownloadManager::finished);
}
void DownloadManager::append(const QUrl &url)
{
if (downloadQueue.isEmpty())
QTimer::singleShot(0, this, SLOT(startNextDownload()));
QTimer::singleShot(0, this, &DownloadManager::startNextDownload);
downloadQueue.enqueue(url);
++totalCount;
@ -123,12 +123,12 @@ void DownloadManager::startNextDownload()
QNetworkRequest request(url);
currentDownload = manager.get(request);
connect(currentDownload, SIGNAL(downloadProgress(qint64,qint64)),
SLOT(downloadProgress(qint64,qint64)));
connect(currentDownload, SIGNAL(finished()),
SLOT(downloadFinished()));
connect(currentDownload, SIGNAL(readyRead()),
SLOT(downloadReadyRead()));
connect(currentDownload, &QNetworkReply::downloadProgress,
this, &DownloadManager::downloadProgress);
connect(currentDownload, &QNetworkReply::finished,
this, &DownloadManager::downloadFinished);
connect(currentDownload, &QNetworkReply::readyRead,
this, &DownloadManager::downloadReadyRead);
// prepare the output
printf("Downloading %s...\n", url.toEncoded().constData());
@ -162,7 +162,7 @@ void DownloadManager::downloadFinished()
progressBar.clear();
output.close();
if (currentDownload->error()) {
if (currentDownload->networkError()) {
// download failed
fprintf(stderr, "Failed: %s\n", qPrintable(currentDownload->errorString()));
output.remove();

View File

@ -76,6 +76,7 @@ int main(int argc, char **argv)
DownloadManager manager;
manager.append(arguments);
QObject::connect(&manager, SIGNAL(finished()), &app, SLOT(quit()));
QObject::connect(&manager, &DownloadManager::finished,
&app, &QCoreApplication::quit);
app.exec();
}

View File

@ -48,9 +48,9 @@
**
****************************************************************************/
//! [1]
#include "googlesuggest.h"
//! [1]
const QString gsuggestUrl(QStringLiteral("http://google.com/complete/search?output=toolbar&q=%1"));
//! [1]
@ -74,16 +74,18 @@ GSuggestCompletion::GSuggestCompletion(QLineEdit *parent): QObject(parent), edit
popup->installEventFilter(this);
connect(popup, SIGNAL(itemClicked(QTreeWidgetItem*,int)),
SLOT(doneCompletion()));
connect(popup, &QTreeWidget::itemClicked,
this, &GSuggestCompletion::doneCompletion);
timer.setSingleShot(true);
timer.setInterval(500);
connect(&timer, SIGNAL(timeout()), SLOT(autoSuggest()));
connect(editor, SIGNAL(textEdited(QString)), &timer, SLOT(start()));
connect(&timer, &QTimer::timeout,
this, &GSuggestCompletion::autoSuggest);
connect(editor, &QLineEdit::textEdited,
&timer, QOverload<>::of(&QTimer::start));
connect(&networkManager, SIGNAL(finished(QNetworkReply*)),
this, SLOT(handleNetworkData(QNetworkReply*)));
connect(&networkManager, &QNetworkAccessManager::finished,
this, &GSuggestCompletion::handleNetworkData);
}
//! [2]
@ -207,7 +209,7 @@ void GSuggestCompletion::preventSuggest()
void GSuggestCompletion::handleNetworkData(QNetworkReply *networkReply)
{
QUrl url = networkReply->url();
if (networkReply->error() == QNetworkReply::NoError) {
if (networkReply->networkError() == QNetworkReply::NoError) {
QVector<QString> choices;
QByteArray response(networkReply->readAll());

View File

@ -57,11 +57,11 @@
const QString gsearchUrl = QStringLiteral("http://www.google.com/search?q=%1");
//! [1]
SearchBox::SearchBox(QWidget *parent): QLineEdit(parent)
SearchBox::SearchBox(QWidget *parent)
: QLineEdit(parent)
, completer(new GSuggestCompletion(this))
{
completer = new GSuggestCompletion(this);
connect(this, SIGNAL(returnPressed()),this, SLOT(doSearch()));
connect(this, &SearchBox::returnPressed, this, &SearchBox::doSearch);
setWindowTitle("Search with Google");

View File

@ -249,7 +249,7 @@ void HttpWindow::httpFinished()
return;
}
if (reply->error()) {
if (reply->networkError()) {
QFile::remove(fi.absoluteFilePath());
statusLabel->setText(tr("Download failed:\n%1.").arg(reply->errorString()));
downloadButton->setEnabled(true);

View File

@ -80,10 +80,12 @@ Receiver::Receiver(QWidget *parent)
!udpSocket6.joinMulticastGroup(groupAddress6))
statusLabel->setText(tr("Listening for multicast messages on IPv4 only"));
connect(&udpSocket4, SIGNAL(readyRead()),
this, SLOT(processPendingDatagrams()));
connect(&udpSocket6, &QUdpSocket::readyRead, this, &Receiver::processPendingDatagrams);
connect(quitButton, SIGNAL(clicked()), this, SLOT(close()));
connect(&udpSocket4, &QUdpSocket::readyRead,
this, &Receiver::processPendingDatagrams);
connect(&udpSocket6, &QUdpSocket::readyRead,
this, &Receiver::processPendingDatagrams);
connect(quitButton, &QPushButton::clicked,
this, &Receiver::close);
}
void Receiver::processPendingDatagrams()

View File

@ -126,8 +126,8 @@ Client::Client(QWidget *parent)
connect(sctpSocket, &QSctpSocket::connected, this, &Client::connected);
connect(sctpSocket, &QSctpSocket::disconnected, this, &Client::disconnected);
connect(sctpSocket, &QSctpSocket::channelReadyRead, this, &Client::readDatagram);
connect(sctpSocket, SIGNAL(error(QAbstractSocket::SocketError)),
this, SLOT(displayError(QAbstractSocket::SocketError)));
connect(sctpSocket, QOverload<QAbstractSocket::SocketError>::of(&QSctpSocket::error),
this, &Client::displayError);
connect(consumers[SctpChannels::Time], &Consumer::writeDatagram, this, &Client::writeDatagram);
connect(consumers[SctpChannels::Chat], &Consumer::writeDatagram, this, &Client::writeDatagram);

View File

@ -62,14 +62,14 @@ ChatDialog::ChatDialog(QWidget *parent)
textEdit->setReadOnly(true);
listWidget->setFocusPolicy(Qt::NoFocus);
connect(lineEdit, SIGNAL(returnPressed()), this, SLOT(returnPressed()));
connect(lineEdit, SIGNAL(returnPressed()), this, SLOT(returnPressed()));
connect(&client, SIGNAL(newMessage(QString,QString)),
this, SLOT(appendMessage(QString,QString)));
connect(&client, SIGNAL(newParticipant(QString)),
this, SLOT(newParticipant(QString)));
connect(&client, SIGNAL(participantLeft(QString)),
this, SLOT(participantLeft(QString)));
connect(lineEdit, &QLineEdit::returnPressed,
this, &ChatDialog::returnPressed);
connect(&client, &Client::newMessage,
this, &ChatDialog::appendMessage);
connect(&client, &Client::newParticipant,
this, &ChatDialog::newParticipant);
connect(&client, &Client::participantLeft,
this, &ChatDialog::participantLeft);
myNickName = client.nickName();
newParticipant(myNickName);

View File

@ -59,7 +59,7 @@ class ChatDialog : public QDialog, private Ui::ChatDialog
Q_OBJECT
public:
ChatDialog(QWidget *parent = 0);
ChatDialog(QWidget *parent = nullptr);
public slots:
void appendMessage(const QString &from, const QString &message);

View File

@ -60,10 +60,10 @@ Client::Client()
peerManager->setServerPort(server.serverPort());
peerManager->startBroadcasting();
QObject::connect(peerManager, SIGNAL(newConnection(Connection*)),
this, SLOT(newConnection(Connection*)));
QObject::connect(&server, SIGNAL(newConnection(Connection*)),
this, SLOT(newConnection(Connection*)));
connect(peerManager, &PeerManager::newConnection,
this, &Client::newConnection);
connect(&server, &Server::newConnection,
this, &Client::newConnection);
}
void Client::sendMessage(const QString &message)
@ -102,10 +102,10 @@ void Client::newConnection(Connection *connection)
{
connection->setGreetingMessage(peerManager->userName());
connect(connection, SIGNAL(error(QAbstractSocket::SocketError)),
this, SLOT(connectionError(QAbstractSocket::SocketError)));
connect(connection, SIGNAL(disconnected()), this, SLOT(disconnected()));
connect(connection, SIGNAL(readyForUse()), this, SLOT(readyForUse()));
connect(connection, QOverload<QAbstractSocket::SocketError>::of(&Connection::error),
this, &Client::connectionError);
connect(connection, &Connection::disconnected, this, &Client::disconnected);
connect(connection, &Connection::readyForUse, this, &Client::readyForUse);
}
void Client::readyForUse()
@ -115,8 +115,8 @@ void Client::readyForUse()
connection->peerPort()))
return;
connect(connection, SIGNAL(newMessage(QString,QString)),
this, SIGNAL(newMessage(QString,QString)));
connect(connection, &Connection::newMessage,
this, &Client::newMessage);
peers.insert(connection->peerAddress(), connection);
QString nick = connection->name();

View File

@ -82,11 +82,14 @@ Connection::Connection(QObject *parent)
isGreetingMessageSent = false;
pingTimer.setInterval(PingInterval);
QObject::connect(this, SIGNAL(readyRead()), this, SLOT(processReadyRead()));
QObject::connect(this, SIGNAL(disconnected()), &pingTimer, SLOT(stop()));
QObject::connect(&pingTimer, SIGNAL(timeout()), this, SLOT(sendPing()));
QObject::connect(this, SIGNAL(connected()),
this, SLOT(sendGreetingMessage()));
connect(this, &QTcpSocket::readyRead, this,
&Connection::processReadyRead);
connect(this, &QTcpSocket::disconnected,
&pingTimer, &QTimer::stop);
connect(&pingTimer, &QTimer::timeout,
this, &Connection::sendPing);
connect(this, &QTcpSocket::connected,
this, &Connection::sendGreetingMessage);
}
Connection::Connection(qintptr socketDescriptor, QObject *parent)

View File

@ -79,8 +79,8 @@ public:
Undefined
};
Connection(QObject *parent = 0);
Connection(qintptr socketDescriptor, QObject *parent = 0);
Connection(QObject *parent = nullptr);
Connection(qintptr socketDescriptor, QObject *parent = nullptr);
~Connection();
QString name() const;

View File

@ -81,12 +81,12 @@ PeerManager::PeerManager(Client *client)
broadcastSocket.bind(QHostAddress::Any, broadcastPort, QUdpSocket::ShareAddress
| QUdpSocket::ReuseAddressHint);
connect(&broadcastSocket, SIGNAL(readyRead()),
this, SLOT(readBroadcastDatagram()));
connect(&broadcastSocket, &QUdpSocket::readyRead,
this, &PeerManager::readBroadcastDatagram);
broadcastTimer.setInterval(BroadcastInterval);
connect(&broadcastTimer, SIGNAL(timeout()),
this, SLOT(sendBroadcastDatagram()));
connect(&broadcastTimer, &QTimer::timeout,
this, &PeerManager::sendBroadcastDatagram);
}
void PeerManager::setServerPort(int port)

View File

@ -60,7 +60,7 @@ class Server : public QTcpServer
Q_OBJECT
public:
Server(QObject *parent = 0);
Server(QObject *parent = nullptr);
signals:
void newConnection(Connection *connection);

View File

@ -29,7 +29,7 @@ qtHaveModule(widgets) {
}
qtConfig(openssl): SUBDIRS += securesocketclient
qtConfig(ssl): SUBDIRS += securesocketclient
qtConfig(dtls): SUBDIRS += secureudpserver secureudpclient
qtConfig(sctp): SUBDIRS += multistreamserver multistreamclient
}

View File

@ -63,8 +63,8 @@ int main(int argc, char **argv)
QApplication app(argc, argv);
if (!QSslSocket::supportsSsl()) {
QMessageBox::information(0, "Secure Socket Client",
"This system does not support SSL/TLS.");
QMessageBox::information(nullptr, "Secure Socket Client",
"This system does not support TLS.");
return -1;
}

View File

@ -54,8 +54,6 @@
#include "ui_sslclient.h"
#include "ui_sslerrors.h"
#include <QtCore>
SslClient::SslClient(QWidget *parent)
: QWidget(parent)
{
@ -185,16 +183,17 @@ void SslClient::setupUi()
form->hostNameEdit->setSelection(0, form->hostNameEdit->text().size());
form->sessionOutput->setHtml(tr("&lt;not connected&gt;"));
connect(form->hostNameEdit, SIGNAL(textChanged(QString)),
this, SLOT(updateEnabledState()));
connect(form->connectButton, SIGNAL(clicked()),
this, SLOT(secureConnect()));
connect(form->sendButton, SIGNAL(clicked()),
this, SLOT(sendData()));
connect(form->hostNameEdit, &QLineEdit::textChanged,
this, &SslClient::updateEnabledState);
connect(form->connectButton, &QPushButton::clicked,
this, &SslClient::secureConnect);
connect(form->sendButton, &QPushButton::clicked,
this, &SslClient::sendData);
padLock = new QToolButton;
padLock->setIcon(QIcon(":/encrypted.png"));
connect(padLock, SIGNAL(clicked()), this, SLOT(displayCertificateInfo()));
connect(padLock, &QToolButton::clicked,
this, &SslClient::displayCertificateInfo);
#if QT_CONFIG(cursor)
padLock->setCursor(Qt::ArrowCursor);
@ -223,16 +222,16 @@ void SslClient::setupSecureSocket()
socket = new QSslSocket(this);
connect(socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)),
this, SLOT(socketStateChanged(QAbstractSocket::SocketState)));
connect(socket, SIGNAL(encrypted()),
this, SLOT(socketEncrypted()));
connect(socket, SIGNAL(error(QAbstractSocket::SocketError)),
this, SLOT(socketError(QAbstractSocket::SocketError)));
connect(socket, SIGNAL(sslErrors(QList<QSslError>)),
this, SLOT(sslErrors(QList<QSslError>)));
connect(socket, SIGNAL(readyRead()),
this, SLOT(socketReadyRead()));
connect(socket, &QSslSocket::stateChanged,
this, &SslClient::socketStateChanged);
connect(socket, &QSslSocket::encrypted,
this, &SslClient::socketEncrypted);
connect(socket, QOverload<QAbstractSocket::SocketError>::of(&QSslSocket::error),
this, &SslClient::socketError);
connect(socket, QOverload<const QList<QSslError> &>::of(&QSslSocket::sslErrors),
this, &SslClient::sslErrors);
connect(socket, &QSslSocket::readyRead,
this, &SslClient::socketReadyRead);
}

View File

@ -89,7 +89,7 @@ Dialog::Dialog(QWidget *parent)
"Run the Fortune Client example now.")
.arg(ipAddress).arg(server.serverPort()));
connect(quitButton, SIGNAL(clicked()), this, SLOT(close()));
connect(quitButton, &QPushButton::clicked, this, &Dialog::close);
QHBoxLayout *buttonLayout = new QHBoxLayout;
buttonLayout->addStretch(1);

View File

@ -64,7 +64,7 @@ class Dialog : public QWidget
Q_OBJECT
public:
Dialog(QWidget *parent = 0);
Dialog(QWidget *parent = nullptr);
private:
QLabel *statusLabel;

View File

@ -74,7 +74,7 @@ void FortuneServer::incomingConnection(qintptr socketDescriptor)
{
QString fortune = fortunes.at(QRandomGenerator::global()->bounded(fortunes.size()));
FortuneThread *thread = new FortuneThread(socketDescriptor, fortune, this);
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
connect(thread, &FortuneThread::finished, thread, &FortuneThread::deleteLater);
thread->start();
}
//! [1]

View File

@ -60,7 +60,7 @@ class FortuneServer : public QTcpServer
Q_OBJECT
public:
FortuneServer(QObject *parent = 0);
FortuneServer(QObject *parent = nullptr);
protected:
void incomingConnection(qintptr socketDescriptor) override;

View File

@ -65,7 +65,7 @@ void FortuneThread::run()
QTcpSocket tcpSocket;
//! [1] //! [2]
if (!tcpSocket.setSocketDescriptor(socketDescriptor)) {
emit error(tcpSocket.error());
emit error(tcpSocket.socketError());
return;
}
//! [2] //! [3]

View File

@ -73,12 +73,12 @@ AddTorrentDialog::AddTorrentDialog(QWidget *parent)
{
ui.setupUi(this);
connect(ui.browseTorrents, SIGNAL(clicked()),
this, SLOT(selectTorrent()));
connect(ui.browseDestination, SIGNAL(clicked()),
this, SLOT(selectDestination()));
connect(ui.torrentFile, SIGNAL(textChanged(QString)),
this, SLOT(setTorrent(QString)));
connect(ui.browseTorrents, &QPushButton::clicked,
this, &AddTorrentDialog::selectTorrent);
connect(ui.browseDestination, &QPushButton::clicked,
this, &AddTorrentDialog::selectDestination);
connect(ui.torrentFile, &QLineEdit::textChanged,
this, &AddTorrentDialog::setTorrent);
ui.destinationFolder->setText(destinationDirectory = QDir::current().path());
ui.torrentFile->setFocus();

View File

@ -60,7 +60,7 @@ class AddTorrentDialog : public QDialog
Q_OBJECT
public:
AddTorrentDialog(QWidget *parent = 0);
AddTorrentDialog(QWidget *parent = nullptr);
QString torrentFileName() const;
QString destinationFolder() const;

View File

@ -70,7 +70,7 @@ class FileManager : public QThread
Q_OBJECT
public:
FileManager(QObject *parent = 0);
FileManager(QObject *parent = nullptr);
virtual ~FileManager();
inline void setMetaInfo(const MetaInfo &info) { metaInfo = info; }

View File

@ -60,7 +60,7 @@ class TorrentView : public QTreeWidget
{
Q_OBJECT
public:
TorrentView(QWidget *parent = 0);
TorrentView(QWidget *parent = nullptr);
#if QT_CONFIG(draganddrop)
signals:
@ -110,7 +110,7 @@ public:
};
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), quitDialog(0), saveChanges(false)
: QMainWindow(parent), quitDialog(nullptr), saveChanges(false)
{
// Initialize some static strings
QStringList headers;
@ -147,12 +147,12 @@ MainWindow::MainWindow(QWidget *parent)
fileMenu->addAction(pauseTorrentAction);
fileMenu->addAction(removeTorrentAction);
fileMenu->addSeparator();
fileMenu->addAction(QIcon(":/icons/exit.png"), tr("E&xit"), this, SLOT(close()));
fileMenu->addAction(QIcon(":/icons/exit.png"), tr("E&xit"), this, &MainWindow::close);
// Help menu
QMenu *helpMenu = menuBar()->addMenu(tr("&Help"));
helpMenu->addAction(tr("&About"), this, SLOT(about()));
helpMenu->addAction(tr("About &Qt"), qApp, SLOT(aboutQt()));
helpMenu->addAction(tr("&About"), this, &MainWindow::about);
helpMenu->addAction(tr("About &Qt"), qApp, QApplication::aboutQt);
// Top toolbar
QToolBar *topBar = new QToolBar(tr("Tools"));
@ -188,24 +188,24 @@ MainWindow::MainWindow(QWidget *parent)
#endif
// Set up connections
connect(torrentView, SIGNAL(itemSelectionChanged()),
this, SLOT(setActionsEnabled()));
connect(torrentView, SIGNAL(fileDropped(QString)),
this, SLOT(acceptFileDrop(QString)));
connect(uploadLimitSlider, SIGNAL(valueChanged(int)),
this, SLOT(setUploadLimit(int)));
connect(downloadLimitSlider, SIGNAL(valueChanged(int)),
this, SLOT(setDownloadLimit(int)));
connect(newTorrentAction, SIGNAL(triggered()),
this, SLOT(addTorrent()));
connect(pauseTorrentAction, SIGNAL(triggered()),
this, SLOT(pauseTorrent()));
connect(removeTorrentAction, SIGNAL(triggered()),
this, SLOT(removeTorrent()));
connect(upActionTool, SIGNAL(triggered(bool)),
this, SLOT(moveTorrentUp()));
connect(downActionTool, SIGNAL(triggered(bool)),
this, SLOT(moveTorrentDown()));
connect(torrentView, &TorrentView::itemSelectionChanged,
this, &MainWindow::setActionsEnabled);
connect(torrentView, &TorrentView::fileDropped,
this, &MainWindow::acceptFileDrop);
connect(uploadLimitSlider, &QSlider::valueChanged,
this, &MainWindow::setUploadLimit);
connect(downloadLimitSlider, &QSlider::valueChanged,
this, &MainWindow::setDownloadLimit);
connect(newTorrentAction, &QAction::triggered,
this, QOverload<>::of(&MainWindow::addTorrent));
connect(pauseTorrentAction, &QAction::triggered,
this, &MainWindow::pauseTorrent);
connect(removeTorrentAction, &QAction::triggered,
this, &MainWindow::removeTorrent);
connect(upActionTool, &QAction::triggered,
this, &MainWindow::moveTorrentUp);
connect(downActionTool, &QAction::triggered,
this, &MainWindow::moveTorrentDown);
// Load settings and start
setWindowTitle(tr("Torrent Client"));
@ -297,7 +297,7 @@ bool MainWindow::addTorrent()
addTorrent(fileName, addTorrentDialog->destinationFolder());
if (!saveChanges) {
saveChanges = true;
QTimer::singleShot(1000, this, SLOT(saveSettings()));
QTimer::singleShot(1000, this, &MainWindow::saveSettings);
}
return true;
}
@ -311,7 +311,8 @@ void MainWindow::removeTorrent()
// Stop the client.
client->disconnect();
connect(client, SIGNAL(stopped()), this, SLOT(torrentStopped()));
connect(client, &TorrentClient::stopped,
this, &MainWindow::torrentStopped);
client->stop();
// Remove the row from the view.
@ -379,13 +380,20 @@ bool MainWindow::addTorrent(const QString &fileName, const QString &destinationF
client->setDumpedState(resumeState);
// Setup the client connections.
connect(client, SIGNAL(stateChanged(TorrentClient::State)), this, SLOT(updateState(TorrentClient::State)));
connect(client, SIGNAL(peerInfoUpdated()), this, SLOT(updatePeerInfo()));
connect(client, SIGNAL(progressUpdated(int)), this, SLOT(updateProgress(int)));
connect(client, SIGNAL(downloadRateUpdated(int)), this, SLOT(updateDownloadRate(int)));
connect(client, SIGNAL(uploadRateUpdated(int)), this, SLOT(updateUploadRate(int)));
connect(client, SIGNAL(stopped()), this, SLOT(torrentStopped()));
connect(client, SIGNAL(error(TorrentClient::Error)), this, SLOT(torrentError(TorrentClient::Error)));
connect(client, &TorrentClient::stateChanged,
this, &MainWindow::updateState);
connect(client, &TorrentClient::peerInfoUpdated,
this, &MainWindow::updatePeerInfo);
connect(client, &TorrentClient::progressUpdated,
this, &MainWindow::updateProgress);
connect(client, &TorrentClient::downloadRateUpdated,
this, &MainWindow::updateDownloadRate);
connect(client, &TorrentClient::uploadRateUpdated,
this, &MainWindow::updateUploadRate);
connect(client, &TorrentClient::stopped,
this, &MainWindow::torrentStopped);
connect(client, QOverload<TorrentClient::Error>::of(&TorrentClient::error),
this, &MainWindow::torrentError);
// Add the client to the list of downloading jobs.
Job job;
@ -414,7 +422,7 @@ bool MainWindow::addTorrent(const QString &fileName, const QString &destinationF
if (!saveChanges) {
saveChanges = true;
QTimer::singleShot(5000, this, SLOT(saveSettings()));
QTimer::singleShot(5000, this, &MainWindow::saveSettings);
}
client->start();
return true;
@ -491,15 +499,15 @@ void MainWindow::setActionsEnabled()
{
// Find the view item and client for the current row, and update
// the states of the actions.
QTreeWidgetItem *item = 0;
QTreeWidgetItem *item = nullptr;
if (!torrentView->selectedItems().isEmpty())
item = torrentView->selectedItems().first();
TorrentClient *client = item ? jobs.at(torrentView->indexOfTopLevelItem(item)).client : 0;
TorrentClient *client = item ? jobs.at(torrentView->indexOfTopLevelItem(item)).client : nullptr;
bool pauseEnabled = client && ((client->state() == TorrentClient::Paused)
|| (client->state() > TorrentClient::Preparing));
removeTorrentAction->setEnabled(item != 0);
pauseTorrentAction->setEnabled(item != 0 && pauseEnabled);
removeTorrentAction->setEnabled(item != nullptr);
pauseTorrentAction->setEnabled(item && pauseEnabled);
if (client && client->state() == TorrentClient::Paused) {
pauseTorrentAction->setIcon(QIcon(":/icons/player_play.png"));
@ -524,7 +532,7 @@ void MainWindow::updateDownloadRate(int bytesPerSecond)
if (!saveChanges) {
saveChanges = true;
QTimer::singleShot(5000, this, SLOT(saveSettings()));
QTimer::singleShot(5000, this, &MainWindow::saveSettings);
}
}
@ -538,7 +546,7 @@ void MainWindow::updateUploadRate(int bytesPerSecond)
if (!saveChanges) {
saveChanges = true;
QTimer::singleShot(5000, this, SLOT(saveSettings()));
QTimer::singleShot(5000, this, &MainWindow::saveSettings);
}
}
@ -649,7 +657,7 @@ void MainWindow::about()
about.setWindowTitle(tr("About Torrent Client"));
about.setLayout(mainLayout);
connect(quitButton, SIGNAL(clicked()), &about, SLOT(close()));
connect(quitButton, &QPushButton::clicked, &about, &QDialog::close);
about.exec();
}
@ -688,7 +696,7 @@ void MainWindow::closeEvent(QCloseEvent *)
++jobsToStop;
TorrentClient *client = job.client;
client->disconnect();
connect(client, SIGNAL(stopped()), this, SLOT(torrentStopped()));
connect(client, &TorrentClient::stopped, this, &MainWindow::torrentStopped);
client->stop();
delete torrentView->takeTopLevelItem(0);
}
@ -696,7 +704,7 @@ void MainWindow::closeEvent(QCloseEvent *)
if (jobsToStop > jobsStopped)
quitDialog->exec();
quitDialog->deleteLater();
quitDialog = 0;
quitDialog = nullptr;
}
TorrentView::TorrentView(QWidget *parent)

View File

@ -71,7 +71,7 @@ class MainWindow : public QMainWindow
Q_OBJECT
public:
MainWindow(QWidget *parent = 0);
MainWindow(QWidget *parent = nullptr);
QSize sizeHint() const override;
const TorrentClient *clientForRow(int row) const;

View File

@ -87,7 +87,7 @@ PeerWireClient::PeerWireClient(const QByteArray &peerId, QObject *parent)
: QTcpSocket(parent), pendingBlockSizes(0),
pwState(ChokingPeer | ChokedByPeer), receivedHandShake(false), gotPeerId(false),
sentHandShake(false), nextPacketLength(-1), pendingRequestTimer(0), invalidateTimeout(false),
keepAliveTimer(0), torrentPeer(0)
keepAliveTimer(0), torrentPeer(nullptr)
{
memset(uploadSpeedData, 0, sizeof(uploadSpeedData));
memset(downloadSpeedData, 0, sizeof(downloadSpeedData));
@ -96,21 +96,23 @@ PeerWireClient::PeerWireClient(const QByteArray &peerId, QObject *parent)
timeoutTimer = startTimer(ConnectTimeout);
peerIdString = peerId;
connect(this, SIGNAL(readyRead()), this, SIGNAL(readyToTransfer()));
connect(this, SIGNAL(connected()), this, SIGNAL(readyToTransfer()));
connect(this, &PeerWireClient::readyRead,
this, &PeerWireClient::readyToTransfer);
connect(this, &PeerWireClient::connected,
this, &PeerWireClient::readyToTransfer);
connect(&socket, SIGNAL(connected()),
this, SIGNAL(connected()));
connect(&socket, SIGNAL(readyRead()),
this, SIGNAL(readyRead()));
connect(&socket, SIGNAL(disconnected()),
this, SIGNAL(disconnected()));
connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)),
this, SIGNAL(error(QAbstractSocket::SocketError)));
connect(&socket, SIGNAL(bytesWritten(qint64)),
this, SIGNAL(bytesWritten(qint64)));
connect(&socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)),
this, SLOT(socketStateChanged(QAbstractSocket::SocketState)));
connect(&socket, &QTcpSocket::connected,
this, &PeerWireClient::connected);
connect(&socket, &QTcpSocket::readyRead,
this, &PeerWireClient::readyRead);
connect(&socket, &QTcpSocket::disconnected,
this, &PeerWireClient::disconnected);
connect(&socket, QOverload<QAbstractSocket::SocketError>::of(&QTcpSocket::error),
this, QOverload<QAbstractSocket::SocketError>::of(&PeerWireClient::error));
connect(&socket, &QTcpSocket::bytesWritten,
this, &PeerWireClient::bytesWritten);
connect(&socket, &QTcpSocket::stateChanged,
this, &PeerWireClient::socketStateChanged);
}

View File

@ -92,7 +92,7 @@ public:
};
Q_DECLARE_FLAGS(PeerWireState, PeerWireStateFlag)
explicit PeerWireClient(const QByteArray &peerId, QObject *parent = 0);
explicit PeerWireClient(const QByteArray &peerId, QObject *parent = nullptr);
void initialize(const QByteArray &infoHash, int pieceCount);
void setPeer(TorrentPeer *peer);

View File

@ -62,7 +62,8 @@ RateController *RateController::instance()
void RateController::addSocket(PeerWireClient *socket)
{
connect(socket, SIGNAL(readyToTransfer()), this, SLOT(scheduleTransfer()));
connect(socket, &PeerWireClient::readyToTransfer,
this, &RateController::scheduleTransfer);
socket->setReadBufferSize(downLimit * 4);
sockets << socket;
scheduleTransfer();
@ -70,7 +71,8 @@ void RateController::addSocket(PeerWireClient *socket)
void RateController::removeSocket(PeerWireClient *socket)
{
disconnect(socket, SIGNAL(readyToTransfer()), this, SLOT(scheduleTransfer()));
disconnect(socket, &PeerWireClient::readyToTransfer,
this, &RateController::scheduleTransfer);
socket->setReadBufferSize(0);
sockets.remove(socket);
}

View File

@ -62,8 +62,7 @@ class RateController : public QObject
Q_OBJECT
public:
inline RateController(QObject *parent = 0)
: QObject(parent), transferScheduled(false) { }
using QObject::QObject;
static RateController *instance();
void addSocket(PeerWireClient *socket);
@ -81,9 +80,9 @@ public slots:
private:
QElapsedTimer stopWatch;
QSet<PeerWireClient *> sockets;
int upLimit;
int downLimit;
bool transferScheduled;
int upLimit = 0;
int downLimit = 0;
bool transferScheduled = false;
};
#endif

View File

@ -75,13 +75,12 @@ static const int MinimumTimeBeforeRevisit = 30;
static const int MaxUploads = 4;
static const int UploadScheduleInterval = 10000;
class TorrentPiece {
public:
int index;
int length;
struct TorrentPiece {
QBitArray completedBlocks;
QBitArray requestedBlocks;
bool inProgress;
int index = 0;
int length = 0;
bool inProgress = false;
};
class TorrentClientPrivate
@ -227,7 +226,7 @@ void TorrentClientPrivate::callPeerConnector()
{
if (!connectingToClients) {
connectingToClients = true;
QTimer::singleShot(10000, q, SLOT(connectToPeers()));
QTimer::singleShot(10000, q, &TorrentClient::connectToPeers);
}
}
@ -235,22 +234,22 @@ TorrentClient::TorrentClient(QObject *parent)
: QObject(parent), d(new TorrentClientPrivate(this))
{
// Connect the file manager
connect(&d->fileManager, SIGNAL(dataRead(int,int,int,QByteArray)),
this, SLOT(sendToPeer(int,int,int,QByteArray)));
connect(&d->fileManager, SIGNAL(verificationProgress(int)),
this, SLOT(updateProgress(int)));
connect(&d->fileManager, SIGNAL(verificationDone()),
this, SLOT(fullVerificationDone()));
connect(&d->fileManager, SIGNAL(pieceVerified(int,bool)),
this, SLOT(pieceVerified(int,bool)));
connect(&d->fileManager, SIGNAL(error()),
this, SLOT(handleFileError()));
connect(&d->fileManager, &FileManager::dataRead,
this, &TorrentClient::sendToPeer);
connect(&d->fileManager, &FileManager::verificationProgress,
this, &TorrentClient::updateProgress);
connect(&d->fileManager, &FileManager::verificationDone,
this, &TorrentClient::fullVerificationDone);
connect(&d->fileManager, &FileManager::pieceVerified,
this, &TorrentClient::pieceVerified);
connect(&d->fileManager, &FileManager::error,
this, &TorrentClient::handleFileError);
// Connect the tracker client
connect(&d->trackerClient, SIGNAL(peerListUpdated(QList<TorrentPeer>)),
this, SLOT(addToPeerList(QList<TorrentPeer>)));
connect(&d->trackerClient, SIGNAL(stopped()),
this, SIGNAL(stopped()));
connect(&d->trackerClient, &TrackerClient::peerListUpdated,
this, &TorrentClient::addToPeerList);
connect(&d->trackerClient, &TrackerClient::stopped,
this, &TorrentClient::stopped);
}
TorrentClient::~TorrentClient()
@ -840,26 +839,26 @@ void TorrentClient::setupOutgoingConnection()
void TorrentClient::initializeConnection(PeerWireClient *client)
{
connect(client, SIGNAL(connected()),
this, SLOT(setupOutgoingConnection()));
connect(client, SIGNAL(disconnected()),
this, SLOT(removeClient()));
connect(client, SIGNAL(error(QAbstractSocket::SocketError)),
this, SLOT(removeClient()));
connect(client, SIGNAL(piecesAvailable(QBitArray)),
this, SLOT(peerPiecesAvailable(QBitArray)));
connect(client, SIGNAL(blockRequested(int,int,int)),
this, SLOT(peerRequestsBlock(int,int,int)));
connect(client, SIGNAL(blockReceived(int,int,QByteArray)),
this, SLOT(blockReceived(int,int,QByteArray)));
connect(client, SIGNAL(choked()),
this, SLOT(peerChoked()));
connect(client, SIGNAL(unchoked()),
this, SLOT(peerUnchoked()));
connect(client, SIGNAL(bytesWritten(qint64)),
this, SLOT(peerWireBytesWritten(qint64)));
connect(client, SIGNAL(bytesReceived(qint64)),
this, SLOT(peerWireBytesReceived(qint64)));
connect(client, &PeerWireClient::connected,
this, &TorrentClient::setupOutgoingConnection);
connect(client, &PeerWireClient::disconnected,
this, &TorrentClient::removeClient);
connect(client, QOverload<QAbstractSocket::SocketError>::of(&PeerWireClient::error),
this, &TorrentClient::removeClient);
connect(client, &PeerWireClient::piecesAvailable,
this, &TorrentClient::peerPiecesAvailable);
connect(client, &PeerWireClient::blockRequested,
this, &TorrentClient::peerRequestsBlock);
connect(client, &PeerWireClient::blockReceived,
this, &TorrentClient::blockReceived);
connect(client, &PeerWireClient::choked,
this, &TorrentClient::peerChoked);
connect(client, &PeerWireClient::unchoked,
this, &TorrentClient::peerUnchoked);
connect(client, &PeerWireClient::bytesWritten,
this, &TorrentClient::peerWireBytesWritten);
connect(client, &PeerWireClient::bytesReceived,
this, &TorrentClient::peerWireBytesReceived);
}
void TorrentClient::removeClient()
@ -868,7 +867,7 @@ void TorrentClient::removeClient()
// Remove the host from our list of known peers if the connection
// failed.
if (client->peer() && client->error() == QAbstractSocket::ConnectionRefusedError)
if (client->peer() && client->socketError() == QAbstractSocket::ConnectionRefusedError)
d->peers.removeAll(client->peer());
// Remove the client from RateController and all structures.
@ -890,7 +889,8 @@ void TorrentClient::removeClient()
}
// Delete the client later.
disconnect(client, SIGNAL(disconnected()), this, SLOT(removeClient()));
disconnect(client, &PeerWireClient::disconnected,
this, &TorrentClient::removeClient);
client->deleteLater();
ConnectionManager::instance()->removeConnection(client);
@ -905,7 +905,7 @@ void TorrentClient::peerPiecesAvailable(const QBitArray &pieces)
// Find the peer in our list of announced peers. If it's there,
// then we can use the piece list into to gather statistics that
// help us decide what peers to connect to.
TorrentPeer *peer = 0;
TorrentPeer *peer = nullptr;
QList<TorrentPeer *>::Iterator it = d->peers.begin();
while (it != d->peers.end()) {
if ((*it)->address == client->peerAddress() && (*it)->port == client->peerPort()) {
@ -1163,7 +1163,7 @@ void TorrentClient::schedulePieceForClient(PeerWireClient *client)
// many blocks have been requested.
QList<int> currentPieces;
bool somePiecesAreNotInProgress = false;
TorrentPiece *lastPendingPiece = 0;
TorrentPiece *lastPendingPiece = nullptr;
QMultiMap<PeerWireClient *, TorrentPiece *>::Iterator it = d->payloads.find(client);
while (it != d->payloads.end() && it.key() == client) {
lastPendingPiece = it.value();
@ -1183,7 +1183,7 @@ void TorrentClient::schedulePieceForClient(PeerWireClient *client)
// If all pieces are in progress, but we haven't filled up our
// block requesting quota, then we need to schedule another piece.
if (!somePiecesAreNotInProgress || client->incomingBlocks().size() > 0)
lastPendingPiece = 0;
lastPendingPiece = nullptr;
TorrentPiece *piece = lastPendingPiece;
// In warmup state, all clients request blocks from the same pieces.

View File

@ -58,8 +58,7 @@
class MetaInfo;
class PeerWireClient;
class TorrentClientPrivate;
class TorrentPeer;
class TorrentPiece;
struct TorrentPiece;
QT_BEGIN_NAMESPACE
class QTimerEvent;
QT_END_NAMESPACE
@ -110,7 +109,7 @@ public:
ServerError
};
TorrentClient(QObject *parent = 0);
TorrentClient(QObject *parent = nullptr);
~TorrentClient();
bool setTorrent(const QString &fileName);

View File

@ -78,10 +78,10 @@ void TorrentServer::incomingConnection(qintptr socketDescriptor)
if (client->setSocketDescriptor(socketDescriptor)) {
if (ConnectionManager::instance()->canAddConnection() && !clients.isEmpty()) {
connect(client, SIGNAL(infoHashReceived(QByteArray)),
this, SLOT(processInfoHash(QByteArray)));
connect(client, SIGNAL(error(QAbstractSocket::SocketError)),
this, SLOT(removeClient()));
connect(client, &PeerWireClient::infoHashReceived,
this, &TorrentServer::processInfoHash);
connect(client, QOverload<QAbstractSocket::SocketError>::of(&PeerWireClient::error),
this, QOverload<>::of(&TorrentServer::removeClient));
RateController::instance()->addSocket(client);
ConnectionManager::instance()->addConnection(client);
return;
@ -104,7 +104,7 @@ void TorrentServer::processInfoHash(const QByteArray &infoHash)
PeerWireClient *peer = qobject_cast<PeerWireClient *>(sender());
for (TorrentClient *client : qAsConst(clients)) {
if (client->state() >= TorrentClient::Searching && client->infoHash() == infoHash) {
peer->disconnect(peer, 0, this, 0);
peer->disconnect(peer, nullptr, this, nullptr);
client->setupIncomingConnection(peer);
return;
}

View File

@ -60,14 +60,8 @@
TrackerClient::TrackerClient(TorrentClient *downloader, QObject *parent)
: QObject(parent), torrentDownloader(downloader)
{
length = 0;
requestInterval = 5 * 60;
requestIntervalTimer = -1;
firstTrackerRequest = true;
lastTrackerRequest = false;
firstSeeding = true;
connect(&http, SIGNAL(finished(QNetworkReply*)), this, SLOT(httpRequestDone(QNetworkReply*)));
connect(&http, &QNetworkAccessManager::finished,
this, &TrackerClient::httpRequestDone);
}
void TrackerClient::start(const MetaInfo &info)
@ -157,8 +151,8 @@ void TrackerClient::fetchPeerList()
if (!url.userName().isEmpty()) {
uname = url.userName();
pwd = url.password();
connect(&http, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)),
this, SLOT(provideAuthentication(QNetworkReply*,QAuthenticator*)));
connect(&http, &QNetworkAccessManager::authenticationRequired,
this, &TrackerClient::provideAuthentication);
}
http.get(req);
}
@ -171,8 +165,8 @@ void TrackerClient::httpRequestDone(QNetworkReply *reply)
return;
}
if (reply->error() != QNetworkReply::NoError) {
emit connectionError(reply->error());
if (reply->networkError() != QNetworkReply::NoError) {
emit connectionError(reply->networkError());
return;
}

View File

@ -69,7 +69,7 @@ class TrackerClient : public QObject
Q_OBJECT
public:
explicit TrackerClient(TorrentClient *downloader, QObject *parent = 0);
explicit TrackerClient(TorrentClient *downloader, QObject *parent = nullptr);
void start(const MetaInfo &info);
void stop();
@ -98,21 +98,19 @@ private slots:
private:
TorrentClient *torrentDownloader;
int requestInterval;
int requestIntervalTimer;
int requestInterval = 5 * 60;
int requestIntervalTimer = -1;
QNetworkAccessManager http;
MetaInfo metaInfo;
QByteArray trackerId;
QList<TorrentPeer> peers;
qint64 uploadedBytes;
qint64 downloadedBytes;
qint64 length;
qint64 length = 0;
QString uname;
QString pwd;
bool firstTrackerRequest;
bool lastTrackerRequest;
bool firstSeeding;
bool firstTrackerRequest = true;
bool lastTrackerRequest = false;
bool firstSeeding = true;
};
#endif

View File

@ -1,4 +1,4 @@
QT += widgets
QT += widgets opengl
HEADERS = glwidget.h \
helper.h \

View File

@ -1,3 +1,5 @@
QT += opengl
HEADERS = $$PWD/glwindow.h
SOURCES = $$PWD/glwindow.cpp \

View File

@ -171,7 +171,7 @@ static const char *fsDisplaySource =
"}\n";
static const char *csComputeSourceV =
"#define COMPUTEPATCHSIZE 32 \n"
"#define COMPUTEPATCHSIZE 10 // Setting this to 10 to comply with MAX_COMPUTE_WORK_GROUP_INVOCATIONS for both OpenGL and OpenGLES - see QTBUG-79374 \n"
"#define IMGFMT rgba8 \n"
"layout (local_size_x = COMPUTEPATCHSIZE, local_size_y = COMPUTEPATCHSIZE) in;\n"
"layout(binding=0, IMGFMT) uniform readonly highp image2D inputImage; // Use a sampler to improve performance \n"
@ -212,7 +212,7 @@ static const char *csComputeSourceV =
"}\n";
static const char *csComputeSourceH =
"#define COMPUTEPATCHSIZE 32 \n"
"#define COMPUTEPATCHSIZE 10 \n"
"#define IMGFMT rgba8 \n"
"layout (local_size_x = COMPUTEPATCHSIZE, local_size_y = COMPUTEPATCHSIZE) in;\n"
"layout(binding=0, IMGFMT) uniform readonly highp image2D inputImage; // Use a sampler to improve performance \n"
@ -381,7 +381,7 @@ void GLWindow::paintGL()
// Process input image
QSize workGroups = getWorkGroups( 32, QSize(m_texImageInput->width(), m_texImageInput->height()));
QSize workGroups = getWorkGroups(10, QSize(m_texImageInput->width(), m_texImageInput->height()));
// Pass 1
f->glBindImageTexture(0, m_texImageInput->textureId(), 0, 0, 0, GL_READ_WRITE, GL_RGBA8);
f->glBindImageTexture(1, m_texImageTmp->textureId(), 0, 0, 0, GL_READ_WRITE, GL_RGBA8);

View File

@ -1,4 +1,4 @@
QT += core gui widgets
QT += core gui widgets opengl
TARGET = cube
TEMPLATE = app

View File

@ -8,7 +8,7 @@ SOURCES = glwidget.cpp \
mainwindow.cpp \
logo.cpp
QT += widgets
QT += widgets opengl
# install
target.path = $$[QT_INSTALL_EXAMPLES]/opengl/hellogl2

View File

@ -1,3 +1,5 @@
QT += opengl
HEADERS = $$PWD/glwindow.h \
$$PWD/../hellogl2/logo.h

View File

@ -1,4 +1,4 @@
QT += widgets
QT += widgets opengl
SOURCES += main.cpp \
glwidget.cpp \

View File

@ -1,6 +1,7 @@
TEMPLATE = app
TARGET = qopenglwindow
INCLUDEPATH += .
QT += opengl
RESOURCES += shaders.qrc

View File

@ -6,7 +6,7 @@ SOURCES = glwidget.cpp \
RESOURCES = textures.qrc
QT += widgets
QT += widgets opengl
# install
target.path = $$[QT_INSTALL_EXAMPLES]/opengl/textures

View File

@ -1,4 +1,4 @@
QT += widgets
QT += widgets opengl
SOURCES += main.cpp \
glwidget.cpp \

View File

@ -43,15 +43,15 @@
\section1 TableEditor Class Definition
The \c TableEditor class inherits QDialog making the table editor
The \c TableEditor class inherits QWidget making the table editor
widget a top-level dialog window.
\snippet cachedtable/tableeditor.h 0
The \c TableEditor constructor takes two arguments: The first is a
pointer to the parent widget and is passed on to the base class
constructor. The other is a reference to the database table the \c
TableEditor object will operate on.
reference to the database table the \c TableEditor object will operate
on. The other is a pointer to the parent widget and is passed on to the
base class constructor.
Note the QSqlTableModel variable declaration: As we will see in
this example, the QSqlTableModel class can be used to provide data

View File

@ -320,7 +320,7 @@ QGroupBox* MainWindow::createAlbumGroupBox()
this, &MainWindow::showAlbumDetails);
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(albumView, 0, 0);
layout->addWidget(albumView, 0, { });
box->setLayout(layout);
return box;

View File

@ -56,12 +56,9 @@
#include <QGraphicsView>
#include <QApplication>
#include <QMenu>
#include <QMenuBar>
#include <QLayout>
#ifndef QT_NO_OPENGL
# include <QtOpenGL>
#endif
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
@ -83,14 +80,5 @@ MainWindow::MainWindow(QWidget *parent)
view = new QGraphicsView(scene, this);
view->setAlignment(Qt::AlignLeft | Qt::AlignTop);
scene->setupScene(newAction, quitAction);
#ifndef QT_NO_OPENGL
QGLWidget *glWidget = new QGLWidget(QGLFormat(QGL::SampleBuffers));
if (glWidget->context()->isValid()) {
view->setViewport(glWidget);
} else {
qWarning("Unable to create an Open GL context with sample buffers, not using Open GL.");
delete glWidget;
}
#endif
setCentralWidget(view);
}

View File

@ -1,5 +1,4 @@
QT += widgets
qtHaveModule(opengl): QT += opengl
HEADERS += boat.h \
bomb.h \
mainwindow.h \

View File

@ -182,6 +182,6 @@
In addition to the functions and slots discussed above, we have
also implemented several convenience functions to simplify the
constructor: \c createIconGroupBox(), \c createMessageGroupBox(),
\c createActions() and \c createTrayIcon(). See the \l
{desktop/systray/window.cpp}{window.cpp} file for details.
\c createActions() and \c createTrayIcon(). See the \c
{desktop/systray/window.cpp} file for details.
*/

View File

@ -492,7 +492,7 @@ void Dialog::questionMessage()
void Dialog::warningMessage()
{
QMessageBox msgBox(QMessageBox::Warning, tr("QMessageBox::warning()"),
MESSAGE, nullptr, this);
MESSAGE, { }, this);
msgBox.setDetailedText(MESSAGE_DETAILS);
msgBox.addButton(tr("Save &Again"), QMessageBox::AcceptRole);
msgBox.addButton(tr("&Continue"), QMessageBox::RejectRole);

View File

@ -136,7 +136,7 @@
\section1 Defining the AddressBook Class
The \l{tutorials/addressbook/part1/addressbook.h}{\c addressbook.h} file is
The \c{tutorials/addressbook/part1/addressbook.h} file is
used to define the \c AddressBook class.
We start by defining \c AddressBook as a QWidget subclass and declaring

View File

@ -284,6 +284,6 @@
instance of the QStandardItemModel class, i.e., a generic model
for storing custom data typically used as a repository for
standard Qt data types. Each mail description is added to the
model using \c addMail(), another convenience function. See \l
{itemviews/customsortfiltermodel/main.cpp}{main.cpp} for details.
model using \c addMail(), another convenience function. See \c
{itemviews/customsortfiltermodel/main.cpp} for details.
*/

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
@ -26,16 +26,11 @@
****************************************************************************/
/*!
\example saxbookmarks
\title SAX Bookmarks Example
\brief Demonstrates how to read XBEL files.
\ingroup xml-examples
\example widgets/gallery
\title Widgets Gallery Example
\ingroup examples-widgets
\brief The Widgets Gallery example shows widgets relevant for designing UIs.
This example uses Qt's SAX API to read and parse the files. The DOM Bookmarks
example provides an alternative way to read this type of file.
\image saxbookmarks-example.png
See the \l{XML Bookmark Exchange Language Resource Page} for more
information about XBEL files.
This example demonstrates widgets typically used in dialogs and forms.
It also allows for changing the style.
*/

View File

@ -232,8 +232,8 @@
combinations of states and modes for a given icon.
\li \c IconSizeSpinBox is a subclass of QSpinBox that lets the
user enter icon sizes (e.g., "48 x 48").
\li \c ImageDelegate is a subclass of QItemDelegate that provides
comboboxes for letting the user set the mode and state
\li \c ImageDelegate is a subclass of QStyledItemDelegate that
provides comboboxes for letting the user set the mode and state
associated with an image.
\endlist
@ -468,7 +468,6 @@
loaded into the application.
\snippet widgets/icons/mainwindow.cpp 13
\snippet widgets/icons/mainwindow.cpp 14
We retrieve the image name using the QFileInfo::baseName()
function that returns the base name of the file without the path,
@ -486,8 +485,6 @@
Qt::ItemIsEditable flag. Table items are editable by default.
\snippet widgets/icons/mainwindow.cpp 15
\snippet widgets/icons/mainwindow.cpp 16
\snippet widgets/icons/mainwindow.cpp 17
Then we create the second and third items in the row making the
default mode Normal and the default state Off. But if the \uicontrol
@ -498,7 +495,6 @@
example's \c images subdirectory respect this naming convention.
\snippet widgets/icons/mainwindow.cpp 18
\snippet widgets/icons/mainwindow.cpp 19
In the end we add the items to the associated row, and use the
QTableWidget::openPersistentEditor() function to create
@ -522,8 +518,6 @@
application.
\snippet widgets/icons/mainwindow.cpp 8
\snippet widgets/icons/mainwindow.cpp 9
\snippet widgets/icons/mainwindow.cpp 10
We also extract the image file's name using the
QTableWidgetItem::data() function. This function takes a
@ -571,24 +565,22 @@
delegate for the table widget. We create a \c ImageDelegate that
we make the item delegate for our view.
The QItemDelegate class can be used to provide an editor for an item view
The QStyledItemDelegate class can be used to provide an editor for an item view
class that is subclassed from QAbstractItemView. Using a delegate
for this purpose allows the editing mechanism to be customized and
developed independently from the model and view.
In this example we derive \c ImageDelegate from QItemDelegate.
QItemDelegate usually provides line editors, while our subclass
In this example we derive \c ImageDelegate from QStyledItemDelegate.
QStyledItemDelegate usually provides line editors, while our subclass
\c ImageDelegate, provides comboboxes for the mode and state
fields.
\snippet widgets/icons/mainwindow.cpp 22
\snippet widgets/icons/mainwindow.cpp 23
Then we customize the QTableWidget's horizontal header, and hide
the vertical header.
\snippet widgets/icons/mainwindow.cpp 24
\snippet widgets/icons/mainwindow.cpp 25
At the end, we connect the QTableWidget::itemChanged() signal to
the \c changeIcon() slot to ensure that the preview area is in
@ -750,23 +742,23 @@
\snippet widgets/icons/imagedelegate.h 0
The \c ImageDelegate class is a subclass of QItemDelegate. The
QItemDelegate class provides display and editing facilities for
data items from a model. A single QItemDelegate object is
The \c ImageDelegate class is a subclass of QStyledItemDelegate. The
QStyledItemDelegate class provides display and editing facilities for
data items from a model. A single QStyledItemDelegate object is
responsible for all items displayed in a item view (in our case,
a QTableWidget).
A QItemDelegate can be used to provide an editor for an item view
A QStyledItemDelegate can be used to provide an editor for an item view
class that is subclassed from QAbstractItemView. Using a delegate
for this purpose allows the editing mechanism to be customized and
developed independently from the model and view.
\snippet widgets/icons/imagedelegate.h 1
The default implementation of QItemDelegate creates a QLineEdit.
The default implementation of QStyledItemDelegate creates a QLineEdit.
Since we want the editor to be a QComboBox, we need to subclass
QItemDelegate and reimplement the QItemDelegate::createEditor(),
QItemDelegate::setEditorData() and QItemDelegate::setModelData()
QStyledItemDelegate and reimplement the QStyledItemDelegate::createEditor(),
QStyledItemDelegate::setEditorData() and QStyledItemDelegate::setModelData()
functions.
\snippet widgets/icons/imagedelegate.h 2
@ -783,7 +775,7 @@
\snippet widgets/icons/imagedelegate.cpp 1
The default QItemDelegate::createEditor() implementation returns
The default QStyledItemDelegate::createEditor() implementation returns
the widget used to edit the item specified by the model and item
index for editing. The parent widget and style option are used to
control the appearance of the editor widget.
@ -803,7 +795,7 @@
\snippet widgets/icons/imagedelegate.cpp 2
The QItemDelegate::setEditorData() function is used by
The QStyledItemDelegate::setEditorData() function is used by
QTableWidget to transfer data from a QTableWidgetItem to the
editor. The data is stored as a string; we use
QComboBox::findText() to locate it in the combobox.
@ -816,7 +808,7 @@
\snippet widgets/icons/imagedelegate.cpp 3
The QItemDelegate::setEditorData() function is used by QTableWidget
The QStyledItemDelegate::setEditorData() function is used by QTableWidget
to transfer data back from the editor to the \l{QTableWidgetItem}.
\snippet widgets/icons/imagedelegate.cpp 4

View File

@ -387,17 +387,12 @@
\snippet graphicsview/padnavigator/padnavigator.cpp 7
We now create the animations that control the flip-effect when you press
the enter key. The main goal is to rotate the pad by 180 degrees or back,
but we also need to make sure the selection item's tilt rotations are reset
back to 0 when the pad is flipped, and restored back to their original
values when flipped back:
the enter key. The main goal is to rotate the pad by 180 degrees or back.
\list
\li \c smoothFlipRotation: Animates the main 180 degree rotation of the pad.
\li \c smoothFlipScale: Scales the pad out and then in again while the pad is rotating.
\li \c smoothFlipXRotation: Animates the selection item's X-tilt to 0 and back.
\li \c smoothFlipYRotation: Animates the selection item's Y-tilt to 0 and back.
\li \c flipAnimation: A parallel animation group that ensures all the above animations are run in parallel.
\li \c flipAnimation: A parallel animation group that ensures the above animations are run in parallel.
\endlist
All animations are given a 500 millisecond duration and an
@ -447,11 +442,17 @@
Each state assigns specific properties to objects on entry. Most
interesting perhaps is the assignment of the value 0.0 to the pad's \c
flipRotation angle property when in \c frontState, and 180.0 when in \c
backState. At the end of this section we register default animations with
the state engine; these animations will apply to their respective objects
and properties for any state transition. Otherwise it's common to assign
backState.
At the end of this section we register default animations with the state
engine; these animations will apply to their respective objects and
properties for any state transition. Otherwise it's common to assign
animations to specific transitions.
Specifically, we use default animations to control the selection item's
movement and tilt rotations. The tilt rotations are set to 0 when the pad
is flipped, and restored back to their original values when flipped back.
The \c splashState state is set as the initial state. This is required
before we start the state engine. We proceed with creating some
transitions.

View File

@ -29,16 +29,18 @@
\example widgets/shapedclock
\title Shaped Clock Example
\ingroup examples-widgets
\brief The Shaped Clock example shows how to apply a widget mask to a top-level
widget to produce a shaped window.
\brief The Shaped Clock example shows how to apply a translucent background
and a widget mask to a top-level widget to produce a shaped window.
\borderedimage shapedclock-example.png
Widget masks are used to customize the shapes of top-level widgets by restricting
the available area for painting. On some window systems, setting certain window flags
will cause the window decoration (title bar, window frame, buttons) to be disabled,
allowing specially-shaped windows to be created. In this example, we use this feature
to create a circular window containing an analog clock.
Widget masks are used to customize the shapes of top-level widgets by
restricting the area available for painting and mouse input. Using a
translucent background facilitates partially transparent windows and smooth
edges. On most window systems, setting certain window flags will cause the
window decoration (title bar, window frame, buttons) to be disabled,
allowing specially-shaped windows to be created. In this example, we use
this feature to create a circular window containing an analog clock.
Since this example's window does not provide a \uicontrol File menu or a close
button, we provide a context menu with an \uicontrol Exit entry so that the example
@ -52,8 +54,10 @@
\snippet widgets/shapedclock/shapedclock.h 0
The \l{QWidget::paintEvent()}{paintEvent()} implementation is the same as that found
in the \c AnalogClock class. We implement \l{QWidget::sizeHint()}{sizeHint()}
The \l{QWidget::paintEvent()}{paintEvent()} implementation is the same as
that found in the \c AnalogClock class, with one important exception: we
now must also draw background (the clock face) ourselves, since the widget
background is just transparent. We implement \l{QWidget::sizeHint()}{sizeHint()}
so that we don't have to resize the widget explicitly. We also provide an event
handler for resize events. This allows us to update the mask if the clock is resized.
@ -70,9 +74,11 @@
\snippet widgets/shapedclock/shapedclock.cpp 0
We inform the window manager that the widget is not to be decorated with a window
frame by setting the Qt::FramelessWindowHint flag on the widget. As a result, we need
to provide a way for the user to move the clock around the screen.
We request a transparent window by setting the Qt::WA_TranslucentBackground
widget attribute. We inform the window manager that the widget is not to be
decorated with a window frame by setting the Qt::FramelessWindowHint flag
on the widget. As a result, we need to provide a way for the user to move
the clock around the screen.
Mouse button events are delivered to the \c mousePressEvent() handler:
@ -94,14 +100,20 @@
widget is moved to the point given by subtracting the \c dragPosition from the current
cursor position in global coordinates. If we drag the widget, we also accept the event.
The \c paintEvent() function is given for completeness. See the
\l{Analog Clock Example}{Analog Clock} example for a description of the process used
to render the clock.
The \c paintEvent() function is mainly the same as described in the
\l{Analog Clock Example}{Analog Clock} example. The one addition is that we
use QPainter::drawEllipse() to draw a round clock face with the current
palette's default background color. We make the clock face a bit smaller
than the widget mask, so that the anti-aliased, semi-transparent pixels on
the edge are not clipped away by the widget mask. This gives the shaped
window smooth edges on the screen.
\snippet widgets/shapedclock/shapedclock.cpp 3
In the \c resizeEvent() handler, we re-use some of the code from the \c paintEvent()
to determine the region of the widget that is visible to the user:
In the \c resizeEvent() handler, we re-use some of the code from the \c
paintEvent() to determine the region of the widget that is visible to the
user. This tells the system the area where mouse clicks should go to us,
and not to whatever window is behind us:
\snippet widgets/shapedclock/shapedclock.cpp 4
@ -121,6 +133,12 @@
\section1 Notes on Widget Masks
Widget masks are used to hint to the window system that the application
does not want mouse events for areas outside the mask. On most systems,
they also result in coarse visual clipping. To get smooth window edges, one
should use translucent background and anti-aliased painting, as shown in
this example.
Since QRegion allows arbitrarily complex regions to be created, widget masks can be
made to suit the most unconventionally-shaped windows, and even allow widgets to be
displayed with holes in them.

View File

@ -84,8 +84,8 @@
\snippet widgets/styles/norwegianwoodstyle.cpp 0
The \c polish() function is reimplemented from QStyle. It takes a
QPalette as a reference and adapts the palette to fit the style.
The \c standardPalette() function is reimplemented from QStyle.
It returns a QPalette with the style's preferred colors and textures.
Most styles don't need to reimplement that function. The
Norwegian Wood style reimplements it to set a "wooden" palette.
@ -380,7 +380,7 @@
a certain \l{QPalette::ColorRole}{color role}, for all three
\l{QPalette::ColorGroup}{color groups} (active, disabled,
inactive). We used it to initialize the Norwegian Wood palette in
\c polish(QPalette &).
\c standardPalette.
\snippet widgets/styles/norwegianwoodstyle.cpp 39
\snippet widgets/styles/norwegianwoodstyle.cpp 40
@ -443,10 +443,6 @@
current style's \l{QStyle::standardPalette()}{standard palette}
is used; otherwise, the system's default palette is honored.
For the Norwegian Wood style, this makes no difference because we
always override the palette with our own palette in \c
NorwegianWoodStyle::polish().
\snippet widgets/styles/widgetgallery.cpp 9
\snippet widgets/styles/widgetgallery.cpp 10

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