[Development] Calling QWindow::requestActivate after QWindow::show and before QTest::qWaitForWindowActive
Giuseppe D'Angelo
giuseppe.dangelo at kdab.com
Wed Aug 13 11:50:06 CEST 2025
Il 13/08/25 11:40, Tor Arne Vestbø ha scritto:
>> On 13 Aug 2025, at 11:30, Giuseppe D'Angelo via Development<development at qt-project.org> wrote:
>>
>> More on topic: if ultimately it is platform specific whether show() alone is sufficient or one needs show()+requestAcivate() (+ QVERIFY), couldn't this combination be packaged in some QtTest helper function, so that people can simply call that function and it'll always do the right
> Yes. Though we should stive to use it only when the test actually requires focus. Running tests locally with windows that steal focus unnecessarily is a bit annoying. Of course these things are typically cargo-culled, which is how we probably ended up with the current state of every test requesting activation explicitly after show.
A packaged function would actually allow for an easier way out of the
cargo cult, as one could centrally switch its implementation from
show()+requestActivate() to show() alone and start monitor exactly what
breaks after that, then investigate why.
My 2 c,
--
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - Trusted Software Excellence
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4850 bytes
Desc: Firma crittografica S/MIME
URL: <http://lists.qt-project.org/pipermail/development/attachments/20250813/9e1f1408/attachment-0001.bin>
More information about the Development
mailing list