• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

kaddressbook

  • sources
  • kde-4.14
  • kdepim
  • kaddressbook
  • xxport
  • csv
qcsvmodel.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
3 
4  This library is free software; you can redistribute it and/or modify it
5  under the terms of the GNU Library General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or (at your
7  option) any later version.
8 
9  This library is distributed in the hope that it will be useful, but WITHOUT
10  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12  License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to the
16  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  02110-1301, USA.
18 */
19 
20 #ifndef QCSVMODEL_H
21 #define QCSVMODEL_H
22 
23 #include <QtCore/QAbstractTableModel>
24 
25 class QCsvModel : public QAbstractTableModel
26 {
27  Q_OBJECT
28 
29 public:
33  explicit QCsvModel( QObject *parent );
34 
38  ~QCsvModel();
39 
43  bool load( QIODevice *device );
44 
48  void setTextQuote( const QChar &textQuote );
49 
53  QChar textQuote() const;
54 
59  void setDelimiter( const QChar &delimiter );
60 
64  QChar delimiter() const;
65 
75  void setStartRow( uint startRow );
76 
80  uint startRow() const;
81 
87  void setTextCodec( QTextCodec *textCodec );
88 
92  QTextCodec *textCodec() const;
93 
97  virtual int columnCount( const QModelIndex &parent = QModelIndex() ) const;
98 
102  virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const;
103 
107  virtual QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const;
108 
112  virtual bool setData( const QModelIndex &index, const QVariant &data, int role = Qt::EditRole );
113 
117  virtual Qt::ItemFlags flags( const QModelIndex &index ) const;
118 
119 Q_SIGNALS:
123  void finishedLoading();
124 
125 private:
126  class Private;
127  Private *const d;
128 
129  Q_PRIVATE_SLOT( d, void columnCountChanged( int ) )
130  Q_PRIVATE_SLOT( d, void rowCountChanged( int ) )
131  Q_PRIVATE_SLOT( d, void fieldChanged( const QString&, int, int ) )
132  Q_PRIVATE_SLOT( d, void finishedLoading() )
133 };
134 
135 #endif
QIODevice
QModelIndex
QCsvModel::delimiter
QChar delimiter() const
Returns the delimiter that is used as delimiter for fields.
Definition: qcsvmodel.cpp:216
QCsvModel::setTextCodec
void setTextCodec(QTextCodec *textCodec)
Sets the text codec that shall be used for parsing the csv list.
Definition: qcsvmodel.cpp:242
QAbstractTableModel::index
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const
QCsvModel::rowCount
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
Inherited from QAbstractTableModel.
Definition: qcsvmodel.cpp:272
QChar
QCsvModel::setStartRow
void setStartRow(uint startRow)
Sets the row from where the parsing shall be started.
Definition: qcsvmodel.cpp:221
QAbstractTableModel
QCsvModel::setDelimiter
void setDelimiter(const QChar &delimiter)
Sets the character that is used as delimiter for fields.
Definition: qcsvmodel.cpp:200
QCsvModel::finishedLoading
void finishedLoading()
This signal is emitted whenever the model has loaded all data.
QCsvModel::data
virtual QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
Inherited from QAbstractTableModel.
Definition: qcsvmodel.cpp:281
QCsvModel::load
bool load(QIODevice *device)
Loads the data from the device into the model.
Definition: qcsvmodel.cpp:166
QCsvModel::startRow
uint startRow() const
Returns the start row.
Definition: qcsvmodel.cpp:237
QCsvModel::~QCsvModel
~QCsvModel()
Destroys the csv model.
Definition: qcsvmodel.cpp:161
QCsvModel::flags
virtual Qt::ItemFlags flags(const QModelIndex &index) const
Inherited from QAbstractTableModel.
Definition: qcsvmodel.cpp:326
QObject
QCsvModel::columnCount
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const
Inherited from QAbstractTableModel.
Definition: qcsvmodel.cpp:263
QString
QCsvModel::QCsvModel
QCsvModel(QObject *parent)
Creates a new csv model.
Definition: qcsvmodel.cpp:147
QTextCodec
QCsvModel::textQuote
QChar textQuote() const
Returns the character that is used for quoting.
Definition: qcsvmodel.cpp:195
QCsvModel::setTextQuote
void setTextQuote(const QChar &textQuote)
Sets the character that is used for quoting.
Definition: qcsvmodel.cpp:179
QCsvModel::setData
virtual bool setData(const QModelIndex &index, const QVariant &data, int role=Qt::EditRole)
Inherited from QAbstractTableModel.
Definition: qcsvmodel.cpp:313
QObject::parent
QObject * parent() const
QCsvModel::textCodec
QTextCodec * textCodec() const
Returns the text codec that is used for parsing the csv list.
Definition: qcsvmodel.cpp:258
QCsvModel
Definition: qcsvmodel.h:25
QVariant
Qt::ItemFlags
typedef ItemFlags
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:32:34 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kaddressbook

Skip menu "kaddressbook"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal