kernel/qwidgetaction.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5QWidgetAction::QWidgetAction(QObject *parent) -
6 : QAction(*(new QWidgetActionPrivate), parent) -
7{ -
8}
executed: }
Execution Count:18
18
9 -
10 -
11 -
12 -
13QWidgetAction::~QWidgetAction() -
14{ -
15 QWidgetActionPrivate * const d = d_func(); -
16 for (int i = 0; i < d->createdWidgets.count(); ++i)
evaluated: i < d->createdWidgets.count()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:18
2-18
17 disconnect(d->createdWidgets.at(i), "2""destroyed(QObject*)", 2
18 this, "1""_q_widgetDestroyed(QObject*)");
executed: disconnect(d->createdWidgets.at(i), "2""destroyed(QObject*)", this, "1""_q_widgetDestroyed(QObject*)");
Execution Count:2
2
19 QList<QWidget *> widgetsToDelete = d->createdWidgets; -
20 d->createdWidgets.clear(); -
21 qDeleteAll(widgetsToDelete); -
22 delete d->defaultWidget; -
23}
executed: }
Execution Count:18
18
24void QWidgetAction::setDefaultWidget(QWidget *widget) -
25{ -
26 QWidgetActionPrivate * const d = d_func(); -
27 if (widget == d->defaultWidget || d->defaultWidgetInUse)
evaluated: widget == d->defaultWidget
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:17
partially evaluated: d->defaultWidgetInUse
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
0-17
28 return;
executed: return;
Execution Count:1
1
29 delete d->defaultWidget; -
30 d->defaultWidget = widget; -
31 if (!widget)
partially evaluated: !widget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
0-17
32 return;
never executed: return;
0
33 -
34 setVisible(!(widget->isHidden() && widget->testAttribute(Qt::WA_WState_ExplicitShowHide))); -
35 d->defaultWidget->hide(); -
36 d->defaultWidget->setParent(0); -
37 d->defaultWidgetInUse = false; -
38 if (!isEnabled())
evaluated: !isEnabled()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:15
2-15
39 d->defaultWidget->setEnabled(false);
executed: d->defaultWidget->setEnabled(false);
Execution Count:2
2
40}
executed: }
Execution Count:17
17
41 -
42 -
43 -
44 -
45QWidget *QWidgetAction::defaultWidget() const -
46{ -
47 const QWidgetActionPrivate * const d = d_func(); -
48 return d->defaultWidget;
executed: return d->defaultWidget;
Execution Count:4
4
49} -
50QWidget *QWidgetAction::requestWidget(QWidget *parent) -
51{ -
52 QWidgetActionPrivate * const d = d_func(); -
53 -
54 QWidget *w = createWidget(parent); -
55 if (!w) {
evaluated: !w
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:3
3-15
56 if (d->defaultWidgetInUse || !d->defaultWidget)
evaluated: d->defaultWidgetInUse
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:13
partially evaluated: !d->defaultWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-13
57 return 0;
executed: return 0;
Execution Count:2
2
58 d->defaultWidget->setParent(parent); -
59 d->defaultWidgetInUse = true; -
60 return d->defaultWidget;
executed: return d->defaultWidget;
Execution Count:13
13
61 } -
62 -
63 connect(w, "2""destroyed(QObject*)", -
64 this, "1""_q_widgetDestroyed(QObject*)"); -
65 d->createdWidgets.append(w); -
66 return w;
executed: return w;
Execution Count:3
3
67} -
68void QWidgetAction::releaseWidget(QWidget *widget) -
69{ -
70 QWidgetActionPrivate * const d = d_func(); -
71 -
72 if (widget == d->defaultWidget) {
evaluated: widget == d->defaultWidget
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:5
5-10
73 d->defaultWidget->hide(); -
74 d->defaultWidget->setParent(0); -
75 d->defaultWidgetInUse = false; -
76 return;
executed: return;
Execution Count:10
10
77 } -
78 -
79 if (!d->createdWidgets.contains(widget))
evaluated: !d->createdWidgets.contains(widget)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1
1-4
80 return;
executed: return;
Execution Count:4
4
81 -
82 disconnect(widget, "2""destroyed(QObject*)", -
83 this, "1""_q_widgetDestroyed(QObject*)"); -
84 d->createdWidgets.removeAll(widget); -
85 deleteWidget(widget); -
86}
executed: }
Execution Count:1
1
87 -
88 -
89 -
90 -
91bool QWidgetAction::event(QEvent *event) -
92{ -
93 QWidgetActionPrivate * const d = d_func(); -
94 if (event->type() == QEvent::ActionChanged) {
partially evaluated: event->type() == QEvent::ActionChanged
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
95 if (d->defaultWidget)
evaluated: d->defaultWidget
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1
1-4
96 d->defaultWidget->setEnabled(isEnabled());
executed: d->defaultWidget->setEnabled(isEnabled());
Execution Count:4
4
97 for (int i = 0; i < d->createdWidgets.count(); ++i)
partially evaluated: i < d->createdWidgets.count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
98 d->createdWidgets.at(i)->setEnabled(isEnabled());
never executed: d->createdWidgets.at(i)->setEnabled(isEnabled());
0
99 }
executed: }
Execution Count:5
5
100 return QAction::event(event);
executed: return QAction::event(event);
Execution Count:5
5
101} -
102 -
103 -
104 -
105 -
106bool QWidgetAction::eventFilter(QObject *obj, QEvent *event) -
107{ -
108 return QAction::eventFilter(obj,event);
never executed: return QAction::eventFilter(obj,event);
0
109} -
110QWidget *QWidgetAction::createWidget(QWidget *parent) -
111{ -
112 (void)parent; -
113 return 0;
executed: return 0;
Execution Count:15
15
114} -
115void QWidgetAction::deleteWidget(QWidget *widget) -
116{ -
117 widget->hide(); -
118 widget->deleteLater(); -
119}
executed: }
Execution Count:1
1
120 -
121 -
122 -
123 -
124 -
125QList<QWidget *> QWidgetAction::createdWidgets() const -
126{ -
127 const QWidgetActionPrivate * const d = d_func(); -
128 return d->createdWidgets;
executed: return d->createdWidgets;
Execution Count:2
2
129} -
130 -
131 -
132 -
133 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial