本文整理汇总了C++中Column::setComment方法的典型用法代码示例。如果您正苦于以下问题:C++ Column::setComment方法的具体用法?C++ Column::setComment怎么用?C++ Column::setComment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Column
的用法示例。
在下文中一共展示了Column::setComment方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readData
//.........这里部分代码省略.........
int currentRow=0; //indexes the position in the vector(column)
int columnOffset=0; //indexes the "start column" in the spreadsheet. Starting from this column the data will be imported.
//pointers to the actual data containers
QVector<QVector<double>*> dataPointers;
if(dataSource != NULL)
columnOffset = dataSource->create(dataPointers, mode, actualRows, actualCols, vectorNameList);
//header: import the values in the first line, if they were not used as the header (as the names for the columns)
bool isNumber;
if (!headerEnabled){
for ( int n=0; n<actualCols; n++ ){
if (n<lineStringList.size()) {
const double value = lineStringList.at(n).toDouble(&isNumber);
if (dataSource != NULL)
isNumber ? dataPointers[n]->operator[](0) = value : dataPointers[n]->operator[](0) = NAN;
else
isNumber ? dataString<<QString::number(value)<<" " : dataString<<QLatin1String("NAN ");
} else {
if (dataSource != NULL)
dataPointers[n]->operator[](0) = NAN;
else
dataString<<QLatin1String("NAN ");
}
}
dataString<<"\n";
currentRow++;
}
//Read the remainder of the file.
for (int i=currentRow; i<qMin(lines,actualRows); i++){
line = in.readLine();
if(simplifyWhitespacesEnabled)
line = line.simplified();
//skip empty lines
if (line.isEmpty())
continue;
if( line.startsWith(commentCharacter) == true ){
currentRow++;
continue;
}
lineStringList = line.split( separator, QString::SplitBehavior(skipEmptyParts) );
// TODO : read strings (comments) or datetime too
for ( int n=0; n<actualCols; n++ ){
if (n<lineStringList.size()) {
const double value = lineStringList.at(n).toDouble(&isNumber);
if (dataSource != NULL)
isNumber ? dataPointers[n]->operator[](currentRow) = value : dataPointers[n]->operator[](currentRow) = NAN;
else
isNumber ? dataString<<QString::number(value)<<" " : dataString<<QString("NAN ");
} else {
if (dataSource != NULL)
dataPointers[n]->operator[](currentRow) = NAN;
else
dataString<<QLatin1String("NAN ");
}
}
dataString<<"\n";
currentRow++;
emit q->completed(100*currentRow/actualRows);
}
if (!dataSource)
return dataString.join("");
//make everything undo/redo-able again
//set the comments for each of the columns
Spreadsheet* spreadsheet = dynamic_cast<Spreadsheet*>(dataSource);
if (spreadsheet) {
//TODO: generalize to different data types
QString comment = i18np("numerical data, %1 element", "numerical data, %1 elements", headerEnabled ? currentRow : currentRow+1);
for ( int n=startColumn; n<=endColumn; n++ ){
Column* column = spreadsheet->column(columnOffset+n-startColumn);
column->setComment(comment);
column->setUndoAware(true);
if (mode==AbstractFileFilter::Replace) {
column->setSuppressDataChangedSignal(false);
column->setChanged();
}
}
spreadsheet->setUndoAware(true);
return dataString.join("");
}
Matrix* matrix = dynamic_cast<Matrix*>(dataSource);
if (matrix) {
matrix->setSuppressDataChangedSignal(false);
matrix->setChanged();
matrix->setUndoAware(true);
}
return dataString.join("");
}
示例2: read
//.........这里部分代码省略.........
case ImageFilter::MATRIX: {
actualCols = endColumn-startColumn+1;
actualRows = endRow-startRow+1;
break;
}
case ImageFilter::XYZ: {
actualCols = 3;
actualRows = (endColumn-startColumn+1)*(endRow-startRow+1);
break;
}
case ImageFilter::XYRGB: {
actualCols = 5;
actualRows = (endColumn-startColumn+1)*(endRow-startRow+1);
break;
}
}
#ifdef QT_DEBUG
qDebug()<<"image format ="<<image.format();
qDebug()<<"image w/h ="<<cols<<rows;
qDebug()<<"actual rows/cols ="<<actualRows<<actualCols;
#endif
//make sure we have enough columns in the data source.
int columnOffset = 0;
QVector<QVector<double>*> dataPointers;
if (dataSource != 0)
columnOffset = dataSource->create(dataPointers, mode, actualRows, actualCols);
else {
qDebug()<<"data source in image import not defined! Giving up.";
return;
}
// read data
switch (importFormat) {
case ImageFilter::MATRIX: {
for (int i=0; i<actualRows; i++) {
for ( int j=0; j<actualCols; j++ ) {
double value=qGray(image.pixel(j+startColumn-1,i+startRow-1));
dataPointers[j]->operator[](i) = value;
}
emit q->completed(100*i/actualRows);
}
break;
}
case ImageFilter::XYZ: {
int currentRow=0;
for (int i=startRow-1; i<endRow; i++) {
for ( int j=startColumn-1; j<endColumn; j++ ) {
QRgb color=image.pixel(j, i);
dataPointers[0]->operator[](currentRow) = i+1;
dataPointers[1]->operator[](currentRow) = j+1;
dataPointers[2]->operator[](currentRow) = qGray(color);
currentRow++;
}
emit q->completed(100*i/actualRows);
}
break;
}
case ImageFilter::XYRGB: {
int currentRow=0;
for (int i=startRow-1; i<endRow; i++) {
for ( int j=startColumn-1; j<endColumn; j++ ) {
QRgb color=image.pixel(j, i);
dataPointers[0]->operator[](currentRow) = i+1;
dataPointers[1]->operator[](currentRow) = j+1;
dataPointers[2]->operator[](currentRow) = qRed(color);
dataPointers[3]->operator[](currentRow) = qGreen(color);
dataPointers[4]->operator[](currentRow) = qBlue(color);
currentRow++;
}
emit q->completed(100*i/actualRows);
}
break;
}
}
Spreadsheet* spreadsheet = dynamic_cast<Spreadsheet*>(dataSource);
if (spreadsheet) {
QString comment = i18np("numerical data, %1 element", "numerical data, %1 elements", rows);
for ( int n=0; n<actualCols; n++ ) {
Column* column = spreadsheet->column(columnOffset+n);
column->setComment(comment);
column->setUndoAware(true);
if (mode==AbstractFileFilter::Replace) {
column->setSuppressDataChangedSignal(false);
column->setChanged();
}
}
spreadsheet->setUndoAware(true);
return;
}
Matrix* matrix = dynamic_cast<Matrix*>(dataSource);
if (matrix) {
matrix->setSuppressDataChangedSignal(false);
matrix->setChanged();
matrix->setUndoAware(true);
}
}
示例3: readData
//.........这里部分代码省略.........
case BinaryFilter::INT64: {
qint64 value;
in >> value;
if (dataSource != NULL)
dataPointers[n]->operator[](i) = value;
else
dataString<<QString::number(value)<<" ";
break;
}
case BinaryFilter::UINT8: {
quint8 value;
in >> value;
if (dataSource != NULL)
dataPointers[n]->operator[](i) = value;
else
dataString<<QString::number(value)<<" ";
break;
}
case BinaryFilter::UINT16: {
quint16 value;
in >> value;
if (dataSource != NULL)
dataPointers[n]->operator[](i) = value;
else
dataString<<QString::number(value)<<" ";
break;
}
case BinaryFilter::UINT32: {
quint32 value;
in >> value;
if (dataSource != NULL)
dataPointers[n]->operator[](i) = value;
else
dataString<<QString::number(value)<<" ";
break;
}
case BinaryFilter::UINT64: {
quint64 value;
in >> value;
if (dataSource != NULL)
dataPointers[n]->operator[](i) = value;
else
dataString<<QString::number(value)<<" ";
break;
}
case BinaryFilter::REAL32: {
float value;
in >> value;
if (dataSource != NULL)
dataPointers[n]->operator[](i) = value;
else
dataString<<QString::number(value)<<" ";
break;
}
case BinaryFilter::REAL64: {
double value;
in >> value;
if (dataSource != NULL)
dataPointers[n]->operator[](i) = value;
else
dataString<<QString::number(value)<<" ";
break;
}
}
}
dataString<<"\n";
emit q->completed(100*i/actualRows);
}
if (!dataSource)
return dataString.join("");
//make everything undo/redo-able again
//set the comments for each of the columns
Spreadsheet* spreadsheet = dynamic_cast<Spreadsheet*>(dataSource);
if (spreadsheet) {
Spreadsheet* spreadsheet = dynamic_cast<Spreadsheet*>(dataSource);
QString comment = i18np("numerical data, %1 element", "numerical data, %1 elements", actualRows);
for ( int n=0; n<actualCols; n++ ){
Column* column = spreadsheet->column(columnOffset+n);
column->setComment(comment);
column->setUndoAware(true);
if (mode==AbstractFileFilter::Replace) {
column->setSuppressDataChangedSignal(false);
column->setChanged();
}
}
spreadsheet->setUndoAware(true);
return dataString.join("");
}
Matrix* matrix = dynamic_cast<Matrix*>(dataSource);
if (matrix) {
matrix->setSuppressDataChangedSignal(false);
matrix->setChanged();
matrix->setUndoAware(true);
}
return dataString.join("");
}