Skip to content

Commit 25869ff

Browse files
clang-format: fix code formatting
This run of `clang-format` cleanups indentation and spacing to match ParaView style.
1 parent 6aa3964 commit 25869ff

File tree

105 files changed

+2552
-2841
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+2552
-2841
lines changed

QtTestingExport.h

+13-13
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
All rights reserved.
88
99
ParaView is a free software; you can redistribute it and/or modify it
10-
under the terms of the ParaView license version 1.2.
10+
under the terms of the ParaView license version 1.2.
1111
1212
See License_v1.2.txt for the full ParaView license.
1313
A copy of this license can be obtained by contacting
@@ -36,21 +36,21 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3636
#include "QtTestingConfigure.h"
3737

3838
#if defined(QTTESTING_BUILD_SHARED_LIBS)
39-
# if defined(QtTesting_EXPORTS)
40-
# if defined(WIN32)
41-
# define QTTESTING_EXPORT __declspec(dllexport)
42-
# elif defined(__GNUC__) && __GNUC__ >= 4
43-
# define QTTESTING_EXPORT __attribute__ ((visibility("default")))
44-
# endif
45-
# else
46-
# if defined(WIN32)
47-
# define QTTESTING_EXPORT __declspec(dllimport)
48-
# endif
49-
# endif
39+
#if defined(QtTesting_EXPORTS)
40+
#if defined(WIN32)
41+
#define QTTESTING_EXPORT __declspec(dllexport)
42+
#elif defined(__GNUC__) && __GNUC__ >= 4
43+
#define QTTESTING_EXPORT __attribute__((visibility("default")))
44+
#endif
45+
#else
46+
#if defined(WIN32)
47+
#define QTTESTING_EXPORT __declspec(dllimport)
48+
#endif
49+
#endif
5050
#endif
5151

5252
#ifndef QTTESTING_EXPORT
53-
# define QTTESTING_EXPORT
53+
#define QTTESTING_EXPORT
5454
#endif
5555

5656
#endif // !_QtTestingExport_h

pq3DViewEventPlayer.cxx

+32-33
Original file line numberDiff line numberDiff line change
@@ -35,46 +35,45 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3535
#include <QApplication>
3636
#include <QKeyEvent>
3737
#include <QMouseEvent>
38-
#include <QtDebug>
3938
#include <QRegExp>
4039
#include <QWidget>
40+
#include <QtDebug>
4141

42-
pq3DViewEventPlayer::pq3DViewEventPlayer(const QByteArray& classname, QObject * p)
43-
: pqWidgetEventPlayer(p), mClassType(classname)
42+
pq3DViewEventPlayer::pq3DViewEventPlayer(const QByteArray& classname, QObject* p)
43+
: pqWidgetEventPlayer(p)
44+
, mClassType(classname)
4445
{
4546
}
4647

47-
bool pq3DViewEventPlayer::playEvent(QObject* Object,
48-
const QString& Command,
49-
const QString& Arguments,
50-
bool& Error)
48+
bool pq3DViewEventPlayer::playEvent(
49+
QObject* Object, const QString& Command, const QString& Arguments, bool& Error)
5150
{
52-
QWidget* widget = qobject_cast<QWidget*>(Object);
53-
if(widget && Object->inherits(mClassType.data()))
51+
QWidget* widget = qobject_cast<QWidget*>(Object);
52+
if (widget && Object->inherits(mClassType.data()))
53+
{
54+
if (Command == "mousePress" || Command == "mouseRelease" || Command == "mouseMove")
55+
{
56+
QRegExp mouseRegExp("\\(([^,]*),([^,]*),([^,]),([^,]),([^,]*)\\)");
57+
if (mouseRegExp.indexIn(Arguments) != -1)
5458
{
55-
if (Command == "mousePress" || Command=="mouseRelease" || Command=="mouseMove")
56-
{
57-
QRegExp mouseRegExp("\\(([^,]*),([^,]*),([^,]),([^,]),([^,]*)\\)");
58-
if (mouseRegExp.indexIn(Arguments)!= -1)
59-
{
60-
QVariant v = mouseRegExp.cap(1);
61-
int x = static_cast<int>(v.toDouble() * widget->size().width());
62-
v = mouseRegExp.cap(2);
63-
int y = static_cast<int>(v.toDouble() * widget->size().height());
64-
v = mouseRegExp.cap(3);
65-
Qt::MouseButton button = static_cast<Qt::MouseButton>(v.toInt());
66-
v = mouseRegExp.cap(4);
67-
Qt::MouseButtons buttons = static_cast<Qt::MouseButton>(v.toInt());
68-
v = mouseRegExp.cap(5);
69-
Qt::KeyboardModifiers keym = static_cast<Qt::KeyboardModifier>(v.toInt());
70-
QEvent::Type type = (Command == "mousePress")? QEvent::MouseButtonPress :
71-
((Command=="mouseMove")? QEvent::MouseMove : QEvent::MouseButtonRelease);
72-
QMouseEvent e(type, QPoint(x,y), button, buttons, keym);
73-
qApp->notify(Object, &e);
74-
}
75-
return true;
76-
}
59+
QVariant v = mouseRegExp.cap(1);
60+
int x = static_cast<int>(v.toDouble() * widget->size().width());
61+
v = mouseRegExp.cap(2);
62+
int y = static_cast<int>(v.toDouble() * widget->size().height());
63+
v = mouseRegExp.cap(3);
64+
Qt::MouseButton button = static_cast<Qt::MouseButton>(v.toInt());
65+
v = mouseRegExp.cap(4);
66+
Qt::MouseButtons buttons = static_cast<Qt::MouseButton>(v.toInt());
67+
v = mouseRegExp.cap(5);
68+
Qt::KeyboardModifiers keym = static_cast<Qt::KeyboardModifier>(v.toInt());
69+
QEvent::Type type = (Command == "mousePress")
70+
? QEvent::MouseButtonPress
71+
: ((Command == "mouseMove") ? QEvent::MouseMove : QEvent::MouseButtonRelease);
72+
QMouseEvent e(type, QPoint(x, y), button, buttons, keym);
73+
qApp->notify(Object, &e);
7774
}
78-
return this->Superclass::playEvent(Object, Command, Arguments, Error);
75+
return true;
76+
}
77+
}
78+
return this->Superclass::playEvent(Object, Command, Arguments, Error);
7979
}
80-

pq3DViewEventPlayer.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3636
#include "pqWidgetEventPlayer.h"
3737

3838
/**
39-
Concrete implementation of pqWidgetEventPlayer that handles playback of "activate" events for 3d views.
39+
Concrete implementation of pqWidgetEventPlayer that handles playback of "activate" events for 3d
40+
views.
4041
It is not registered by default, and user can register with their own 3d view type.
4142
4243
\sa pqEventPlayer
4344
*/
44-
class QTTESTING_EXPORT pq3DViewEventPlayer :
45-
public pqWidgetEventPlayer
45+
class QTTESTING_EXPORT pq3DViewEventPlayer : public pqWidgetEventPlayer
4646
{
4747
Q_OBJECT
4848
typedef pqWidgetEventPlayer Superclass;
@@ -51,13 +51,13 @@ class QTTESTING_EXPORT pq3DViewEventPlayer :
5151
pq3DViewEventPlayer(const QByteArray& classname, QObject* p = 0);
5252

5353
using Superclass::playEvent;
54-
bool playEvent(QObject* Object, const QString& Command, const QString& Arguments, bool& Error) override;
54+
bool playEvent(
55+
QObject* Object, const QString& Command, const QString& Arguments, bool& Error) override;
5556

5657
protected:
5758
QByteArray mClassType;
5859

5960
private:
60-
6161
pq3DViewEventPlayer(const pq3DViewEventPlayer&);
6262
pq3DViewEventPlayer& operator=(const pq3DViewEventPlayer&);
6363
};

pq3DViewEventTranslator.cxx

+63-65
Original file line numberDiff line numberDiff line change
@@ -33,143 +33,141 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3333
#include "pq3DViewEventTranslator.h"
3434

3535
#include <QEvent>
36-
#include <QMouseEvent>
3736
#include <QKeyEvent>
37+
#include <QMouseEvent>
3838
#include <QWidget>
3939

