From b5eacc597dd115b416bc3c3088f3ab864a3795e5 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Fri, 16 Nov 2012 16:03:30 +0100 Subject: [PATCH] dialogshadows belongs to tooltipmanager tooltips are created/destroyed too often, this saves same deletions and recreations --- private/tooltip.cpp | 4 ---- tooltipmanager.cpp | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/private/tooltip.cpp b/private/tooltip.cpp index e1068eed9..299fcc1da 100644 --- a/private/tooltip.cpp +++ b/private/tooltip.cpp @@ -20,7 +20,6 @@ #include "tooltip_p.h" #include "windowpreview_p.h" -#include "dialogshadows_p.h" #include #include @@ -197,9 +196,6 @@ ToolTip::ToolTip(QWidget *parent) mainLayout->addLayout(iconTextHBoxLayout); setLayout(mainLayout); - DialogShadows *shadow = new DialogShadows(this); - shadow->setImagePath("widgets/tooltip"); - shadow->addWindow(this); } ToolTip::~ToolTip() diff --git a/tooltipmanager.cpp b/tooltipmanager.cpp index e07ba9fa6..6e5d4a187 100644 --- a/tooltipmanager.cpp +++ b/tooltipmanager.cpp @@ -48,6 +48,7 @@ #include "plasma/theme.h" #include "plasma/view.h" #include "plasma/private/tooltip_p.h" +#include "plasma/private/dialogshadows_p.h" namespace Plasma { @@ -57,6 +58,7 @@ class ToolTipManagerPrivate public : ToolTipManagerPrivate(ToolTipManager *manager) : q(manager), + shadow(new DialogShadows(q, "widgets/tooltip")), currentWidget(0), showTimer(new QTimer(manager)), hideTimer(new QTimer(manager)), @@ -90,6 +92,7 @@ public : void hideTipWidget(); ToolTipManager *q; + DialogShadows *shadow; QGraphicsWidget *currentWidget; QTimer *showTimer; QTimer *hideTimer; @@ -298,6 +301,8 @@ void ToolTipManagerPrivate::createTipWidget() } tipWidget = new ToolTip(0); + shadow->addWindow(tipWidget); + QObject::connect(tipWidget, SIGNAL(activateWindowByWId(WId,Qt::MouseButtons,Qt::KeyboardModifiers,QPoint)), q, SIGNAL(windowPreviewActivated(WId,Qt::MouseButtons,Qt::KeyboardModifiers,QPoint))); QObject::connect(tipWidget, SIGNAL(linkActivated(QString,Qt::MouseButtons,Qt::KeyboardModifiers,QPoint)),