This is the first step in implementing an in-place conversion of QString
to QByteArray. This requires ref-qualifiers in member functions so we
know that we have an rvalue QString.
Converting from UTF-16 to Latin1 always requires half the memory.
For conversion from UTF-16 to UTF-8, the typical string will also need
the same memory or less: characters from U+0000 to U+007F consume one
fewer byte; characters from U+0080 to U+07FF and from U+10000 to
U+1FFFFF occupy the same space in UTF-8 and UTF-16; it's only the ones
from U+0800 to U+FFFF that consume more space in the UTF-8 string.
For the locale's 8-bit codec, we can't be sure and the code (currently)
needs to go through QTextCodec anyway.
This requires a #define set before #include'ing "qstring.h". However,
since qstring.h is included by the QtCore PCH, we need an extra qmake
compiler without the PCH flags to compile this .cpp.
After this change, the distribution of calls in QtCore, Network, Gui,
and Widgets is as follows:
const & &&
toUtf8 31 (74%) 11 (26%)
toLatin1 79 (77%) 24 (23%)
toLocal8Bit 26 (16%) 138 (84%)
Change-Id: Idd96f9ddb51b989bc59f6da50054dd10c953dd4f
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
The test used a member testWidget that was cleared and reset after each
test, which caused focus fights and side effects. The widget is now
created and shown only when necessary.
Change-Id: I0dc635e9d4cdf4f899994b88206bb0125526f6df
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Assume an unrelated class that declares an enum and uses Q_ENUMS. Consider
then a class that uses UnrelatedClass::Enum as a Q_PROPERTY. We used to
include UnrelatedClass in the primary class's related meta objects, in order
to support use-cases like
obj->setProperty("enumProperty", "ValueOfEnumAsString");
If however moc happens to see Q_DECLARE_METATYPE(UnrelatedClass::Enum), then it
would exclude it from the related meta objects, which would silently break the
string based enum value conversion. This was meant as an optimization, but it
isn't apparent to the developer why sometimes the string conversion would
work and sometimes not (depending on whether somebody declares that macro).
This also becomes visible in QML, which relies on the same embedded type
information for enum assignments.
This patch removes that check in moc's code generator and cleans up the code a
little. However always including the prefix of Q_PROPERTY(SomePrefix::Enum ...)
is not correct either, because it may be that SomePrefix is a namespace, which
would cause compilation issues. Therefore we limit the inclusion of related
meta objects only to Q_OBJECT decorated classes the moc has seen, and for these
we save the fully qualified name in the related meta objects array (for QTBUG-2151).
While this patch makes the previous workaround for namespace issues by using a
Q_DECLARE_METATYPE not workable anymore, by saving the fully qualified name we
are making a hopefully sufficient effort to not require a workaround in the
first place. There's always the new workaround of fully qualifying the type in
Q_PROPERTY.
One side-effect of this change is that in the autoPropertyMetaTypeRegistration
test of tst_moc, the CustomQObject for Q_PROPERTY(CustomQObject::Number
enumValue ...) is now a related meta object, and therefore when querying for
the type of this property via QMetaProperty::userType(), we are now aware of
this being an enum and try to resolve CustomQObject::Number via
QMetaType::type(qualfiedName). As there is no guarantee for this to succeed, we
must now also do what is done in the non-enum code path in ::userType(), which
is to call the moc generated type registration function.
Task-number: QTBUG-33577
Task-number: QTBUG-2151
Change-Id: Ibf20e7421cba464c558a25c76a7e1eef002c6cff
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This patch removes the activaton aand deactivation of a window when we get the window group
activated event from the navigator. This event is sent to both the primary and secondary screen
and does not state if a window should be active from a Qt perspective.
A window should only be active if it has screen keyboard focus.
Change-Id: Ibbed0dd76a21d86f4b580265f996357a8eef5192
Reviewed-by: Roger Maclean <rmaclean@qnx.com>
Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com>
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
Based a recent problem where one property of QPen was not properly copied
to QPainterPathStroke, I believe we should add a method to automatically
create a QPainterPathStroke based on all the relevant information in a QPen.
This patch adds a constructor that automatically does so.
Change-Id: Id2849b36426f2e3b06b4b508292063a0917ca61c
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Even though it is not really part of the angle implementation, having it
in source is more consistent with the rest of Qt and makes browsing the
code easier.
There was also an issue, that only a debug build was done when calling
nmake or jom. While moving the implementation this issue was fixed by
including config.pri to d3dcompiler's .pro file.
Change-Id: I3e3630865c94adbe1a1f1af2ccfc2bcb046002a8
Reviewed-by: Andrew Knight <andrew.knight@digia.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
[ChangeLog][QtWidgets][QLineEdit] A blinking cursor in the middle
over horizontally centered placeholder text looks bad. Thus,
horizontally centered content is now considered as an exception
and the placeholder text is hidden when the line edit is focused.
Task-number: QTBUG-31669
Change-Id: I17aa1e6656673f81545a8437f90814b188ad484a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
The default values for PCH, the -ZW switch, and CharacterSet aren't
ideal for WinRT projects, so adjust these accordingly.
Task-number: QTBUG-35328
Change-Id: I78021d0785fa84e15b1f17264daa599a9418f92e
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@digia.com>
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
tst_QObject is getting big, so make a separate test for QSignalBlocker,
but leave parts of signalsBlocked() in tst_QObject as that seemed to
have been the only check for blockSignals(true) actually blocking signal
emission.
Change-Id: I1cfac035e0e39203eea8626d43f316cc6244ee86
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
When QSignalBlocker was reviewed, move semantics were asked for.
This patch add them.
This makes QSignalBlocker usable as a by-value argument (to transfer
control of signal blocking into a function) as well as as a return
value (to transfer control of signal blocking out of a function).
Change-Id: I714aa2a283bb33dba76e860649e88ed202e913c5
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This feature was never completely implemented. Sure, it's nice to
build the SSE2 + SSSE3 code with the VEX prefix, which results in
better code. But the leap isn't that big anyway.
This is the first step to removing the runtime detection for the
drawhelpers. They create timebombs when we use inline functions.
Task-number: QTBUG-30440
Change-Id: Ic53b2cf5261106a1c940d4a36eb6111b7d998be1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
The new atomic code was introduced in Qt 5.0. The platforms that did not
get ported were announced as deprecated in Qt 5.2. The code is now
removed in Qt 5.3.
The status for the platform/compiler/OS combinations affected is:
* Linux with GCC or Clang: still compiles on all platforms
(via qatomic_cxx11.h or qatomic_gcc.h)
* INTEGRITY with Green Hills compiler: no longer compiles
* Solaris on UltraSPARC, with Sun Studio: no longer compiles
* AIX on POWER5 or 6, with IBM Visual Age: no longer compiles
(probably did not compile Qt 5.0 either)
* VxWorks in kernel mode: no longer compiles
[ChangeLog][General] Support for the following platforms has been
removed, due to lack of interest in updating support: INTEGRITY,
VxWorks, Solaris on UltraSPARC (with the Sun Studio compiler suite), AIX
on POWER processors (with IBM Visual Age compiler suite).
Change-Id: I8a961385fd95011c016b2b1eec52034794dae3e1
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
The locations of UI assets are deployed to is being added as a read-only
location under DataLocation.
As such a path is located differently on certain mobile platforms, such
as Android and BlackBerry, having an entry in StandardPaths will make it
easier to write cross-platform code.
Change-Id: I4533c90ed7157725a8604591595b350c7f616723
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: David Faure <david.faure@kdab.com>
Press and hold is an interaction available on many platforms,
particularly when touch is involved. In Qt Quick this is exposed to the
user via MouseArea::onPressAndHold. This value should not be hard-coded,
but rather use a platform-specified default. This commit adds the
low-level hooks necessary for that to happen.
Task-number: QTBUG-24793
Change-Id: I621a8ac9de66b881e34336228056bffbb6306a70
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
the respective code was removed in 375edf7
Change-Id: Ie31ef4bc8970b5396f50f1c4963f378df816242a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
For MacOS 10.6 the exported symbols must be the same regardless of
debug/release configuration, because for debug builds it will by
default link to a release library.
We therefore cannot let some exported symbols depend on if QT_DEBUG
is defined or not. We therefore introduce QGRIDLAYOUTENGINE_DEBUG,
which is independent of debug/release configuration.
The whole dump() function concept should probably be revisited, but
I don't want to clutter this commit too much with such unrelated
things.
Change-Id: I7086f31e2c36fe22ce9c9a3eda37ea25302459a9
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
This is not an attempt to complete this API, but rather preventing code
like !(a==b) being used every time timespec structs are compared for
unequality.
Change-Id: I0edf3fd3c44a9350208adc6b3fb5fe8aec370a45
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
They're now required as per the documentation. They should have been
present when this was created...
Change-Id: If52bc91e942306ef0fa7b1b41b739d897c9a1ea1
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
It's still a relocation, but at least it can be marked read-only
after the relocation run, if indeed the dynamic linker goes to
such a length.
Change-Id: Ibadddac3ab99d2e58cc32cfd57311bddd3bdb0ef
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
d3dcompiler_qt is a DLL for use with ANGLE which replaces d3dcompiler_XX
at runtime to proxy shader compilation calls. This is useful for:
- Loading the newest D3D compiler DLL found, instead of loading the
version specified when Qt was compiled
- Reporting better debug information when the compiler cannot be loaded
- Caching shader blobs for later use
- Returning cached shader blobs
- Deferring compilation to another mechanism, such as a D3D compilation
service running on a host debugging machine *
The above use cases are especially important for Windows Store apps, as
they are not allowed to ship the d3dcompiler. On Windows Phone, where
there is no runtime compiler, this is essential for handling QtQuick apps
which require runtime shader compilation.
* This requires a separate service which monitors a directory for shader
source files, compiles these files into D3D bytecode, and places
the bytecode in the qtd3dcompiler cache directory. This directory is
monitored by qtd3dcompiler, which is then able to then load the blob.
Change-Id: I9889c8d66d2ddbe5a7a1dc44bfe5d8ad229b0e43
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This fixes a missing declaration caused by 11a2226c
Change-Id: I4b8092c6b9592e886353af9193686238105a1512
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@digia.com>
If the default compiler cannot be found, load it from a list of DLL names.
On Desktop Windows, the default compiler can be specified by an
environment variable, QT_D3DCOMPILER_DLL. This can also be set at
compile time by a define of the same name. Otherwise, the default
compiler DLL is that which is set by the Direct3D SDK.
On WinRT, the default compiler is d3dcompiler_qt, which is a
non-versioned compiler proxy provided by Qt.
Change-Id: I0d7a8a8a36cc571836f8fa59ea14513b9b19c19b
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@digia.com>
QDirIterator::next() returns QDirIterator::filePath(), which returns
QFileInfo::filePath() on a default-constructed QFileInfo. That
specifically returns a non-null QString for some reason. I don't know
why but I won't change it.
Task-number: QTBUG-35422
Change-Id: I6bbcf8b83153e44c36d6320d27ce223ef28503ba
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
At least with GCC, the use of cmpxchg8b in inline assembly is
unreliable. The instruction requires 5 registers to be used and
sometimes GCC complains that it runs out of them.
qatomic_x86.h:424:33: error: can’t find a register in class ‘GENERAL_REGS’ while reloading ‘asm’
qatomic_x86.h:424:33: error: ‘asm’ operand has impossible constraints
Change-Id: Ie5414f3bccc6e559c7eec93beabe8663ab40271f
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This got messed up in merge 4a8273a6fc
thanks to automatic conflict resolution.
Change-Id: Idbe1545c7d3ee0580bf2c1381dd3e8b2191dc3e8
Reviewed-by: Michael Brasser <michael.brasser@live.com>
While QHostInfo and QNetworkInterface are implemented,
socket implementation is just a stub for now. Having
stub implementation is preferable over not having them
at all is because most applications will not build, if
sockets are not available. Even though they do not
do anything useful yet, applications can be compiled
and run to get an idea how network will work on WinRT.
Change-Id: I78ea88901a30280d4098b75ef7398c2628dd19c8
Reviewed-by: Andrew Knight <andrew.knight@digia.com>
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@digia.com>
Otherwise build will be broken due to no support for it.
Change-Id: If5ccd7fbcf8340600c5b12081ac4f7e2c6b420fd
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
It's unexpected that all messages generated by the stream version
of qDebug and friends have a trailing space. It also makes switching
to categorized logging (which only supports the stream version) difficult,
since all autotests checking for debug output would have to be adapted.
Task-number: QTBUG-15256
Change-Id: I8d627a8379dc273d9689f5611184f03607b73823
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The abstractions are needed so that they can work with both
QGraphicsLayouts and QtQuick.Layouts.
Since the plan is to move the engine to QtGui, this means that the
engine cannot have any references to anything in the QtWidgets module.
As a consequence of that several things had to be done:
* The style info object had to be redone with an abstraction layer
to get rid of style and widget dependency. (Abstract class is
called QAbstractLayoutStyleInfo)
* QGridLayoutEngine must be subclassed due to some specializations for
QGraphicsLayoutItem, manifested as QGraphicsGridLayoutEngine.
* QGridLayoutItem must be subclassed due to some specializations for
QGraphicsLayoutItem, manifested as QGraphicsGridLayoutEngineItem.
Did also some minor cleanups, reordered arguments so that all styleInfo
arguments are last in all function calls
This also fixes QTBUG-35099 (bug was spotted during this refactoring)
Task-number: QTBUG-35099
Change-Id: If49d40f71870dc8d99d2e145be158e3080b595fa
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
When the window is requested to be made active then it should check if
the window accepts focus or not. If it does not then it should ensure
it informs the underlying system that it does not accept the activate
event.
Change-Id: I3e6533be792d8bdbb2bfcdf3b9c1a93e2c67c75a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
The definition and usage of QNativeGestureEvent had already been
protected against QT_NO_GESTURES but the implementation had been missed
out before.
Change-Id: Ie039e08257ad5eb7705342e4248b904f6ceca8df
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
(same thing for center- and delimiter-aligned tabs)
The width of the inline object wasn't taken into account, the code in
QTextEngine::calculateTabWidth only looked at glyph widths.
Change-Id: I303a6561c67870ff2094a685698e642fc1b53b12
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Change highp to mediump. This qualifier is ignored on desktop, and
mediump should be sufficient elsewhere.
Task-number: QTBUG-35353
Change-Id: I79f0ed88717d45dada5dcb781e75b10e72db4bd0
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Moved qdoc and image file to correct qdoc folder.
Added brief and ingroup statements to books.qdoc.
Task-number: QTBUG-34749
Change-Id: I5806ffd6f116cccf10238e3e1a9fc627ad0e93a9
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
Otherwise Xcode might choose to use libc++, eg when the deployment target
is iOS7, and this doesn't work when Qt itself was built using libstdc++.
Change-Id: I0b0f36666ed318be9aae87ebaeb0d344109566ac
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
The functions fromBytesToWord() and fromWordToBytes() are called when
building on 64bit BigEndian platforms. It fails because those
functions are disabled on the source code. Enabling those functions for
64bit BigEndian platforms fixes the problem.
Task-number: QTBUG-35228
Change-Id: I5ccacd4fb5051df05f67c8da879b3a9e49953861
Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Richard J. Moore <rich@kde.org>
During show() of a QAbstractScrollArea we might get resize events, which
results in laying out the children of the scroll area. One of these
children are the scrollbars, and raising them to the top means creating
them, which in turn means creating all parents, including the abstract
scroll area itself. Creating the abstract scroll area means creating
a platform window, which might send synchronous resize events as a
result of creating the window, and we end up recursing.
Change-Id: I1a2813f03091d6c42e51834315835551cb2fd621
Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
As stated in commit 46106c4, placeholder text should not be shown
when an empty QLineEdit has visual preedit text fed by a composing
input method. The same condition applies to setPlaceholderText() in
the sense that there is no need to call update() when the placeholder
text is not even shown.
Change-Id: I2521a119b160e16ae0738d3575fea6d9939d6d2a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Tasuku Suzuki <stasuku@gmail.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
If a platform window is created from a QWindow without setting a valid
size or position on the QWindow, the platform window is expected to
apply sane defaults. We use the baseclass initialGeometry() function
for this, similar to other platform plugins.
The default geometry unless otherwise set and/or calculated based on
size hints is that of the screen's available geometry.
An improvement to this is to detect whenever we apply the screen
geometry, and also apply the appropriate window state, but that
needs more testing.
Change-Id: I02b12064ce6d55c04fe0cc2cd1d2816ca1113f40
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
When sending expose events to Qt, Qt will ask us if we're exposed,
and we need to tell it that we're not, so that clients will not try
to makeCurrent on a CA layer that has a zero width and/or height.
Note that this only works because we flush expose events.
Change-Id: Idfbe03a2f35681084061376a3c650a8da027fda4
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Make QJsonObject::const_iterator() part of the same doc
group as the non-const variant. Also add a \since
command with the correct value.
Task-number: QTBUG-33052
Change-Id: I97fa2cc44dae93decf2b99a1384e37579b7dac46
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>