TestOverloads Class | Qt
Description: Demonstrates multiple overloads and the \overload primary feature.

# TestOverloads Class

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

Header: | `#include <TestOverloads>`

- List of all members, including inherited members

## Static Public Members

`(since 6.11)` void | failOnWarning(const RegularExpression &messagePattern)
`(since 6.11)` void | failOnWarning()
`(since 6.11)` void | failOnWarning(const char *message)
`(since 6.11)` void | linkingTest()
`(since 6.11)` void | linkingTest(const char *message)
`(since 6.11)` void | linkingTest(int value)
`(since 6.11)` void | parameterWarningTest(int param)
`(since 6.11)` void | parameterWarningTest(const RegularExpression &pattern, bool enabled)
`(since 6.11)` void | parameterWarningTest(const char *message, int level)
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(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 function was introduced in Qt 6.11.

### `[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 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, since 6.11]` void TestOverloads::linkingTest()

Test function to validate QTBUG-140508: Primary overloads should not display "This function overloads..." text. Instead, they should appear as the main documentation entry.

This function demonstrates the intended behavior where the primary overload contains the main documentation and does not show overload linking text.

This function was introduced in Qt 6.11.

### `[static, since 6.11]` void TestOverloads::linkingTest(const char *message)

Another overload that should link to the primary linkingTest() function.

This function overloads TestOverloads::linkingTest().

This function was introduced in Qt 6.11.

### `[static, since 6.11]` void TestOverloads::linkingTest(int value)

This overload should show "This function overloads linkingTest()." and successfully link to the primary overload above.

This function overloads TestOverloads::linkingTest().

This function was introduced in Qt 6.11.

### `[static, since 6.11]` void TestOverloads::parameterWarningTest(int param)

Test function to validate QTBUG-140510: Functions marked with \overload primary should require parameter documentation just like non-overloaded functions, since they serve as the main documentation for their function family.

This primary overload has a parameter param that is documented here, demonstrating the correct practice for primary overload documentation.

This function was introduced in Qt 6.11.

### `[static, since 6.11]` void TestOverloads::parameterWarningTest(const RegularExpression &pattern, bool enabled)

Another overload that correctly does not generate parameter warnings. Parameters are intentionally undocumented to test regular overload behavior.

This function overloads TestOverloads::parameterWarningTest().

This function was introduced in Qt 6.11.

### `[static, since 6.11]` void TestOverloads::parameterWarningTest(const char *message, int level)

This overload correctly does not generate undocumented parameter warnings for its parameters, because regular overloads inherit their documentation from the primary overload. The parameters are intentionally not documented to test that the warning suppression works for regular overloads.

This function overloads TestOverloads::parameterWarningTest().

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.

### `[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.