Commit Graph

4389 Commits

Author SHA1 Message Date
João Abecasis
e92e5fda44 Migrate QString over to QArrayData
Change-Id: Ieadc60523a2bef61a088920576c65c720b11bfb9
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-04-24 13:51:37 +02:00
Thiago Macieira
f02e1d6d8e Move QGestureEventPrivate's content to the main class
QEvent now checks that the d pointer is unused.

Change-Id: Ib0aa97d1692ea55324c4c6f133ffdd5a221f1680
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-04-23 23:26:44 +02:00
Thiago Macieira
d631c31235 Make QStringLiteral and QByteArrayLiteral always return the real types
Up until now, the macros would return an internal type that contained
the pointer to the data. This breaks code that tried to use the macros
with operators, like QStringBuilder but also when writing:

     QStringList() << QStringLiteral("a") << QStringLiteral("b");

This change seems to work fine now and I can also verify that this
works:

     const auto str = QStringLiteral("Hello");

Even though it creates a QString, which is non-POD and non-constexpr.

Change-Id: Iaf82af9bea4245513a1128ea54f9d2d3d785fb09
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
2012-04-23 23:26:28 +02:00
Thiago Macieira
80ad5938ea Stop using QEventPrivate::d in QWindowStateChangeEvent
We can add a boolean and avoid using the d pointer (which QEvent now
checks to be unused).

Change-Id: I7367d5410d10ed06441fe9037cac0e3473d62498
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2012-04-20 10:50:28 +02:00
Kai Koehne
d9a1c2dff8 Logging: Change arguments of message handler to avoid conversions
Introduce a new QtMessageHandler that takes QString instead of
char *: This avoids converting to local8bit , only to convert it back
to utf16 for Windows.

The old QMessageHandler is kept for a transition period, but will
be removed before Qt 5.0.

Also fix qEmergencyOut (that is called in OOM situations) to not rely
on the default message handler.

Change-Id: Iee0ce5838f97175c98788b847964273dd22d4a37
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-04-20 08:37:06 +02:00
Thiago Macieira
a3f90fd44f Remove private classes in QEvent-derived classes.
QEventPrivate doesn't exist, so these classes were technically abusing
the d pointer.

Move the contents of the private classes into the main event classes.

Change-Id: If2e894c1fa05f468221a0b43f3ebdf90769298eb
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-04-19 23:42:26 +02:00
Thiago Macieira
275945f144 Add an assertion to deleteLater() before it modifies QEvent::d
The deferred deletion functionality stores the event loop level
nesting count in the QEvent d pointer. In Qt 4, this d pointer was
not usable because we forgot to add a proper copy constructor and
assignment operator to it, so the deleteLater() process stored the
count here safely.

Since Qt 5 now has non-implicit copy methods, the d pointer could be
used in the future. If QEvent uses it, this assertion will
trigger. Note that it doesn't apply to classes derived from QEvent,
though.

Change-Id: I8600c8e9379921e32aca166bc0a6c0b4c4ed799f
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2012-04-19 12:14:30 +02:00
Jędrzej Nowacki
ff55d64f67 Remove QVariant constructor taking Qt::GlobalColor.
The constructor is wrong, it creates instance of QVariant encapsulating
a QColor instance. QVariant should not implicitly convert data, never.

Change-Id: Idc794ecdecb42d8b53fee3f993bf51ddd43f595d
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-04-19 10:09:39 +02:00
Girish Ramakrishnan
10c88faf79 api: remove QWindow::visible()
The correct api is QWindow::isVisible(). Removing the api
is safe since QWindow is not even released yet.

Only qtdeclarative needed to be fixed with
71c8fe296fe5aa7e79033dd8f5b539852d4276e0.

Change-Id: Ie571ed4802fe89132419e402acdb854446f4578f
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
2012-04-18 21:24:25 +02:00
Girish Ramakrishnan
21102a71ff api: QGuiApplication::inputMethod should be static
Pretty much all methods in QGuiApplication are static.

Also adds documentation.

Change-Id: I96808dd266922432b92fe3962292e4d5b6a8ab46
Reviewed-by: Pekka Vuorela <pekka.ta.vuorela@nokia.com>
2012-04-18 15:11:13 +02:00
Jędrzej Nowacki
9ecce11261 Remove redundant check in QMetaType::typeInfo
The check was introduced when void was not a fully defined type.

Change-Id: I4df8607999436f8db92be77fc8fd203fc66c2816
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-04-18 12:16:20 +02:00
Jędrzej Nowacki
ab0bcd0792 Remove redundant checks in QVariant.
QVariant and QMetaType have aligned type naming implementation.

Change-Id: I9eaae1045c492c148e3e9d23f4e04d48272f7ec2
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-04-18 12:16:09 +02:00
Jędrzej Nowacki
6f0065944d Hide QTypeModuleInfo in a private namespace.
The class is private and shouldn't pollute global namespace.

Change-Id: Ib44473fd72e5a70096eeff1662e88b29263d19c6
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2012-04-18 12:15:52 +02:00
Sergio Ahumada
16b53b2f0e Merge "Merge remote-tracking branch 'origin/master' into api_changes" into refs/staging/api_changes 2012-04-17 10:38:24 +02:00
Girish Ramakrishnan
2c13dc7482 api: remove QWindow::move
QWindow::setPos is the correct api.

Change-Id: I5439338e9bc6933800d66331f20ce554b017c4fb
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
2012-04-17 06:19:52 +02:00
Girish Ramakrishnan
f285356e88 api: Fix const correctness of api in QScreen
const was missing in many convenience functions.

grabWindow should not be const since it actually does something.

Change-Id: I0ffa718878d4251c4fb5c34789cf58ebb85cff37
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
2012-04-17 06:19:49 +02:00
Girish Ramakrishnan
6094197294 api: Make QGuiApplication::styleHints() static
Practically all functions in QGuiApplication are static.

Change-Id: I5948620865c021029a3c04b31901b1110e6c0d27
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
2012-04-17 06:19:47 +02:00
João Abecasis
76d61af1e2 Make reallocData use QArrayData::AllocationOptions
Growth computations are deferred to QArrayData::allocate, except in the
case of realloc as that functionality is currently lacking in
QArrayData. Since that sits in library code, anyway, it can be changed
later to use a future QArrayData::reallocate.

As it is, reallocData is becoming a model for QArrayData::reallocate
and what it can offer to containers of POD/movable types.

Change-Id: I045483f729114be43e4818149d1be1b333bcbe13
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-04-16 15:51:20 +02:00
João Abecasis
3111e6d6fa Drop unnecessary assignment
In this branch, !IS_RAW_DATA has already established that offset is
sizeof(QByteArrayData) and realloc maintains the assumption.

Change-Id: Ic160e36d7781d4c4f64a3b2ebec98c9cb605b3eb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
2012-04-16 15:51:14 +02:00
Jędrzej Nowacki
d1f5a85e66 Migrate QByteArray over QArrayData.
For the time being QByteArrayData keeps its independent existence, for
the sake of other modules. Once they have been ported to use the new
initializer macros it can be changed to:

    struct QByteArrayData { QArrayData array; };

Extra braces can then be added to the macros.

With respect to source compatibility, the only concern is with other
modules, as QByteArrayData has already changed in incompatible ways with
Qt 4.x

Done-with: João Abecasis
Change-Id: I044e2a680317431777a098feec8839a90a3d3da3
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-04-16 15:51:06 +02:00
João Abecasis
78b780b9a1 Remove explicit checks for shared_null/empty
This eases porting to QArrayData and retains semantics. In append() and
prepend() a conditional was generalized so that no work is done if there
is nothing to add.

Done-with: Jędrzej Nowacki
Change-Id: Ib9e7bb572801b2434fa040cde2bf66dacf595f22
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
2012-04-16 15:50:59 +02:00
João Abecasis
2ac4c463af Make QByteArray and QString keep track of terminating null
In conceptual terms, this change increments the Data::alloc member by
one for all strings allocated and maintained by these classes. Instances
initialized with fromRawData retain 0 as the member value, so they are
treated as immutable.

