Libplasma
dialog.cpp
95 * Gets the maximum and minimum size hints for the window based on the contents. it doesn't actually resize anything
159 static bool check = QGuiApplication::platformName() == QLatin1String("wayland-org.kde.kwin.qpa");
206 if (!q->flags().testFlag(Qt::ToolTip) && location != Plasma::Types::Floating && floating == 0) {
304 // to set its position again as there won't be any move event to sync QWindow::position and shellsurface::position
311 if (!q->flags().testFlag(Qt::ToolTip) && type != Dialog::Notification && type != Dialog::CriticalNotification) {
357 int minimumWidth = mainItemLayout->property("minimumWidth").toInt() + dialogBackground->leftMargin() + dialogBackground->rightMargin();
382 int minimumHeight = mainItemLayout->property("minimumHeight").toInt() + dialogBackground->topMargin() + dialogBackground->bottomMargin();
403 int maximumWidth = mainItemLayout->property("maximumWidth").toInt() + dialogBackground->leftMargin() + dialogBackground->rightMargin();
424 int maximumHeight = mainItemLayout->property("maximumHeight").toInt() + dialogBackground->topMargin() + dialogBackground->bottomMargin();
553 // it's important here that we're using re->size() as size, we don't want to do recursive resizeEvents
561 mainItem->setSize(QSizeF(q->width() - dialogBackground->leftMargin() - dialogBackground->rightMargin(),
567 // Only reposition after successful setup; otherwise repositionIfOffScreen will override the default position set by kwin under wayland
572 // setting the minimum or maximum size will resize the window instantly and min <= max is enforced
573 // so we have to set maximum first in that case, but also care about the new maximum being smaller
624 + QSize(dialogBackground->leftMargin() + dialogBackground->rightMargin(), dialogBackground->topMargin() + dialogBackground->bottomMargin());
640 + QSize(dialogBackground->leftMargin() + dialogBackground->rightMargin(), dialogBackground->topMargin() + dialogBackground->bottomMargin());
645 s = QSize(qBound(min.width(), s.width(), max.width()), qBound(min.height(), s.height(), max.height()));
676 if (!q->isVisible() || q->flags().testFlag(Qt::ToolTip) || location == Plasma::Types::Floating || floating > 0) {
685 mainItem->setSize(QSize(q->width() - dialogBackground->leftMargin() - dialogBackground->rightMargin(),
696 return QRectF(mainItem->mapToScene(QPoint(0, 0)), QSizeF(mainItem->width(), mainItem->height())).contains(point);
705 QRectF itemRect(mainItem->mapToScene(QPoint(0, 0)), QSizeF(mainItem->width(), mainItem->height()));
707 return QPointF(qBound(itemRect.left(), point.x(), itemRect.right()), qBound(itemRect.top(), point.y(), itemRect.bottom()));
743 // QXcbWindow isn't installed and thus inaccessible to us, but it does read this magic property from the window...
757 PlasmaShellWaylandIntegration::get(q)->setPanelBehavior(QtWayland::org_kde_plasma_surface::panel_behavior_windows_go_below);
759 PlasmaShellWaylandIntegration::get(q)->setPanelBehavior(QtWayland::org_kde_plasma_surface::panel_behavior_always_visible);
767 PlasmaShellWaylandIntegration::get(q)->setRole(QtWayland::org_kde_plasma_surface::role_tooltip);
770 PlasmaShellWaylandIntegration::get(q)->setRole(QtWayland::org_kde_plasma_surface::role_notification);
773 PlasmaShellWaylandIntegration::get(q)->setRole(QtWayland::org_kde_plasma_surface::role_onscreendisplay);
776 PlasmaShellWaylandIntegration::get(q)->setRole(QtWayland::org_kde_plasma_surface::role_criticalnotification);
782 PlasmaShellWaylandIntegration::get(q)->setRole(QtWayland::org_kde_plasma_surface::role_appletpopup);
815 if (type == Dialog::Dock || type == Dialog::Notification || type == Dialog::OnScreenDisplay || type == Dialog::CriticalNotification) {
822 PlasmaShellWaylandIntegration::get(q)->setTakesFocus(!q->flags().testFlag(Qt::WindowDoesNotAcceptFocus));
884 const QRectF rect(geometry.x(), geometry.y(), dialogBackground->leftMargin(), geometry.height());
891 const QRectF rect(geometry.x() + geometry.width() - dialogBackground->rightMargin(), geometry.y(), dialogBackground->rightMargin(), geometry.height());
905 const QRectF rect(geometry.x(), geometry.y() + geometry.height() - dialogBackground->bottomMargin(), geometry.width(), dialogBackground->bottomMargin());
936 // HACK: this property is invoked due to the initialization that gets done to contentItem() in the getter
987 // find for the needed property of Layout: minimum/maximum/preferred sizes and fillWidth/fillHeight
988 if (child->property("minimumWidth").isValid() && child->property("minimumHeight").isValid() && child->property("preferredWidth").isValid()
989 && child->property("preferredHeight").isValid() && child->property("maximumWidth").isValid() && child->property("maximumHeight").isValid()
1000 // If the underlying QQuickItem is sane, these properties should be updated atomically in one cycle
1001 // of the GUI thread event loop, denying the chance for the event loop to run a QQuickItem::update() call in between.
1002 // So we avoid rendering a frame in between with inconsistent geometry properties which would cause flickering issues.
1012 // if this is called in Component.onCompleted we have to wait a loop the item is added to a scene
1055 return QPoint(screen->availableGeometry().center().x() - size.width() / 2, screen->availableGeometry().y());
1057 return QPoint(screen->availableGeometry().x(), screen->availableGeometry().center().y() - size.height() / 2);
1059 return QPoint(screen->availableGeometry().right() - size.width(), screen->availableGeometry().center().y() - size.height() / 2);
1061 return QPoint(screen->availableGeometry().center().x() - size.width() / 2, screen->availableGeometry().bottom() - size.height());
1079 // if the item is in a dock or in a window that ignores WM we want to position the popups outside of the dock
1082 ((winInfo.windowType(NET::AllTypesMask) == NET::Dock) || (item->window()->flags() & Qt::X11BypassWindowManagerHint)) && item->window()->mask().isNull();
1123 if (outsideParentWindow && d->dialogBackground->enabledBorders() != KSvg::FrameSvg::AllBorders) {
1138 // If the dialog is from opening an applet in the panel and it's close enough to the center that
1139 // it would still cover the original applet in the panel if it was centered, then we manually center it.
1145 if (qAbs(dialogPos.x() + size.width() / 2 - avail.center().x()) < size.width() / 2 - parentRect.width() / 3) {
1151 if (qAbs(dialogPos.y() + size.height() / 2 - avail.center().y()) < size.height() / 2 - parentRect.height() / 3) {
1160 // For top & bottom the inner conditions are intentionally different from thouse for left & right,
1266 // it's a spontaneous event generated in qguiapplication.cpp QGuiApplicationPrivate::processWindowScreenChangedEvent
1267 // QWindowSystemInterfacePrivate::GeometryChangeEvent gce(window, QHighDpi::fromNativePixels(window->handle()->geometry(), window), QRect());
1270 // but the resize event gets delivered with 0x0 again and executed with all the bad side effects
1271 // this seems to happen for every window when there are multiple screens, so something we have probably to watch out for in the future
1284 d->mainItem->setPosition(QPointF(d->dialogBackground->leftMargin(), d->dialogBackground->topMargin()));
1286 d->mainItem->setSize(QSize(re->size().width() - d->dialogBackground->leftMargin() - d->dialogBackground->rightMargin(),
1287 re->size().height() - d->dialogBackground->topMargin() - d->dialogBackground->bottomMargin()));
1334 bool childHasFocus = focusWindow && ((focusWindow->isActive() && isAncestorOf(focusWindow)) || (focusWindow->type() & Qt::Popup) == Qt::Popup);
1336 const bool viewClicked = qobject_cast<const PlasmaQuick::SharedQmlEngine *>(focusWindow) || qobject_cast<const ConfigView *>(focusWindow);
1421 if (geometry().contains(me->globalPosition().toPoint()) && !d->mainItemContainsPosition(me->scenePosition())) {
1501 QDropEvent de2(d->positionAdjustedForMainItem(de->position()).toPoint(), de->possibleActions(), de->mimeData(), de->buttons(), de->modifiers());
Internal type used by DialogBackground in plasmaquick to load the actual background SVG.
Definition DialogBackground.qml:12
void writeEntry(const char *key, const char *value, WriteConfigFlags pFlags=Normal)
KConfig * config()
QString readEntry(const char *key, const char *aDefault=nullptr) const
bool sync() override
EnabledBorder
NET::WindowType windowType(NET::WindowTypes supported_types) const
static bool isPlatformX11()
static bool isPlatformWayland()
static void setOnAllDesktops(WId win, bool b)
static void setState(WId win, NET::States state)
bool compositingActive
static void setType(WId win, NET::WindowType windowType)
SkipTaskbar
SkipSwitcher
SkipPager
AllTypesMask
WindowType
Dock
@ NoBackground
Not drawing a background under the applet, the dialog has its own implementation.
Definition dialog.h:176
virtual QPoint popupPosition(QQuickItem *item, const QSize &size)
Definition dialog.cpp:1045
static PlasmaShellWaylandIntegration * get(QWindow *window)
Returns the relevant PlasmaWaylandShellIntegration instance for this window creating one if needed.
Definition plasmashellwaylandintegration.cpp:127
KConfigGroup config() const
Returns the KConfigGroup to access the applets configuration.
Definition applet.cpp:189
bool backgroundContrastEnabled() const
This method allows Plasma to enable and disable the background contrast effect for a given theme,...
Definition theme.cpp:284
bool blurBehindEnabled() const
This method allows Plasma to enable and disable the blurring of what is behind the background for a g...
Definition theme.cpp:329
Location
The Location enumeration describes where on screen an element, such as an Applet or its managing cont...
Definition plasma.h:81
@ Desktop
On the planar desktop layer, extending across the full screen from edge to edge.
Definition plasma.h:84
AKONADI_CALENDAR_EXPORT KCalendarCore::Event::Ptr event(const Akonadi::Item &item)
Type type(const QSqlDatabase &db)
KCRASH_EXPORT void setFlags(KCrash::CrashFlags flags)
QVariant location(const QVariant &res)
QWidget * window(QObject *job)
void slideWindow(QWindow *window, SlideFromLocation location, int offset=-1)
void enableBlurBehind(QWindow *window, bool enable=true, const QRegion ®ion=QRegion())
void enableBackgroundContrast(QWindow *window, bool enable=true, qreal contrast=1, qreal intensity=1, qreal saturation=1, const QRegion ®ion=QRegion())
The EdgeEventForwarder class This class forwards edge events to be replayed within the given margin T...
Definition action.h:20
bool sendEvent(QObject *receiver, QEvent *event)
QPoint pos()
Qt::MouseButtons buttons() const const
const QMimeData * mimeData() const const
Qt::KeyboardModifiers modifiers() const const
QPointF position() const const
Qt::DropActions possibleActions() const const
Expose
Type type() const const
QWindow * focusWindow()
platformName
QList< QScreen * > screens()
Qt::KeyboardModifiers modifiers() const const
quint64 timestamp() const const
const QPoint & pos() const const
const QObjectList & children() const const
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
bool setProperty(const char *name, QVariant &&value)
Types
void setX(int x)
void setY(int y)
int x() const const
int y() const const
QPoint toPoint() const const
qreal x() const const
qreal y() const const
virtual QRectF boundingRect() const const
QRectF mapRectToScene(const QRectF &rect) const const
QPointF mapToScene(const QPointF &point) const const
void setParentItem(QQuickItem *parent)
QQuickWindow * window() const const
contentItem
virtual bool event(QEvent *event) override
virtual void focusInEvent(QFocusEvent *ev) override
virtual void focusOutEvent(QFocusEvent *ev) override
virtual void hideEvent(QHideEvent *) override
virtual void resizeEvent(QResizeEvent *ev) override
virtual void showEvent(QShowEvent *) override
void adjust(int dx1, int dy1, int dx2, int dy2)
int bottom() const const
QPoint center() const const
int height() const const
bool isEmpty() const const
bool isNull() const const
int left() const const
void moveTopLeft(const QPoint &position)
int right() const const
void setBottom(int y)
void setLeft(int x)
void setRight(int x)
void setTop(int y)
QSize size() const const
int top() const const
QPoint topLeft() const const
int width() const const
int x() const const
int y() const const
bool contains(const QPointF &point) const const
qreal height() const const
QRect toRect() const const
qreal width() const const
bool isNull() const const
const QSize & oldSize() const const
const QSize & size() const const
availableGeometry
geometry
Qt::MouseButton button() const const
Qt::MouseButtons buttons() const const
QPointF globalPosition() const const
QPointF position() const const
QPointF scenePosition() const const
QSize expandedTo(const QSize &otherSize) const const
int height() const const
bool isEmpty() const const
int width() const const
SizeFDiagCursor
BottomEdge
transparent
WindowState
ToolTip
QTextStream & left(QTextStream &stream)
QTextStream & right(QTextStream &stream)
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
bool isNull() const const
int toInt(bool *ok) const const
QPoint angleDelta() const const
Qt::ScrollPhase phase() const const
QPoint pixelDelta() const const
Hidden
void setFlags(Qt::WindowFlags flags)
QRect geometry() const const
height
bool isActive() const const
QPoint mapToGlobal(const QPoint &pos) const const
QRegion mask() const const
void setMaximumHeight(int h)
QSize maximumSize() const const
void setMaximumWidth(int w)
void setMinimumHeight(int h)
void setMinimumWidth(int w)
virtual void moveEvent(QMoveEvent *ev)
QPoint position() const const
void raise()
void resize(const QSize &newSize)
QScreen * screen() const const
void setCursor(const QCursor &cursor)
void setGeometry(const QRect &rect)
void setMask(const QRegion ®ion)
void setMaximumSize(const QSize &size)
void setMinimumSize(const QSize &size)
void setPosition(const QPoint &pt)
virtual QSize size() const const override
void setTransientParent(QWindow *parent)
Qt::WindowType type() const const
void unsetCursor()
visibility
void visibleChanged(bool arg)
width
WId winId() const const
void windowStateChanged(Qt::WindowState windowState)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 6 2024 12:04:40 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 6 2024 12:04:40 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.