Engauge Digitizer  2
WindowModelBase.h
Go to the documentation of this file.
1 /******************************************************************************************************
2  * (C) 2016 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3  * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4  * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5  ******************************************************************************************************/
6 
7 #ifndef WINDOW_MODEL_BASE_H
8 #define WINDOW_MODEL_BASE_H
9 
10 #include "ExportDelimiter.h"
11 #include <QStandardItemModel>
12 #include <QString>
13 #include <QVector>
14 
15 class WindowTable;
16 
18 class WindowModelBase : public QStandardItemModel
19 {
20 public:
22  WindowModelBase ();
23  virtual ~WindowModelBase ();
24 
27  QMimeData *mimeData (const QModelIndexList &indexes) const;
28 
30  QString selectionAsHtml () const;
31 
33  QString selectionAsText (ExportDelimiter delimiter) const;
34 
36  void setDelimiter (ExportDelimiter delimiter);
37 
39  void setView (WindowTable &view);
40 
41 private:
42  int fold2dIndexes (int row,
43  int col,
44  int rowLow,
45  int colLow,
46  int colHigh) const;
47  void selectionAsTable (int &rowLow,
48  int &colLow,
49  int &rowHigh,
50  int &colHigh,
51  QVector<QString> &table) const;
52 
53  ExportDelimiter m_delimiter;
54  WindowTable *m_view;
55 };
56 
57 #endif // WINDOW_MODEL_BASE_H
ExportDelimiter.h
WindowModelBase::selectionAsHtml
QString selectionAsHtml() const
Convert the selection into exportable html which is good for spreadsheets.
Definition: WindowModelBase.cpp:48
WindowModelBase::~WindowModelBase
virtual ~WindowModelBase()
Definition: WindowModelBase.cpp:21
WindowTable
Table view class with support for both drag-and-drop and copy-and-paste.
Definition: WindowTable.h:16
WindowModelBase::setView
void setView(WindowTable &view)
Save the view so this class can access the current selection.
Definition: WindowModelBase.cpp:169
WindowModelBase::selectionAsText
QString selectionAsText(ExportDelimiter delimiter) const
Convert the selection into exportable text which is good for text editors.
Definition: WindowModelBase.cpp:132
WindowModelBase::mimeData
QMimeData * mimeData(const QModelIndexList &indexes) const
Support dragging of multiple cells.
Definition: WindowModelBase.cpp:34
ExportDelimiter
ExportDelimiter
Delimiter values that may or may not be overridden by DOCUMENT_SERIALIZE_EXPORT_DELIMITER_OVERRIDE_CS...
Definition: ExportDelimiter.h:13
WindowModelBase::WindowModelBase
WindowModelBase()
Single constructor.
Definition: WindowModelBase.cpp:16
WindowModelBase::setDelimiter
void setDelimiter(ExportDelimiter delimiter)
Save output delimiter.
Definition: WindowModelBase.cpp:164
WindowModelBase
Model for WindowTable.
Definition: WindowModelBase.h:17