Commit Graph

5084 Commits

Author SHA1 Message Date
Mark Brand
888fed8065 QSqlTableModel: use selectRow() for field and row edit strategies
Calling select refreshes the query data but disrupts view
navigation.

For OnFieldChange and OnRecordChange it makes sense to only
select the row in question. This does not disturb view navigation.

Assume disruption of view navigation is not a problem
for OnManualSubmit because the user or application decides
when submitAll is called.

Task-number: QTBUG-2875
Change-Id: I1e5f68668fb9102f6296d67d543e80daa403f1c4
Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
2012-03-07 00:01:32 +01:00
Mark Brand
291e2c7d54 QSqlTableModel: long live selectRow()!
Change-Id: If26dbcc8a1e8ef1376ef7a688c946ce5270e5706
Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
2012-03-07 00:01:22 +01:00
Mark Brand
b979956ec4 QSqlTableModel: handle changes between submit and select
Once an insert has been submitted, the cached record behaves like an
update. For row bookkeeping, we still have to remember that it was
originally inserted and is not in the query rows.

Between submitting a delete and selecting, we remove the values
from the deleted record. This causes a blank row to be displayed.
Read-only flag is set for cells in deleted row.

Reverting between submit and select means going back to the last
submitted values.

When removing rows, it's better to process from highest row numbers
to lowest. This avoids complications with higher rows shifting down
when lower rows are removed.

Change-Id: I8752fa11f7a1b88f2a71b9e03a020ac37e62487f
Reviewed-by: Honglei Zhang <honglei.zhang@nokia.com>
2012-03-07 00:01:07 +01:00
Giuseppe D'Angelo
d7b720dd3e QRegularExpression: const correctness fixes
Adding some const qualifiers to members which are never written.

Change-Id: Ibb8953764c7b7790a419a5d48f2956751d5fc1f9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-06 23:56:55 +01:00
Giuseppe D'Angelo
efcd4d9470 QRegularExpression: add captureCount()
QRegularExpression::captureCount() returns the number of
capturing groups inside the regular expression pattern.

Change-Id: Ib90ce67c67d06ab2966f0c98bd91da21defc156d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-06 23:56:14 +01:00
Giuseppe D'Angelo
1899861858 QRegularExpression: do not use JIT in debug builds
PCRE's JIT uses self-modifying code extensively, requiring full SMC
checks enabled by tools like valgrind, which slow down the execution
considerably; not enabling SMC checks lead to crashes.

Therefore, JIT is now disabled by default in debug builds of Qt.
Its usage (both in debug and release builds) can be controlled
by setting the QT_ENABLE_REGEXP_JIT environment variable.

Change-Id: Ib38952400e4219582942ce65ab9edcd89c432f3e
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-03-06 21:54:30 +01:00
Giuseppe D'Angelo
bd30234b59 QRegularExpression: improve operator==, add dedicated autotest
Trivial change: compare dpointers first, then the data.
Added test function for operator==.

Change-Id: I33ac64a59db4ccad56c30be17622187e42415f38
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-03-06 21:54:17 +01:00
Giuseppe D'Angelo
aea65cbaa4 QRegularExpression: QDebug support for pattern options
Added the proper QDebug operator to debug the
QRegularExpression::PatternOptions flags.

Change-Id: Icd00e93a0c6cc4345db528d494fc176624f7b7a2
Reviewed-by: hjk <qthjk@ovi.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-03-06 21:54:11 +01:00
Giuseppe D'Angelo
c7cb455a47 QRegularExpression: add QRegularExpression* set of classes
Added QRegularExpression, QRegularExpressionMatch and
QRegularExpressionMatchIterator as PCRE-enabled, regexp classes.
Documentation is included, as well as a first round of autotests.

Task-number: QTBUG-23489
Change-Id: Id47031b80602c913ccd2fd740070e3024ea06abc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-03-06 21:53:39 +01:00
Oswald Buddenhagen
4958c138a7 don't add bogus /mkspecs to QMAKE_MKSPECS
the project build root can of course be empty - if there is neither an
mkspecs/ nor a .qmake.cache - or no project in the first place (-query).

