Warning, file /office/calligra/libs/widgets/KoLineStyleSelector.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* This file is part of the KDE project
0002  * Copyright (C) 2007 Jan Hambrecht <jaham@gmx.net>
0003  *
0004  * This library is free software; you can redistribute it and/or
0005  * modify it under the terms of the GNU Library General Public
0006  * License as published by the Free Software Foundation; either
0007  * version 2 of the License, or (at your option) any later version.
0008  *
0009  * This library is distributed in the hope that it will be useful,
0010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012  * Library General Public License for more details.
0013  *
0014  * You should have received a copy of the GNU Library General Public License
0015  * along with this library; see the file COPYING.LIB.  If not, write to
0016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017  * Boston, MA 02110-1301, USA.
0018  */
0019 
0020 #ifndef _KOLINESTYLESELECTOR_H_
0021 #define _KOLINESTYLESELECTOR_H_
0022 
0023 #include "kowidgets_export.h"
0024 #include <QComboBox>
0025 
0026 /**
0027  * A custom combobox widget for selecting line styles.
0028  */
0029 class KOWIDGETS_EXPORT KoLineStyleSelector : public QComboBox
0030 {
0031     Q_OBJECT
0032 public:
0033     explicit KoLineStyleSelector(QWidget *parent = nullptr);
0034     ~KoLineStyleSelector() override;
0035 
0036     /**
0037      * Adds a new line style to the combobox.
0038      *
0039      * If the style already exists, it is not added to the selector.
0040      *
0041      * @param style the line style to add
0042      * @return true if style is unique among the existing styles and was added, else false
0043      */
0044     bool addCustomStyle(const QVector<qreal> &style);
0045 
0046     /**
0047      * Selects the specified style.
0048      *
0049      * If the style was already added it gets selected. If the style was not added already
0050      * it gets temporary added and selected.
0051      *
0052      * @param style the style to display
0053      * @param dashes the dashes of the style if style == Qt::CustomDashLine
0054      */
0055     void setLineStyle(Qt::PenStyle style, const QVector<qreal> &dashes = QVector<qreal>());
0056 
0057     /// Returns the current line style
0058     Qt::PenStyle lineStyle() const;
0059     /// Returns the dashes of the current line style
0060     QVector<qreal> lineDashes() const;
0061 
0062 protected:
0063     void paintEvent(QPaintEvent *pe) override;
0064 
0065 private:
0066     class Private;
0067     Private * const d;
0068 };
0069 
0070 #endif // _KOLINESTYLESELECTOR_H_