示例#1
0
void tablewidget::selectTableRow( QTableWidgetItem * current,QTableWidgetItem * previous )
{
	QTableWidget * table ;

	int col = 0 ;
	int i   = 0 ;
	int j   = 0 ;

	if( current && previous ){

		if( previous->row() == current->row() ){
			table = current->tableWidget() ;
			table->setCurrentCell( current->row(),table->columnCount() - 1 ) ;
			table->setFocus() ;
			return ;
		}
	}

	if( current ){

		table = current->tableWidget() ;

		if( table->rowCount() > 0 ){

			col = table->columnCount() ;
			j = current->row() ;

			for( i = 0 ; i < col ; i++ ){
				table->item( j,i )->setSelected( true ) ;
			}
		}

		table->setCurrentCell( j,table->columnCount() -1 ) ;
		table->setFocus() ;
	}

	if( previous ){

		table = previous->tableWidget() ;

		if( table->rowCount() > 0 ){

			col = table->columnCount() ;
			j = previous->row() ;

			for( i = 0 ; i < col ; i++ ){
				table->item( j,i )->setSelected( false ) ;
			}
		}

		table->setFocus() ;
	}
}
示例#2
0
void Player::playNext()
{
    stop();
    _isPaused = false;

    int r;
    QTableWidget *widget = 0;
    QList<Track*> *playlist = 0;
//    Track *track = 0;

    if (_ui->tabWidget->currentWidget() == _ui->libraryTab)
    {
        widget = _ui->tracks;
        playlist = &_libTracks;
    }
    else
    {
        widget = _ui->playlist;
        playlist = &_plistTracks;
    }

    r = widget->currentRow() + 1;
    if (r >= playlist->size())
        return;

    widget->setCurrentCell(r, 0);
    play();
}
示例#3
0
void Player::playPrevious()
{
    stop();
    _isPaused = false;

    int r;
    QTableWidget *widget = 0;
//    QList<Track*> *playlist = 0;
//    Track *track = 0;

    if (_ui->tabWidget->currentWidget() == _ui->libraryTab)
    {
        widget = _ui->tracks;
//        playlist = &_libTracks;
    }
    else
    {
        widget = _ui->playlist;
//        playlist = &_plistTracks;
    }

    r = widget->currentRow();
    if (r <= 0)
        return;

    widget->setCurrentCell(--r, 0);
    play();
}
示例#4
0
void Table::setSelection(int row, int column, bool suppressSignals)
{
    QTableWidget *tablewidget = static_cast<QTableWidget*>(getQWidget());
    bool oldSignalsState = tablewidget->blockSignals(suppressSignals);
    tablewidget->setCurrentCell(row, column);
    tablewidget->blockSignals(oldSignalsState);
}