Change-Id: I9595b0b4ad80a9086dcd48c9ae62b3e8bd1b6f2f
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
2012-03-06 21:50:25 +01:00
Oswald Buddenhagen
092a270afd fix relative default examples path
copy&pasto ...

Change-Id: I73ab90f31f2a2250abe1ec9aeea975122ff319cb
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
2012-03-06 21:50:20 +01:00
Shane Kearns
c93f7b6948 Fix tst_QNetworkReply::httpWithNoCredentialUsage autotest
The test was testing the wrong thing, and passing even though
QNetworkRequest::AuthenticationReuseAttribute was not being
respected, until recently when I fixed username/password in URLs

Now the cache is properly bypassed when this attribute is set to
manual, and the autotest is updated to check this.

Change-Id: I87943515562d0b16b03504f0758ba265758d1c22
Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
2012-03-06 18:24:09 +01:00
Shane Kearns
299e7ffd6a Fix QNetworkReply ioGetFromHttpWithCache test case
Expiration date is calculated from max-age header when a response is
inserted into the cache. Because the test case is prepopulating the
cache outside of QNAM's control, the expiration date was uninitialised,
causing the test to fail.

This is due to a 2 year old change in QNAM, where max age calculation was
removed from cache retrieval, and more recent changes to QDateTime
where secsTo() returns 0 if one of the arguments is invalid.

Change-Id: Ieecd46123dde4ca0fd0be3ae79e70e1528ec02bc
Reviewed-by: Martin Petersson <Martin.Petersson@nokia.com>
2012-03-06 18:24:01 +01:00
Shane Kearns
2cf8e487a5 Windows - fix QWindowsSystemProxy global static race
Loser of the race would try to delete an uninitialised pointer

Task-number: QTBUG-15765
Change-Id: Ie184ee2306e102aa8fbad752ef09b95c3ede00c2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2012-03-06 18:21:31 +01:00
Thomas McGuire
11f9d18731 Fix finding specs in the unsupported/ directory.
The -spec argument was interpreted as a relative directory as
soon as it contained a slash. Fix this by checking if the
directory exists before attempting to interpret it.

Change-Id: Ide8f0418abc719b0be582d2d72642a141f6c6dea
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2012-03-06 17:47:46 +01:00
Joerg Bornemann
3ff7bc086b QProcess/Win: pointless Sleep call removed
Change-Id: I634c62d3a0f96bc074e815dfd4106b6187f4ba85
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2012-03-06 17:47:17 +01:00
Oswald Buddenhagen
1fc0e27b17 transitively resolve module dependencies
otherwise we need the nasty hack for includes, and CONFIGs and DEFINES
from dependencies are not included at all.

Change-Id: I7eaee761161a6e8fbac8e9237d26559aa11a88a1
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
2012-03-06 17:40:44 +01:00
Olivier Goffart
8bf6d6a6ca Don't use QMutexPool in QEventDispatcher
Use a QBasicMutex, there is no extra cost of having a mutex for this.

Change-Id: Ib5b01338649002c0c21f018b2c931a8cc68027f6
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2012-03-06 17:19:11 +01:00
Olivier Goffart
1e6514a714 Don't use QMutexPool from the animation framework
Use a plain QBasicMutex instead

Change-Id: I1abd35b4fe4e9f0401e73c7c3f503b00bba2baa9
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2012-03-06 17:19:04 +01:00
Olivier Goffart
38d566f713 Cleanup QThread::initialize and QThread::cleanup
The qt_global_mutexpool was private API deprecated long time ago.

And there is no reason to call qt_create_tls because it is called in
QThreadData::current that is called from the QObject constructor, even
before QCoreApplication::init can be called.

Change-Id: Idf3576d8591377811b727b12edc43dc898570ba4
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
2012-03-06 17:18:50 +01:00
Eskil Abrahamsen Blomfeldt
9f13a7d020 Make cache of opentype tables in Harfbuzz face lazy
The mechanism in fontconfig which determines if a certain character
is available (FcCharSetHasChar()) may give false positives, in which
case we would load and unload those fonts per every char for which
FC gave us a false positive. This was a major performance regression.
Specifically the false positives happened when looking at e.g.
italic variants of certain multilingual fonts, since we only check
the charset of the font family as a whole and not of the specific variant,
which may only support a subset of the chars.