4040
pq3DViewEventTranslator::pq3DViewEventTranslator(const QByteArray& classname, QObject* p)
41-
: pqWidgetEventTranslator(p), mClassType(classname),
42-
lastMoveEvent(QEvent::MouseButtonPress, QPoint(), Qt::MouseButton(),
43-
Qt::MouseButtons(), Qt::KeyboardModifiers())
41+
: pqWidgetEventTranslator(p)
42+
, mClassType(classname)
43+
, lastMoveEvent(QEvent::MouseButtonPress, QPoint(), Qt::MouseButton(), Qt::MouseButtons(),
44+
Qt::KeyboardModifiers())
4445
{
4546
}
4647

4748
pq3DViewEventTranslator::~pq3DViewEventTranslator()
4849
{
4950
}
5051

51-
bool pq3DViewEventTranslator::translateEvent(QObject* Object, QEvent* Event,
52-
bool& Error)
52+
bool pq3DViewEventTranslator::translateEvent(QObject* Object, QEvent* Event, bool& Error)
5353
{
5454
QWidget* widget = qobject_cast<QWidget*>(Object);
55-
if(!widget || !Object->inherits(mClassType.data()))
56-
{
55+
if (!widget || !Object->inherits(mClassType.data()))
56+
{
5757
return false;
58-
}
58+
}
5959

60-
switch(Event->type())
61-
{
60+
switch (Event->type())
61+
{
6262
case QEvent::ContextMenu:
63-
{
63+
{
6464
return true;
6565
break;
66-
}
66+
}
6767

6868
case QEvent::MouseButtonPress:
69-
{
69+
{
7070
QMouseEvent* mouseEvent = dynamic_cast<QMouseEvent*>(Event);
7171
if (mouseEvent)
72-
{
72+
{
7373
QSize size = widget->size();
74-
double normalized_x = mouseEvent->x()/static_cast<double>(size.width());
75-
double normalized_y = mouseEvent->y()/static_cast<double>(size.height());
74+
double normalized_x = mouseEvent->x() / static_cast<double>(size.width());
75+
double normalized_y = mouseEvent->y() / static_cast<double>(size.height());
7676
int button = mouseEvent->button();
7777
int buttons = mouseEvent->buttons();
7878
int modifiers = mouseEvent->modifiers();
7979
emit recordEvent(Object, "mousePress", QString("(%1,%2,%3,%4,%5)")
80-
.arg(normalized_x)
81-
.arg(normalized_y)
82-
.arg(button)
83-
.arg(buttons)
84-
.arg(modifiers));
85-
}
80+
.arg(normalized_x)
81+
.arg(normalized_y)
82+
.arg(button)
83+
.arg(buttons)
84+
.arg(modifiers));
85+
}
8686

8787
// reset lastMoveEvent
88-
QMouseEvent e(QEvent::MouseButtonPress, QPoint(), Qt::MouseButton(),
89-
Qt::MouseButtons(), Qt::KeyboardModifiers());
88+
QMouseEvent e(QEvent::MouseButtonPress, QPoint(), Qt::MouseButton(), Qt::MouseButtons(),
89+
Qt::KeyboardModifiers());
9090

9191
lastMoveEvent = e;
9292
return true;
9393
break;
94-
}
94+
}
9595

9696
case QEvent::MouseMove:
97-
{
97+
{
9898
QMouseEvent* mouseEvent = dynamic_cast<QMouseEvent*>(Event);
9999
if (mouseEvent)
100-
{
100+
{
101101
QMouseEvent e(QEvent::MouseMove, QPoint(mouseEvent->x(), mouseEvent->y()),
102-
mouseEvent->button(), mouseEvent->buttons(),
103-
mouseEvent->modifiers());
102+
mouseEvent->button(), mouseEvent->buttons(), mouseEvent->modifiers());
104103

105104
lastMoveEvent = e;
106-
}
105+
}
107106
return true;
108107
break;
109-
}
108+
}
110109

111110
case QEvent::MouseButtonRelease:
112-
{
111+
{
113112
QMouseEvent* mouseEvent = dynamic_cast<QMouseEvent*>(Event);
114113
if (mouseEvent)
115-
{
114+
{
116115
QSize size = widget->size();
117116

118117
// record last move event if it is valid
119-
if(lastMoveEvent.type() == QEvent::MouseMove)
120-
{
121-
double normalized_x = lastMoveEvent.x()/static_cast<double>(size.width());
122-
double normalized_y = lastMoveEvent.y()/static_cast<double>(size.height());
118+
if (lastMoveEvent.type() == QEvent::MouseMove)
119+
{
120+
double normalized_x = lastMoveEvent.x() / static_cast<double>(size.width());
121+
double normalized_y = lastMoveEvent.y() / static_cast<double>(size.height());
123122
int button = lastMoveEvent.button();
124123
int buttons = lastMoveEvent.buttons();
125124
int modifiers = lastMoveEvent.modifiers();
126125

127126
emit recordEvent(Object, "mouseMove", QString("(%1,%2,%3,%4,%5)")
128-
.arg(normalized_x)
129-
.arg(normalized_y)
130-
.arg(button)
131-
.arg(buttons)
132-
.arg(modifiers));
133-
}
134-
127+
.arg(normalized_x)
128+
.arg(normalized_y)
129+
.arg(button)
130+
.arg(buttons)
131+
.arg(modifiers));
132+
}
135133

136-
double normalized_x = mouseEvent->x()/static_cast<double>(size.width());
137-
double normalized_y = mouseEvent->y()/static_cast<double>(size.height());
134+
double normalized_x = mouseEvent->x() / static_cast<double>(size.width());
135+
double normalized_y = mouseEvent->y() / static_cast<double>(size.height());
138136
int button = mouseEvent->button();
139137
int buttons = mouseEvent->buttons();
140138
int modifiers = mouseEvent->modifiers();
141139

142140
emit recordEvent(Object, "mouseRelease", QString("(%1,%2,%3,%4,%5)")
143-
.arg(normalized_x)
144-
.arg(normalized_y)
145-
.arg(button)
146-
.arg(buttons)
147-
.arg(modifiers));
148-
}
141+
.arg(normalized_x)
142+
.arg(normalized_y)
143+
.arg(button)
144+
.arg(buttons)
145+
.arg(modifiers));
146+
}
149147
return true;
150148
break;
151-
}
149+
}
152150

