qpen.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 **
00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
00004 ** All rights reserved.
00005 ** Contact: Nokia Corporation (qt-info@nokia.com)
00006 **
00007 ** This file is part of the QtGui module of the Qt Toolkit.
00008 **
00009 ** $QT_BEGIN_LICENSE:LGPL$
00010 ** Commercial Usage
00011 ** Licensees holding valid Qt Commercial licenses may use this file in
00012 ** accordance with the Qt Commercial License Agreement provided with the
00013 ** Software or, alternatively, in accordance with the terms contained in
00014 ** a written agreement between you and Nokia.
00015 **
00016 ** GNU Lesser General Public License Usage
00017 ** Alternatively, this file may be used under the terms of the GNU Lesser
00018 ** General Public License version 2.1 as published by the Free Software
00019 ** Foundation and appearing in the file LICENSE.LGPL included in the
00020 ** packaging of this file.  Please review the following information to
00021 ** ensure the GNU Lesser General Public License version 2.1 requirements
00022 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
00023 **
00024 ** In addition, as a special exception, Nokia gives you certain additional
00025 ** rights.  These rights are described in the Nokia Qt LGPL Exception
00026 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this module.
00027 **
00028 ** GNU General Public License Usage
00029 ** Alternatively, this file may be used under the terms of the GNU
00030 ** General Public License version 3.0 as published by the Free Software
00031 ** Foundation and appearing in the file LICENSE.GPL included in the
00032 ** packaging of this file.  Please review the following information to
00033 ** ensure the GNU General Public License version 3.0 requirements will be
00034 ** met: http://www.gnu.org/copyleft/gpl.html.
00035 **
00036 ** If you have questions regarding the use of this file, please contact
00037 ** Nokia at qt-info@nokia.com.
00038 ** $QT_END_LICENSE$
00039 **
00040 ****************************************************************************/
00041 
00042 #ifndef QPEN_H
00043 #define QPEN_H
00044 
00045 #include <QtGui/qcolor.h>
00046 #include <QtGui/qbrush.h>
00047 
00048 QT_BEGIN_HEADER
00049 
00050 QT_BEGIN_NAMESPACE
00051 
00052 QT_MODULE(Gui)
00053 
00054 class QVariant;
00055 class QPenPrivate;
00056 class QBrush;
00057 class QPen;
00058 
00059 #ifndef QT_NO_DATASTREAM
00060 Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPen &);
00061 Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPen &);
00062 #endif
00063 
00064 class Q_GUI_EXPORT QPen
00065 {
00066 public:
00067     QPen();
00068     QPen(Qt::PenStyle);
00069     QPen(const QColor &color);
00070     QPen(const QBrush &brush, qreal width, Qt::PenStyle s = Qt::SolidLine,
00071          Qt::PenCapStyle c = Qt::SquareCap, Qt::PenJoinStyle j = Qt::BevelJoin);
00072     QPen(const QPen &pen);
00073 
00074     ~QPen();
00075 
00076     QPen &operator=(const QPen &pen);
00077 
00078     Qt::PenStyle style() const;
00079     void setStyle(Qt::PenStyle);
00080 
00081     QVector<qreal> dashPattern() const;
00082     void setDashPattern(const QVector<qreal> &pattern);
00083 
00084     qreal dashOffset() const;
00085     void setDashOffset(qreal doffset);
00086 
00087     qreal miterLimit() const;
00088     void setMiterLimit(qreal limit);
00089 
00090     qreal widthF() const;
00091     void setWidthF(qreal width);
00092 
00093     int width() const;
00094     void setWidth(int width);
00095 
00096     QColor color() const;
00097     void setColor(const QColor &color);
00098 
00099     QBrush brush() const;
00100     void setBrush(const QBrush &brush);
00101 
00102     bool isSolid() const;
00103 
00104     Qt::PenCapStyle capStyle() const;
00105     void setCapStyle(Qt::PenCapStyle pcs);
00106 
00107     Qt::PenJoinStyle joinStyle() const;
00108     void setJoinStyle(Qt::PenJoinStyle pcs);
00109 
00110     bool isCosmetic() const;
00111     void setCosmetic(bool cosmetic);
00112 
00113     bool operator==(const QPen &p) const;
00114     inline bool operator!=(const QPen &p) const { return !(operator==(p)); }
00115     operator QVariant() const;
00116 
00117     bool isDetached();
00118 private:
00119     friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPen &);
00120     friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPen &);
00121 
00122     void detach();
00123     class QPenPrivate *d;
00124 
00125 public:
00126     typedef QPenPrivate * DataPtr;
00127     inline DataPtr &data_ptr() { return d; }
00128 };
00129 Q_DECLARE_TYPEINFO(QPen, Q_MOVABLE_TYPE);
00130 Q_DECLARE_SHARED(QPen)
00131 
00132 #ifndef QT_NO_DEBUG_STREAM
00133 Q_GUI_EXPORT QDebug operator<<(QDebug, const QPen &);
00134 #endif
00135 
00136 QT_END_NAMESPACE
00137 
00138 QT_END_HEADER
00139 
00140 #endif // QPEN_H