Logo Search packages:      
Sourcecode: qtoctave version File versions  Download package

void Table::line_ready ( QString  line  )  [slot]

Callback to line_ready signal from OctaveConnection.

Parameters:
line line from Octave.

Definition at line 104 of file table.cpp.

{
      if( ! line.startsWith("~~matrix:"+matrix) ) return;
      line=line.right(line.length() - (10+matrix.length()) );
      //printf("line:>%s<\n",line.ascii());
      if(line.indexOf('#')>-1)
      {     //La l�ea contiene el nmero de filas y columnas
            int _rows, _columns;
            sscanf(line.toAscii().data(),"#%d %d",&_rows,&_columns);
            table_form->table_widget->setColumnCount(_columns);
            table_form->table_widget->setRowCount(_rows);
            table_form->rows_lineedit->setText(line.setNum(_rows));
            table_form->cols_lineedit->setText(line.setNum(_columns));
            return;
      }
      else
      {
            //La l�ea contiene los datos de la celda
            int row=0, col;
            /*
            char data[256];
            sscanf(line.toAscii().data(),"%d %d %[0-9+iej .-]s",&row,&col,data);
            //printf("(%d,%d) %f",row,col,data);
            
            disconnect(table_form->table_widget,SIGNAL(cellChanged( int, int)),this,SLOT(cellChanged( int, int)));
            QTableWidgetItem *cell= new QTableWidgetItem(data);
            table_form->table_widget->setItem(row-1,col-1,cell);
            connect(table_form->table_widget,SIGNAL(cellChanged( int, int)),this,SLOT(cellChanged( int, int)));
            */
            QRegExp rx("([0-9ieEj\\.\\-\\+]+)");
            QString value;
            int pos = 0;
            if ((pos = rx.indexIn(line, pos)) != -1) 
            {
                  value=rx.cap(0);
                  pos += rx.matchedLength();
                  row=value.toInt()-1;
            }
            col=0;
            disconnect(table_form->table_widget,SIGNAL(cellChanged( int, int)),this,SLOT(cellChanged( int, int)));
            while ((pos = rx.indexIn(line, pos)) != -1) {
                  value=rx.cap(0);
                  pos += rx.matchedLength();
                  QTableWidgetItem *cell= new QTableWidgetItem(value);
                  table_form->table_widget->setItem(row,col,cell);
                  col++;
            }
            connect(table_form->table_widget,SIGNAL(cellChanged( int, int)),this,SLOT(cellChanged( int, int)));
      }
}


Generated by  Doxygen 1.6.0   Back to index