KTextEditor::MainWindow

KTextEditor::MainWindow Class Reference

#include <KTextEditor/MainWindow>

Inheritance diagram for KTextEditor::MainWindow:

Public Types

enum  ToolViewPosition { Left = 0, Right = 1, Top = 2, Bottom = 3 }
 

Signals

void pluginViewCreated (const QString &name, QObject *pluginView)
 
void pluginViewDeleted (const QString &name, QObject *pluginView)
 
void unhandledShortcutOverride (QEvent *e)
 
void viewChanged (KTextEditor::View *view)
 
void viewCreated (KTextEditor::View *view)
 

Public Member Functions

 MainWindow (QObject *parent)
 
virtual ~MainWindow ()
 
KTextEditor::ViewactivateView (KTextEditor::Document *document)
 
KTextEditor::ViewactiveView ()
 
void addWidgetToViewBar (KTextEditor::View *view, QWidget *bar)
 
bool closeSplitView (KTextEditor::View *view)
 
bool closeView (KTextEditor::View *view)
 
QWidgetcreateToolView (KTextEditor::Plugin *plugin, const QString &identifier, KTextEditor::MainWindow::ToolViewPosition pos, const QIcon &icon, const QString &text)
 
QWidgetcreateViewBar (KTextEditor::View *view)
 
void deleteViewBar (KTextEditor::View *view)
 
KXMLGUIFactoryguiFactory ()
 
bool hideToolView (QWidget *widget)
 
void hideViewBar (KTextEditor::View *view)
 
bool moveToolView (QWidget *widget, KTextEditor::MainWindow::ToolViewPosition pos)
 
KTextEditor::ViewopenUrl (const QUrl &url, const QString &encoding=QString())
 
QObjectpluginView (const QString &name)
 
bool showPluginConfigPage (KTextEditor::Plugin *plugin, int page)
 
bool showToolView (QWidget *widget)
 
void showViewBar (KTextEditor::View *view)
 
void splitView (Qt::Orientation orientation)
 
QList< KTextEditor::View * > views ()
 
bool viewsInSameSplitView (KTextEditor::View *view1, KTextEditor::View *view2)
 
QWidgetwindow ()
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
qobject_cast (QObject *object)
 
