Merge remote-tracking branch 'origin/5.10' into dev
Conflicts: .qmake.conf sc/corelib/io/qfsfileengine_p.h src/corelib/io/qstorageinfo_unix.cpp src/platformsupport/eglconvenience/qeglpbuffer_p.h src/platformsupport/input/libinput/qlibinputkeyboard.cpp src/platformsupport/input/libinput/qlibinputpointer.cpp src/plugins/platforms/cocoa/qcocoamenu.mm src/plugins/platforms/ios/qiosscreen.h src/plugins/platforms/ios/qioswindow.h src/plugins/platforms/ios/quiview.mm src/printsupport/dialogs/qpagesetupdialog_unix_p.h src/printsupport/dialogs/qprintpreviewdialog.cpp src/printsupport/widgets/qcupsjobwidget_p.h src/widgets/widgets/qmenu.cpp tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp Change-Id: Iecb4883122efe97ef0ed850271e6c51bab568e9c
@ -1037,7 +1037,8 @@ foreach my $lib (@modules_to_sync) {
|
|||||||
|
|
||||||
my $clean_header;
|
my $clean_header;
|
||||||
my $requires;
|
my $requires;
|
||||||
my $iheader = $subdir . "/" . $header;
|
my $iheader_src = $subdir . "/" . $header;
|
||||||
|
my $iheader = $iheader_src;
|
||||||
$iheader =~ s/^\Q$basedir\E/$out_basedir/ if ($shadow);
|
$iheader =~ s/^\Q$basedir\E/$out_basedir/ if ($shadow);
|
||||||
if ($check_includes) {
|
if ($check_includes) {
|
||||||
# We need both $public_header and $private_header because QPA headers count as neither
|
# We need both $public_header and $private_header because QPA headers count as neither
|
||||||
@ -1079,7 +1080,7 @@ foreach my $lib (@modules_to_sync) {
|
|||||||
}
|
}
|
||||||
$header_copies++ if (!$shadow && syncHeader($lib, $oheader, $iheader, $copy_headers, $ts));
|
$header_copies++ if (!$shadow && syncHeader($lib, $oheader, $iheader, $copy_headers, $ts));
|
||||||
|
|
||||||
my $pri_install_iheader = fixPaths($iheader, $dir);
|
my $pri_install_iheader = fixPaths($iheader_src, $dir);
|
||||||
my $injection = "";
|
my $injection = "";
|
||||||
if ($public_header) {
|
if ($public_header) {
|
||||||
foreach my $class (@classes) {
|
foreach my $class (@classes) {
|
||||||
|
@ -9,6 +9,12 @@ ICU_PREFIX=/opt/icu42 ICU_LIBS="-licui18n -licuuc -licudata".
|
|||||||
It is also possible to manipulate any QMAKE_* variable, to amend the values
|
It is also possible to manipulate any QMAKE_* variable, to amend the values
|
||||||
from the mkspec for the build of Qt itself, e.g., QMAKE_CXXFLAGS+=-g3.
|
from the mkspec for the build of Qt itself, e.g., QMAKE_CXXFLAGS+=-g3.
|
||||||
|
|
||||||
|
Note that the *_LIBS* and QMAKE_* assignments manipulate lists, so items
|
||||||
|
containing meta characters (spaces in particular) need to be quoted according
|
||||||
|
to qmake rules. On top of that, the assignments as a whole need to be quoted
|
||||||
|
according to shell rules. It is recommended to use single quotes for the inner
|
||||||
|
quoting and double quotes for the outer quoting.
|
||||||
|
|
||||||
Top-level installation directories:
|
Top-level installation directories:
|
||||||
-prefix <dir> ...... The deployment directory, as seen on the target device.
|
-prefix <dir> ...... The deployment directory, as seen on the target device.
|
||||||
[/usr/local/Qt-$QT_VERSION, $PWD if -developer-build]
|
[/usr/local/Qt-$QT_VERSION, $PWD if -developer-build]
|
||||||
@ -60,8 +66,10 @@ Configure meta:
|
|||||||
-redo ................ Re-configure with previously used options.
|
-redo ................ Re-configure with previously used options.
|
||||||
Additional options may be passed, but will not be
|
Additional options may be passed, but will not be
|
||||||
saved for later use by -redo.
|
saved for later use by -redo.
|
||||||
-recheck ............. Discard cached negative configure test results.
|
-recheck [test,...] .. Discard cached negative configure test results.
|
||||||
Use this after installing missing dependencies.
|
Use this after installing missing dependencies.
|
||||||
|
Alternatively, if tests are specified, only their
|
||||||
|
results are discarded.
|
||||||
-recheck-all ......... Discard all cached configure test results.
|
-recheck-all ......... Discard all cached configure test results.
|
||||||
|
|
||||||
-feature-<feature> ... Enable <feature>
|
-feature-<feature> ... Enable <feature>
|
||||||
|
@ -753,7 +753,7 @@
|
|||||||
"sanitizer": {
|
"sanitizer": {
|
||||||
"label": "Sanitizers",
|
"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_undefined",
|
||||||
"output": [ "publicConfig" ]
|
"output": [ "sanitizer", "publicConfig" ]
|
||||||
},
|
},
|
||||||
"GNUmake": {
|
"GNUmake": {
|
||||||
"label": "GNU make",
|
"label": "GNU make",
|
||||||
|
@ -580,7 +580,7 @@ defineTest(qtConfOutput_prepareOptions) {
|
|||||||
else: \
|
else: \
|
||||||
qtConfFatalError("Cannot detect the Android host." \
|
qtConfFatalError("Cannot detect the Android host." \
|
||||||
"Please use -android-ndk-host option to specify one.")
|
"Please use -android-ndk-host option to specify one.")
|
||||||
qtConfAddNotice("Available Android host does not match host architecture.")
|
qtConfAddNote("Available Android host does not match host architecture.")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
!exists($$ndk_tc_pfx/$$ndk_host/*): \
|
!exists($$ndk_tc_pfx/$$ndk_host/*): \
|
||||||
@ -899,6 +899,19 @@ defineTest(qtConfOutput_shared) {
|
|||||||
export(CONFIG)
|
export(CONFIG)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defineTest(qtConfOutput_sanitizer) {
|
||||||
|
!$${2}: return()
|
||||||
|
|
||||||
|
# Export this here, so that WebEngine can access it at configure time.
|
||||||
|
CONFIG += sanitizer
|
||||||
|
$$qtConfEvaluate("features.sanitize_address"): CONFIG += sanitize_address
|
||||||
|
$$qtConfEvaluate("features.sanitize_thread"): CONFIG += sanitize_thread
|
||||||
|
$$qtConfEvaluate("features.sanitize_memory"): CONFIG += sanitize_memory
|
||||||
|
$$qtConfEvaluate("features.sanitize_undefined"): CONFIG += sanitize_undefined
|
||||||
|
|
||||||
|
export(CONFIG)
|
||||||
|
}
|
||||||
|
|
||||||
defineTest(qtConfOutput_architecture) {
|
defineTest(qtConfOutput_architecture) {
|
||||||
arch = $$qtConfEvaluate("tests.architecture.arch")
|
arch = $$qtConfEvaluate("tests.architecture.arch")
|
||||||
buildabi = $$qtConfEvaluate("tests.architecture.buildabi")
|
buildabi = $$qtConfEvaluate("tests.architecture.buildabi")
|
||||||
|
576
dist/changes-5.10.0
vendored
Normal file
@ -0,0 +1,576 @@
|
|||||||
|
Qt 5.10 introduces many new features and improvements as well as bugfixes
|
||||||
|
over the 5.9.x series. For more details, refer to the online documentation
|
||||||
|
included in this distribution. The documentation is also available online:
|
||||||
|
|
||||||
|
http://doc.qt.io/qt-5/index.html
|
||||||
|
|
||||||
|
The Qt version 5.10 series is binary compatible with the 5.9.x series.
|
||||||
|
Applications compiled for 5.9 will continue to run with 5.10.
|
||||||
|
|
||||||
|
Some of the changes listed in this file include issue tracking numbers
|
||||||
|
corresponding to tasks in the Qt Bug Tracker:
|
||||||
|
|
||||||
|
https://bugreports.qt.io/
|
||||||
|
|
||||||
|
Each of these identifiers can be entered in the bug tracker to obtain more
|
||||||
|
information about a particular change.
|
||||||
|
|
||||||
|
****************************************************************************
|
||||||
|
* Important Behavior Changes *
|
||||||
|
****************************************************************************
|
||||||
|
|
||||||
|
- [QTBUG-60857] The names of the roles returned by
|
||||||
|
QSqlQueryModel::roleNames now only include a name for the
|
||||||
|
Qt::DisplayRole. Previously all the roles names of QSqlQueryModel were
|
||||||
|
returned.
|
||||||
|
- QFileInfo on empty strings now behaves like the default-constructed
|
||||||
|
QFileInfo. Notably, path() will now be the empty string too, instead of
|
||||||
|
".", which means absoluteFilePath() is no longer the current working
|
||||||
|
directory.
|
||||||
|
|
||||||
|
- QTemporaryFile:
|
||||||
|
* rename() no longer attempts to do block copying, as that usually
|
||||||
|
indicates a mistake in the user's code. Instead, either create the
|
||||||
|
temporary file in the same directory as the new name to be, or use
|
||||||
|
QSaveFile.
|
||||||
|
* On Linux, QTemporaryFile will attempt to create unnamed temporary
|
||||||
|
files. If that succeeds, open() will return true but exists() will be
|
||||||
|
false. If you call fileName() or any function that calls it,
|
||||||
|
QTemporaryFile will give the file a name, so most applications will
|
||||||
|
not see a difference.
|
||||||
|
|
||||||
|
- Windows:
|
||||||
|
* [QTBUG-62662] On Windows, a drag & drop operation of local file URIs,
|
||||||
|
like QListView items backed by a QFileSystemModel, will result in the
|
||||||
|
attachment or opening of the files by the target application, instead
|
||||||
|
of the creation of hyperlinks.
|
||||||
|
|
||||||
|
****************************************************************************
|
||||||
|
* General Notes *
|
||||||
|
****************************************************************************
|
||||||
|
|
||||||
|
Deprecation Notice
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Starting with Qt 5.10, IPv6 support is mandatory for all platforms.
|
||||||
|
Systems without proper IPv6 support, such as the getaddrinfo() function
|
||||||
|
or the proper socket address structures, will not be able to build
|
||||||
|
QtNetwork anymore.
|
||||||
|
|
||||||
|
- QSignalMapper is now marked as deprecated.
|
||||||
|
|
||||||
|
Potentially Source-Incompatible Changes
|
||||||
|
---------------------------------------
|
||||||
|
|
||||||
|
- QByteArray:
|
||||||
|
* qbytearray.h no longer includes qstring.h. In particular, this means
|
||||||
|
that in order to use QStringBuilder with QByteArray, you need to
|
||||||
|
include both qbytearray.h and qstring.h now (or <QByteArray> and
|
||||||
|
<QString>, resp.).
|
||||||
|
|
||||||
|
- QStaticText:
|
||||||
|
* The QStaticText(const QString &) constructor is now explicit.
|
||||||
|
|
||||||
|
Third-Party Code
|
||||||
|
----------------
|
||||||
|
|
||||||
|
- PCRE2 has been updated to version 10.30.
|
||||||
|
- Replaced bundled libjpeg by libjpeg-turbo 1.5.2
|
||||||
|
- Improve documentation about Freetype 2 licenses.
|
||||||
|
- Sqlite was updated to version 3.20.1
|
||||||
|
|
||||||
|
****************************************************************************
|
||||||
|
* Library *
|
||||||
|
****************************************************************************
|
||||||
|
|
||||||
|
QtCore
|
||||||
|
------
|
||||||
|
|
||||||
|
- Added qHash(QStringView).
|
||||||
|
- [QTBUG-37253] Added QMetaObject::invokeMethod() overloads for function
|
||||||
|
pointers.
|
||||||
|
- [QTBUG-41006] Added qEnvironmentVariable, which returns the value of an
|
||||||
|
environment variable in a QString, while qgetenv continues to be used to
|
||||||
|
return it in a QByteArray. For Unix, since most environment variables
|
||||||
|
seem to contain path names, qEnvironmentVariable will do the same as
|
||||||
|
QFile::decodeName, which means NFC/NFD conversion on Apple OSes.
|
||||||
|
- [QTBUG-62915] qAddPostRoutine() and qRemovePostRoutine() are now
|
||||||
|
thread-safe.
|
||||||
|
|
||||||
|
- Containers:
|
||||||
|
* Added an STL-like iterator to go through QHash/QMap returning both the
|
||||||
|
key and the value of the element pointed to. That lets QHash/QMap
|
||||||
|
interoperate better with stl's algorithms like std::set_union.
|
||||||
|
|
||||||
|
- JSON:
|
||||||
|
* QJsonArray, QJsonDocument, QJsonObject and QJsonValue now have move
|
||||||
|
operations and a swap() member function.
|
||||||
|
|
||||||
|
- Logging:
|
||||||
|
* If you set QT_FATAL_WARNINGS to a number n > 1, Qt will stop the
|
||||||
|
application on that n-th warning, instead of on the first. For the
|
||||||
|
sake of compatibility with previous versions, if the variable is set
|
||||||
|
to any non-empty and non-numeric value, Qt will understand it as "stop
|
||||||
|
on first warning".
|
||||||
|
|
||||||
|
- QByteArray:
|
||||||
|
* Added shrink_to_fit() for compatibility with the Standard Library. This
|
||||||
|
function does the same as squeeze().
|
||||||
|
|
||||||
|
- QChar:
|
||||||
|
* Added constructors from char16_t and, on Windows, wchar_t.
|
||||||
|
|
||||||
|
- QCoreApplication:
|
||||||
|
* [QTBUG-57095] Calling QCoreApplication::translate() is now
|
||||||
|
thread-safe.
|
||||||
|
|
||||||
|
- QCryptographicHash:
|
||||||
|
* [QTBUG-59770] In order to preserve compatibility with earlier versions
|
||||||
|
of Qt, QCryptographicHash is now able to calculate Keccak message
|
||||||
|
digests. Please see the release notes for Qt 5.9.2 for more details.
|
||||||
|
|
||||||
|
- QDate/QTime/QDateTime:
|
||||||
|
* Added toString() overloads taking the format as a QStringView.
|
||||||
|
* [QTBUG-22833] Added support for parsing of time-zones.
|
||||||
|
|
||||||
|
- QDebug:
|
||||||
|
* Added streaming of QStringViews.
|
||||||
|
|
||||||
|
- QFile:
|
||||||
|
* [QTBUG-984] Added fileTime() and setFileTime().
|
||||||
|
|
||||||
|
- QFileInfo:
|
||||||
|
* [QTBUG-984] Added fileTime().
|
||||||
|
* Deprecated created() because it could return one of three different
|
||||||
|
file times depending on the OS and filesystem type, without the
|
||||||
|
ability to determine which one is which. It is replaced by
|
||||||
|
metadataChangeTime() and birthTime().
|
||||||
|
* Added QFileInfo::metadataChangeTime(), which returns the time the
|
||||||
|
file's metadata was last changed, if it is known, and falling back to
|
||||||
|
the same value as lastModified() otherwise. On Unix systems, this
|
||||||
|
corresponds to the file's ctime.
|
||||||
|
* Added QFileInfo::birthTime(), which returns the file's birth time if
|
||||||
|
it is known, an invalid QDateTime otherwise. This function is
|
||||||
|
supported on Windows and on some Unix systems.
|
||||||
|
|
||||||
|
- QIODevice:
|
||||||
|
* Added skip() method to improve performance in read operations.
|
||||||
|
|
||||||
|
- QLatin1String:
|
||||||
|
* Added isEmpty(), isNull().
|
||||||
|
* Added iterators, {c,}{r,}{begin,end}().
|
||||||
|
* Added chopped(), chop(), truncate().
|
||||||
|
* Added startsWith(), endsWith().
|
||||||
|
* Added a constructor taking two pointers, complementing the constructor
|
||||||
|
that takes a pointer and a length.
|
||||||
|
* Added trimmed() function.
|
||||||
|
|
||||||
|
- QLocale:
|
||||||
|
* Added toString(QDate/QTime/QDateTime) overloads taking the format
|
||||||
|
string as a QStringView.
|
||||||
|
* Added QLocale::formattedDataSize() for formatting quantities of bytes
|
||||||
|
as kB, MB, GB etc.
|
||||||
|
|
||||||
|
- QLockFile:
|
||||||
|
* Fixed a bug that would cause QLockFile to mis-identify valid lock
|
||||||
|
files as stale if the application name was set with
|
||||||
|
QCoreApplication::setApplicationName().
|
||||||
|
|
||||||
|
- QMimeType:
|
||||||
|
* Add Q_GADGET, so that QML applications can make use of QMimeType's
|
||||||
|
properties and methods.
|
||||||
|
|
||||||
|
- QObject:
|
||||||
|
* [QTBUG-60339] Added connect() support for move-only function objects.
|
||||||
|
|
||||||
|
- QProcess:
|
||||||
|
* [QTBUG-2058][QTBUG-2284][QTBUG-37656][QTBUG-52405][QTBUG-57687] Added
|
||||||
|
non-static QProcess::startDetached to support more features for
|
||||||
|
detached processes.
|
||||||
|
* [QTBUG-2284] Added the ability to set a custom process environment for
|
||||||
|
detached processes.
|
||||||
|
* [QTBUG-52405] Added the ability to specify native arguments for
|
||||||
|
detached processes on Windows.
|
||||||
|
* [QTBUG-2058][QTBUG-37656] Added support for standard channel
|
||||||
|
redirection using setStandard{Input|Output|Error}File to
|
||||||
|
QProcess::startDetached.
|
||||||
|
|
||||||
|
- QSaveFile:
|
||||||
|
* [QTBUG-47379] Saving to Alternate Data Streams on NTFS on Windows is
|
||||||
|
now possible, but requires setDirectWriteFallback(true).
|
||||||
|
|
||||||
|
- QSemaphore:
|
||||||
|
* Added a new RAII class, QSemaphoreReleaser, to reliably perform
|
||||||
|
release() calls.
|
||||||
|
|
||||||
|
- QSettings:
|
||||||
|
* [QTBUG-47379] Added setAtomicSyncRequired(), which allows one to use
|
||||||
|
QSettings with config files in unwriteable directories or in Alternate
|
||||||
|
Data Streams on NTFS on Windows. This used to work before Qt 5.4, but
|
||||||
|
remains a non-default behavior due to the potential of data
|
||||||
|
corruption.
|
||||||
|
|
||||||
|
- QSortFilterProxyModel:
|
||||||
|
* QSortFilterProxyModel now does not emit an unnecessary layoutChanged()
|
||||||
|
following a model reset.
|
||||||
|
|
||||||
|
- QStandardPaths:
|
||||||
|
* On Windows, QStandardPaths now also looks into
|
||||||
|
"<APPDIR>/data/<APPNAME>" for non-generic paths.
|
||||||
|
|
||||||
|
- QString:
|
||||||
|
* Added arg(QStringView), arg(QLatin1String) overloads.
|
||||||
|
* Added shrink_to_fit(), for compatibility with the Standard
|
||||||
|
Library. This function does the same as squeeze().
|
||||||
|
|
||||||
|
- QString/QStringRef:
|
||||||
|
* Added startsWith(), endsWith() overloads taking QStringView.
|
||||||
|
|
||||||
|
- QString/QStringRef/QByteArray:
|
||||||
|
* Added chopped(n), a const version of chop(n).
|
||||||
|
|
||||||
|
- QString/QStringRef/QByteArray/QLatin1String:
|
||||||
|
* Added front() and back() for STL compatibility.
|
||||||
|
|
||||||
|
- QStringBuilder:
|
||||||
|
* Added support for (non-const) char*.
|
||||||
|
|
||||||
|
- QStringList:
|
||||||
|
* Added contains(QLatin1String) overload.
|
||||||
|
|
||||||
|
- QStringRef:
|
||||||
|
* trimmed() now returns an empty string-ref for an empty input. Before,
|
||||||
|
it would return a null one.
|
||||||
|
|
||||||
|
- QStringView:
|
||||||
|
* New class, superseding const QString and QStringRef as function
|
||||||
|
parameters, accepting a wide variety of UTF-16 string data sources,
|
||||||
|
e.g. u"string", std::u16string{,_view}, and, on Windows, L"string",
|
||||||
|
std::wstring{,_view} without converting to QString first.
|
||||||
|
|
||||||
|
- QTemporaryDir:
|
||||||
|
* The class now supports the "XXXXXX" replacement token anywhere in the
|
||||||
|
template, not just at the end. This behavior is similar to what
|
||||||
|
QTemporaryFile supports.
|
||||||
|
|
||||||
|
- QTextCodec:
|
||||||
|
* Added fromUnicode() and canEncode() overloads taking QStringView.
|
||||||
|
|
||||||
|
- QTextEncoder:
|
||||||
|
* Added fromUnicode() overload taking QStringView.
|
||||||
|
|
||||||
|
- QThread:
|
||||||
|
* Added the QThread::create() function.
|
||||||
|
* An exception escaping from QThread::run() will now result in immediate
|
||||||
|
and abnormal program termination. The same applies if an exception
|
||||||
|
leaves a slot connected directly to the QThread::started() or
|
||||||
|
QThread::finished() signals.
|
||||||
|
|
||||||
|
- QUuid:
|
||||||
|
* Added fromString(QStringView/QLatin1String).
|
||||||
|
|
||||||
|
- QVariant:
|
||||||
|
* QVariants containing pointers will now return true on isNull() if the
|
||||||
|
contained pointer is null.
|
||||||
|
|
||||||
|
- QVarLengthArray:
|
||||||
|
* Added shrink_to_fit(), for compatibility with the Standard Library.
|
||||||
|
|
||||||
|
- QVector:
|
||||||
|
* Added shrink_to_fit(), for compatibility with the Standard Library.
|
||||||
|
|
||||||
|
- QVersionNumber:
|
||||||
|
* Added QStringView and QLatin1String overloads of fromString().
|
||||||
|
|
||||||
|
- QtGlobal:
|
||||||
|
* Q_ASSERT() and Q_ASSERT_X() now always expand to expressions of type
|
||||||
|
void that are usable in constexpr contexts. This makes them usable in
|
||||||
|
both C++11 and C++14 constexpr functions and in comma expressions.
|
||||||
|
|
||||||
|
QtGui
|
||||||
|
-----
|
||||||
|
|
||||||
|
- [QTBUG-55981] Added support for rendering to QWindow via the Vulkan
|
||||||
|
graphics API.
|
||||||
|
- [QTBUG-55981] Added QVulkanWindow, a convenience subclass of QWindow.
|
||||||
|
- Added support for the OpenGL ES 3.2 API in QOpenGLExtraFunctions
|
||||||
|
- [QTBUG-50987] Added support for requesting OpenGL windows with
|
||||||
|
sRGB-capable default framebuffers. While this is implicit on some
|
||||||
|
platforms, QSurfaceFormat now has the necessary flags to request such
|
||||||
|
windows in a cross-platform manner.
|
||||||
|
- High DPI variants of 9-patch images can now be loaded using the
|
||||||
|
following syntax: "foo@2x.9.png"
|
||||||
|
- It's now possible to retrieve the screen at a given point via
|
||||||
|
QGuiApplication::screenAt().
|
||||||
|
|
||||||
|
- Important Behvior Changes:
|
||||||
|
* [QTBUG-56848][QTCREATORBUG-17683] Changed CSS line-height property
|
||||||
|
with multiplier to follow CSS spec
|
||||||
|
|
||||||
|
- Tablet support:
|
||||||
|
* [QTBUG-44964] If the application attribute AA_CompressTabletEvents is
|
||||||
|
set in addition to AA_CompressHighFrequencyEvents, even the
|
||||||
|
QTabletEvents will be compressed (only on the X11 platform so far).
|
||||||
|
AA_CompressHighFrequencyEvents does not enable compression of tablet
|
||||||
|
events by itself, because paint applications typically need to process
|
||||||
|
all possible tablet events in order to draw the smoothest curves.
|
||||||
|
|
||||||
|
- QPA:
|
||||||
|
* [QTBUG-57608] QWindowSystemInterfacePrivate::handleGeometryChange no
|
||||||
|
longer takes the old geometry as an argument.
|
||||||
|
|
||||||
|
- QImage:
|
||||||
|
* QImages can now use more than 2GByte of pixel data.
|
||||||
|
|
||||||
|
- QCursor:
|
||||||
|
* Added equality operators.
|
||||||
|
|
||||||
|
- QImageWriter:
|
||||||
|
* Add QImageWriter::InvalidImageError to communicate invalid attempts to
|
||||||
|
write a bad QImage (for instance, a null QImage).
|
||||||
|
|
||||||
|
- QMovie:
|
||||||
|
* Added lastError and lastErrorString accessors, as a convenience over
|
||||||
|
connecting to the error() signal.
|
||||||
|
|
||||||
|
- QWindow:
|
||||||
|
* setMask() no longer requires the window to be created to have an
|
||||||
|
effect; it can be set at any time.
|
||||||
|
|
||||||
|
- Text:
|
||||||
|
* [QTBUG-56728] Added QFont::PreferNoShaping style strategy to support
|
||||||
|
improvements to performance at the expense of some cosmetic font
|
||||||
|
features.
|
||||||
|
|
||||||
|
- Windows:
|
||||||
|
* [QTBUG-55967] Native menus have been implemented.
|
||||||
|
* A native system tray icon is now available for SystemTrayIcon.
|
||||||
|
|
||||||
|
QtNetwork
|
||||||
|
---------
|
||||||
|
|
||||||
|
- [QTBUG-56102] QSslSocket can now use a temporary keychain on macOS.
|
||||||
|
- Fixed a proxy-authentication issue, after a wrong password has been used,
|
||||||
|
when supplying the right password.
|
||||||
|
|
||||||
|
- HTTP/2:
|
||||||
|
* [QTBUG-61397] In case of clear text HTTP/2 we now initiate a required
|
||||||
|
protocol upgrade procedure instead of 'H2Direct' connection.
|
||||||
|
|
||||||
|
- QHostInfo:
|
||||||
|
* Added swap() and move operator.
|
||||||
|
|
||||||
|
- QLocalServer:
|
||||||
|
* [QTBUG-55043] Added a function to retrieve the socket descriptor.
|
||||||
|
|
||||||
|
- QNetworkAccessManager:
|
||||||
|
* [QTBUG-63075] Added support for HTTP status 308.
|
||||||
|
|
||||||
|
- QNetworkInterface:
|
||||||
|
* [QTBUG-51922] Changed allAddresses() to not include addresses found in
|
||||||
|
inactive interfaces, matching the user expectations of this function.
|
||||||
|
If those addresses are needed for some purpose, the application can
|
||||||
|
call allInterfaces() and obtain the addresses in each interface.
|
||||||
|
|
||||||
|
- QNetworkProxy:
|
||||||
|
* [QTBUG-45495] Setting of network proxies is now supported on UWP.
|
||||||
|
* [QTBUG-45495] UWP now supports proxies using SOCKS5.
|
||||||
|
* The functions related to QNetworkConfiguration are deprecated. They've
|
||||||
|
performed no action since Qt 5.0, so code using them can safely stop
|
||||||
|
doing so.
|
||||||
|
|
||||||
|
- QSslSocket:
|
||||||
|
* [QTBUG-52905] Added OpenSSL 1.1 backend.
|
||||||
|
|
||||||
|
QtSql
|
||||||
|
-----
|
||||||
|
|
||||||
|
- QSqlError:
|
||||||
|
* Added swap().
|
||||||
|
|
||||||
|
- SQLite:
|
||||||
|
* Named placeholder can now be used. If compiling Qt by hand and using
|
||||||
|
system libraries, this feature requires at least SQLite 3.3.11.
|
||||||
|
* [QTBUG-18084] Added QSQLITE_ENABLE_REGEXP connect option for the SQLite
|
||||||
|
backend. If set, a Qt based regexp() implementation is provided
|
||||||
|
allowing use of REGEXP in SQL statements.
|
||||||
|
|
||||||
|
QtTest
|
||||||
|
------
|
||||||
|
|
||||||
|
- [QTBUG-53381] Added keySequence() function.
|
||||||
|
|
||||||
|
- QCOMPARE:
|
||||||
|
* Can now be used for mixed-type comparisons.
|
||||||
|
* Now outputs contents of QPair and std::pair on failure.
|
||||||
|
* Now supports printing QStringViews in case of test failures.
|
||||||
|
|
||||||
|
QtWidgets
|
||||||
|
---------
|
||||||
|
|
||||||
|
- The windowsxp style is no longer available as a separate style, because
|
||||||
|
it did not (and cannot) actually provide an XP-style appearance on
|
||||||
|
currently supported Qt platforms.
|
||||||
|
- Added AA_DisableWindowContextHelpButton attribute. Setting this
|
||||||
|
attribute globally prevents the automatic "What's this" button on
|
||||||
|
dialogs on Windows (WindowsContextHelpButtonHint).
|
||||||
|
- [QTBUG-56860] Fixed widget losing focus after showing menu second time.
|
||||||
|
- [QTBUG-47185][QTBUG-61280] QOpenGLWidget is now able to render and
|
||||||
|
return its content via grabFramebuffer(), QWidget::grab() or
|
||||||
|
QWidget::render() even when the widget has not been made visible.
|
||||||
|
- [QTBUG-10907] When tabbing to a widget with focus proxy, focus will now
|
||||||
|
be given to the proxy rather than just being ignored.
|
||||||
|
|
||||||
|
- ItemViews:
|
||||||
|
* Made it easier to drop above and below items.
|
||||||
|
|
||||||
|
- QAbstractItemView/QTreeWidget/QTableWidget/QListWidget:
|
||||||
|
* [QTBUG-61139] Added isPersistentEditorOpen().
|
||||||
|
|
||||||
|
- QDockWidget:
|
||||||
|
* When QMainWindow::GrouppedDragging and QMainWindow::AllowNestedDocks
|
||||||
|
are both enabled, floating dock widgets now have the ability to be
|
||||||
|
dropped together side by side.
|
||||||
|
* [QTBUG-63526] Fixed an issue in QDockWidgets where the widget would
|
||||||
|
not resize despite showing a resize cursor.
|
||||||
|
|
||||||
|
- QFusionStyle:
|
||||||
|
* The default palette used by the platform-agnostic Fusion style has
|
||||||
|
been desaturated. Previously the window background color, and other
|
||||||
|
colors derived from it, were brown shades. Now these colors are
|
||||||
|
neutral gray that fit better on any desktop.
|
||||||
|
|
||||||
|
- QInputDialog:
|
||||||
|
* [QTBUG-17547] Added setDoubleStep to enable changing of the step
|
||||||
|
amount for getDouble().
|
||||||
|
|
||||||
|
- QLineEdit:
|
||||||
|
* Added selectionEnd(), selectionLength(), complementing
|
||||||
|
selectionStart().
|
||||||
|
|
||||||
|
- QOpenGLWidget:
|
||||||
|
* [QTBUG-50987] Added support for specifying custom internal texture
|
||||||
|
formats in QOpenGLWidget in order to make it possible to have the
|
||||||
|
widget backed by an sRGB-capable framebuffer.
|
||||||
|
|
||||||
|
- QSplashScreen:
|
||||||
|
* All constructors now implicitly set Qt::FramelessWindowHint, not just
|
||||||
|
the (pixmap, flags) one.
|
||||||
|
|
||||||
|
- QWidget:
|
||||||
|
* [QTBUG-10907] QWidget::setTabOrder() will now preserve the local tab
|
||||||
|
order inside a widget if it has a focus proxy set to an inner child.
|
||||||
|
|
||||||
|
- Styles:
|
||||||
|
* Added SH_Widget_Animation_Duration style hint which supersedes
|
||||||
|
SH_Widget_Animate, which is now deprecated.
|
||||||
|
|
||||||
|
- Text:
|
||||||
|
* Introduced tabStopDistance property in QTextOption, QTextEdit and
|
||||||
|
QPlainTextEdit as replacement for the inconsistently named tabStop and
|
||||||
|
tabStopWidth properties. QTextOption::tabStop, QTextEdit::tabStopWidth
|
||||||
|
and QPlainTextEdit::tabStopWidth are now deprecated.
|
||||||
|
|
||||||
|
****************************************************************************
|
||||||
|
* Platform-specific Changes *
|
||||||
|
****************************************************************************
|
||||||
|
|
||||||
|
- [QTBUG-60268] Input context is now supported with the offscreen platform.
|
||||||
|
|
||||||
|
Android
|
||||||
|
-------
|
||||||
|
|
||||||
|
- QtLoader: Enabled loading shared libraries from /system/lib or a custom
|
||||||
|
path specified with the android.app.system_libs_prefix metadata variable in
|
||||||
|
AndroidManifest.xml. This supports deploying Qt apps as Android system
|
||||||
|
apps.
|
||||||
|
- [QTBUG-58060] Android dialogs now have more appropriate button layouts,
|
||||||
|
with affirmative actions on the right.
|
||||||
|
- [QTBUG-59175] QWidget::createWindowContainer() is now supported on
|
||||||
|
Android for embedding OpenGL-based QWindows into widget UIs.
|
||||||
|
|
||||||
|
iOS
|
||||||
|
---
|
||||||
|
|
||||||
|
- [QTBUG-59403] Support added for using the input panel as a trackpad
|
||||||
|
using two-finger swipe.
|
||||||
|
- The minimum deployment target for applications is now iOS 10.0.
|
||||||
|
|
||||||
|
Linux
|
||||||
|
-----
|
||||||
|
|
||||||
|
- Qt uses the statx(2) system call for obtaining file information on
|
||||||
|
kernels 4.12 and later. Some older container systems install system call
|
||||||
|
protection rules that do not include this system call. If you experience
|
||||||
|
problems running Qt applications inside containers (such as the report of
|
||||||
|
a file not existing when it does), ensure the statx(2) is allowed in the
|
||||||
|
container configuration.
|
||||||
|
|
||||||
|
- Linux/XCB:
|
||||||
|
* Added screen product information from EDID.
|
||||||
|
|
||||||
|
- eglfs/KMS:
|
||||||
|
* Screen modes, including current and preferred ones, are now listed.
|
||||||
|
* Added screen product information from EDID.
|
||||||
|
|
||||||
|
Windows
|
||||||
|
-------
|
||||||
|
|
||||||
|
- Accessibility:
|
||||||
|
* MinGW builds now support IAccessible2.
|
||||||
|
|
||||||
|
- Fonts:
|
||||||
|
* [QTBUG-62176] Some key fonts, such as Calibri, were being detected as
|
||||||
|
bitmap fonts and not rendered correctly in Qt Quick. This has now been
|
||||||
|
fixed.
|
||||||
|
|
||||||
|
X11
|
||||||
|
---
|
||||||
|
|
||||||
|
- Native painting (instead of software rasterization) has been experimentally
|
||||||
|
re-introduced. Enabled by the configure option -xcb-native-painting.
|
||||||
|
- XInput device property changes are now detected at runtime (no
|
||||||
|
application restart required).
|
||||||
|
- [QTBUG-60513][QTBUG-29278][QTBUG-43768][QTBUG-18380] The _NET_WORKAREA
|
||||||
|
atom is used for calculating QScreen::availableGeometry() only on systems
|
||||||
|
with one monitor. In all other cases QScreen::availableGeometry() is
|
||||||
|
equal to QScreen::geometry(). To restore the legacy behavior with
|
||||||
|
untrustworthy values in QScreen::availableGeometry() set
|
||||||
|
QT_RELY_ON_NET_WORKAREA_ATOM=1 in the environment.
|
||||||
|
- The QT_XCB_NO_XI2_MOUSE environment variable is deprecated and will be
|
||||||
|
removed in Qt 6. If your application relies on behavior set by
|
||||||
|
QT_XCB_NO_XI2_MOUSE, it should be updated accordingly.
|
||||||
|
|
||||||
|
- Pointer event delivery on X11 is now done starting from XInput version
|
||||||
|
2.0 (when available) instead of 2.2. XInput support can be disabled by
|
||||||
|
setting QT_XCB_NO_XI2=1 in the environment; note that doing so will also
|
||||||
|
disable tablet and touch support.
|
||||||
|
|
||||||
|
****************************************************************************
|
||||||
|
* Tools *
|
||||||
|
****************************************************************************
|
||||||
|
|
||||||
|
moc
|
||||||
|
---
|
||||||
|
|
||||||
|
- moc now supports NOTIFY signals of parent classes in Q_PROPERTY
|
||||||
|
|
||||||
|
qmake
|
||||||
|
-----
|
||||||
|
|
||||||
|
- [QTBUG-1581] Introduced the variable OBJECTIVE_HEADERS.
|
||||||
|
- [QTBUG-11117][nmake] Added support for precompiled header also for
|
||||||
|
plain C files.
|
||||||
|
- Added versionAtLeast() and versionAtMost() test functions.
|
||||||
|
- If you use CONFIG+=qmltestcase with no SOURCES, 'make check' will now
|
||||||
|
run qmltestrunner for you.
|
||||||
|
- [Darwin] Added support for Info.plist in non-bundle apps and libs.
|
||||||
|
|
||||||
|
uic
|
||||||
|
---
|
||||||
|
|
||||||
|
- [QTBUG-51602] Added the no-stringliteral option, to be used for building
|
||||||
|
shared objects which are meant to be unloadable.
|
||||||
|
- Old images embedded in ui files, imported from Qt 3, are now ignored.
|
||||||
|
uic will now behave consistently with Qt Designer - both will ignore
|
||||||
|
them.
|
@ -30,26 +30,6 @@
|
|||||||
|
|
||||||
manifestmeta.filters = highlighted android thumbnail ios
|
manifestmeta.filters = highlighted android thumbnail ios
|
||||||
|
|
||||||
manifestmeta.highlighted.names = "QtQuick/Qt Quick Demo - Same Game" \
|
|
||||||
"QtQuick/Qt Quick Demo - Photo Surface" \
|
|
||||||
"QtQuick/Qt Quick Demo - Tweet Search" \
|
|
||||||
"QtQuick/Qt Quick Demo - Calqlatr" \
|
|
||||||
"QtQuick/Qt Quick Demo - StocQt" \
|
|
||||||
"QtQuick/Qt Quick Demo - Clocks" \
|
|
||||||
"QtQuick/Qt Quick Examples - Shader Effects" \
|
|
||||||
"QtQuickExtras/Qt Quick Extras - Dashboard" \
|
|
||||||
"QtQuickExtras/Qt Quick Extras - Flat" \
|
|
||||||
"QtQuickExtras/Qt Quick Extras - Gallery" \
|
|
||||||
"QtQuickDialogs/Qt Quick System Dialog Examples" \
|
|
||||||
"QtWinExtras/Quick Player" \
|
|
||||||
"QtMultimedia/QML Video Shader Effects Example" \
|
|
||||||
"QtCanvas3D/Interactive Mobile Phone Example" \
|
|
||||||
"QtLocation/Map Viewer (QML)" \
|
|
||||||
"QtBluetooth/Bluetooth Low Energy Heart Rate Game" \
|
|
||||||
"QtCharts/Chart Themes Example" \
|
|
||||||
"QtDataVisualization/Bars Example" \
|
|
||||||
"QtDataVisualization/Surface Example"
|
|
||||||
|
|
||||||
manifestmeta.highlighted.attributes = isHighlighted:true
|
manifestmeta.highlighted.attributes = isHighlighted:true
|
||||||
|
|
||||||
manifestmeta.android.names = "QtQuick/Qt Quick Demo - Calqlatr" \
|
manifestmeta.android.names = "QtQuick/Qt Quick Demo - Calqlatr" \
|
||||||
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 9.1 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 12 KiB |
@ -55,9 +55,10 @@
|
|||||||
|
|
||||||
Receiver::Receiver(QWidget *parent)
|
Receiver::Receiver(QWidget *parent)
|
||||||
: QDialog(parent),
|
: QDialog(parent),
|
||||||
groupAddress(QStringLiteral("239.255.43.21"))
|
groupAddress4(QStringLiteral("239.255.43.21")),
|
||||||
|
groupAddress6(QStringLiteral("ff12::2115"))
|
||||||
{
|
{
|
||||||
statusLabel = new QLabel(tr("Listening for multicasted messages"));
|
statusLabel = new QLabel(tr("Listening for multicast messages on both IPv4 and IPv6"));
|
||||||
auto quitButton = new QPushButton(tr("&Quit"));
|
auto quitButton = new QPushButton(tr("&Quit"));
|
||||||
|
|
||||||
auto buttonLayout = new QHBoxLayout;
|
auto buttonLayout = new QHBoxLayout;
|
||||||
@ -72,21 +73,37 @@ Receiver::Receiver(QWidget *parent)
|
|||||||
|
|
||||||
setWindowTitle(tr("Multicast Receiver"));
|
setWindowTitle(tr("Multicast Receiver"));
|
||||||
|
|
||||||
udpSocket.bind(QHostAddress::AnyIPv4, 45454, QUdpSocket::ShareAddress);
|
udpSocket4.bind(QHostAddress::AnyIPv4, 45454, QUdpSocket::ShareAddress);
|
||||||
udpSocket.joinMulticastGroup(groupAddress);
|
udpSocket4.joinMulticastGroup(groupAddress4);
|
||||||
|
|
||||||
connect(&udpSocket, SIGNAL(readyRead()),
|
if (!udpSocket6.bind(QHostAddress::AnyIPv6, 45454, QUdpSocket::ShareAddress) ||
|
||||||
|
!udpSocket6.joinMulticastGroup(groupAddress6))
|
||||||
|
statusLabel->setText(tr("Listening for multicast messages on IPv4 only"));
|
||||||
|
|
||||||
|
connect(&udpSocket4, SIGNAL(readyRead()),
|
||||||
this, SLOT(processPendingDatagrams()));
|
this, SLOT(processPendingDatagrams()));
|
||||||
|
connect(&udpSocket6, &QUdpSocket::readyRead, this, &Receiver::processPendingDatagrams);
|
||||||
connect(quitButton, SIGNAL(clicked()), this, SLOT(close()));
|
connect(quitButton, SIGNAL(clicked()), this, SLOT(close()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Receiver::processPendingDatagrams()
|
void Receiver::processPendingDatagrams()
|
||||||
{
|
{
|
||||||
QByteArray datagram;
|
QByteArray datagram;
|
||||||
while (udpSocket.hasPendingDatagrams()) {
|
|
||||||
datagram.resize(int(udpSocket.pendingDatagramSize()));
|
// using QUdpSocket::readDatagram (API since Qt 4)
|
||||||
udpSocket.readDatagram(datagram.data(), datagram.size());
|
while (udpSocket4.hasPendingDatagrams()) {
|
||||||
statusLabel->setText(tr("Received datagram: \"%1\"")
|
datagram.resize(int(udpSocket4.pendingDatagramSize()));
|
||||||
|
udpSocket4.readDatagram(datagram.data(), datagram.size());
|
||||||
|
statusLabel->setText(tr("Received IPv4 datagram: \"%1\"")
|
||||||
.arg(datagram.constData()));
|
.arg(datagram.constData()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// using QUdpSocket::receiveDatagram (API since Qt 5.8)
|
||||||
|
while (udpSocket6.hasPendingDatagrams()) {
|
||||||
|
QNetworkDatagram dgram = udpSocket6.receiveDatagram();
|
||||||
|
statusLabel->setText(statusLabel->text() +
|
||||||
|
tr("\nReceived IPv6 datagram from [%2]:%3: \"%1\"")
|
||||||
|
.arg(dgram.data().constData(), dgram.senderAddress().toString())
|
||||||
|
.arg(dgram.senderPort()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,8 +71,10 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QLabel *statusLabel = nullptr;
|
QLabel *statusLabel = nullptr;
|
||||||
QUdpSocket udpSocket;
|
QUdpSocket udpSocket4;
|
||||||
QHostAddress groupAddress;
|
QUdpSocket udpSocket6;
|
||||||
|
QHostAddress groupAddress4;
|
||||||
|
QHostAddress groupAddress6;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -52,11 +52,21 @@
|
|||||||
|
|
||||||
Sender::Sender(QWidget *parent)
|
Sender::Sender(QWidget *parent)
|
||||||
: QDialog(parent),
|
: QDialog(parent),
|
||||||
groupAddress(QStringLiteral("239.255.43.21"))
|
groupAddress4(QStringLiteral("239.255.43.21")),
|
||||||
|
groupAddress6(QStringLiteral("ff12::2115"))
|
||||||
{
|
{
|
||||||
statusLabel = new QLabel(tr("Ready to multicast datagrams to group %1 on port 45454").arg(groupAddress.toString()));
|
// force binding to their respective families
|
||||||
|
udpSocket4.bind(QHostAddress(QHostAddress::AnyIPv4), 0);
|
||||||
|
udpSocket6.bind(QHostAddress(QHostAddress::AnyIPv6), udpSocket4.localPort());
|
||||||
|
|
||||||
auto ttlLabel = new QLabel(tr("TTL for multicast datagrams:"));
|
QString msg = tr("Ready to multicast datagrams to groups %1 and [%2] on port 45454").arg(groupAddress4.toString());
|
||||||
|
if (udpSocket6.state() != QAbstractSocket::BoundState)
|
||||||
|
msg = tr("IPv6 failed. Ready to multicast datagrams to group %1 on port 45454").arg(groupAddress4.toString());
|
||||||
|
else
|
||||||
|
msg = msg.arg(groupAddress6.toString());
|
||||||
|
statusLabel = new QLabel(msg);
|
||||||
|
|
||||||
|
auto ttlLabel = new QLabel(tr("TTL for IPv4 multicast datagrams:"));
|
||||||
auto ttlSpinBox = new QSpinBox;
|
auto ttlSpinBox = new QSpinBox;
|
||||||
ttlSpinBox->setRange(0, 255);
|
ttlSpinBox->setRange(0, 255);
|
||||||
|
|
||||||
@ -88,7 +98,8 @@ Sender::Sender(QWidget *parent)
|
|||||||
|
|
||||||
void Sender::ttlChanged(int newTtl)
|
void Sender::ttlChanged(int newTtl)
|
||||||
{
|
{
|
||||||
udpSocket.setSocketOption(QAbstractSocket::MulticastTtlOption, newTtl);
|
// we only set the TTL on the IPv4 socket, as that changes the multicast scope
|
||||||
|
udpSocket4.setSocketOption(QAbstractSocket::MulticastTtlOption, newTtl);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sender::startSending()
|
void Sender::startSending()
|
||||||
@ -101,6 +112,8 @@ void Sender::sendDatagram()
|
|||||||
{
|
{
|
||||||
statusLabel->setText(tr("Now sending datagram %1").arg(messageNo));
|
statusLabel->setText(tr("Now sending datagram %1").arg(messageNo));
|
||||||
QByteArray datagram = "Multicast message " + QByteArray::number(messageNo);
|
QByteArray datagram = "Multicast message " + QByteArray::number(messageNo);
|
||||||
udpSocket.writeDatagram(datagram, groupAddress, 45454);
|
udpSocket4.writeDatagram(datagram, groupAddress4, 45454);
|
||||||
|
if (udpSocket6.state() == QAbstractSocket::BoundState)
|
||||||
|
udpSocket6.writeDatagram(datagram, groupAddress6, 45454);
|
||||||
++messageNo;
|
++messageNo;
|
||||||
}
|
}
|
||||||
|
@ -70,9 +70,11 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
QLabel *statusLabel = nullptr;
|
QLabel *statusLabel = nullptr;
|
||||||
QPushButton *startButton = nullptr;
|
QPushButton *startButton = nullptr;
|
||||||
QUdpSocket udpSocket;
|
QUdpSocket udpSocket4;
|
||||||
|
QUdpSocket udpSocket6;
|
||||||
QTimer timer;
|
QTimer timer;
|
||||||
QHostAddress groupAddress;
|
QHostAddress groupAddress4;
|
||||||
|
QHostAddress groupAddress6;
|
||||||
int messageNo = 1;
|
int messageNo = 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.1 KiB |
@ -1,124 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of the examples of the Qt Toolkit.
|
|
||||||
**
|
|
||||||
** $QT_BEGIN_LICENSE:BSD$
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** BSD License Usage
|
|
||||||
** Alternatively, you may use this file under the terms of the BSD license
|
|
||||||
** as follows:
|
|
||||||
**
|
|
||||||
** "Redistribution and use in source and binary forms, with or without
|
|
||||||
** modification, are permitted provided that the following conditions are
|
|
||||||
** met:
|
|
||||||
** * Redistributions of source code must retain the above copyright
|
|
||||||
** notice, this list of conditions and the following disclaimer.
|
|
||||||
** * Redistributions in binary form must reproduce the above copyright
|
|
||||||
** notice, this list of conditions and the following disclaimer in
|
|
||||||
** the documentation and/or other materials provided with the
|
|
||||||
** distribution.
|
|
||||||
** * Neither the name of The Qt Company Ltd nor the names of its
|
|
||||||
** contributors may be used to endorse or promote products derived
|
|
||||||
** from this software without specific prior written permission.
|
|
||||||
**
|
|
||||||
**
|
|
||||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
|
||||||
**
|
|
||||||
** $QT_END_LICENSE$
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include <QtWidgets>
|
|
||||||
|
|
||||||
#include "configdialog.h"
|
|
||||||
#include "pages.h"
|
|
||||||
|
|
||||||
ConfigDialog::ConfigDialog()
|
|
||||||
{
|
|
||||||
contentsWidget = new QListWidget;
|
|
||||||
contentsWidget->setViewMode(QListView::IconMode);
|
|
||||||
contentsWidget->setIconSize(QSize(96, 84));
|
|
||||||
contentsWidget->setMovement(QListView::Static);
|
|
||||||
contentsWidget->setMaximumWidth(128);
|
|
||||||
contentsWidget->setSpacing(12);
|
|
||||||
|
|
||||||
pagesWidget = new QStackedWidget;
|
|
||||||
pagesWidget->addWidget(new ConfigurationPage);
|
|
||||||
pagesWidget->addWidget(new UpdatePage);
|
|
||||||
pagesWidget->addWidget(new QueryPage);
|
|
||||||
|
|
||||||
QPushButton *closeButton = new QPushButton(tr("Close"));
|
|
||||||
|
|
||||||
createIcons();
|
|
||||||
contentsWidget->setCurrentRow(0);
|
|
||||||
|
|
||||||
connect(closeButton, &QAbstractButton::clicked, this, &QWidget::close);
|
|
||||||
|
|
||||||
QHBoxLayout *horizontalLayout = new QHBoxLayout;
|
|
||||||
horizontalLayout->addWidget(contentsWidget);
|
|
||||||
horizontalLayout->addWidget(pagesWidget, 1);
|
|
||||||
|
|
||||||
QHBoxLayout *buttonsLayout = new QHBoxLayout;
|
|
||||||
buttonsLayout->addStretch(1);
|
|
||||||
buttonsLayout->addWidget(closeButton);
|
|
||||||
|
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
|
||||||
mainLayout->addLayout(horizontalLayout);
|
|
||||||
mainLayout->addStretch(1);
|
|
||||||
mainLayout->addSpacing(12);
|
|
||||||
mainLayout->addLayout(buttonsLayout);
|
|
||||||
setLayout(mainLayout);
|
|
||||||
|
|
||||||
setWindowTitle(tr("Config Dialog"));
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConfigDialog::createIcons()
|
|
||||||
{
|
|
||||||
QListWidgetItem *configButton = new QListWidgetItem(contentsWidget);
|
|
||||||
configButton->setIcon(QIcon(":/images/config.png"));
|
|
||||||
configButton->setText(tr("Configuration"));
|
|
||||||
configButton->setTextAlignment(Qt::AlignHCenter);
|
|
||||||
configButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
|
||||||
|
|
||||||
QListWidgetItem *updateButton = new QListWidgetItem(contentsWidget);
|
|
||||||
updateButton->setIcon(QIcon(":/images/update.png"));
|
|
||||||
updateButton->setText(tr("Update"));
|
|
||||||
updateButton->setTextAlignment(Qt::AlignHCenter);
|
|
||||||
updateButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
|
||||||
|
|
||||||
QListWidgetItem *queryButton = new QListWidgetItem(contentsWidget);
|
|
||||||
queryButton->setIcon(QIcon(":/images/query.png"));
|
|
||||||
queryButton->setText(tr("Query"));
|
|
||||||
queryButton->setTextAlignment(Qt::AlignHCenter);
|
|
||||||
queryButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
|
||||||
|
|
||||||
connect(contentsWidget, &QListWidget::currentItemChanged, this, &ConfigDialog::changePage);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConfigDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous)
|
|
||||||
{
|
|
||||||
if (!current)
|
|
||||||
current = previous;
|
|
||||||
|
|
||||||
pagesWidget->setCurrentIndex(contentsWidget->row(current));
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
QT += widgets
|
|
||||||
|
|
||||||
HEADERS = configdialog.h \
|
|
||||||
pages.h
|
|
||||||
SOURCES = configdialog.cpp \
|
|
||||||
main.cpp \
|
|
||||||
pages.cpp
|
|
||||||
RESOURCES += configdialog.qrc
|
|
||||||
|
|
||||||
# install
|
|
||||||
target.path = $$[QT_INSTALL_EXAMPLES]/widgets/dialogs/configdialog
|
|
||||||
INSTALLS += target
|
|
@ -1,7 +0,0 @@
|
|||||||
<!DOCTYPE RCC><RCC version="1.0">
|
|
||||||
<qresource>
|
|
||||||
<file>images/config.png</file>
|
|
||||||
<file>images/query.png</file>
|
|
||||||
<file>images/update.png</file>
|
|
||||||
</qresource>
|
|
||||||
</RCC>
|
|
Before Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 7.7 KiB |
@ -1,161 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of the examples of the Qt Toolkit.
|
|
||||||
**
|
|
||||||
** $QT_BEGIN_LICENSE:BSD$
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** BSD License Usage
|
|
||||||
** Alternatively, you may use this file under the terms of the BSD license
|
|
||||||
** as follows:
|
|
||||||
**
|
|
||||||
** "Redistribution and use in source and binary forms, with or without
|
|
||||||
** modification, are permitted provided that the following conditions are
|
|
||||||
** met:
|
|
||||||
** * Redistributions of source code must retain the above copyright
|
|
||||||
** notice, this list of conditions and the following disclaimer.
|
|
||||||
** * Redistributions in binary form must reproduce the above copyright
|
|
||||||
** notice, this list of conditions and the following disclaimer in
|
|
||||||
** the documentation and/or other materials provided with the
|
|
||||||
** distribution.
|
|
||||||
** * Neither the name of The Qt Company Ltd nor the names of its
|
|
||||||
** contributors may be used to endorse or promote products derived
|
|
||||||
** from this software without specific prior written permission.
|
|
||||||
**
|
|
||||||
**
|
|
||||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
|
||||||
**
|
|
||||||
** $QT_END_LICENSE$
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include <QtWidgets>
|
|
||||||
|
|
||||||
#include "pages.h"
|
|
||||||
|
|
||||||
ConfigurationPage::ConfigurationPage(QWidget *parent)
|
|
||||||
: QWidget(parent)
|
|
||||||
{
|
|
||||||
QGroupBox *configGroup = new QGroupBox(tr("Server configuration"));
|
|
||||||
|
|
||||||
QLabel *serverLabel = new QLabel(tr("Server:"));
|
|
||||||
QComboBox *serverCombo = new QComboBox;
|
|
||||||
serverCombo->addItem(tr("Qt (Australia)"));
|
|
||||||
serverCombo->addItem(tr("Qt (Germany)"));
|
|
||||||
serverCombo->addItem(tr("Qt (Norway)"));
|
|
||||||
serverCombo->addItem(tr("Qt (People's Republic of China)"));
|
|
||||||
serverCombo->addItem(tr("Qt (USA)"));
|
|
||||||
|
|
||||||
QHBoxLayout *serverLayout = new QHBoxLayout;
|
|
||||||
serverLayout->addWidget(serverLabel);
|
|
||||||
serverLayout->addWidget(serverCombo);
|
|
||||||
|
|
||||||
QVBoxLayout *configLayout = new QVBoxLayout;
|
|
||||||
configLayout->addLayout(serverLayout);
|
|
||||||
configGroup->setLayout(configLayout);
|
|
||||||
|
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
|
||||||
mainLayout->addWidget(configGroup);
|
|
||||||
mainLayout->addStretch(1);
|
|
||||||
setLayout(mainLayout);
|
|
||||||
}
|
|
||||||
|
|
||||||
UpdatePage::UpdatePage(QWidget *parent)
|
|
||||||
: QWidget(parent)
|
|
||||||
{
|
|
||||||
QGroupBox *updateGroup = new QGroupBox(tr("Package selection"));
|
|
||||||
QCheckBox *systemCheckBox = new QCheckBox(tr("Update system"));
|
|
||||||
QCheckBox *appsCheckBox = new QCheckBox(tr("Update applications"));
|
|
||||||
QCheckBox *docsCheckBox = new QCheckBox(tr("Update documentation"));
|
|
||||||
|
|
||||||
QGroupBox *packageGroup = new QGroupBox(tr("Existing packages"));
|
|
||||||
|
|
||||||
QListWidget *packageList = new QListWidget;
|
|
||||||
QListWidgetItem *qtItem = new QListWidgetItem(packageList);
|
|
||||||
qtItem->setText(tr("Qt"));
|
|
||||||
QListWidgetItem *qsaItem = new QListWidgetItem(packageList);
|
|
||||||
qsaItem->setText(tr("QSA"));
|
|
||||||
QListWidgetItem *teamBuilderItem = new QListWidgetItem(packageList);
|
|
||||||
teamBuilderItem->setText(tr("Teambuilder"));
|
|
||||||
|
|
||||||
QPushButton *startUpdateButton = new QPushButton(tr("Start update"));
|
|
||||||
|
|
||||||
QVBoxLayout *updateLayout = new QVBoxLayout;
|
|
||||||
updateLayout->addWidget(systemCheckBox);
|
|
||||||
updateLayout->addWidget(appsCheckBox);
|
|
||||||
updateLayout->addWidget(docsCheckBox);
|
|
||||||
updateGroup->setLayout(updateLayout);
|
|
||||||
|
|
||||||
QVBoxLayout *packageLayout = new QVBoxLayout;
|
|
||||||
packageLayout->addWidget(packageList);
|
|
||||||
packageGroup->setLayout(packageLayout);
|
|
||||||
|
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
|
||||||
mainLayout->addWidget(updateGroup);
|
|
||||||
mainLayout->addWidget(packageGroup);
|
|
||||||
mainLayout->addSpacing(12);
|
|
||||||
mainLayout->addWidget(startUpdateButton);
|
|
||||||
mainLayout->addStretch(1);
|
|
||||||
setLayout(mainLayout);
|
|
||||||
}
|
|
||||||
|
|
||||||
QueryPage::QueryPage(QWidget *parent)
|
|
||||||
: QWidget(parent)
|
|
||||||
{
|
|
||||||
QGroupBox *packagesGroup = new QGroupBox(tr("Look for packages"));
|
|
||||||
|
|
||||||
QLabel *nameLabel = new QLabel(tr("Name:"));
|
|
||||||
QLineEdit *nameEdit = new QLineEdit;
|
|
||||||
|
|
||||||
QLabel *dateLabel = new QLabel(tr("Released after:"));
|
|
||||||
QDateTimeEdit *dateEdit = new QDateTimeEdit(QDate::currentDate());
|
|
||||||
|
|
||||||
QCheckBox *releasesCheckBox = new QCheckBox(tr("Releases"));
|
|
||||||
QCheckBox *upgradesCheckBox = new QCheckBox(tr("Upgrades"));
|
|
||||||
|
|
||||||
QSpinBox *hitsSpinBox = new QSpinBox;
|
|
||||||
hitsSpinBox->setPrefix(tr("Return up to "));
|
|
||||||
hitsSpinBox->setSuffix(tr(" results"));
|
|
||||||
hitsSpinBox->setSpecialValueText(tr("Return only the first result"));
|
|
||||||
hitsSpinBox->setMinimum(1);
|
|
||||||
hitsSpinBox->setMaximum(100);
|
|
||||||
hitsSpinBox->setSingleStep(10);
|
|
||||||
|
|
||||||
QPushButton *startQueryButton = new QPushButton(tr("Start query"));
|
|
||||||
|
|
||||||
QGridLayout *packagesLayout = new QGridLayout;
|
|
||||||
packagesLayout->addWidget(nameLabel, 0, 0);
|
|
||||||
packagesLayout->addWidget(nameEdit, 0, 1);
|
|
||||||
packagesLayout->addWidget(dateLabel, 1, 0);
|
|
||||||
packagesLayout->addWidget(dateEdit, 1, 1);
|
|
||||||
packagesLayout->addWidget(releasesCheckBox, 2, 0);
|
|
||||||
packagesLayout->addWidget(upgradesCheckBox, 3, 0);
|
|
||||||
packagesLayout->addWidget(hitsSpinBox, 4, 0, 1, 2);
|
|
||||||
packagesGroup->setLayout(packagesLayout);
|
|
||||||
|
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
|
||||||
mainLayout->addWidget(packagesGroup);
|
|
||||||
mainLayout->addSpacing(12);
|
|
||||||
mainLayout->addWidget(startQueryButton);
|
|
||||||
mainLayout->addStretch(1);
|
|
||||||
setLayout(mainLayout);
|
|
||||||
}
|
|
@ -1,74 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of the examples of the Qt Toolkit.
|
|
||||||
**
|
|
||||||
** $QT_BEGIN_LICENSE:BSD$
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** BSD License Usage
|
|
||||||
** Alternatively, you may use this file under the terms of the BSD license
|
|
||||||
** as follows:
|
|
||||||
**
|
|
||||||
** "Redistribution and use in source and binary forms, with or without
|
|
||||||
** modification, are permitted provided that the following conditions are
|
|
||||||
** met:
|
|
||||||
** * Redistributions of source code must retain the above copyright
|
|
||||||
** notice, this list of conditions and the following disclaimer.
|
|
||||||
** * Redistributions in binary form must reproduce the above copyright
|
|
||||||
** notice, this list of conditions and the following disclaimer in
|
|
||||||
** the documentation and/or other materials provided with the
|
|
||||||
** distribution.
|
|
||||||
** * Neither the name of The Qt Company Ltd nor the names of its
|
|
||||||
** contributors may be used to endorse or promote products derived
|
|
||||||
** from this software without specific prior written permission.
|
|
||||||
**
|
|
||||||
**
|
|
||||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
|
||||||
**
|
|
||||||
** $QT_END_LICENSE$
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef PAGES_H
|
|
||||||
#define PAGES_H
|
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
|
|
||||||
class ConfigurationPage : public QWidget
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ConfigurationPage(QWidget *parent = 0);
|
|
||||||
};
|
|
||||||
|
|
||||||
class QueryPage : public QWidget
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
QueryPage(QWidget *parent = 0);
|
|
||||||
};
|
|
||||||
|
|
||||||
class UpdatePage : public QWidget
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
UpdatePage(QWidget *parent = 0);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
@ -2,7 +2,6 @@ QT_FOR_CONFIG += widgets
|
|||||||
|
|
||||||
TEMPLATE = subdirs
|
TEMPLATE = subdirs
|
||||||
SUBDIRS = classwizard \
|
SUBDIRS = classwizard \
|
||||||
configdialog \
|
|
||||||
extension \
|
extension \
|
||||||
findfiles \
|
findfiles \
|
||||||
licensewizard \
|
licensewizard \
|
||||||
|
@ -74,6 +74,7 @@ static inline void openFile(const QString &fileName)
|
|||||||
Window::Window(QWidget *parent)
|
Window::Window(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
{
|
{
|
||||||
|
setWindowTitle(tr("Find Files"));
|
||||||
QPushButton *browseButton = new QPushButton(tr("&Browse..."), this);
|
QPushButton *browseButton = new QPushButton(tr("&Browse..."), this);
|
||||||
connect(browseButton, &QAbstractButton::clicked, this, &Window::browse);
|
connect(browseButton, &QAbstractButton::clicked, this, &Window::browse);
|
||||||
findButton = new QPushButton(tr("&Find"), this);
|
findButton = new QPushButton(tr("&Find"), this);
|
||||||
@ -92,9 +93,7 @@ Window::Window(QWidget *parent)
|
|||||||
filesFoundLabel = new QLabel;
|
filesFoundLabel = new QLabel;
|
||||||
|
|
||||||
createFilesTable();
|
createFilesTable();
|
||||||
//! [0]
|
|
||||||
|
|
||||||
//! [1]
|
|
||||||
QGridLayout *mainLayout = new QGridLayout(this);
|
QGridLayout *mainLayout = new QGridLayout(this);
|
||||||
mainLayout->addWidget(new QLabel(tr("Named:")), 0, 0);
|
mainLayout->addWidget(new QLabel(tr("Named:")), 0, 0);
|
||||||
mainLayout->addWidget(fileComboBox, 0, 1, 1, 2);
|
mainLayout->addWidget(fileComboBox, 0, 1, 1, 2);
|
||||||
@ -106,12 +105,13 @@ Window::Window(QWidget *parent)
|
|||||||
mainLayout->addWidget(filesTable, 3, 0, 1, 3);
|
mainLayout->addWidget(filesTable, 3, 0, 1, 3);
|
||||||
mainLayout->addWidget(filesFoundLabel, 4, 0, 1, 2);
|
mainLayout->addWidget(filesFoundLabel, 4, 0, 1, 2);
|
||||||
mainLayout->addWidget(findButton, 4, 2);
|
mainLayout->addWidget(findButton, 4, 2);
|
||||||
|
//! [0]
|
||||||
|
|
||||||
setWindowTitle(tr("Find Files"));
|
|
||||||
const QRect screenGeometry = QApplication::desktop()->screenGeometry(this);
|
|
||||||
resize(screenGeometry.width() / 2, screenGeometry.height() / 3);
|
|
||||||
}
|
|
||||||
//! [1]
|
//! [1]
|
||||||
|
connect(new QShortcut(QKeySequence::Quit, this), &QShortcut::activated,
|
||||||
|
qApp, &QApplication::quit);
|
||||||
|
//! [1]
|
||||||
|
}
|
||||||
|
|
||||||
//! [2]
|
//! [2]
|
||||||
void Window::browse()
|
void Window::browse()
|
||||||
@ -133,21 +133,7 @@ static void updateComboBox(QComboBox *comboBox)
|
|||||||
comboBox->addItem(comboBox->currentText());
|
comboBox->addItem(comboBox->currentText());
|
||||||
}
|
}
|
||||||
|
|
||||||
//! [13]
|
|
||||||
|
|
||||||
static void findRecursion(const QString &path, const QString &pattern, QStringList *result)
|
|
||||||
{
|
|
||||||
QDir currentDir(path);
|
|
||||||
const QString prefix = path + QLatin1Char('/');
|
|
||||||
foreach (const QString &match, currentDir.entryList(QStringList(pattern), QDir::Files | QDir::NoSymLinks))
|
|
||||||
result->append(prefix + match);
|
|
||||||
foreach (const QString &dir, currentDir.entryList(QDir::Dirs | QDir::NoSymLinks | QDir::NoDotAndDotDot))
|
|
||||||
findRecursion(prefix + dir, pattern, result);
|
|
||||||
}
|
|
||||||
|
|
||||||
//! [13]
|
|
||||||
//! [3]
|
//! [3]
|
||||||
|
|
||||||
void Window::find()
|
void Window::find()
|
||||||
{
|
{
|
||||||
filesTable->setRowCount(0);
|
filesTable->setRowCount(0);
|
||||||
@ -155,6 +141,7 @@ void Window::find()
|
|||||||
QString fileName = fileComboBox->currentText();
|
QString fileName = fileComboBox->currentText();
|
||||||
QString text = textComboBox->currentText();
|
QString text = textComboBox->currentText();
|
||||||
QString path = QDir::cleanPath(directoryComboBox->currentText());
|
QString path = QDir::cleanPath(directoryComboBox->currentText());
|
||||||
|
currentDir = QDir(path);
|
||||||
//! [3]
|
//! [3]
|
||||||
|
|
||||||
updateComboBox(fileComboBox);
|
updateComboBox(fileComboBox);
|
||||||
@ -162,12 +149,16 @@ void Window::find()
|
|||||||
updateComboBox(directoryComboBox);
|
updateComboBox(directoryComboBox);
|
||||||
|
|
||||||
//! [4]
|
//! [4]
|
||||||
|
QStringList filter;
|
||||||
currentDir = QDir(path);
|
if (!fileName.isEmpty())
|
||||||
|
filter << fileName;
|
||||||
|
QDirIterator it(path, filter, QDir::AllEntries | QDir::NoSymLinks | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);
|
||||||
QStringList files;
|
QStringList files;
|
||||||
findRecursion(path, fileName.isEmpty() ? QStringLiteral("*") : fileName, &files);
|
while (it.hasNext())
|
||||||
|
files << it.next();
|
||||||
if (!text.isEmpty())
|
if (!text.isEmpty())
|
||||||
files = findFiles(files, text);
|
files = findFiles(files, text);
|
||||||
|
files.sort();
|
||||||
showFiles(files);
|
showFiles(files);
|
||||||
}
|
}
|
||||||
//! [4]
|
//! [4]
|
||||||
@ -225,20 +216,18 @@ QStringList Window::findFiles(const QStringList &files, const QString &text)
|
|||||||
//! [7]
|
//! [7]
|
||||||
|
|
||||||
//! [8]
|
//! [8]
|
||||||
void Window::showFiles(const QStringList &files)
|
void Window::showFiles(const QStringList &paths)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < files.size(); ++i) {
|
for (const QString &filePath : paths) {
|
||||||
const QString &fileName = files.at(i);
|
const QString toolTip = QDir::toNativeSeparators(filePath);
|
||||||
const QString toolTip = QDir::toNativeSeparators(fileName);
|
const QString relativePath = QDir::toNativeSeparators(currentDir.relativeFilePath(filePath));
|
||||||
const QString relativePath = QDir::toNativeSeparators(currentDir.relativeFilePath(fileName));
|
const qint64 size = QFileInfo(filePath).size();
|
||||||
const qint64 size = QFileInfo(fileName).size();
|
|
||||||
QTableWidgetItem *fileNameItem = new QTableWidgetItem(relativePath);
|
QTableWidgetItem *fileNameItem = new QTableWidgetItem(relativePath);
|
||||||
fileNameItem->setData(absoluteFileNameRole, QVariant(fileName));
|
fileNameItem->setData(absoluteFileNameRole, QVariant(filePath));
|
||||||
fileNameItem->setToolTip(toolTip);
|
fileNameItem->setToolTip(toolTip);
|
||||||
fileNameItem->setFlags(fileNameItem->flags() ^ Qt::ItemIsEditable);
|
fileNameItem->setFlags(fileNameItem->flags() ^ Qt::ItemIsEditable);
|
||||||
QTableWidgetItem *sizeItem = new QTableWidgetItem(tr("%1 KB")
|
QTableWidgetItem *sizeItem = new QTableWidgetItem(QLocale().formattedDataSize(size));
|
||||||
.arg(int((size + 1023) / 1024)));
|
sizeItem->setData(absoluteFileNameRole, QVariant(filePath));
|
||||||
sizeItem->setData(absoluteFileNameRole, QVariant(fileName));
|
|
||||||
sizeItem->setToolTip(toolTip);
|
sizeItem->setToolTip(toolTip);
|
||||||
sizeItem->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
sizeItem->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||||
sizeItem->setFlags(sizeItem->flags() ^ Qt::ItemIsEditable);
|
sizeItem->setFlags(sizeItem->flags() ^ Qt::ItemIsEditable);
|
||||||
@ -248,7 +237,7 @@ void Window::showFiles(const QStringList &files)
|
|||||||
filesTable->setItem(row, 0, fileNameItem);
|
filesTable->setItem(row, 0, fileNameItem);
|
||||||
filesTable->setItem(row, 1, sizeItem);
|
filesTable->setItem(row, 1, sizeItem);
|
||||||
}
|
}
|
||||||
filesFoundLabel->setText(tr("%n file(s) found (Double click on a file to open it)", 0, files.size()));
|
filesFoundLabel->setText(tr("%n file(s) found (Double click on a file to open it)", 0, paths.size()));
|
||||||
filesFoundLabel->setWordWrap(true);
|
filesFoundLabel->setWordWrap(true);
|
||||||
}
|
}
|
||||||
//! [8]
|
//! [8]
|
||||||
|
@ -79,7 +79,7 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QStringList findFiles(const QStringList &files, const QString &text);
|
QStringList findFiles(const QStringList &files, const QString &text);
|
||||||
void showFiles(const QStringList &files);
|
void showFiles(const QStringList &paths);
|
||||||
QComboBox *createComboBox(const QString &text = QString());
|
QComboBox *createComboBox(const QString &text = QString());
|
||||||
void createFilesTable();
|
void createFilesTable();
|
||||||
|
|
||||||
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 11 KiB |
BIN
examples/widgets/doc/images/notepad.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
examples/widgets/doc/images/notepad1.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
examples/widgets/doc/images/notepad2.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
examples/widgets/doc/images/notepad3.png
Normal file
After Width: | Height: | Size: 40 KiB |
BIN
examples/widgets/doc/images/notepad4.png
Normal file
After Width: | Height: | Size: 9.3 KiB |
BIN
examples/widgets/doc/images/notepad_menu.png
Normal file
After Width: | Height: | Size: 8.5 KiB |
@ -1,37 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 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$
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\example dialogs/configdialog
|
|
||||||
\title Config Dialog Example
|
|
||||||
\ingroup examples-dialogs
|
|
||||||
|
|
||||||
\brief The Config Dialog examples shows how a configuration dialog can be created by
|
|
||||||
using an icon view with a stacked widget.
|
|
||||||
|
|
||||||
\image configdialog-example.png
|
|
||||||
*/
|
|
@ -28,6 +28,7 @@
|
|||||||
/*!
|
/*!
|
||||||
\example draganddrop/draggabletext
|
\example draganddrop/draggabletext
|
||||||
\title Draggable Text Example
|
\title Draggable Text Example
|
||||||
|
\brief Illustrates how to drag and drop text between widgets
|
||||||
|
|
||||||
\brief The Draggable Text example shows how to drag and drop textual data between widgets
|
\brief The Draggable Text example shows how to drag and drop textual data between widgets
|
||||||
in the same application, and between different applications.
|
in the same application, and between different applications.
|
||||||
|
@ -34,4 +34,7 @@
|
|||||||
|
|
||||||
\image easing-example.png
|
\image easing-example.png
|
||||||
|
|
||||||
|
See \l QEasingCurve for a detailed description on how to use the class's
|
||||||
|
functionalities.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
@ -74,19 +74,23 @@
|
|||||||
|
|
||||||
\snippet dialogs/findfiles/window.cpp 0
|
\snippet dialogs/findfiles/window.cpp 0
|
||||||
|
|
||||||
We create the application's buttons using the private \c
|
We create the widgets to build up the UI, and we add them to a main layout
|
||||||
createButton() function. Then we create the comboboxes associated
|
using QGridLayout. We have, however, put the \c Find and \c Quit buttons
|
||||||
with the search specifications, using the private \c
|
and a stretchable space in a separate \l QHBoxLayout first, to make the
|
||||||
createComboBox() function. We also create the application's labels
|
buttons appear in the \c Window widget's bottom right corner.
|
||||||
before we use the private \c createFilesTable() function to create
|
|
||||||
the table displaying the search results.
|
Alternatively, we could have used Qt Designer to construct a UI file,
|
||||||
|
and \l {uic} to generate this code.
|
||||||
|
|
||||||
\snippet dialogs/findfiles/window.cpp 1
|
\snippet dialogs/findfiles/window.cpp 1
|
||||||
|
|
||||||
Then we add all the widgets to a main layout using QGridLayout. We
|
We did not create a \l QMenuBar with a \uicontrol Quit menu item; but we
|
||||||
have, however, put the \c Find and \c Quit buttons and a
|
would still like to have a keyboard shortcut for quitting. Since we
|
||||||
stretchable space in a separate QHBoxLayout first, to make the
|
construct a \l QShortcut with \l QKeySequence::Quit, and connect it to
|
||||||
buttons appear in the \c Window widget's bottom right corner.
|
\l QApplication::quit(), on most platforms it will be possible to press
|
||||||
|
Control-Q to quit (or whichever standard Quit key is configured on that platform).
|
||||||
|
(On \macos, this is redundant, because every application gets a
|
||||||
|
\uicontrol Quit menu item automatically; but it helps to make the application portable.)
|
||||||
|
|
||||||
\snippet dialogs/findfiles/window.cpp 2
|
\snippet dialogs/findfiles/window.cpp 2
|
||||||
|
|
||||||
@ -122,18 +126,16 @@
|
|||||||
We use the directory's path to create a QDir; the QDir class
|
We use the directory's path to create a QDir; the QDir class
|
||||||
provides access to directory structures and their contents.
|
provides access to directory structures and their contents.
|
||||||
|
|
||||||
\snippet dialogs/findfiles/window.cpp 13
|
We use QDirIterator to iterate over the files that match the
|
||||||
|
specified file name and build a QStringList of paths.
|
||||||
We recursively create a list of the files (contained in the newl
|
|
||||||
created QDir) that match the specified file name.
|
|
||||||
|
|
||||||
Then we search through all the files in the list, using the private
|
Then we search through all the files in the list, using the private
|
||||||
\c findFiles() function, eliminating the ones that don't contain
|
\c findFiles() function, eliminating the ones that don't contain the
|
||||||
the specified text. And finally, we display the results using the
|
specified text. We sort them (because QDirIterator did not). And finally,
|
||||||
private \c showFiles() function.
|
we display the results using the private \c showFiles() function.
|
||||||
|
|
||||||
If the user didn't specify any text, there is no reason to search
|
If the user didn't specify any text, there is no reason to search
|
||||||
through the files, and we display the results immediately.
|
through the files, so we sort and display the results immediately.
|
||||||
|
|
||||||
\image findfiles_progress_dialog.png Screenshot of the Progress Dialog
|
\image findfiles_progress_dialog.png Screenshot of the Progress Dialog
|
||||||
|
|
||||||
@ -196,7 +198,8 @@
|
|||||||
the \c find() slot. In the \c showFiles() function we run through
|
the \c find() slot. In the \c showFiles() function we run through
|
||||||
the provided list of file names, adding each relative file name to the
|
the provided list of file names, adding each relative file name to the
|
||||||
first column in the table widget and retrieving the file's size using
|
first column in the table widget and retrieving the file's size using
|
||||||
QFileInfo for the second column. For later use, we set
|
QFileInfo for the second column. We use \l QLocale::formattedDataSize()
|
||||||
|
to format the file size in a human-readable form. For later use, we set
|
||||||
the absolute path as a data on the QTableWidget using the
|
the absolute path as a data on the QTableWidget using the
|
||||||
the role absoluteFileNameRole defined to be Qt::UserRole + 1.
|
the role absoluteFileNameRole defined to be Qt::UserRole + 1.
|
||||||
|
|
||||||
|
@ -35,4 +35,50 @@
|
|||||||
QGraphicsAnchorLayout class.
|
QGraphicsAnchorLayout class.
|
||||||
|
|
||||||
\image graphicssimpleanchorlayout-example.png
|
\image graphicssimpleanchorlayout-example.png
|
||||||
|
|
||||||
|
The example starts by creating a QGraphicsScene (\c scene), 3 widgets
|
||||||
|
(\c a, \c b, and \c c), and a QGraphicsAnchorlayout (\c layout).
|
||||||
|
|
||||||
|
\quotefromfile graphicsview/simpleanchorlayout/main.cpp
|
||||||
|
\skipto QGraphicsScene
|
||||||
|
\printuntil QGraphicsAnchorLayout
|
||||||
|
|
||||||
|
First it anchors the top left corner of item \c a to the top left
|
||||||
|
corner of \c layout. This can be done in two steps:
|
||||||
|
|
||||||
|
\skipto layout->addAnchor(a
|
||||||
|
\printto adding
|
||||||
|
|
||||||
|
Or in one step:
|
||||||
|
|
||||||
|
\skipuntil [adding a corner anchor]
|
||||||
|
\printline layout->addCornerAnchors(a, Qt::T
|
||||||
|
|
||||||
|
Then the right anchor of \c a is anchored to the left anchor of
|
||||||
|
\c b, and the top of item \c b is anchored to the bottom of \c a.
|
||||||
|
|
||||||
|
\skipuntil [adding anchors]
|
||||||
|
\printto adding anchors
|
||||||
|
|
||||||
|
Place a third widget \c c under widget \c b:
|
||||||
|
|
||||||
|
\skipuntil third widget
|
||||||
|
\printline AnchorBottom
|
||||||
|
|
||||||
|
Items \c b and \c c are anchored to each other horizontally:
|
||||||
|
|
||||||
|
\skipto Qt::Horizontal
|
||||||
|
\printline Qt::Horizontal
|
||||||
|
|
||||||
|
Item c is anchored to the bottom right point of \c layout
|
||||||
|
|
||||||
|
\skipuntil corner of the layout
|
||||||
|
\printline Qt::BottomRightCorner
|
||||||
|
|
||||||
|
Finally, QGraphicsWidget \c w is displayed in QGraphicsView \c view.
|
||||||
|
|
||||||
|
\skipto QGraphicsWidget
|
||||||
|
\printuntil app.exec()
|
||||||
|
|
||||||
|
\sa {Anchor Layout Example}
|
||||||
*/
|
*/
|
||||||
|
559
examples/widgets/tutorials/gettingstartedqt.qdoc
Normal file
@ -0,0 +1,559 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2017 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$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\example tutorials/notepad
|
||||||
|
\title Getting Started Programming with Qt Widgets
|
||||||
|
\brief A tutorial for Qt Widgets based on a notepad application
|
||||||
|
|
||||||
|
In this topic, we teach basic Qt knowledge by implementing a simple
|
||||||
|
Notepad application using C++ and the \l{Qt Widgets} module. The
|
||||||
|
application is a small text editor which allows you to create a text
|
||||||
|
file, save it, print it,
|
||||||
|
or reopen and edit it again. You can also set the font to be used.
|
||||||
|
|
||||||
|
\image notepad1.png "Notepad application"
|
||||||
|
|
||||||
|
You can find the final Notepad source files in the qtdoc repository
|
||||||
|
in the tutorials/notepad directory. You can either fetch
|
||||||
|
the Qt 5 sources from Qt Project or install them as part of Qt 5.
|
||||||
|
The application is also available in the example list of Qt Creator's
|
||||||
|
Welcome mode.
|
||||||
|
|
||||||
|
\section1 Creating the Notepad Project
|
||||||
|
|
||||||
|
Setting up a new project in Qt Creator is aided by a wizard that
|
||||||
|
guides you step-by-step through the project creation process. The
|
||||||
|
wizard prompts you to enter the settings needed for that particular
|
||||||
|
type of project and creates the project for you.
|
||||||
|
|
||||||
|
\image notepad2.png "Qt Creator New File or Project dialog"
|
||||||
|
|
||||||
|
To create the Notepad project, select \b File > \b{New File or
|
||||||
|
Project} > \b Applications > \b {Qt Widgets Application} > \b Choose,
|
||||||
|
and follow the instructions of the wizard. In the
|
||||||
|
\b{Class Information}
|
||||||
|
dialog, type \b Notepad as the class name and select \b QMainWindow
|
||||||
|
as the base class.
|
||||||
|
|
||||||
|
\image notepad3.png "Class Information Dialog"
|
||||||
|
|
||||||
|
The \b {Qt Widgets Application} wizard creates a project that contains
|
||||||
|
a main source file and a set of files that specify a user interface
|
||||||
|
(Notepad widget):
|
||||||
|
|
||||||
|
\list
|
||||||
|
\li notepad.pro - the project file.
|
||||||
|
\li main.cpp - the main source file for the application.
|
||||||
|
\li notepad.cpp - the source file of the notepad class of the
|
||||||
|
Notepad widget.
|
||||||
|
\li notepad.h - the header file of the notepad class for the
|
||||||
|
Notepad widget.
|
||||||
|
\li notepad.ui - the UI form for the Notepad widget.
|
||||||
|
\endlist
|
||||||
|
|
||||||
|
The .cpp, .h, and .ui files come with the necessary boiler plate code
|
||||||
|
for you to be able to build and run the project. The .pro file is
|
||||||
|
complete.
|
||||||
|
We will take a closer look at the file contents in the following
|
||||||
|
sections.
|
||||||
|
|
||||||
|
\b{Learn More}
|
||||||
|
|
||||||
|
\table
|
||||||
|
\header
|
||||||
|
\li About
|
||||||
|
\li Here
|
||||||
|
\row
|
||||||
|
\li Using Qt Creator
|
||||||
|
\li \l{Qt Creator Manual}{Qt Creator}
|
||||||
|
\row
|
||||||
|
\li Creating other kind of applications with Qt Creator
|
||||||
|
\li \l{Qt Creator: Tutorials}{Qt Creator Tutorials}
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
|
||||||
|
\section1 Main Source File
|
||||||
|
|
||||||
|
The wizard generates the following code in the main.cpp file:
|
||||||
|
|
||||||
|
\quotefromfile tutorials/notepad/main.cpp
|
||||||
|
\skipto "notepad.h"
|
||||||
|
\printuntil EditorApp.exec()
|
||||||
|
\printuntil }
|
||||||
|
|
||||||
|
We will go through the code line by line. The following lines include
|
||||||
|
the header files for the Notepad widget and QApplication. All Qt classes
|
||||||
|
have a header file named after them.
|
||||||
|
|
||||||
|
\quotefromfile tutorials/notepad/main.cpp
|
||||||
|
\skipto notepad.h
|
||||||
|
\printuntil QApplication
|
||||||
|
|
||||||
|
The following line defines the main function that is the entry point
|
||||||
|
for all C and C++ based applications:
|
||||||
|
|
||||||
|
\printline main
|
||||||
|
|
||||||
|
The following line creates a QApplication object. This object manages
|
||||||
|
application-wide resources and is necessary to run any Qt program
|
||||||
|
that uses Qt Widgets. It constructs an application object with \c argc
|
||||||
|
command line arguments run in \c argv. (For GUI applications that
|
||||||
|
do not use Qt Widgets, you can use QGuiApplication instead.)
|
||||||
|
|
||||||
|
\skipuntil {
|
||||||
|
\printuntil QApplication
|
||||||
|
|
||||||
|
The following line creates the Notepad object. This is the object for
|
||||||
|
which the wizard created the class and the UI file. The user interface
|
||||||
|
contains visual elements that are called \c widgets in Qt. Examples
|
||||||
|
of widgets are text edits, scroll bars, labels, and radio buttons. A
|
||||||
|
widget can also be a container for other widgets; a dialog or a main
|
||||||
|
application window, for example.
|
||||||
|
|
||||||
|
\printline Notepad
|
||||||
|
|
||||||
|
The following line shows the Notepad widget on the screen in its own
|
||||||
|
window. Widgets can also function as containers. An example of this
|
||||||
|
is QMainWindow which often contains several types of widgets. Widgets
|
||||||
|
are not visible by default; the function \l{QWidget::}{show()} makes
|
||||||
|
the widget visible.
|
||||||
|
|
||||||
|
\printline Editor.show
|
||||||
|
|
||||||
|
The following line makes the QApplication enter its event loop. When
|
||||||
|
a Qt application is running, events are generated and sent to the
|
||||||
|
widgets of the application. Examples of events are mouse presses
|
||||||
|
and key strokes.
|
||||||
|
|
||||||
|
\printline EditorApp.exec
|
||||||
|
|
||||||
|
\b{Learn More}
|
||||||
|
|
||||||
|
\table
|
||||||
|
\header
|
||||||
|
\li About
|
||||||
|
\li Here
|
||||||
|
\row
|
||||||
|
\li Widgets and Window Geometry
|
||||||
|
\li \l{Window and Dialog Widgets}
|
||||||
|
\row
|
||||||
|
\li Events and event handling
|
||||||
|
\li \l{The Event System}
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
\section1 Designing a UI
|
||||||
|
|
||||||
|
The wizard generates a user interface definition in XML format: notepad.ui.
|
||||||
|
When you open the notepad.ui file in Qt Creator, it automatically
|
||||||
|
opens in the integrated Qt Designer.
|
||||||
|
|
||||||
|
When you build the application, Qt Creator launches the Qt
|
||||||
|
\l{User Interface Compiler (uic)} that reads the .ui file and creates
|
||||||
|
a corresponding C++ header file, ui_notepad.h.
|
||||||
|
|
||||||
|
\section2 Using Qt Designer
|
||||||
|
|
||||||
|
The wizard creates an application that uses a QMainWindow. It has
|
||||||
|
its own layout to which you can add a menu bar, dock widgets, toolbars,
|
||||||
|
and a status bar. The center area can be occupied by any kind of widget.
|
||||||
|
The wizard places the Notepad widget there.
|
||||||
|
|
||||||
|
To add widgets in Qt Designer:
|
||||||
|
|
||||||
|
\list 1
|
||||||
|
\li In the Qt Creator \b Editor mode, double-click the notepad.ui
|
||||||
|
file in the \b Projects view to launch the file in the integrated
|
||||||
|
Qt Designer.
|
||||||
|
\li Drag and drop widgets Text Edit (QTextEdit) to the form.
|
||||||
|
\li Press \b {Ctrl+A} (or \b {Cmd+A}) to select the widgets and click
|
||||||
|
\b {Lay out Vertically} (or press \b {Ctrl+L}) to apply a vertical
|
||||||
|
layout (QVBoxLayout).
|
||||||
|
\li Press \b {Ctrl+S} (or \b {Cmd+S}) to save your changes.
|
||||||
|
\endlist
|
||||||
|
|
||||||
|
The UI now looks as follows in Qt Designer:
|
||||||
|
|
||||||
|
\image notepad4.png
|
||||||
|
|
||||||
|
You can view the generated XML file in the code editor:
|
||||||
|
|
||||||
|
\quotefromfile tutorials/notepad/notepad.ui
|
||||||
|
|
||||||
|
\printuntil QMenuBar
|
||||||
|
\dots
|
||||||
|
|
||||||
|
The following line contains the XML declaration, which specifies the
|
||||||
|
XML version and character encoding used in the document:
|
||||||
|
|
||||||
|
\code
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
\endcode
|
||||||
|
|
||||||
|
The rest of the file specifies an \c ui element that defines a
|
||||||
|
Notepad widget:
|
||||||
|
|
||||||
|
\code
|
||||||
|
<ui version="4.0">
|
||||||
|
\endcode
|
||||||
|
|
||||||
|
The UI file is used together with the header and source file of the
|
||||||
|
Notepad class. We will look at the rest of the UI file in the later
|
||||||
|
sections.
|
||||||
|
|
||||||
|
\section2 Notepad Header File
|
||||||
|
|
||||||
|
The wizard generated a header file for the Notepad class that has the
|
||||||
|
necessary #includes, a constructor, a destructor, and the Ui object.
|
||||||
|
The file looks as follows:
|
||||||
|
|
||||||
|
\snippet tutorials/notepad/notepad.h all
|
||||||
|
|
||||||
|
The following line includes QMainWindow that provides a main application
|
||||||
|
window:
|
||||||
|
|
||||||
|
\snippet tutorials/notepad/notepad.h 1
|
||||||
|
|
||||||
|
The following lines declare the Notepad class in the Ui namespace,
|
||||||
|
which is the standard namespace for the UI classes generated from
|
||||||
|
.ui files by the \c uic tool:
|
||||||
|
|
||||||
|
\snippet tutorials/notepad/notepad.h 2
|
||||||
|
|
||||||
|
The class declaration contains the \c Q_OBJECT macro. It must come
|
||||||
|
first in the class definition, and declares our class as a QObject.
|
||||||
|
Naturally, it must also inherit from QObject. A QObject adds several
|
||||||
|
abilities to a normal C++ class. Notably, the class name and slot
|
||||||
|
names can be queried at runtime. It is also possible to query a slot's
|
||||||
|
parameter types and invoke it.
|
||||||
|
|
||||||
|
\snippet tutorials/notepad/notepad.h 3
|
||||||
|
|
||||||
|
The following lines declare a constructor that has a default argument
|
||||||
|
called \c parent.
|
||||||
|
The value 0 indicates that the widget has no parent (it is a top-level
|
||||||
|
widget).
|
||||||
|
|
||||||
|
\snippet tutorials/notepad/notepad.h 4
|
||||||
|
|
||||||
|
The following line declares a virtual destructor to free the resources
|
||||||
|
that were acquired by the object during its life-cycle. According to
|
||||||
|
the C++ naming convention, destructors have the same name as the class
|
||||||
|
they are associated with, prefixed with a tilde (~). In QObject,
|
||||||
|
destructors are virtual to ensure that the destructors of derived
|
||||||
|
classes are invoked properly when an object is deleted through a
|
||||||
|
pointer-to-base-class.
|
||||||
|
|
||||||
|
\snippet tutorials/notepad/notepad.h 5
|
||||||
|
|
||||||
|
The following lines declare a member variable which is a pointer to
|
||||||
|
the Notepad UI class. A member variable is associated with a specific
|
||||||
|
class, and accessible for all its methods.
|
||||||
|
|
||||||
|
\snippet tutorials/notepad/notepad.h 6
|
||||||
|
|
||||||
|
\section2 Notepad Source File
|
||||||
|
|
||||||
|
The source file that the wizard generated for the Notepad class looks
|
||||||
|
as follows:
|
||||||
|
|
||||||
|
\quotefromfile tutorials/notepad/notepad.cpp
|
||||||
|
\skipto notepad.h
|
||||||
|
\printuntil ui->textEdit->setFont(font)
|
||||||
|
\printuntil }
|
||||||
|
|
||||||
|
The following lines include the Notepad class header file that was
|
||||||
|
generated by the wizard and the UI header file that was generated
|
||||||
|
by the \c uic tool:
|
||||||
|
|
||||||
|
\quotefromfile tutorials/notepad/notepad.cpp
|
||||||
|
\skipto notepad.h
|
||||||
|
\printuntil ui_notepad
|
||||||
|
|
||||||
|
The following line defines the \c {Notepad} constructor:
|
||||||
|
|
||||||
|
\skipto Notepad::Notepad
|
||||||
|
\printline Notepad::Notepad
|
||||||
|
|
||||||
|
The following line calls the QMainWindow constructor, which is
|
||||||
|
the base class for the Notepad class:
|
||||||
|
|
||||||
|
\printline QMainWindow
|
||||||
|
|
||||||
|
The following line creates the UI class instance and assigns it to
|
||||||
|
the \c ui member:
|
||||||
|
|
||||||
|
\printline ui(new
|
||||||
|
|
||||||
|
The following line sets up the UI:
|
||||||
|
|
||||||
|
\quotefromfile tutorials/notepad/notepad.cpp
|
||||||
|
\skipto ui->setupUi
|
||||||
|
\printline ui->setupUi(this)
|
||||||
|
|
||||||
|
In the destructor, we delete the \c ui:
|
||||||
|
|
||||||
|
\skipto Notepad::~Notepad
|
||||||
|
\printuntil }
|
||||||
|
|
||||||
|
In order to have the text edit field occupy the whole screen, we add
|
||||||
|
\c setCentralWidget to the main window.
|
||||||
|
|
||||||
|
\quotefromfile tutorials/notepad/notepad.cpp
|
||||||
|
\skipto Notepad::Notepad(QWidget *parent)
|
||||||
|
\printuntil }
|
||||||
|
|
||||||
|
\section2 Project File
|
||||||
|
|
||||||
|
The wizard generates the following project file, \c {notepad.pro}, for
|
||||||
|
us:
|
||||||
|
|
||||||
|
\quotefile tutorials/notepad/notepad.pro
|
||||||
|
|
||||||
|
The project file specifies the application name and the \c qmake
|
||||||
|
template to use for generating the project, as well as the source,
|
||||||
|
header, and UI files included in the project.
|
||||||
|
|
||||||
|
You could also use \c qmake's \c -project option to generate the \.pro
|
||||||
|
file. Although, in that case, you have to remember to add the line
|
||||||
|
\c{QT += widgets} to the generated file in order to link against the
|
||||||
|
Qt Widgets Module.
|
||||||
|
|
||||||
|
\b{Learn More}
|
||||||
|
|
||||||
|
\table
|
||||||
|
\header
|
||||||
|
\li About
|
||||||
|
\li Here
|
||||||
|
\row
|
||||||
|
\li Using Qt Designer
|
||||||
|
\li \l{Qt Designer Manual}
|
||||||
|
\row
|
||||||
|
\li Layouts
|
||||||
|
\li \l{Layout Management},
|
||||||
|
\l{Widgets and Layouts},
|
||||||
|
\l{Layout Examples}
|
||||||
|
\row
|
||||||
|
\li The widgets that come with Qt
|
||||||
|
\li \l{Qt Widget Gallery}
|
||||||
|
\row
|
||||||
|
\li Main windows and main window classes
|
||||||
|
\li \l{Application Main Window},
|
||||||
|
\l{Main Window Examples}
|
||||||
|
\row
|
||||||
|
\li QObjects and the Qt Object model (This is essential to
|
||||||
|
understand Qt)
|
||||||
|
\li \l{Object Model}
|
||||||
|
\row
|
||||||
|
\li qmake and the Qt build system
|
||||||
|
\li \l{qmake Manual}
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
\section1 Adding User Interaction
|
||||||
|
|
||||||
|
|
||||||
|
To add functionality to the editor, we start by adding menu items
|
||||||
|
and buttons on a toolbar.
|
||||||
|
|
||||||
|
Click on "Type Here", and add the options New, Open, Save, Save as,
|
||||||
|
Print and Exit. This creates 5 lines in the Action Editor below.
|
||||||
|
To connect the actions to slots, right-click an action and select
|
||||||
|
Go to slot > triggered(), and complete the code for that given slot.
|
||||||
|
|
||||||
|
If we also want to add the actions to a toolbar, we can assign an
|
||||||
|
icon to each QAction, and then drag the QAction to the toolbar. You
|
||||||
|
assign an icon by entering an icon name in the Icon property of the
|
||||||
|
action concerned. When the QAction has been dragged to the toolbar,
|
||||||
|
clicking the icon will launch the associated slot.
|
||||||
|
|
||||||
|
Complete the method \c on_actionNew_triggered():
|
||||||
|
|
||||||
|
\quotefromfile tutorials/notepad/notepad.cpp
|
||||||
|
\skipto on_actionNew_triggered()
|
||||||
|
\printuntil }
|
||||||
|
|
||||||
|
\c current_file is a global variable containing the file presently
|
||||||
|
being edited.
|
||||||
|
It is defined in the private part of notepad.h:
|
||||||
|
|
||||||
|
\quotefromfile tutorials/notepad/notepad.h
|
||||||
|
\skipto private:
|
||||||
|
\printuntil currentFile;
|
||||||
|
|
||||||
|
\c clear() clears the text buffer.
|
||||||
|
|
||||||
|
\section2 Opening a file
|
||||||
|
|
||||||
|
In \c notepad.ui, right click on \c actionOpen and select \c {Go to
|
||||||
|
slot}
|
||||||
|
|
||||||
|
Complete method \c on_actionOpen_triggered().
|
||||||
|
|
||||||
|
\quotefromfile tutorials/notepad/notepad.cpp
|
||||||
|
\skipto on_actionOpen_triggered()
|
||||||
|
\printuntil file.close
|
||||||
|
\printuntil }
|
||||||
|
|
||||||
|
|
||||||
|
\c QFileDialog::getOpenFileName opens a dialog enabling you to select
|
||||||
|
a file. QFile object \c myfile has the selected \c file_name as
|
||||||
|
parameter. We store the selected file also into the global variable
|
||||||
|
\c current_file for later purposes. We open the file with \c file.open
|
||||||
|
as a readonly text file. If it cannot be opened, a warning is issued,
|
||||||
|
and the program stops.
|
||||||
|
|
||||||
|
We define a QTextStream \c instream for parameter \c myfile.
|
||||||
|
The contents of file \c myfile is copied into QString \a text.
|
||||||
|
\c setText(text) fille the buffer of our editor with \c text.
|
||||||
|
|
||||||
|
\c section2 Saving a file
|
||||||
|
|
||||||
|
We create the method for saving a file in the same way as for
|
||||||
|
\l {Opening a file}, by right clicking on \c actionSave, and
|
||||||
|
selecting \c {Go to Slot}.
|
||||||
|
|
||||||
|
\skipto Notepad::on_actionSave_triggered
|
||||||
|
\printuntil file.close
|
||||||
|
\printuntil }
|
||||||
|
|
||||||
|
QFile object \c myfile is linked to global variable \c current_file,
|
||||||
|
the variable that contains the file we were working with.
|
||||||
|
If we cannot open \c myfile, an error message is issued and the
|
||||||
|
method stops. We create a QTextStream \c outstream. The contents
|
||||||
|
of the editor buffer is converted to plain text, and then written
|
||||||
|
to \c outstream.
|
||||||
|
|
||||||
|
\section2 Saving a file with \c {Save as}
|
||||||
|
|
||||||
|
\skipto Notepad::on_actionSave_as_triggered
|
||||||
|
\printuntil file.close
|
||||||
|
\printuntil }
|
||||||
|
|
||||||
|
This is the same procedure as for \c {Saving a file}, the only
|
||||||
|
difference being that here you need to enter a new file name for
|
||||||
|
the file to be created.
|
||||||
|
|
||||||
|
|
||||||
|
\section2 Print a File
|
||||||
|
|
||||||
|
If you want to use print functionalities, you need to add
|
||||||
|
\c printsupport to the project file:
|
||||||
|
|
||||||
|
\badcode
|
||||||
|
QT += printsupport
|
||||||
|
\endcode
|
||||||
|
|
||||||
|
We declare a QPrinter object called \c printer.
|
||||||
|
We launch a printer dialog box and store the selected printer in
|
||||||
|
object \c printer. If we clicked on \c Cancel and did not select
|
||||||
|
a printer, the methods returns. The actual printer command is given
|
||||||
|
with \a ui->textEdit->print with our QPrinter object as parameter.
|
||||||
|
|
||||||
|
\section2 Select a Font
|
||||||
|
|
||||||
|
\skipto Notepad::on_actionFont_triggered
|
||||||
|
\printuntil ui->textEdit->setFont
|
||||||
|
\printline }
|
||||||
|
|
||||||
|
We declare a boolean indicating if we did select a font with
|
||||||
|
QFontDialog. If so, we set the font with \c ui->textEdit->setFont(myfont).
|
||||||
|
|
||||||
|
\section2 Copy, Cut, Paste, Undo, and Redo
|
||||||
|
|
||||||
|
If you select some text, and want to copy it to the clipboard,
|
||||||
|
you call the appropriate method of ui->textEdit. The same counts
|
||||||
|
for cut, paste, undo, and redo.
|
||||||
|
|
||||||
|
This table shows the method name to use.
|
||||||
|
|
||||||
|
\table
|
||||||
|
\header
|
||||||
|
\li Task
|
||||||
|
\li Method called
|
||||||
|
\row
|
||||||
|
\li Copy
|
||||||
|
\li ui->textEdit->copy()
|
||||||
|
\row
|
||||||
|
\li Cut
|
||||||
|
\li ui->textEdit->cut()
|
||||||
|
\row
|
||||||
|
\li Paste
|
||||||
|
\li ui->textEdit->paste()
|
||||||
|
\row
|
||||||
|
\li Undo
|
||||||
|
\li ui->textEdit->undo()
|
||||||
|
\row
|
||||||
|
\li Redo
|
||||||
|
\li ui->textEdit->redo()
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
\b{Learn More}
|
||||||
|
|
||||||
|
\table
|
||||||
|
\header
|
||||||
|
\li About
|
||||||
|
\li Here
|
||||||
|
\row
|
||||||
|
\li MDI applications
|
||||||
|
\li QMdiArea,
|
||||||
|
\l{MDI Example}
|
||||||
|
\row
|
||||||
|
\li Files and I/O devices
|
||||||
|
\li QFile, QIODevice
|
||||||
|
\row
|
||||||
|
\li tr() and internationalization
|
||||||
|
\li \l{Qt Linguist Manual},
|
||||||
|
\l{Writing Source Code for Translation},
|
||||||
|
\l{Internationalization with Qt}
|
||||||
|
\endtable
|
||||||
|
|
||||||
|
\section1 Building and Running Notepad
|
||||||
|
|
||||||
|
Now that you have all the necessary files, select \b Build >
|
||||||
|
\b {Build Project Notepad} to build and run the application. Qt
|
||||||
|
Creator uses \c qmake and \c make to create an executable in the
|
||||||
|
directory specified in the build settings of the project and runs
|
||||||
|
it.
|
||||||
|
|
||||||
|
\section2 Building and Running from the Command Line
|
||||||
|
|
||||||
|
To build the application from the command line, switch to the
|
||||||
|
directory in which you have the \c .cpp file of the application
|
||||||
|
and add the project file (suffixed .pro) described earlier. The
|
||||||
|
following shell commands then build the application:
|
||||||
|
|
||||||
|
\badcode
|
||||||
|
qmake
|
||||||
|
make (or nmake on Windows)
|
||||||
|
\endcode
|
||||||
|
|
||||||
|
The commands create an executable in the project directory. The
|
||||||
|
\c qmake tool reads the project file and produces a \c Makefile
|
||||||
|
with instructions on how to build the application.
|
||||||
|
The \c make tool (or the \c nmake tool) then reads the \c Makefile
|
||||||
|
and produces the executable binary.
|
||||||
|
*/
|
BIN
examples/widgets/tutorials/notepad/images/copy.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
examples/widgets/tutorials/notepad/images/create.png
Normal file
After Width: | Height: | Size: 459 B |
BIN
examples/widgets/tutorials/notepad/images/cut.png
Normal file
After Width: | Height: | Size: 9.3 KiB |
BIN
examples/widgets/tutorials/notepad/images/edit_redo.png
Normal file
After Width: | Height: | Size: 7.3 KiB |
BIN
examples/widgets/tutorials/notepad/images/edit_undo.png
Normal file
After Width: | Height: | Size: 8.2 KiB |
BIN
examples/widgets/tutorials/notepad/images/exit.png
Normal file
After Width: | Height: | Size: 379 B |
BIN
examples/widgets/tutorials/notepad/images/font.png
Normal file
After Width: | Height: | Size: 6.8 KiB |
BIN
examples/widgets/tutorials/notepad/images/info.png
Normal file
After Width: | Height: | Size: 557 B |
BIN
examples/widgets/tutorials/notepad/images/new.png
Normal file
After Width: | Height: | Size: 7.2 KiB |
BIN
examples/widgets/tutorials/notepad/images/open.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
examples/widgets/tutorials/notepad/images/paste.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
examples/widgets/tutorials/notepad/images/pencil.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
examples/widgets/tutorials/notepad/images/print.png
Normal file
After Width: | Height: | Size: 331 B |
BIN
examples/widgets/tutorials/notepad/images/save.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
examples/widgets/tutorials/notepad/images/save_as.png
Normal file
After Width: | Height: | Size: 8.0 KiB |
@ -1,9 +1,9 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2017 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the examples of the Qt Toolkit.
|
** This file is part of the documentation of the Qt Toolkit.
|
||||||
**
|
**
|
||||||
** $QT_BEGIN_LICENSE:BSD$
|
** $QT_BEGIN_LICENSE:BSD$
|
||||||
** Commercial License Usage
|
** Commercial License Usage
|
||||||
@ -48,16 +48,14 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "notepad.h"
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
|
||||||
#include "configdialog.h"
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
Q_INIT_RESOURCE(configdialog);
|
QApplication EditorApp(argc, argv);
|
||||||
|
Notepad Editor;
|
||||||
|
Editor.show();
|
||||||
|
|
||||||
QApplication app(argc, argv);
|
return EditorApp.exec();
|
||||||
app.setApplicationDisplayName("Qt Example");
|
|
||||||
ConfigDialog dialog;
|
|
||||||
return dialog.exec();
|
|
||||||
}
|
}
|
182
examples/widgets/tutorials/notepad/notepad.cpp
Normal file
@ -0,0 +1,182 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2017 The Qt Company Ltd.
|
||||||
|
** Contact: https://www.qt.io/licensing/
|
||||||
|
**
|
||||||
|
** This file is part of the documentation of the Qt Toolkit.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:BSD$
|
||||||
|
** Commercial License Usage
|
||||||
|
** Licensees holding valid commercial Qt licenses may use this file in
|
||||||
|
** accordance with the commercial license agreement provided with the
|
||||||
|
** Software or, alternatively, in accordance with the terms contained in
|
||||||
|
** a written agreement between you and The Qt Company. For licensing terms
|
||||||
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
||||||
|
** information use the contact form at https://www.qt.io/contact-us.
|
||||||
|
**
|
||||||
|
** BSD License Usage
|
||||||
|
** Alternatively, you may use this file under the terms of the BSD license
|
||||||
|
** as follows:
|
||||||
|
**
|
||||||
|
** "Redistribution and use in source and binary forms, with or without
|
||||||
|
** modification, are permitted provided that the following conditions are
|
||||||
|
** met:
|
||||||
|
** * Redistributions of source code must retain the above copyright
|
||||||
|
** notice, this list of conditions and the following disclaimer.
|
||||||
|
** * Redistributions in binary form must reproduce the above copyright
|
||||||
|
** notice, this list of conditions and the following disclaimer in
|
||||||
|
** the documentation and/or other materials provided with the
|
||||||
|
** distribution.
|
||||||
|
** * Neither the name of The Qt Company Ltd nor the names of its
|
||||||
|
** contributors may be used to endorse or promote products derived
|
||||||
|
** from this software without specific prior written permission.
|
||||||
|
**
|
||||||
|
**
|
||||||
|
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||||
|
**
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <QFile>
|
||||||
|
#include <QFileDialog>
|
||||||
|
#include <QTextStream>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QPrintDialog>
|
||||||
|
#include <QPrinter>
|
||||||
|
#include <QFont>
|
||||||
|
#include <QFontDialog>
|
||||||
|
|
||||||
|
#include "notepad.h"
|
||||||
|
#include "ui_notepad.h"
|
||||||
|
|
||||||
|
Notepad::Notepad(QWidget *parent) :
|
||||||
|
QMainWindow(parent),
|
||||||
|
ui(new Ui::Notepad)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
this->setCentralWidget(ui->textEdit);
|
||||||
|
}
|
||||||
|
|
||||||
|
Notepad::~Notepad()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Notepad::on_actionNew_triggered()
|
||||||
|
{
|
||||||
|
currentFile.clear();
|
||||||
|
ui->textEdit->setText(QString());
|
||||||
|
}
|
||||||
|
|
||||||
|
void Notepad::on_actionOpen_triggered()
|
||||||
|
{
|
||||||
|
QString fileName = QFileDialog::getOpenFileName(this, "Open the file");
|
||||||
|
QFile file(fileName);
|
||||||
|
currentFile = fileName;
|
||||||
|
if (!file.open(QIODevice::ReadOnly | QFile::Text)) {
|
||||||
|
QMessageBox::warning(this, "Warning", "Cannot open file: " + file.errorString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setWindowTitle(fileName);
|
||||||
|
QTextStream in(&file);
|
||||||
|
QString text = in.readAll();
|
||||||
|
ui->textEdit->setText(text);
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Notepad::on_actionSave_triggered()
|
||||||
|
{
|
||||||
|
QString fileName;
|
||||||
|
// If we don't have a filename from before, get one.
|
||||||
|
if (currentFile.isEmpty()) {
|
||||||
|
fileName = QFileDialog::getSaveFileName(this, "Save");
|
||||||
|
currentFile = fileName;
|
||||||
|
} else {
|
||||||
|
fileName = currentFile;
|
||||||
|
}
|
||||||
|
QFile file(fileName);
|
||||||
|
if (!file.open(QIODevice::WriteOnly | QFile::Text)) {
|
||||||
|
QMessageBox::warning(this, "Warning", "Cannot save file: " + file.errorString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setWindowTitle(fileName);
|
||||||
|
QTextStream out(&file);
|
||||||
|
QString text = ui->textEdit->toPlainText();
|
||||||
|
out << text;
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Notepad::on_actionSave_as_triggered()
|
||||||
|
{
|
||||||
|
QString fileName = QFileDialog::getSaveFileName(this, "Save as");
|
||||||
|
QFile file(fileName);
|
||||||
|
|
||||||
|
if (!file.open(QFile::WriteOnly | QFile::Text)) {
|
||||||
|
QMessageBox::warning(this, "Warning", "Cannot save file: " + file.errorString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
currentFile = fileName;
|
||||||
|
setWindowTitle(fileName);
|
||||||
|
QTextStream out(&file);
|
||||||
|
QString text = ui->textEdit->toPlainText();
|
||||||
|
out << text;
|
||||||
|
file.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Notepad::on_actionPrint_triggered()
|
||||||
|
{
|
||||||
|
QPrinter printDev;
|
||||||
|
QPrintDialog dialog(&printDev, this);
|
||||||
|
if (dialog.exec() == QDialog::Rejected)
|
||||||
|
return;
|
||||||
|
ui->textEdit->print(&printDev);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Notepad::on_actionExit_triggered()
|
||||||
|
{
|
||||||
|
QCoreApplication::quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Notepad::on_actionCopy_triggered()
|
||||||
|
{
|
||||||
|
ui->textEdit->copy();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Notepad::on_actionCut_triggered()
|
||||||
|
{
|
||||||
|
ui->textEdit->cut();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Notepad::on_actionPaste_triggered()
|
||||||
|
{
|
||||||
|
ui->textEdit->paste();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Notepad::on_actionUndo_triggered()
|
||||||
|
{
|
||||||
|
ui->textEdit->undo();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Notepad::on_actionRedo_triggered()
|
||||||
|
{
|
||||||
|
ui->textEdit->redo();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Notepad::on_actionFont_triggered()
|
||||||
|
{
|
||||||
|
bool fontSelected;
|
||||||
|
QFont font = QFontDialog::getFont(&fontSelected, this);
|
||||||
|
if (fontSelected)
|
||||||
|
ui->textEdit->setFont(font);
|
||||||
|
}
|
@ -1,9 +1,9 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
** Copyright (C) 2017 The Qt Company Ltd.
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the examples of the Qt Toolkit.
|
** This file is part of the documentation of the Qt Toolkit.
|
||||||
**
|
**
|
||||||
** $QT_BEGIN_LICENSE:BSD$
|
** $QT_BEGIN_LICENSE:BSD$
|
||||||
** Commercial License Usage
|
** Commercial License Usage
|
||||||
@ -48,32 +48,67 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef CONFIGDIALOG_H
|
#ifndef NOTEPAD_H
|
||||||
#define CONFIGDIALOG_H
|
#define NOTEPAD_H
|
||||||
|
|
||||||
#include <QDialog>
|
//! [all]
|
||||||
|
//! [1]
|
||||||
|
#include <QMainWindow>
|
||||||
|
//! [1]
|
||||||
|
|
||||||
|
//! [2]
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QListWidget;
|
namespace Ui {
|
||||||
class QListWidgetItem;
|
class Notepad;
|
||||||
class QStackedWidget;
|
}
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
//! [2]
|
||||||
|
|
||||||
class ConfigDialog : public QDialog
|
//! [3]
|
||||||
|
class Notepad : public QMainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
//! [3]
|
||||||
|
|
||||||
|
//! [4]
|
||||||
public:
|
public:
|
||||||
ConfigDialog();
|
explicit Notepad(QWidget *parent = 0);
|
||||||
|
//! [4]
|
||||||
|
//! [5]
|
||||||
|
~Notepad();
|
||||||
|
//! [5]
|
||||||
|
|
||||||
public slots:
|
private slots:
|
||||||
void changePage(QListWidgetItem *current, QListWidgetItem *previous);
|
void on_actionNew_triggered();
|
||||||
|
|
||||||
|
void on_actionOpen_triggered();
|
||||||
|
|
||||||
|
void on_actionSave_triggered();
|
||||||
|
|
||||||
|
void on_actionSave_as_triggered();
|
||||||
|
|
||||||
|
void on_actionPrint_triggered();
|
||||||
|
|
||||||
|
void on_actionExit_triggered();
|
||||||
|
|
||||||
|
void on_actionCopy_triggered();
|
||||||
|
|
||||||
|
void on_actionCut_triggered();
|
||||||
|
|
||||||
|
void on_actionPaste_triggered();
|
||||||
|
|
||||||
|
void on_actionUndo_triggered();
|
||||||
|
|
||||||
|
void on_actionRedo_triggered();
|
||||||
|
|
||||||
|
void on_actionFont_triggered();
|
||||||
|
|
||||||
|
//! [6]
|
||||||
private:
|
private:
|
||||||
void createIcons();
|
Ui::Notepad *ui;
|
||||||
|
QString currentFile;
|
||||||
QListWidget *contentsWidget;
|
//! [6]
|
||||||
QStackedWidget *pagesWidget;
|
|
||||||
};
|
};
|
||||||
|
//! [all]
|
||||||
|
|
||||||
#endif
|
#endif // NOTEPAD_H
|
20
examples/widgets/tutorials/notepad/notepad.pro
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
TEMPLATE = app
|
||||||
|
TARGET = notepad
|
||||||
|
|
||||||
|
QT += printsupport
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
main.cpp\
|
||||||
|
notepad.cpp
|
||||||
|
|
||||||
|
HEADERS += notepad.h
|
||||||
|
|
||||||
|
FORMS += notepad.ui
|
||||||
|
|
||||||
|
RESOURCES += \
|
||||||
|
notepad.qrc
|
||||||
|
|
||||||
|
# install
|
||||||
|
target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tutorials/notepad
|
||||||
|
INSTALLS += target
|
||||||
|
|
19
examples/widgets/tutorials/notepad/notepad.qrc
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<RCC>
|
||||||
|
<qresource prefix="/">
|
||||||
|
<file>images/copy.png</file>
|
||||||
|
<file>images/create.png</file>
|
||||||
|
<file>images/cut.png</file>
|
||||||
|
<file>images/edit_redo.png</file>
|
||||||
|
<file>images/edit_undo.png</file>
|
||||||
|
<file>images/exit.png</file>
|
||||||
|
<file>images/font.png</file>
|
||||||
|
<file>images/info.png</file>
|
||||||
|
<file>images/new.png</file>
|
||||||
|
<file>images/open.png</file>
|
||||||
|
<file>images/paste.png</file>
|
||||||
|
<file>images/pencil.png</file>
|
||||||
|
<file>images/print.png</file>
|
||||||
|
<file>images/save.png</file>
|
||||||
|
<file>images/save_as.png</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
196
examples/widgets/tutorials/notepad/notepad.ui
Normal file
@ -0,0 +1,196 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>Notepad</class>
|
||||||
|
<widget class="QMainWindow" name="Notepad">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>524</width>
|
||||||
|
<height>300</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Notepad</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="centralWidget">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QTextEdit" name="textEdit"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QMenuBar" name="menuBar">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>524</width>
|
||||||
|
<height>25</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<widget class="QMenu" name="menuFile">
|
||||||
|
<property name="title">
|
||||||
|
<string>File</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="actionNew"/>
|
||||||
|
<addaction name="actionOpen"/>
|
||||||
|
<addaction name="actionSave"/>
|
||||||
|
<addaction name="actionSave_as"/>
|
||||||
|
<addaction name="actionPrint"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
|
<addaction name="actionExit"/>
|
||||||
|
</widget>
|
||||||
|
<widget class="QMenu" name="menuEdit">
|
||||||
|
<property name="title">
|
||||||
|
<string>Edit</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="actionCopy"/>
|
||||||
|
<addaction name="actionCut"/>
|
||||||
|
<addaction name="actionPaste"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
|
<addaction name="actionUndo"/>
|
||||||
|
<addaction name="actionRedo"/>
|
||||||
|
<addaction name="actionFont"/>
|
||||||
|
</widget>
|
||||||
|
<addaction name="menuFile"/>
|
||||||
|
<addaction name="menuEdit"/>
|
||||||
|
</widget>
|
||||||
|
<widget class="QToolBar" name="mainToolBar">
|
||||||
|
<attribute name="toolBarArea">
|
||||||
|
<enum>TopToolBarArea</enum>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="toolBarBreak">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
<addaction name="actionNew"/>
|
||||||
|
<addaction name="actionOpen"/>
|
||||||
|
<addaction name="actionSave"/>
|
||||||
|
<addaction name="actionSave_as"/>
|
||||||
|
<addaction name="actionPrint"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
|
<addaction name="actionCopy"/>
|
||||||
|
<addaction name="actionCut"/>
|
||||||
|
<addaction name="actionPaste"/>
|
||||||
|
<addaction name="actionUndo"/>
|
||||||
|
<addaction name="actionRedo"/>
|
||||||
|
<addaction name="actionFont"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
|
<addaction name="actionExit"/>
|
||||||
|
</widget>
|
||||||
|
<widget class="QStatusBar" name="statusBar"/>
|
||||||
|
<action name="actionNew">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="notepad.qrc">
|
||||||
|
<normaloff>:/images/new.png</normaloff>:/images/new.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>New</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionOpen">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset>
|
||||||
|
<normaloff>:/images/open.png</normaloff>:/images/open.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Open</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionSave">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset>
|
||||||
|
<normaloff>:/images/save.png</normaloff>:/images/save.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Save</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionSave_as">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset>
|
||||||
|
<normaloff>:/images/save_as.png</normaloff>:/images/save_as.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Save as</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionPrint">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset>
|
||||||
|
<normaloff>:/images/print.png</normaloff>:/images/print.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Print</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionExit">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset>
|
||||||
|
<normaloff>:/images/exit.png</normaloff>:/images/exit.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Exit</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionCopy">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset>
|
||||||
|
<normaloff>:/images/copy.png</normaloff>:/images/copy.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Copy</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionCut">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset>
|
||||||
|
<normaloff>:/images/cut.png</normaloff>:/images/cut.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Cut</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionPaste">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset>
|
||||||
|
<normaloff>:/images/paste.png</normaloff>:/images/paste.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Paste</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionUndo">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset>
|
||||||
|
<normaloff>:/images/edit_undo.png</normaloff>:/images/edit_undo.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Undo</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionRedo">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset>
|
||||||
|
<normaloff>:/images/edit_redo.png</normaloff>:/images/edit_redo.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Redo</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionFont">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset>
|
||||||
|
<normaloff>:/images/font.png</normaloff>:/images/font.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Font</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
</widget>
|
||||||
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
|
<resources>
|
||||||
|
<include location="notepad.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
@ -1,2 +1,2 @@
|
|||||||
TEMPLATE = subdirs
|
TEMPLATE = subdirs
|
||||||
SUBDIRS += addressbook widgets modelview gettingStarted
|
SUBDIRS += addressbook widgets modelview gettingStarted notepad
|
||||||
|
@ -1,17 +1,21 @@
|
|||||||
#
|
#
|
||||||
# qmake configuration for Microsoft Visual Studio C/C++ Compiler
|
# This file is used as a basis for the following compilers:
|
||||||
# This mkspec is used by the win32-msvc and win32-clang-msvc specs
|
|
||||||
#
|
#
|
||||||
|
# - Microsoft C/C++ Optimizing Compiler (all desktop versions)
|
||||||
|
# - Intel C++ Compiler on Windows
|
||||||
|
# - Clang-cl
|
||||||
|
#
|
||||||
|
# Baseline:
|
||||||
|
#
|
||||||
|
# - Visual Studio 2005 (8.0), VC++ 14.0
|
||||||
#
|
#
|
||||||
# Baseline: Visual Studio 2005 (8.0), VC++ 14.0
|
|
||||||
# Version-specific settings go in msvc-version.conf (loaded by default_pre)
|
# Version-specific settings go in msvc-version.conf (loaded by default_pre)
|
||||||
#
|
#
|
||||||
|
|
||||||
MAKEFILE_GENERATOR = MSVC.NET
|
MAKEFILE_GENERATOR = MSVC.NET
|
||||||
QMAKE_PLATFORM = win32
|
QMAKE_PLATFORM = win32
|
||||||
QMAKE_COMPILER = msvc
|
QMAKE_COMPILER = msvc
|
||||||
CONFIG += incremental flat precompile_header autogen_precompile_source debug_and_release debug_and_release_target embed_manifest_dll embed_manifest_exe
|
CONFIG += incremental flat debug_and_release debug_and_release_target precompile_header autogen_precompile_source embed_manifest_dll embed_manifest_exe
|
||||||
DEFINES += UNICODE _UNICODE WIN32
|
DEFINES += UNICODE _UNICODE WIN32
|
||||||
QMAKE_COMPILER_DEFINES += _WIN32
|
QMAKE_COMPILER_DEFINES += _WIN32
|
||||||
contains(QMAKE_TARGET.arch, x86_64) {
|
contains(QMAKE_TARGET.arch, x86_64) {
|
||||||
@ -31,7 +35,7 @@ QMAKE_CFLAGS = -nologo -Zc:wchar_t
|
|||||||
QMAKE_CFLAGS_WARN_ON = -W3
|
QMAKE_CFLAGS_WARN_ON = -W3
|
||||||
QMAKE_CFLAGS_WARN_OFF = -W0
|
QMAKE_CFLAGS_WARN_OFF = -W0
|
||||||
QMAKE_CFLAGS_RELEASE = $$QMAKE_CFLAGS_OPTIMIZE -MD
|
QMAKE_CFLAGS_RELEASE = $$QMAKE_CFLAGS_OPTIMIZE -MD
|
||||||
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_OPTIMIZE -MD -Zi
|
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_CFLAGS_OPTIMIZE -Zi -MD
|
||||||
QMAKE_CFLAGS_DEBUG = -Zi -MDd
|
QMAKE_CFLAGS_DEBUG = -Zi -MDd
|
||||||
QMAKE_CFLAGS_YACC =
|
QMAKE_CFLAGS_YACC =
|
||||||
QMAKE_CFLAGS_LTCG = -GL
|
QMAKE_CFLAGS_LTCG = -GL
|
||||||
@ -96,7 +100,6 @@ QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib
|
|||||||
QMAKE_LIBS_OPENGL_ES2 = gdi32.lib user32.lib
|
QMAKE_LIBS_OPENGL_ES2 = gdi32.lib user32.lib
|
||||||
QMAKE_LIBS_OPENGL_ES2_DEBUG = gdi32.lib user32.lib
|
QMAKE_LIBS_OPENGL_ES2_DEBUG = gdi32.lib user32.lib
|
||||||
QMAKE_LIBS_COMPAT = advapi32.lib shell32.lib comdlg32.lib user32.lib gdi32.lib ws2_32.lib
|
QMAKE_LIBS_COMPAT = advapi32.lib shell32.lib comdlg32.lib user32.lib gdi32.lib ws2_32.lib
|
||||||
|
|
||||||
QMAKE_LIBS_QT_ENTRY = -lqtmain
|
QMAKE_LIBS_QT_ENTRY = -lqtmain
|
||||||
|
|
||||||
QMAKE_IDL = midl /NOLOGO
|
QMAKE_IDL = midl /NOLOGO
|
||||||
|
57
mkspecs/devices/integrity-armv8-msm8996au/qmake.conf
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
#
|
||||||
|
# qmake configuration for INTEGRITY Qualcomm s820 Snapdragon MSM8996AU
|
||||||
|
#
|
||||||
|
|
||||||
|
load(device_config)
|
||||||
|
|
||||||
|
include(../../common/ghs-integrity-armv8.conf)
|
||||||
|
|
||||||
|
QT_QPA_DEFAULT_PLATFORM = eglfs
|
||||||
|
EGLFS_DEVICE_INTEGRATION = eglfs_openwfd
|
||||||
|
|
||||||
|
bsp_name = $$(INTEGRITY_BSP)
|
||||||
|
isEmpty(bsp_name): \
|
||||||
|
error("This qmakespec requires $INTEGRITY_BSP to be set")
|
||||||
|
|
||||||
|
os_directory = $$(INTEGRITY_DIR)
|
||||||
|
isEmpty(os_directory): \
|
||||||
|
error("This qmakespec requires $INTEGRITY_DIR to be set")
|
||||||
|
|
||||||
|
qclibs_directory = $$(QCLIBS_DIR)
|
||||||
|
isEmpty(qclibs_directory): \
|
||||||
|
error("This qmakespec requires $QCLIBS_DIR to be set")
|
||||||
|
|
||||||
|
qc_multimedia_inc_directory = $$(QC_MULTIMEDIA_INC_DIR)
|
||||||
|
isEmpty(qc_multimedia_inc_directory): \
|
||||||
|
error("This qmakespec requires $QC_MULTIMEDIA_INC_DIR to be set")
|
||||||
|
|
||||||
|
gl_inc_directory = $$(GL_INC_DIR)
|
||||||
|
isEmpty(gl_inc_directory): \
|
||||||
|
error("This qmakespec requires $GL_INC_DIR to be set")
|
||||||
|
|
||||||
|
gl_lib_directory = $$(GL_LIB_DIR)
|
||||||
|
isEmpty(gl_lib_directory): \
|
||||||
|
error("This qmakespec requires $GL_LIB_DIR to be set")
|
||||||
|
|
||||||
|
QMAKE_LIBDIR += $$(QCLIBS_DIR)/base
|
||||||
|
QMAKE_LIBDIR += $$(QCLIBS_DIR)/multimedia/display
|
||||||
|
|
||||||
|
QMAKE_INCDIR += $$(QC_MULTIMEDIA_INC_DIR)
|
||||||
|
|
||||||
|
QMAKE_LIBS_EGL += -lESXEGL_Adreno -lESXGLESv2_Adreno -ladreno_utils -lGSLUser -lOSUser -lpanel -livfs -lposix -lpmem -ltzbsp -lpaged_alloc -lglnext-llvm -lopenwfd
|
||||||
|
QMAKE_LIBS_OPENGL_ES2 += $${QMAKE_LIBS_EGL}
|
||||||
|
|
||||||
|
QMAKE_CFLAGS += -DINTEGRITY
|
||||||
|
QMAKE_CXXFLAGS += -DINTEGRITY
|
||||||
|
|
||||||
|
QMAKE_CFLAGS += -bigswitch
|
||||||
|
QMAKE_CXXFLAGS += -bigswitch
|
||||||
|
QMAKE_LFLAGS += -bigswitch
|
||||||
|
|
||||||
|
# OpenGL libraries have a dependency on libEGL
|
||||||
|
QMAKE_INCDIR_EGL = $$(GL_INC_DIR)
|
||||||
|
QMAKE_LIBDIR_EGL = $$(GL_LIB_DIR)
|
||||||
|
QMAKE_INCDIR_OPENGL_ES2 = $$(GL_INC_DIR)
|
||||||
|
QMAKE_LIBDIR_OPENGL_ES2 = $$(GL_LIB_DIR)
|
||||||
|
|
||||||
|
load(qt_config)
|
45
mkspecs/devices/integrity-armv8-msm8996au/qplatformdefs.h
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2017 The Qt Company Ltd.
|
||||||
|
** Contact: https://www.qt.io/licensing/
|
||||||
|
**
|
||||||
|
** This file is part of the qmake spec of the Qt Toolkit.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:LGPL$
|
||||||
|
** 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 Lesser General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 3 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 3 requirements
|
||||||
|
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
|
** General Public License version 2.0 or (at your option) the GNU General
|
||||||
|
** Public license version 3 or any later version approved by the KDE Free
|
||||||
|
** Qt Foundation. The licenses are as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
||||||
|
** included in the packaging of this file. Please review the following
|
||||||
|
** information to ensure the GNU General Public License requirements will
|
||||||
|
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
||||||
|
** https://www.gnu.org/licenses/gpl-3.0.html.
|
||||||
|
**
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef QPLATFORMDEFS_H
|
||||||
|
#define QPLATFORMDEFS_H
|
||||||
|
|
||||||
|
#include "../../common/integrity/qplatformdefs.h"
|
||||||
|
|
||||||
|
#endif // QPLATFORMDEFS_H
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
"continue": "void",
|
"continue": "void",
|
||||||
|
|
||||||
"recheck": { "type": "void", "name": "cache_use", "value": "positive" },
|
"recheck": { "type": "optionalString", "name": "cache_recheck" },
|
||||||
"recheck-all": { "type": "void", "name": "cache_use", "value": "none" },
|
"recheck-all": { "type": "void", "name": "cache_use", "value": "none" },
|
||||||
|
|
||||||
"redo": { "type": "redo" },
|
"redo": { "type": "redo" },
|
||||||
|
@ -2,6 +2,9 @@
|
|||||||
# Note that evaluating variable assignments from the command line
|
# Note that evaluating variable assignments from the command line
|
||||||
# still happens in between these two steps.
|
# still happens in between these two steps.
|
||||||
|
|
||||||
|
# In early configure setup; nothing useful to be done here.
|
||||||
|
isEmpty(QMAKE_CXX): return()
|
||||||
|
|
||||||
load(exclusive_builds)
|
load(exclusive_builds)
|
||||||
CONFIG = \
|
CONFIG = \
|
||||||
lex yacc debug exceptions depend_includepath \
|
lex yacc debug exceptions depend_includepath \
|
||||||
|
@ -499,30 +499,37 @@ defineTest(qtConfLibrary_inline) {
|
|||||||
# to make them recognize the same input variables.
|
# to make them recognize the same input variables.
|
||||||
input = $$eval($${2}.alias)
|
input = $$eval($${2}.alias)
|
||||||
|
|
||||||
# direct libs. overwrites inline libs.
|
|
||||||
defined(config.input.$${input}.libs, var) {
|
|
||||||
$${1}.libs = $$eval(config.input.$${input}.libs)
|
|
||||||
export($${1}.libs)
|
|
||||||
}
|
|
||||||
|
|
||||||
# build-specific direct libs. overwrites inline libs.
|
# build-specific direct libs. overwrites inline libs.
|
||||||
vars =
|
vars =
|
||||||
any = false
|
any = false
|
||||||
all = true
|
all = true
|
||||||
for (b, $${1}.builds._KEYS_) {
|
for (b, $$list(debug release)) {
|
||||||
iv = $${input}.libs.$${b}
|
iv = $${input}.libs.$${b}
|
||||||
vars += $$eval(config.commandline.rev_assignments.$${iv})
|
vars += $$eval(config.commandline.rev_assignments.$${iv})
|
||||||
defined(config.input.$${iv}, var) {
|
defined(config.input.$${iv}, var) {
|
||||||
$${1}.builds.$${b}.libs = $$eval(config.input.$${iv})
|
$${1}.builds.$${b} = $$eval(config.input.$${iv})
|
||||||
export($${1}.builds.$${b}.libs)
|
export($${1}.builds.$${b})
|
||||||
|
$${1}.builds._KEYS_ *= $${b}
|
||||||
any = true
|
any = true
|
||||||
} else {
|
} else {
|
||||||
all = false
|
all = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$$any:!$$all {
|
$$any {
|
||||||
qtConfAddError("Either none or all of $$join(vars, ", ", [, ]) must be specified.")
|
!$$all {
|
||||||
return(false)
|
qtConfAddError("Either none or all of $$join(vars, ", ", [, ]) must be specified.")
|
||||||
|
return(false)
|
||||||
|
}
|
||||||
|
export($${1}.builds._KEYS_)
|
||||||
|
# we also reset the generic libs, to avoid surprises.
|
||||||
|
$${1}.libs =
|
||||||
|
export($${1}.libs)
|
||||||
|
}
|
||||||
|
|
||||||
|
# direct libs. overwrites inline libs.
|
||||||
|
defined(config.input.$${input}.libs, var) {
|
||||||
|
$${1}.libs = $$eval(config.input.$${input}.libs)
|
||||||
|
export($${1}.libs)
|
||||||
}
|
}
|
||||||
|
|
||||||
# prefix. prepends to (possibly overwritten) inline libs.
|
# prefix. prepends to (possibly overwritten) inline libs.
|
||||||
@ -670,9 +677,10 @@ defineTest(qtConfExportLibrary) {
|
|||||||
NAME = $$upper($$name)
|
NAME = $$upper($$name)
|
||||||
# LIBS is emitted even if empty, as this allows the library to be "seen".
|
# LIBS is emitted even if empty, as this allows the library to be "seen".
|
||||||
qtConfOutputVar(assign, $$output, QMAKE_LIBS_$$NAME, $$libs)
|
qtConfOutputVar(assign, $$output, QMAKE_LIBS_$$NAME, $$libs)
|
||||||
for (b, $${spfx}.builds._KEYS_): \
|
for (b, $${spfx}.builds._KEYS_) {
|
||||||
qtConfOutputVar(assign, $$output, QMAKE_LIBS_$${NAME}_$$upper($$b), \
|
eval(blibs = $$eval($${spfx}.builds.$${b}))
|
||||||
$$eval($${spfx}.builds.$${b}))
|
qtConfOutputVar(assign, $$output, QMAKE_LIBS_$${NAME}_$$upper($$b), $$blibs)
|
||||||
|
}
|
||||||
!isEmpty(defines): qtConfOutputVar(assign, $$output, QMAKE_DEFINES_$$NAME, $$defines)
|
!isEmpty(defines): qtConfOutputVar(assign, $$output, QMAKE_DEFINES_$$NAME, $$defines)
|
||||||
!isEmpty(includes): qtConfOutputVar(assign, $$output, QMAKE_INCDIR_$$NAME, $$includes)
|
!isEmpty(includes): qtConfOutputVar(assign, $$output, QMAKE_INCDIR_$$NAME, $$includes)
|
||||||
!isEmpty($${currentConfig}.module): \
|
!isEmpty($${currentConfig}.module): \
|
||||||
@ -1044,8 +1052,13 @@ defineTest(qtConfSaveResult) {
|
|||||||
return()
|
return()
|
||||||
keys = result $$eval($${1}.cache)
|
keys = result $$eval($${1}.cache)
|
||||||
cont = "cache.$${2}._KEYS_ = $$keys"
|
cont = "cache.$${2}._KEYS_ = $$keys"
|
||||||
for (k, keys): \
|
cache.$${2}._KEYS_ = $$keys
|
||||||
|
export(cache.$${2}._KEYS_)
|
||||||
|
for (k, keys) {
|
||||||
cont += "cache.$${2}.$${k} = $$val_escape($${1}.$${k})"
|
cont += "cache.$${2}.$${k} = $$val_escape($${1}.$${k})"
|
||||||
|
cache.$${2}.$${k} = $$eval($${1}.$${k})
|
||||||
|
export(cache.$${2}.$${k})
|
||||||
|
}
|
||||||
write_file($$QMAKE_CONFIG_CACHE, cont, append)|error()
|
write_file($$QMAKE_CONFIG_CACHE, cont, append)|error()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2033,14 +2046,28 @@ qtConfCheckErrors()
|
|||||||
|
|
||||||
QMAKE_CONFIG_CACHE = $$OUT_PWD/config.cache
|
QMAKE_CONFIG_CACHE = $$OUT_PWD/config.cache
|
||||||
QMAKE_CONFIG_CACHE_USE = $$eval(config.input.cache_use)
|
QMAKE_CONFIG_CACHE_USE = $$eval(config.input.cache_use)
|
||||||
|
cache_recheck = $$eval(config.input.cache_recheck)
|
||||||
|
equals(cache_recheck, yes) {
|
||||||
|
QMAKE_CONFIG_CACHE_USE = positive
|
||||||
|
cache_recheck =
|
||||||
|
}
|
||||||
isEmpty(QMAKE_CONFIG_CACHE_USE): \
|
isEmpty(QMAKE_CONFIG_CACHE_USE): \
|
||||||
QMAKE_CONFIG_CACHE_USE = all
|
QMAKE_CONFIG_CACHE_USE = all
|
||||||
!equals(QMAKE_CONFIG_CACHE_USE, none) {
|
!equals(QMAKE_CONFIG_CACHE_USE, none) {
|
||||||
include($$QMAKE_CONFIG_CACHE, , true)
|
include($$QMAKE_CONFIG_CACHE, , true)
|
||||||
# this crudely determines when to discard the cache. this also catches the case
|
# this crudely determines when to discard the cache. this also catches the case
|
||||||
# of no cache being there in the first place.
|
# of no cache being there in the first place.
|
||||||
!equals(cache.platform, $$[QMAKE_SPEC])|!equals(cache.xplatform, $$[QMAKE_XSPEC]): \
|
!equals(cache.platform, $$[QMAKE_SPEC])|!equals(cache.xplatform, $$[QMAKE_XSPEC]) {
|
||||||
QMAKE_CONFIG_CACHE_USE = none
|
QMAKE_CONFIG_CACHE_USE = none
|
||||||
|
} else: !isEmpty(cache_recheck) {
|
||||||
|
for (cr, $$list($$split(cache_recheck, ","))) {
|
||||||
|
!isEmpty(cache.$${cr}._KEYS_) {
|
||||||
|
cache.$${cr}._KEYS_ =
|
||||||
|
} else {
|
||||||
|
qtConfAddWarning("Attempting to discard non-cached result '$$cr'.")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
equals(QMAKE_CONFIG_CACHE_USE, none) {
|
equals(QMAKE_CONFIG_CACHE_USE, none) {
|
||||||
cont = \
|
cont = \
|
||||||
|
@ -135,18 +135,12 @@ lib_bundle {
|
|||||||
!build_all| \
|
!build_all| \
|
||||||
if(if(!debug_and_release|CONFIG(release, debug|release))) {
|
if(if(!debug_and_release|CONFIG(release, debug|release))) {
|
||||||
FRAMEWORK_HEADERS.version = Versions
|
FRAMEWORK_HEADERS.version = Versions
|
||||||
FRAMEWORK_HEADERS.files = $$SYNCQT.HEADER_FILES $$SYNCQT.HEADER_CLASSES
|
FRAMEWORK_HEADERS.files = \
|
||||||
# Non-existing paths (yet, they will be generated) are used verbatim.
|
$$SYNCQT.HEADER_FILES $$SYNCQT.HEADER_CLASSES $$SYNCQT.INJECTED_HEADER_FILES
|
||||||
for (injected_header, SYNCQT.INJECTED_HEADER_FILES): \
|
|
||||||
FRAMEWORK_HEADERS.files += \
|
|
||||||
$$relative_path($$absolute_path($$injected_header, $$_PRO_FILE_PWD_), $$OUT_PWD)
|
|
||||||
|
|
||||||
FRAMEWORK_HEADERS.path = Headers
|
FRAMEWORK_HEADERS.path = Headers
|
||||||
FRAMEWORK_PRIVATE_HEADERS.version = Versions
|
FRAMEWORK_PRIVATE_HEADERS.version = Versions
|
||||||
FRAMEWORK_PRIVATE_HEADERS.files = $$SYNCQT.PRIVATE_HEADER_FILES
|
FRAMEWORK_PRIVATE_HEADERS.files = \
|
||||||
for (injected_header, SYNCQT.INJECTED_PRIVATE_HEADER_FILES): \
|
$$SYNCQT.PRIVATE_HEADER_FILES $$SYNCQT.INJECTED_PRIVATE_HEADER_FILES
|
||||||
FRAMEWORK_PRIVATE_HEADERS.files += \
|
|
||||||
$$relative_path($$absolute_path($$injected_header, $$_PRO_FILE_PWD_), $$OUT_PWD)
|
|
||||||
FRAMEWORK_PRIVATE_HEADERS.path = Headers/$$VERSION/$$MODULE_INCNAME/private
|
FRAMEWORK_PRIVATE_HEADERS.path = Headers/$$VERSION/$$MODULE_INCNAME/private
|
||||||
FRAMEWORK_QPA_HEADERS.version = Versions
|
FRAMEWORK_QPA_HEADERS.version = Versions
|
||||||
FRAMEWORK_QPA_HEADERS.files = $$SYNCQT.QPA_HEADER_FILES
|
FRAMEWORK_QPA_HEADERS.files = $$SYNCQT.QPA_HEADER_FILES
|
||||||
|
@ -48,7 +48,7 @@ CONFIG(static, static|shared)|prefix_build {
|
|||||||
|
|
||||||
!build_pass {
|
!build_pass {
|
||||||
qt_plugin_deps = $$QT $$QT_PRIVATE
|
qt_plugin_deps = $$QT $$QT_PRIVATE
|
||||||
qt_plugin_deps = s,-private$,_private,g
|
qt_plugin_deps ~= s,-private$,_private,g
|
||||||
|
|
||||||
MODULE_PRI_CONT = \
|
MODULE_PRI_CONT = \
|
||||||
"QT_PLUGIN.$${MODULE}.TYPE = $$PLUGIN_TYPE" \
|
"QT_PLUGIN.$${MODULE}.TYPE = $$PLUGIN_TYPE" \
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
|
|
||||||
# In early configure setup; nothing useful to be done here.
|
|
||||||
isEmpty(QMAKE_CXX): return()
|
|
||||||
|
|
||||||
defineReplace(qtMakeExpand) {
|
defineReplace(qtMakeExpand) {
|
||||||
out = "$$1"
|
out = "$$1"
|
||||||
for(ever) {
|
for(ever) {
|
||||||
@ -19,7 +16,13 @@ defineTest(qtCompilerErrror) {
|
|||||||
what = " host"
|
what = " host"
|
||||||
else: \
|
else: \
|
||||||
what = " target"
|
what = " target"
|
||||||
error("Cannot run$$what compiler '$$1'. Maybe you forgot to setup the environment?")
|
msg = \
|
||||||
|
"Cannot run$$what compiler '$$1'. Output:" \
|
||||||
|
"===================" \
|
||||||
|
$$2 \
|
||||||
|
"===================" \
|
||||||
|
"Maybe you forgot to setup the environment?"
|
||||||
|
error($$join(msg, $$escape_expand(\\n)))
|
||||||
}
|
}
|
||||||
|
|
||||||
cross_compile:host_build: \
|
cross_compile:host_build: \
|
||||||
@ -64,7 +67,7 @@ isEmpty($${target_prefix}.INCDIRS) {
|
|||||||
cxx_flags += -E -v
|
cxx_flags += -E -v
|
||||||
|
|
||||||
output = $$system("$$cmd_prefix $$QMAKE_CXX $$qtMakeExpand($$cxx_flags) -xc++ - 2>&1 $$cmd_suffix", lines, ec)
|
output = $$system("$$cmd_prefix $$QMAKE_CXX $$qtMakeExpand($$cxx_flags) -xc++ - 2>&1 $$cmd_suffix", lines, ec)
|
||||||
!equals(ec, 0): qtCompilerErrror($$QMAKE_CXX)
|
!equals(ec, 0): qtCompilerErrror($$QMAKE_CXX, $$output)
|
||||||
|
|
||||||
rim_qcc {
|
rim_qcc {
|
||||||
for (line, output) {
|
for (line, output) {
|
||||||
@ -124,7 +127,7 @@ isEmpty($${target_prefix}.INCDIRS) {
|
|||||||
# What's more, -print-search-dirs can't be used on clang on Apple because it
|
# What's more, -print-search-dirs can't be used on clang on Apple because it
|
||||||
# won't print all the library paths (only the clang-internal ones).
|
# won't print all the library paths (only the clang-internal ones).
|
||||||
output = $$system("$$cmd_prefix $$QMAKE_CXX -print-search-dirs", lines, ec)
|
output = $$system("$$cmd_prefix $$QMAKE_CXX -print-search-dirs", lines, ec)
|
||||||
!equals(ec, 0): qtCompilerErrror($$QMAKE_CXX)
|
!equals(ec, 0): qtCompilerErrror($$QMAKE_CXX, $$output)
|
||||||
|
|
||||||
for (line, output) {
|
for (line, output) {
|
||||||
contains(line, "^libraries: .*") {
|
contains(line, "^libraries: .*") {
|
||||||
@ -166,14 +169,14 @@ isEmpty($${target_prefix}.INCDIRS) {
|
|||||||
|
|
||||||
defineReplace(qtVariablesFromMSVC) {
|
defineReplace(qtVariablesFromMSVC) {
|
||||||
ret = $$system("$$1 -nologo -E $$2 $$system_quote($$PWD/data/macros.cpp) <NUL 2>NUL", lines, ec)
|
ret = $$system("$$1 -nologo -E $$2 $$system_quote($$PWD/data/macros.cpp) <NUL 2>NUL", lines, ec)
|
||||||
!equals(ec, 0): qtCompilerErrror($$1)
|
!equals(ec, 0): qtCompilerErrror($$1, $$ret)
|
||||||
return($$ret)
|
return($$ret)
|
||||||
}
|
}
|
||||||
|
|
||||||
defineReplace(qtVariablesFromGCC) {
|
defineReplace(qtVariablesFromGCC) {
|
||||||
ret = $$system("$$1 -E $$system_quote($$PWD/data/macros.cpp) \
|
ret = $$system("$$1 -E $$system_quote($$PWD/data/macros.cpp) \
|
||||||
<$$QMAKE_SYSTEM_NULL_DEVICE 2>$$QMAKE_SYSTEM_NULL_DEVICE", lines, ec)
|
<$$QMAKE_SYSTEM_NULL_DEVICE 2>$$QMAKE_SYSTEM_NULL_DEVICE", lines, ec)
|
||||||
!equals(ec, 0): qtCompilerErrror($$1)
|
!equals(ec, 0): qtCompilerErrror($$1, $$ret)
|
||||||
return($$ret)
|
return($$ret)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ DESTINATION_MESSAGE = "Running $(call tolower,$(CONFIGURATION)) $(ACTION) \
|
|||||||
|
|
||||||
xcodebuild-%:
|
xcodebuild-%:
|
||||||
@$(if $(DESTINATION_NAME), echo $(DESTINATION_MESSAGE),)
|
@$(if $(DESTINATION_NAME), echo $(DESTINATION_MESSAGE),)
|
||||||
xcodebuild $(ACTION) $(XCODEBUILD_FLAGS) -project $(TARGET).xcodeproj -scheme $(TARGET) $(if $(SDK), -sdk $(SDK),) $(if $(CONFIGURATION), -configuration $(CONFIGURATION),) $(if $(DESTINATION), -destination $(DESTINATION) -destination-timeout 1,) $(if $(INSTALL_ROOT), DSTROOT=$(INSTALL_ROOT),)
|
xcodebuild $(ACTION) $(XCODEBUILD_FLAGS) -project $(TARGET).xcodeproj -scheme $(TARGET) $(if $(SDK), -sdk $(SDK),) $(if $(CONFIGURATION), -configuration $(CONFIGURATION),) $(if $(DESTINATION), -destination $(DESTINATION) -destination-timeout 1,) $(if $(DESTINATION_ID),, ENABLE_ONLY_ACTIVE_RESOURCES=NO) $(if $(INSTALL_ROOT), DSTROOT=$(INSTALL_ROOT),)
|
||||||
|
|
||||||
xcodebuild-check-device_%: DESTINATION_ID=$(lastword $(subst _, ,$@))
|
xcodebuild-check-device_%: DESTINATION_ID=$(lastword $(subst _, ,$@))
|
||||||
|
|
||||||
|
33
mkspecs/integrity-armv8-rcar/qmake.conf
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#
|
||||||
|
# qmake configuration for INTEGRITY armv7 targets
|
||||||
|
#
|
||||||
|
|
||||||
|
# armv7 common includes work for armv8-A as well
|
||||||
|
include(../common/ghs-integrity-armv7.conf)
|
||||||
|
|
||||||
|
DEFINES += INTEGRITY
|
||||||
|
|
||||||
|
# This define is used because the RCar INTEGRITY EGL library expects same
|
||||||
|
# parameter types as Symbian. The parameter types are defined in eglplatform.h.
|
||||||
|
DEFINES += __WINSCW__
|
||||||
|
|
||||||
|
QTPLUGIN.platforms += qeglfs
|
||||||
|
QT_QPA_DEFAULT_PLATFORM = eglfs
|
||||||
|
|
||||||
|
QMAKE_LIBS_EGL += -lEGL -lIMGegl -lsrv_um -lsrv_init -lpvrWSEGL_WM -lncg_usr.a -lmmgr_usr -lwm_usr -lprr_usr
|
||||||
|
QMAKE_LIBS_OPENGL_ES2 += -lGLESv2 -lIMGegl -lglslcompiler -lusc -lsrv_um -lsrv_init -lpvrWSEGL_WM -lncg_usr.a -lmmgr_usr -lwm_usr -lprr_usr
|
||||||
|
QMAKE_LIBS_GUI = -lmmgr_usr -lwm_usr -lprr_usr
|
||||||
|
|
||||||
|
QMAKE_CFLAGS += -bigswitch
|
||||||
|
QMAKE_CXXFLAGS += -bigswitch
|
||||||
|
QMAKE_LFLAGS += -bigswitch
|
||||||
|
|
||||||
|
EGLFS_DEVICE_INTEGRATION = eglfs_rcar
|
||||||
|
|
||||||
|
# OpenGL libraries have a dependency on libEGL
|
||||||
|
dirs = $$(GL_INC_DIR)
|
||||||
|
QMAKE_INCDIR_EGL = $$split(dirs, $$QMAKE_DIRLIST_SEP)
|
||||||
|
QMAKE_INCDIR_OPENGL_ES2 = $$QMAKE_INCDIR_EGL
|
||||||
|
dirs = $$(GL_LIB_DIR)
|
||||||
|
QMAKE_LIBDIR_EGL = $$split(dirs, $$QMAKE_DIRLIST_SEP)
|
||||||
|
QMAKE_LIBDIR_OPENGL_ES2 = $$QMAKE_LIBDIR_EGL
|
39
mkspecs/integrity-armv8-rcar/qplatformdefs.h
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2015 Green Hills Software. All rights reserved.
|
||||||
|
** Contact: http://www.qt.io/licensing/
|
||||||
|
**
|
||||||
|
** This file is part of the qmake spec of the Qt Toolkit.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:LGPL21$
|
||||||
|
** 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 http://www.qt.io/terms-conditions. For further
|
||||||
|
** information use the contact form at http://www.qt.io/contact-us.
|
||||||
|
**
|
||||||
|
** GNU Lesser General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||||
|
** General Public License version 2.1 or version 3 as published by the Free
|
||||||
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||||
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||||
|
** following information to ensure the GNU Lesser General Public License
|
||||||
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||||
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||||
|
**
|
||||||
|
** As a special exception, The Qt Company gives you certain additional
|
||||||
|
** rights. These rights are described in The Qt Company LGPL Exception
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef QPLATFORMDEFS_H
|
||||||
|
#define QPLATFORMDEFS_H
|
||||||
|
|
||||||
|
#include "../common/integrity/qplatformdefs.h"
|
||||||
|
|
||||||
|
#endif // QPLATFORMDEFS_H
|
@ -1,25 +1,24 @@
|
|||||||
#
|
#
|
||||||
# qmake configuration for win32-g++
|
# qmake configuration for win32-g++
|
||||||
#
|
#
|
||||||
# Written for MinGW / gcc 4.6 or higher
|
# Written for MinGW-w64 / gcc 5.3 or higher
|
||||||
#
|
#
|
||||||
# Cross compile example for i686-w64-mingw32-g++:
|
# Cross compile example for i686-w64-mingw32-g++:
|
||||||
# configure -xplatform win32-g++ -device-option CROSS_COMPILE=i686-w64-mingw32-
|
# configure -xplatform win32-g++ -device-option CROSS_COMPILE=i686-w64-mingw32-
|
||||||
#
|
#
|
||||||
|
|
||||||
load(device_config)
|
load(device_config)
|
||||||
|
include(../common/gcc-base.conf)
|
||||||
include(../common/g++-base.conf)
|
include(../common/g++-base.conf)
|
||||||
|
|
||||||
|
# modifications to gcc-base.conf and g++-base.conf
|
||||||
|
|
||||||
MAKEFILE_GENERATOR = MINGW
|
MAKEFILE_GENERATOR = MINGW
|
||||||
QMAKE_PLATFORM = win32 mingw
|
QMAKE_PLATFORM = win32 mingw
|
||||||
CONFIG += debug_and_release debug_and_release_target precompile_header
|
CONFIG += debug_and_release debug_and_release_target precompile_header
|
||||||
DEFINES += UNICODE _UNICODE
|
DEFINES += UNICODE _UNICODE
|
||||||
QMAKE_COMPILER_DEFINES += __GNUC__ WIN32
|
QMAKE_COMPILER_DEFINES += __GNUC__ WIN32
|
||||||
|
|
||||||
QMAKE_EXT_OBJ = .o
|
|
||||||
QMAKE_EXT_RES = _res.o
|
|
||||||
|
|
||||||
|
|
||||||
QMAKE_CC = $${CROSS_COMPILE}gcc
|
QMAKE_CC = $${CROSS_COMPILE}gcc
|
||||||
QMAKE_LEX = flex
|
QMAKE_LEX = flex
|
||||||
QMAKE_LEXFLAGS =
|
QMAKE_LEXFLAGS =
|
||||||
@ -27,12 +26,12 @@ QMAKE_YACC = bison -y
|
|||||||
QMAKE_YACCFLAGS = -d
|
QMAKE_YACCFLAGS = -d
|
||||||
QMAKE_CFLAGS += -fno-keep-inline-dllexport
|
QMAKE_CFLAGS += -fno-keep-inline-dllexport
|
||||||
QMAKE_CFLAGS_WARN_ON += -Wextra
|
QMAKE_CFLAGS_WARN_ON += -Wextra
|
||||||
|
|
||||||
QMAKE_CFLAGS_SSE2 += -mstackrealign
|
QMAKE_CFLAGS_SSE2 += -mstackrealign
|
||||||
QMAKE_CFLAGS_AESNI = -maes
|
QMAKE_CFLAGS_AESNI = -maes
|
||||||
QMAKE_CFLAGS_SHANI = -msha
|
QMAKE_CFLAGS_SHANI = -msha
|
||||||
|
|
||||||
QMAKE_CXX = $${CROSS_COMPILE}g++
|
QMAKE_CXX = $${CROSS_COMPILE}g++
|
||||||
QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD
|
|
||||||
QMAKE_CXXFLAGS_RTTI_ON = -frtti
|
QMAKE_CXXFLAGS_RTTI_ON = -frtti
|
||||||
QMAKE_CXXFLAGS_RTTI_OFF = -fno-rtti
|
QMAKE_CXXFLAGS_RTTI_OFF = -fno-rtti
|
||||||
QMAKE_CXXFLAGS_EXCEPTIONS_ON = -fexceptions -mthreads
|
QMAKE_CXXFLAGS_EXCEPTIONS_ON = -fexceptions -mthreads
|
||||||
@ -56,6 +55,8 @@ equals(QMAKE_HOST.os, Windows) {
|
|||||||
QMAKE_LINK_OBJECT_MAX = 10
|
QMAKE_LINK_OBJECT_MAX = 10
|
||||||
QMAKE_LINK_OBJECT_SCRIPT = object_script
|
QMAKE_LINK_OBJECT_SCRIPT = object_script
|
||||||
}
|
}
|
||||||
|
QMAKE_EXT_OBJ = .o
|
||||||
|
QMAKE_EXT_RES = _res.o
|
||||||
QMAKE_PREFIX_SHLIB =
|
QMAKE_PREFIX_SHLIB =
|
||||||
QMAKE_EXTENSION_SHLIB = dll
|
QMAKE_EXTENSION_SHLIB = dll
|
||||||
QMAKE_PREFIX_STATICLIB = lib
|
QMAKE_PREFIX_STATICLIB = lib
|
||||||
|
@ -1,24 +1,26 @@
|
|||||||
#
|
#
|
||||||
# qmake configuration for win32-icc
|
# qmake configuration for win32-icc
|
||||||
#
|
#
|
||||||
# Written for Intel C++
|
# Written for Intel C++ Compiler on Windows / icl 16.0 or higher
|
||||||
#
|
#
|
||||||
|
|
||||||
# Use the Visual Studio configuration
|
# Use the Microsoft (R) C/C++ Optimizing Compiler configuration,
|
||||||
|
# since ICC on Windows pretends to be MSVC
|
||||||
|
|
||||||
include(../common/msvc-desktop.conf)
|
include(../common/msvc-desktop.conf)
|
||||||
|
|
||||||
# Now override with the Intel compiler settings
|
# modifications to msvc-desktop.conf
|
||||||
|
|
||||||
QMAKE_COMPILER += intel_icl # icl pretends to be msvc
|
QMAKE_COMPILER += intel_icl
|
||||||
|
|
||||||
QMAKE_CC = icl
|
QMAKE_CC = icl
|
||||||
QMAKE_CFLAGS = -nologo -Zm200 /Qprec /Qwd1744,1738,809,3373
|
QMAKE_CFLAGS = -nologo -Zm200 /Qprec /Qwd1744,1738,809,3373
|
||||||
QMAKE_CFLAGS_WARN_ON = -W3 /Qwd673
|
QMAKE_CFLAGS_WARN_ON = -W3 /Qwd673
|
||||||
QMAKE_CFLAGS_WARN_OFF = -W0 /Qwd673
|
QMAKE_CFLAGS_WARN_OFF = -W0 /Qwd673
|
||||||
QMAKE_CFLAGS_DEBUG = -Zi -MDd -Od
|
QMAKE_CFLAGS_DEBUG = -Od -Zi -MDd
|
||||||
QMAKE_CFLAGS_LTCG = -Qipo
|
QMAKE_CFLAGS_LTCG = -Qipo
|
||||||
QMAKE_CFLAGS_DISABLE_LTCG = -Qno-ipo
|
QMAKE_CFLAGS_DISABLE_LTCG = -Qno-ipo
|
||||||
|
|
||||||
QMAKE_CFLAGS_SSE2 = -QxSSE2
|
QMAKE_CFLAGS_SSE2 = -QxSSE2
|
||||||
QMAKE_CFLAGS_SSE3 = -QxSSE3
|
QMAKE_CFLAGS_SSE3 = -QxSSE3
|
||||||
QMAKE_CFLAGS_SSSE3 = -QxSSSE3
|
QMAKE_CFLAGS_SSSE3 = -QxSSSE3
|
||||||
@ -49,16 +51,10 @@ QMAKE_CXXFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG
|
|||||||
QMAKE_CXXFLAGS_DISABLE_LTCG = $$QMAKE_CFLAGS_DISABLE_LTCG
|
QMAKE_CXXFLAGS_DISABLE_LTCG = $$QMAKE_CFLAGS_DISABLE_LTCG
|
||||||
|
|
||||||
QMAKE_LINK = xilink
|
QMAKE_LINK = xilink
|
||||||
QMAKE_LFLAGS = /NOLOGO
|
|
||||||
QMAKE_LFLAGS_RELEASE =
|
|
||||||
QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO =
|
|
||||||
QMAKE_LFLAGS_DEBUG = /DEBUG
|
|
||||||
QMAKE_LFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG
|
QMAKE_LFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG
|
||||||
|
|
||||||
QMAKE_LIB = xilib /NOLOGO
|
QMAKE_LIB = xilib /NOLOGO
|
||||||
|
|
||||||
DSP_EXTENSION = .dsp
|
|
||||||
|
|
||||||
include(../common/angle.conf)
|
include(../common/angle.conf)
|
||||||
include(../common/windows-vulkan.conf)
|
include(../common/windows-vulkan.conf)
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# qmake configuration for win32-msvc
|
# qmake configuration for win32-msvc
|
||||||
#
|
#
|
||||||
# Written for Microsoft Visual C++ (all desktop versions)
|
# Written for Microsoft C/C++ Optimizing Compiler (all desktop versions)
|
||||||
#
|
#
|
||||||
|
|
||||||
include(../common/msvc-desktop.conf)
|
include(../common/msvc-desktop.conf)
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
# sh-compatible shell. This is not a problem, because configure.bat
|
# sh-compatible shell. This is not a problem, because configure.bat
|
||||||
# will not do that.
|
# will not do that.
|
||||||
ifeq ($(SHELL), sh.exe)
|
ifeq ($(SHELL), sh.exe)
|
||||||
ifeq ($(wildcard $(CURDIR)/sh.exe), )
|
ifeq ($(wildcard ./sh.exe), )
|
||||||
SH = 0
|
SH = 0
|
||||||
else
|
else
|
||||||
SH = 1
|
SH = 1
|
||||||
|
@ -280,8 +280,6 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t)
|
|||||||
|
|
||||||
QMap<QString, QString> settings;
|
QMap<QString, QString> settings;
|
||||||
settings.insert("COPY_PHASE_STRIP", (as_release ? "YES" : "NO"));
|
settings.insert("COPY_PHASE_STRIP", (as_release ? "YES" : "NO"));
|
||||||
if(as_release)
|
|
||||||
settings.insert("GCC_GENERATE_DEBUGGING_SYMBOLS", "NO");
|
|
||||||
if(project->isActiveConfig("sdk") && !project->isEmpty("QMAKE_MAC_SDK"))
|
if(project->isActiveConfig("sdk") && !project->isEmpty("QMAKE_MAC_SDK"))
|
||||||
settings.insert("SDKROOT", project->first("QMAKE_MAC_SDK").toQString());
|
settings.insert("SDKROOT", project->first("QMAKE_MAC_SDK").toQString());
|
||||||
{
|
{
|
||||||
@ -1499,7 +1497,6 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
|
|||||||
settings.insert("APPLICATION_EXTENSION_API_ONLY", project->isActiveConfig("app_extension_api_only") ? "YES" : "NO");
|
settings.insert("APPLICATION_EXTENSION_API_ONLY", project->isActiveConfig("app_extension_api_only") ? "YES" : "NO");
|
||||||
// required for tvOS (and watchos), optional on iOS (deployment target >= iOS 6.0)
|
// required for tvOS (and watchos), optional on iOS (deployment target >= iOS 6.0)
|
||||||
settings.insert("ENABLE_BITCODE", project->isActiveConfig("bitcode") ? "YES" : "NO");
|
settings.insert("ENABLE_BITCODE", project->isActiveConfig("bitcode") ? "YES" : "NO");
|
||||||
settings.insert("GCC_GENERATE_DEBUGGING_SYMBOLS", as_release ? "NO" : "YES");
|
|
||||||
if(!as_release)
|
if(!as_release)
|
||||||
settings.insert("GCC_OPTIMIZATION_LEVEL", "0");
|
settings.insert("GCC_OPTIMIZATION_LEVEL", "0");
|
||||||
if(project->isActiveConfig("sdk") && !project->isEmpty("QMAKE_MAC_SDK"))
|
if(project->isActiveConfig("sdk") && !project->isEmpty("QMAKE_MAC_SDK"))
|
||||||
|
@ -2164,9 +2164,9 @@ MakefileGenerator::writeExtraVariables(QTextStream &t)
|
|||||||
ProStringList outlist;
|
ProStringList outlist;
|
||||||
const ProValueMap &vars = project->variables();
|
const ProValueMap &vars = project->variables();
|
||||||
const ProStringList &exports = project->values("QMAKE_EXTRA_VARIABLES");
|
const ProStringList &exports = project->values("QMAKE_EXTRA_VARIABLES");
|
||||||
for (ProValueMap::ConstIterator it = vars.begin(); it != vars.end(); ++it) {
|
for (ProStringList::ConstIterator exp_it = exports.begin(); exp_it != exports.end(); ++exp_it) {
|
||||||
for (ProStringList::ConstIterator exp_it = exports.begin(); exp_it != exports.end(); ++exp_it) {
|
QRegExp rx((*exp_it).toQString(), Qt::CaseInsensitive, QRegExp::Wildcard);
|
||||||
QRegExp rx((*exp_it).toQString(), Qt::CaseInsensitive, QRegExp::Wildcard);
|
for (ProValueMap::ConstIterator it = vars.begin(); it != vars.end(); ++it) {
|
||||||
if (rx.exactMatch(it.key().toQString()))
|
if (rx.exactMatch(it.key().toQString()))
|
||||||
outlist << ("EXPORT_" + it.key() + " = " + it.value().join(' '));
|
outlist << ("EXPORT_" + it.key() + " = " + it.value().join(' '));
|
||||||
}
|
}
|
||||||
|
@ -2645,7 +2645,7 @@ bool Renderer11::getShareHandleSupport() const
|
|||||||
|
|
||||||
if (deviceType == d3d11::ANGLE_D3D11_DEVICE_TYPE_WARP)
|
if (deviceType == d3d11::ANGLE_D3D11_DEVICE_TYPE_WARP)
|
||||||
{
|
{
|
||||||
#if !defined(ANGLE_ENABLE_WINDOWS_STORE) && !defined(__GNUC__)
|
#ifndef ANGLE_ENABLE_WINDOWS_STORE
|
||||||
if (!IsWindows8OrGreater())
|
if (!IsWindows8OrGreater())
|
||||||
{
|
{
|
||||||
// WARP on Windows 7 doesn't support shared handles
|
// WARP on Windows 7 doesn't support shared handles
|
||||||
|
@ -707,15 +707,15 @@ EGLint SwapChain11::copyOffscreenToBackbuffer(EGLint x, EGLint y, EGLint width,
|
|||||||
d3d11::PositionTexCoordVertex *vertices = static_cast<d3d11::PositionTexCoordVertex*>(mappedResource.pData);
|
d3d11::PositionTexCoordVertex *vertices = static_cast<d3d11::PositionTexCoordVertex*>(mappedResource.pData);
|
||||||
|
|
||||||
// Create a quad in homogeneous coordinates
|
// Create a quad in homogeneous coordinates
|
||||||
float x1 = (x / float(mWidth)) * 2.0f - 1.0f;
|
float x1 = (x / float(width)) * 2.0f - 1.0f;
|
||||||
float y1 = (y / float(mHeight)) * 2.0f - 1.0f;
|
float y1 = (y / float(height)) * 2.0f - 1.0f;
|
||||||
float x2 = ((x + width) / float(mWidth)) * 2.0f - 1.0f;
|
float x2 = ((x + width) / float(width)) * 2.0f - 1.0f;
|
||||||
float y2 = ((y + height) / float(mHeight)) * 2.0f - 1.0f;
|
float y2 = ((y + height) / float(height)) * 2.0f - 1.0f;
|
||||||
|
|
||||||
float u1 = x / float(mWidth);
|
float u1 = x / float(width);
|
||||||
float v1 = y / float(mHeight);
|
float v1 = y / float(height);
|
||||||
float u2 = (x + width) / float(mWidth);
|
float u2 = (x + width) / float(width);
|
||||||
float v2 = (y + height) / float(mHeight);
|
float v2 = (y + height) / float(height);
|
||||||
|
|
||||||
// Invert the quad vertices depending on the surface orientation.
|
// Invert the quad vertices depending on the surface orientation.
|
||||||
if ((mOrientation & EGL_SURFACE_ORIENTATION_INVERT_X_ANGLE) != 0)
|
if ((mOrientation & EGL_SURFACE_ORIENTATION_INVERT_X_ANGLE) != 0)
|
||||||
@ -760,8 +760,8 @@ EGLint SwapChain11::copyOffscreenToBackbuffer(EGLint x, EGLint y, EGLint width,
|
|||||||
D3D11_VIEWPORT viewport;
|
D3D11_VIEWPORT viewport;
|
||||||
viewport.TopLeftX = 0;
|
viewport.TopLeftX = 0;
|
||||||
viewport.TopLeftY = 0;
|
viewport.TopLeftY = 0;
|
||||||
viewport.Width = static_cast<FLOAT>(mWidth);
|
viewport.Width = static_cast<FLOAT>(width);
|
||||||
viewport.Height = static_cast<FLOAT>(mHeight);
|
viewport.Height = static_cast<FLOAT>(height);
|
||||||
viewport.MinDepth = 0.0f;
|
viewport.MinDepth = 0.0f;
|
||||||
viewport.MaxDepth = 1.0f;
|
viewport.MaxDepth = 1.0f;
|
||||||
deviceContext->RSSetViewports(1, &viewport);
|
deviceContext->RSSetViewports(1, &viewport);
|
||||||
|
8
src/3rdparty/freetype/qt_attribution.json
vendored
@ -9,7 +9,7 @@
|
|||||||
"Homepage": "http://www.freetype.org",
|
"Homepage": "http://www.freetype.org",
|
||||||
"License": "Freetype Project License or GNU General Public License v2.0 only",
|
"License": "Freetype Project License or GNU General Public License v2.0 only",
|
||||||
"LicenseId": "FTL OR GPL-2.0",
|
"LicenseId": "FTL OR GPL-2.0",
|
||||||
"LicenseFile": "LICENSE.TXT",
|
"LicenseFile": "LICENSE.txt",
|
||||||
"Copyright": "Copyright 2006-2015 by David Turner, Robert Wilhelm, and Werner Lemberg."
|
"Copyright": "Copyright 2006-2015 by David Turner, Robert Wilhelm, and Werner Lemberg."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -22,7 +22,7 @@
|
|||||||
"Homepage": "http://www.freetype.org",
|
"Homepage": "http://www.freetype.org",
|
||||||
"License": "zlib License",
|
"License": "zlib License",
|
||||||
"LicenseId": "Zlib",
|
"LicenseId": "Zlib",
|
||||||
"LicenseFile": "ZLIB-LICENSE.TXT",
|
"LicenseFile": "ZLIB-LICENSE.txt",
|
||||||
"Copyright": "Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler"
|
"Copyright": "Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -35,7 +35,7 @@
|
|||||||
"Homepage": "http://www.freetype.org",
|
"Homepage": "http://www.freetype.org",
|
||||||
"License": "MIT License",
|
"License": "MIT License",
|
||||||
"LicenseId": "MIT",
|
"LicenseId": "MIT",
|
||||||
"LicenseFile": "BDF-LICENSE.TXT",
|
"LicenseFile": "BDF-LICENSE.txt",
|
||||||
"Copyright": "Copyright (C) 2001-2002 by Francesco Zappa Nardelli
|
"Copyright": "Copyright (C) 2001-2002 by Francesco Zappa Nardelli
|
||||||
Copyright 2000 Computing Research Labs, New Mexico State University
|
Copyright 2000 Computing Research Labs, New Mexico State University
|
||||||
Copyright 2001-2002, 2011 Francesco Zappa Nardelli"
|
Copyright 2001-2002, 2011 Francesco Zappa Nardelli"
|
||||||
@ -50,7 +50,7 @@ Copyright 2001-2002, 2011 Francesco Zappa Nardelli"
|
|||||||
"Homepage": "http://www.freetype.org",
|
"Homepage": "http://www.freetype.org",
|
||||||
"License": "MIT License",
|
"License": "MIT License",
|
||||||
"LicenseId": "MIT",
|
"LicenseId": "MIT",
|
||||||
"LicenseFile": "PCF-LICENSE.TXT",
|
"LicenseFile": "PCF-LICENSE.txt",
|
||||||
"Copyright": "Copyright (C) 2000 by Francesco Zappa Nardelli"
|
"Copyright": "Copyright (C) 2000 by Francesco Zappa Nardelli"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -1156,7 +1156,7 @@ public class QtActivityDelegate
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_metaState = MetaKeyKeyListener.handleKeyDown(m_metaState, keyCode, event);
|
m_metaState = MetaKeyKeyListener.handleKeyDown(m_metaState, keyCode, event);
|
||||||
int c = event.getUnicodeChar(MetaKeyKeyListener.getMetaState(m_metaState));
|
int c = event.getUnicodeChar(MetaKeyKeyListener.getMetaState(m_metaState) | event.getMetaState());
|
||||||
int lc = c;
|
int lc = c;
|
||||||
m_metaState = MetaKeyKeyListener.adjustMetaAfterKeypress(m_metaState);
|
m_metaState = MetaKeyKeyListener.adjustMetaAfterKeypress(m_metaState);
|
||||||
|
|
||||||
|
@ -500,15 +500,16 @@ public class QtNative
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static public void sendGenericMotionEvent(MotionEvent event, int id)
|
static public boolean sendGenericMotionEvent(MotionEvent event, int id)
|
||||||
{
|
{
|
||||||
if (event.getActionMasked() != MotionEvent.ACTION_SCROLL
|
if (event.getActionMasked() != MotionEvent.ACTION_SCROLL
|
||||||
|| (event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != InputDevice.SOURCE_CLASS_POINTER) {
|
|| (event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != InputDevice.SOURCE_CLASS_POINTER) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
mouseWheel(id, (int) event.getX(), (int) event.getY(),
|
mouseWheel(id, (int) event.getX(), (int) event.getY(),
|
||||||
event.getAxisValue(MotionEvent.AXIS_HSCROLL), event.getAxisValue(MotionEvent.AXIS_VSCROLL));
|
event.getAxisValue(MotionEvent.AXIS_HSCROLL), event.getAxisValue(MotionEvent.AXIS_VSCROLL));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Context getContext() {
|
public static Context getContext() {
|
||||||
|
@ -116,7 +116,6 @@ public class QtSurface extends SurfaceView implements SurfaceHolder.Callback
|
|||||||
@Override
|
@Override
|
||||||
public boolean onGenericMotionEvent(MotionEvent event)
|
public boolean onGenericMotionEvent(MotionEvent event)
|
||||||
{
|
{
|
||||||
QtNative.sendGenericMotionEvent(event, getId());
|
return QtNative.sendGenericMotionEvent(event, getId());
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -569,7 +569,8 @@ public abstract class QtLoader {
|
|||||||
boolean bundlingQtLibs = false;
|
boolean bundlingQtLibs = false;
|
||||||
if (m_contextInfo.metaData.containsKey("android.app.bundle_local_qt_libs")
|
if (m_contextInfo.metaData.containsKey("android.app.bundle_local_qt_libs")
|
||||||
&& m_contextInfo.metaData.getInt("android.app.bundle_local_qt_libs") == 1) {
|
&& m_contextInfo.metaData.getInt("android.app.bundle_local_qt_libs") == 1) {
|
||||||
localPrefix = m_context.getApplicationInfo().dataDir + "/";
|
File dataDir = new File(m_context.getApplicationInfo().dataDir);
|
||||||
|
localPrefix = dataDir.getCanonicalPath() + "/";
|
||||||
pluginsPrefix = localPrefix + "qt-reserved-files/";
|
pluginsPrefix = localPrefix + "qt-reserved-files/";
|
||||||
|
|
||||||
if (libsDir == null)
|
if (libsDir == null)
|
||||||
|
@ -405,15 +405,6 @@ index ea84783..62badcc 100644
|
|||||||
|
|
||||||
if (mD3d11Module)
|
if (mD3d11Module)
|
||||||
{
|
{
|
||||||
@@ -2618,7 +2642,7 @@ bool Renderer11::getShareHandleSupport() const
|
|
||||||
|
|
||||||
if (deviceType == d3d11::ANGLE_D3D11_DEVICE_TYPE_WARP)
|
|
||||||
{
|
|
||||||
-#ifndef ANGLE_ENABLE_WINDOWS_STORE
|
|
||||||
+#if !defined(ANGLE_ENABLE_WINDOWS_STORE) && !defined(__GNUC__)
|
|
||||||
if (!IsWindows8OrGreater())
|
|
||||||
{
|
|
||||||
// WARP on Windows 7 doesn't support shared handles
|
|
||||||
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.h
|
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.h
|
||||||
index 62e9816..b4e7761 100644
|
index 62e9816..b4e7761 100644
|
||||||
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.h
|
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.h
|
||||||
|
57
src/angle/patches/0016-ANGLE-Fix-resizing-of-windows.patch
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
From 55821d34b2208e7858dbba5648760b83c66b58a5 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Oliver Wolff <oliver.wolff@qt.io>
|
||||||
|
Date: Mon, 29 Aug 2016 09:48:28 +0200
|
||||||
|
Subject: [PATCH] ANGLE: Fix resizing of windows
|
||||||
|
|
||||||
|
Use the correct height/width values when calculating
|
||||||
|
the vector for resizing the window content and the
|
||||||
|
new size as viewport size.
|
||||||
|
|
||||||
|
Task-number: QTBUG-62475
|
||||||
|
Change-Id: I33a8dc1379a908e991b04bc31dfc6254a6d005c9
|
||||||
|
---
|
||||||
|
.../libANGLE/renderer/d3d/d3d11/SwapChain11.cpp | 35 +++++++++++-----------
|
||||||
|
1 file changed, 17 insertions(+), 18 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp
|
||||||
|
index 785a83cd77..fe72bc935d 100644
|
||||||
|
--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp
|
||||||
|
+++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp
|
||||||
|
@@ -707,15 +706,15 @@ EGLint SwapChain11::copyOffscreenToBackbuffer(EGLint x, EGLint y, EGLint width,
|
||||||
|
d3d11::PositionTexCoordVertex *vertices = static_cast<d3d11::PositionTexCoordVertex*>(mappedResource.pData);
|
||||||
|
|
||||||
|
// Create a quad in homogeneous coordinates
|
||||||
|
- float x1 = (x / float(mWidth)) * 2.0f - 1.0f;
|
||||||
|
- float y1 = (y / float(mHeight)) * 2.0f - 1.0f;
|
||||||
|
- float x2 = ((x + width) / float(mWidth)) * 2.0f - 1.0f;
|
||||||
|
- float y2 = ((y + height) / float(mHeight)) * 2.0f - 1.0f;
|
||||||
|
+ float x1 = (x / float(width)) * 2.0f - 1.0f;
|
||||||
|
+ float y1 = (y / float(height)) * 2.0f - 1.0f;
|
||||||
|
+ float x2 = ((x + width) / float(width)) * 2.0f - 1.0f;
|
||||||
|
+ float y2 = ((y + height) / float(height)) * 2.0f - 1.0f;
|
||||||
|
|
||||||
|
- float u1 = x / float(mWidth);
|
||||||
|
- float v1 = y / float(mHeight);
|
||||||
|
- float u2 = (x + width) / float(mWidth);
|
||||||
|
- float v2 = (y + height) / float(mHeight);
|
||||||
|
+ float u1 = x / float(width);
|
||||||
|
+ float v1 = y / float(height);
|
||||||
|
+ float u2 = (x + width) / float(width);
|
||||||
|
+ float v2 = (y + height) / float(height);
|
||||||
|
|
||||||
|
// Invert the quad vertices depending on the surface orientation.
|
||||||
|
if ((mOrientation & EGL_SURFACE_ORIENTATION_INVERT_X_ANGLE) != 0)
|
||||||
|
@@ -760,8 +759,8 @@ EGLint SwapChain11::copyOffscreenToBackbuffer(EGLint x, EGLint y, EGLint width,
|
||||||
|
D3D11_VIEWPORT viewport;
|
||||||
|
viewport.TopLeftX = 0;
|
||||||
|
viewport.TopLeftY = 0;
|
||||||
|
- viewport.Width = static_cast<FLOAT>(mWidth);
|
||||||
|
- viewport.Height = static_cast<FLOAT>(mHeight);
|
||||||
|
+ viewport.Width = static_cast<FLOAT>(width);
|
||||||
|
+ viewport.Height = static_cast<FLOAT>(height);
|
||||||
|
viewport.MinDepth = 0.0f;
|
||||||
|
viewport.MaxDepth = 1.0f;
|
||||||
|
deviceContext->RSSetViewports(1, &viewport);
|
||||||
|
--
|
||||||
|
2.15.0.windows.1
|
||||||
|
|
@ -36,6 +36,8 @@ exampledirs += ../../../examples/qtconcurrent \
|
|||||||
../ \
|
../ \
|
||||||
snippets
|
snippets
|
||||||
|
|
||||||
|
manifestmeta.highlighted.names = "QtConcurrent/QtConcurrent Progress Dialog Example"
|
||||||
|
|
||||||
excludedirs += ../../../examples/widgets/doc
|
excludedirs += ../../../examples/widgets/doc
|
||||||
|
|
||||||
imagedirs += images
|
imagedirs += images
|
||||||
|
@ -299,13 +299,13 @@ void QUnifiedTimer::stopAnimationDriver()
|
|||||||
driver->stop();
|
driver->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QUnifiedTimer::updateAnimationTimers(qint64)
|
void QUnifiedTimer::updateAnimationTimers(qint64 currentTick)
|
||||||
{
|
{
|
||||||
//setCurrentTime can get this called again while we're the for loop. At least with pauseAnimations
|
//setCurrentTime can get this called again while we're the for loop. At least with pauseAnimations
|
||||||
if(insideTick)
|
if(insideTick)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
qint64 totalElapsed = elapsed();
|
qint64 totalElapsed = currentTick > 0 ? currentTick : elapsed();
|
||||||
|
|
||||||
// ignore consistentTiming in case the pause timer is active
|
// ignore consistentTiming in case the pause timer is active
|
||||||
qint64 delta = (consistentTiming && !pauseTimer.isActive()) ?
|
qint64 delta = (consistentTiming && !pauseTimer.isActive()) ?
|
||||||
|
@ -178,7 +178,7 @@
|
|||||||
"slog2": {
|
"slog2": {
|
||||||
"label": "slog2",
|
"label": "slog2",
|
||||||
"test": {
|
"test": {
|
||||||
"include": "slog2.h",
|
"include": "sys/slog2.h",
|
||||||
"main": "slog2_set_default_buffer((slog2_buffer_t)-1);"
|
"main": "slog2_set_default_buffer((slog2_buffer_t)-1);"
|
||||||
},
|
},
|
||||||
"export": "",
|
"export": "",
|
||||||
@ -349,6 +349,15 @@
|
|||||||
"qmake": "linux: LIBS += -lpthread -lrt"
|
"qmake": "linux: LIBS += -lpthread -lrt"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"linkat": {
|
||||||
|
"label": "linkat()",
|
||||||
|
"type": "compile",
|
||||||
|
"test": {
|
||||||
|
"head": "#define _ATFILE_SOURCE 1",
|
||||||
|
"include": [ "fcntl.h", "unistd.h" ],
|
||||||
|
"main": "linkat(AT_FDCWD, \"foo\", AT_FDCWD, \"bar\", AT_SYMLINK_FOLLOW);"
|
||||||
|
}
|
||||||
|
},
|
||||||
"ppoll": {
|
"ppoll": {
|
||||||
"label": "ppoll()",
|
"label": "ppoll()",
|
||||||
"type": "compile",
|
"type": "compile",
|
||||||
@ -540,6 +549,12 @@
|
|||||||
"condition": "libs.journald",
|
"condition": "libs.journald",
|
||||||
"output": [ "privateFeature" ]
|
"output": [ "privateFeature" ]
|
||||||
},
|
},
|
||||||
|
"linkat": {
|
||||||
|
"label": "linkat()",
|
||||||
|
"autoDetect": "config.linux",
|
||||||
|
"condition": "tests.linkat",
|
||||||
|
"output": [ "privateFeature" ]
|
||||||
|
},
|
||||||
"std-atomic64": {
|
"std-atomic64": {
|
||||||
"label": "64 bit atomic operations",
|
"label": "64 bit atomic operations",
|
||||||
"condition": "libs.libatomic",
|
"condition": "libs.libatomic",
|
||||||
@ -593,7 +608,7 @@
|
|||||||
"label": "PPS",
|
"label": "PPS",
|
||||||
"emitIf": "config.qnx",
|
"emitIf": "config.qnx",
|
||||||
"condition": "libs.pps",
|
"condition": "libs.pps",
|
||||||
"output": [ "privateConfig" ]
|
"output": [ "privateFeature" ]
|
||||||
},
|
},
|
||||||
"qeventtransition": {
|
"qeventtransition": {
|
||||||
"label": "QEventTransition class",
|
"label": "QEventTransition class",
|
||||||
|
@ -45,5 +45,8 @@ excludedirs += snippets
|
|||||||
excludefiles += ../../../examples/widgets/tools/customcompleter/doc/src/customcompleter.qdoc \
|
excludefiles += ../../../examples/widgets/tools/customcompleter/doc/src/customcompleter.qdoc \
|
||||||
../../../examples/widgets/tools/codecs/doc/src/codecs.qdoc
|
../../../examples/widgets/tools/codecs/doc/src/codecs.qdoc
|
||||||
|
|
||||||
|
manifestmeta.highlighted.names = "QtCore/JSON Save Game Example" \
|
||||||
|
"QtCore/Local Fortune*"
|
||||||
|
|
||||||
navigation.landingpage = "Qt Core"
|
navigation.landingpage = "Qt Core"
|
||||||
navigation.cppclassespage = "Qt Core C++ Classes"
|
navigation.cppclassespage = "Qt Core C++ Classes"
|
||||||
|
@ -750,7 +750,6 @@ void Widget::sizeFunction()
|
|||||||
int n = str.size(); // n == 5
|
int n = str.size(); // n == 5
|
||||||
str.data()[0]; // returns 'W'
|
str.data()[0]; // returns 'W'
|
||||||
str.data()[4]; // returns 'd'
|
str.data()[4]; // returns 'd'
|
||||||
str.data()[5]; // returns '\0'
|
|
||||||
//! [58]
|
//! [58]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -810,6 +809,18 @@ void Widget::splitCaseSensitiveFunction()
|
|||||||
QStringList list2 = str.split(',', QString::SkipEmptyParts);
|
QStringList list2 = str.split(',', QString::SkipEmptyParts);
|
||||||
// list2: [ "a", "b", "c" ]
|
// list2: [ "a", "b", "c" ]
|
||||||
//! [62]
|
//! [62]
|
||||||
|
|
||||||
|
//! [62-empty]
|
||||||
|
QString str = "abc";
|
||||||
|
auto parts = str.split("");
|
||||||
|
// parts: {"", "a", "b", "c", ""}
|
||||||
|
//! [62-empty]
|
||||||
|
|
||||||
|
//! [62-slashes]
|
||||||
|
QString str = "/a/b/c/";
|
||||||
|
auto parts = str.split('/');
|
||||||
|
// parts: {"", "a", "b", "c", ""}
|
||||||
|
//! [62-slashes]
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::sprintfFunction()
|
void Widget::sprintfFunction()
|
||||||
|
@ -63,7 +63,10 @@ unset(f16c_cxx)
|
|||||||
VERSIONTAGGING_SOURCES = global/qversiontagging.cpp
|
VERSIONTAGGING_SOURCES = global/qversiontagging.cpp
|
||||||
|
|
||||||
darwin: SOURCES += global/qoperatingsystemversion_darwin.mm
|
darwin: SOURCES += global/qoperatingsystemversion_darwin.mm
|
||||||
win32: SOURCES += global/qoperatingsystemversion_win.cpp
|
win32 {
|
||||||
|
SOURCES += global/qoperatingsystemversion_win.cpp
|
||||||
|
HEADERS += global/qoperatingsystemversion_win_p.h
|
||||||
|
}
|
||||||
|
|
||||||
# qlibraryinfo.cpp includes qconfig.cpp
|
# qlibraryinfo.cpp includes qconfig.cpp
|
||||||
INCLUDEPATH += $$QT_BUILD_TREE/src/corelib/global
|
INCLUDEPATH += $$QT_BUILD_TREE/src/corelib/global
|
||||||
|
@ -67,7 +67,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
* - inotify_init1 before 2.6.12-rc12
|
* - inotify_init1 before 2.6.12-rc12
|
||||||
* - futex(2) before 2.6.12-rc12
|
* - futex(2) before 2.6.12-rc12
|
||||||
* - FUTEX_WAKE_OP 2.6.14 FUTEX_OP
|
* - FUTEX_WAKE_OP 2.6.14 FUTEX_OP
|
||||||
* - linkat(2) 2.6.17 O_TMPFILE
|
* - linkat(2) 2.6.17 O_TMPFILE && QT_CONFIG(linkat)
|
||||||
* - FUTEX_PRIVATE_FLAG 2.6.22
|
* - FUTEX_PRIVATE_FLAG 2.6.22
|
||||||
* - O_CLOEXEC 2.6.23
|
* - O_CLOEXEC 2.6.23
|
||||||
* - eventfd 2.6.23
|
* - eventfd 2.6.23
|
||||||
|
@ -87,6 +87,11 @@
|
|||||||
#define QT_FEATURE_futimens -1
|
#define QT_FEATURE_futimens -1
|
||||||
#define QT_FEATURE_futimes -1
|
#define QT_FEATURE_futimes -1
|
||||||
#define QT_FEATURE_library -1
|
#define QT_FEATURE_library -1
|
||||||
|
#ifdef __linux__
|
||||||
|
# define QT_FEATURE_linkat 1
|
||||||
|
#else
|
||||||
|
# define QT_FEATURE_linkat -1
|
||||||
|
#endif
|
||||||
#define QT_NO_QOBJECT
|
#define QT_NO_QOBJECT
|
||||||
#define QT_FEATURE_process -1
|
#define QT_FEATURE_process -1
|
||||||
#define QT_FEATURE_regularexpression -1
|
#define QT_FEATURE_regularexpression -1
|
||||||
|
@ -129,8 +129,8 @@ extern "C" {
|
|||||||
# define f16cextern extern
|
# define f16cextern extern
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
f16cextern void qFloatToFloat16_fast(quint16 *out, const float *in, qssize_t len) Q_DECL_NOTHROW;
|
f16cextern void qFloatToFloat16_fast(quint16 *out, const float *in, qsizetype len) Q_DECL_NOTHROW;
|
||||||
f16cextern void qFloatFromFloat16_fast(float *out, const quint16 *in, qssize_t len) Q_DECL_NOTHROW;
|
f16cextern void qFloatFromFloat16_fast(float *out, const quint16 *in, qsizetype len) Q_DECL_NOTHROW;
|
||||||
|
|
||||||
#undef f16cextern
|
#undef f16cextern
|
||||||
}
|
}
|
||||||
@ -141,20 +141,20 @@ static inline bool hasFastF16()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qFloatToFloat16_fast(quint16 *out, const float *in, qssize_t len) Q_DECL_NOTHROW
|
static void qFloatToFloat16_fast(quint16 *out, const float *in, qsizetype len) Q_DECL_NOTHROW
|
||||||
{
|
{
|
||||||
__fp16 *out_f16 = reinterpret_cast<__fp16 *>(out);
|
__fp16 *out_f16 = reinterpret_cast<__fp16 *>(out);
|
||||||
qssize_t i = 0;
|
qsizetype i = 0;
|
||||||
for (; i < len - 3; i += 4)
|
for (; i < len - 3; i += 4)
|
||||||
vst1_f16(out_f16 + i, vcvt_f16_f32(vld1q_f32(in + i)));
|
vst1_f16(out_f16 + i, vcvt_f16_f32(vld1q_f32(in + i)));
|
||||||
SIMD_EPILOGUE(i, len, 3)
|
SIMD_EPILOGUE(i, len, 3)
|
||||||
out_f16[i] = __fp16(in[i]);
|
out_f16[i] = __fp16(in[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qFloatFromFloat16_fast(float *out, const quint16 *in, qssize_t len) Q_DECL_NOTHROW
|
static void qFloatFromFloat16_fast(float *out, const quint16 *in, qsizetype len) Q_DECL_NOTHROW
|
||||||
{
|
{
|
||||||
const __fp16 *in_f16 = reinterpret_cast<const __fp16 *>(in);
|
const __fp16 *in_f16 = reinterpret_cast<const __fp16 *>(in);
|
||||||
qssize_t i = 0;
|
qsizetype i = 0;
|
||||||
for (; i < len - 3; i += 4)
|
for (; i < len - 3; i += 4)
|
||||||
vst1q_f32(out + i, vcvt_f32_f16(vld1_f16(in_f16 + i)));
|
vst1q_f32(out + i, vcvt_f32_f16(vld1_f16(in_f16 + i)));
|
||||||
SIMD_EPILOGUE(i, len, 3)
|
SIMD_EPILOGUE(i, len, 3)
|
||||||
@ -166,12 +166,12 @@ static inline bool hasFastF16()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qFloatToFloat16_fast(quint16 *, const float *, qssize_t) Q_DECL_NOTHROW
|
static void qFloatToFloat16_fast(quint16 *, const float *, qsizetype) Q_DECL_NOTHROW
|
||||||
{
|
{
|
||||||
Q_UNREACHABLE();
|
Q_UNREACHABLE();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qFloatFromFloat16_fast(float *, const quint16 *, qssize_t) Q_DECL_NOTHROW
|
static void qFloatFromFloat16_fast(float *, const quint16 *, qsizetype) Q_DECL_NOTHROW
|
||||||
{
|
{
|
||||||
Q_UNREACHABLE();
|
Q_UNREACHABLE();
|
||||||
}
|
}
|
||||||
@ -182,12 +182,12 @@ static void qFloatFromFloat16_fast(float *, const quint16 *, qssize_t) Q_DECL_NO
|
|||||||
Converts \a len floats from \a in to qfloat16 and stores them in \a out.
|
Converts \a len floats from \a in to qfloat16 and stores them in \a out.
|
||||||
Both \a in and \a out must have \a len allocated entries.
|
Both \a in and \a out must have \a len allocated entries.
|
||||||
*/
|
*/
|
||||||
Q_CORE_EXPORT void qFloatToFloat16(qfloat16 *out, const float *in, qssize_t len) Q_DECL_NOTHROW
|
Q_CORE_EXPORT void qFloatToFloat16(qfloat16 *out, const float *in, qsizetype len) Q_DECL_NOTHROW
|
||||||
{
|
{
|
||||||
if (hasFastF16())
|
if (hasFastF16())
|
||||||
return qFloatToFloat16_fast(reinterpret_cast<quint16 *>(out), in, len);
|
return qFloatToFloat16_fast(reinterpret_cast<quint16 *>(out), in, len);
|
||||||
|
|
||||||
for (qssize_t i = 0; i < len; ++i)
|
for (qsizetype i = 0; i < len; ++i)
|
||||||
out[i] = qfloat16(in[i]);
|
out[i] = qfloat16(in[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,12 +197,12 @@ Q_CORE_EXPORT void qFloatToFloat16(qfloat16 *out, const float *in, qssize_t len)
|
|||||||
Converts \a len qfloat16 from \a in to floats and stores them in \a out.
|
Converts \a len qfloat16 from \a in to floats and stores them in \a out.
|
||||||
Both \a in and \a out must have \a len allocated entries.
|
Both \a in and \a out must have \a len allocated entries.
|
||||||
*/
|
*/
|
||||||
Q_CORE_EXPORT void qFloatFromFloat16(float *out, const qfloat16 *in, qssize_t len) Q_DECL_NOTHROW
|
Q_CORE_EXPORT void qFloatFromFloat16(float *out, const qfloat16 *in, qsizetype len) Q_DECL_NOTHROW
|
||||||
{
|
{
|
||||||
if (hasFastF16())
|
if (hasFastF16())
|
||||||
return qFloatFromFloat16_fast(out, reinterpret_cast<const quint16 *>(in), len);
|
return qFloatFromFloat16_fast(out, reinterpret_cast<const quint16 *>(in), len);
|
||||||
|
|
||||||
for (qssize_t i = 0; i < len; ++i)
|
for (qsizetype i = 0; i < len; ++i)
|
||||||
out[i] = float(in[i]);
|
out[i] = float(in[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,8 +88,8 @@ private:
|
|||||||
|
|
||||||
Q_DECLARE_TYPEINFO(qfloat16, Q_PRIMITIVE_TYPE);
|
Q_DECLARE_TYPEINFO(qfloat16, Q_PRIMITIVE_TYPE);
|
||||||
|
|
||||||
Q_CORE_EXPORT void qFloatToFloat16(qfloat16 *, const float *, qssize_t length) Q_DECL_NOTHROW;
|
Q_CORE_EXPORT void qFloatToFloat16(qfloat16 *, const float *, qsizetype length) Q_DECL_NOTHROW;
|
||||||
Q_CORE_EXPORT void qFloatFromFloat16(float *, const qfloat16 *, qssize_t length) Q_DECL_NOTHROW;
|
Q_CORE_EXPORT void qFloatFromFloat16(float *, const qfloat16 *, qsizetype length) Q_DECL_NOTHROW;
|
||||||
|
|
||||||
Q_REQUIRED_RESULT Q_CORE_EXPORT bool qIsInf(qfloat16 f) Q_DECL_NOTHROW; // complements qnumeric.h
|
Q_REQUIRED_RESULT Q_CORE_EXPORT bool qIsInf(qfloat16 f) Q_DECL_NOTHROW; // complements qnumeric.h
|
||||||
Q_REQUIRED_RESULT Q_CORE_EXPORT bool qIsNaN(qfloat16 f) Q_DECL_NOTHROW; // complements qnumeric.h
|
Q_REQUIRED_RESULT Q_CORE_EXPORT bool qIsNaN(qfloat16 f) Q_DECL_NOTHROW; // complements qnumeric.h
|
||||||
|
@ -54,9 +54,9 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
QT_FUNCTION_TARGET(F16C)
|
QT_FUNCTION_TARGET(F16C)
|
||||||
void qFloatToFloat16_fast(quint16 *out, const float *in, qssize_t len) Q_DECL_NOTHROW
|
void qFloatToFloat16_fast(quint16 *out, const float *in, qsizetype len) Q_DECL_NOTHROW
|
||||||
{
|
{
|
||||||
qssize_t i = 0;
|
qsizetype i = 0;
|
||||||
for (; i < len - 7; i += 8)
|
for (; i < len - 7; i += 8)
|
||||||
_mm_storeu_si128((__m128i *)(out + i), _mm256_cvtps_ph(_mm256_loadu_ps(in + i), 0));
|
_mm_storeu_si128((__m128i *)(out + i), _mm256_cvtps_ph(_mm256_loadu_ps(in + i), 0));
|
||||||
if (i < len - 3) {
|
if (i < len - 3) {
|
||||||
@ -69,9 +69,9 @@ void qFloatToFloat16_fast(quint16 *out, const float *in, qssize_t len) Q_DECL_NO
|
|||||||
}
|
}
|
||||||
|
|
||||||
QT_FUNCTION_TARGET(F16C)
|
QT_FUNCTION_TARGET(F16C)
|
||||||
void qFloatFromFloat16_fast(float *out, const quint16 *in, qssize_t len) Q_DECL_NOTHROW
|
void qFloatFromFloat16_fast(float *out, const quint16 *in, qsizetype len) Q_DECL_NOTHROW
|
||||||
{
|
{
|
||||||
qssize_t i = 0;
|
qsizetype i = 0;
|
||||||
for (; i < len - 7; i += 8)
|
for (; i < len - 7; i += 8)
|
||||||
_mm256_storeu_ps(out + i, _mm256_cvtph_ps(_mm_loadu_si128((const __m128i *)(in + i))));
|
_mm256_storeu_ps(out + i, _mm256_cvtph_ps(_mm_loadu_si128((const __m128i *)(in + i))));
|
||||||
if (i < len - 3) {
|
if (i < len - 3) {
|
||||||
|
@ -61,9 +61,9 @@ static inline bool qt_is_inf(qfloat16 d) Q_DECL_NOTHROW
|
|||||||
bool is_inf;
|
bool is_inf;
|
||||||
uchar *ch = (uchar *)&d;
|
uchar *ch = (uchar *)&d;
|
||||||
if (QSysInfo::ByteOrder == QSysInfo::BigEndian)
|
if (QSysInfo::ByteOrder == QSysInfo::BigEndian)
|
||||||
is_inf = (ch[0] & 0x7c) == 0x7c;
|
is_inf = (ch[0] & 0x7c) == 0x7c && (ch[0] & 0x02) == 0;
|
||||||
else
|
else
|
||||||
is_inf = (ch[1] & 0x7c) == 0x7c;
|
is_inf = (ch[1] & 0x7c) == 0x7c && (ch[1] & 0x02) == 0;
|
||||||
return is_inf;
|
return is_inf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,6 +46,9 @@
|
|||||||
#include "qdatetime.h"
|
#include "qdatetime.h"
|
||||||
#include "qoperatingsystemversion.h"
|
#include "qoperatingsystemversion.h"
|
||||||
#include "qoperatingsystemversion_p.h"
|
#include "qoperatingsystemversion_p.h"
|
||||||
|
#if defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) || defined(Q_OS_WINRT)
|
||||||
|
#include "qoperatingsystemversion_win_p.h"
|
||||||
|
#endif
|
||||||
#include <private/qlocale_tools_p.h>
|
#include <private/qlocale_tools_p.h>
|
||||||
|
|
||||||
#include <qmutex.h>
|
#include <qmutex.h>
|
||||||
@ -164,8 +167,8 @@ Q_STATIC_ASSERT_X(std::numeric_limits<float>::radix == 2,
|
|||||||
|
|
||||||
// not required by the definition of size_t, but we depend on this
|
// not required by the definition of size_t, but we depend on this
|
||||||
Q_STATIC_ASSERT_X(sizeof(size_t) == sizeof(void *), "size_t and a pointer don't have the same size");
|
Q_STATIC_ASSERT_X(sizeof(size_t) == sizeof(void *), "size_t and a pointer don't have the same size");
|
||||||
Q_STATIC_ASSERT(sizeof(size_t) == sizeof(qssize_t)); // implied by the definition
|
Q_STATIC_ASSERT(sizeof(size_t) == sizeof(qsizetype)); // implied by the definition
|
||||||
Q_STATIC_ASSERT((std::is_same<qssize_t, qptrdiff>::value));
|
Q_STATIC_ASSERT((std::is_same<qsizetype, qptrdiff>::value));
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class QFlag
|
\class QFlag
|
||||||
@ -827,7 +830,7 @@ Q_STATIC_ASSERT((std::is_same<qssize_t, qptrdiff>::value));
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\typedef qssize_t
|
\typedef qsizetype
|
||||||
\relates <QtGlobal>
|
\relates <QtGlobal>
|
||||||
\since 5.10
|
\since 5.10
|
||||||
|
|
||||||
@ -836,7 +839,7 @@ Q_STATIC_ASSERT((std::is_same<qssize_t, qptrdiff>::value));
|
|||||||
This type is guaranteed to be the same size as a \c size_t on all
|
This type is guaranteed to be the same size as a \c size_t on all
|
||||||
platforms supported by Qt.
|
platforms supported by Qt.
|
||||||
|
|
||||||
Note that qssize_t is signed. Use \c size_t for unsigned values.
|
Note that qsizetype is signed. Use \c size_t for unsigned values.
|
||||||
|
|
||||||
\sa qptrdiff
|
\sa qptrdiff
|
||||||
*/
|
*/
|
||||||
|
@ -250,7 +250,7 @@ typedef quint64 qulonglong;
|
|||||||
// In C++ mode, we define below using QIntegerForSize template
|
// In C++ mode, we define below using QIntegerForSize template
|
||||||
Q_STATIC_ASSERT_X(sizeof(ptrdiff_t) == sizeof(size_t), "Weird ptrdiff_t and size_t definitions");
|
Q_STATIC_ASSERT_X(sizeof(ptrdiff_t) == sizeof(size_t), "Weird ptrdiff_t and size_t definitions");
|
||||||
typedef ptrdiff_t qptrdiff;
|
typedef ptrdiff_t qptrdiff;
|
||||||
typedef ptrdiff_t qssize_t;
|
typedef ptrdiff_t qsizetype;
|
||||||
typedef ptrdiff_t qintptr;
|
typedef ptrdiff_t qintptr;
|
||||||
typedef size_t quintptr;
|
typedef size_t quintptr;
|
||||||
#endif
|
#endif
|
||||||
@ -475,7 +475,7 @@ namespace QtPrivate {
|
|||||||
sizeof(void *) == sizeof(quintptr)
|
sizeof(void *) == sizeof(quintptr)
|
||||||
&& sizeof(void *) == sizeof(qptrdiff)
|
&& sizeof(void *) == sizeof(qptrdiff)
|
||||||
|
|
||||||
size_t and qssize_t are not guaranteed to be the same size as a pointer, but
|
size_t and qsizetype are not guaranteed to be the same size as a pointer, but
|
||||||
they usually are.
|
they usually are.
|
||||||
*/
|
*/
|
||||||
template <int> struct QIntegerForSize;
|
template <int> struct QIntegerForSize;
|
||||||
@ -492,7 +492,7 @@ typedef QIntegerForSize<Q_PROCESSOR_WORDSIZE>::Unsigned qregisteruint;
|
|||||||
typedef QIntegerForSizeof<void*>::Unsigned quintptr;
|
typedef QIntegerForSizeof<void*>::Unsigned quintptr;
|
||||||
typedef QIntegerForSizeof<void*>::Signed qptrdiff;
|
typedef QIntegerForSizeof<void*>::Signed qptrdiff;
|
||||||
typedef qptrdiff qintptr;
|
typedef qptrdiff qintptr;
|
||||||
using qssize_t = QIntegerForSizeof<std::size_t>::Signed;
|
using qsizetype = QIntegerForSizeof<std::size_t>::Signed;
|
||||||
|
|
||||||
/* moc compats (signals/slots) */
|
/* moc compats (signals/slots) */
|
||||||
#ifndef QT_MOC_COMPAT
|
#ifndef QT_MOC_COMPAT
|
||||||
|