call bucket enumeration - function pointers are misbehaving
This commit is contained in:
parent
8a93f163c4
commit
be594cb1a5
@ -31,7 +31,7 @@ void MainWindow::on_actionOpen_database_triggered()
|
||||
auto *bdb = BoltDB::createFrom(file, error);
|
||||
if (bdb == nullptr) {
|
||||
QMessageBox qmb;
|
||||
qmb.setText(tr("Error opening database: %s").arg(error));
|
||||
qmb.setText(tr("Error opening database: %1").arg(error));
|
||||
qmb.exec();
|
||||
return;
|
||||
}
|
||||
@ -41,6 +41,20 @@ void MainWindow::on_actionOpen_database_triggered()
|
||||
top->setIcon(0, QIcon(":/rsrc/database.png"));
|
||||
ui->bucketTree->addTopLevelItem(top);
|
||||
|
||||
bool ok = bdb->listBucketsAtRoot(error, [=](QByteArray qba){
|
||||
QTreeWidgetItem *child = new QTreeWidgetItem();
|
||||
child->setText(0, QString::fromUtf8(qba));
|
||||
child->setIcon(0, QIcon(":/rsrc/table.png"));
|
||||
top->addChild(child);
|
||||
});
|
||||
|
||||
if (!ok) {
|
||||
QMessageBox qmb;
|
||||
qmb.setText(tr("Error listing buckets: %1").arg(error));
|
||||
qmb.exec();
|
||||
// (continue)
|
||||
}
|
||||
|
||||
// Free
|
||||
delete bdb;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user