1 #include <QStringListModel>
3 #include "chaptersdialog.h"
6 ChaptersDialog::ChaptersDialog(Book *book, QWidget *parent):
7 ListWindow(tr("(No chapters)"), parent)
9 setWindowTitle(tr("Chapters"));
11 foreach (QString id, book->chapters) {
12 QString contentTitle = book->content[id].name;
13 data.append(contentTitle);
16 QStringListModel *model = new QStringListModel(data, this);
18 connect(this, SIGNAL(activated(const QModelIndex &)),
19 this, SLOT(onItemActivated(const QModelIndex &)));
22 void ChaptersDialog::onItemActivated(const QModelIndex &index)
24 emit goToChapter(index.row());