| 250 | } |
| 251 | |
| 252 | void DocumentationView::updateView() |
| 253 | { |
| 254 | if (mCurrent != mHistory.end()) { |
| 255 | mProviders->setCurrentIndex(mProvidersModel->rowForProvider((*mCurrent)->provider())); |
| 256 | mIdentifiers->completer()->setModel((*mCurrent)->provider()->indexModel()); |
| 257 | mIdentifiers->setText((*mCurrent)->name()); |
| 258 | mIdentifiers->completer()->setCompletionPrefix((*mCurrent)->name()); |
| 259 | } else { |
| 260 | mIdentifiers->clear(); |
| 261 | } |
| 262 | |
| 263 | QLayoutItem* lastview = layout()->takeAt(0); |
| 264 | Q_ASSERT(lastview); |
| 265 | |
| 266 | if (lastview->widget()->parent() == this) { |
| 267 | lastview->widget()->deleteLater(); |
| 268 | } |
| 269 | |
| 270 | delete lastview; |
| 271 | |
| 272 | mFindDoc->setEnabled(false); |
| 273 | QWidget* w; |
| 274 | if (mCurrent != mHistory.end()) { |
| 275 | w = (*mCurrent)->documentationWidget(mFindDoc, this); |
| 276 | Q_ASSERT(w); |
| 277 | |
| 278 | if (auto* const standardView = qobject_cast<StandardDocumentationView*>(w)) { |
| 279 | connect(standardView, &StandardDocumentationView::browseForward, this, &DocumentationView::tryBrowseForward); |
| 280 | connect(standardView, &StandardDocumentationView::browseBack, this, &DocumentationView::tryBrowseBack); |
| 281 | } |
| 282 | } else { |
| 283 | // placeholder widget at location of doc view |
| 284 | w = new QWidget(this); |
| 285 | } |
| 286 | |
| 287 | mFind->setEnabled(mFindDoc->isEnabled()); |
| 288 | if (!mFindDoc->isEnabled()) { |
| 289 | mFindDoc->hide(); |
| 290 | } |
| 291 | |
| 292 | QLayoutItem* findWidget = layout()->takeAt(0); |
| 293 | layout()->addWidget(w); |
| 294 | layout()->addItem(findWidget); |
| 295 | } |
| 296 | |
| 297 | void DocumentationView::changedProvider(int row) |
| 298 | { |
nothing calls this directly
no test coverage detected