当前位置: 首页>>代码示例>>C++>>正文


C++ setRowCount函数代码示例

本文整理汇总了C++中setRowCount函数的典型用法代码示例。如果您正苦于以下问题:C++ setRowCount函数的具体用法?C++ setRowCount怎么用?C++ setRowCount使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了setRowCount函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: clear

void SortedSetKeyModel::setCurrentPage(int page)
{
	if (page == currentPage) {
		return;
	}

	clear();

	QStringList labels;
	labels << "Value" << "Score";
	setHorizontalHeaderLabels(labels);

	currentPage = page;

	int size = rawData.size();

	setRowCount( (itemsOnPageLimit  > size / 2)? size / 2 : itemsOnPageLimit);

	int startShiftPosition = itemsOnPageLimit * 2 * (currentPage - 1);
	int limit = startShiftPosition + itemsOnPageLimit * 2;

	for (int i = startShiftPosition, row = 0; i < limit && i < size; ++i, ++row) {

		QStandardItem * key = new QStandardItem(rawData.at(i));
		QStandardItem * value = new QStandardItem(rawData.at(++i));
		setItem(row, 0, key);
		setItem(row, 1, value);
	}
}
开发者ID:BennyH26,项目名称:RedisDesktopManager,代码行数:29,代码来源:SortedSetKeyModel.cpp

示例2: QTableWidget

DataTableWidget::DataTableWidget(IDataForms *ADataForms, const IDataTable &ATable, QWidget *AParent) : QTableWidget(AParent)
{
	FTable = ATable;
	FDataForms = ADataForms;
	setRowCount(ATable.rows.count());
	setColumnCount(ATable.columns.count());

	int row = 0;
	foreach(const QStringList &values, ATable.rows)
	{
		for (int col=0; col<values.count(); col++)
		{
			QTableWidgetItem *item = new QTableWidgetItem(values.at(col));
			item->setData(DTR_COL_INDEX,col);
			item->setData(DTR_ROW_INDEX,row);
			item->setFlags(Qt::ItemIsEnabled);
			setItem(row,col,item);
		}
		row++;
	}

	QStringList headers;
	foreach(const IDataField &field, ATable.columns)
		headers.append(!field.label.isEmpty() ? field.label : field.var);

	setHorizontalHeaderLabels(headers);
	horizontalHeader()->resizeSections(QHeaderView::ResizeToContents);
	verticalHeader()->resizeSections(QHeaderView::ResizeToContents);
	setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);

	connect(this,SIGNAL(cellActivated(int,int)),SIGNAL(activated(int,int)));
	connect(this,SIGNAL(currentCellChanged(int,int,int,int)),SIGNAL(changed(int,int,int,int)));
}
开发者ID:ChALkeR,项目名称:vacuum-im,代码行数:33,代码来源:datatablewidget.cpp

示例3: QTableWidget

AdvancedSettings::AdvancedSettings(QWidget *parent)
    : QTableWidget(parent)
{
    // column
    setColumnCount(COL_COUNT);
    QStringList header = {tr("Setting"), tr("Value", "Value set for this setting")};
    setHorizontalHeaderLabels(header);
    // row
    setRowCount(ROW_COUNT);
    verticalHeader()->setVisible(false);
    // etc.
    setAlternatingRowColors(true);
    setSelectionMode(QAbstractItemView::NoSelection);
    setEditTriggers(QAbstractItemView::NoEditTriggers);
    // Signals
    connect(&spinBoxCache, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged)
            , this, &AdvancedSettings::updateCacheSpinSuffix);
    connect(&comboBoxInterface, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged)
            , this, &AdvancedSettings::updateInterfaceAddressCombo);
    connect(&spinBoxSaveResumeDataInterval, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged)
            , this, &AdvancedSettings::updateSaveResumeDataIntervalSuffix);
    // Load settings
    loadAdvancedSettings();
    resizeColumnToContents(0);
    horizontalHeader()->setStretchLastSection(true);
}
开发者ID:gubatron,项目名称:qBittorrent,代码行数:26,代码来源:advancedsettings.cpp

示例4: QTableWidget

