diff --git a/src/plugins/help/openpagesmanager.cpp b/src/plugins/help/openpagesmanager.cpp index 0b7f0171b9cc6c27f8f29ed6ca64b1886f3d96a2..d56a1853e540e998f36704d9245ac0fa061d0fbc 100644 --- a/src/plugins/help/openpagesmanager.cpp +++ b/src/plugins/help/openpagesmanager.cpp @@ -153,6 +153,8 @@ void OpenPagesManager::setupInitialPages() for (int i = 0; i < m_model->rowCount(); ++i) CentralWidget::instance()->addPage(m_model->pageAt(i)); + + emit pagesChanged(); setCurrentPage(initialPage); } diff --git a/src/plugins/help/openpagesmodel.cpp b/src/plugins/help/openpagesmodel.cpp index c2eae41afceb79fb22a57334aff824a08e05db60..55541533ebe6ea58e09636802625ed4823260017 100644 --- a/src/plugins/help/openpagesmodel.cpp +++ b/src/plugins/help/openpagesmodel.cpp @@ -39,20 +39,23 @@ OpenPagesModel::OpenPagesModel(QObject *parent) { } -int OpenPagesModel::columnCount(const QModelIndex &/*parent*/) const +int OpenPagesModel::rowCount(const QModelIndex &parent) const { - return 2; + return parent.isValid() ? 0 : m_pages.count(); } -int OpenPagesModel::rowCount(const QModelIndex &parent) const +int OpenPagesModel::columnCount(const QModelIndex &/*parent*/) const { - return parent.isValid() ? 0 : m_pages.count(); + return 2; } QVariant OpenPagesModel::data(const QModelIndex &index, int role) const { - if (!index.isValid() || index.row() >= rowCount() || role != Qt::DisplayRole) + if (!index.isValid() || role != Qt::DisplayRole + || index.row() >= rowCount() || index.column() >= columnCount() - 1) + return QVariant(); + QString title = m_pages.at(index.row())->title(); title.replace(QLatin1Char('&'), QLatin1String("&&")); return title.isEmpty() ? tr("(Untitled)") : title; diff --git a/src/plugins/help/openpagesmodel.h b/src/plugins/help/openpagesmodel.h index 0fe32c017dd0954cc253255094bf74c297eb4cc8..2dc7c878819883c98c7a4c419254094a240313d4 100644 --- a/src/plugins/help/openpagesmodel.h +++ b/src/plugins/help/openpagesmodel.h @@ -46,8 +46,8 @@ class OpenPagesModel : public QAbstractTableModel public: OpenPagesModel(QObject *parent); - int columnCount(const QModelIndex &parent) const; int rowCount(const QModelIndex &parent = QModelIndex()) const; + int columnCount(const QModelIndex &parent = QModelIndex()) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; void addPage(const QUrl &url, qreal zoom = 0); diff --git a/src/plugins/help/openpageswidget.cpp b/src/plugins/help/openpageswidget.cpp index 25a0230f35f070543cf8e48db0a3b39bc150d040..3d19778261251bc2c3140903d83c37b1ac526246 100644 --- a/src/plugins/help/openpageswidget.cpp +++ b/src/plugins/help/openpageswidget.cpp @@ -98,7 +98,7 @@ OpenPagesWidget::OpenPagesWidget(OpenPagesModel *model) header()->setStretchLastSection(false); header()->setResizeMode(0, QHeaderView::Stretch); header()->setResizeMode(1, QHeaderView::Fixed); - header()->resizeSection(1, 16); + header()->resizeSection(1, 18); installEventFilter(this); setUniformRowHeights(true);