Exemplo n.º 1
0
/**
 * Constructor.
 *
 * @param parent This dialog's parent widget.
 */
DBEditor::DBEditor(QWidget *parent)
    : PBDialog(tr("Columns Editor"), parent), db(0), ceName("_cename"),
      ceType("_cetype"), ceDefault("_cedefault"), ceOldIndex("_ceoldindex"),
      ceNewIndex("_cenewindex"), resized(false)
{
    stack = new QStackedWidget(this);
    vbox->addWidget(stack, 1);
    QString text("<center>%1<br><br>%2</center>");
    text = text.arg(tr("No columns defined"));
    text = text.arg(tr("Press the \"Add\" button to create one"));
    noColumns = new QLabel(text, stack);
    stack->addWidget(noColumns);

    QStringList headers;
    headers << ColumnEditor::tr("Name");
    headers << ColumnEditor::tr("Type");
    headers << ColumnEditor::tr("Default");
    table = Factory::treeWidget(stack, headers);
    stack->addWidget(table);
    int colWidth = width() / 3 - 2;
    table->setColumnWidth(0, colWidth);
    table->setColumnWidth(1, colWidth);
    table->setColumnWidth(2, colWidth);
    stack->setCurrentWidget(noColumns);

    addEditButtons();
    connect(addButton, SIGNAL(clicked()), this, SLOT(addColumn()));
    connect(editButton, SIGNAL(clicked()), this, SLOT(editColumn()));
    connect(deleteButton, SIGNAL(clicked()), this, SLOT(deleteColumn()));
    connect(upButton, SIGNAL(clicked()), this, SLOT(moveUp()));
    connect(downButton, SIGNAL(clicked()), this, SLOT(moveDown()));

    finishLayout();
}
Exemplo n.º 2
0
Arquivo: WTable.C Projeto: DTidd/wt
void WTable::clear()
{
  while (rowCount() > 0)
    deleteRow(rowCount() - 1);

  while (columnCount() > 0)
    deleteColumn(columnCount() - 1);
}
Exemplo n.º 3
0
/**
 * Free the memory that has been allocated by fields within the Region
 * structure.  In this case, free the array of Columns that were
 * allocated (and recursively all the fields within the Column structs).
 * This function does NOT free the Region itself.
 */
void deleteRegion(Region* region) {
  int i;
  for(i=0; i<region->numCols; ++i)
    deleteColumn(&(region->columns[i]));
  free(region->columns);
  region->columns = NULL;

  if(region->inputCells!=NULL)
    free(region->inputCells);
  region->inputCells = NULL;
}
Exemplo n.º 4
0
void TableView::setColumns(std::initializer_list<ColumnProperties> columnList)
{
    auto numCol = columns();        // save column count since we are changing it
    if( numCol >= columnList.size() ) {
        int c = 0;
        for( auto it = columnList.begin(); it != columnList.end(); ++it,++c ) {
            setColumn(c,*it);
        }
        for( ; c < numCol; ++c ) {
            deleteColumn(c);
        }
    } else {
        auto it = columnList.begin();
        for( int c = 0; c < numCol; ++c, ++it ) {
            setColumn(c,*it);
        }
        for( ; it != columnList.end(); ++it ) {
            addColumn(*it);
        }
    }
}
Exemplo n.º 5
0
    void EFILE::hierarchicalClustering()
    {
      int _i,_j;
      if(nsolutions>nclusters+1){
        hasclusteredfirsttime=true;
        updatematrix=false;
        normalizeDistances();
        createProximityMatrix();
        while(pmsize>nclusters){
          findLowestValue(&_i,&_j);
          copy2Column(_i);
          copy2Column(_j);
          joinColumns(_i,_j);
          copy2Row(_i);
          deleteColumn(_j);
          deleteRow(_j);
          pmsize--;
        }
        for(_i=0;_i<nclusters;_i++){
          for(_j=0;proximitymatrixindex[_i][_j]!=-1;_j++);
          /*
      {

      for(int _k=0;_k<ndimensions;_k++){

      gbests4swarm[_i][_j].x[_k]=solutions[proximitymatrixindex[_i][_j]].x[_k];
          }

          for(int _k=0;_k<nobjectives;_k++){
          gbests4swarm[_i][_j].fx[_k]=solutions[proximitymatrixindex[_i][_j]].fx[_k];
          }
          }*/

          nsolutionsbyswarm[_i]=_j;
        }

      }
    }
Exemplo n.º 6
0
void ResTable::createHeaderPopupMenu(const QPoint& pos)
{
    LOGDEB(("ResTable::createHeaderPopupMenu(%d, %d)\n", pos.x(), pos.y()));
    QHeaderView *header = tableView->horizontalHeader();
    if (!header || !m_model)
	return;

    m_popcolumn = header->logicalIndexAt(pos);
    if (m_popcolumn < 0)
	return;

    const map<string, QString>& allfields = m_model->getAllFields();
    const vector<string>& fields = m_model->getFields();
    QMenu *popup = new QMenu(this);

    popup->addAction(tr("&Reset sort"), this, SLOT(resetSort()));
    popup->addSeparator();

    popup->addAction(tr("&Save as CSV"), this, SLOT(saveAsCSV()));
    popup->addSeparator();

    popup->addAction(tr("&Delete column"), this, SLOT(deleteColumn()));
    popup->addSeparator();

    QAction *act;
    for (map<string, QString>::const_iterator it = allfields.begin();
	 it != allfields.end(); it++) {
	if (std::find(fields.begin(), fields.end(), it->first) != fields.end())
	    continue;
	act = new QAction(tr("Add \"%1\" column").arg(it->second), popup);
	act->setData(QString::fromUtf8(it->first.c_str()));
	connect(act, SIGNAL(triggered(bool)), this , SLOT(addColumn()));
	popup->addAction(act);
    }
    popup->popup(mapToGlobal(pos));
}
Exemplo n.º 7
0
 /** Deletes all entries in column and bounds.  If last column the number of columns
     will be decremented and true returned.  */
 inline void deleteCol(int whichColumn)
 {
   deleteColumn(whichColumn);
 }