Commit fe45ce92 authored by Sergio Martins's avatar Sergio Martins

blogilo: Save 1 QHash iteration, 1 memory allocation and 2 lookups

parent 5e99b313
......@@ -126,12 +126,10 @@ MainWindow::MainWindow()
connect(toolbox, &Toolbox::sigError, this, &MainWindow::slotError);
connect(toolbox, &Toolbox::sigBusy, this, &MainWindow::slotBusy);
QList<BilboBlog *> blogList = DBMan::self()->blogList().values();
const int count = blogList.count();
for (int i = 0; i < count; ++i) {
QAction *act = new QAction(blogList.at(i)->title(), blogs);
foreach (BilboBlog *blog, DBMan::self()->blogList()) {
QAction *act = new QAction(blog->title(), blogs);
act->setCheckable(true);
act->setData(blogList.at(i)->id());
act->setData(blog->id());
blogs->addAction(act);
}
connect(blogs, static_cast<void (KSelectAction::*)(QAction *)>(&KSelectAction::triggered), this, &MainWindow::currentBlogChanged);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment