/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Design Studio documentation.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
**
****************************************************************************/

/*!
    \qmltype Triangle
    \inqmlmodule QtQuick.Studio.Components
    \since QtQuick.Studio.Components 1.0
    \inherits ShapePath
    \ingroup qtquickstudio-components

    \brief A triangle.

    The Triangle type can be used to draw triangles with different dimensions
    and shapes. The type is enclosed in an invisible \l Rectangle type. The size
    of the triagle is determined by the size of the bounding rectangle. The
    dimensions of the triangle can be changed to make it elongated or squatter
    with space around it by using the \l leftMargin, \l topMargin,
    \l rightMargin, and \l bottomMargin properties. The margins are set between
    the triangle and the edges of the parent rectangle.

    Each Triangle item is painted using either a solid fill color, specified
    using the \l fillColor property, or a gradient, defined using one of the
    \l ShapeGradient subtypes and set using the \l gradient property.
    If both a color and a gradient are specified, the gradient is used.

    An optional border can be added to a triangle with its own color and
    thickness by setting the \l strokeColor and \l strokeWidth properties.
    Setting the color to \c transparent creates a border without a fill color.

    \section2 Example Usage

    You can use the Triangle component in \QDS to create triangles in different
    shapes and colors.

    \image studio-triangle.png

    The QML code looks as follows:

    \code
    TriangleItem {
        id: triangle
        strokeColor: "gray"
        fillColor: "light gray"
    }

    TriangleItem {
        id: squatTriangle
        bottomMargin: 10
        topMargin: 30
        fillColor: "#d3d3d3"
        strokeColor: "#808080"
    }

    TriangleItem {
        id: elongatedTriangle
        leftMargin: 15
        rightMargin: 15
        fillColor: "#d3d3d3"
        strokeColor: "#808080"
    }

    TriangleItem {
        id: pear
        radius: 20
        fillColor: "light gray"
        bottomMargin: 10
        arcRadius: 20
        strokeColor: "#808080"
    }
    \endcode
*/

/*!
    \qmlproperty ShapePath Triangle::dashOffset

    The starting point of the dash pattern for the triangle border.

    The offset is measured in terms of the units used to specify the dash
    pattern. For example, a pattern where each stroke is four units long,
    followed by a gap of two units, will begin with the stroke when drawn
    as a line. However, if the dash offset is set to 4.0, any line drawn
    will begin with the gap. Values of the offset up to 4.0 will cause part
    of the stroke to be drawn first, and values of the offset between 4.0 and
    6.0 will cause the line to begin with part of the gap.

    The default value is 0.

    \sa QPen::setDashOffset()
*/

/*!
    \qmlproperty ShapePath Triangle::dashPattern

    The dash pattern of the triangle border specified as the dashes and the
    gaps between them.

    The dash pattern is specified in units of the pen's width. That is, a dash
    with the length 5 and width 10 is 50 pixels long.

    The default value is (4, 2), meaning a dash of 4 * \l strokeWidth pixels
    followed by a space of 2 * \l strokeWidth pixels.

    \sa QPen::setDashPattern()
*/

/*!
    \qmlproperty ShapePath Triangle::fillColor

    The triangle fill color.

    A gradient for the fill can be specified by using \l gradient. If both a
    color and a gradient are specified, the gradient is used.

    When set to \c transparent, no filling occurs.

    The default value is \c white.
*/

/*!
    \qmlproperty ShapePath Triangle::gradient

    The gradient of the triangle fill color.

    By default, no gradient is enabled and the value is null. In this case, the
    fill uses a solid color based on the value of \l fillColor.

    When set, \l fillColor is ignored and filling is done using one of the
    \l ShapeGradient subtypes.

    \note The \l Gradient type cannot be used here. Rather, prefer using one of
    the advanced subtypes, like \l LinearGradient.
*/

/*!
    \qmlproperty enumeration Triangle::joinStyle

    The join style used to connect two triangle line segments.

        \value ShapePath.MiterJoin
           The outer edges of the lines are extended to meet at an angle, and
           this area is filled.
    \value ShapePath.BevelJoin
           The triangular notch between the two lines is filled.
           This is the default value.
    \value ShapePath.RoundJoin
           A circular arc between the two lines is filled.

    \sa Qt::PenJoinStyle
*/

/*!
    \qmlproperty ShapePath Triangle::strokeColor

    The color used to draw the border of the triangle.

    When set to \c transparent, no line is drawn.

    The default value is \c white.

    \sa QColor
*/

/*!
    \qmlproperty ShapePath Triangle::strokeStyle

    The style of the triangle border.

    \value ShapePath.SolidLine
           A solid line. This is the default value.
    \value ShapePath.DashLine
           Dashes separated by a few pixels.
           The \l dashPattern property specifies the dash pattern.

    \sa Qt::PenStyle
*/

/*!
    \qmlproperty ShapePath Triangle::strokeWidth

    The width of the border of the rectangle.

    A width of 1 creates a thin line. For no line, use a negative value or a
    transparent color.

    \note The width of the rectangle's border does not affect the geometry of
    the rectangle itself or its position relative to other items if anchors are
    used.

    The border is rendered within the rectangle's boundaries.
*/

/*!
    \qmlproperty int Triangle::radius

    Defines the rotation of the triangle in degrees. The default value is 0.

    This property can be used together with the \l radius property to
    determine the shape of the triangle.

    \sa arcRadius
*/

/*!
    \qmlproperty real Triangle::arcRadius

    The radius used to draw rounded corners.

    If radius is non-zero, the corners will be rounded, otherwise they will
    be sharp.

    This property can be used together with the \l radius property to
    determine the shape of the triangle.
*/

/*!
    \qmlproperty real Triangle::leftMargin

    The left margin between the triangle and the bounding rectangle.

    Setting the left and right margins makes the triangle thinner and moves it
    away from the edge.

    \sa rightMargin, topMargin, bottomMargin
*/

/*!
    \qmlproperty real Triangle::topMargin

    The top margin between the triangle and the bounding rectangle.

    Setting the top and bottom margins makes the triangle lower and moves it
    away from the edge.

    \sa bottomMargin, leftMargin, rightMargin
*/

/*!
    \qmlproperty real Triangle::rightMargin

    The left margin between the triangle and the bounding rectangle.

    Setting the left and right margins makes the triangle thinner and moves it
    away from the edge.

    \sa leftMargin, topMargin, bottomMargin
*/

/*!
    \qmlproperty real Triangle::bottomMargin

    The top margin between the triangle and the bounding rectangle.

    Setting the top and bottom margins makes the triangle shorter and moves it
    away from the edge.

    \sa topMargin, leftMargin, rightMargin
*/

/*!
    \qmlproperty bool Triangel::antialiasing

    Whether the triangle should be antialiased.

    Antialiasing might require more memory and slow down drawing the type.
*/
