Commit Graph

20503 Commits

Author SHA1 Message Date
Shawn Rutledge
f5f8ee7af7 transient window manual test: set window type to Dialog
On X11, setting the transient parent is not enough to get it
centered w.r.t. its parent: it must also be a dialog window.

Change-Id: Icfc664e17e53f23cd025dead30e3966f859a1dc5
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
2014-10-20 11:03:30 +02:00
Paul Olav Tvete
1fe8a708cb Android: deadlock avoidance
This change adds deadlock protection to all places where we lock
one thread while waiting for the other to do something. If we
detect that the other thread is going to block, we abort the
operation. This could cause unexpected problems, such as painting
errors, text input errors, or even crashes, but the alternative is
a guaranteed deadlock.

Task-number: QTBUG-41369
Change-Id: I2627a955cfafc4bce54eb9d0d38e19b768b06956
Reviewed-by: Christian Stromme <christian.stromme@digia.com>
2014-10-20 10:23:47 +02:00
Paul Olav Tvete
1faba97683 Delay showing keyboard until application is active
Android starts asking lots of questions when the software keyboard
pops up, so let's wait until the application is initialized. This
works around a deadlock on startup.

Task-number: QTBUG-41369
Change-Id: I1c79e32d08c7cc11748ec55efbff3bc25e40f4b2
Reviewed-by: Christian Stromme <christian.stromme@digia.com>
2014-10-20 10:23:41 +02:00
Mitch Curtis
096d0ef02b Correct QPainter::clipPath() documentation.
Change-Id: Ie8ea01eee23e28378eadca0e87dc89fd62aec14f
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
2014-10-20 10:13:43 +02:00
Jocelyn Turcotte
c762c8accc Remove QOpenGLContextPrivate::globalShareContext
This has previously been replaced with qt_gl_global_share_context
and all using code has been ported to the new name at this point.

Change-Id: I13832f583456891dd057a7b414f45ec3e83f5698
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
2014-10-20 10:11:31 +02:00
Jørgen Lind
c231694949 Fix QOpenGLWindow tests when devicePixelRatio != 1
Change-Id: I83d71de8b9d735cd649a6c514e41a9ff23625005
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
2014-10-20 10:11:25 +02:00
Marc Mutz
bcda685be9 tst_QPointer: fix memleak
Benign, but easy to avoid by using automatic storage.

Change-Id: I60a1a2e85d8c1b2d91f3f33973374afae8876340
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2014-10-19 13:18:23 +02:00
Marc Mutz
9dcc38b566 QEasingCurve: fix mem leak in operator>>
The code ignored that the QEasingCurve passed in to op>>
might already have a QEasingCurveFunction set, overwriting
it with a new pointer without deleting the old.

Change-Id: Ic14cf7e4b97c7c8c7edb64cde08fbf22c07ac8f3
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2014-10-19 13:18:18 +02:00
Marc Mutz
665966d243 tst_QState: fix memleaks
Benign, but easy to avoid by allocating objects on the stack.

Change-Id: I1933d0abb2ebd53bcf0402f392e7e3c201756b9e
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2014-10-19 13:18:12 +02:00
Marc Mutz
0ebd05686d tst_QThreadPool: fix memleak
Benign, but easy to avoid by using the same pattern as in clear().

Change-Id: Ie382313343385f0709519b232a7d58dd8181b8de
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2014-10-19 13:18:07 +02:00
Marc Mutz
4cf9168630 tst_QSharedPointer: fix memleak
Benign, but easy to avoid by using automatic storage.

Change-Id: I4eefce9a7c902ceadebdd0aba1bbba7e5519cf24
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2014-10-19 13:18:02 +02:00
Marc Mutz
d78bbf8c81 tst_QMetaType: fix memleaks
Benign, but easy to avoid by distinguishing between
owning and non-owning smart pointers.