lmcImagePicker::lmcImagePicker(
        QWidget *parent,
        QList<QString>* source,
        int picSize,
        int columns,
        int* selected,
        int actionIndex )
    : QTableWidget(parent)
{
	setMouseTracking(true);

	setBackgroundRole(QPalette::Window);
	setIconSize(QSize(picSize, picSize));
	setFrameShape(QFrame::NoFrame);
	setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	setEditTriggers(QAbstractItemView::NoEditTriggers);
	setSelectionMode(QAbstractItemView::NoSelection);
	setShowGrid(false);
	horizontalHeader()->setVisible(false);
	verticalHeader()->setVisible(false);
	setStyleSheet("QTableWidget { padding: 4px }");	// padding around table

	max_col = columns;
	int max_row = qCeil(source->count() / (qreal)max_col);

	setColumnCount(max_col);
	setRowCount(max_row);

	int cellSize = picSize + 8;
	verticalHeader()->setDefaultSectionSize(cellSize);
	verticalHeader()->setMinimumSectionSize(cellSize);
	horizontalHeader()->setDefaultSectionSize(cellSize);
	horizontalHeader()->setMinimumSectionSize(cellSize);

	//	set min and max size of table, with padding included
	setMinimumSize(max_col * cellSize + 8, max_row * cellSize + 8);
	setMaximumSize(max_col * cellSize + 8, max_row * cellSize + 8);

	for(int i = 0; i < max_row; i++) {
		for(int j = 0; j < max_col; j++) {
			int k = (i * max_col) + j;

			QTableWidgetItem* item = new QTableWidgetItem();
			item->setData(TypeRole, 0);
			if(k < source->count()) {
				item->setIcon(QIcon(source->value(k)));
				item->setData(TypeRole, 1);
				item->setSizeHint(QSize(picSize, picSize));
				item->setBackground(this->palette().window());
			}
			setItem(i, j, item);
		}
	}

	this->actionIndex = actionIndex;
	this->selected = selected;
	this->hoverItem = NULL;
}
开发者ID:sonic414,项目名称:lmc-clone,代码行数:59,代码来源:imagepicker.cpp

示例5: QString

bool MatrixModel::calculate(int startRow, int endRow, int startCol, int endCol)
{
	QString formula = d_matrix->formula();
	if (formula.isEmpty())
		return false;

	QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));

	ScriptingEnv *scriptEnv = d_matrix->scriptingEnv();
	Script *script = scriptEnv->newScript(formula, this, QString("<%1>").arg(objectName()));
	connect(script, SIGNAL(error(const QString&,const QString&,int)), scriptEnv, SIGNAL(error(const QString&,const QString&,int)));
	connect(script, SIGNAL(print(const QString&)), scriptEnv, SIGNAL(print(const QString&)));
	
	if (!script->compile()){
		QApplication::restoreOverrideCursor();
		return false;
	}

	if (endRow < 0)
		endRow = d_rows - 1;
	if (endCol < 0)
		endCol = d_cols - 1;
    if (endCol >= d_cols)
		setColumnCount(endCol + 1);
	if (endRow >= d_rows)
        setRowCount(endRow + 1);

	QVariant res;
	double dx = d_matrix->dx();
	double dy = d_matrix->dy();
	double x_start = d_matrix->xStart();
	double y_start = d_matrix->yStart();
	double r = 0.0, c = 0.0;
	for(int row = startRow; row <= endRow; row++){
	    r = row + 1.0;
		script->setDouble(r, "i");
		script->setDouble(r, "row");
		script->setDouble(y_start + row*dy, "y");
		int aux = row*d_cols + startCol;
		for(int col = startCol; col <= endCol; col++){
		    c = col + 1.0;
			script->setDouble(c, "j");
			script->setDouble(c, "col");
			script->setDouble(x_start + col*dx, "x");
			res = script->eval();
			if (res.canConvert(QVariant::Double))
				d_data[aux++] = res.toDouble();
			else {
				QApplication::restoreOverrideCursor();
				d_data[aux++] = GSL_NAN;
				return false;
			}
		}
		qApp->processEvents();
	}

	QApplication::restoreOverrideCursor();
	return true;
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:59,代码来源:MatrixModel.cpp

示例6: clearContents

void MorphismListWidget::updateList(const VariableList &variableList)
{

  // updates morphism list

  int row = 0;
  int rowSpan = 0;
  QTableWidgetItem *nameItem;
  QTableWidgetItem *varItem;

  clearContents();

  VariableListIterator i(variableList);
  while (i.hasNext()) {
    i.next();
    if (i.value().type() == Morphism)
      row += i.value().mapData().domainRank();
  }
  setRowCount(row);

  i.toFront();
  row = 0;
  while (i.hasNext()) {
    i.next();

    if (i.value().type() == Morphism) {
      nameItem = item(row,0);
      if (!nameItem) {
        nameItem = new QTableWidgetItem;
        setItem(row,0,nameItem);
      }
      nameItem->setText(i.key());
      nameItem->setTextAlignment(Qt::AlignLeft);
      nameItem->setTextAlignment(Qt::AlignVCenter);
      nameItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
      rowSpan = i.value().mapData().domainRank();
      setSpan(row,0,rowSpan,1);

      MapIterator x(i.value().mapData());
      while (x.hasNext()) {
        x.next();
        if (x.key().isLower()) {
          varItem = item(row,1);
          if (!varItem) {
            varItem = new QTableWidgetItem;
            setItem(row,1,varItem);
          }
          varItem->setText(QString(x.key()) + " -> " + x.value());
          varItem->setTextAlignment(Qt::AlignLeft);
          varItem->setTextAlignment(Qt::AlignVCenter);
          varItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);

          row++;
        }
      }
    }
  }

}
开发者ID:clay-matt,项目名称:Fn,代码行数:59,代码来源:MorphismListWidget.cpp