153151
case QEvent::KeyPress:
154152
case QEvent::KeyRelease:
155-
{
153+
{
156154
QKeyEvent* ke = static_cast<QKeyEvent*>(Event);
157-
QString data =QString("%1:%2:%3:%4:%5:%6")
158-
.arg(ke->type())
159-
.arg(ke->key())
160-
.arg(static_cast<int>(ke->modifiers()))
161-
.arg(ke->text())
162-
.arg(ke->isAutoRepeat())
163-
.arg(ke->count());
155+
QString data = QString("%1:%2:%3:%4:%5:%6")
156+
.arg(ke->type())
157+
.arg(ke->key())
158+
.arg(static_cast<int>(ke->modifiers()))
159+
.arg(ke->text())
160+
.arg(ke->isAutoRepeat())
161+
.arg(ke->count());
164162
emit recordEvent(Object, "keyEvent", data);
165163
return true;
166164
break;
167-
}
165+
}
168166

169167
default:
170-
{
168+
{
171169
break;
172-
}
173170
}
171+
}
174172
return this->Superclass::translateEvent(Object, Event, Error);
175173
}

pq3DViewEventTranslator.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,13 @@ Translates low-level Qt events into high-level ParaView events that can be recor
4242
\sa pqEventTranslator
4343
*/
4444

45-
class QTTESTING_EXPORT pq3DViewEventTranslator :
46-
public pqWidgetEventTranslator
45+
class QTTESTING_EXPORT pq3DViewEventTranslator : public pqWidgetEventTranslator
4746
{
4847
Q_OBJECT
4948
typedef pqWidgetEventTranslator Superclass;
5049

5150
public:
52-
pq3DViewEventTranslator(const QByteArray& classname, QObject* p=0);
51+
pq3DViewEventTranslator(const QByteArray& classname, QObject* p = 0);
5352
~pq3DViewEventTranslator() override;
5453

5554
using Superclass::translateEvent;
@@ -62,7 +61,6 @@ class QTTESTING_EXPORT pq3DViewEventTranslator :
6261
private:
6362
pq3DViewEventTranslator(const pq3DViewEventTranslator&);
6463
pq3DViewEventTranslator& operator=(const pq3DViewEventTranslator&);
65-
6664
};
6765

6866
#endif // !_pq3DViewEventTranslator_h

0 commit comments

Comments
 (0)