This test fails on Windows occasionally with values just short of 800, the lowest
observed being 791. It is probably rounding somehow to 10ms segments, so allow
it to be up to 10 ms too fast.
Change-Id: Ie28e9f61588b68a9060a006f78eedc3a26d05155
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
The outer scope it was in had a later clause with its own pos
variable.
Change-Id: I8d083d3d5935416ef82a78890ed145f02d6d6ded
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
QModelIndex is not safe to be used to store an index as it is designed
to be discarded right after use as the index information can change.
Therefore a QPersistentModelIndex should be used instead to store the
index. Subsequently the m_index does not need to be updated whenever
the model changes anymore as this is already done for us.
Task-number: QTBUG-49907
Change-Id: Icc93e410de2821c503ea15a7a1dd9ae32634914e
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
GCC warned:
tst_qtablewidget.cpp:30:
tst_qtablewidget.cpp: In member function ‘void tst_QTableWidget::mimeData()’:
qtestcase.h:66:52: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
if (!QTest::qVerify(static_cast<bool>(statement), #statement, "", __FILE__, __LINE__))\
^
tst_qtablewidget.cpp:1523:5: note: in expansion of macro ‘QVERIFY’
QVERIFY(data = table.mimeData(tableWidgetItemList));
^~~~~~~
Fix by adding the extra parentheses, as usual.
Change-Id: I2826d7a865b4113b468d5a958ede06e03aa0e278
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Even QByteArray::fromRawData() allocates memory.
Instead of QByteArray::contains() and indexOf(), use good ol'
strstr(), like already done elsewhere in the same function.
Apart from the memory allocations saved, this fixes a Coverity error
complaining that indexOf() can return -1. It's a false positive on the
first occurrence, because we didn't call that function unless we know
there is a "0x" in the string, but the second _was_ wrong, because we
applied it on a new buffer, with unknown content.
Coverity-Id: 11262
Change-Id: I18f352c5576e24f89a5c3ef7f2f1b2176f2a235d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Easy to miss otherwise and hasAcceptableInput() already references setValidator().
Change-Id: Id2d63050db670ab8f7150d7f76492664751cd2da
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This will be used in QtQuick to avoid costly string manipulation (which in turn
involves memory allocations).
Change-Id: I51a67a4cd97cc576f399483c9c0c13da1e1c6e72
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
When a menu item's enabled state changes after
-[QCocoaMenuDelegate menuWillOpen:] is invoked, i.e.,
during or after QMenu::aboutToShow() is emitted, that
state change may not be taken into account. This is
because the automatic menu validation, upon which Qt
relies, is not made aware of any such change.
By calling -[NSMenu update] when syncing the QPA menu
item, we induce Cocoa to invoke -[QCocoaMenuDelegate
validateMenuItem:] and ensure that previously synced
items, whose state may have changed, will be properly
updated. This, however, has a small side effect, namely
that menu-holding items will also go through the automatic
menu enabling path and may appear disabled since, until
now, they were not properly configured. In order to solve
this, we set the action on those items as well, and make
sure that both of QCocoaMenuDelegate's relevant methods,
validateMenuItem: and itemFired:, properly process
menu-holding items.
Menurama manual test updated accordingly.
Change-Id: I62f955538b8be09b8494ea0ce87fca7910148d38
Task-number: QTBUG-56850
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
That loop could never have worked properly.
Identified by analyze compile switch.
Change-Id: I5e987dc9f5c57d3ffbcf054b7b417b506c02e7e1
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
this is complementary to configure's makeSpec library source type.
this should be sufficient to make QMAKE_USE += {egl,opengl,opengl_es2}
actually work, obsoleting the need for opengl.prf and egl.prf (and the
currently dysfunct openvg.prf).
Change-Id: I2f7595ac89afa087ea7f0f25060e8e47e6148be9
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
The documentation for the qtmain license is right now pretty hidden.
The library is added by qmake independent of the Qt module that are
linked to, but it seems safe to assume people at least link against
Qt Core.
Change-Id: Id474990edde45feab6727bada2bc6a28946216cd
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Since virtually all the logic is shared between QNSColorPanelDelegate
and QNSFontPanelDelegate, we extract the added buttons and
layouting logic and move it into its own class. This requires
the two afore mentioned Objective C classes to satisfy the
QNSPanelDelegate protocol.
Change-Id: Ie26e758f5db71920896d930a4f3644b51a1ce3fa
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
now the callbacks don't need to re-export the designated file contents,
which improves the abstraction and removes some boilerplate.
Change-Id: Ifa50313155fc96762025e2610b810ebb71daa373
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
swap the branches for (not) reading from qt.conf, and use a state
variable instead of an 'else' for mutual exclusion. this is somewhat
more self-documenting, and allows for a saner handling of the mkspec
fallbacks (which really should have been in a separate [QMake] section
along with Host* and Sysroot, but changing that now is way too much
hassle downstream).
Change-Id: I80a73294022fd1e8d84fe501b737c4fc7758662f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
so far, qmake.exe was built in qmake/ and then copied to bin/, with
possible errors in the second step ignored. this made no sense.
this unifies the nmake makefile with the unix one; compare 46e51ce1d.
Change-Id: Ieb9c7cd46f0be0501d17e297808ac1cdad1b3c4a
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
when the file's effects are discarded, the mention of the file should be
as well.
Change-Id: I894b7e2b887dd34d18533b197bfa9d0d84d647e7
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
the normal mode forces the prompt into a pattern which may be
undesirable.
Change-Id: I01689c7a6573415801862348b32bafc6a609ed4a
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
that is, adjust path separators and don't quote them. we already did
that to some degree, but totally inconsistently, so it just didn't work
for any targets with "fancy" file names.
note that we don't bother doing that for recursive targets, as these are
assumed to be identifiers.
Change-Id: Ic75f003b71abc6fed03a4121b903ad5ee8253ed2
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
if the externally provided qmake had a different on-device install tree
layout, things would go wrong. of course, that's a rather unlikely case,
so nobody noticed ...
Change-Id: I59f9976a769ccb6099b7237ef42555f0549615aa
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
there are plenty new functions, let's do this symbolic act.
Change-Id: Iaeb88afa5e33cacd81dc0ea26e380a16af06a739
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
otherwise it's sometimes quite hard to tell it apart from configure's
own messages.
Change-Id: I2f4908344367a9a3ce38e032bf76486fc4552ffd
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
this got broken in 2ad4d75754.
however, the new configure system operates from the top-level build dir
anyway, so there is no point in messing with the cache as a reference
point to start with - just use OUT_PWD.
Task-number: QTBUG-57120
Change-Id: I69629bf497931574bff8452939170abb1776ab60
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
60985aa42 converted the QT_CONFIG use, not taking into account that the
feature isn't actually known to the configure system - it's coming
directly from the makespec. so revert that hunk (until we have a better
integration between makespecs and configure).
Task-number: QTBUG-57039
Change-Id: Iaf57b5f5339250055f1c378e091da3ab3fcd4292
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
We can not improve the result from JSON parsing without changing API,
so instead recalculate the line and column based on input and offset.
Change-Id: I54149233f71023aa5d30deff854d6f3406c5c48c
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
When including a CSS file in a HTML file sent to QTextDocument, and the
CSS file starts with «@charset "UTF-8";», which is the correct way of
declaring that, the parsing fails.
If you omit the space, like «@charset"UTF-8";» the parsing succeeds,
which is wrong.
Fix this by expecting and swallowing whitespace after the @charset
tokens.
Task-number: QTBUG-54829
Change-Id: I32044e8d24bda70c1eb06bf74af50d4cabe2211d
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
The buffer is fed into strstr() on the next loop iteration, but
strstr() expects a NUL-terminated string.
In the equivalent code some lines up, the buffer is explicitly
terminated, and we never write the last character of the buffer again,
so we'll not fall off the end of the buffer, but if we read less bytes
than in the last line, we'll parse garbage from the previous line.
Change-Id: I354e1ce1dea71188942305190500b4778a69b4ff
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This will be used by QtQuick to correct a performance regression introduced by
592614ea3e -- QFontDatabase::isSmoothlyScalable is
quite computationally expensive; and now it is unconditionally expensive
regardless of the platform.
Change-Id: I82bfa65a963c6c3c276d574f2b379da4a9ba5b69
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Do not consume white-space after a token before the token has been
parsed, otherwise we end up with misleading offsets. This also fixes
a wrong error of illegal number in several cases.
Change-Id: I492ca4de0346a1d0ab73b1c23d7a72dba812664c
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
The old code was wrong as it used QString::fromUtf8() to convert the
char * array to a QString. This could lead to wrong positions when trying
to find the #version directive, as any valid utf8 sequence in a comment
before could have lead to wrong offsets compared to the 8 bit data.
Fix this and optimize the code at the same time to avoid creating a copy
of the data and using QRegularExpression.
Also fixes building Qt with -no-feature-regularexpression
Change-Id: I2d84875ef59b3a0fb4d8b069bf56f4372c57ccdc
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
The test relied on the file created being automatically selected,
which sometimes does not happen when executing the entire test.
Explicitly select the file and check the selection.
Use the temporary directory for testing.
Change-Id: Ia58641c1ac32ba21effa8a5ace9623eb5d48a1c2
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Returning NSNotFound from the NSTextInputClient selectedRange
implementation when there is no selection prevents
dictation from activating (for unknown reasons).
Return an empty {0, 0} range instead. Text input
methods such as Pinyin still work after this change.
[ChangeLog][macOS] Speech to text dictation now works
for Qt text input.
Change-Id: Ibf1729bdd271e8ed5ce3c9d2a0373c8ab3613d8e
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
In XCB environment the QClipboard::changed() was not delivered if the
QClipboard::clear() was issued by other Qt app/process.
If the QClipboard::clear() is used, then the owner in
xcb_xfixes_selection_notify_event_t is XCB_NONE, so we need make the
decission to handle this event by the selection_timestamp and our
m_timestamp[mode].
Task-number: QTBUG-56972
Change-Id: If4c486ac02223eac506465cac7ff1a07bd02a187
Reviewed-by: Lars Knoll <lars.knoll@qt.io>