Q_OS_WINRT was missing in the Windows-condition.
Condition was simplified through use of Q_OS_WIN.
Change-Id: I1a49d2d9c413dc2156930b6915e1675abcdde36f
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
This basically inlines the call to parent(), which unconditionally
returns QModelIndex().
The change is binary compatible, because even though we newly
override a previously non-overridden virtual method, it doesn't
matter whether old code still calls the base class' method, as
the new implementation is semantically equivalent, at least if
subclasses don't inherit parent() (but why would they).
[ChangeLog][QtCore][Important Behavior Changes] QAbstractTableModel
and QAbstractListModel now reimplement sibling() to avoid calling
parent() (which returns a constant). Subclasses of these models
that override parent(), will likely also need to override sibling()
now.
Change-Id: I9e0cb5622a6d3826e40acaf0e0cd3fdea85cba2d
Reviewed-by: David Faure <david.faure@kdab.com>
So if you stream enum type into qDebug, it will show the name
of the enum value instead of the int
Change-Id: Iec5e826623353560319890d3e7c4ab97d0645f4a
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
these reflect the on-target paths (unlike /raw, which are host paths, just
without the -sysroot). this is necessary for anything deployment-related,
starting with RPATH.
Change-Id: I13d598995d0e4d6cb0dc1fc7938b8631cf3e3a95
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
this cuts down the bloat in the binaries and the binary patching
requirements in the installer.
as a side effect, the sysroot and makespecs are not binary patchable any
more as well, which is ok, as the installer does not do it anyway.
we now also warn if -[host]<foo>dir is not a subdir of -[host]prefix, as
putting things outside the prefix is anti-thetical (the obvious
exception being the (unix-only) -sysconfdir).
Change-Id: I878f0e71a4dfcfd55b2f8b1cf3045b98b502569b
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Check by comparing __argc/__argv whether a modified argv was
passed to QCoreApplication. If that is the case, build
QCoreApplication::arguments() from that argv instead of using
the command line.
[ChangeLog][Important Behavior Changes][QCoreApplication]
On Windows, QCoreApplication::arguments() now returns a list built
from argv on Windows as well if a modified argv was passed to the
class' constructor.
Task-number: QTBUG-30330
Task-number: QTSOLBUG-184
Change-Id: I2498bb554130e7bfaeada3aebe786dfdd0eb534d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
They need a special macro since they have a different metaobject
Change-Id: I2fa50b4b2e45990fb01771378765b42f03139183
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Classes should either use or not use override, otherwise it hurts
code readability.
Some inline keywords were removed because of an error with MSVC2010:
error C2216: 'override' cannot be used with 'inline'
Change-Id: I7276d5525a92281bd0d743beb11d0dc73441443b
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This requires being able to create a QItemSelectionModel
without specifiying its model, and also setting the model
later. Also, several classes, like QPersistentModelIndex,
need to be declared as meta-type.
Finally, and in order to introduce the 'model' property,
we need to have a type compatible getter. Hence the new,
non-const model() function.
Where needed, meta-type declarations have been removed from
auto-tests.
[ChangeLog][QtCore][Item Models] QItemSelectionModel
can now be created without a model and have one set later.
Change-Id: If49bed061a5d1012331f335ca7f6e3959ecd3f1c
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Instead of using QString::sprintf() (and converting the result back to QByteArray),
simply do the conversion from uchar to hex digits ourselves, using QtMiscUtils.
This function is a copy of a similar (but not identical) one
in qprocess_unix.cpp, but it's not clear whether they can or
should be merged (both are only conditionally compiled), so
this patch does not attempt to do so.
Change-Id: I0be87963f78a98e35a54c98c5fb444756c57b672
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
The warning was:
warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long unsigned int’ [-Wformat=]
Change-Id: I37dc13ca864d408e02c69102ba5208f8bfe70980
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
The warnings were:
warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat=] (2x)
Change-Id: If8c2e8fab7388cb4aa7d6e7ceb5faee531e16006
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
suppose we queried QT_INSTALL_DOCS/get. if no [EffectivePaths] existed,
we'd try [Paths]. if that didn't exist, either, we'd use the built-in,
which is relative. so we'd query QT_INSTALL_PREFIX ... without the /get,
which is technically wrong.
this doesn't currently matter, as all groups have the same built-in
defaults anyway, but it may (hint hint) matter later on.
Change-Id: I5a3746e80ca1bfbf2f37db3604cc351bddeacd94
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
it's not worth making things more complicated to remove the duplication of
one real LOC.
Change-Id: Iddbd0db7d0f81b80192b3980dbe2316b246a3b57
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
There are currently only two users, but I have patches in
the pipeline which mark some other function noinline, so
proavtively centralize the ifdef'ery involved.
Change-Id: I1f02351fdc903d4e026089e12b8a976ed6a8d603
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The function used a QMap<int,int> to map the %n's to the index
in the args array.
By way of construction, the key was sorted in ascending order
while the values, initially all -1, were later reassigned to be
0...map.size()-1, ie. std::iota().
The only information this data structure stores is therefore
the sorted %n's. For that, a sorted vector is a vastly superior
data structure.
Go one step further and use QVarLengthArray to avoid
allocating any memory for the common case of just a few
placeholders.
As an artifact of the underlying refactoring, the management
of that data structure has been moved to a separate class,
ArgMapper.
Runtime for the following test from tst_qstring:
QString str("%1 %2 %3 %4 %5 %6 %7 %8 %9 foo %10 %11 bar"); // not timed
str = str.arg("one", "2", "3", "4", "5", "6", "7", "8", "9");
str = str.arg("ahoy", "there");
went down from 2.2us to 1.5us.
Change-Id: Ic552615fbac646b78ba05eb4e3215e63d202fd94
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reduce the number of (non-regex) splitString instantiations from
six to two by:
- Passing separators by (const QChar*, int) and using qFindString()
instead of indexOf()
- Passing QString as QStringRef when the output is QVector<QStringRef>.
Doing so also allows to drop the MidMethod template parameter since
QString::midRef() is no longer being used.
(Somewhat disappointing) effects on Linux GCC 4.9 stripped release builds:
text -500B
data +-0B
relocs +-0
Change-Id: Id89e2814d5f7da5170181d863167517943c2e0cd
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
pthread_getthreadid_np(3) is defined in pthread_np.h, not pthread.h.
Additionally, it was added during the FreeBSD 9 time frame, so add a
version check to use it only when we know it is present.
Change-Id: I4d716d9bfb189d10128b6d458a47045e130b51e8
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Commit b6191b16 ("Merge remote-tracking branch 'origin/5.4' into dev")
merged commit 350c60b ("Link against QMAKE_LIBS_EXECINFO when using
backtrace(3)") into the dev branch, but the conflict resolution left out
the actual line that changed LIBS_PRIVATE.
Change-Id: I6e716ed375abdc534a1f20e412ce7c56ee85d6c0
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
We expect floating-point math to be IEEE754 compliant.
Change-Id: I2b257177f2ef5fce38ac4d8fd76f746dc7b9fc15
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
ItemIsTristate is now again purely for enabling the automatic management
of the check state of QTreeWidgetItems, while ItemIsUserTristate is
separate from that and lets the user select the three states manually.
This restores the original behavior of ItemIsTristate for QTreeWidgetItems,
which got broken by letting the user cycle through the states too.
[ChangeLog][QtWidgets][QTreeWidget] Restored Qt 5.1 behavior of
QTreeWidgetItems with ItemIsTristate to enable automatic management
of the check state. User-editable tristate checkboxes are now enabled
by setting the new flag ItemIsUserTristate.
Task-number: QTBUG-40060
Change-Id: I341f5e983804d3b4f27982520bb6647f3014cccc
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@theqtcompany.com>
The patch adds convenience functions for working on C++11's new char
width specific unicode strings u16string and u32string.
[ChangeLog][QtCore][QString] Added methods for convenient conversion
to and from std::u16string and std::u32string.
Change-Id: I67c082e4755c592d61daaaaa70c8867ef0b23dcb
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Due to a bug in the internal implementation of posix_spawnp on QNX, all file
descriptors with a value lower than the maximum file descriptor specified
in the file_actions structure are duplicated by default, ignoring the
FD_CLOEXEC flag. This includes all file descriptors that we are not working
with. So we add those file descriptors that have the FD_CLOEXEC flag to the
file_actions structure as close actions.
Change-Id: I316bc334addb46a4b84c199a69e9bd291ca706c5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Most posix_spawn implementations are done using fork(), so the only way
to report errors afer fork() is via a special exit code.
Reference: http://pubs.opengroup.org/onlinepubs/009695399/functions/posix_spawn.html
Change-Id: I3a37f81b0cb278bb31e5cb83c87e6b4c034dbc19
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Replace the existing code in QProcess that dealt with signaling of child
processes exiting with forkfd and spawnfd. The previous code was
convoluted and hard to maintain, having shown its age in the last
year. I've been running it for a year and a half and the new
implementation is definitely an improvement.
This change replaces support for the QNX Neutrino spawn() call with the
POSIX version. We lose the ability to do setsid(), but we gain quite a
few ioctls() that were done to fill in the file descriptor mapping
structure. That's also the only OS for which we have the ability to
thread-safely chdir() before the call to spawnfd().
Another advantage is that forkfd does not require a dedicated thread
running to handle child processes exiting.
Change-Id: I5eb76821dfdb6a8ed2989d7f53b3c31e515c3174
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
This also brings in the harness to forkfd that uses QBasicAtomic
instead of the generic GCC atomics.
Change-Id: Id5488bf192db0027bc684956ade0bf6c640c9512
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The most common use case for QTextStream::readLine() is reading
a file line by line in a loop. The existing readLine() method
allocates new memory for each line, that results in a loss of
speed. The introduced overload can use already allocated memory.
Besides it allows you to not think about filesystem specifics.
The current QFile documentation suggests a separate way to read
files from /proc filesystem. With this overload it's possible
to use the same idiom in all cases:
QTextStream in(&file);
QString line;
while (in.readLine(&line)) {
process_line(line);
}
The idea was inspired by the blog post of Ivan Čukić:
http://ivan.fomentgroup.org/blog/2014/10/03/api-design-and-impact-on-the-performance-qt-vs-stl-example/
Change-Id: I0c62b4a52681870589bc099905e83ed69e03dd40
Reviewed-by: Martin Smith <martin.smith@digia.com>
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
On Android the foreground activity can get intents
with onNewIntent. Those intents can not be received
in any other way. This is especially true in Android nfc.
This patch adds a way to receive those intents in Qt.
This patch heavily leans on the implementation of onActivityResult.
Change-Id: Ic4dca301f34afe9a528149c3653e545ed3265a3c
Reviewed-by: BogDan Vatra <bogdan@kde.org>
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
This is like value(), but returns an iterator instead of the value().
[ChangeLog][QtCore][QAssociativeIterable] Added find().
Change-Id: I029fc8f91cef78f718d419587a2a50ffd2bf7632
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
QtCore now builds with no -Wnoexcept warnings
(that doesn't mean there aren't tons of functions
that should be marked noexcept, just that all
conditionally noexcept functions aren't noexcept(false)
just because of a forgotten noexcept elsewhere).
Change-Id: I10dacb6b9c9d41d3595fe2f306356d62d3d91c76
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This leaves the decision on whether to do unaligned stores to the
compiler, as opposed to forcing it by ourselves.
Since we're now implementing them using two calls, this invalidates the
compiler bug that triggered the #ifdef for Sun Studio (whatever that bug
was).
Change-Id: I4e494ca860a15b9427b2a3000921bf5d92cbb5ef
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Commit 1259c5768e410361bcd8b5cf0c2057a2ebabda83 in qtdeclarative removed the
ability to create QWidgets in QML by giving them the correct parent, which
requires calling QWidget::setParent instead of QObject::setParent. This patch
introduces a hook that will allow QtQml to give widgets a proper parent.
Change-Id: I84c57ca5032582c43e405219343d55ac9cf2ffa0
Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
Silence the MSVC warning that got introduced in commit 62b752b3a2:
warning C4333: '>>' : right shift by too large amount, data loss
qdebug.cpp(316) : see reference to function template instantiation 'void putEscapedString<uchar>(QTextStreamPrivate *,const Char *,int,bool)' being compiled
with
[
Char=uchar
]
qdebug.cpp(270) : warning C4333: '>>' : right shift by too large amount, data loss
Change-Id: If1ee20b741feae3287a8d6a11c202b4296d429fb
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Most of the QIODevice functions already have a locally cached
"sequential" flag. Make the rest of them follow this strategy.
This eliminates the need to use private caching members.
Change-Id: I0edb2c9b7c5f411c5bee25c425e7b40e3c9021d3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: hjk <hjk@theqtcompany.com>
On some Android devices, the realpath() implementation will return
the full path even if the path does not exist. This breaks the
expectation of the canonical path, which should be empty for
nonexistent paths. A few autotests failed due to this.
To work around it, we query existence before getting the
canonical path.
[ChangeLog][Android] Fixed canonical path for nonexistent paths on
some devices.
Change-Id: I5c1dabb8b8394694bc74d2a91912800aaff6b9e3
Task-number: QTBUG-43705
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Since the former is monotonic and we need a monotonic timer here.
Change-Id: I34325da4fe0317e12f64629a6eef6a80990c3e1a
Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Signed integer overflow is undefined behavior ([expr]/4),
but unsigned arithmetic doesn't overflow, so isn't
([basic.fundamental]/4, footnote there).
So, use unsigned arithmetic for the loop-around serial
number generation in incrementserial(). While we're at
it, also use it for the masking operation in the same
function.
Found by UBSan.
Change-Id: I500fae9d80fd3f6e39d06e79a53d271b82ea8df8
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>