Change-Id: Idcd7ae550a8e4e00dfcd5570790e2ed985e2379a
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
2014-10-19 13:17:53 +02:00
Marc Mutz
14ea26f708 tst_QMimeData: test doesn't require QGuiApplication
Makes the test execute faster (not that it's slow in any way)
and more importantly gets rid of the QGuiApplication-induced
3rd-party library leaks reported by asan and/or valgrind.

Change-Id: I94b505f15b4db577a2807b0b81464e19ce7e7cab
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2014-10-19 13:17:46 +02:00
Marc Mutz
ef1027b824 qdatetime.h: include correct header
QExplicitlySharedDataPointer is defined in qshareddata.h, not qsharedpointer.h.

Change-Id: If81f6615681068a8e8c38817044ea3a0433c42ab
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-10-19 13:17:24 +02:00
BogDan Vatra
c5b0308dc5 Android: Update Ministro's requirements.
Task-number: QTBUG-41968
Change-Id: Ia0c204dd87b9de3cbb7bb388099c435b855ad4d5
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
2014-10-19 11:38:33 +02:00
Richard Moe Gustavsen
e5f48c63d2 Widgets: only update IM if the widget is the current focus object
QInputMethod works on focusObject, not focusWidget. These two
are not always the same, and sometimes the focusObject is also
NULL. In either case, we should not tell QInputMethod to
commit, reset or otherwise emit signals based on the internal
state of widgets that are not the focus object.

This led to a crash on iOS, since we got a call to
cursorRectangleChanged when focus object was NULL, which
the code didn't (and shouldn't need to) take into account.

Change-Id: I54e40d7ec35210ba6599a78c5a8c7f982a1c3dbb
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
2014-10-19 09:57:45 +02:00
Marc Mutz
32dfbd6dbf Add qHash(QSslError) overload
qsslsocket_winrt.cpp defined it locally, which runs the risk of
clashes with a potential user-defined qHash(QSslError), so
make it public.

Also included both .error() and .certificate() in the hash, as
both of these are used to determine equality (the WinRT version
only used .error()).

[ChangeLog][QtNetwork][QSslError] Can now be used in QSet/QHash.

Change-Id: Ieb7995bed491ff011d4be9dad544248b56fd4f73
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
Reviewed-by: Andrew Knight <andrew.knight@digia.com>
2014-10-19 07:32:41 +02:00
Marc Mutz
e8bdc949fc Add qHash(QSslCertificate) overload
qsslsocket_winrt.cpp defined it locally, which runs the risk of
clashes with a potential user-defined qHash(QSslCertificate), so
make it public.

Also, the implementation in qsslsocket_winrt.cpp simply hashed
the handle(), which violates the principle that equal instances
must hash to the same value. Also, for some platforms, the
implementation returns nullptr unconditionally, which, while not
violating the above-mentioned principle, will make all users of
the hash have worst-case complexity.

To calculate a meaningful hash, therefore, the certificate needs
to be inspected deeper than just the handle.

For OpenSSL, we use X509::sha1_hash, which also X509_cmp uses
internally to determine inequality (it checks more stuff, but
if X059::sha1_hash is different, X509_cmp() returns non-zero,
which is sufficient for the purposes of qHash()). sha1_hash may
not be up-to-date, though, so we call X509_cmp to make it valid.
Ugh.

For WinRT/Qt, we use the DER encoding, as that is the native
storage format used in QSslCertificate. This is not equivalent
to the implementation used in qsslsocket_winrt.cpp before, but
since handle() == handle() => toDer() == toDer(), it should not
be a problem.

[ChangeLog][QtNetwork][QSslCertificate] Can now be used as a key in QSet/QHash.

Change-Id: I10858fe648c70fc9535af6913dd3b7f3b2cf0eba
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
2014-10-19 07:32:37 +02:00
Marc Mutz
adadb5e870 QSizePolicy: remind to mark as Q_PRIMITIVE_TYPE in Qt 6
Change-Id: I1f18b4cd99f37aadf199e70d3acade9c8f5f9799
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-10-19 07:32:21 +02:00
Richard Moe Gustavsen
e57153b082 iOS: ensure we have a valid focusObject before sending it IM events
Should not really happen, but since we don't store the focus
object given to us, we should do a check.

A crash was seen from this when running the "Application"
example for widgets.

