Engauge Digitizer 2
Loading...
Searching...
No Matches
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
15class WindowTable;
16
18class WindowModelBase : public QStandardItemModel
19{
20public:
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
41private:
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
Delimiter values that may or may not be overridden by DOCUMENT_SERIALIZE_EXPORT_DELIMITER_OVERRIDE_CS...
QString selectionAsText(ExportDelimiter delimiter) const
Convert the selection into exportable text which is good for text editors.
virtual ~WindowModelBase()
void setView(WindowTable &view)
Save the view so this class can access the current selection.
QMimeData * mimeData(const QModelIndexList &indexes) const
Support dragging of multiple cells.
QString selectionAsHtml() const
Convert the selection into exportable html which is good for spreadsheets.
void setDelimiter(ExportDelimiter delimiter)
Save output delimiter.
WindowModelBase()
Single constructor.
Table view class with support for both drag-and-drop and copy-and-paste.
Definition WindowTable.h:19