This brings QByteArray and QString closer to QVector, making it possible
for them to reference and share the same data in memory, in the future.
It also brings them closer to QArrayData.

In practical terms all comparisons to the alloc member were changed to
take into account that it also tracks the terminating null character.

Aside from the increment in the alloc member, there should be no user
visible changes.

Change-Id: I618f49022a9b1845754500c8f8706c72a68b9c7d
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-04-16 15:50:53 +02:00
Lars Knoll
9bd0323551 Merge remote-tracking branch 'origin/master' into api_changes
Conflicts:
	configure
	src/corelib/io/qurl.cpp
	src/gui/kernel/qwindow.cpp
	src/tools/moc/generator.cpp
	src/widgets/kernel/qwidget_qpa.cpp
	src/widgets/styles/qstyle.h
	src/widgets/widgets/qtabbar.cpp
	tests/auto/corelib/codecs/utf8/tst_utf8.cpp

Change-Id: Ia457228d6f684ec8184e13e8fcc9d25857b1751e
2012-04-16 12:04:34 +02:00
Stephen Kelly
77fd8fd997 Show the type and address of QObjects in debug output.
Change-Id: I9f44ab80a6fb763adc9cbaf47de8e1b97212332d
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
2012-04-16 11:35:44 +02:00
Girish Ramakrishnan
41673c45dd qmenu.h includes private headers
qpa includes are considered private and should not be included
in public header files.

Change-Id: I26c744ec1d8ddef7b0c11c3d26b593be05f5aa54
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-04-16 07:31:37 +02:00
Girish Ramakrishnan
d037d25c3d api: fix constness of QOpenGLContext::getProcAddress
Should be const just like Qt4's QGLContext::getProcAddress.

Change-Id: I273467d5cf852cd49f48cec3f335c4ddac795363
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
2012-04-16 04:21:49 +02:00
Sean Harmer
f609035fc1 Adding support for obtaining an OpenGL Core Profile context on Mac OSX
Change-Id: I08048ecee9b243b122ee93fce316e498aa7e2d51
Reviewed-by: James Turner <james.turner@kdab.com>
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
2012-04-16 03:10:22 +02:00
Pasi Matilainen
b3670edba4 Fix incorrect state of show/hide menu items in Mac application menu
The "Hide <app>", "Hide Others" and "Show All" menu items in Mac
application menu are always enabled, and do not get disabled correctly.
Fix by turning on autoenable for the menu in qt_menu.nib, and by
implementing menu item validation in QCocoaMenuLoader.

Task-number: QTBUG-10705
Change-Id: Ic181dfa26a71acad0067f5269c72517b50b17362
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
(cherry picked from commit 8f23a6be1069455e609e8bea7527726c24bebb36)
2012-04-16 03:10:22 +02:00
Olivier Goffart
d2090e19a9 moc: Fix parsing of the empty preprocessor command
When encountering a null preprocessing directive (which is supposed to
be ignored), the moc preprocessor will leave a PP_NEWLINE token in the
token stream. That will confuse the parser.
The PP_NEWLINE token need to be ignored in the preprocessing phase.

Task-number: QTBUG-22717
Change-Id: I1e502a7e5bc6fa8ce2f82109ba7199b95747ff0a
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2012-04-16 00:54:19 +02:00
Thiago Macieira
f18a6c5fb5 Update com.trolltech -> org.qtproject in the bootstrapped tools
The tools will now generate the new org.qtproject annotations only,
matching the XML generator in the library. They accept both types of
annotations as input though -- and will generate a warning about the
older one.

This commit should be backported to Qt 4, so XML files can start to be
ported.

Task-number: QTBUG-23274
Change-Id: If298c342ab4774cbca1be1898a01af8b46e80446
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Reviewed-by: Lorn Potter <lorn.potter@nokia.com>
2012-04-16 00:08:13 +02:00
Thiago Macieira
e12c34b244 Introduce the new UnknownProperty and PropertyReadOnly errors
Those error codes have been standardised for years but we haven't used
them until now.

