For some reason this setter wasn't protected against setting
the same value again, and always did work (including resizing
the last section when setting it to false).
Change-Id: I044404eef95d52d165100254f3afd489997e0872
Task-number: QTBUG-52308
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
QAbstractSlider might register and use small scroll events that would
scroll less than a single line. Since we consume the scroll-event we
should accept it, so it doesn't scroll other widgets too.
Task-number: QTBUG-49549
Change-Id: I7c64c5f6cae46f02ba21058abbecb791fc3c88eb
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
Avoid rounding errors, thus preventing sizes becoming
too small when High DPI scaling is in effect. Also fix
division by zero crashes should a scale factor be below 1.
Task-number: QTBUG-49374
Task-number: QTBUG-51552
Change-Id: I72718521bc3c7f6b0e42392ea2d2d3bbc61e2faa
Reviewed-by: Marko Kangas <marko.kangas@theqtcompany.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
Previously, the style defaulted to drawing via pixmaps when the device
transformation of the QPainter was more complex than TxTranslate.
Introduce an enumeration describing the transformation to be able
to identify the scaling used by High DPI scaling and allow for direct
drawing in that case as well. Add scale factors.
Create pixmaps with device pixel ration in drawBackgroundThruNativeBuffer()
if High DPI scaling is in effect.
Issues: Borders may go missing due to the up-scaling/rounding.
Code branches for DrawBackgroundEx==0 are not touched since it is
assumed these old versions of Windows do not run in High DPI.
Task-number: QTBUG-49374
Change-Id: Idfe1887e4fac3be2843438dc76cb4971a198ab2a
Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
Remove the font-size declarations from the CSS, rely on the default
sizes for each element. This solves two issues:
- The user-configured font size (both in Assistant and Qt Creator
Help) is correctly taken into use. Previously, adjusting the
font size resulted in resizing fonts only for some of the text
elements.
- QTextBrowser backend seems to assume a DPI of 96 for all
platforms, and font-sizes in 'pt' units are scaled accordingly.
However, on OS X this resulted in font sizes too small to read.
Change-Id: Iaab3ad07e387912ad7391df982d4bfe7047f0b20
Task-number: QTBUG-51709
Task-number: QTBUG-51885
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com>
Meta modifier is not found in some configurations which triggers an
assert. Instead of assert, ignore the modifier if it is not found.
Task-number: QTBUG-52298
Change-Id: I258cee4014a30162afebb423eadaf07ef0ed6a1f
Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
For these states, geometry change will be sent from the code called
by setWindowState(); the geometry obtained immediately after window
creation is then no longer valid.
Task-number: QTBUG-52231
Change-Id: Ia7cbe95e73c5dd4126bb63d448b83f2cab6a53a1
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
... to avoid unnecessary allocations with
both case sensitive and case insensitive paths.
Optimize 4413254ff6
Change-Id: I4288831d641f7a0ee67f2efd2f5d4f023df0d39c
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Don't access first() of a potentially-empty QList.
Check for QHostInfo::error() first.
Also change to constFirst() to prevent a detach.
Change-Id: I91fa0bbfb21f62af29abdb23b4869a7f039b259e
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Found by UBSan:
itemmodels/qabstractitemmodel.h:426:28: runtime error: left shift of negative value -1
Fix by casting the lhs of the left-shift operator to uint
before shifting. Since Qt assumes two's complement repre-
sentation of signed integers, this should yield the same
result as the old code, but without UBs.
It is critically important that the result is identical
to the old code (modulo the compiler exploiting the UB,
which this patch aims to prevent even in future compilers),
because the function is inline, and changing the hash value
would mean changing the layout of a QHash<QModelIndex,.>
between users compiled against the old and new libraries.
Change-Id: I7b826a34fb78b02021e40c3f85fd11af398dbec4
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Wrap C-string in QL1S to prevent memory allocation.
Replace startsWith() with comparing to first element of
(existing) splitting result.
Change-Id: Id47a0c350e4027abecd1394c1ee5dec8f346af00
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Remove:
- handling in abort(): timer will be stopped in resetSocketLayer();
- unneccesary checks in _q_testConnection(): if we have a valid timer
we should stop it anyway;
- code duplication in _q_testConnection(): do not try to stop the
timer twice.
Change-Id: I039ae583ae4e6c4a90dc102c7d93a30e46632374
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
In keyboardSearch(), QAbstractItemView unconditionally called
QElapsedTimer::restart().
Calling restart() on an invalid QElapsedTimer is undefined
behavior:
qelapsedtimer_unix.cpp:192:9: runtime error: signed integer overflow: 3313808 - -9223372036854775808 cannot be represented in type 'long int'
qelapsedtimer_unix.cpp:193:10: runtime error: signed integer overflow: 534150461 - -9223372036854775808 cannot be represented in type 'long int'
qelapsedtimer_unix.cpp:194:17: runtime error: signed integer overflow: -9223372036851462000 * 1000000000 cannot be represented in type 'long long int'
The code already checked the timer for validity, and did not
use the return value of restart() in case of an invalid timer,
but the check came too late.
Fix by checking the return value of QElapsedTimer::isValid()
earlier, and calling start() instead of restart() instead.
Fix the same error in QTreeView, which has a c'n'p copy of
the buggy code.
Change-Id: I9751465394707d9348d5c05a0b1b2be147eceb2e
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
The flags here are passed to a private QVariant constructor, and they
really represent a boolean - IsPointer or not.
Because the flag for the key_type was incorrectly populated with the
flag for the value_type, memory would be corrupted when using a mapping
type whose value_type is a pointer, but whose key type was not, such as
QMap<QString, int*>
This typo has been there since the concept was introduced in commit
v5.2.0-alpha1~807 (Add container access functionality for associative
containers in QVariant., 2013-04-05).
Task-number: QTBUG-52246
Change-Id: I9ecb13c603015eed2dc2ca43947fa0ecd6be8b5a
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
The QScrollerTimer instance allocated by QScrollerPrivate was never
freed. I've absolutely no idea why QScroller has such a messy
d-pointer handling, so go for the easiest approach: exploit the
fact that QScrollerPrivate is a QObject and parent the QScrollerTimer
to it.
Change-Id: I500edc9d0d14b2fb9eec02712229970eb2b9fe81
Task-number: QTBUG-52280
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
People use this, so make sure there's a test for it.
I don't expect this test to fail, but static and
dynamic checkers should be presented with this
use-case, so they have a chance of warning, because
certain implementation strategies of QPointer may
make this code undefined.
Change-Id: I334bd73204ba4e186c4098fc6b7188917407e020
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Fixes documentation warnings:
qtbase/src/network/kernel/qnetworkinterface.cpp:528: warning: Can't link to 'QUdpDatagram::interfaceIndex()'
qtbase/src/network/kernel/qnetworkinterface.cpp:587: warning: Can't link to 'QUdpDatagram::interfaceIndex()'
Change-Id: I6579f7880b5e183b9c68dfe08fa7671f1511fdfa
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Reviewed-by: Richard J. Moore <rich@kde.org>
- Directly link against dwmapi which should be present on
Windows Vista and remove duplicated header constants.
- Remove struct QWindowsShell32DL since all required functions
are present on Windows Vista.
- Remove functions that are no longer needed from QWindowsUser32DLL
with exception of the clipboard functions which are not present
in the MinGW stub libraries until v5.
Task-number: QTBUG-51673
Change-Id: Ia4a8a3f1db0f0d02322317d547e61ae39f9008b5
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
It is only set if the "Show passwords" option in Android's security
settings is enabled, the value is not updated at runtime as this option
isn't likely to be changed frequently, if at all.
The value of 1.5s is hardcoded in Android's PasswordTransformationMethod.
[ChangeLog][Android] Show password while typing is now supported
Task-number: QTBUG-48948
Change-Id: I9209b68c8684b825be196e8d0afd37cb0e0d141d
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Reviewed-by: Jason Erb
This fixes an inconsistency with all other files in platform plugins.
Change-Id: If790f51e250c1e3b2e4525efbc18c59be9c5568b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
Removing blacklistings from tests that are now passing.
Change-Id: I00aa1ce286d3e7715fb4bee4a36d0d77049a29ae
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@theqtcompany.com>
... by replacing QString::split() with QString::splitRef()
and using the new overloaded functions:
- QLocalePrivate::languageToCode(QStringRef)
- QLocalePrivate::languageToCode(const QChar*, int)
Change-Id: I2884bdc6d3e27963ce121d659a5e092b10b4ef8c
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
... for QStringRef and QChar array.
Now we can use QStringRef arg or QChar array arg to avoid
unnecessary allocations.
Also mark these functions as Q_DECL_NOTHROW.
Change-Id: Ibe75346d80cc413e303fad886ecb82dbdb89af24
Reviewed-by: Edward Welbourne <edward.welbourne@theqtcompany.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Now we can use QStringRef arg or QChar array arg to avoid
unnecessary allocations.
Also mark these functions as Q_DECL_NOTHROW.
Change-Id: I22b08a054051e80e3f76bb543d860f3dcb6caa4f
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
While extremely unlikely, there is a theoretical possibility that
the '0' glyph of a given font will have a width or height of 1 pixel,
in which case the (x + 1) / 2 way of getting the center would give us
an out of bounds pixel. We just default to true in this case, since
we cannot make any assumption based on the 0 glyph if it doesn't make
any sense. If the image is invalid, we default to false.
Change-Id: I36cea0b80c9d55aa10eb65db44d1b7ec8a40fc8c
Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
Some strings were drawn with a different size or scaling than what the
string itself said, causing confusion.
Change-Id: I4b187cba6d467cfa0900576bdf451052baa806e6
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
If moc is invoked with the @ argument and no options file is specified
or the options file cannot be read, do not try to parse the empty
arguments list. Otherwise QCommandLineParser will print an additional
error message that is of no value for the user.
Task-number: QTBUG-51847
Change-Id: I9aa1eb20a44097b553123be8bc6fded87473a03a
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
The test is preventing us to take RHEL 7.1 in the CI for Qt 5.7.
Changed the paintEvent() test to be less strict about the paintCount.
Task-number: QTBUG-51809
Change-Id: I84f797442e38c66dc23862e92eda6db08bcac368
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
QImage::pixel() assumed that the color table was valid
for the values in the bitmap. This was always wrong
for indexed images with explicit no color table set and
was wrong for mono images that were constructed from
preexisting data.
For mono images, we default to a black/white color table,
like we do when constructing with uninitialized data.
For indexed image, we always default to no color table,
but instead of crashing in pixel(), we warn and return
an undefined value.
[ChangeLog][QtGui][Image] Fixed possible crash in QImage::pixel()
for mono or indexed images.
Change-Id: Ieaf19c03984badddfd06e1855a7e287b862adc70
Task-number: QTBUG-50745
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Replace substring functions that return QString with
corresponding functions that return QStringRef where
it's possible.
Create QString from QStringRef only where necessary.
Change-Id: I697f776c60003629990cfd197534ffed63bafe2f
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Fixes the position of the input method window when High DPI scaling
is active.
Task-number: QTBUG-51923
Change-Id: I35ee4bcf320f8c2b7d5cc7fb8484348b18e1d833
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
Bump WINVER, _WIN32_WINNT in qt_windows.h and add a define in corelib.pro
overriding the definition in _mingw.h which would otherwise cause a conflict
in the precompiled header.
Task-number: QTBUG-51673
Change-Id: I1428a74b2f00295afd06a0af7769ebf729daebb9
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Remove #ifdef sections for Q_OS_WINCE and wince .pro file clauses in library,
and tests.
Task-number: QTBUG-51673
Change-Id: I55f61845c3b54027c467a5c59c122e7d16955358
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Program can't continue execution, if QByteArray::resize() fails.
Change-Id: I7138cadada0c1ecdb782daa32ab33b16f22291c6
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Extend the blacklist with Mali-T760 and Mali-T720 as found on Meizu
Pro 5 and Bq Aquaris M10 Ubuntu Editions. Reading from FBO like
taking screenshots does not produce correct result otherwise.
Initially reported at: https://launchpad.net/bugs/1557915 and
https://launchpad.net/bugs/1559906
Change-Id: Ic875bd083277bf933863a3a50f8e874dd6e04365
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
In case Qt::WindowTransparentForInput is set on a window, we
usually call [super someRelatedMethod] on a corresponding QNSView, for example,
[super mouseDown:theEvent]. Unfortunately, Cocoa will continue
to report the subsequent mouse dragging events to the first view where
mouse down occurred, despite of us passing mouse down to the next reponder.
Dragging events we'll also 'propagate' by calling super's method,
but it's not working properly, since the current view below
probably did not have that first mouse down event thus it does not have m_buttons set
correctly. And even worse with the closing mouseUp event. So, let's use
-hitTest: returning nil on such a 'transparent' view so that it's ignored by mouse events.
Task-number: QTBUG-40583
Change-Id: I5e0fef3e246a29332df758a692300d478b862069
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>