示例7: setRowCount

//resize table and set column headings
void Spreadsheet::clear()
{
    setRowCount(0);
    setColumnCount(0);

    setRowCount(RowCount);
    setColumnCount(ColumnCount);

    for (int i = 0; i < ColumnCount; ++i)
    {
        QTableWidgetItem *item = new QTableWidgetItem;
        item->setText(QString(QChar('A' + i)));
        setHorizontalHeaderItem(i, item);
    }

    setCurrentCell(0,0);
}
开发者ID:KleineKarsten,项目名称:CppGuiWithQt,代码行数:18,代码来源:spreadsheet.cpp

示例8: setRowCount

void
AnalysisDataAverageModule::dataStarted(AbstractAnalysisData *data)
{
    int nrows = data->columnCount();
    setRowCount(nrows);
    allocateValues();
    nsamples_.resize(nrows);
}
开发者ID:hasagar,项目名称:gromacs,代码行数:8,代码来源:average.cpp

示例9: setRowCount

void WidgetTableProgression::initialize(int rows, QString progression) {
    m_completing = true;
    setRowCount(rows);
    setColumnCount(2);
    setHorizontalHeaderItem(0, new QTableWidgetItem(NAME_LEVEL));
    setHorizontalHeaderItem(1, new QTableWidgetItem(progression));
    verticalHeader()->hide();
}
开发者ID:Wano-k,项目名称:RPG-Paper-Maker,代码行数:8,代码来源:widgettableprogression.cpp

示例10: QTableWidget

searchTable::searchTable(QWidget *parent): QTableWidget(parent),index(0)
{
        setColumnCount(8);
        QStringList header;
        header<<"Name "<<"Type "<<"LV "<<"MP "<<"HP "<<"Strength "<<"Constitution "<<"Wisdom ";
        setHorizontalHeaderLabels(header);
        setRowCount(0);
}
开发者ID:StefanoMunari,项目名称:qDB,代码行数:8,代码来源:searchtable.cpp

示例11: delTmp

void tableTemplateWidget::deleteTemplate(void)
{
  if (templateId == 0)
    return;

  QMessageBox delTmp(QMessageBox::Question,
                     tr("Deleting template!"),
                     tr("Do you want delete template ?"),
                     QMessageBox::Yes | QMessageBox::No);

  int code = delTmp.exec();

  if (code == QMessageBox::No)
    return;

  QSqlQuery query;
  QSqlError le;

  query.prepare("DELETE FROM crossword.private_data WHERE _template = ?;");
    query.addBindValue(QVariant(templateId));
  query.exec();

  le = query.lastError();
  if (le.type() != QSqlError::NoError)
    qDebug() << "1. deleteTemplate: " << le.text();

  query.prepare("DELETE FROM crossword.grids WHERE _template = ?;");
    query.addBindValue(QVariant(templateId));
  query.exec();

  le = query.lastError();
  if (le.type() != QSqlError::NoError)
    qDebug() << "2. deleteTemplate: " << le.text();

  query.prepare("DELETE FROM crossword.templates WHERE _id = ?;");
    query.addBindValue(QVariant(templateId));
  query.exec();

  le = query.lastError();
  if (le.type() != QSqlError::NoError)
    qDebug() << "3. deleteTemplate: " << le.text();

  for (int i = 0; i < numCol; i++)
    removeColumn(0);

  setRowCount(0);

  sb->showMessage(tr("Template deleted"), 2000);

  // need for templateListWidget
  emit deletedFromDB(templateId);

  numCol = numRow = 0;
  templateId = 0;
  countWords = 0;
  wi.clear();
}
开发者ID:skydion,项目名称:qtcrossword,代码行数:57,代码来源:tabletemplatewidget.cpp

示例12: setRowCount

