KDDockWidgets API Documentation 2.0
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
KDDockWidgets::QtCommon::Platform_qt Class Referenceabstract

Baseclass platform for Qt based platform Useful since QtWidgets and QtQuick share some similarities. More...

#include <Platform.h>

Inheritance diagram for KDDockWidgets::QtCommon::Platform_qt:
Inheritance graph
[legend]
Collaboration diagram for KDDockWidgets::QtCommon::Platform_qt:
Collaboration graph
[legend]

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::ViewfocusedView () 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::ViewqobjectAsView (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 screenNumberForWindow (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 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 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 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 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_qtinstance ()
 
- Static Public Member Functions inherited from KDDockWidgets::Core::Platform
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.
 

Protected Member Functions

int screenNumberForQWindow (QWindow *) const
 
- Protected Member Functions inherited from KDDockWidgets::Core::Platform
 Platform ()
 
 Platform (const Platform &)=delete
 
Platformoperator= (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
 

Detailed Description

Baseclass platform for Qt based platform Useful since QtWidgets and QtQuick share some similarities.

Definition at line 32 of file qtcommon/Platform.h.

Constructor & Destructor Documentation

◆ Platform_qt()

Platform_qt::Platform_qt ( )

Definition at line 175 of file qtcommon/Platform.cpp.

◆ ~Platform_qt()

Platform_qt::~Platform_qt ( )
override

Definition at line 196 of file qtcommon/Platform.cpp.

Member Function Documentation

◆ applicationName()

QString Platform_qt::applicationName ( ) const
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 252 of file qtcommon/Platform.cpp.

◆ cursorPos()

QPoint Platform_qt::cursorPos ( ) const
overridevirtual

Returns the mouse cursor position in screen coordinates.

Implements KDDockWidgets::Core::Platform.

Definition at line 271 of file qtcommon/Platform.cpp.

References QCursor::pos().

◆ displayType()

Core::Platform::DisplayType Platform_qt::displayType ( ) const
overridevirtual

◆ focusedView()

std::shared_ptr< View > Platform_qt::focusedView ( ) const
overridevirtual

Returns the focused view, if any.

Implements KDDockWidgets::Core::Platform.

Definition at line 201 of file qtcommon/Platform.cpp.

References qobjectAsView().

◆ instance()

Platform_qt * Platform_qt::instance ( )
static

Definition at line 307 of file qtcommon/Platform.cpp.

References KDDockWidgets::Core::Platform::instance().

◆ isLeftMouseButtonPressed()

bool Platform_qt::isLeftMouseButtonPressed ( ) const
overridevirtual

Returns whether the left mouse button is pressed.

Implements KDDockWidgets::Core::Platform.

Definition at line 301 of file qtcommon/Platform.cpp.

References Qt::LeftButton.

◆ isProcessingAppQuitEvent()

bool Platform_qt::isProcessingAppQuitEvent ( ) const
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 247 of file qtcommon/Platform.cpp.

◆ primaryScreen()

Screen::Ptr Platform_qt::primaryScreen ( ) const
overridevirtual

Implements KDDockWidgets::Core::Platform.

Definition at line 323 of file qtcommon/Platform.cpp.

◆ qobjectAsView()

virtual std::shared_ptr< Core::View > KDDockWidgets::QtCommon::Platform_qt::qobjectAsView ( QObject ) const
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().

◆ qobjectAsWindow()

std::shared_ptr< Core::Window > Platform_qt::qobjectAsWindow ( QObject obj) const

Definition at line 218 of file qtcommon/Platform.cpp.

References windowFromQWindow().

◆ readFile()

QByteArray Platform_qt::readFile ( const QString fileName,
bool &  ok 
) const
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 333 of file qtcommon/Platform.cpp.

References QIODevice::errorString(), QFile::open(), QIODevice::readAll(), and QIODevice::ReadOnly.

◆ restoreMouseCursor()

void Platform_qt::restoreMouseCursor ( )
overridevirtual

Undoes the call to setMouseCursor()

Implements KDDockWidgets::Core::Platform.

Definition at line 266 of file qtcommon/Platform.cpp.

◆ runDelayed()

void Platform_qt::runDelayed ( int  ms,
Core::DelayedCall *  c 
)
overridevirtual

runs the specified all after ms Equivalent to QTimer::singleShot in Qt

Implements KDDockWidgets::Core::Platform.

Definition at line 328 of file qtcommon/Platform.cpp.

References QTimer::singleShot.

◆ screenNumberForQWindow()

int Platform_qt::screenNumberForQWindow ( QWindow window) const
protected

◆ screenNumberForWindow()

int Platform_qt::screenNumberForWindow ( std::shared_ptr< Core::Window >  window) const
overridevirtual

Implements KDDockWidgets::Core::Platform.

Definition at line 225 of file qtcommon/Platform.cpp.

References screenNumberForQWindow().

◆ screens()

Screen::List Platform_qt::screens ( ) const
overridevirtual

Returns all available screens.

Implements KDDockWidgets::Core::Platform.

Definition at line 312 of file qtcommon/Platform.cpp.

References screens().

Referenced by screens().

◆ sendEvent()

void Platform_qt::sendEvent ( Core::View view,
QEvent ev 
) const
override

◆ setCursorPos()

void Platform_qt::setCursorPos ( QPoint  pos)
override

Definition at line 276 of file qtcommon/Platform.cpp.

References QCursor::setPos().

◆ setMouseCursor()

void Platform_qt::setMouseCursor ( Qt::CursorShape  ,
bool  discardLast = false 
)
overridevirtual

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()

Implements KDDockWidgets::Core::Platform.

Definition at line 257 of file qtcommon/Platform.cpp.

◆ supportsAeroSnap()

bool Platform_qt::supportsAeroSnap ( ) const
overridevirtual

Only supported on Qt, for windows.

Reimplemented from KDDockWidgets::Core::Platform.

Definition at line 345 of file qtcommon/Platform.cpp.

References QOperatingSystemVersion::current(), and QOperatingSystemVersion::majorVersion().

◆ windowFromQWindow()

virtual std::shared_ptr< Core::Window > KDDockWidgets::QtCommon::Platform_qt::windowFromQWindow ( QWindow ) const
pure virtual

◆ windows()

Core::Window::List Platform_qt::windows ( ) const
overridevirtual

Returns all windows.

Implements KDDockWidgets::Core::Platform.

Definition at line 206 of file qtcommon/Platform.cpp.

References windowFromQWindow(), and windows().

Referenced by KDDockWidgets::QtQuick::Platform::ungrabMouse(), and windows().


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