Model which represents the currently loaded file for upload.
More...
#include <importfilemodel.h>
List of all members.
Public Slots |
void | setLimitedPreview (bool setLimitedPreview) |
void | slot_syncFileParserWithTagContainer (TagContainer::GeneralTag tag, QString attrib) |
Signals |
void | signal_maxColumns_changed (int oldValue, int newvalue) |
void | signal_itemDropped (int column, TagContainer::ColumnTag role, QVariant data) |
Public Member Functions |
| ImportFileModel (QObject *parent=0) |
bool | setFile (const QString &path) |
int | rowCount (const QModelIndex &parent=QModelIndex()) const |
int | columnCount (const QModelIndex &parent=QModelIndex()) const |
QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const |
QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const |
bool | dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) |
Qt::DropActions | supportedDropActions () const |
Qt::ItemFlags | flags (const QModelIndex &index) const |
QStringList | mimeTypes () const |
void | setSkipLinesCount (int newSkipLinesCount) |
void | setDelimiter (QRegExp newDelimiter) |
void | setMergeOnSplits (QVector< int > &mergeOnSplits) |
void | setRowFilter (const QRegExp ®Exp) |
void | unloadFile () |
Detailed Description
Model which represents the currently loaded file for upload.
- Todo:
Currently files are cached completely before shown, but a better aproach would be to load only that which is shown.
QTextStream allows many adjustments and those could be adjusted through the GUI and saved through TagContainer.
Constructor & Destructor Documentation
ImportFileModel::ImportFileModel |
( |
QObject * |
parent = 0 |
) |
|
Member Function Documentation
bool ImportFileModel::dropMimeData |
( |
const QMimeData * |
data, |
|
|
Qt::DropAction |
action, |
|
|
int |
row, |
|
|
int |
column, |
|
|
const QModelIndex & |
parent | |
|
) |
| | |
Qt::ItemFlags ImportFileModel::flags |
( |
const QModelIndex & |
index |
) |
const |
{
Qt::ItemFlags defaultFlags = QAbstractTableModel::flags(index);
if (index.row()==-1 && index.column()==-1) return defaultFlags;
else return defaultFlags | Qt::ItemIsDropEnabled;
}
QVariant ImportFileModel::headerData |
( |
int |
section, |
|
|
Qt::Orientation |
orientation, |
|
|
int |
role = Qt::DisplayRole | |
|
) |
| | const |
{
QStringList types;
types << "appobj/treeitem.pointer";
return types;
}
void ImportFileModel::setDelimiter |
( |
QRegExp |
newDelimiter |
) |
|
bool ImportFileModel::setFile |
( |
const QString & |
path |
) |
|
{
unloadFile();
qDebug() << "Loading " + path + " file in ImportFileModel: " << path;
if (!QFile::exists(path)){
qWarning() << "File does not exist: " << path;
return false;
}
stream.reset(new QTextStream());
file.reset(new QFile(path));
if (!file->open(QIODevice::ReadOnly | QIODevice::Text))
{
qWarning() << "ImportFileModel: Error: Cannot read file: "
<< path
<< file->errorString();
return false;
}
stream->setDevice(file.data());
loadFile();
qDebug() << "File " + file->fileName() + " successfully loaded in ImportFileModel";
return true;
}
void ImportFileModel::setLimitedPreview |
( |
bool |
setLimitedPreview |
) |
[slot] |
{
limitedPreview = setLimitedPreview; loadFile();
}
void ImportFileModel::setMergeOnSplits |
( |
QVector< int > & |
mergeOnSplits |
) |
|
void ImportFileModel::setRowFilter |
( |
const QRegExp & |
regExp |
) |
|
void ImportFileModel::setSkipLinesCount |
( |
int |
newSkipLinesCount |
) |
|
void ImportFileModel::signal_maxColumns_changed |
( |
int |
oldValue, |
|
|
int |
newvalue | |
|
) |
| | [signal] |
Qt::DropActions ImportFileModel::supportedDropActions |
( |
|
) |
const |
{
return Qt::CopyAction | Qt::MoveAction | Qt::LinkAction;
}
void ImportFileModel::unloadFile |
( |
|
) |
|
Referenced by setFile().
{
beginResetModel();
preview.clear();
maxColumns = 0;
endResetModel();
}
The documentation for this class was generated from the following files: