KDDockWidgets API Documentation 2.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | List of all members
KDDockWidgets::Core::Platform Class Referenceabstract

implements functions specific to a particular platform A platform can be for example qtwidgets, qtquick, etc. More...

#include <Platform.h>

Inheritance diagram for KDDockWidgets::Core::Platform:
Inheritance graph
[legend]

Public Types

enum class  DisplayType {
  Other = 0 , X11 = 1 , Wayland = 2 , QtOffscreen = 3 ,
  QtEGLFS = 4 , Windows = 5
}
 Enum describing the graphics stack type. More...
 

Public Member Functions

virtual ~Platform ()
 
virtual QString applicationName () const =0
 Returns the application name This name will be used as title of floating dock widgets which contain more than 1 group.
 
virtual ViewFactorycreateDefaultViewFactory ()=0
 Creates and returns the default ViewFactory.
 
virtual ViewcreateView (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 Point cursorPos () const =0
 Returns the mouse cursor position in screen coordinates.
 
virtual DisplayType displayType () const =0
 Returns the type of graphics stack being used.
 
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 std::shared_ptr< ViewfocusedView () const =0
 Returns the focused view, if any.
 
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.
 
virtual bool isLeftMouseButtonPressed () const =0
 Returns whether the left mouse button is pressed.
 
virtual bool isProcessingAppQuitEvent () const =0
 Returns whether we're processing a Event::Quit.
 
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.
 
virtual std::shared_ptr< Screen > primaryScreen () const =0
 
virtual QByteArray readFile (const QString &, bool &ok) const
 
void removeGlobalEventFilter (EventFilterInterface *)
 Removes a global event filter.
 
virtual void restoreMouseCursor ()=0
 Undoes the call to setMouseCursor()
 
virtual void runDelayed (int ms, Core::DelayedCall *c)=0
 
virtual int screenNumberForView (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 int screenNumberForWindow (std::shared_ptr< Core::Window >) const =0
 
virtual Vector< std::shared_ptr< Screen > > screens () const =0
 Returns all available screens.
 
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.
 
virtual void setMouseCursor (Qt::CursorShape, bool discardLast=false)=0
 Sets the mouse cursor to the specified shape, this has an application-wide effect Call restoreMouseCursor() to set the previous cursor shape.
 
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 bool supportsAeroSnap () const
 Only supported on Qt, for windows.
 
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.
 
virtual Vector< std::shared_ptr< Core::Window > > windows () const =0
 Returns all windows.
 

Static Public Member Functions

static std::vector< KDDockWidgets::FrontendTypefrontendTypes ()
 list the list of frontend types supported by this build
 
static bool hasInstance ()
 Returns whether a Platform instance exists.
 
static Platforminstance ()
 Returns the platform singleton.
 
static bool isInitialized ()
 Returns whether the Platform was already initialized.
 

Public Attributes

Private *const d
 

Protected Member Functions

 Platform ()
 
 Platform (const Platform &)=delete
 
Platformoperator= (const Platform &)=delete
 
virtual int startDragDistance_impl () const
 

Detailed Description

implements functions specific to a particular platform A platform can be for example qtwidgets, qtquick, etc.

Definition at line 35 of file core/Platform.h.

Member Enumeration Documentation

◆ DisplayType

Enum describing the graphics stack type.

Enumerator
Other 
X11 
Wayland 
QtOffscreen 
QtEGLFS 
Windows 

Definition at line 39 of file core/Platform.h.

Constructor & Destructor Documentation

◆ ~Platform()

Platform::~Platform ( )
virtual

◆ Platform() [1/2]

Platform::Platform ( )
protected

Definition at line 53 of file core/Platform.cpp.

References instance(), s_platform, and screens().

◆ Platform() [2/2]

KDDockWidgets::Core::Platform::Platform ( const Platform )
protecteddelete

Member Function Documentation

◆ applicationName()

virtual QString KDDockWidgets::Core::Platform::applicationName ( ) const
pure virtual

◆ createDefaultViewFactory()

virtual ViewFactory * KDDockWidgets::Core::Platform::createDefaultViewFactory ( )
pure virtual

◆ createView()

virtual View * KDDockWidgets::Core::Platform::createView ( Controller ,
View parent = nullptr 
) const
pure virtual

◆ cursorPos()

virtual Point KDDockWidgets::Core::Platform::cursorPos ( ) const
pure virtual

◆ displayType()

virtual DisplayType KDDockWidgets::Core::Platform::displayType ( ) const
pure virtual

Returns the type of graphics stack being used.

Implemented in KDDockWidgets::flutter::Platform, and KDDockWidgets::QtCommon::Platform_qt.

◆ dumpManagedBacktrace()

virtual void KDDockWidgets::Core::Platform::dumpManagedBacktrace ( )
inlinevirtual

◆ focusedView()

virtual std::shared_ptr< View > KDDockWidgets::Core::Platform::focusedView ( ) const
pure virtual

Returns the focused view, if any.

Implemented in KDDockWidgets::flutter::Platform, and KDDockWidgets::QtCommon::Platform_qt.

◆ frontendTypes()

std::vector< KDDockWidgets::FrontendType > Platform::frontendTypes ( )
static

list the list of frontend types supported by this build

static

Definition at line 146 of file core/Platform.cpp.

References KDDockWidgets::Flutter, KDDockWidgets::QtQuick, and KDDockWidgets::QtWidgets.

Referenced by instance(), and main().

◆ hasActivePopup()

bool Platform::hasActivePopup ( ) const
virtual

Returns whether a popup is open Usually not needed to override. Investigate further in case side bars aren't auto hiding.

Reimplemented in KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::Platform_wrapper, KDDockWidgetsBindings_wrappersNS::KDDWBindingsFlutter::Platform_wrapper, KDDockWidgets::flutter::Platform, and KDDockWidgets::QtWidgets::Platform.

Definition at line 109 of file core/Platform.cpp.

◆ hasInstance()

bool Platform::hasInstance ( )
static

Returns whether a Platform instance exists.

Definition at line 104 of file core/Platform.cpp.

References s_platform.

◆ inDisallowedDragView()

virtual bool KDDockWidgets::Core::Platform::inDisallowedDragView ( Point  globalPos) const
pure virtual

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.

Implemented in KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::Platform_wrapper, KDDockWidgetsBindings_wrappersNS::KDDWBindingsFlutter::Platform_wrapper, and KDDockWidgets::flutter::Platform.

◆ installGlobalEventFilter()

void Platform::installGlobalEventFilter ( EventFilterInterface filter)

Installs a global event filter Events will be forwarded to the specified EventFilterInterface.

Definition at line 247 of file core/Platform.cpp.

References d.

◆ instance()

Platform * Platform::instance ( )
static

Returns the platform singleton.

Definition at line 85 of file core/Platform.cpp.

References frontendTypes(), KDDockWidgets::initFrontend(), and s_platform.

Referenced by KDDockWidgets::Core::DockWidget::DockWidget(), KDDockWidgets::Core::DropIndicatorOverlay::DropIndicatorOverlay(), KDDockWidgets::Core::FloatingWindow::FloatingWindow(), Platform(), KDDockWidgets::Config::~Config(), KDDockWidgets::DockRegistry::~DockRegistry(), KDDockWidgets::Core::Group::anyNonClosable(), KDDockWidgets::createDefaultViewFactory(), KDDockWidgets::Core::FloatingWindow::deserialize(), KDDockWidgets::Core::Controller::destroyLater(), KDDockWidgets::Core::TabBar::dragCanStart(), KDDockWidgets::Core::FloatingWindow::ensureRectIsOnScreen(), KDDockWidgets::Tests::fatalWarningsMessageHandler(), KDDockWidgets::initFrontend(), KDDockWidgets::QtCommon::Platform_qt::instance(), KDDockWidgets::QtQuick::Platform::instance(), lint(), KDDockWidgets::Core::Separator::onMouseMove(), KDDockWidgets::Core::Separator::onMousePress(), KDDockWidgets::LayoutSaver::openedDockWidgetsInLayout(), KDDockWidgets::plat(), KDDockWidgets::DockRegistry::registerFloatingWindow(), KDDockWidgets::DockRegistry::registerMainWindow(), KDDockWidgets::LayoutSaver::restoreFromFile(), KDDockWidgets::Core::FloatingWindow::serialize(), KDDockWidgets::LayoutSaver::sideBarDockWidgetsInLayout(), KDDockWidgets::Core::DockWidget::startDragging(), KDDockWidgets::Core::DockWidget::title(), KDDockWidgets::DockRegistry::unregisterFloatingWindow(), KDDockWidgets::DockRegistry::unregisterMainWindow(), and KDDockWidgets::Core::FloatingWindow::updateTitleAndIcon().

◆ isInitialized()

bool Platform::isInitialized ( )
static

Returns whether the Platform was already initialized.

Definition at line 178 of file core/Platform.cpp.

References s_platform.

Referenced by KDDockWidgets::Config::~Config().

◆ isLeftMouseButtonPressed()

virtual bool KDDockWidgets::Core::Platform::isLeftMouseButtonPressed ( ) const
pure virtual

◆ isProcessingAppQuitEvent()

virtual bool KDDockWidgets::Core::Platform::isProcessingAppQuitEvent ( ) const
pure virtual

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.

Implemented in KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::Platform_wrapper, KDDockWidgetsBindings_wrappersNS::KDDWBindingsFlutter::Platform_wrapper, KDDockWidgets::flutter::Platform, and KDDockWidgets::QtCommon::Platform_qt.

Referenced by KDDockWidgets::Core::Group::anyNonClosable().

◆ isQt()

bool Platform::isQt ( ) const

Returns whether this platform is Qt based.

Definition at line 124 of file core/Platform.cpp.

References isQtQuick(), and isQtWidgets().

Referenced by c_KDDockWidgets__Core__Platform__isQt().

◆ isQtQuick()

bool Platform::isQtQuick ( ) const

Returns whether this platform is QtQuick.

Definition at line 119 of file core/Platform.cpp.

References name().

Referenced by c_KDDockWidgets__Core__Platform__isQtQuick(), and isQt().

◆ isQtWidgets()

bool Platform::isQtWidgets ( ) const

Returns whether this platform is QtWidgets.

Definition at line 114 of file core/Platform.cpp.

References name().

Referenced by c_KDDockWidgets__Core__Platform__isQtWidgets(), and isQt().

◆ name()

virtual const char * KDDockWidgets::Core::Platform::name ( ) const
pure virtual

◆ onFloatingWindowCreated()

void Platform::onFloatingWindowCreated ( Core::FloatingWindow )
virtual

◆ onFloatingWindowDestroyed()

void Platform::onFloatingWindowDestroyed ( Core::FloatingWindow )
virtual

◆ onMainWindowCreated()

void Platform::onMainWindowCreated ( Core::MainWindow )
virtual

◆ onMainWindowDestroyed()

void Platform::onMainWindowDestroyed ( Core::MainWindow )
virtual

◆ operator=()

Platform & KDDockWidgets::Core::Platform::operator= ( const Platform )
protecteddelete

◆ primaryScreen()

virtual std::shared_ptr< Screen > KDDockWidgets::Core::Platform::primaryScreen ( ) const
pure virtual

◆ readFile()

QByteArray Platform::readFile ( const QString fileName,
bool &  ok 
) const
virtual

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 in KDDockWidgets::QtCommon::Platform_qt.

Definition at line 275 of file core/Platform.cpp.

References QByteArray::data(), QByteArray::resize(), and QString::toStdString().

Referenced by KDDockWidgets::LayoutSaver::openedDockWidgetsInLayout(), KDDockWidgets::LayoutSaver::restoreFromFile(), and KDDockWidgets::LayoutSaver::sideBarDockWidgetsInLayout().

◆ removeGlobalEventFilter()

void Platform::removeGlobalEventFilter ( EventFilterInterface filter)

Removes a global event filter.

Definition at line 252 of file core/Platform.cpp.

References d.

Referenced by KDDockWidgets::DockRegistry::~DockRegistry().

◆ restoreMouseCursor()

virtual void KDDockWidgets::Core::Platform::restoreMouseCursor ( )
pure virtual

◆ runDelayed()

virtual void KDDockWidgets::Core::Platform::runDelayed ( int  ms,
Core::DelayedCall *  c 
)
pure virtual

◆ screenNumberForView()

virtual int KDDockWidgets::Core::Platform::screenNumberForView ( View ) const
pure virtual

◆ screenNumberForWindow()

virtual int KDDockWidgets::Core::Platform::screenNumberForWindow ( std::shared_ptr< Core::Window >  ) const
pure virtual

◆ screens()

virtual Vector< std::shared_ptr< Screen > > KDDockWidgets::Core::Platform::screens ( ) const
pure virtual

◆ screenSizeFor()

virtual Size KDDockWidgets::Core::Platform::screenSizeFor ( View ) const
pure virtual

◆ sendEvent()

virtual void KDDockWidgets::Core::Platform::sendEvent ( View ,
Event *   
) const
pure virtual

◆ setCursorPos()

virtual void KDDockWidgets::Core::Platform::setCursorPos ( Point  )
pure virtual

◆ setMouseCursor()

virtual void KDDockWidgets::Core::Platform::setMouseCursor ( Qt::CursorShape  ,
bool  discardLast = false 
)
pure virtual

Sets the mouse cursor to the specified shape, this has an application-wide effect Call restoreMouseCursor() to set the previous cursor shape.

Parameters
discardLastIf true, then the previous shape is discarded instead of being saved into a stack for restoreMouseCursor()

Implemented in KDDockWidgetsBindings_wrappersNS::KDDWBindingsCore::Platform_wrapper, KDDockWidgetsBindings_wrappersNS::KDDWBindingsFlutter::Platform_wrapper, KDDockWidgets::flutter::Platform, and KDDockWidgets::QtCommon::Platform_qt.

◆ startDragDistance()

int Platform::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.

Definition at line 130 of file core/Platform.cpp.

References KDDockWidgets::Config::self(), KDDockWidgets::Config::startDragDistance(), and startDragDistance_impl().

Referenced by c_KDDockWidgets__Core__Platform__startDragDistance(), and KDDockWidgets::Core::TabBar::dragCanStart().

◆ startDragDistance_impl()

int Platform::startDragDistance_impl ( ) const
protectedvirtual

◆ supportsAeroSnap()

bool Platform::supportsAeroSnap ( ) const
virtual

◆ ungrabMouse()

virtual void KDDockWidgets::Core::Platform::ungrabMouse ( )
pure virtual

◆ usesFallbackMouseGrabber()

virtual bool KDDockWidgets::Core::Platform::usesFallbackMouseGrabber ( ) const
pure virtual

◆ windowAt()

virtual std::shared_ptr< Core::Window > KDDockWidgets::Core::Platform::windowAt ( Point  globalPos) const
pure virtual

Returns the window at the specified global coordinates.

Implemented in KDDockWidgets::flutter::Platform.

◆ windows()

virtual Vector< std::shared_ptr< Core::Window > > KDDockWidgets::Core::Platform::windows ( ) const
pure virtual

Member Data Documentation

◆ d

Private* const KDDockWidgets::Core::Platform::d

The documentation for this class was generated from the following files:

© Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
KDDockWidgets
Advanced Dock Widget Framework for Qt
https://www.kdab.com/development-resources/qt-tools/kddockwidgets/
Generated by doxygen 1.9.8