• TestOverloads
  • TestOverloads Class

    Demonstrates multiple overloads and the \overload primary feature. More...

    Header: #include <TestOverloads>

    Static Public Members

    (since 6.11) void failOnWarning()
    (since 6.11) void failOnWarning(const RegularExpression &messagePattern)
    (since 6.11) void failOnWarning(const char *message)
    void primary()
    void primary(const char *message)
    void primary(int value)
    void testFullyQualified()

    Detailed Description

    This test case demonstrates various scenarios for the \overload command:

    1. Original issue: Using \overload with unqualified function names (e.g., \overload failOnWarning()) creates dead links when there are multiple overloads and QDoc cannot determine which overload should be the primary target.
    2. Solution: The \overload primary command allows explicitly designating which overload should be the primary target for unqualified \overload references.
    3. Corner case: Functions named "primary" to test whether the function name conflicts with the "primary" keyword in \overload commands.

    The failOnWarning() functions demonstrate the original problem and its solution, while the primary() functions test the corner case where a function happens to be named "primary".

    Member Function Documentation

    [static, since 6.11] void TestOverloads::failOnWarning()

    This should link to the primary failOnWarning function, but creates dead links when there are multiple overloads and no clear primary function.

    Issue: QDoc cannot resolve which of the three failOnWarning overloads this should link to.

    This function overloads TestOverloads::failOnWarning().

    This function was introduced in Qt 6.11.

    [static, since 6.11] void TestOverloads::failOnWarning(const RegularExpression &messagePattern)

    Appends a test failure to the test log for each warning that matches \a messagePattern.

    This is explicitly marked as the primary overload with \overload primary. Other overloads should now link to this function when using unqualified \overload commands.

    This is an overloaded function.

    This function was introduced in Qt 6.11.

    [static, since 6.11] void TestOverloads::failOnWarning(const char *message)

    Another overload using the same unqualified \overload target. This also creates dead links for the same reason as above.

    This function overloads TestOverloads::failOnWarning().

    This function was introduced in Qt 6.11.

    [static] void TestOverloads::primary()

    Corner case test: This function is named "primary" and is marked as the primary overload. This tests whether the word "primary" as a function name conflicts with the "primary" keyword in the \overload command.

    This should work correctly because the "primary" keyword is parsed in the context of the \overload command, not as a function name reference.

    This is an overloaded function.

    [static] void TestOverloads::primary(const char *message)

    Another overload of the function named "primary". This should also link to the parameterless primary() function, testing that multiple overloads of a function named "primary" work correctly with the \overload system.

    This function overloads TestOverloads::primary().

    [static] void TestOverloads::primary(int value)

    Corner case test: This should link to the primary() function above, demonstrating that \overload primary() correctly references the function named "primary" rather than being confused with the "primary" keyword.

    This tests the scenario where a function name happens to be "primary".

    This function overloads TestOverloads::primary().

    [static] void TestOverloads::testFullyQualified()

    This uses a fully qualified \overload target to demonstrate the current workaround mentioned in the bug report. This should generate a working link.