Replace QString::arg() with QStringBuilder, use QStringLiteral
where appropriate, and remove it where it isn't (e.g. in
QStringBuilder expressions).
Saves ~750b in text size on optimized GCC 5.3 Linux AMD64 builds.
Change-Id: I2471c849db79f477677213f9a155053248800590
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Keep the return values of QXmlStream*::value() around as QStringRefs
for as long as possible. Avoids conversions to QString, among other
things, for:
- comparison to another string
- conversion to int
- conversion to UTF-8 or Latin-1 byte arrays
Add a pair of Q_UNLIKELY as a drive-by.
Saves ~900b in text size on optimized GCC 5.3 Linux AMD64 builds.
Change-Id: I17d440a11aeb8675979483f89e66d0a088ccc605
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
It makes little sense to use QStringLiteral for strings which are
immediately appended to, or which are appended to other strings,
because no dynamic memory allocation is saved by doing so. But if
the only advantage of QStringLiteral does not apply, all its
disadvantages dominate, to wit: injection of calls to qstring dtor,
non-sharability of data between C strings and QStringLiterals and
among QStringLiterals, and doubled storage requirements.
Fix by replacing QStringLiteral with QLatin1String.
Saves 104B in text size on stripped optimized Linux AMD64 GCC 4.9
builds.
Change-Id: I36b6a9bb1963b69361cc3a3db0971e1db92f0080
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
It makes little sense to use QStringLiteral for strings which are
immediately appended to, or which are appended to other strings,
because no dynamic memory allocation is saved by doing so. But if
the only advantage of QStringLiteral does not apply, all its
disadvantages dominate, to wit: injection of calls to qstring dtor,
non-sharability of data between C strings and QStringLiterals and
among QStringLiterals, and doubled storage requirements.
Fix by replacing QStringLiteral with QLatin1String.
Saves 288B in text size on stripped optimized Linux AMD64 GCC 4.9
builds.
Change-Id: Ie632f25883163f57991264b29e8753fe4c4f738e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
The windows.h include is not needed, the enums are properly known to
the metaobject system nowadays, and qprocess_p.h already has a
QT_NO_PROCESS guard.
Change-Id: I6bbdce19f097feb8260c51a29425279049aa0192
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Do not use a loop to execute similar but separate tests in
tst_QProcess::softExitInSlots. Use separate test rows with
distinguishable data tags instead.
This way we can deduce from CI output which part of this test failed.
Change-Id: Ic9bc996f2ced11b2bb1c33c1970e64937d860976
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Since a094af0017 we don't need any null
pointer checks for xcb screens.
This reverts patch 7532fb4e61
Change-Id: I8b90ed538aad4403650ef42aab6f39de5861d9ed
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
QRingBuffer already works fine with empty list of arrays.
Change-Id: I5cd388709686d2980efa3d5129c726e75c0b5c09
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Two related errors: When a non-existent font was set on
the font dialog, the GTK native font dialog would just pick
a default one. Also, if the font size was specified with
pixel size, we would request -1 as the point size from
Pango.
The fix for both is to resolve the font before applying
it to the font dialog, and set the actually resolved family,
as well as point size. Note that if the point size is
explicitly set, then we pass this to the font dialog,
since the one returned by QFontInfo will always be
calculated based on the (rounded) pixel size, so it will
usually not match the request.
This fixes tst_qfontdialog::setFont().
[ChangeLog][GTK2][Dialogs] Fixed requesting a font from
font dialog with a non-existent family name and/or pixel
size.
Task-number: QTBUG-51148
Change-Id: Id9c783407778546b0cf3f9c3ab19f124e76c878e
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
When mouse events are delivered using XInput2 then the wheel event is
missing on submenus, because XInput2 delivers the wheel event only to
the root menu.
Task-number: QTBUG-50996
Change-Id: I757c0b5e3aea4606d2e45dfc8180c263e02167ca
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
When a modal window is closed and the mouse is not under the modal
window - find a proper window and send a fake enter event.
Added auto test for checking enter event on window when modal window
is closed.
Task-number: QTBUG-35109
Change-Id: I370b52d386503820ac9de21e6d05fd019ca456ec
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
This is a partial revert of fef629cd91.
When doing the original fix, I didn't realize that there was a
mechanism for disabling specific OpenType features in Harfbuzz.
This commit reverts the hack to disable GSUB completely and disables
the ligature features instead.
Task-number: QTBUG-44393
Change-Id: I30f0080eb3897f37219df7f2d50843f3a4556e13
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
... when QT_NO_CURSOR is enabled. Then, result of this
function is unneeded.
Change-Id: I0e74e1aa5253de2608c4c18cb2c4b4e2e9f4c9e2
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Use std::remove_if(), which is linear, instead of looping
over erase(it), which turns the loop quadratic.
Reorder condition: call cheap non-virtual QModelIndex::column()
first, then virtuals parent(), and isIndexHidden().
Change-Id: Id46ee1297b91906332eeca98f69372ef887ac330
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
First-level context menu grabs the mouse, so all mouse events are
delivered to it. This menu passes the mouse events to submenus. Any
platform delivers mouse enter/leave event differently when window is
grabbed. This patch unifies event delivery to context menus - it can
block some unwanted events and it emulates fake events if necessary.
This patch can reduce duplicated events and can provide proper enter
or leave event to additional widgets in the context menu. It can also
prevent submenu from unwanted close on Windows and X11.
Added autotest.
Task-number: QTBUG-45565
Task-number: QTBUG-45893
Task-number: QTBUG-47515
Change-Id: I7dd476d0be23afa34e947e54aef235012d173dcf
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
If QT_PRESERVE_TESTLIB_PATH is set, then LD_LIBRARY_PATH and
QT_PLUGIN_PATH won't be filtered out for the sub-tests started by
tst_selftest.
Change-Id: Ic43ba9b4d882ee36b2f7495b1c880f26aefd2629
Reviewed-by: aavit <eirik.aavitsland@theqtcompany.com>
The protocol was originally developed by Canonical, currently supported
by Unity and Plasma.
Adjust some tests to use the non-native menu bar when they require it.
[ChangeLog][XCB / X11] QMenuBar uses the unified D-Bus AppMenu menubar
when the desktop environment supports it.
Change-Id: Iea74b40522573bcc4f70168fe7fa2a49b4f3fc21
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
The auto.pro file would bail out or skip based on the availability of
the session bus at qmake time. That does not make sense for cross
compilation: the session bus may be available on the target even if it
is not on the compilation host.
Change-Id: I459a518f3411acb39e8dcdad9d32ded1f9b57029
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Unlike other rendering backends, QTextBrowser treats px unit in
stylesheets as physical pixels when printing, resulting in
too small to read font sizes.
Work around this by converting font-size px units to pt.
Change-Id: I70c71d8bda0996f793bf1c4558775384fe6ec297
Task-number: QTBUG-51083
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Robert Loehning <robert.loehning@theqtcompany.com>
The win32-g++ mkspec is not based on gcc-base, so
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO is not inherited. Therefore,
-release -force-debug-info would build with neither -O2 nor -g.
Change-Id: I4e97cb08f577062dd342fb3e91c02adfd636a310
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Fix the condition to check for plain move events and gain in
one dimension in which case Windows will send events.
Task-number: QTBUG-51038
Change-Id: I60433657f37275ee302f745291e79e465d52064d
Reviewed-by: Błażej Szczygieł <spaz16@wp.pl>
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
Querying the flags of the QWindow fails when inside
QWindowsWindow::setWindowFlags() since the new flags do not take
effect.
Task-number: QTBUG-40578
Task-number: QTBUG-51224
Change-Id: Ida8c23b64ddfde34ebc0af95c84954e666865240
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
This test fails in distros using GNOME due to
most likely bad usage of native dialogs.
Task-number: QTBUG-51148
Change-Id: I6e539b429266e298ce413565e0191bffa7fbe6bc
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Move the bool QFileDialogPrivate::defaultFileTypes to QFileDialogOptions
as defaultNameFilters and add a static function returning the
translated default filter string. Let QFileDialogOptions::nameFilters()
return the default filter until a value has been set.
This removes the need for special handling for empty filter lists
in the QPA plugins. As a side effect, Qt Quick Controls's FileDialog
will then also default to "All files" if no filters have been set.
Task-number: QTBUG-50644
Change-Id: I9ba271a472d4fa03767b540ef6f1399f5ca4408e
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@theqtcompany.com>
This check is used in many places in the public header files,
and correctly documenting the affected declarations depend on
QDoc evaluating it correctly.
As QDoc currently cannot evaluate complex preprocessor
directives, work around this by explicitly evaluating
the version check to false.
Change-Id: If22eff76f6831c92375d9a0b25d04aa46422da13
Task-number: QTBUG-51262
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
QListWidget uses a set of slots for its selection model that are
connected only at creation time. This patch adds the missing
connections cleanup and setup when a user changes the selection
model.
Task-number: QTBUG-50891
Change-Id: I942bae6c471ea1ae22637d09b96d6fbd422f653f
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
gui/text/qfontengine_ft.cpp(1743,5) : warning: variable 'bytesPerLine' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
gui/text/qfontengine_ft.cpp(1743,5) : warning: variable 'format' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
The default branch is marked Q_UNREACHABLE, but apparently Clang does
not recognize it.
Task-number: QTBUG-50804
Change-Id: Idfce8cb2b9a481dd67a18d9952b920ad4f71e0f4
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Change-Id: I075932cfb9fdd38fb8d54da19e7d72b8cdec49f3
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Change-Id: I83df0d0bbac66957dc06e2805acf2c47d172fed8
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
std::vector is all that the Array original author dreamed about,
and more: never shrinks capacity, non CoWed, ...
Appart from append(), the Array API was modeled after std::vector
(size_t size_type, etc) already, so the port to std::vector is
minimal. The only change besides append() -> push_back() was not
assuming const_iterator being const T*.
Remove now-unused Array.
Change-Id: I02bc71441d01e554e320746d82dbc00f74c5466d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Fix up debug operator for QFontDef, add one for LOGFONT and output
both should creation fail.
Task-number: QTBUG-51260
Change-Id: I5cbcd392edd811c6b9470ddbb095d41a9185d208
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
instead of unsetting the flag later on, don't set it in the first place.
Change-Id: Id448500b02b5c3e1dc7c332cc178a84c7fd2cfdc
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
this has multiple consequences:
- we do sane DESTDIR replacement for debug_and_release builds, fixing
QTBUG-47313
- we don't create debug/release subdirectories, fixing QTBUG-47639. this
only makes sense given the complementary call of $$qt5LibraryTarget()
- we patch up the .prl files upon installation
Task-number: QTBUG-47313
Task-number: QTBUG-47639
Change-Id: Id409bbd26781a773409b94835ab6b97e71569322
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
evidently, nothing and nobody sets this option, as it's been completely
broken since 6234dec41f (qt 5.5) and apparently nobody noticed.
Change-Id: I5a82ebd963a292af4689397875dde096f63d751a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
... or similar.
This amends previous commits that converted the majority of
cases.
Task-number: QTBUG-45291
Change-Id: I219cdeddca7063a56efeb4fee0e5bb2cbdc7732b
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
QXcbScreen did not set the m_sizeMillimeters if the xcb connection does
not support XRandR. This caused physicalSize() to return an invalid QSize.
This change fixes a regression compared to Qt 5.4 discovered by a
broken unit test for KWin on KDE's CI system, which uses Xvfb and by
that no XRandR support.
Task-number: QTBUG-49885
Change-Id: Ie472a194ba410f0748ccfda8aa467727fafa10a3
Reviewed-by: Błażej Szczygieł <spaz16@wp.pl>
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
Take an intersection of the screen geometry and the work area.
Change-Id: Ia61d090ac103cb4d13d656ec09037f642b255a79
Reviewed-by: Błażej Szczygieł <spaz16@wp.pl>
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
The activity exits immersive mode when displaying a dialog. To fix the
problem we must use onWindowFocusChanged to update updateFullScreen
every time when we've gotten the focus.
Task-number: QTBUG-38759
Change-Id: I9f11a82dba484dbec6daba7cbf116f16fe2ba372
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Since Qt 5.0, there's been a separation between QGuiApplication
for generic GUI applications, and QApplication for applications
using Qt Widgets. The docs in QCoreApplication has not reflected
this, however, and was still recommending QApplication for
any GUI app.
Change-Id: I7b2b166170d1e20755889767cda3d555fbbc666a
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
Reviewed-by: Nico Vertriest <nico.vertriest@theqtcompany.com>