MCPcopy Create free account
hub / github.com/KDE/kdevelop / setupActions

Method setupActions

kdevplatform/documentation/documentationview.cpp:66–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64}
65
66void DocumentationView::setupActions()
67{
68 // use custom QAction's with createWidget for mProviders and mIdentifiers
69 mBack = new QAction(QIcon::fromTheme(QStringLiteral("go-previous")), i18nc("@action go back", "Back"), this);
70 mBack->setEnabled(false);
71 connect(mBack, &QAction::triggered, this, &DocumentationView::browseBack);
72 addAction(mBack);
73
74 mForward = new QAction(QIcon::fromTheme(QStringLiteral("go-next")), i18nc("@action go forward", "Forward"), this);
75 mForward->setEnabled(false);
76 connect(mForward, &QAction::triggered, this, &DocumentationView::browseForward);
77 addAction(mForward);
78
79 mHomeAction = new QAction(QIcon::fromTheme(QStringLiteral("go-home")), i18nc("@action go to start page", "Home"), this);
80 mHomeAction->setEnabled(false);
81 connect(mHomeAction, &QAction::triggered, this, &DocumentationView::showHome);
82 addAction(mHomeAction);
83
84 mProviders = new QComboBox(this);
85 mProviders->setSizeAdjustPolicy(QComboBox::AdjustToContents);
86 auto providersAction = new QWidgetAction(this);
87 providersAction->setDefaultWidget(mProviders);
88 addAction(providersAction);
89
90 mIdentifiers = new QLineEdit(this);
91 mIdentifiers->setEnabled(false);
92 mIdentifiers->setClearButtonEnabled(true);
93 mIdentifiers->setPlaceholderText(i18nc("@info:placeholder", "Search..."));
94 mIdentifiers->setCompleter(new QCompleter(mIdentifiers));
95// mIdentifiers->completer()->setCompletionMode(QCompleter::UnfilteredPopupCompletion);
96 mIdentifiers->completer()->setCaseSensitivity(Qt::CaseInsensitive);
97
98 /* vertical size policy should be left to the style. */
99 mIdentifiers->setSizePolicy(QSizePolicy::Expanding, mIdentifiers->sizePolicy().verticalPolicy());
100 connect(mIdentifiers->completer(), QOverload<const QModelIndex&>::of(&QCompleter::activated),
101 this, &DocumentationView::changedSelection);
102 connect(mIdentifiers, &QLineEdit::returnPressed, this, &DocumentationView::returnPressed);
103 auto identifiersAction = new QWidgetAction(this);
104 identifiersAction->setDefaultWidget(mIdentifiers);
105 addAction(identifiersAction);
106
107 mSeparatorBeforeFind = new QAction(this);
108 mSeparatorBeforeFind->setSeparator(true);
109 addAction(mSeparatorBeforeFind);
110
111 mFind = new QAction(QIcon::fromTheme(QStringLiteral("edit-find")), i18nc("@action", "Find in Text..."), this);
112 mFind->setToolTip(i18nc("@info:tooltip", "Find in text of current documentation page"));
113 mFind->setEnabled(false);
114 connect(mFind, &QAction::triggered, mFindDoc, &DocumentationFindWidget::startSearch);
115 addAction(mFind);
116
117 auto closeFindBarShortcut = new QShortcut(QKeySequence(Qt::Key_Escape), this);
118 closeFindBarShortcut->setContext(Qt::WidgetWithChildrenShortcut);
119 connect(closeFindBarShortcut, &QShortcut::activated, mFindDoc, &QWidget::hide);
120}
121
122void DocumentationView::initialize()
123{

Callers

nothing calls this directly

Calls 4

setPlaceholderTextMethod · 0.80
setToolTipMethod · 0.80
setEnabledMethod · 0.45
setContextMethod · 0.45

Tested by

no test coverage detected