To optimize this, we remove the deletion of the font engines after
loading them, but also wait with loading the opentype tables until
they are actually needed. This means that for the false positives,
we will load the font, but the cached data for each unused font will
be much smaller.

Change-Id: Idfc794401a2080da5946bf65204eb947aeb635ed
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-03-06 12:43:27 +01:00
Jędrzej Nowacki
e5dabe8338 Improve safeness of QMetaType::registerType.
This internal function is abused by some modules to create dynamic
types in metatype system. In Qt5 more non-optional arguments were added
to the function and to keep temporary source compatibility an overload
was created.

QMetaType code assumes that every known type has properly defined basic
operations like creation and destruction. Setting a helper function
pointer to null value is asking for a crash, because the code doesn't
check for that value, the null pointer may be called.

Change-Id: I5ca7454a70c308e01de26fab23481b3c94c22371
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2012-03-06 12:39:50 +01:00
Morten Johan Sorvig
930a90d978 Cocoa: Implement widget palettes.
Add roles to QPLatformTheme::Palette, map QWidget
subclasses to those. Port Qt4 widget palette creation
code to use the QPLatformTheme::Palette roles.

Palette entries are disabled in this commit, this
will be fixed later.

Change-Id: I07babe3d7c76d306efc4ea4813c7161fdf36227f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
2012-03-06 12:30:16 +01:00
Max Desyatov
9d5e721e96 escape *_script_file usages in MingwMakefileGenerator::writeObjectsPart
Task-number: QTBUG-24595
Change-Id: I1e78a6015247b9e41ae2b05b50fdedf0613f00f1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
2012-03-06 12:28:26 +01:00
Oswald Buddenhagen
52843c1988 de-duplicate feature and mkspec root candidate lists
Change-Id: I03f5b5903a133e5386b9ebef640ddbacdf3ebcd4
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
2012-03-06 12:28:18 +01:00
Shane Kearns
00821ec710 QSslCertificate - make lazy initialisation thread safe
QSslCertificate can be copied around into multiple threads,
without detaching. For example, the https worker threads inside
QNetworkAccessManager.
There are const methods, which lazily initialise members of
the private class without detaching (i.e. caching results of
expensive function calls)
These functions now lock the d pointer using QMutexPool to
avoid concurrency related crashes.

autotest crashes 20% of the time in release builds without
the fix, passes 100 times in a row with the fix.

Task-number: QTBUG-20452
Change-Id: I64a01af8159216f2dd6215a08669890f6c029ca8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Richard J. Moore <rich@kde.org>
2012-03-06 12:25:22 +01:00
David Faure
c78957766a QMimeDatabase: Fix crash on empty filename
This is due to the search in the suffix tree starting at position
fileName.length() - 1.

Change-Id: I98501c1724c7dde2626351ace8ba19faa0d2e1e1
Reviewed-by: Ivan Komissarov <ABBAPOH@nextmail.ru>
Reviewed-by: Wolf-Michael Bolle <wolf-michael.bolle@nokia.com>
2012-03-06 12:10:42 +01:00
Holger Hans Peter Freyther
e6f84312a5 qpa: Document a requirement of the backing store implementation
Docuent the requirement that the alpha channels need to be properly
initialized by the implementation.

Change-Id: I03db81b44b43ea75feb1b983fb0725c65a3bd9f4
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
2012-03-06 08:24:22 +01:00
Rick Stockton
4a80a7ced1 add widget mousebuttons example 'mousetester'.
This is an xev-like program. A user clicks a mouse button inside the
Window, and the program displays (a) the "raw" button number; (b)
the corresponding Qt::MouseButton name; and (c) the type of mouse Event.

Task-number: QTBUG-24112
Change-Id: I8a76ff37b5b85639f662706072cc4a2ce490754b
Reviewed-by: Casper van Donderen <casper.vandonderen@nokia.com>
2012-03-06 08:24:22 +01:00
Tasuku Suzuki
e3027377f0 QWindow: fix crash on Mac
Fixes a crash when QWindow::baseSize() is invalid size.