//! Creates a new row that matches points.at(row)
void PointTableWidget::createNewRow(int row) {
    setRowCount(rowCount() + 1);

    QTableWidgetItem * newItem = new QTableWidgetItem(tr("%1").arg(points.at(row).x()));
    setItem(row, settings.xColumn, newItem);

    newItem = new QTableWidgetItem(tr("%1").arg(points.at(row).y()));
    setItem(row, settings.yColumn, newItem);
}
开发者ID:pengwg,项目名称:vurtigo,代码行数:10,代码来源:PointTableWidget.cpp

示例13: setRowCount

void Foundlist::handleNewData( int i )
{
   if( (i == 0) || (mQuery.mEntries.size() == 0) )
   {
      return;
   }

   setRowCount( i );
   --i;

   int playtime = mQuery.mEntries.at(i).playtime / 75;
   QString displaytime( QString::number( playtime / 60 ) );
   displaytime.append(":");
   if( (playtime % 60) < 10 )
   {
      displaytime.append("0");
   }
   displaytime.append( QString::number( playtime % 60 ) );

   QTableWidgetItem *categoryItem =
      new QTableWidgetItem( mQuery.mEntries.at(i).category );
   categoryItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
   setItem( i, 0, categoryItem );

   QTableWidgetItem *idItem =
      new QTableWidgetItem( mQuery.mEntries.at(i).id );
   idItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
   setItem( i, 1, idItem );

   QTableWidgetItem *trackItem =
      new QTableWidgetItem( QString::number( mQuery.mEntries.at(i).track ) );
   trackItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
   setItem( i, 2, trackItem );

   QTableWidgetItem *titleItem =
      new QTableWidgetItem( mQuery.mEntries.at(i).title );
   titleItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
   setItem( i, 3, titleItem );

   QTableWidgetItem *playtimeItem =
      new QTableWidgetItem( displaytime );
   playtimeItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
   setItem( i, 4, playtimeItem );

#if INCLUDE_EXT
   if( mQuery.mEntries.count() > 5 )
   {
      QTableWidgetItem *extItem =
         new QTableWidgetItem( mQuery.mEntries.at(i).ext );
      categoryItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
      setItem( i, 5, extItem );
   }
#endif

   resizeColumnsToContents();
}
开发者ID:SvOlli,项目名称:SLART,代码行数:56,代码来源:Foundlist.cpp

示例14: getClass

/**----------------------------------------------------------------
 * Create the output from a single ChebfunWorkspace.
 */
void ChebfunToTable::fromChebWorkspace()
{
  ChebfunWorkspace_sptr cws = getClass("InputWorkspace");

  Numeric::FunctionDomain1D_sptr domain;

  size_t n = (int)get("N");

  if (n < 2)
  {// if n has default value (0) use the x-points of the chebfuns
    domain = cws->fun().createDomainFromXPoints();
    n = domain->size();
  }
  else
  {// otherwise create a regular comb
    domain = cws->fun().createDomain( n );
  }

  Numeric::FunctionValues values( *domain );
  cws->fun().function(*domain, values);

  auto tws = API::TableWorkspace_ptr(dynamic_cast<API::TableWorkspace*>(
    API::WorkspaceFactory::instance().create("TableWorkspace"))
    );

  tws->addColumn("double","X");
  tws->addColumn("double","Y");
  tws->setRowCount(n);
  auto xColumn = static_cast<API::TableColumn<double>*>(tws->getColumn("X").get());
  xColumn->asNumeric()->setPlotRole(API::NumericColumn::X);
  auto& x = xColumn->data();
  auto yColumn = static_cast<API::TableColumn<double>*>(tws->getColumn("Y").get());
  yColumn->asNumeric()->setPlotRole(API::NumericColumn::Y);
  auto& y = yColumn->data();
  
  for(size_t i = 0; i < domain->size(); ++i)
  {
    x[i] = (*domain)[i];
    y[i] = values.getCalculated(i);
  }

  bool dropXInf = get("DropXInf");
  if ( dropXInf )
  {
    if ( fabs( x.front() ) == inf )
    {
      tws->removeRow( 0 );
    }
    if ( fabs( x.back() ) == inf )
    {
      tws->removeRow( tws->rowCount() - 1 );
    }
  }

  setProperty("OutputWorkspace",tws);
}
开发者ID:rrnntt,项目名称:SmallProject,代码行数:59,代码来源:ChebfunToTable.cpp

示例15: setRowCount

void ParameterTable::initTable()
{
  setRowCount(0);
  setSelectionMode(QTableWidget::NoSelection);

  mpComboDelegate = new CQComboDelegate(NULL, this);
  setItemDelegateForColumn(2, mpComboDelegate);

  setShowGrid(false);
}
开发者ID:cpanchal,项目名称:COPASI,代码行数:10,代码来源:parametertable.cpp


注:本文中的setRowCount函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。