Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
centralwidget.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
4#ifndef CENTRALWIDGET_H
5#define CENTRALWIDGET_H
6
7#include <QtCore/QUrl>
8#include <QtCore/QHash>
9
10#include <QtWidgets/QTabBar>
11#include <QtWidgets/QWidget>
12
14
15class FindWidget;
16class HelpViewer;
17class QStackedWidget;
18class QPrinter;
19
20class TabBar : public QTabBar
21{
23 friend class CentralWidget;
24
25public:
26 ~TabBar();
27
28 int addNewTab(const QString &title);
29 void setCurrent(HelpViewer *viewer);
30 void removeTabAt(HelpViewer *viewer);
31
32public slots:
33 void titleChanged();
34
37 void addBookmark(const QString &title, const QString &url);
38
39private:
40 TabBar(QWidget *parent = nullptr);
41
42private slots:
43 void slotCurrentChanged(int index);
44 void slotTabCloseRequested(int index);
45 void slotCustomContextMenuRequested(const QPoint &pos);
46};
47
48class CentralWidget : public QWidget
49{
51 friend class OpenPagesManager;
52
53public:
54 CentralWidget(QWidget *parent = nullptr);
56
57 static CentralWidget *instance();
58
59 QUrl currentSource() const;
60 QString currentTitle() const;
61
62 bool hasSelection() const;
63 bool isForwardAvailable() const;
64 bool isBackwardAvailable() const;
65
66 HelpViewer *viewerAt(int index) const;
68 int currentIndex() const;
69
70 void connectTabBar();
71
72public slots:
73#if QT_CONFIG(clipboard)
74 void copy();
75#endif
76 void home();
77
78 void zoomIn();
79 void zoomOut();
80 void resetZoom();
81
82 void forward();
83 void nextPage();
84
85 void backward();
86 void previousPage();
87
88 void print();
89 void pageSetup();
90 void printPreview();
91
92 void setSource(const QUrl &url);
93 void setSourceFromSearch(const QUrl &url);
94
95 void findNext();
96 void findPrevious();
97 void find(const QString &text, bool forward, bool incremental);
98
99 void activateTab();
100 void showTextSearch();
101 void updateBrowserFont();
102 void updateUserInterface();
103
104signals:
106#if QT_CONFIG(clipboard)
107 void copyAvailable(bool yes);
108#endif
109 void sourceChanged(const QUrl &url);
110 void highlighted(const QUrl &link);
111 void forwardAvailable(bool available);
112 void backwardAvailable(bool available);
113 void addBookmark(const QString &title, const QString &url);
114
115protected:
116 void keyPressEvent(QKeyEvent *) override;
117 void focusInEvent(QFocusEvent *event) override;
118
119private slots:
121 void printPreviewToPrinter(QPrinter *printer);
122 void handleSourceChanged(const QUrl &url);
123 void slotHighlighted(const QUrl& link);
124
125private:
126 void initPrinter();
127 void connectSignals(HelpViewer *page);
128 bool eventFilter(QObject *object, QEvent *e) override;
129
130 void removePage(int index);
131 void setCurrentPage(HelpViewer *page);
132 void addPage(HelpViewer *page, bool fromSearch = false);
133
134private:
135#ifndef QT_NO_PRINTER
136 QPrinter *m_printer;
137#endif
138 FindWidget *m_findWidget;
139 QStackedWidget *m_stackedWidget;
140 TabBar *m_tabBar;
141 QHash<QUrl, QUrl> m_resolvedLinks;
142};
143
144QT_END_NAMESPACE
145
146#endif // CENTRALWIDGET_H
QString documentTitle() const
void setText(const QString &text, const QByteArray &resources)
void setPixmap(const QPixmap &pixmap)
QSize minimumSizeHint() const override
QVariant loadResource(int type, const QUrl &name) override
This function is called when the document is loaded and for each image in the document.
void doSetSource(const QUrl &name, QTextDocument::ResourceType type) override
Attempts to load the document at the given url with the specified type.
void setText(const QString &text, const QByteArray &resources)
void subclassKeyPressEvent(QKeyEvent *event)
void focusInEvent(QFocusEvent *event) override
This event handler can be reimplemented in a subclass to receive keyboard focus events (focus receive...
void setBookmarksToolbar(QToolBar *toolBar)
void setSource(const QUrl &url)
void setSourceInNewTab(const QUrl &url)
QWidget * bookmarkDockWidget() const
~BookmarkManager() override
static void destroy()
bool eventFilter(QObject *object, QEvent *event) override
Filters events if this object has been installed as an event filter for the watched object.
void sourceChanged(const QUrl &url)
QString currentTitle() const
void backwardAvailable(bool available)
bool isBackwardAvailable() const
HelpViewer * viewerAt(int index) const
int currentIndex() const
static CentralWidget * instance()
void forwardAvailable(bool available)
bool hasSelection() const
CentralWidget(QWidget *parent=nullptr)
void keyPressEvent(QKeyEvent *) override
This event handler, for event event, can be reimplemented in a subclass to receive key press events f...
void setSourceFromSearch(const QUrl &url)
bool eventFilter(QObject *object, QEvent *e) override
Filters events if this object has been installed as an event filter for the watched object.
QUrl currentSource() const
void highlighted(const QUrl &link)
void setSource(const QUrl &url)
HelpViewer * currentHelpViewer() const
void focusInEvent(QFocusEvent *event) override
This event handler can be reimplemented in a subclass to receive keyboard focus events (focus receive...
void updateUserInterface()
~CentralWidget() override
bool isForwardAvailable() const
ShowState index() const
ShowState contents() const
ShowState bookmarks() const
bool enableRemoteControl() const
bool collectionFileGiven() const
ShowState search() const
void escapePressed()
void expandToDepth(int depth)
QAction * findAction() const
QAction * zoomInAction() const
QAction * nextAction() const
QAction * homeAction() const
QAction * backAction() const
QAction * printAction() const
QAction * zoomOutAction() const
QHelpFilterEngine * filterEngine() const
QHelpSearchEngine * searchEngine() const
static HelpEngineWrapper & instance()
bool addressBarEnabled() const
bool addressBarVisible() const
void setUseBrowserFont(bool useBrowserFont)
QHelpIndexModel * indexModel() const
bool filterFunctionalityEnabled() const
bool filterToolbarVisible() const
void setUseAppFont(bool useAppFont)
QHelpContentModel * contentModel() const
void escapePressed()
void closeEvent(QCloseEvent *event) override
[21]
void setIndexString(const QString &str)
~MainWindow() override
void syncContents()
void setBookmarksVisible(bool visible)
static void activateCurrentBrowser()
void activateCurrentCentralWidgetTab()
void expandTOC(int depth)
void setIndexVisible(bool visible)
void setSearchVisible(bool visible)
void currentFilterChanged(const QString &filter)
bool usesDefaultCollection() const
QAbstractItemView * openPagesWidget() const
HelpViewer * createNewPageFromSearch(const QUrl &url)
void pageAdded(int index)
HelpViewer * createBlankPage()
static OpenPagesManager * instance()
void updateApplicationFont()
void updateUserInterface()
void docsInstalled(bool newDocsInstalled)
void setCurrent(HelpViewer *viewer)
void removeTabAt(HelpViewer *viewer)
QUrl link() const
Combined button and popup list for selecting options.
static const char * docs[]
static QStringList newQtDocumentation()
@ warnAboutMissingModules
#define TRACE_OBJ
Definition tracer.h:34