Qt 4.8
Public Functions | Properties | List of all members
QWidgetBackingStoreTracker Class Reference

Class which allows tracking of which widgets are using a given backing store. More...

#include <qwidget_p.h>

Public Functions

void create (QWidget *tlw)
 Destroy the contained QWidgetBackingStore, if not null, and clear the list of widgets using the backing store, then create a new QWidgetBackingStore, providing the QWidget. More...
 
QWidgetBackingStoredata ()
 
void destroy ()
 Destroy the contained QWidgetBackingStore, if not null, and clear the list of widgets using the backing store. More...
 
 operator bool () const
 
QWidgetBackingStoreoperator* ()
 
QWidgetBackingStoreoperator-> ()
 
 QWidgetBackingStoreTracker ()
 
void registerWidget (QWidget *w)
 Add the widget to the list of widgets currently using the backing store. More...
 
void unregisterWidget (QWidget *w)
 Remove the widget from the list of widgets currently using the backing store. More...
 
void unregisterWidgetSubtree (QWidget *w)
 Recursively remove widget and all of its descendents. More...
 
 ~QWidgetBackingStoreTracker ()
 

Properties

QWidgetBackingStorem_ptr
 
QSet< QWidget * > m_widgets
 

Detailed Description

Class which allows tracking of which widgets are using a given backing store.

Warning
This function is not part of the public interface.

QWidgetBackingStoreTracker is a thin wrapper around a QWidgetBackingStore pointer, which maintains a list of the QWidgets which are currently using the backing store. This list is modified via the registerWidget and unregisterWidget functions.

Definition at line 118 of file qwidget_p.h.

Constructors and Destructors

◆ QWidgetBackingStoreTracker()

QWidgetBackingStoreTracker::QWidgetBackingStoreTracker ( )

Definition at line 198 of file qwidget.cpp.

199  : m_ptr(0)
200 {
201 
202 }
QWidgetBackingStore * m_ptr
Definition: qwidget_p.h:156

◆ ~QWidgetBackingStoreTracker()

QWidgetBackingStoreTracker::~QWidgetBackingStoreTracker ( )

Definition at line 204 of file qwidget.cpp.

205 {
206  delete m_ptr;
207 }
QWidgetBackingStore * m_ptr
Definition: qwidget_p.h:156

Functions

◆ create()

void QWidgetBackingStoreTracker::create ( QWidget widget)

Destroy the contained QWidgetBackingStore, if not null, and clear the list of widgets using the backing store, then create a new QWidgetBackingStore, providing the QWidget.

Warning
This function is not part of the public interface.

Definition at line 218 of file qwidget.cpp.

219 {
220  destroy();
221  m_ptr = new QWidgetBackingStore(widget);
222 }
void destroy()
Destroy the contained QWidgetBackingStore, if not null, and clear the list of widgets using the backi...
Definition: qwidget.cpp:232
QWidgetBackingStore * m_ptr
Definition: qwidget_p.h:156

◆ data()

QWidgetBackingStore* QWidgetBackingStoreTracker::data ( )
inline

Definition at line 132 of file qwidget_p.h.

Referenced by QWidgetPrivate::maybeBackingStore(), QWidgetPrivate::moveRect(), and QWidgetPrivate::scrollRect().

133  {
134  return m_ptr;
135  }
QWidgetBackingStore * m_ptr
Definition: qwidget_p.h:156

◆ destroy()

void QWidgetBackingStoreTracker::destroy ( )

Destroy the contained QWidgetBackingStore, if not null, and clear the list of widgets using the backing store.

Warning
This function is not part of the public interface.

Definition at line 232 of file qwidget.cpp.

Referenced by create().

233 {
234  delete m_ptr;
235  m_ptr = 0;
236  m_widgets.clear();
237 }
void clear()
Definition: qset.h:87
QSet< QWidget * > m_widgets
Definition: qwidget_p.h:157
QWidgetBackingStore * m_ptr
Definition: qwidget_p.h:156

◆ operator bool()

