annotate src/libqxt/qxtcsvmodel.h @ 96:a9e72af2e6fa 1.2

(Auto) Update translations
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 29 Jun 2015 15:40:19 +0200
parents 06c9b37d1e1b
children
rev   line source
1
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
1 #ifndef QXTCSVMODEL_H
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
2 /****************************************************************************
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
3 ** Copyright (c) 2006 - 2011, the LibQxt project.
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
4 ** See the Qxt AUTHORS file for a list of authors and copyright holders.
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
5 ** All rights reserved.
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
6 **
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
7 ** Redistribution and use in source and binary forms, with or without
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
8 ** modification, are permitted provided that the following conditions are met:
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
9 ** * Redistributions of source code must retain the above copyright
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
10 ** notice, this list of conditions and the following disclaimer.
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
11 ** * Redistributions in binary form must reproduce the above copyright
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
12 ** notice, this list of conditions and the following disclaimer in the
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
13 ** documentation and/or other materials provided with the distribution.
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
14 ** * Neither the name of the LibQxt project nor the
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
15 ** names of its contributors may be used to endorse or promote products
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
16 ** derived from this software without specific prior written permission.
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
17 **
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
18 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
19 ** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
20 ** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
21 ** DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
22 ** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
23 ** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
24 ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
25 ** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
26 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
27 ** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
28 **
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
29 ** <http://libqxt.org> <foundation@libqxt.org>
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
30 *****************************************************************************/
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
31
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
32 #define QXTCSVMODEL_H
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
33
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
34 #include <QAbstractTableModel>
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
35 #include <QVariant>
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
36 #include <QIODevice>
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
37 #include <QChar>
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
38 #include <QString>
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
39 #include <QStringList>
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
40 #include <QModelIndex>
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
41 #include <qxtglobal.h>
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
42 class QTextCodec;
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
43
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
44 class QxtCsvModelPrivate;
13
06c9b37d1e1b Fix static windows build of qtxtcsvmodel copy
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1
diff changeset
45 class QxtCsvModel : public QAbstractTableModel
1
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
46 {
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
47 Q_OBJECT
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
48 public:
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
49 QxtCsvModel(QObject *parent = 0);
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
50 explicit QxtCsvModel(QIODevice *file, QObject *parent = 0, bool withHeader = false, QChar separator = ',');
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
51 explicit QxtCsvModel(const QString filename, QObject *parent = 0, bool withHeader = false, QChar separator = ',');
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
52 ~QxtCsvModel();
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
53
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
54 int rowCount(const QModelIndex& parent = QModelIndex()) const;
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
55 int columnCount(const QModelIndex& parent = QModelIndex()) const;
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
56 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
57 bool setData(const QModelIndex& index, const QVariant& data, int role = Qt::EditRole);
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
58 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
59 bool setHeaderData(int section, Qt::Orientation orientation, const QVariant& value, int role = Qt::DisplayRole);
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
60 void setHeaderData(const QStringList& data);
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
61 QString text(int row, int column) const;
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
62 void setText(int row, int column, const QString& value);
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
63 QString headerText(int column) const;
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
64 void setHeaderText(int column, const QString& value);
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
65
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
66
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
67 bool insertRow(int row, const QModelIndex& parent = QModelIndex());
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
68 bool insertRows(int row, int count, const QModelIndex& parent = QModelIndex());
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
69 bool removeRow(int row, const QModelIndex& parent = QModelIndex());
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
70 bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex());
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
71 bool insertColumn(int col, const QModelIndex& parent = QModelIndex());
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
72 bool insertColumns(int col, int count, const QModelIndex& parent = QModelIndex());
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
73 bool removeColumn(int col, const QModelIndex& parent = QModelIndex());
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
74 bool removeColumns(int col, int count, const QModelIndex& parent = QModelIndex());
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
75
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
76 void setSource(QIODevice *file, bool withHeader = false, QChar separator = ',', QTextCodec* codec = 0);
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
77 void setSource(const QString filename, bool withHeader = false, QChar separator = ',', QTextCodec* codec = 0);
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
78
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
79 void toCSV(QIODevice *file, bool withHeader = false, QChar separator = ',', QTextCodec* codec = 0) const;
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
80 void toCSV(const QString filename, bool withHeader = false, QChar separator = ',', QTextCodec* codec = 0) const;
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
81
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
82 enum QuoteOption { NoQuotes = 0, SingleQuote = 1, DoubleQuote = 2, BothQuotes = 3,
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
83 NoEscape = 0, TwoQuoteEscape = 4, BackslashEscape = 8,
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
84 AlwaysQuoteOutput = 16, DefaultQuoteMode = BothQuotes | BackslashEscape | AlwaysQuoteOutput };
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
85 Q_DECLARE_FLAGS(QuoteMode, QuoteOption)
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
86 QuoteMode quoteMode() const;
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
87 void setQuoteMode(QuoteMode mode);
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
88
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
89 Qt::ItemFlags flags(const QModelIndex& index) const;
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
90
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
91 private:
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
92 QXT_DECLARE_PRIVATE(QxtCsvModel)
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
93 };
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
94 Q_DECLARE_OPERATORS_FOR_FLAGS(QxtCsvModel::QuoteMode)
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
95
7a2637c3eb83 Add csv parser from libqxt
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
96 #endif
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)