Task-number: QTBUG-23274
Change-Id: Iebc9ded949f363281a4d43fd9d29a284f2e2df08
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Reviewed-by: Lorn Potter <lorn.potter@nokia.com>
2012-04-16 00:07:49 +02:00
Thiago Macieira
e02a144a3c Finish cleaning up com.trolltech -> org.qtproject in QtDBus
Lots of uses of the annotations and error names, plus a bunch of local
unit test names (including one file that had to be renamed).

The meta object generator is updated to support both the old and new
names. That means some references to com.trolltech *must* remain in the
source code.

Task-number: QTBUG-23274
Change-Id: Icc38ae040232f07c437e7546ee744a4703f41726
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
Reviewed-by: Lorn Potter <lorn.potter@nokia.com>
2012-04-16 00:07:39 +02:00
Thiago Macieira
65e75acd05 Update the error codes in QtDBus
Change the old com.trolltech ones to org.qtproject and introduce Use
the alternate domain name for the Qt Project because the dash
character is not valid in interface and error names.

Task-number: QTBUG-23274
Change-Id: Iac1699e70525d67f983c10560932acff6b2ecde6
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
2012-04-16 00:07:25 +02:00
Holger Hans Peter Freyther
83fc52e3b4 widgets: Fix painting to a fully transparent top level widget
QWS used to have a line to change the composite mode from SourceOver
to Source for the top level widget. This wasn't used with QPA and I
removed the internal DontSetCompositionMode in qtbase. It turns out that
the QWS way is the most efficient one to initialize the background of
the widget.

The alternative is to have the QPlatformBackingStore::beginPaint
always clear the entire to be painted area and then paint the background
of the widget. The difference of painting each pixel once or twice is
noticable on embedded platforms and in the range of one to two fps.

Reproduce the issue with:
echo "QWidget {background: transparent}" > style.css
./examples/widgets/wiggly/wiggly -stylesheet style.css

Task-number: QTBUG-24526
Change-Id: Ica4c980bb3bf6eb87ddb5b510ac7493292d01543
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
2012-04-15 06:14:00 +02:00
ABBAPOH
5cb2fbe088 Now QSplitter can have 0-pixel handle
Change-Id: Iad920ffcd5d7f4c01504d41d1740f130b7aa53dd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
2012-04-15 03:53:07 +02:00
Konstantin Ritt
73b24486ed UCD-5.0: apply Corrigendum #6
http://unicode.org/versions/corrigendum6.html:
> in Unicode 5.0, the list of characters with the Bidi_Mirrored property
> was made consistent for brackets and quotation marks, in preparation for
> new constraints on bidi mirroring. However, after publication of
> Unicode 5.0.0 it was discovered that this change adversely affected
> several quotation mark characters in deployed data.

Task-number: QTBUG-25169
Change-Id: Id49caf401af2d5a1e6dbcc32b2f350aa20b7f901
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-04-15 03:53:07 +02:00
Samuel Rødal
d357b74493 Fixed broken logic in evdev input plugins.
If we do multiple reads we need to accumulate the total amount of bytes
read, instead of just taking the last read amount into account.

Change-Id: Iaa9b90c269f3ed9d09dae67452ca816d9db6217f
Reviewed-by: Johannes Zellner <johannes.zellner@nokia.com>
Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com>
2012-04-15 01:41:45 +02:00
Girish Ramakrishnan
a9a1bf3359 Fold qpaintdevice_qpa.cpp into qpaintdevice.cpp
Change-Id: I274508826b9be4eb00f67fccae5a18ecbdf41a36
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
2012-04-15 01:39:54 +02:00
Girish Ramakrishnan
763de6965c Fix header inclusion guard
Change-Id: Icc537d5b52315b9563078da9fa69ddd67b567f76
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
2012-04-15 01:39:33 +02:00
Girish Ramakrishnan
033eff02fe doc: QWindowSurface is dead
It goes by the name of QBackingStore these days.

Change-Id: Id46254e47ee0abf9e669862eec6c2205d9634368
Reviewed-by: Holger Freyther <holger+qt@freyther.de>
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
2012-04-14 19:46:32 +02:00
Casper van Donderen
48e092574a QDoc: add missing newline characters in qdoc -help.
Change-Id: Ibd50091693be393c6b479d6ca8927ba1ed578709
Reviewed-by: Martin Smith <martin.smith@nokia.com>
2012-04-14 19:46:09 +02:00
Martin Smith
aabd54b8bb qdoc: Fixed bugs causing invalid DITA XML
Fixed a bug in qdoc that caused too many end elements to be generated.
Also fixed some doc errors that caused invalid DITA to be generated.