Change-Id: I9c4121766d7028a4eceede7d7b15c8c53d34e16e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
2014-10-19 00:57:29 +02:00
Richard Moe Gustavsen
0ed65a6513 iOS: ignore sender of actions for edit menu
The reason is that the sender is sometimes 'NULL', so
we cannot rely on it. But the current test with our
prefix should suffice.

Change-Id: Ie58bf062cbade08feda622bda753d63e1d811a8d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
2014-10-19 00:56:18 +02:00
Richard Moe Gustavsen
3797ee7747 CoreText font database: Use dynamic type on iOS to resolve theme fonts
Use Dynamic Type to resolve theme fonts, so that we get the
correct font sizes and styling based on user preferences
in Settings app.

Change-Id: I2222199a5ba21badb2e3696993eee503e720c476
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
2014-10-19 00:56:04 +02:00
Richard Moe Gustavsen
fc567acefb iOS: ensure edit menu works on iOS6
Method "- (id)targetForAction:(SEL)action withSender:(id)sender" is
only available from iOS7. So change implementation to use
whats available on iOS 6.

Change-Id: I4e21495073364e83ef396dfab47a7ea2a23bbead
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
2014-10-19 00:55:49 +02:00
Dyami Caliri
1cfd457826 OS X: Emit QClipboard::dataChanged when activating application
The QClipboard documentation states that on OS X it will emit
dataChanged() when activating the application, if the system clipboard
had changed. It wasn't doing this in Qt5.

Task-number: QTBUG-34941
Change-Id: I7f34e757876757691f0a6c94dd2ae76a60146291
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
2014-10-18 18:35:49 +02:00
Morten Johan Sørvig
cd512cbcab Bump default deployment target to 10.7
10.6 is no longer supported.

Change-Id: I4c799ba2a9622aa1dd8a79ff70608b50b2bbd26a
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
2014-10-18 13:25:08 +02:00
Gabriel de Dietrich
59ebcdc540 Merge "Merge remote-tracking branch 'origin/5.3' into 5.4" into refs/staging/5.4 2014-10-18 13:24:33 +02:00
Gabriel de Dietrich
cb2e65eea2 QMacStyle: Fix QSlider appearance on Yosemite
First, we adjust the min and max positions, which HITheme has been
unable to render properly for years. This involves separating the
knob and track rendering. Also, on Yosemite, the tickmarks-less
slider shows a blue progress fill in the track, on the knob's left
side. Finaly, and this is valid for all versions, the tickmarks are
being drawn before the knob (or the whole slider for OS X versions
before 10.10)

Change-Id: I6fce2e298a80858a18fd9fe1e799b65265a8aefd
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
2014-10-18 13:24:21 +02:00
Gabriel de Dietrich
8dd15fd955 QMacStyle: Add optional block parameter to drawNSViewInRect()
In some cases we want to do something different than just calling
- [NSView drawRect:].

Change-Id: I7db704daa39611f33f270b0192c4301de62ec1bf
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
2014-10-18 13:24:13 +02:00
Marc Mutz
239b71d07d Fix use-after-delete bug in tst_QWidget::taskQTBUG_27643_enterEvents()
ASAN report:

  READ of size 8 at 0x606000011990 thread T0
    #0 0x505e3b in EnterTestMainDialog::eventFilter(QObject*, QEvent*) tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp:10294
    [...]

  0x606000011990 is located 48 bytes inside of 56-byte region [0x606000011960,0x606000011998)
  freed by thread T0 here:
    #0 0x2b8df3551c79 in operator delete(void*) ../../../../gcc/libsanitizer/asan/asan_new_delete.cc:92
    #1 0x418ab5 in EnterTestMainDialog::buttonPressed() tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp:10276

  previously allocated by thread T0 here:
    #0 0x2b8df3551739 in operator new(unsigned long) ../../../../gcc/libsanitizer/asan/asan_new_delete.cc:60
    #1 0x4188cf in EnterTestMainDialog::buttonPressed() tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp:10272

