KDDockWidgets API Documentation 2.0
|
Baseclass platform for Qt based platform Useful since QtWidgets and QtQuick share some similarities. More...
#include <Platform.h>
Public Member Functions | |
Platform_qt () | |
~Platform_qt () override | |
QString | applicationName () const override |
Returns the application name This name will be used as title of floating dock widgets which contain more than 1 group. | |
QPoint | cursorPos () const override |
Returns the mouse cursor position in screen coordinates. | |
DisplayType | displayType () const override |
Returns the type of graphics stack being used. | |
std::shared_ptr< Core::View > | focusedView () const override |
Returns the focused view, if any. | |
bool | isLeftMouseButtonPressed () const override |
Returns whether the left mouse button is pressed. | |
bool | isProcessingAppQuitEvent () const override |
Returns whether we're processing a Event::Quit. | |
std::shared_ptr< Core::Screen > | primaryScreen () const override |
virtual std::shared_ptr< Core::View > | qobjectAsView (QObject *) const =0 |
Returns the specified QObject casted to View Nullptr if it's not a view. | |
std::shared_ptr< Core::Window > | qobjectAsWindow (QObject *) const |
QByteArray | readFile (const QString &fileName, bool &ok) const override |
void | restoreMouseCursor () override |
Undoes the call to setMouseCursor() | |
void | runDelayed (int ms, Core::DelayedCall *) override |
int | screenNumberFor (std::shared_ptr< Core::Window >) const override |
QVector< std::shared_ptr< Core::Screen > > | screens () const override |
Returns all available screens. | |
void | sendEvent (Core::View *, QEvent *) const override |
void | setCursorPos (QPoint) override |
void | setMouseCursor (Qt::CursorShape, bool discardLast=false) override |
Sets the mouse cursor to the specified shape, this has an application-wide effect Call restoreMouseCursor() to set the previous cursor shape. | |
bool | supportsAeroSnap () const override |
Only supported on Qt, for windows. | |
virtual std::shared_ptr< Core::Window > | windowFromQWindow (QWindow *) const =0 |
QVector< std::shared_ptr< Core::Window > > | windows () const override |
Returns all windows. | |
Public Member Functions inherited from KDDockWidgets::Core::Platform | |
virtual | ~Platform () |
virtual ViewFactory * | createDefaultViewFactory ()=0 |
Creates and returns the default ViewFactory. | |
virtual View * | createView (Controller *, View *parent=nullptr) const =0 |
Create an empty view For Qt this would just returns a empty QWidget or QQuickItem other frontends can return something as basic. | |
virtual void | dumpManagedBacktrace () |
For non-C++, managed languages (having a VM) prints a non-native back-trace For example, the flutter frontend implements this to get a dart backtrace Used for debugging only. Can be called by gdb. | |
virtual bool | hasActivePopup () const |
Returns whether a popup is open Usually not needed to override. Investigate further in case side bars aren't auto hiding. | |
virtual bool | inDisallowedDragView (Point globalPos) const =0 |
Returns whether the specified global position is on top of a view that isn't draggable. This is needed since not the entire title bar is draggable. For example, clicking on the close button shouldn't start a drag. | |
void | installGlobalEventFilter (EventFilterInterface *) |
Installs a global event filter Events will be forwarded to the specified EventFilterInterface. | |
bool | isQt () const |
Returns whether this platform is Qt based. | |
bool | isQtQuick () const |
Returns whether this platform is QtQuick. | |
bool | isQtWidgets () const |
Returns whether this platform is QtWidgets. | |
virtual const char * | name () const =0 |
Returns the name of the platform, only "qtwidgets" and "qtquick". | |
virtual void | onFloatingWindowCreated (Core::FloatingWindow *) |
Called when a floating window is created. Overridden by flutter, so it can create a window. | |
virtual void | onFloatingWindowDestroyed (Core::FloatingWindow *) |
Called when a floating window is created. Overridden by flutter, so it can destroy the window. | |
virtual void | onMainWindowCreated (Core::MainWindow *) |
Called when a main window is created. Overridden by flutter, so it can create a window Used by tests only. In real life users will instantiate a MainWindow in dart directly. | |
virtual void | onMainWindowDestroyed (Core::MainWindow *) |
Called when a main window is created. Overridden by flutter, so it can destroy the window. | |
void | removeGlobalEventFilter (EventFilterInterface *) |
Removes a global event filter. | |
virtual int | screenNumberFor (View *) const =0 |
Returns the screen index for the specified view or window. It's up to the platform to decide how screens are ordered, kddw won't care. | |
virtual Size | screenSizeFor (View *) const =0 |
Returns the size of the screen where this view is in. | |
virtual void | sendEvent (View *, Event *) const =0 |
Sends the specified event to the specified view. | |
virtual void | setCursorPos (Point)=0 |
Sets the mouse cursor position in screen coordinates. | |
int | startDragDistance () const |
Returns how many pixels the mouse must move for a drag to start This is usually 4 by default (QApplication::startDragDistance() for QtWidgets) You can override by calling Config::setStartDragDistance(), so you don't need to create a new Platform class. | |
virtual void | ungrabMouse ()=0 |
Releases the mouse grab, if any. | |
virtual bool | usesFallbackMouseGrabber () const =0 |
Return whether we use the global event filter based mouse grabber. | |
virtual std::shared_ptr< Core::Window > | windowAt (Point globalPos) const =0 |
Returns the window at the specified global coordinates. | |
Static Public Member Functions | |
static Platform_qt * | instance () |
Static Public Member Functions inherited from KDDockWidgets::Core::Platform | |
static std::vector< KDDockWidgets::FrontendType > | frontendTypes () |
list the list of frontend types supported by this build | |
static Platform * | instance () |
Returns the platform singleton. | |
Protected Member Functions | |
int | screenNumberForQWindow (QWindow *) const |
Protected Member Functions inherited from KDDockWidgets::Core::Platform | |
Platform () | |
Platform (const Platform &)=delete | |
Platform & | operator= (const Platform &)=delete |
virtual int | startDragDistance_impl () const |
Additional Inherited Members | |
Public Types inherited from KDDockWidgets::Core::Platform | |
enum class | DisplayType { Other = 0 , X11 = 1 , Wayland = 2 , QtOffscreen = 3 , QtEGLFS = 4 , Windows = 5 } |
Enum describing the graphics stack type. More... | |
Public Attributes inherited from KDDockWidgets::Core::Platform | |
Private *const | d |
Baseclass platform for Qt based platform Useful since QtWidgets and QtQuick share some similarities.
Definition at line 32 of file qtcommon/Platform.h.
Platform_qt::Platform_qt | ( | ) |
Definition at line 173 of file qtcommon/Platform.cpp.
|
override |
Definition at line 194 of file qtcommon/Platform.cpp.
|
overridevirtual |
Returns the application name This name will be used as title of floating dock widgets which contain more than 1 group.
Implements KDDockWidgets::Core::Platform.
Definition at line 250 of file qtcommon/Platform.cpp.
|
overridevirtual |
Returns the mouse cursor position in screen coordinates.
Implements KDDockWidgets::Core::Platform.
Definition at line 269 of file qtcommon/Platform.cpp.
References QCursor::pos().
|
overridevirtual |
Returns the type of graphics stack being used.
Implements KDDockWidgets::Core::Platform.
Definition at line 279 of file qtcommon/Platform.cpp.
References KDDockWidgets::Core::Platform::Other, KDDockWidgets::Core::Platform::QtEGLFS, KDDockWidgets::Core::Platform::QtOffscreen, KDDockWidgets::Core::Platform::Wayland, and KDDockWidgets::Core::Platform::X11.
|
overridevirtual |
Returns the focused view, if any.
Implements KDDockWidgets::Core::Platform.
Definition at line 199 of file qtcommon/Platform.cpp.
References qobjectAsView().
|
static |
Definition at line 302 of file qtcommon/Platform.cpp.
References KDDockWidgets::Core::Platform::instance().
|
overridevirtual |
Returns whether the left mouse button is pressed.
Implements KDDockWidgets::Core::Platform.
Definition at line 296 of file qtcommon/Platform.cpp.
References Qt::LeftButton.
|
overridevirtual |
Returns whether we're processing a Event::Quit.
Used internally to know if we should let Qt close a NonClosable dock widget at shutdown time.
Implements KDDockWidgets::Core::Platform.
Definition at line 245 of file qtcommon/Platform.cpp.
|
overridevirtual |
Implements KDDockWidgets::Core::Platform.
Definition at line 318 of file qtcommon/Platform.cpp.
|
pure virtual |
Returns the specified QObject casted to View Nullptr if it's not a view.
Implemented in KDDockWidgets::QtQuick::Platform, and KDDockWidgets::QtWidgets::Platform.
Referenced by focusedView().
std::shared_ptr< Core::Window > Platform_qt::qobjectAsWindow | ( | QObject * | obj | ) | const |
Definition at line 216 of file qtcommon/Platform.cpp.
References windowFromQWindow().
|
overridevirtual |
Reads the specified and returns its content The default implementation uses std::ifstream while the Qt implementation uses QFile, as it needs to support QRC
Reimplemented from KDDockWidgets::Core::Platform.
Definition at line 328 of file qtcommon/Platform.cpp.
References QIODevice::errorString(), QFile::open(), QIODevice::readAll(), and QIODevice::ReadOnly.
|
overridevirtual |
Undoes the call to setMouseCursor()
Implements KDDockWidgets::Core::Platform.
Definition at line 264 of file qtcommon/Platform.cpp.
|
overridevirtual |
runs the specified all after ms Equivalent to QTimer::singleShot in Qt
Implements KDDockWidgets::Core::Platform.
Definition at line 323 of file qtcommon/Platform.cpp.
References QTimer::singleShot.
|
overridevirtual |
Implements KDDockWidgets::Core::Platform.
Definition at line 223 of file qtcommon/Platform.cpp.
References screenNumberForQWindow().
|
protected |
Definition at line 231 of file qtcommon/Platform.cpp.
References QWindow::screen().
Referenced by KDDockWidgets::QtQuick::Platform::screenNumberFor(), KDDockWidgets::QtWidgets::Platform::screenNumberFor(), and screenNumberFor().
|
overridevirtual |
Returns all available screens.
Implements KDDockWidgets::Core::Platform.
Definition at line 307 of file qtcommon/Platform.cpp.
References screens().
Referenced by screens().
|
override |
Definition at line 240 of file qtcommon/Platform.cpp.
References KDDockWidgets::QtCommon::View_qt::asQObject().
|
override |
Definition at line 274 of file qtcommon/Platform.cpp.
References QCursor::setPos().
|
overridevirtual |
Sets the mouse cursor to the specified shape, this has an application-wide effect Call restoreMouseCursor() to set the previous cursor shape.
discardLast | If true, then the previous shape is discarded instead of being saved into a stack for restoreMouseCursor() |
Implements KDDockWidgets::Core::Platform.
Definition at line 255 of file qtcommon/Platform.cpp.
|
overridevirtual |
Only supported on Qt, for windows.
Reimplemented from KDDockWidgets::Core::Platform.
Definition at line 340 of file qtcommon/Platform.cpp.
References QOperatingSystemVersion::current(), and QOperatingSystemVersion::majorVersion().
|
pure virtual |
Implemented in KDDockWidgets::QtQuick::Platform, and KDDockWidgets::QtWidgets::Platform.
Referenced by qobjectAsWindow(), and windows().
|
overridevirtual |
Returns all windows.
Implements KDDockWidgets::Core::Platform.
Definition at line 204 of file qtcommon/Platform.cpp.
References windowFromQWindow(), and windows().
Referenced by KDDockWidgets::QtQuick::Platform::ungrabMouse(), and windows().