int TableContendor::readFileIntoContendor (QString ifilename) { bool res; QFile infile(ifilename); if (!infile.open(QIODevice::ReadOnly | QIODevice::Text)) { qDebug()<<"Error while opening file"; return 1; } QTextStream str (&infile); QStringList listOfLines = str.readAll().split("\n"); QStringList namesLst = listOfLines.at(0).trimmed().split("\t"); int gnumberOfColumns = namesLst.count(); int gnumberOfRows = listOfLines.count(); setSizes(gnumberOfColumns,gnumberOfRows-1); int i=0; foreach (QString name, namesLst) { setColumnName(i, name); i++; }
ModelColumn::ModelColumn(const std::string& columnName, const Type& dataType, const bool autoIncrement, const bool isPrimary){ setColumnName(columnName).setType(dataType).setAutoincrement(autoIncrement).setIsPrimary(isPrimary); }
/** Sets name (if column does not exist then all columns up to this are defined with default values and no elements) */ inline void setColName(int whichColumn, const char *columnName) { setColumnName(whichColumn, columnName); }
ResultEditor& ResultEditor::setColumn(const size_t index, const int type, const std::string& name) { setColumnType(index, type); setColumnName(index, name); return *this; }