Commit Graph

46 Commits

Author SHA1 Message Date
Christian Ehrlicher
4af00753fa Cleanup QtWidgets examples
Cleanup QtWidgets examples:
 - use nullptr (clang-tidy)
 - use member-initialization
 - adjust the style
 - fix includes

Change-Id: Ic5448606aacc525ea60b615a69227017aa2b821a
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2019-10-11 06:32:30 +02:00
Christian Ehrlicher
1f2c23a7ca Cleanup Widgets examples - foreach
Cleanup the Widget examples - replace foreach with range-based for loop
in subdirectory tools, touch and tutorials

Change-Id: I008d23b5993a18a3332fe9f5e5bca68cb0561066
Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2019-01-07 13:15:59 +00:00
Christian Ehrlicher
a21f3431b8 Cleanup Widgets examples - new signal/slot syntax
Cleanup the Widget examples - use the new signal/slot syntax where
possible - tutorials subdirectory

Change-Id: I741589f6616578412ad74f8371e0e3c87df783a2
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
Reviewed-by: Luca Beldi <v.ronin@yahoo.it>
2019-01-03 08:30:04 +00:00
Christian Ehrlicher
8c685b765b Itemviews: Cleanup examples
Cleanup some minor issues in the chart example:
 - remove unused members
 - use initializer list for members
 - pass a proper role to dataChanged()
 - honor roles parameter in PieView::dataChanged()
 - use nullptr instead 0
 - use new-style connect
 - fix indentation and other whitespaces

Change-Id: Idb212b07c006fe3ae31bee9cd9b1ba4d03043b5e
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2018-11-12 13:01:30 +00:00
Alexander Volkov
7aad542629 Notepad example: Get rid of auto-connection slots
Their correctness is not checked at compile time and even object
renames can break code.

Change-Id: I99273a28743a79a76c00e6db0ed4cd6d7eba8bf2
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2018-11-01 11:46:00 +00:00
Topi Reinio
6601939713 Notepad example: Wrap clipboard functions with QT_CONFIG(clipboard)
And disable menu actions for functionality that's not available.

Task-number: QTBUG-68168
Change-Id: I153487860e8dda8271ae04e9cd2ad8b26a4b130f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2018-06-22 14:37:48 +00:00
Paul Wicking
8bd73ad989 Doc: Add missing full stops in briefs
Task-number: QTBUG-68933
Change-Id: I3f2a9f8c562f9a44bb32bddd31d75abbfe6de04d
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2018-06-21 14:23:30 +00:00
Nico Vertriest
28738d2d8d Doc: Add formatting features to Notepad example
- bold, italic, underline
- About button

Change-Id: I8ece7d2bfca0b148b681a2fccb4a439ce179848a
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2018-06-01 09:54:56 +00:00
Friedemann Kleint
3e4b7223f1 Examples: Fix unused variable warnings by Clang
mainwindow.cpp(59,11):  warning: unused variable 'ROWS' [-Wunused-const-variable]
const int ROWS = 2;
mainwindow.cpp(60,11):  warning: unused variable 'COLUMNS' [-Wunused-const-variable]
const int COLUMNS = 3;
mainwindow.cpp(76,19):  warning: unused variable 'message' [-Wunused-const-variable]

Task-number: QTBUG-60635
Change-Id: I97c31462ffa826da9baa32c33c0ff0140bf46dfc
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2018-05-02 13:05:55 +00:00
Oliver Wolff
6c3f864ec0 examples: Fix notepad example for configurations without printsupport
Task-number: QTBUG-65735
Change-Id: I7e0d19de4ac92603f2fd033007343f20a408618a
Reviewed-by: Nico Vertriest <nico.vertriest@qt.io>
2018-01-22 08:27:26 +00:00
Rainer Keller
f13b0b2cf2 qtlite: Skip building examples when configured with no-feature-itemviews
Compiling the default examples should be possible without compile errors.

Task-number: QTBUG-53141
Change-Id: I73d8787241291ae6230861a89b38e91d900fede0
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-01-12 07:58:20 +00:00
Nico Vertriest
51a956366f Doc: move notepad example to qtbase and improve it
- Edited gettingstartedqt.qdoc
- update .pro files
- replaced snippet statements by \quotefromfile
- removed second version of notepad.h and notepad.cpp
  that were made only for quoting snippets
  (\quotefromfile reads from the program code)
- show current filename in header of window
- added checking routine on filename in Save method

Task-number: QTBUG-63984
Change-Id: I5298d761763a4dfeb705a1d9b77354be853ada88
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2017-12-18 13:39:28 +00:00
Samuel Gaist
74819c4ed9 Tutorial: migrate addressbook tutorial to use QRegularExpression
Update the addressbook tutorial to use the new QRegularExpression class
in place of the deprecated QRegExp.

Change-Id: Ibea9252ab8fe1d12e6fc862fa70229ca6efe0804
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
2017-01-24 07:24:13 +00:00
hjk
40a54bf565 Examples: Replace 'Q_DECL_OVERRIDE' by 'override'
Examples should demonstrate best practice, and we can use the keyword
directly nowadays.

Change-Id: I1f122e5caceca17290757ffbaf3d660e7daa9ae4
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
2016-06-15 09:32:30 +00:00
Jani Heikkinen
cd46a2daf5 Unify license header usage.
Update files using old header.LGPL3 to header.LGPL
Update files using old FDL template to use new one
Update files using old BSD template to use new one

Change-Id: I36a78272516f9953d02956522f285b40adfc8915
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-03-29 10:20:03 +00:00
Friedemann Kleint
f9bf737d74 Examples/Doc snippets: Fix single-character string literals.
Use character literals where applicable.

Change-Id: I79fa5018f05735201ae35ee94ba0d356fcad1056
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
2015-10-13 16:37:07 +00:00
Liang Qi
0aa2d318b1 Merge remote-tracking branch 'origin/5.5' into dev
Conflicts:
	src/corelib/global/qglobal.cpp
	src/corelib/global/qglobal.h
	src/corelib/global/qsysinfo.h
	src/corelib/global/qsystemdetection.h
	src/corelib/kernel/qobjectdefs.h
	src/plugins/plugins.pro
	tests/auto/widgets/itemviews/qlistview/qlistview.pro

Change-Id: Ib55aa79d707c4c1453fb9d697f6cf92211ed665c
2015-07-01 11:05:26 +02:00
Nico Vertriest
e1b7c55a43 Doc: rearrange tables with overflow
Task-number: QTBUG-46475
Change-Id: Id599b2eb0dee0c003475c094ad61700150e37e65
Reviewed-by: Venugopal Shivashankar <venugopal.shivashankar@digia.com>
2015-06-26 11:26:24 +00:00
Holger Hans Peter Freyther
ae4bc7e97e Remove bogus call and comment from addressbook
QMap::empty() does not empty the list but is the STL
version to ask if the map is empty. Remove the comment
and code as operator>> of QDataStream will clear the
map.

Fixes Coverity CID#89073

Change-Id: I259e518b44afd42b698368b42aedcc3b84240aca
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
2015-06-08 07:22:20 +00:00
Jani Heikkinen
2b75c156b6 Updated BSD licensed file headers
Change-Id: I6441ff931dbd33b698d762e6f6784898f3f60fe7
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-02-15 07:41:17 +00:00
Jani Heikkinen
83a5694dc2 Update copyright headers
Qt copyrights are now in The Qt Company, so we could update the source
code headers accordingly. In the same go we should also fix the links to
point to qt.io.

Outdated header.LGPL removed (use header.LGPL21 instead)

Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing
combination. New header.LGPL-COMM taken in the use file which were
using old header.LGPL3 (src/plugins/platforms/android/extract.cpp)

Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license
combination

Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe
Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
2015-02-11 06:49:51 +00:00
Olivier Goffart
3b0c2b7c1b Examples: Add Q_DECL_OVERRIDE to overridden functions
Q_DECL_OVERRIDE (which expands to 'override' for supported compiler)
helps to declare the intent (that it is an overridden function) and
force compilation error when there is no such virtual function in the
base class.
The examples should show the best practice of having it, as it may save
the programmer quite some time in case of change of API or typo in the
function name or arguments.

This change was done automatically with
clang-modernize -add-override -override-macros

And fixed MSVC compilation by removing inline for TorrentViewDelegate::paint

Change-Id: Ice66ae93fae571266f908703d5b8892b2c1ebb1a
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
2014-07-15 08:44:44 +02:00
Steven Ceuppens
c0b75d3e6b Update AddressBook Example
Adding parent to QDialog
As proposed on qt-project.org forum:
http://qt-project.org/forums/viewthread/41686/

Change-Id: Ib66d24e4afd0be803a1080c37bc6c0a189844786
Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
2014-04-28 13:54:44 +02:00
Oswald Buddenhagen
882bf3475c expand tabs and related whitespace fixes in *.{cpp,h,qdoc}
the diff -w for this commit is empty.

Started-by: Thiago Macieira <thiago.macieira@intel.com>
Change-Id: I77bb84e71c63ce75e0709e5b94bee18e3ce6ab9e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-01-13 22:46:50 +01:00
Sze Howe Koh
6b8e866391 Doc: Clean up threading examples
- Example 3 (Clock) is a collection of anti-patterns.
    - It implements a slot in a QThread subclass and then forces the new
      thread to use Qt::DirectConnection to invoke the slot in the
      "wrong" thread.
    - It talks about getting away with non-thread-safe usage
    - It uses a thread as a timer and then admits that it's an over-
      complicated approach.
- Example 4 (Permanent Thread) is over-complicated yet incomplete. A
  better one exists in the QThread class ref.
- Example 1 (Thread Pool) is covered by the QThreadPool class ref.
- Example 2 (QtConcurrent::run()) is covered in the "Threading and
  Concurrent Programming Examples" page and the "QtConcurrentRun" page.
- The undocumented "Hello Thread" example is covered in the QThread
  class ref.
- These examples cannot be accessed from Qt Creator's Examples tool.
- These examples are neither widget-related nor tutorials, contrary to
  their source paths.

Task-number: QTBUG-33360
Change-Id: Ic79cb764ee925ddbcbeafee8e1d01db7fe0f6cfe
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
2013-11-05 00:29:01 +01:00
Tor Arne Vestbø
5466eb289f Remove warnings about examples not running in the Qt Simulator
The Qt Simulator is no longer supported with Qt 5.

Change-Id: I0f98351d482dd0554ea0754746d56f94ee6bf22f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2013-10-09 21:45:31 +02:00
Sze Howe Koh
2171b057e3 Doc: Remove section about how to start threads
- Incomplete: It doesn't talk about how to use a raw QThread, or
  QRunnable, or Qt Concurrent.
- Redundant: Its contents are already presented in QThread's class ref,
  and the line before this section links to the "Multithreading
  Technologies in Qt" overview page which provides a more complete intro

Also remove snippet markers that are no longer used.

Change-Id: I89b7bd72f10c8ffdfd9b7772e2493050aafc9c88
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2013-09-14 02:58:57 +02:00
hjk
d593d6955c Doc: Remove addressbook-fr
Documentation is generally not translated, this one sticks out.

Task-number: QTBUG-28535
Change-Id: Ib2cdbc8c94a6354af3369ff2dcf4df69cde4c381
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
Reviewed-by: Geir Vattekar <geir.vattekar@digia.com>
2013-08-23 01:54:41 +02:00
Axel Waggershauser
b11317a643 Whitespace cleanup: remove trailing whitespace
Remove all trailing whitespace from the following list of files:
*.cpp *.h *.conf *.qdoc *.pro *.pri *.mm *.rc *.pl *.qps *.xpm *.txt *README
excluding 3rdparty, test-data and auto generated code.

Note A): the only non 3rdparty c++-files that still
have trailing whitespace after this change are:
* src/corelib/codecs/cp949codetbl_p.h
* src/corelib/codecs/qjpunicode.cpp
* src/corelib/codecs/qbig5codec.cpp
* src/corelib/xml/qxmlstream_p.h
* src/tools/qdoc/qmlparser/qqmljsgrammar.cpp
* src/tools/uic/ui4.cpp
* tests/auto/other/qtokenautomaton/tokenizers/*
* tests/benchmarks/corelib/tools/qstring/data.cpp
* util/lexgen/tokenizer.cpp

Note B): in about 30 files some overlapping 'leading tab' and
'TAB character in non-leading whitespace' issues have been fixed
to make the sanity bot happy. Plus some general ws-fixes here
and there as asked for during review.

Change-Id: Ia713113c34d82442d6ce4d93d8b1cf545075d11d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2013-03-16 20:22:50 +01:00
Sergio Ahumada
6239af6f0f Merge branch 'release' into stable
Change-Id: If3aa1b7ed75082eff6e9761ad82c83691135ed60
2013-01-31 18:55:53 +01:00
Sergio Ahumada
f262815f2e Fix some more old references and links to Nokia
Task-number: QTBUG-28156
Change-Id: I9ba0d6f1e92103219bec1e61e716b6b2f269a8ad
Reviewed-by: Laszlo Papp <lpapp@kde.org>
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
2013-01-28 14:27:57 +01:00
Sergio Ahumada
48e0c4df23 Update copyright year in Digia's license headers
Change-Id: Ic804938fc352291d011800d21e549c10acac66fb
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-01-18 09:07:35 +01:00
Oswald Buddenhagen
586adeabe4 add and use qtHaveModule() function
this is much more elegant than the so far propagated !isEmpty(QT.foo.name).
also replace feature-specific tests (no-gui and no-widgets) and the
obsolete contains(QT_CONFIG, foo) syntax.

Change-Id: Ia4b3c8febcabf9eeca67b1f9173a523820b1038b
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
Reviewed-by: Tasuku Suzuki <stasuku@gmail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2012-12-21 19:05:02 +01:00
Oswald Buddenhagen
2ac3f92296 clean up example project files, mostly wrt QT+=widgets
move QT+=widgets (and printsupport) statements before the install
statements, and de-duplicate some cases.
also move some TARGET assignments to a more conventional place.

Change-Id: I6140d8611680f66c24490e5894e4eb90cae95635
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
2012-12-17 14:08:17 +01:00
Oswald Buddenhagen
6c88c7db63 remove QT+=widgets from SUBDIRS projects
it makes no sense whatsoever

Change-Id: Ica7c764575079a12512ee2eb62a995ebbefa09a0
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
2012-12-17 14:08:17 +01:00
Oswald Buddenhagen
aeb036ed87 centralize and fixup example sources install targets
it's confusing for the users if the examples' project files contain code
to install their own sources. also, this constitutes an enormous code
duplication, and lots of mistakes. consequently, automate it.

more or less as a side effect, this also removes the entirely meaningless
target installs in subdirs projects.

Task-number: QTBUG-28184
Change-Id: I9fc1367a06db9e2c46aeb67d68729a4f67163ef9
Reviewed-by: hjk <qthjk@ovi.com>
2012-11-29 20:21:11 +01:00
Oswald Buddenhagen
4dedd61d2e delete .desktop files of examples
they were added without an explanation, and they can't be particularly
useful (because they contain hard-coded paths and refer to non-existing
icons).

Change-Id: I27e2c35375e28645b0c03449ddc7ac7017da5943
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
2012-11-28 16:21:57 +01:00
Stephen Kelly
5a9de4c676 Always use QAIM to get the default flags.
Change-Id: I801f5c8023e3e3672fde28139a7f34f640e650f5
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2012-11-28 08:43:31 +01:00
hjk
c527dd44be Examples: Install to $$[QT_INSTALL_EXAMPLES]/$submodule/$example
This makes the structure of the examples after an 'make install'
similar to the one in a 'developer build'.

Change-Id: I9120bd741fab332e64e30adc01cefe87e5633454
Reviewed-by: Martin Smith <martin.smith@digia.com>
2012-11-26 14:35:23 +01:00
Friedemann Kleint
626283740f Fix building of examples.
- Correct install path of widget examples to contain widgets
  directory in target tree.
- Add missing resources.

Task-number: QTBUG-27977

Change-Id: If4cb117998892b0b165d7678367553d3a7553b91
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
2012-11-21 16:36:50 +01:00
Joerg Bornemann
9e750d341a fix conflicting Visual Studio project names for Qt examples
Loading examples.sln resulted in a cascade of error messages because
Visual Studio doesn't allow projects of the same name in a solution.
Now using QMAKE_PROJECT_NAME to give the projects distinct names.

Change-Id: Ifd3a00311253e4b234ece936092649ce0f0869d8
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
2012-09-27 15:50:14 +02:00
Marc Mutz
6d65b2cc8c Use QStringList::join(QChar) overload where applicable [examples]
This is an automated change performing the following replacements:
                    join\("(.)"\) -> join('\1')
  join\(QLatin1String\("(.)"\)\)  -> join(QLatin1Char('\1'))
  join\(QStringLiteral\("(.)"\)\) -> join(QLatin1Char('\1'))

Change-Id: I1d0c9782cc1522d937b930531720e32d4c8f7ce8
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2012-09-23 23:30:03 +02:00
Iikka Eklund
be15856f61 Change copyrights from Nokia to Digia
Change copyrights and license headers from Nokia to Digia

Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
2012-09-22 19:20:11 +02:00
Geir Vattekar
7ec469e900 Doc: Fix snippet bug in Getting Started Qt
Change-Id: I9c8caabee4c6f6131a69851586ef992138beb211
Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org>
Reviewed-by: Jerome Pasion <jerome.pasion@nokia.com>
2012-09-13 19:33:08 +02:00
Sergio Ahumada
5243999c3c example: minor fix to gettingStarted - part5
Do not compare a QString to "".  Instead use the .isEmpty() method.

Change-Id: Ifda1361b2c288dd590f0294daacdf5e2d9241522
Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org>
Reviewed-by: Geir Vattekar <geir.vattekar@nokia.com>
2012-09-10 10:40:31 +02:00
Frederik Gladhorn
f67d23d4fc Move tutorials to widgets.
All of these are very QWidget centric.
They cannot properly refer to the
sources without being part of the widget module.

This fixes around 300 qdoc errors.

Change-Id: I5a7c2dbc10f7913f7b088d6a0ac81323b3c287ac
Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
2012-09-09 01:18:37 +02:00