KConfigWidgets

kstandardaction.cpp
1/*
2 This file is part of the KDE libraries
3 SPDX-FileCopyrightText: 1999, 2000 Kurt Granroth <granroth@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-only
6*/
7
8#include "kstandardaction.h"
9#include "kopenaction_p.h"
10#include "kstandardaction_p.h"
11#include "moc_kstandardaction_p.cpp"
12
13#include <KAboutData>
14#include <KAcceleratorManager>
15#include <KLocalizedString>
16#include <KStandardShortcutWatcher>
17#include <QGuiApplication>
18#include <QLayout>
19#include <QMainWindow>
20#include <QMenuBar>
21
23{
24AutomaticAction::AutomaticAction(const QIcon &icon,
25 const QString &text,
27 const char *slot,
28 QObject *parent)
29 : QAction(parent)
30{
31 setText(text);
32 setIcon(icon);
33
34 const QList<QKeySequence> shortcut = KStandardShortcut::shortcut(standardShortcut);
35 setShortcuts(shortcut);
36 setProperty("defaultShortcuts", QVariant::fromValue(shortcut));
39 this,
40 [standardShortcut, this](KStandardShortcut::StandardShortcut id, const QList<QKeySequence> &newShortcut) {
41 if (id != standardShortcut) {
42 return;
43 }
44 setShortcuts(newShortcut);
45 setProperty("defaultShortcuts", QVariant::fromValue(newShortcut));
46 });
47
48 connect(this, SIGNAL(triggered()), this, slot);
49}
50
52{
53 return internal_stdNames();
54}
55
57{
59
60 for (uint i = 0; g_rgActionInfo[i].id != ActionNone; i++) {
61 result.append(g_rgActionInfo[i].id);
62 }
63
64 return result;
65}
66
68{
69 const KStandardActionInfo *pInfo = infoPtr(id);
70 return (pInfo) ? pInfo->idAccel : KStandardShortcut::AccelNone;
71}
72
73class ShowMenubarActionFilter : public QObject
74{
75public:
76 ShowMenubarActionFilter(QAction *parent)
78 , wasNative(false)
79 , wasChecked(false)
80 , wasVisible(false)
81 {
82 }
83
84 bool eventFilter(QObject * /*watched*/, QEvent *e) override
85 {
86 if (e->type() == QEvent::Show) {
87 updateAction();
88 }
89 return false;
90 }
91
92 void updateAction()
93 {
94 bool allMenuBarsNative = true;
95 bool hasAnyMenuBar = false;
96 const auto lstWidget = qApp->topLevelWidgets();
97 for (QWidget *w : lstWidget) {
99 if (mw) {
100 mw->installEventFilter(this); // this is just in case a new main window appeared
101 // if we were filtering it already it is almost a noop
102 if (mw->layout() && mw->layout()->menuBar()) {
104 if (mb) {
105 hasAnyMenuBar = true;
106 if (!mb->isNativeMenuBar()) {
107 allMenuBarsNative = false;
108 }
109 }
110 }
111 }
112 }
113
114 if (!hasAnyMenuBar) {
115 return;
116 }
117
118 QAction *showMenubarAction = static_cast<QAction *>(parent());
119 if (allMenuBarsNative && !wasNative) {
120 wasNative = true;
121 wasChecked = showMenubarAction->isChecked();
122 wasVisible = showMenubarAction->isVisible();
123
124 showMenubarAction->setChecked(true);
125 showMenubarAction->setVisible(false);
126 } else if (!allMenuBarsNative && wasNative) {
127 showMenubarAction->setChecked(wasChecked);
128 showMenubarAction->setVisible(wasVisible);
129 }
130 }
131
132 bool wasNative;
133 bool wasChecked;
134 bool wasVisible;
135};
136
138{
139 static bool stdNamesInitialized = false;
140
141 if (!stdNamesInitialized) {
143 stdNamesInitialized = true;
144 }
145
146 QAction *pAction = nullptr;
147 const KStandardActionInfo *pInfo = infoPtr(id);
148
149 // qCDebug(KCONFIG_WIDGETS_LOG) << "KStandardAction::create( " << id << "=" << (pInfo ? pInfo->psName : (const char*)0) << ", " << parent << " )"; // ellis
150
151 if (pInfo) {
152 QString sLabel;
153 QString iconName = pInfo->psIconName.toString();
154
155 switch (id) {
156 case Back:
157 sLabel = i18nc("go back", "&Back");
159 iconName = QStringLiteral("go-next");
160 }
161 break;
162
163 case Forward:
164 sLabel = i18nc("go forward", "&Forward");
166 iconName = QStringLiteral("go-previous");
167 }
168 break;
169
170 case Home:
171 sLabel = i18nc("home page", "&Home");
172 break;
173 case Preferences:
174 case AboutApp:
175 case HelpContents: {
177 if (appDisplayName.isEmpty()) {
178 appDisplayName = QCoreApplication::applicationName();
179 }
180 sLabel = pInfo->psLabel.subs(appDisplayName).toString();
181 } break;
182 default:
183 sLabel = pInfo->psLabel.toString();
184 }
185
187 switch (id) {
188 case Prior:
189 iconName = QStringLiteral("go-next-view-page");
190 break;
191 case Next:
192 iconName = QStringLiteral("go-previous-view-page");
193 break;
194 case FirstPage:
195 iconName = QStringLiteral("go-last-view-page");
196 break;
197 case LastPage:
198 iconName = QStringLiteral("go-first-view-page");
199 break;
200 case DocumentBack:
201 iconName = QStringLiteral("go-next");
202 break;
203 case DocumentForward:
204 iconName = QStringLiteral("go-previous");
205 break;
206 default:
207 break;
208 }
209 }
210
211 if (id == Donate) {
213 if (!currencyCode.isEmpty()) {
214 iconName = QStringLiteral("help-donate-%1").arg(currencyCode);
215 }
216 }
217
218 QIcon icon = iconName.isEmpty() ? QIcon() : QIcon::fromTheme(iconName);
219
220 switch (id) {
221 case Open:
222 pAction = new KOpenAction(parent);
223 break;
224 case OpenRecent:
225 pAction = new KRecentFilesAction(parent);
226 break;
227 case ShowMenubar: {
228 pAction = new KToggleAction(parent);
229 pAction->setWhatsThis(
230 i18n("Show Menubar<p>"
231 "Shows the menubar again after it has been hidden</p>"));
232 pAction->setChecked(true);
233
234 ShowMenubarActionFilter *mf = new ShowMenubarActionFilter(pAction);
235 const auto lstWidget = qApp->topLevelWidgets();
236 for (QWidget *w : lstWidget) {
237 if (qobject_cast<QMainWindow *>(w)) {
238 w->installEventFilter(mf);
239 }
240 }
241 mf->updateAction();
242 break;
243 }
244 case ShowToolbar:
245 pAction = new KToggleAction(parent);
246 pAction->setChecked(true);
247 break;
248 case ShowStatusbar:
249 pAction = new KToggleAction(parent);
250 pAction->setWhatsThis(
251 i18n("Show Statusbar<p>"
252 "Shows the statusbar, which is the bar at the bottom of the window used for status information.</p>"));
253 pAction->setChecked(true);
254 break;
255 case FullScreen:
256 pAction = new KToggleFullScreenAction(parent);
257 pAction->setCheckable(true);
258 break;
259 // Same as default, but with the app icon
260 case AboutApp: {
261 pAction = new QAction(parent);
262 icon = qApp->windowIcon();
263 break;
264 }
265 case HamburgerMenu: {
266 pAction = new KHamburgerMenu(parent);
267 break;
268 }
269
270 default:
271 pAction = new QAction(parent);
272 break;
273 }
274
275 // Set the text before setting the MenuRole, as on OS X setText will do some heuristic role guessing.
276 // This ensures user menu items get the intended role out of the list below.
277 pAction->setText(sLabel);
278
279 switch (id) {
280 case Quit:
282 break;
283
284 case Preferences:
286 break;
287
288 case AboutApp:
290 break;
291
292 default:
294 break;
295 }
296
297 if (!pInfo->psToolTip.isEmpty()) {
298 pAction->setToolTip(pInfo->psToolTip.toString());
299 }
300 pAction->setIcon(icon);
301
303 if (!cut.isEmpty()) {
304 // emulate KActionCollection::setDefaultShortcuts to allow the use of "configure shortcuts"
305 pAction->setShortcuts(cut);
306 pAction->setProperty("defaultShortcuts", QVariant::fromValue(cut));
307 }
310 pAction,
311 [pAction, shortcut = pInfo->idAccel](KStandardShortcut::StandardShortcut id, const QList<QKeySequence> &newShortcut) {
312 if (id != shortcut) {
313 return;
314 }
315 pAction->setShortcuts(newShortcut);
316 pAction->setProperty("defaultShortcuts", QVariant::fromValue(newShortcut));
317 });
318
319 pAction->setObjectName(pInfo->psName.toString());
320 }
321
322 if (pAction && parent && parent->inherits("KActionCollection")) {
323 QMetaObject::invokeMethod(parent, "addAction", Q_ARG(QString, pAction->objectName()), Q_ARG(QAction *, pAction));
324 }
325
326 return pAction;
327}
328
329QAction *create(StandardAction id, const QObject *recvr, const char *slot, QObject *parent)
330{
331 QAction *pAction = _k_createInternal(id, parent);
332 if (recvr && slot) {
333 if (id == OpenRecent) {
334 // FIXME QAction port: probably a good idea to find a cleaner way to do this
335 // Open Recent is a special case - provide the selected URL
336 QObject::connect(pAction, SIGNAL(urlSelected(QUrl)), recvr, slot);
337 } else if (id == ConfigureToolbars) { // #200815
338 QObject::connect(pAction, SIGNAL(triggered(bool)), recvr, slot, Qt::QueuedConnection);
339 } else {
340 QObject::connect(pAction, SIGNAL(triggered(bool)), recvr, slot);
341 }
342 }
343 return pAction;
344}
345
347{
348 const KStandardActionInfo *pInfo = infoPtr(id);
349 return (pInfo) ? pInfo->psName.toString() : QString();
350}
351
352QAction *openNew(const QObject *recvr, const char *slot, QObject *parent)
353{
354 return KStandardAction::create(New, recvr, slot, parent);
355}
356
357QAction *open(const QObject *recvr, const char *slot, QObject *parent)
358{
359 return KStandardAction::create(Open, recvr, slot, parent);
360}
361
362KRecentFilesAction *openRecent(const QObject *recvr, const char *slot, QObject *parent)
363{
364 return (KRecentFilesAction *)KStandardAction::create(OpenRecent, recvr, slot, parent);
365}
366
367QAction *save(const QObject *recvr, const char *slot, QObject *parent)
368{
369 return KStandardAction::create(Save, recvr, slot, parent);
370}
371
372QAction *saveAs(const QObject *recvr, const char *slot, QObject *parent)
373{
374 return KStandardAction::create(SaveAs, recvr, slot, parent);
375}
376
377QAction *revert(const QObject *recvr, const char *slot, QObject *parent)
378{
379 return KStandardAction::create(Revert, recvr, slot, parent);
380}
381
382QAction *print(const QObject *recvr, const char *slot, QObject *parent)
383{
384 return KStandardAction::create(Print, recvr, slot, parent);
385}
386
387QAction *printPreview(const QObject *recvr, const char *slot, QObject *parent)
388{
389 return KStandardAction::create(PrintPreview, recvr, slot, parent);
390}
391
392QAction *close(const QObject *recvr, const char *slot, QObject *parent)
393{
394 return KStandardAction::create(Close, recvr, slot, parent);
395}
396
397QAction *mail(const QObject *recvr, const char *slot, QObject *parent)
398{
399 return KStandardAction::create(Mail, recvr, slot, parent);
400}
401
402QAction *quit(const QObject *recvr, const char *slot, QObject *parent)
403{
404 return KStandardAction::create(Quit, recvr, slot, parent);
405}
406
407QAction *undo(const QObject *recvr, const char *slot, QObject *parent)
408{
409 return KStandardAction::create(Undo, recvr, slot, parent);
410}
411
412QAction *redo(const QObject *recvr, const char *slot, QObject *parent)
413{
414 return KStandardAction::create(Redo, recvr, slot, parent);
415}
416
417QAction *cut(const QObject *recvr, const char *slot, QObject *parent)
418{
419 return KStandardAction::create(Cut, recvr, slot, parent);
420}
421
422QAction *copy(const QObject *recvr, const char *slot, QObject *parent)
423{
424 return KStandardAction::create(Copy, recvr, slot, parent);
425}
426
427QAction *paste(const QObject *recvr, const char *slot, QObject *parent)
428{
429 return KStandardAction::create(Paste, recvr, slot, parent);
430}
431
432QAction *clear(const QObject *recvr, const char *slot, QObject *parent)
433{
434 return KStandardAction::create(Clear, recvr, slot, parent);
435}
436
437QAction *selectAll(const QObject *recvr, const char *slot, QObject *parent)
438{
439 return KStandardAction::create(SelectAll, recvr, slot, parent);
440}
441
442QAction *deselect(const QObject *recvr, const char *slot, QObject *parent)
443{
444 return KStandardAction::create(Deselect, recvr, slot, parent);
445}
446
447QAction *find(const QObject *recvr, const char *slot, QObject *parent)
448{
449 return KStandardAction::create(Find, recvr, slot, parent);
450}
451
452QAction *findNext(const QObject *recvr, const char *slot, QObject *parent)
453{
454 return KStandardAction::create(FindNext, recvr, slot, parent);
455}
456
457QAction *findPrev(const QObject *recvr, const char *slot, QObject *parent)
458{
459 return KStandardAction::create(FindPrev, recvr, slot, parent);
460}
461
462QAction *replace(const QObject *recvr, const char *slot, QObject *parent)
463{
464 return KStandardAction::create(Replace, recvr, slot, parent);
465}
466
467QAction *actualSize(const QObject *recvr, const char *slot, QObject *parent)
468{
469 return KStandardAction::create(ActualSize, recvr, slot, parent);
470}
471
472QAction *fitToPage(const QObject *recvr, const char *slot, QObject *parent)
473{
474 return KStandardAction::create(FitToPage, recvr, slot, parent);
475}
476
477QAction *fitToWidth(const QObject *recvr, const char *slot, QObject *parent)
478{
479 return KStandardAction::create(FitToWidth, recvr, slot, parent);
480}
481
482QAction *fitToHeight(const QObject *recvr, const char *slot, QObject *parent)
483{
484 return KStandardAction::create(FitToHeight, recvr, slot, parent);
485}
486
487QAction *zoomIn(const QObject *recvr, const char *slot, QObject *parent)
488{
489 return KStandardAction::create(ZoomIn, recvr, slot, parent);
490}
491
492QAction *zoomOut(const QObject *recvr, const char *slot, QObject *parent)
493{
494 return KStandardAction::create(ZoomOut, recvr, slot, parent);
495}
496
497QAction *zoom(const QObject *recvr, const char *slot, QObject *parent)
498{
499 return KStandardAction::create(Zoom, recvr, slot, parent);
500}
501
502QAction *redisplay(const QObject *recvr, const char *slot, QObject *parent)
503{
504 return KStandardAction::create(Redisplay, recvr, slot, parent);
505}
506
507QAction *up(const QObject *recvr, const char *slot, QObject *parent)
508{
509 return KStandardAction::create(Up, recvr, slot, parent);
510}
511
512QAction *back(const QObject *recvr, const char *slot, QObject *parent)
513{
514 return KStandardAction::create(Back, recvr, slot, parent);
515}
516
517QAction *forward(const QObject *recvr, const char *slot, QObject *parent)
518{
519 return KStandardAction::create(Forward, recvr, slot, parent);
520}
521
522QAction *home(const QObject *recvr, const char *slot, QObject *parent)
523{
524 return KStandardAction::create(Home, recvr, slot, parent);
525}
526
527QAction *prior(const QObject *recvr, const char *slot, QObject *parent)
528{
529 return KStandardAction::create(Prior, recvr, slot, parent);
530}
531
532QAction *next(const QObject *recvr, const char *slot, QObject *parent)
533{
534 return KStandardAction::create(Next, recvr, slot, parent);
535}
536
537QAction *goTo(const QObject *recvr, const char *slot, QObject *parent)
538{
539 return KStandardAction::create(Goto, recvr, slot, parent);
540}
541
542QAction *gotoPage(const QObject *recvr, const char *slot, QObject *parent)
543{
544 return KStandardAction::create(GotoPage, recvr, slot, parent);
545}
546
547QAction *gotoLine(const QObject *recvr, const char *slot, QObject *parent)
548{
549 return KStandardAction::create(GotoLine, recvr, slot, parent);
550}
551
552QAction *firstPage(const QObject *recvr, const char *slot, QObject *parent)
553{
554 return KStandardAction::create(FirstPage, recvr, slot, parent);
555}
556
557QAction *lastPage(const QObject *recvr, const char *slot, QObject *parent)
558{
559 return KStandardAction::create(LastPage, recvr, slot, parent);
560}
561
562QAction *documentBack(const QObject *recvr, const char *slot, QObject *parent)
563{
564 return KStandardAction::create(DocumentBack, recvr, slot, parent);
565}
566
567QAction *documentForward(const QObject *recvr, const char *slot, QObject *parent)
568{
569 return KStandardAction::create(DocumentForward, recvr, slot, parent);
570}
571
572QAction *addBookmark(const QObject *recvr, const char *slot, QObject *parent)
573{
574 return KStandardAction::create(AddBookmark, recvr, slot, parent);
575}
576
577QAction *editBookmarks(const QObject *recvr, const char *slot, QObject *parent)
578{
579 return KStandardAction::create(EditBookmarks, recvr, slot, parent);
580}
581
582QAction *spelling(const QObject *recvr, const char *slot, QObject *parent)
583{
584 return KStandardAction::create(Spelling, recvr, slot, parent);
585}
586
587static QAction *buildAutomaticAction(QObject *parent, StandardAction id, const char *slot)
588{
589 const KStandardActionInfo *p = infoPtr(id);
590 if (!p) {
591 return nullptr;
592 }
593
594 AutomaticAction *action = new AutomaticAction(QIcon::fromTheme(p->psIconName.toString()), p->psLabel.toString(), p->idAccel, slot, parent);
595
596 action->setObjectName(p->psName.toString());
597 if (!p->psToolTip.isEmpty()) {
598 action->setToolTip(p->psToolTip.toString());
599 }
600
601 if (parent && parent->inherits("KActionCollection")) {
602 QMetaObject::invokeMethod(parent, "addAction", Q_ARG(QString, action->objectName()), Q_ARG(QAction *, action));
603 }
604
605 return action;
606}
607
608QAction *cut(QObject *parent)
609{
610 return buildAutomaticAction(parent, Cut, SLOT(cut()));
611}
612
613QAction *copy(QObject *parent)
614{
615 return buildAutomaticAction(parent, Copy, SLOT(copy()));
616}
617
618QAction *paste(QObject *parent)
619{
620 return buildAutomaticAction(parent, Paste, SLOT(paste()));
621}
622
623QAction *clear(QObject *parent)
624{
625 return buildAutomaticAction(parent, Clear, SLOT(clear()));
626}
627
628QAction *selectAll(QObject *parent)
629{
630 return buildAutomaticAction(parent, SelectAll, SLOT(selectAll()));
631}
632
633KToggleAction *showMenubar(const QObject *recvr, const char *slot, QObject *parent)
634{
635 QAction *ret = KStandardAction::create(ShowMenubar, recvr, slot, parent);
636 Q_ASSERT(qobject_cast<KToggleAction *>(ret));
637 return static_cast<KToggleAction *>(ret);
638}
639
640KToggleAction *showStatusbar(const QObject *recvr, const char *slot, QObject *parent)
641{
642 QAction *ret = KStandardAction::create(ShowStatusbar, recvr, slot, parent);
643 Q_ASSERT(qobject_cast<KToggleAction *>(ret));
644 return static_cast<KToggleAction *>(ret);
645}
646
647KToggleFullScreenAction *fullScreen(const QObject *recvr, const char *slot, QWidget *window, QObject *parent)
648{
650 ret = static_cast<KToggleFullScreenAction *>(KStandardAction::create(FullScreen, recvr, slot, parent));
651 ret->setWindow(window);
652
653 return ret;
654}
655
656QAction *keyBindings(const QObject *recvr, const char *slot, QObject *parent)
657{
658 return KStandardAction::create(KeyBindings, recvr, slot, parent);
659}
660
661QAction *preferences(const QObject *recvr, const char *slot, QObject *parent)
662{
663 return KStandardAction::create(Preferences, recvr, slot, parent);
664}
665
666QAction *configureToolbars(const QObject *recvr, const char *slot, QObject *parent)
667{
668 return KStandardAction::create(ConfigureToolbars, recvr, slot, parent);
669}
670
671QAction *configureNotifications(const QObject *recvr, const char *slot, QObject *parent)
672{
673 return KStandardAction::create(ConfigureNotifications, recvr, slot, parent);
674}
675
676QAction *helpContents(const QObject *recvr, const char *slot, QObject *parent)
677{
678 return KStandardAction::create(HelpContents, recvr, slot, parent);
679}
680
681QAction *whatsThis(const QObject *recvr, const char *slot, QObject *parent)
682{
683 return KStandardAction::create(WhatsThis, recvr, slot, parent);
684}
685
686QAction *reportBug(const QObject *recvr, const char *slot, QObject *parent)
687{
688 return KStandardAction::create(ReportBug, recvr, slot, parent);
689}
690
691QAction *switchApplicationLanguage(const QObject *recvr, const char *slot, QObject *parent)
692{
693 return KStandardAction::create(SwitchApplicationLanguage, recvr, slot, parent);
694}
695
696QAction *aboutApp(const QObject *recvr, const char *slot, QObject *parent)
697{
698 return KStandardAction::create(AboutApp, recvr, slot, parent);
699}
700
701QAction *aboutKDE(const QObject *recvr, const char *slot, QObject *parent)
702{
703 return KStandardAction::create(AboutKDE, recvr, slot, parent);
704}
705
706QAction *deleteFile(const QObject *recvr, const char *slot, QObject *parent)
707{
708 return KStandardAction::create(DeleteFile, recvr, slot, parent);
709}
710
711QAction *renameFile(const QObject *recvr, const char *slot, QObject *parent)
712{
713 return KStandardAction::create(RenameFile, recvr, slot, parent);
714}
715
716QAction *moveToTrash(const QObject *recvr, const char *slot, QObject *parent)
717{
718 return KStandardAction::create(MoveToTrash, recvr, slot, parent);
719}
720
721QAction *donate(const QObject *recvr, const char *slot, QObject *parent)
722{
723 return KStandardAction::create(Donate, recvr, slot, parent);
724}
725
726KHamburgerMenu *hamburgerMenu(const QObject *recvr, const char *slot, QObject *parent)
727{
728 return static_cast<KHamburgerMenu *>(KStandardAction::create(HamburgerMenu, recvr, slot, parent));
729}
730
731}
static void addStandardActionNames(const QStringList &names)
A menu that substitutes a menu bar when necessary.
Recent files action.
void shortcutChanged(KStandardShortcut::StandardShortcut id, const QList< QKeySequence > &shortcut)
void setWindow(QWidget *window)
QString i18nc(const char *context, const char *text, const TYPE &arg...)
QString i18n(const char *text, const TYPE &arg...)
Convenience methods to access all standard KDE actions.
QAction * goTo(const QObject *recvr, const char *slot, QObject *parent)
Jump to some specific location in the document.
QAction * revert(const QObject *recvr, const char *slot, QObject *parent)
Revert the current document to the last saved version (essentially will undo all changes).
QAction * lastPage(const QObject *recvr, const char *slot, QObject *parent)
Jump to the last page.
QAction * fitToWidth(const QObject *recvr, const char *slot, QObject *parent)
Fit the document view to the width of the current window.
QAction * reportBug(const QObject *recvr, const char *slot, QObject *parent)
Open up the Report Bug dialog.
QAction * fitToHeight(const QObject *recvr, const char *slot, QObject *parent)
Fit the document view to the height of the current window.
QAction * configureNotifications(const QObject *recvr, const char *slot, QObject *parent)
Display the notifications configuration dialog.
KRecentFilesAction * openRecent(const QObject *recvr, const char *slot, QObject *parent)
Open a recently used document.
QAction * deselect(const QObject *recvr, const char *slot, QObject *parent)
Deselect any selected elements in the current document.
QAction * _k_createInternal(StandardAction id, QObject *parent)
QAction * documentForward(const QObject *recvr, const char *slot, QObject *parent)
Move forward (document style menu).
QAction * cut(const QObject *recvr, const char *slot, QObject *parent)
Cut selected area and store it in the clipboard.
QAction * aboutKDE(const QObject *recvr, const char *slot, QObject *parent)
Display the About KDE dialog.
QAction * fitToPage(const QObject *recvr, const char *slot, QObject *parent)
Fit the document view to the size of the current window.
QStringList stdNames()
Returns a list of all standard names.
QAction * redisplay(const QObject *recvr, const char *slot, QObject *parent)
Redisplay or redraw the document.
KStandardShortcut::StandardShortcut shortcutForActionId(StandardAction id)
Returns the standardshortcut associated with actionId.
QAction * create(StandardAction id, const QObject *recvr, const char *slot, QObject *parent)
Creates an action corresponding to one of the KStandardAction::StandardAction actions,...
QAction * keyBindings(const QObject *recvr, const char *slot, QObject *parent)
Display the configure keyboard shortcuts dialog.
QAction * gotoPage(const QObject *recvr, const char *slot, QObject *parent)
Go to a specific page.
QAction * spelling(const QObject *recvr, const char *slot, QObject *parent)
Pop up the spell checker.
QList< StandardAction > actionIds()
Returns a list of all actionIds.
KToggleAction * showStatusbar(const QObject *recvr, const char *slot, QObject *parent)
Show/Hide the statusbar.
QAction * documentBack(const QObject *recvr, const char *slot, QObject *parent)
Move back (document style menu).
QAction * configureToolbars(const QObject *recvr, const char *slot, QObject *parent)
Display the toolbar configuration dialog.
StandardAction
The standard menubar and toolbar actions.
@ Donate
Open donation page on kde.org.
@ DocumentForward
Move forward (document style menu).
@ Prior
Scroll up one page.
@ ShowMenubar
Show/Hide the menubar.
@ ShowToolbar
Show/Hide the toolbar.
@ AboutApp
Display the application's About box.
@ Quit
Quit the program.
@ Back
Move back (web style menu).
@ HelpContents
Display the handbook of the application.
@ ShowStatusbar
Show/Hide the statusbar.
@ Home
Go to the "Home" position or document.
@ DocumentBack
Move back (document style menu).
@ HamburgerMenu
Opens a menu that substitutes the menubar.
@ Open
Open an existing file.
@ Forward
Move forward (web style menu).
@ FullScreen
Switch to/from full screen mode.
@ FirstPage
Jump to the first page.
@ Preferences
Display the preferences/options dialog.
@ Next
Scroll down one page.
@ OpenRecent
Open a recently used document.
@ LastPage
Jump to the last page.
QAction * firstPage(const QObject *recvr, const char *slot, QObject *parent)
Jump to the first page.
QAction * printPreview(const QObject *recvr, const char *slot, QObject *parent)
Show a print preview of the current document.
QAction * mail(const QObject *recvr, const char *slot, QObject *parent)
Send the current document by mail.
QAction * helpContents(const QObject *recvr, const char *slot, QObject *parent)
Display the handbook of the application.
QAction * switchApplicationLanguage(const QObject *recvr, const char *slot, QObject *parent)
Display the Switch Application Language dialog.
KHamburgerMenu * hamburgerMenu(const QObject *recvr, const char *slot, QObject *parent)
Opens a menu that substitutes the menubar.
QAction * actualSize(const QObject *recvr, const char *slot, QObject *parent)
View the document at its actual size.
QAction * aboutApp(const QObject *recvr, const char *slot, QObject *parent)
Display the application's About box.
QAction * donate(const QObject *recvr, const char *slot, QObject *parent)
Open donation page on kde.org.
QAction * zoom(const QObject *recvr, const char *slot, QObject *parent)
Select the current zoom level.
QAction * editBookmarks(const QObject *recvr, const char *slot, QObject *parent)
Edit the application bookmarks.
StandardShortcutWatcher * shortcutWatcher()
const QList< QKeySequence > & shortcut(StandardShortcut id)
void setCheckable(bool)
bool isChecked() const const
void setIcon(const QIcon &icon)
void setMenuRole(MenuRole menuRole)
void setShortcuts(QKeySequence::StandardKey key)
void setText(const QString &text)
void setToolTip(const QString &tip)
bool isVisible() const const
void setWhatsThis(const QString &what)
Type type() const const
bool isRightToLeft()
QIcon fromTheme(const QString &name)
QWidget * menuBar() const const
void append(QList< T > &&value)
QString currencySymbol(CurrencySymbolFormat format) const const
bool isNativeMenuBar() const const
bool invokeMethod(QObject *context, Functor &&function, FunctorReturnType *ret)
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
bool inherits(const char *className) const const
void installEventFilter(QObject *filterObj)
QObject * parent() const const
T qobject_cast(QObject *object)
void setObjectName(QAnyStringView name)
bool setProperty(const char *name, QVariant &&value)
QString arg(Args &&... args) const const
bool isEmpty() const const
QString toLower() const const
QueuedConnection
QVariant fromValue(T &&value)
QLayout * layout() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:00:18 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.