The check for Qt::Key_A to handle selectAll was changed to directly
compare to QKeySequence::SelectAll as this will only match Ctrl. The
former implementation also triggered when e.g. Shift was pressed.
Added a check that selectAll is only called when selection is not
disabled, i.e. selectionMode=NoSelection.
Added a unit test for selectAll().
Task-number: QTBUG-26687
Change-Id: I721e7ab590b55d7d754b3b74ef01756fa5aa1315
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Say you have a document of two blocks of text.
When you select a block of text in the document and then replace this
with a new empty block (by pressing enter) and then subsequently
undo this action, the following three steps are performed as a
chain of undo commands:
1. Remove the empty block at the beginning of the document
2. Insert a new empty block at the beginning of the document
3. Insert the text back into the first block
Since a block is removed and inserted in the same go, both blocks
require a relayout, since the accumulated change spans both blocks.
However, in QPlainTextDocumentLayout we would only look at the max
of either removed chars or added chars. This would match the text
length of the first block at this point, so we would only relayout
that block. However, since we are also removing characters, the
actual accumulated change to the document is larger. We should
relayout any block touched by the sum of the added and removed
character counts.
Missing this, the paint event would later query
block.layout()->lineForTextPosition(0) which would give an invalid
line despite the fact that the block.length() > 0. This caused
a crash in the paint event when the full width selection was
turned on.
Note that the logic here was only recently updated to include the
removed characters at all in the logic, by the SHA1:
2983cb9531.
[ChangeLog][QPlainTextEdit] Fixed a crash when using full width
selections and issuing a complex undo command chain which removes
and inserts an empty block in one go.
Task-number: QTBUG-36415
Change-Id: Iafe8a69e455e0c713a48714f10f0cace69c84f51
Reviewed-by: Axel Rasmussen <axel.rasmussen1@gmail.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
My previous fix for CPU load issues between HTTP thread
and user thread was fragile if the upload QIODevice
emitted readyRead() multiple times.
[ChangeLog][QtNetwork][QNetworkAccessManager] Fix behavior of upload QIODevice
that generate data on readyRead() for HTTP PUT/POST
Change-Id: Idb1c2d5a382a704d8cc08fe03c55c883bfc95aa7
Reviewed-by: Christian Kamm <kamm@incasoftware.de>
Reviewed-by: Richard J. Moore <rich@kde.org>
This was done wrong when using the ini format.
Task-number: QTBUG-22461
Change-Id: Ib9390460bce6138659cceac7e3cd25339ba5e9bb
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
device is private, always null and class has no friends, so no need to have it at all
Change-Id: I320d47f1a712a3202c08b494563533e29d185501
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Richard J. Moore <rich@kde.org>
QToolButton::sizeHint() takes into account the presence of a menu.
However, setMenu() doesn't retrigger a size hint recalculation. Hence,
(un)setting a menu on an already sized tool button won't properly
reset the size hint. Since the calculated size hint is cached,
delete the cached value and call updateGeometry to cause a
recalculation.
Task-number: QTBUG-38949
Change-Id: I6e79e5e70e31afdfd129282b3668875eca86f51d
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
And not a normal pointer. The problem is that in certain scenarios,
if the TLW containing a QSizeGrip changes and the old TLW gets
immediately destroyed, then the mechanism which updates the tracked
TLW is run too late, and ends up accessing a dangling pointer.
Therefore, we need to protect that pointer via a smart pointer.
Task-number: QTBUG-22867
Change-Id: Icfb051132bacde604f660ac7a98bc0a9d1022c68
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
In some cases, e.g. when bad credentials are provided in an ftp URI,
QNetworkAccessAuthenticationManager::cacheCredentials is called with a
null authenticator. This authenticator should not be cached, because
it is useless, and leads to inconsistencies in the use of the cache
Task-number: QTBUG-40622
Change-Id: If2a0a422b915f268648f5eef1d68601446123371
Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
Widgets and layouts added or inserted to a layout are checked for:
- Not being NULL
- Not being the parent widget of a layout or the layout itself,
respectively
Without this commit, adding a widget to its own layout would result in a
CPU-hogging infinite loop. Now, a warning is written to stderr and the
add or insert function call is ignored.
The checks are implemented as public functions of QLayoutPrivate and
thus accessible in QLayout's descendants to be used in various
"addWidget", "insertWidget", etc functions.
Unlike 'classical' layouts like QGridLayout, QFormLayout does indeed
accept widgets that are NULL. To not break this behavior, any call for
the check functions first tests if the widget or layout, respectively,
to test is NULL or not and calls the check only in the latter case.
Automated tests for QBoxLayout, QGridLayout, and QFormLayout were added.
For an unpatched Qt 5.3, each of those automated tests will freeze as
explained in QTBUG-40609. For a fixed version, warning messages about
invalid parameters to addWidget/addLayout/... calls will be read by
QTest::ignoreMessage, resulting in a passed test.
Change-Id: I1522d5727e643da3f7c025755975aca9f482676d
Task-number: QTBUG-40609
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
When 'cursorPos' is out of bounds ([0, lineEnd]), this method crashed.
Change-Id: Ia0540ab3afbffb5c598f7b8515263cce3b3928e4
Task-number: QTBUG-40753
Reviewed-by: Dominik Haumann <dhaumann@kde.org>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
When setting a new screen, the code calls QWindow::destroy(), which
recursively destroys all child windows. It then calls create() on the
top-level window, leaving child windows destroyed. This causes crashes
if you have embedded native widgets.
Task-number: QTBUG-40817
Change-Id: Iaace2589f48bbfd5faaf5ff95357ff43b310504a
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
In Qt 5.3.0 a change was added which automatically adapts Common
script to surrounding scripts in accordance with the Unicode tr#24.
This broke *a lot* of cases of font selection because the font
selection algorithm is not prepared for handling characters with
adapted scripts. We need to disable this change for now and redo it
later with patches to font selection to avoid the regressions.
[ChangeLog][Text] Fixed several regressions in font selection when
combining different writing systems in the same text.
Task-number: QTBUG-39930
Task-number: QTBUG-39860
Change-Id: Id02b5ae2403c06542ed5d81e7c4deb2e0c7d816e
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
kUCCollateDigitsAsNumberMask works only if kUCCollateDigitsOverrideMask
is also set.
Update 0: - test added.
Task-number: QTBUG-40777
Change-Id: I48bfec78f5f8439a51f8d749f0fc4397a72b29f2
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
In cases where a cached ftp connection fails to connect, or a file
transfer has failed, we should removed the cached connection. Since qnam
has an idea of a single internal QFtp per full operation, when file
transfers failed previously the cached connection would be reused for
subsequent connections and thus fail.
[ChangeLog][QtNetwork][QNetworkAccessManager] QNetworkAccessManager now
properly handles FTP transfer failures by removing failed cached ftp
connections.
Task-number: QTBUG-40797
Change-Id: Ie090a39ceddd7e58a0d8baf7d01f2a08c70162e5
Reviewed-by: Richard J. Moore <rich@kde.org>
If we write to a file, its size changes. We should drop previous size
caches.
Change-Id: Ib687c91e5fc88cab588c89023f23da9622160da9
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
Fix disconnection from pointer to member signal that belongs to the base
class, but whose type is a pointer to a member of the derived class.
Commit 9cc106d9d7 fixed connect, so apply
the same fix in disconnect
[ChangeLog][QtCore][QObject] Fixed disconnecting from pointer to member
signal that belongs in the base class but whose type is explicitly given
as a pointer to a member in the derived class
Task-number: QTBUG-40638
Change-Id: Ia546fc8f36e1ea0dd0645bdd820aea47f43677ac
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This is helpful to e.g. test an NTLM proxy.
The test server currently does not support NTLM; this test offers a
possibility to specify a proxy server via environment variables.
Change-Id: Iea94656d38424c1d932fc854d13ca15ca47cdd68
Reviewed-by: Richard J. Moore <rich@kde.org>
With SHA1 47b3ecf3f4 some tests got
commented out by accident. This re-enables those tests.
Change-Id: If9c7d8a672b66086895a0383fe87d3101fb146fb
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
This commit reverts c4cef6fae9.
The above fix for QTBUG-25958 (cloned in QTBUG-40219) is not
complete and introduces the regression QTBUG-30049.
Task-number: QTBUG-30049, QTBUG-25958, QTBUG-40219
Change-Id: I3c4b774dce06c13cb4e089f8413a7747cedfd212
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Add a test that checks that QHash keeps the first of the keys
that compare equal. This may or may not be documented, but is
inconsistent with the values in a QHash, where the last element
with equal key is kept.
Document this as a test. That way, we'll be informed when the
behavior changes (e.g. by a port to std::unordered_map).
Do the equivalent checks in tst_QMap, too. There, of course,
instead of equal keys, check equivalent ones.
Change-Id: I2c5f04f8e8a6bbc7dbaadadd878a4c876e4df042
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Add a test that checks that QSet keeps the first of the elements
that have equal value. This is documented, but inconsistent with
values in a QHash, which keeps the last element with equal key.
Document this as a test. That way, we'll be informed when the
behavior changes (e.g. by a port to std::unordered_set).
Change-Id: I4ca1718bb86599b925b3ccd13b0856917cd4ce67
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
No actual reason for this test, except my curiority. Then again, it's
good to have this check, too.
Change-Id: I815fce7e4dbe76e21cac29beb1dbfc1083191d24
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
No actual reason for this test, except my curiority. Then again, it's
good to have this check, too.
Also checks that the last entry in the init_list "wins", which is
not how std:: containers work.
Change-Id: I4f7d1228f2b90a904b6c3f99e54afcd9970b723e
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
No actual reason for this test, except my curiority. Then again, it's
good to have this check, too.
Also checks that the last entry in the init_list "wins", which is
not how std:: containers work.
Change-Id: Ia284d093cd0029432372630e81657fb687b9516f
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This fixes high CPU load for upload devices that don't generate
a constant stream of data. Their readData() function was called all the
time without returning actual data.
This was noticed when implementing an upload device that emits data in
a limited way for bandwidth limiting.
[ChangeLog][QtNetwork][QNetworkAccessManager] Fixed high CPU load when handling
POST/upload QIODevice that generates data on readyRead().
Change-Id: Iefbcb1a21d8aedef1eb11761232dd16a049018dc
Reviewed-by: Richard J. Moore <rich@kde.org>
This was prompted by https://git.reviewboard.kde.org/r/119221
Change-Id: Ia148f07f6d711df533693918bbedfa5e7dc02cd5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Several tests require test data to be deployed with the
application. The easiest way to achieve this on Android
is to add them to a qrc file and use the QFINDTESTDATA macro
to look up the files. This fixes several test failures
in the gui/text subdirectory for Android.
Change-Id: If944bb1fc93434a1b2d6487da829d21bd6b84e87
Reviewed-by: BogDan Vatra <bogdan@kde.org>
When a dialog was parented on a native child widget,
its window handle was used as a transient parent.
This confused QPlatformWindow::initialGeometry() among
other things. Use top level window as is in Qt 4.
Task-number: QTBUG-40195
Change-Id: Ic82adc276175f92adde825fb2551274351e41f30
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
At the moment, there is no stream information in the cache file. This
can lead to a problem when current stream version differs from version
cache file written with.
As an example, if file written with Qt 5.1.1, QTimeDate in the metadata
stored as 13-bytes value, but Qt 5.2 and later can read additional 4
bytes which breaks following data, leading to network request just hangs
forever.
Adding stream version fixes this problem.
As cache format changed, cache version bumped.
Task-number: QTBUG-36219
Change-Id: I467d8c9fda82bcf9302192f51e7a00d2f6a9ff66
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Prevent the splitter from adding them to the layout or showing
them.
Task-number: QTBUG-40132
Change-Id: Ife2be0bbd7e489570ef41f6f72a034b356c65f18
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
I've also updated the qfont test so it passes on Android now. Note that
there are no suitable cursive/fantasy fonts on Android, so the regular
default "Roboto" (or "Droid Sans" on older devices) will be picked here
instead.
[ChangeLog][Android] Fixed font selection to prefer "Droid Serif" when
Serif style hint is set on QFont.
Change-Id: I294eebcc4d79410e435bdddce552acc6044753b2
Reviewed-by: Christian Stromme <christian.stromme@digia.com>
When the platform plugin gives us specific fallbacks for a
specific script, we need to respect this, and load the correct
font family regardless of which writing systems it supports.
This is especially important since the common script is adapted
to match surrounding, proper scripts, so characters such as
digits next to e.g. Hebrew text will be marked as Hebrew. On
stock Android, there is a single Hebrew font, and this would
previously be put in all fallback slots for Hebrew regardless of
what fallback fonts were dictated by the platform plugin. Since
this font does not support the digits, they would show up as boxes.
[ChangeLog][Android] Fixed common characters like digits and
punctuation showing as boxes when positioned next to non-latin
scripts.
Task-number: QTBUG-39377
Change-Id: I1555e208a8ddc587c0bbdbfff1600cafdd9442e9
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Check result in initTestData().
Previously, QFINDTESTDATA() was repeatedly invoked in init(). The
data-driven cd() test then failed when invoked stand-alone since
cd_data(), which relies on the data path, is executed before init().
Task-number: QTBUG-40067
Change-Id: I91039247e8dcaedd92fa990f1b5f82bc54b17c60
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
At some point since Qt 4.8, the nbsp character has acquired
the whitespace attribute, causing it to be treated exactly
like an ordinary space. To account for this, we add an extra
check in the layout code to avoid breaking on non-breaking
spaces even if they have the whiteSpace flag set.
This is a temporary fix for the regression. The line breaking
algorithm needs to be refactored and support Unicode tr14
properly, which it currently doesn't.
[ChangeLog][Text] Fixed lines breaking on non-breaking spaces.
Task-number: QTBUG-39832
Change-Id: Ibd7e1a11ce4b82c611ecda1542c8638a67bf3cae
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
The assumption that we can test "en_US" and expect
it to behave a certain way is flawed in that most
of the formatting settings are independently
configurable by the end user.
Make the test more robust while attempting to preserve
as much testing as possible:
Make the decimalPoint/groupSeparator tests check for
a range of possible values. Check that they are not
the same.
Remove the date formatting tests and the firstDayOfWeek()
== Sunday test.
Make the time zone test accept a non zero extended
time zone. ("GMT+2" in addition to "GMT+02".)
Change-Id: Ie1f89793eb785f526c5f6fafbb6726ef8c6cb016
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Fixed qwidget test cases for platforms that show windows full screen by
default and that don't support WindowMasks. Incorporated QNX/BlackBerry
peculiarities.
Change-Id: I349ecab5cef35c7d9751aa547465f685d620164a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
The combination of these unstable tests makes it very
hard to get changes through the CI system due to the
unrelated test failures.
Skip the following test functions:
tst_QIODevice::unget QTBUG-39983 (Mac)
tst_QThreadPool:expiryTimeoutRace QTBUG-3786 (Windows)
tst_QLocalSocket::processConnection QTBUG-39986 (Mac)
tst_QTcpServer::adressReusable QTBUG-39985 (Linux)
Change-Id: I96559bea0d437fd25966b6ccac1ece1490e06241
Reviewed-by: David Faure <david.faure@kdab.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
The setting of (static) messageHandler to qDefaultMessageHandler if null
was happening in multiple threads simultaneously, so it needs synchronization.
Used an atomic pointer in case qInstallMessageHandler is called from a thread,
but more importantly, initialized the static vars right away.
Improve auto test to ensure that qInstallMessageHandler(0) still sets the
default message handler.
Change-Id: I70335af38c1d28a1cdba1df8a79c6006f227422e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The sockaddr_in struct is defined in netinet/in.h header.
Change-Id: I67a3421094c96a5e948968a26723ec8c21f85c93
Reviewed-by: BogDan Vatra <bogdan@kde.org>
The almostplugin has an unresolved symbol, and on Android
we compile with -no-undefined.
Change-Id: Ia631193890dfe8e7ac8e58087475164222d876fc
Reviewed-by: BogDan Vatra <bogdan@kde.org>
In "setOpaqueResizeAndMove" this patch makes sure that the content of a subwindow
actually fits into the window, otherwise the resize does not work properly.
The content is dpi dependent and thus the pixel size of it increases with the display
dpi value.
Furthermore when moving the QMdiSubwindow this patch makes sure that we actually grab
the window's header and not one of it's tool buttons (minimize, maximize, close).
Change-Id: I88314994957c5883f57c09c9240a3b83f1ee42ed
Reviewed-by: Sergio Ahumada <sahumada@blackberry.com>
Reviewed-by: Bernd Weimer <bweimer@blackberry.com>
Fix condition to allow return a valid pointer when head != 0.
Change-Id: I5215f7dfc44924016c2d9b67ab2d9935b5164d7a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
We were keeping a dangling pointer to a non-existent QIODevice around
which would lead to a crash.
Task-number: QTBUG-17400
Change-Id: Ie374cbb94bb45c9b0fbef46287b3317f60154123
Reviewed-by: Richard J. Moore <rich@kde.org>