Example #1
0
MidiTable::~MidiTable()
{
	for( int myRow = 0; myRow <=  __row_count ; myRow++ ) {
		delete cellWidget( myRow, 0 );
		delete cellWidget( myRow, 1 );
		delete cellWidget( myRow, 2 );
		delete cellWidget( myRow, 3 );
	}
}
Example #2
0
void MarkList::select( int index )
{
    MarkListItem *_item;
    setCurrentCell( index, 0 );
    _item = dynamic_cast<MarkListItem *>( cellWidget( _selected, 0 ) );
    if (_item) _item -> setSelected( false );
    _selected = index;
    _item = dynamic_cast<MarkListItem *>( cellWidget( _selected, 0 ) );
    if (_item) _item -> setSelected( true );
    clearFocus();
}
Example #3
0
void MidiTable::updateTable()
{
	if( __row_count > 0 ) {
		QComboBox * eventCombo =  dynamic_cast <QComboBox *> ( cellWidget( __row_count - 1, 1 ) );
		QComboBox * actionCombo = dynamic_cast <QComboBox *> ( cellWidget( __row_count - 1, 3 ) );

		if( eventCombo == NULL || actionCombo == NULL) return;

		if( actionCombo->currentText() != "" && eventCombo->currentText() != "" ) {
			insertNewRow("", "", 0, 0);
		}
	}
}
Example #4
0
void MidiTable::midiSensePressed( int row ){

	currentMidiAutosenseRow = row;
	MidiSenseWidget mW( this );
	mW.exec();

	QComboBox * eventCombo =  dynamic_cast <QComboBox *> ( cellWidget( row, 1 ) );
	QSpinBox * eventSpinner = dynamic_cast <QSpinBox *> ( cellWidget( row, 2 ) );


	eventCombo->setCurrentIndex( eventCombo->findText( mW.lastMidiEvent ) );
	eventSpinner->setValue( mW.lastMidiEventParameter );

	m_pUpdateTimer->start( 100 );	
}
Example #5
0
ModulesInfo::~ModulesInfo()
{
    int rows = rowCount();
    for (int row = 0; row < rows; row++)
        delete cellWidget(0, row);
    clear();
}
Example #6
0
void MarkList::removeMarks()
{
    MarkListItem *_item;
    for( int i = 0; i < numRows(); i++ ) {
	_item = dynamic_cast<MarkListItem *>( cellWidget( i, 0 ) );
	assert( _item );
	_item->setChecked( false );
    }
}
Example #7
0
void MarkList::markOdd()
{
    MarkListItem *_item;
    for(int i = 0; i < numRows(); i = i + 2)
    {
	_item = dynamic_cast<MarkListItem *>( cellWidget( i, 0 ) );
	assert( _item );
	_item->setChecked( true );
    }
}
Example #8
0
void MarkList::toggleMarks()
{
    MarkListItem *_item;
    for(int i = 0; i < numRows(); i++)
    {
	_item = dynamic_cast<MarkListItem *>( cellWidget( i, 0 ) );
	assert( _item );
	_item->toggle();
    }
}
Example #9
0
void KWMapEditor::erase() {
	const TQObject *o = TQT_TQOBJECT(const_cast<TQT_BASE_OBJECT_NAME*>(sender()));
	for (int i = 0; i < numRows(); i++) {
		if (TQT_BASE_OBJECT_CONST(cellWidget(i, 0)) == TQT_BASE_OBJECT_CONST(o)) {
			removeRow(i);
			break;
		}
	}

	emit dirty();
}
Example #10
0
QValueList<int> MarkList::markList() const
{
    QValueList<int> list;
    MarkListItem *_item;
    for(int i = 0; i < numRows(); i++)
    {
	_item = dynamic_cast<MarkListItem *>( cellWidget( i, 0 ) );
	assert( _item );
	if ( _item->isChecked() ) list << (i + 1);
    }
    return list;
}
Example #11
0
void ModulesInfo::clean()
{
    int rows = rowCount();
    for (int row = 0; row < rows; row++)
        delete cellWidget(0, row);
    clear();
    setRowCount(0);
    m_modules.clear();
    m_rows.clear();

    setHorizontalHeaderLabels(m_moduleInfo);
}
Example #12
0
void MTable::setCellContentFromEditor( int row, int col )
{
    QWidget *editor = cellWidget( row, col );
    if ( !editor ) return;
    clearCell( row, col );
    if ( editor->inherits( "QComboBox" ) ){
	  QString str = ((QComboBox*)editor )->currentText();
                //if ( str == "no medium" ) str = "";
	  setText( row, col, str );
    }
    else if ( editor->inherits( "QLineEdit" ) )
	   setText( row, col, ( (QLineEdit*)editor )->text() );
}
WordsPtrSet QuizWordsChooserTable::selectedCards()
{
    WordsPtrSet tmp;

    for (int i = 0, size = rowCount(); i < size; i++) {
        QCheckBox *chck = qobject_cast<QCheckBox*>(cellWidget(i, 0));
        if (chck->isChecked()) {
            tmp << m_Cards[i];
        }
    }

    return tmp;
}
Example #14
0
void pTableWidget::updateToolButtonNumber()
{
    for(int row = 0; row < rowCount(); row++)
    {
        for(int column = 0; column < columnCount(); column++)
        {
            pToolButton *button = (pToolButton *) cellWidget(row, column);
            if(button != 0)
            {
                button->setNumber(row);
            }
        }
    }
}
Example #15
0
void QQuestionsTableWidget::setQuestions(const QList<QQuestion> & questions)
{
    QStringList answers;
    clearContents();
    while(rowCount())
        removeRow(0);
    setSortingEnabled(false);
    blockSignals(true);
    model() -> blockSignals(true);
    foreach(QQuestion quest,questions)
    {
        answers = quest.answers();
        if (answers.count() != (int)CHOICE_COUNT)
            continue;
        addQuestionRow();
        //setting columns: question, answers, true answer and rating
        item(rowCount() - 1,0) -> setText(quest.question());
        for (unsigned int i = 0; i < CHOICE_COUNT; i++)
            item(rowCount() - 1,1 + i) -> setText(answers.at(i));
        dynamic_cast<QComboBox *>(cellWidget(rowCount() - 1,1 + CHOICE_COUNT)) -> setCurrentText(QString::number(quest.goodAnswerIndex()));
        if (RATING)
            dynamic_cast<QComboBox *>(cellWidget(rowCount() - 1,1 + CHOICE_COUNT + 1)) -> setCurrentText(QString::number(quest.rating()));
    }
void QuizWordsChooserTable::fillTable()
{
    for (int i = 0, size = m_Cards.size(); i < size; i++) {
        insertRow(i);

        QCheckBox *chck = new QCheckBox();
        setCellWidget(i, 0, chck);

        QTableWidgetItem *item = new QTableWidgetItem(m_Cards[i]->word());
        setItem(i, 1, item);
    }

    setColumnWidth(0, cellWidget(0, 0)->width());
}
Example #17
0
void MarkList::viewportResizeEvent ( QResizeEvent * )
{
    MarkListItem *_item;
    if( visibleWidth() != columnWidth( 0 ) )
    {
	setColumnWidth( 0, visibleWidth() );
	for( int i = 0; i < numRows(); ++i )
	{
	    _item = dynamic_cast<MarkListItem *>( cellWidget( i, 0 ) );
	    assert( _item );
	    _item->setFixedSize( visibleWidth(), _item->height() );
	}
    }
}
Example #18
0
void MidiTable::saveMidiTable()
{
	MidiMap *mM = MidiMap::get_instance();
	
	for ( int row = 0; row < __row_count; row++ ) {

		QComboBox * eventCombo =  dynamic_cast <QComboBox *> ( cellWidget( row, 1 ) );
		QSpinBox * eventSpinner = dynamic_cast <QSpinBox *> ( cellWidget( row, 2 ) );
		QComboBox * actionCombo = dynamic_cast <QComboBox *> ( cellWidget( row, 3 ) );
		QSpinBox * actionSpinner = dynamic_cast <QSpinBox *> ( cellWidget( row, 4 ) );

		QString eventString;
		QString actionString;

		if( !eventCombo->currentText().isEmpty() && !actionCombo->currentText().isEmpty() ){
			eventString = eventCombo->currentText();

			actionString = actionCombo->currentText();
		
			MidiAction* pAction = new MidiAction( actionString );

			if( actionSpinner->cleanText() != ""){
				pAction->setParameter1( actionSpinner->cleanText() );
			}

			if( eventString.left(2) == "CC" ){
				mM->registerCCEvent( eventSpinner->cleanText().toInt() , pAction );
			} else if( eventString.left(3) == "MMC" ){
				mM->registerMMCEvent( eventString , pAction );
			} else if( eventString.left(4) == "NOTE" ){
				mM->registerNoteEvent( eventSpinner->cleanText().toInt() , pAction );
			} else if( eventString.left(14) == "PROGRAM_CHANGE" ){
				mM->registerPCEvent( pAction );
			}
		}
	}
}
QMap<QString, QString> PropertyEditingTable::extract() {
	QMap < QString, QString > r;
	for (int row=0;row<rowCount();row++)
	{
		PropDesc pdesc=props.at(row);
		QString val="0";
		if (pdesc.type == "boolean") {
			if (((QCheckBox *)cellWidget(row,1))->isChecked())
				val="1";
		} else
			val=item(row,1)->text();
		r[pdesc.name]=val;
	}
	return r;
}
Example #20
0
void searchTable::setRow(TableRow* element){
        insertRow(index);
        searchlist.push_back(element);//elemento condiviso tra le 2 liste
        setCellWidget(index,0,new QLineEdit(element->getName()->text(),this));
        setCellWidget(index,1,new QLineEdit(element->getType()->text(),this));
        setCellWidget(index,2,new QLineEdit(element->getLV()->text(),this));
        setCellWidget(index,4,new QLineEdit(element->getHP()->text(),this));
        setCellWidget(index,5,new QLineEdit(element->getStrength()->text(),this));
        setCellWidget(index,6,new QLineEdit(element->getConstitution()->text(),this));
        setCellWidget(index,3,new QLineEdit(element->getMP()->text(),this));
        setCellWidget(index,7,new QLineEdit(element->getWisdom()->text(),this));
        for(int i=0;i<8;++i)
            cellWidget(index,i)->setEnabled(false);//gli elementi di searchtable non sono modificabili
        setCurrentCell(index,0);
        ++index;
}
Example #21
0
void MyTable::forceUpdateCells() {
  for (int row = 0; row != numRows(); row += 1) {
    for (int col = 0; col != numCols(); col += 1) {
      QWidget * w = cellWidget(row, col);
      
      if (w != 0) {
	QString s = item(row, col)->text();
	
	item(row, col)->setContentFromEditor(w);
	if (item(row, col)->text() != s)
	  emit valueChanged(row, col);
	
	// warning : may have other edited cells
      }
    }
  }
}
Example #22
0
void pTableWidget::removeRow(int row)
{
    if(rowCount() == 1)
        clearContents();

    for(int column = 0; column < columnCount(); column++)
    {
        QWidget *w = cellWidget(row, column);
        if(w != 0)
        {
            removeCellWidget(row, column);
            delete w;
        }
    }

    QTableWidget::removeRow(row);

    updateToolButtonNumber();
}
Example #23
0
void MTable::endEdit( int row, int col, bool accept, bool replace )
{
    QWidget *editor = cellWidget( row, col );
    if ( !editor ) return;
    if (!editor->inherits("QComboBox")){
         QTable::endEdit( row, col, accept, replace );
         zap(editor);
         //if (editor) delete editor;// <== this seems neccessary to return control to the Table
         return;
    }
    else{
             setCellContentFromEditor( row, col );
              if ( row == currEditRow() && col == currEditCol() )
	     setEditMode( NotEditing, -1, -1 );
              viewport()->setFocus();
              updateCell( row, col );
              clearCellWidget( row, col );
              zap (editor);
              //if (editor) delete editor;// <== this seems neccessary to return control to the Table
               emit valueChanged( row, col );
    }
}
Example #24
0
void QFrozenRowTableWidget::updateCellData(int row, int column) {
	if (row > frozenRows)
		return;
	frozenTableWidget->setCellWidget(row, column, cellWidget(row, column));
}
Example #25
0
void TableWidgetDragRows::dropEvent(QDropEvent *event)
{
  if (event->source() == this && (event->dropAction() == Qt::MoveAction ||
    dragDropMode() == QAbstractItemView::InternalMove)) 
  {
    QModelIndex topIndex;
    int col = -1;
    int row = -1;
    if (this->dropOn(event, &row, &col, &topIndex)) 
    {
      std::set<int> selRows = getSelectedRowsFast(selectionModel()->selection());
      int top = *(selRows.begin());
      int dropRow = topIndex.row();
      if(dropRow == -1)
      {
        dropRow = rowCount();
      }
      int offset = dropRow - top;

      // insert new rows
      std::set<int>::const_iterator it;
      for(it = selRows.begin(); it != selRows.end(); ++it)
      {
        int r = *it + offset ;
        r = qMin(r, rowCount());
        r = qMax(r, 0);
        insertRow(r);
      }

      // copy data
      // note: row numbers may have changed after inserts, hence refresh selRows
      selRows = getSelectedRowsFast(selectionModel()->selection());
      top = *(selRows.begin());
      offset = dropRow - top;
      for(it = selRows.begin(); it != selRows.end(); ++it)
      {
        int r = *it + offset ;
        r = qMin(r, rowCount());
        r = qMax(r, 0);
        for(int c = 0; c < columnCount(); ++c)
        {
            QTableWidgetItem *myItem = item(*it, c);
            if (myItem) {
              QTableWidgetItem *source = new QTableWidgetItem(*myItem);
              setItem(r, c, source);
            }
            QWidget *myWidget = cellWidget(*it, c);
            if (myWidget) {
                setCellWidget(r, c, myWidget);
            }
        }
      }

      // delete selected rows. 
      std::set<int>::const_reverse_iterator rit;
      for(rit = selRows.rbegin(); rit != selRows.rend(); ++rit)
      {
        removeRow(*rit);
      }

      event->accept();
    }
  }
  else
  {
    QTableView::dropEvent(event);
  }

}
Example #26
0
void MarkList::markCurrent()
{
    MarkListItem *_item = dynamic_cast<MarkListItem *>( cellWidget( currentRow(), 0 ) );
    assert( _item );
    _item->toggle();
}
int StockTable::lowValue(int row)
{
    pSpinBox *low = (pSpinBox *)cellWidget(row, LowColumn);
    return low->value();
}
int StockTable::stock(int row)
{
    pSpinBox *stock = (pSpinBox *)cellWidget(row, StockColumn);
    return stock->value();
}
Example #29
0
QWidget* KWidgetListbox::item(int index) const
{
  return cellWidget(index, 0);
}
Example #30
0
// ----------------------------------------------------------------------
// ----------------------------------------------------------------------
void QmvTable::cellClicked( int row, int col, int button, const QPoint & mousePos)
{
    if ( !cellWidget( row, col ) )
        setFocus();
}