From 97869ca7c7c2918d521fee06d8d2d7f8c370e942 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Wed, 17 Dec 2008 00:51:30 +0000 Subject: [PATCH] z value related cleanups, including one fixme svn path=/trunk/KDE/kdelibs/; revision=897861 --- applet.cpp | 12 +++++++++--- private/applethandle.cpp | 2 +- private/desktoptoolbox.cpp | 1 + private/toolbox.cpp | 2 +- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/applet.cpp b/applet.cpp index 8cce82a62..4ee55532d 100644 --- a/applet.cpp +++ b/applet.cpp @@ -459,8 +459,8 @@ void AppletPrivate::createMessageOverlay() zValue = child->zValue() + 1; } } - messageOverlay->setZValue(zValue); + messageOverlay->setZValue(zValue); } void AppletPrivate::destroyMessageOverlay() @@ -815,8 +815,14 @@ void Applet::setConfigurationRequired(bool needsConfig, const QString &reason) configWidget->setDrawBackground(true); connect(configWidget, SIGNAL(clicked()), this, SLOT(showConfigurationInterface())); configLayout->addItem(configWidget, row, 1); - //FIXME: this thing seems necessary for some applets, others not - configWidget->setZValue(999); + // raise the overlay above all the other children! + int zValue = 100; + foreach (QGraphicsItem *child, QGraphicsItem::children()) { + if (child->zValue() > zValue) { + zValue = child->zValue() + 1; + } + } + configWidget->setZValue(zValue); } else { PushButton *configWidget = new PushButton(d->messageOverlay); configWidget->setText(i18n("Configure...")); diff --git a/private/applethandle.cpp b/private/applethandle.cpp index 7975169c6..511614fde 100644 --- a/private/applethandle.cpp +++ b/private/applethandle.cpp @@ -125,7 +125,7 @@ AppletHandle::AppletHandle(Containment *parent, Applet *applet, const QPointF &h //so we want a high zValue. //FIXME: apparently this doesn't work: sometimes an applet still get's drawn behind //the containment it's being dragged to, sometimes it doesn't. - m_zValue = m_applet->zValue()-1; + m_zValue = m_applet->zValue() - 1; m_applet->raise(); m_applet->installSceneEventFilter(this); setZValue(m_applet->zValue()); diff --git a/private/desktoptoolbox.cpp b/private/desktoptoolbox.cpp index 17936f7b3..c8e391b01 100644 --- a/private/desktoptoolbox.cpp +++ b/private/desktoptoolbox.cpp @@ -456,6 +456,7 @@ void DesktopToolBox::showToolBox() if (!d->toolBacker) { d->toolBacker = new EmptyGraphicsItem(this); + d->toolBacker->setZValue(zValue() + 1); } d->toolBacker->setIsToolbar(isToolbar()); diff --git a/private/toolbox.cpp b/private/toolbox.cpp index 1a99d0e33..50c7e8c13 100644 --- a/private/toolbox.cpp +++ b/private/toolbox.cpp @@ -120,7 +120,7 @@ void ToolBox::addTool(QAction *action) tool->hide(); const int height = static_cast(tool->boundingRect().height()); tool->setPos(toolPosition(height)); - tool->setZValue(zValue() + 1); + tool->setZValue(zValue() + 10); tool->setToolTip(action->text()); //make enabled/disabled tools appear/disappear instantly