EnterTestMainDialog::eventFilter() checks for nullness of 'modal'
before accessing it, but buttonPressed() did not reset 'modal'
to nullptr after deletion.

Change-Id: I65562a29f8264a6996d7d615e06de1d1afb5af53
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
2014-10-18 00:33:03 +02:00
Alexander Volkov
4de382f4a2 Make font hinting and antialiasing size dependent when using FontConfig
Add the pixel size of the font to the search pattern to get size dependent
font settings. This patch allows to take into account KDE settings for
font sizes which should be excluded from antialiasing.

Change-Id: I8bd8b7b3d585009d0a39db631cd02b7970537f5c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
2014-10-17 22:48:37 +02:00
Mitch Curtis
06e706bdbb Fix QAbstractListModel's detailed description.
Change-Id: I3f3e6b9d4e021620505c03458e78856326dcd859
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
2014-10-17 22:14:00 +02:00
Christian Strømme
3d94a564f4 Android: Improve cache logic in findClass()
This change adds guards to ensure that we only do a class
look-up once when calling QJNIEnvironmentPrivate::findClass().
IF someone calls findClass() with an environment that does not contain
a "valid" class loader, we should fallback to loadClass(),
but only once.

Change-Id: If5fc82956db889f3269bb33c98a16c49cae55def
Reviewed-by: Yoann Lopes <yoann.lopes@theqtcompany.com>
2014-10-17 14:58:23 +02:00
Topi Reinio
cf8f369f85 Move Qt Core examples under a common subdirectory
Qt Core examples were scattered into several subdirectories under
qtbase/examples. This caused an issue with the example manifest
file generated by QDoc; it expects to find all examples under a
common directory in order to produde correct paths to the example
.pro files. Qt Creator will not find the examples without a valid
manifest file.

This change moves the examples and edits the documentation files
accordingly.

Task-number: QTBUG-41963
Change-Id: I51d86782e0ba21c5c9bae5f15401ec774abe5cf8
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com>
2014-10-17 14:57:13 +02:00
Marc Mutz
45485d9eb4 Fix undefined behavior in QLoggingRegistry::defaultCategoryFilter()
Report by asan:

  READ of size 2 at 0x00000041dd40 thread T0
    #0 0x2af097b84da6 in QLoggingRegistry::defaultCategoryFilter(QLoggingCategory*) (lib/libQt5Core.so.5+0x566da6)
    #1 0x2af097b8387b in QLoggingRegistry::registerCategory(QLoggingCategory*, QtMsgType) (lib/libQt5Core.so.5+0x56587b)
    #2 0x4067f7 in tst_QLogging::QLoggingCategory_categoryName() tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp:238
    <snip>

  0x00000041dd41 is located 0 bytes to the right of global variable '*.LC115' defined in 'tests/auto/corelib/io/qloggingcategory/tst_qloggingcategory.cpp' (0x41dd40) of size 1
    '*.LC115' is ascii string ''

At face value, memcmp("", "qt", 2) should not return 0, but since
the code invokes undefined behavior, the compiler can do whatever
it wants, including returning 0 here, further proving the fact
that there are *no* benign cases of undefined behavior.

Change-Id: I0c38622c47d1dcea450ea549370be1673b47b18d
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
2014-10-17 14:56:07 +02:00
Friedemann Kleint
db069e7f30 XCB: Always set X window attributes in QXcbWindow::setWindowFlags().
QDockWidget and QToolBar set the Qt::BypassWindowManagerHint window flag
when unplugging and clear it in the endDrag() methods. This does not have
any effect since the attribute is not taken into account in
QXcbWindow::setWindowFlags(). Change the method to always set the attributes,
which should also make it possible to set/clear Qt::WindowTransparentForInput.

Task-number: QTBUG-41189
Task-number: QTBUG-38964
Change-Id: Id9eddc642489d18f44c7597f8fc1a1df71971306
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
Reviewed-by: Gatis Paeglis <gatis.paeglis@digia.com>
2014-10-17 14:56:05 +02:00
Kai Koehne
16df1ad322 Export QFSFileEngine symbols
Although it's private API the symbols are used e.g. in the
Qt Installer Framework.