Task nr: QTBUG-25302

Change-Id: Ifbbf457d28c51c2691a252888447739da7713bc9
Reviewed-by: Martin Smith <martin.smith@nokia.com>
Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
2012-04-14 19:46:00 +02:00
Giuseppe D'Angelo
c01eaa4382 QHash security fix (2/2): enable QHash random seed
Algorithmic complexity attacks against hash tables have been known
since 2003 (cf. [1, 2]), and they have been left unpatched for years
until the 2011 attacks [3] against many libraries /
(reference) implementations of programming languages.

This patch makes qHash use the QHash seed introduced in the
previous commits, thus truly randomizing bucketing in QHash.

[1] http://www.cs.rice.edu/~scrosby/hash/CrosbyWallach_UsenixSec2003.pdf
[2] http://perldoc.perl.org/perlsec.html#Algorithmic-Complexity-Attacks
[3] http://www.ocert.org/advisories/ocert-2011-003.html

Task-number: QTBUG-23529
Change-Id: Ibee9cf6aa820af5d777fcde478647665c728052a
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
2012-04-14 17:59:26 +02:00
Giuseppe D'Angelo
c2293c897c QHash: remove optimization for QHash<int, T>
QHash employs an optimization for int/uints, squashing the hash
value and the key value inside an union. This obviously works
iff qHash(int k) = k. If the hash value gets salted, the hash
table is corrupted.

This patch removes that optimization by means of a #if 0,
so if further research finds out that we want those 4 bytes back
it's pretty simple to revert.

Change-Id: If273f0bf2ff007f4f2f7c46d2aab364a3b455cf1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-04-14 15:49:16 +02:00
Giuseppe D'Angelo
a8ceb73b93 qHash: qHash(T*) two arguments support
Change-Id: I1b78914fe9c6ee9251d68af1f2e95f1e3e0f1db5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-04-14 13:50:54 +02:00
Giuseppe D'Angelo
67d7f55db6 qHash: two arguments support for simple integer types (and QChar)
Change-Id: I24bed73422fb1d2e90cf3dd4e5375e249b3dcac4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2012-04-14 13:50:33 +02:00
Frederik Gladhorn
eb52d31ddf Update accessibility selections in QTextControl.
Forwardport from Qt 4.

Change-Id: Iae0c2792b64b8ec2736a9ff621cf7c313a394093
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
(cherry picked from commit d5649547d641b9c5af3c3f814caf8e1ab5bf9f47)
2012-04-14 13:40:03 +02:00
Girish Ramakrishnan
d80b00f320 Fix header inclusion guards
_QPA_ should only be used for qpa (plugin specific api) files.

Change-Id: I1fb6cd5973fcabec4c7e87eb6ccb048f825e2aad
Reviewed-by: Holger Freyther <holger+qt@freyther.de>
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
2012-04-14 06:44:57 +02:00
Thorbjørn Lindeijer
06a5904c8f Removed QXmlStreamReader::readElementText overload
The version without argument was kept for binary compatibility when
the configurable ReadElementTextBehaviour was introduced. It is now
dropped in favour of using a default argument value.

Change-Id: Ic08c41d5a5aad9f22df7fc37a2d53ffbc6df1fe9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-04-14 03:53:46 +02:00
Mark Brand
cf52540dfb QTBUG-1363: fix QSqlField.length() for ODBC
Applied Bill King's suggestion in QTBUG-1363. Columns of
hStmt must be accessed in order.

Verified using ODBC driver on SQL Server 2005 on Windows 7.

Added test for length of text field for MS SQL Server over ODBC.

Task-Id: QTBUG-1363
Change-Id: I6673dafe75e3ef394d41e439adb45096c1421068
Reviewed-by: Bill King <bill.king@nokia.com>
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
2012-04-13 21:26:07 +02:00