Change-Id: I4e41f63d69ad0f218bfd35db8f30f18f92d4e9d5
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
2012-03-06 08:24:22 +01:00
Tasuku Suzuki
cf785e0419 Add missing Q_OBJECT macro to QCoreTextFontEngine
Change-Id: I5d6b4742265a026d404d5ffa48f2c554d5483f30
Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
2012-03-06 08:24:22 +01:00
Robin Burchell
95fa88abe7 Remove codecForTr().
Similarly to change id I2f429fa7ef93bd75bb93a7f64c56db15b7283388, the capability
to arbitrarily alter the encoding of literals is very destructive, especially in
a world with libraries and plugins.

Change-Id: If0d4cd8dcf89792e39c1984cbde6b036cebfc02f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-03-06 06:34:52 +01:00
Oswald Buddenhagen
84ddc06380 do not re-evaluate spec+cache in build passes
clean up the somewhat convoluted code paths which forced re-evaluation.
now that the spec+cache are evaluated in a completely clean context
anyway, there is no point in re-evaluating them for build passes.

Change-Id: I12279083238e9ca7028af97f45e2638c8dc715b8
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
2012-03-06 06:34:49 +01:00
Oswald Buddenhagen
703ef4f79e make QMakeProject's copy c'tor actually behave like one
instead of initializing base_vars with the original's vars, initialize
vars itself. this has two consequences:
- there is no need to call read(0) to initialize vars
- one cannot usefully call the complex read() anymore, as that would
  re-initialize vars from base_vars

this is much closer to an actual copy than the previous "seeding with
existing project".

Change-Id: Ib007bc5b779aedb680a27329aa578f7c604a4308
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
2012-03-06 06:34:47 +01:00
Martin Petersson
ff25691d00 QNam: only init channels when needed.
Each channel will create a socket that will allocate memory for the
read and write buffers. QNam generaly inits 6 sockets for each
connection. That means that by default 12 such buffers are created.
This will instead initialize channels when they are needed.

Change-Id: Ie3f2cf789e084fd3d17d3b2a9bb3d3a4370b3da4
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
2012-03-06 06:34:45 +01:00
Alex Wilson
9c75d0a913 Support new-style plugins without a "Keys" json property
As per discussion with Lars, intent here was to allow plugins without
a "Keys" property to still function correctly, but this particular
if statement was blocking any such plugins from being detected.

Change-Id: Icb343ca8bd95a508d62565cd816fe2a57a4f82bd
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-03-06 06:34:42 +01:00
Jędrzej Nowacki
95550c8f12 Mark QMetaType constructor as explicit.
Implicit conversion from an int would look strange in this case.

Change-Id: I2222a045c293595d7b83a2fb75ca646f5cf79bca
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
2012-03-06 06:34:40 +01:00
Robin Burchell
eb150a51cd Remove unused QThreadPoolPrivate::startFrontRunnable().
Change-Id: Ie079aea3412a53cf9dccaa770fa64ff5b6b7b3b1
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2012-03-06 06:34:38 +01:00
Mark Brand
ea6d1fde1b QSqlTableModel::data(): use cached values when available
Simplify logic. If the record is in the cache, even untouched
values should be there. This is also necessary for getting
the most up-to-date values between submitting and the next
select.

Change-Id: I8578d96229797ce9fb0d07fe456301358f2be071
Reviewed-by: Honglei Zhang <honglei.zhang@nokia.com>
2012-03-06 06:34:36 +01:00
Mark Brand
e999ca25c6 add strategy support to sqlbrowser example
Several useful options added to context menu.

Also added yellow background for unsubmitted
changes.

Change-Id: I132cd4498a5fb7275ea10c0497910aba99c06a2b
Reviewed-by: Honglei Zhang <honglei.zhang@nokia.com>
Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
2012-03-06 06:34:33 +01:00
Mark Brand
698e620aad QSqlTableModel: derive primary values from database values
Primary values are used to map a row in the model to a row in the
database table. It is critically important between submitting a
change and the following select (which refreshes the query) to have
updated primary values. Otherwise, if the change affected the primary
values, additional changes before select will misbehave.