Change-Id: I557d3b86dbf87cb1b712bae09c3e8fecf6f15e67
Reviewed-by: hjk <hjk121@nokiamail.com>
2014-10-17 14:55:59 +02:00
Friedemann Kleint
0368b24a7f QSettings: Prevent assert when passing empty keys.
[ChangeLog][Important behavior changes][QSettings]
QSettings::value() now returns an invalid QVariant
when passing an empty key. The code path ran into
an assert, which was only noticeable in debug
builds.

Task-number: QTBUG-41812
Change-Id: I5cc32be3aa267a132e9d6639ecd6cb0bbafc15b0
Reviewed-by: Stéphane Fabry, Cutesoft <stephane.fabry@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-10-17 14:55:45 +02:00
Alexander Volkov
1b8c5f450b xcb: Fix a type of variables for xkb modifiers masks
Change-Id: I05c7c6a649a55fc0648b1cb84e1c402160c9d998
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Gatis Paeglis <gatis.paeglis@digia.com>
2014-10-16 21:51:31 +02:00
Alexander Volkov
50398708cd Accessibility Linux: Make a full copy of a key event
Otherwise native values (scan code, modifiers, virtual key) of the key event
will be lost if an event listener is registered.

Change-Id: I5eebb1f91ad7de6801f7efb0bf0891c4430f9cf5
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
2014-10-16 21:51:05 +02:00
Alexander Volkov
e8e1616cf2 Reduce code duplication in QFontconfigDatabase
Extract common part from fontEngine() methods to setupFontEngine().

Change-Id: Id4aee43b2a477f9fd40dc564d96a2335bfde9e22
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
2014-10-16 21:49:21 +02:00
Alexander Volkov
d904533acb xcb: Don't return 0 as a possible key for a shortcut
QXcbKeyboard::keysymToQtKey() may return a value of 0 for keysyms
that are not supported by Qt (e.g. for XK_ISO_Next_Group).
It is then translated to an empty QKeySequence which in turn is
detected as a partial match for any shortcut.
The behavior of QShortcutMap::nextState() becomes broken because
it sets current state to QKeySequence::PartialMatch while there is
no match at all.

Task-number: QTCREATORBUG-9589
Change-Id: I1e2a4511a876dfa418db9906d10382255a2e4d62
Reviewed-by: Gatis Paeglis <gatis.paeglis@digia.com>
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
2014-10-16 21:49:02 +02:00
Laszlo Agocs
6d1c4c8862 Avoid breaking BC with new virtuals in QOpenGLPaintDevice
Task-number: QTBUG-41046
Change-Id: Iab628d2d6811d528e2cc513b6f8a74baa628541d
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
2014-10-16 21:47:29 +02:00
Friedemann Kleint
a4ac4b3263 QWindowsGuiEventDispatcher: Register timers in constructor.
Port change 3716a76704273fdbe5ad4ec978438daeda606c26 (Qt 4)
to Qt 5. Enforce the creation of the internal window
and registering of timers in the event dispatcher constructor
for GUI applications instead of delaying it to processEvents()
is called. Move the call to virtual wakeUp() out of
createInternalHwnd().

Task-number: QTBUG-40881
Change-Id: I82a4748897da140a39feff882c75ad5ac6155148
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
2014-10-15 15:16:38 +02:00
Friedemann Kleint
7095cdabc9 QTestLib: Remove valgrind version check.
Version 3.3 is now assumed to be widely available.

Task-number: QTBUG-41453
Change-Id: I453ce26d170b2bbb8179ddf4b91155ddd3e6379a
Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Reviewed-by: Jason McDonald <macadder1@gmail.com>
2014-10-15 15:16:29 +02:00
Topi Reinio
65b563fe57 qdoc: Fixed recursion of \sincelist command handling
QDoc uses a recursive method of resolving all the classes, QML types,
properties, functions etc. added since a specified Qt version.

The code entered the next level of recursion only if its parent had
set a \since version, which was not always the case.

