* a const fix

* BIG WARNINGS TO AVOID FUTURE ERRORS

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=833500
This commit is contained in:
Aaron J. Seigo 2008-07-16 21:58:36 +00:00
parent 853b6a1f93
commit 92c7ffc9df
3 changed files with 12 additions and 2 deletions

View File

@ -1291,6 +1291,9 @@ void ContainmentPrivate::appletDestroyed(QObject* object)
// point anymore since we are in the qobject dtor. we don't actually // point anymore since we are in the qobject dtor. we don't actually
// try and do anything with it, we just need the value of the pointer // try and do anything with it, we just need the value of the pointer
// so this unsafe looking code is actually just fine. // so this unsafe looking code is actually just fine.
//
// NOTE: DO NOT USE THE applet VARIABLE FOR ANYTHING OTHER THAN COMPARING
// THE ADDRESS! ACTUALLY USING THE OBJECT WILL RESULT IN A CRASH!!!
Applet* applet = static_cast<Plasma::Applet*>(object); Applet* applet = static_cast<Plasma::Applet*>(object);
applets.removeAll(applet); applets.removeAll(applet);
if (focusedApplet == applet) { if (focusedApplet == applet) {

View File

@ -194,7 +194,7 @@ void ToolTipManager::setWidgetToolTipContent(QGraphicsWidget *widget,const ToolT
tooltip->updateTheme(); tooltip->updateTheme();
} }
bool ToolTipManager::widgetHasToolTip(QGraphicsWidget *widget) bool ToolTipManager::widgetHasToolTip(QGraphicsWidget *widget) const
{ {
return d->tooltips.contains(widget); return d->tooltips.contains(widget);
} }
@ -214,6 +214,13 @@ void ToolTipManagerPrivate::onWidgetDestroyed(QObject *object)
return; return;
} }
// we do a static_cast here since it really isn't a QGraphicsWidget by this
// point anymore since we are in the QObject dtor. we don't actually
// try and do anything with it, we just need the value of the pointer
// so this unsafe looking code is actually just fine.
//
// NOTE: DO NOT USE THE w VARIABLE FOR ANYTHING OTHER THAN COMPARING
// THE ADDRESS! ACTUALLY USING THE OBJECT WILL RESULT IN A CRASH!!!
QGraphicsWidget *w = static_cast<QGraphicsWidget*>(object); QGraphicsWidget *w = static_cast<QGraphicsWidget*>(object);
if (currentWidget == w) { if (currentWidget == w) {

View File

@ -130,7 +130,7 @@ namespace Plasma
* @param widget the widget * @param widget the widget
* @return true if this widget has a tooltip * @return true if this widget has a tooltip
*/ */
bool widgetHasToolTip(QGraphicsWidget *widget); bool widgetHasToolTip(QGraphicsWidget *widget) const;
/** /**
* Reccomended position for a popup window like a menu or a tooltip * Reccomended position for a popup window like a menu or a tooltip