Plasma::Corona Class
A bookkeeping Scene for Plasma::Applets. More...
Header: | #include <Plasma/Corona> |
CMake: | find_package(Plasma REQUIRED) target_link_libraries(mytarget PRIVATE Plasma::Plasma) |
Inherits: | QObject |
Properties
- editMode : bool
- isStartupCompleted : const bool
- kPackage : const KPackage::Package
Public Functions
Corona(QObject *parent = nullptr) | |
QAction * | action(const QString &name) const |
QList<QAction *> | actions() const |
virtual QRect | availableScreenRect(int id) const |
virtual QRegion | availableScreenRegion(int id) const |
KSharedConfig::Ptr | config() const |
(since 5.45) Plasma::Containment * | containmentForScreen(int screen, const QString &activity, const QString &defaultPluginIfNonExistent, const QVariantList &defaultArgs = QVariantList()) |
QList<Plasma::Containment *> | containments() const |
(since 5.45) QList<Plasma::Containment *> | containmentsForActivity(const QString &activity) |
(since 5.45) QList<Plasma::Containment *> | containmentsForScreen(int screen) |
Plasma::Containment * | createContainment(const QString &name, const QVariantList &args = QVariantList()) |
(since 4.6) void | exportLayout(KConfigGroup &config, QList<Plasma::Containment *> containments) |
QList<Plasma::Types::Location> | freeEdges(int screen) const |
Plasma::Types::ImmutabilityType | immutability() const |
(since 4.6) QList<Plasma::Containment *> | importLayout(const KConfigGroup &config) |
(since 5.63) bool | isEditMode() const |
bool | isStartupCompleted() const |
(since 5.5) KPackage::Package | kPackage() const |
virtual int | numScreens() const |
void | removeAction(const QString &name) |
virtual int | screenForContainment(const Plasma::Containment *containment) const |
virtual QRect | screenGeometry(int id) const = 0 |
void | setAction(const QString &name, QAction *action) |
(since 5.63) void | setEditMode(bool edit) |
(since 5.5) void | setKPackage(const KPackage::Package &package) |
Public Slots
void | loadLayout(const QString &config = QString()) |
void | requestConfigSync() |
void | requireConfigSync() |
void | saveLayout(const QString &config = QString()) const |
void | setImmutability(const Plasma::Types::ImmutabilityType immutable) |
Signals
void | availableScreenRectChanged(int id) |
void | availableScreenRegionChanged(int id) |
void | configSynced() |
void | containmentAdded(Plasma::Containment *containment) |
(since 5.16) void | containmentCreated(Plasma::Containment *containment) |
(since 5.63) void | editModeChanged(bool edit) |
void | immutabilityChanged(Plasma::Types::ImmutabilityType immutability) |
void | kPackageChanged(const KPackage::Package &package) |
(since 5.40) void | screenAdded(int id) |
void | screenGeometryChanged(int id) |
void | screenOwnerChanged(int isScreen) |
(since 5.40) void | screenRemoved(int id) |
void | startupCompleted() |
Protected Functions
Plasma::Containment * | createContainmentDelayed(const QString &name, const QVariantList &args = QVariantList()) |
virtual void | loadDefaultLayout() |
Detailed Description
Property Documentation
editMode : bool
Access functions:
bool | isEditMode() const |
void | setEditMode(bool edit) |
Notifier signal:
void | editModeChanged(bool edit) |
[read-only]
isStartupCompleted : const bool
Access functions:
bool | isStartupCompleted() const |
Notifier signal:
void | startupCompleted() |
[read-only]
kPackage : const KPackage::Package
Access functions:
KPackage::Package | kPackage() const |
Notifier signal:
void | kPackageChanged(const KPackage::Package &package) |
Member Function Documentation
[explicit]
Corona::Corona(QObject *parent = nullptr)
Constructor
[invokable]
QAction *Corona::action(const QString &name) const
Returns The action with the given name, if any
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
See also setAction().
QList<QAction *> Corona::actions() const
Returns all the actions supported by the corona
[virtual]
QRect Corona::availableScreenRect(int id) const
Returns the available rect for a given screen. The difference between this and availableScreenRegion() is that this method returns only a rectangular available space (it doesn't care if your panel is not 100% width). The available rect excludes panels and similar windows. Valid screen ids are 0 to numScreens()-1. By default this method returns a rectangular region equal to screenGeometry(id); subclasses that need another behavior should override this method.
[signal]
void Corona::availableScreenRectChanged(int id)
This signal indicates that a change in available screen geometry occurred.
[virtual]
QRegion Corona::availableScreenRegion(int id) const
Returns the available region for a given screen. The available region excludes panels and similar windows. Valid screen ids are 0 to numScreens()-1. By default this method returns a rectangular region equal to screenGeometry(id); subclasses that need another behavior should override this method.
[signal]
void Corona::availableScreenRegionChanged(int id)
This signal indicates that a change in available screen geometry occurred.
KSharedConfig::Ptr Corona::config() const
Returns the config file used to store the configuration for this Corona
[signal]
void Corona::configSynced()
This signal indicates that the configuration file was flushed to disk.
[signal]
void Corona::containmentAdded(Plasma::Containment *containment)
This signal indicates a new containment has been added to the Corona: it may occur after creation or restore from config
[signal, since 5.16]
void Corona::containmentCreated(Plasma::Containment *containment)
This signal indicates a new containment has been created in the Corona. Compared to containmentAdded it can only happen after the creation of a new containment.
This function was introduced in 5.16.
See also containmentAdded.
[since 5.45]
Plasma::Containment *Corona::containmentForScreen(int screen, const QString &activity, const QString &defaultPluginIfNonExistent, const QVariantList &defaultArgs = QVariantList())
Returns the Containment for a given physical screen and desktop, creating one if none exists
screen number of the physical screen to locate
activity the activity id of the containment we want, and empty string if the activity is not important defaultPluginIfNonExistent the plugin to load by default; "null" won't create it and "default" creates the default plugin
defaultArgs optional arguments to pass in when creating a Containment if needed
This function was introduced in 5.45.
QList<Plasma::Containment *> Corona::containments() const
Returns all containments on this Corona
[since 5.45]
QList<Plasma::Containment *> Corona::containmentsForActivity(const QString &activity)
Returns all containments which match a particular activity, for any screen activity the activity id we want Returns the list of matching containments if any, empty if activity is an empty string
This function was introduced in 5.45.
[since 5.45]
QList<Plasma::Containment *> Corona::containmentsForScreen(int screen)
Returns all containments which match a particular screen, for any activity
screen the screen number we want
Returns the list of matching containments if any, empty if screen is < 0
This function was introduced in 5.45.
Plasma::Containment *Corona::createContainment(const QString &name, const QVariantList &args = QVariantList())
Adds a Containment to the Corona
name the plugin name for the containment, as given by KPluginInfo::pluginName(). If an empty string is passed in, the default containment plugin will be used (usually DesktopContainment). If the string literal "null" is passed in, then no plugin will be loaded and a simple Containment object will be created instead.
args argument list to pass to the containment
Returns a pointer to the containment on success, or 0 on failure. Failure can be caused by too restrictive of an Immutability type, as containments cannot be added when widgets are locked. If the requested containment plugin can not be located or successfully loaded, the Containment will have an invalid pluginInfo().
[protected]
Plasma::Containment *Corona::createContainmentDelayed(const QString &name, const QVariantList &args = QVariantList())
Loads a containment with delayed initialization, primarily useful for implementations of loadDefaultLayout. The caller is responsible for all initialization, saving and notification of a new containment.
name the plugin name for the containment, as given by KPluginInfo::pluginName(). If an empty string is passed in, the default containment plugin will be used (usually DesktopContainment). If the string literal "null" is passed in, then no plugin will be loaded and a simple Containment object will be created instead.
args argument list to pass to the containment
Returns a pointer to the containment on success, or 0 on failure. Failure can be caused by the Immutability type being too restrictive, as containments can't be added when widgets are locked, or if the requested containment plugin can not be located or successfully loaded.
See also createContainment.
[signal, since 5.63]
void Corona::editModeChanged(bool edit)
emitted when the editMode state changes
Note: Notifier signal for property editMode.
This function was introduced in 5.63.
See also isEditMode().
[since 4.6]
void Corona::exportLayout(KConfigGroup &config, QList<Plasma::Containment *> containments)
Exports a set of containments to a config file.
config the config group to save to
containments the list of containments to save
This function was introduced in 4.6.
QList<Plasma::Types::Location> Corona::freeEdges(int screen) const
This method is useful in order to retrieve the list of available screen edges for panel type containments.
screen the id of the screen to look for free edges.
Returns a list of free edges not filled with panel type containments.
Plasma::Types::ImmutabilityType Corona::immutability() const
Returns The type of immutability of this Corona
See also setImmutability().
[signal]
void Corona::immutabilityChanged(Plasma::Types::ImmutabilityType immutability)
emitted when immutability changes. this is for use by things that don't get constraints events, like plasmaapp. it's NOT for containments or applets or any of the other stuff on the scene. if your code's not in shells/ it probably shouldn't be using it.
[since 4.6]
QList<Plasma::Containment *> Corona::importLayout(const KConfigGroup &config)
Imports an applet layout from a config file. The results will be added to the current set of Containments.
config the name of the config file to load from, or the default config file if QString()
Returns the list of containments that were loaded
This function was introduced in 4.6.
[since 5.63]
bool Corona::isEditMode() const
Returns true if the corona is in edit mode
Note: Getter function for property editMode.
This function was introduced in 5.63.
bool Corona::isStartupCompleted() const
Returns true when the startup is over, and all the ui graphics has been instantiated
Note: Getter function for property isStartupCompleted.
[since 5.5]
KPackage::Package Corona::kPackage() const
Accessor for the associated Package object if any. A Corona package defines how Containments are laid out in a View, ToolBoxes, default layout, error messages and in general all the furniture specific of a particular device form factor.
Returns the package object, or an invalid one if none
Note: Getter function for property kPackage.
This function was introduced in 5.5.
See also setKPackage().
[signal]
void Corona::kPackageChanged(const KPackage::Package &package)
Emitted when the package for this corona has been changed. Shells must support changing the shell package on the fly (for instance due to device form factor changing)
package the new package that defines the Corona furniture and behavior
Note: Notifier signal for property kPackage.
[virtual protected]
void Corona::loadDefaultLayout()
Loads the default (system wide) layout for this user
[slot]
void Corona::loadLayout(const QString &config = QString())
Load applet layout from a config file. The results will be added to the current set of Containments.
config the name of the config file to load from, or the default config file if QString()
[virtual]
int Corona::numScreens() const
Returns the number of screens available to plasma. Subclasses should override this method as the default implementation returns a meaningless value.
void Corona::removeAction(const QString &name)
Remove the action with the given name, if exists
[slot]
void Corona::requestConfigSync()
Schedules a flush-to-disk synchronization of the configuration state at the next convenient moment.
[slot]
void Corona::requireConfigSync()
Schedules a time sensitive flush-to-disk synchronization of the configuration state. Since this method does not provide any sort of event compression, it should only be used when an *immediate* disk sync is *absolutely* required. Otherwise, use requestConfigSync() which does do event compression.
[slot]
void Corona::saveLayout(const QString &config = QString()) const
Save applets layout to file
config the file to save to, or the default config file if QString()
[signal, since 5.40]
void Corona::screenAdded(int id)
This signal indicates a new screen with the specified id was added.
This function was introduced in 5.40.
[virtual]
int Corona::screenForContainment(const Plasma::Containment *containment) const
Returns the id of the screen which is showing containment -1 is returned if the containment is not associated with a screen.
[pure virtual]
QRect Corona::screenGeometry(int id) const
Returns the geometry of a given screen. Valid screen ids are 0 to numScreen()-1, or -1 for the full desktop geometry. Subclasses should override this method as the default implementation returns a meaningless value.
[signal]
void Corona::screenGeometryChanged(int id)
This signal indicates that a change in geometry for the screen occurred.
[signal]
void Corona::screenOwnerChanged(int isScreen)
This signal indicates that a containment has been newly associated (or dissociated) with a physical screen.
isScreen the screen it is now associated with
[signal, since 5.40]
void Corona::screenRemoved(int id)
This signal indicates the screen with the specified id was removed.
This function was introduced in 5.40.
void Corona::setAction(const QString &name, QAction *action)
Defines a new action with the given name in the internal collection
See also action().
[since 5.63]
void Corona::setEditMode(bool edit)
Set the Corona globally into "edit mode" Only when the corona is of mutable type can be set of edit mode. This indicates the UI to make easy for the user to manipulate applets.
edit
Note: Setter function for property editMode.
This function was introduced in 5.63.
See also isEditMode().
[slot]
void Corona::setImmutability(const Plasma::Types::ImmutabilityType immutable)
Sets the immutability type for this Corona (not immutable, user immutable or system immutable)
immutable the new immutability type of this applet
See also immutability().
[since 5.5]
void Corona::setKPackage(const KPackage::Package &package)
Setting the package for the corona
This function was introduced in 5.5.
See also kPackage().
[signal]
void Corona::startupCompleted()
Emitted when the startup phase has been completed
Note: Notifier signal for property isStartupCompleted.