Change-Id: I5d08dd70ac5d3f06cd9d3186a439f4c80a037c2d
Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
2012-03-06 06:34:31 +01:00
Mark Brand
463bd32fe5 QSqlTableModel: mirror database values in change cache
Between submitting and the next select, these values will be more
up-to-date than those that could be obtained from the query.

This will be useful for constructing primary values and reverting
changes made after submitting.

Change-Id: I8317617f3e7043ad0b79b333731c55fb88aef171
Reviewed-by: Honglei Zhang <honglei.zhang@nokia.com>
2012-03-06 06:34:29 +01:00
Mark Brand
50f6cf6e48 QSqlTableModel: remove unnecessary parameter from setSubmitted()
Change-Id: I6d23788163ffd6ba7a8f01ed40910d861ff92703
Reviewed-by: Honglei Zhang <honglei.zhang@nokia.com>
2012-03-06 06:34:27 +01:00
Samuel Rødal
50ca45f059 Worked around Metacity crashes in xcb plugin.
Setting the user time before mapping the window seems to prevent the
crasher from happening. We used to set the user time before mapping in
Qt 4.8 too, so it's probably the right thing to do.

Task-number: QTBUG-24462
Change-Id: Ia670b799bd1ed7a7e6399631d5242e57324918b3
Reviewed-by: Jan Arne Petersen <jpetersen@openismus.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-03-06 01:34:57 +01:00
Rohan McGovern
7206f9c539 Stabilize tst_QCalendarWidget::buttonClickCheck
The window should be shown and activated before sending user input.

Task-number: QTBUG-23615
Change-Id: I2fc1738d9dc4ee7f03c81b040eed6389910a9d3c
Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com>
2012-03-06 01:34:55 +01:00
Rohan McGovern
443fd332f9 Stabilize tst_QShortcut
show() on a window is asynchronous.  Wait for it to complete before
continuing with the test.

Note the test already contained code for this, but it was inside of
a Q_WS_X11 block, making it dead code in Qt 5.

Change-Id: I06f892eea86278c56b1773a7e968bbe065f86260
Reviewed-by: Kalle Lehtonen <kalle.ju.lehtonen@nokia.com>
2012-03-06 01:34:53 +01:00
Rohan McGovern
961c3f958f Stabilize tst_QAccessibility::actionTest
show() on a window is asynchronous.  Wait for it to complete before
continuing with the test.

Change-Id: Icd0daa0c0e8f287171c57708bb2fce0b6cf0906a
Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com>
Reviewed-by: Kalle Lehtonen <kalle.ju.lehtonen@nokia.com>
2012-03-06 01:34:50 +01:00
Frederik Gladhorn
f449cefc27 Remove AccessibilityPrepare event.
This event was completely unused.
In addition it leads to crashes on linux when
sending the Destroy accessibility update.

The Destroy event on linux would still query an accessible interface.
That in turn would trigger the event to be sent.

Change-Id: I8915527de067b8b70ba41b1361e3ef5d12866d7d
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
Reviewed-by: Jan-Arve Sæther <jan-arve.saether@nokia.com>
2012-03-05 18:46:43 +01:00
Bradley T. Hughes
b7ba685150 Don't leak from QPlatformPrinterSupportPlugin::get()
Cache the first QPlatformPrinterSupport returned from the first
QPlatformPrinterSupportPlugin, and treat it as an persistent singelton.

Change-Id: Ic1c83d7c1cdf4a09723a74e0b9fd485e0b0b3acb
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2012-03-05 16:37:16 +01:00
Bradley T. Hughes
e1ec8727ea Add API to convert QSizeF<->PaperSize in QPlatformPrinterSupport
These static public functions give printsupport plugins access to the
non-exported qt_paperSizeToQSizeF() and qSizeFTopaperSize() functions in
qprinter.cpp to aid implementing QPrintEngine and
QPlatformPrinterSupport::supportedPaperSizes().

Change-Id: I3ebcdcd17e863b06ceb135e096e630b37882a293
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
2012-03-05 16:37:16 +01:00