From 90aaa298cc69522e88e1f81ade7d5259131b1544 Mon Sep 17 00:00:00 2001 From: zecke Date: Sun, 12 Sep 2004 20:28:36 +0000 Subject: Follow the defined Ownership and have a maybe not needed sanity check --- (limited to 'examples/todayplugin') diff --git a/examples/todayplugin/exampleplugin.cpp b/examples/todayplugin/exampleplugin.cpp index 94a5836..41bbfe2 100644 --- a/examples/todayplugin/exampleplugin.cpp +++ b/examples/todayplugin/exampleplugin.cpp @@ -6,12 +6,12 @@ */ #include "exampleplugin.h" -ExamplePlugin::ExamplePlugin() { - m_widget = 0l; +ExamplePlugin::ExamplePlugin() + : m_widget(0l) +{ } ExamplePlugin::~ExamplePlugin() { - delete (ExamplePluginWidget*)m_widget; } QString ExamplePlugin::pluginName() const { @@ -28,9 +28,7 @@ QString ExamplePlugin::pixmapNameWidget() const { } QWidget* ExamplePlugin::widget( QWidget * wid ) { - if(!m_widget) { - m_widget = new ExamplePluginWidget( wid, "Example" ); - } + m_widget = new ExamplePluginWidget( wid, "Example" ); return m_widget; } diff --git a/examples/todayplugin/exampleplugin.h b/examples/todayplugin/exampleplugin.h index 94f5b37..90d3485 100644 --- a/examples/todayplugin/exampleplugin.h +++ b/examples/todayplugin/exampleplugin.h @@ -9,9 +9,6 @@ #ifndef EXAMPLE_PLUGIN_H #define EXAMPLE_PLUGIN_H -#include -#include - #include #include @@ -34,9 +31,8 @@ public: bool excludeFromRefresh() const; void refresh(); void reinitialize(); - - private: - QGuardedPtr m_widget; +private: + ExamplePluginWidget *m_widget; }; #endif -- cgit v0.9.0.2