-
Notifications
You must be signed in to change notification settings - Fork 1
/
metathemehelper.cpp
38 lines (30 loc) · 989 Bytes
/
metathemehelper.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "metathemehelper.h"
#include <Qt3Support/Q3PtrDict>
extern "C"{
#include <metathemeInt.h>
}
Q3PtrDict<void *> widgetRefs;
Q3PtrDict<void> widgetData;
Q3PtrDict<void> widgetDataDispose;
void MetaThemeHelper::widgetDestroyedForData(QObject *obj)
{
void *data = widgetData[obj];
if (!data) return;
mt_destroy_func dispose_func = (mt_destroy_func)widgetDataDispose[obj];
dispose_func(data);
widgetData.remove(obj);
widgetDataDispose.remove(obj);
QObject::disconnect(obj, SIGNAL(destroyed(QObject *)), this, SLOT(widgetDestroyedForData(QObject *)));
}
void MetaThemeHelper::widgetDestroyedForRef(QObject *obj)
{
Q3PtrDictIterator<void *> it(widgetRefs);
for( ; it.current(); ++it ) {
MT_WIDGET *widget = (MT_WIDGET *)it.currentKey();
if (widget && *widget == obj) {
widgetRefs.remove(widget);
break;
}
}
QObject::disconnect(obj, SIGNAL(destroyed(QObject *)), this, SLOT(widgetDestroyedForRef(QObject *)));
}