Task-number: QTBUG-41862
Change-Id: I3803ed9ffa472165754358f3906955430a893de1
Reviewed-by: Martin Smith <martin.smith@digia.com>
2014-10-15 14:47:27 +02:00
Jan Arve Saether
648623ff23 Consolidate how contentDescription is calculated.
Previously, the behavior was different depending on if the
contentDescription was calculated as a result of an event, or if it was
calculated as a result of hierarchy traversal.
Refactor the functionality into one single function that will be used in
both scenarios.

'contentDescription' will now receive its value from one of the following
sources, listed in prioritised order (QAI == QAccessibleInterface):
1. QAI::text(QAccessible::Name)
2. QAI::text(QAccessible::Description)
3. QAI::text(QAccessible::Value)
4. QAI::valueInterface()->currentValue()

Change-Id: I2e4958a1e95b5f20d01da37c23ecbc09842360bc
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
2014-10-15 14:24:46 +02:00
Oswald Buddenhagen
29ad07d0a4 Avoid sleeping 100ms in QProcessPrivate::drainOutputPipes()
There is no point in waiting 100 milliseconds after each iteration, as
all data that we may possibly read will be already in the pipe. We only
need to give the notifier thread a chance to inform us, which is best
achieved with a yield.

Task-number: QTBUG-41282
Change-Id: Id654b688246508494a5549c11900f9ad2957f192
Reviewed-by: Alessandro Portale <alessandro.portale@digia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2014-10-15 13:44:17 +02:00
Tor Arne Vestbø
3edce263fb Prevent 'recursive' update events when calling QToolButton::setMenu()
Commit bb3d2ca9f1 (QToolButton: properly reset the size hint when a
menu is set on it) didn't take the case of re-setting the same menu
into account, and the result was that we would unconditionally cause
an update, resulting in the following backtrace again and again, as
each posted update event was processed by the event loop:

    frame #0: QToolButton::setMenu(this=0x7af59500, menu=0x00000000)
    frame #1: QToolBarLayout::setUsePopupMenu(this=0x7ae65a30, set=false)
    frame #2: QToolBarLayout::checkUsePopupMenu(this=0x7ae65a30)
    frame #3: QToolBarAreaLayoutLine::fitLayout(this=0x78e5f870)
    frame #4: QToolBarAreaLayoutInfo::fitLayout(this=0x790be278)
    ...

Besides consuming needless CPU time this also uncovered a case on iOS
where Qt would starve native events and animations from being processed,
preventing eg. rotation animations from running.

Change-Id: Ib6bd4ba21d8e84ca73fb0a75b598016dbd9ae0fd
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
2014-10-15 13:34:30 +02:00
Morten Johan Sørvig
f5cf06f4af Cocoa: Send obscure events on OcclusionStateHidden
This disables animations for windows that are
completely obscured by other windows.

On examples/quick/animation, obscured CPU usage goes
from 10% to 1%.

Change-Id: I9945431e6387e406e2064c08d5aa01d5d96ef602
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
2014-10-14 18:15:04 +02:00
Laszlo Agocs
ebc835c2aa Fix QOpenGLWidget on Cocoa when used as viewport
Having a QOpenGLWidget as a graphics view viewport was not functioning
on OS X: it was showing incomplete content due to accessing the texture
attached to the framebuffer object before the rendering is complete.

On the normal path, when rendering is done via paintGL(), the flush was
there. When used as a viewport however, this path is not used. The missing
flush is now added for the other case too. For performance reasons, we will
not flush on every paint engine end(). Instead, the flush is deferred until
composition starts.

QGLWidget also featured a weird on-by-default autoFillBackground concept. To
maintain compatibility with apps that used QGLWidget as the viewport for
QGraphicsView, we will now do the same for QOpenGLWidget, but only when it
is used as a viewport. For regular QOpenGLWidgets autoFillBackground defaults
to false, like for any other widget. The docs are extended with a small section
about differences between QGLWidget and QOpenGLWidget.

Task-number: QTBUG-41046
Change-Id: I42c2033fdd2ef5815783fd640fe11373761061e0
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
2014-10-14 18:14:52 +02:00