qobject_cast (const QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 

Additional Inherited Members

- Properties inherited from QObject
 objectName
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Public Attributes inherited from QObject
typedef QObjectList
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Detailed Description

This class allows the application that embeds the KTextEditor component to allow it to access parts of its main window.

For example the component can get a place to show view bar widgets (e.g. search&replace, goto line, ...). This is useful to e.g. have one place inside the window to show such stuff even if the application allows the user to have multiple split views available per window.

The application must pass a pointer to the MainWindow object to the createView method on view creation and ensure that this main window stays valid for the complete lifetime of the view.

It must not reimplement this class but construct an instance and pass a pointer to a QObject that has the required slots to receive the requests.

Definition at line 43 of file mainwindow.h.

Member Enumeration Documentation

Toolview position.

A toolview can only be at one side at a time.

Enumerator
Left 

Left side.

Right 

Right side.

Top 

Top side.

Bottom 

Bottom side.

Definition at line 210 of file mainwindow.h.

Constructor & Destructor Documentation

KTextEditor::MainWindow::MainWindow ( QObject parent)

Construct an MainWindow wrapper object.

The passed parent is both the parent of this QObject and the receiver of all interface calls via invokeMethod.

Parameters
parentobject the calls are relayed to

Definition at line 14 of file mainwindow.cpp.

KTextEditor::MainWindow::~MainWindow ( )
virtual

Virtual Destructor.

Definition at line 20 of file mainwindow.cpp.

Member Function Documentation

KTextEditor::View * KTextEditor::MainWindow::activateView ( KTextEditor::Document document)

Activate the view with the corresponding document.

If none exist for this document, create one

Parameters
documentthe document
Returns
activated view of this document, return nullptr if not possible

Definition at line 56 of file mainwindow.cpp.

KTextEditor::View * KTextEditor::MainWindow::activeView ( )

Access the active view.

Returns
active view, nullptr if not available

Definition at line 48 of file mainwindow.cpp.

void KTextEditor::MainWindow::addWidgetToViewBar ( KTextEditor::View view,
QWidget bar 
)

Add a widget to the view bar.

Parameters
viewview for which the view bar is used
barbar widget, shall have the viewBarParent() as parent widget

Definition at line 116 of file mainwindow.cpp.

bool KTextEditor::MainWindow::closeSplitView ( KTextEditor::View view)

Close the split view that contains the given view.

Parameters
viewthe view.
Returns
true if the split view was closed.

Definition at line 86 of file mainwindow.cpp.

bool KTextEditor::MainWindow::closeView ( KTextEditor::View view)

Close selected view.

Parameters
viewthe view
Returns
true if view was closed

Definition at line 72 of file mainwindow.cpp.

QWidget * KTextEditor::MainWindow::createToolView ( KTextEditor::Plugin plugin,
const QString identifier,
KTextEditor::MainWindow::ToolViewPosition  pos,
const QIcon icon,
const QString text 
)

Create a new toolview with unique identifier at side pos with icon and caption text.

Use the returned widget to embedd your widgets.

Parameters
pluginwhich owns this tool view
identifierunique identifier for this toolview
posposition for the toolview, if we are in session restore, this is only a preference
iconicon to use in the sidebar for the toolview
texttranslated text (i18n()) to use in addition to icon
Returns
created toolview on success, otherwise NULL

Definition at line 134 of file mainwindow.cpp.

QWidget * KTextEditor::MainWindow::createViewBar ( KTextEditor::View view)

Try to create a view bar for the given view.

Parameters
viewview for which we want an view bar
Returns
suitable widget that can host view bars widgets or nullptr

Definition at line 102 of file mainwindow.cpp.

void KTextEditor::MainWindow::deleteViewBar ( KTextEditor::View view)

Delete the view bar for the given view.

Parameters
viewview for which we want an view bar

Definition at line 110 of file mainwindow.cpp.

KXMLGUIFactory * KTextEditor::MainWindow::guiFactory ( )

Accessor to the XMLGUIFactory.

Returns
the mainwindow's KXMLGUIFactory, nullptr if not available

Definition at line 32 of file mainwindow.cpp.

bool KTextEditor::MainWindow::hideToolView ( QWidget widget)

Hide the toolview widget.

Parameters
widgetthe toolview to hide, where the widget was constructed by createToolView().
Returns
true on success, otherwise false

Definition at line 166 of file mainwindow.cpp.

void KTextEditor::MainWindow::hideViewBar ( KTextEditor::View view)

Hide the view bar for the given view.

Parameters
viewview for which the view bar is used

Definition at line 128 of file mainwindow.cpp.

bool KTextEditor::MainWindow::moveToolView ( QWidget widget,
KTextEditor::MainWindow::ToolViewPosition  pos 
)

Move the toolview widget to position pos.

Parameters
widgetthe toolview to move, where the widget was constructed by createToolView().
posnew position to move widget to
Returns
true on success, otherwise false

Definition at line 150 of file mainwindow.cpp.

KTextEditor::View * KTextEditor::MainWindow::openUrl ( const QUrl url,
const QString encoding = QString() 
)

Open the document url with the given encoding.

Parameters
urlthe document's url
encodingthe preferred encoding. If encoding is QString() the encoding will be guessed or the default encoding will be used.
Returns
a pointer to the created view for the new document, if a document with this url is already existing, its view will be activated, return nullptr if not possible

Definition at line 64 of file mainwindow.cpp.

QObject * KTextEditor::MainWindow::pluginView ( const QString name)

Get a plugin view for the plugin with with identifier name.

Parameters
namethe plugin's name
Returns
pointer to the plugin view if a plugin with name is loaded and has a view for this mainwindow, otherwise NULL

Definition at line 182 of file mainwindow.cpp.

void KTextEditor::MainWindow::pluginViewCreated ( const QString name,
QObject pluginView 
)
signal

This signal is emitted when the view of some Plugin is created for this main window.

Parameters
namename of plugin
pluginViewthe new plugin view
void KTextEditor::MainWindow::pluginViewDeleted ( const QString name,
QObject pluginView 
)
signal

This signal is emitted when the view of some Plugin got deleted.

Warning
Do not access the data referenced by the pointer, it is already invalid. Use the pointer only to remove mappings in hash or maps
Parameters
namename of plugin
pluginViewthe deleted plugin view
bool KTextEditor::MainWindow::showPluginConfigPage ( KTextEditor::Plugin plugin,
int  page 
)

Shows the plugin's config page.

The page specifies which config page will be shown, see KTextEditor::Plugin::configPages().

Returns
true on success, otherwise false
Since
5.63

Definition at line 174 of file mainwindow.cpp.

bool KTextEditor::MainWindow::showToolView ( QWidget widget)

Show the toolview widget.

Parameters
widgetthe toolview to show, where the widget was constructed by createToolView().
Returns
true on success, otherwise false
Todo:
add focus parameter: bool showToolView (QWidget *widget, bool giveFocus );

Definition at line 158 of file mainwindow.cpp.

void KTextEditor::MainWindow::showViewBar ( KTextEditor::View view)

Show the view bar for the given view.

Parameters
viewview for which the view bar is used

Definition at line 122 of file mainwindow.cpp.

void KTextEditor::MainWindow::splitView ( Qt::Orientation  orientation)

Split current view space according to orientation.

Parameters
orientationin which line split the view

Definition at line 80 of file mainwindow.cpp.

void KTextEditor::MainWindow::unhandledShortcutOverride ( QEvent e)
signal

This signal is emitted for every unhandled ShortcutOverride in the window.

Parameters
eresponsible event
void KTextEditor::MainWindow::viewChanged ( KTextEditor::View view)
signal

This signal is emitted whenever the active view changes.

Parameters
viewnew active view
void KTextEditor::MainWindow::viewCreated ( KTextEditor::View view)
signal

This signal is emitted whenever a new view is created.

Parameters
viewview that was created
QList< KTextEditor::View * > KTextEditor::MainWindow::views ( )

Get a list of all views for this main window.

Returns
all views, might be empty!

Definition at line 40 of file mainwindow.cpp.

bool KTextEditor::MainWindow::viewsInSameSplitView ( KTextEditor::View view1,
KTextEditor::View view2 
)
Returns
true if the given views view1 and view2 share the same split view, false otherwise.

Definition at line 94 of file mainwindow.cpp.

QWidget * KTextEditor::MainWindow::window ( )

Get the toplevel widget.

Returns
the real main window widget, nullptr if not available

Definition at line 24 of file mainwindow.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Sep 23 2020 22:58:25 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.