QWidgetBackingStoreTracker::operator bool ( ) const
inline

Definition at line 147 of file qwidget_p.h.

148  {
149  return (0 != m_ptr);
150  }
QWidgetBackingStore * m_ptr
Definition: qwidget_p.h:156

◆ operator*()

QWidgetBackingStore& QWidgetBackingStoreTracker::operator* ( )
inline

Definition at line 142 of file qwidget_p.h.

143  {
144  return *m_ptr;
145  }
QWidgetBackingStore * m_ptr
Definition: qwidget_p.h:156

◆ operator->()

QWidgetBackingStore* QWidgetBackingStoreTracker::operator-> ( )
inline

Definition at line 137 of file qwidget_p.h.

138  {
139  return m_ptr;
140  }
QWidgetBackingStore * m_ptr
Definition: qwidget_p.h:156

◆ registerWidget()

void QWidgetBackingStoreTracker::registerWidget ( QWidget w)

Add the widget to the list of widgets currently using the backing store.

Warning
This function is not part of the public interface.

If the widget was already in the list, this function is a no-op.

Definition at line 247 of file qwidget.cpp.

248 {
249  Q_ASSERT(m_ptr);
250  Q_ASSERT(w->internalWinId());
251  Q_ASSERT(qt_widget_private(w)->maybeBackingStore() == m_ptr);
252  m_widgets.insert(w);
253 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
const_iterator insert(const T &value)
Definition: qset.h:179
Q_GUI_EXPORT QWidgetPrivate * qt_widget_private(QWidget *widget)
Definition: qwidget.cpp:12920
WId internalWinId() const
Returns the window system identifier of the widget, or 0 if the widget is not created yet...
Definition: qwidget.h:244
QSet< QWidget * > m_widgets
Definition: qwidget_p.h:157
QWidgetBackingStore * m_ptr
Definition: qwidget_p.h:156

◆ unregisterWidget()

void QWidgetBackingStoreTracker::unregisterWidget ( QWidget w)

Remove the widget from the list of widgets currently using the backing store.

Warning
This function is not part of the public interface.

If the widget was in the list, and removing it causes the list to be empty, the backing store is deleted. If the widget was not in the list, this function is a no-op.

Definition at line 265 of file qwidget.cpp.

Referenced by unregisterWidgetSubtree().

266 {
267  if (m_widgets.remove(w) && m_widgets.isEmpty()) {
268  delete m_ptr;
269  m_ptr = 0;
270  }
271 }
bool remove(const T &value)
Definition: qset.h:89
bool isEmpty() const
Definition: qset.h:77
QSet< QWidget * > m_widgets
Definition: qwidget_p.h:157
QWidgetBackingStore * m_ptr
Definition: qwidget_p.h:156

◆ unregisterWidgetSubtree()

void QWidgetBackingStoreTracker::unregisterWidgetSubtree ( QWidget widget)

Recursively remove widget and all of its descendents.

Warning
This function is not part of the public interface.

Definition at line 280 of file qwidget.cpp.

281 {
282  unregisterWidget(widget);
283  foreach (QObject *child, widget->children())
284  if (QWidget *childWidget = qobject_cast<QWidget *>(child))
285  unregisterWidgetSubtree(childWidget);
286 }
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
const QObjectList & children() const
Returns a list of child objects.
Definition: qobject.h:197
void unregisterWidgetSubtree(QWidget *w)
Recursively remove widget and all of its descendents.
Definition: qwidget.cpp:280
void unregisterWidget(QWidget *w)
Remove the widget from the list of widgets currently using the backing store.
Definition: qwidget.cpp:265

Properties

◆ m_ptr

QWidgetBackingStore* QWidgetBackingStoreTracker::m_ptr
private

◆ m_widgets

QSet<QWidget *> QWidgetBackingStoreTracker::m_widgets
private

Definition at line 157 of file qwidget_p.h.

Referenced by destroy(), registerWidget(), and unregisterWidget().


The documentation for this class was generated from the following files: