void MainWindow::download()
{
QItemSelection selection
( ui
->tableView
->selectionModel
()->selection
() );
foreach
( const QModelIndex & index, selection.
indexes() ) {
rows.append( index.row() );
}
down1 = rows.count();
if(ui->lineEdit_3->text().isEmpty())
{
on_pushButton_3_clicked();
}
watek.clear();
for(down=0; down<8; down++)
{
connect(mailb[down], SIGNAL(progress(int,int,int)), this, SLOT(upd(int,int,int)));
connect(mailb[down], SIGNAL(done(int)), this, SLOT(asda(int)));
QString temp1
= ui
->tableView
->model
()->data
(ui
->tableView
->model
()->index
(rows
[down
],
0)).
toString();
QString temp2
= ui
->tableView
->model
()->data
(ui
->tableView
->model
()->index
(rows
[down
],
1)).
toString();
mailb[down]->number = rows[down];
mailb[down]->number1 = down;
QString type
= mailb
[down
]->type.
c_str();
temp1 = ui->lineEdit_3->text() + "/" + temp1;
qDebug() << temp1 << temp2;
watek.push_back(QtConcurrent::run(mailb[down], &mailbox::downloadFile, temp2, temp1));
//mailb[0]->downloadFile(temp2, temp1);
}
}
void MainWindow::download()
{
QItemSelection selection( ui->tableView->selectionModel()->selection() );
foreach( const QModelIndex & index, selection.indexes() )
{
rows.append( index.row() );
}
down1 = rows.count();
if(ui->lineEdit_3->text().isEmpty())
{
on_pushButton_3_clicked();
}
watek.clear();
for(down=0; down<8; down++)
{
connect(mailb[down], SIGNAL(progress(int,int,int)), this, SLOT(upd(int,int,int)));
connect(mailb[down], SIGNAL(done(int)), this, SLOT(asda(int)));
QString temp1 = ui->tableView->model()->data(ui->tableView->model()->index(rows[down],0)).toString();
QString temp2 = ui->tableView->model()->data(ui->tableView->model()->index(rows[down],1)).toString();
mailb[down]->number = rows[down];
mailb[down]->number1 = down;
QString type = mailb[down]->type.c_str();
temp1 = ui->lineEdit_3->text() + "/" + temp1;
qDebug() << temp1 << temp2;
watek.push_back(QtConcurrent::run(mailb[down], &mailbox::downloadFile, temp2, temp1));
//mailb[0]->downloadFile(temp2, temp1);
}
}
To copy to clipboard, switch view to plain text mode
function downloadFile is run just twice, not 8 times. Is there maybe some limits for number of threads? If there are, then how can I bypass that limits?
Bookmarks