Skip to content

Commit e533780

Browse files
mrbean-bremenusiems
authored andcommitted
Changes after applying clang-format
1 parent 81bb9d8 commit e533780

File tree

147 files changed

+19193
-20382
lines changed

Some content is hidden

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

147 files changed

+19193
-20382
lines changed

examples/CPPPyWrapperExample/CPPPyWrapperExample.cpp

Lines changed: 42 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,46 @@
22
#include <QtGui>
33
#include <QApplication>
44

5-
int main (int argc, char* argv[]) {
6-
QApplication app(argc, argv);
7-
PythonQt::init();
8-
PythonQtObjectPtr mainModule = PythonQt::self()->getMainModule();
9-
mainModule.evalScript(QString("import sys\n"));
10-
Q_ASSERT(!mainModule.isNull());
11-
{
12-
// evaluate a python file embedded in executable as resource:
13-
mainModule.evalFile(":eyed3tagger.py");
14-
// create an object, hold onto its reference
15-
PythonQtObjectPtr tag = mainModule.evalScript("EyeD3Tagger()\n", Py_eval_input);
16-
Q_ASSERT(!tag.isNull());
17-
tag.call("setFileName", QVariantList() << "t.mp3");
18-
QVariant fn = tag.call("fileName", QVariantList());
19-
Q_ASSERT(fn.toString() == QString("t.mp3"));
20-
// tag goes out of scope, reference count decremented.
21-
}
22-
{
23-
// Allow the python system path to recognize QFile paths in the sys.path
24-
PythonQt::self()->setImporter(NULL);
25-
// append the Qt resource root directory to the sys.path
26-
mainModule.evalScript("sys.path.append(':')\n");
27-
mainModule.evalScript("import eyed3tagger\n");
28-
PythonQtObjectPtr tag = mainModule.evalScript("eyed3tagger.EyeD3Tagger()\n", Py_eval_input);
29-
Q_ASSERT(!tag.isNull());
30-
tag.call("setFileName", QVariantList() << "t.mp3");
31-
QVariant fn = tag.call("fileName", QVariantList());
32-
Q_ASSERT(fn.toString() == QString("t.mp3"));
33-
}
34-
{ // alternative using import and loading it as a real module from sys.path
35-
// import sys first
36-
mainModule.evalScript(QString("sys.path.append('%1')\n").arg(QDir::currentPath()));
37-
mainModule.evalScript("import eyed3tagger\n");
38-
PythonQtObjectPtr tag = mainModule.evalScript("eyed3tagger.EyeD3Tagger()\n", Py_eval_input);
39-
Q_ASSERT(!tag.isNull());
40-
tag.call("setFileName", QVariantList() << "t.mp3");
41-
QVariant fn = tag.call("fileName", QVariantList());
42-
Q_ASSERT(fn.toString() == QString("t.mp3"));
43-
}
44-
qDebug() << "finished";
45-
return 0;
5+
int main(int argc, char* argv[])
6+
{
7+
QApplication app(argc, argv);
8+
PythonQt::init();
9+
PythonQtObjectPtr mainModule = PythonQt::self()->getMainModule();
10+
mainModule.evalScript(QString("import sys\n"));
11+
Q_ASSERT(!mainModule.isNull());
12+
{
13+
// evaluate a python file embedded in executable as resource:
14+
mainModule.evalFile(":eyed3tagger.py");
15+
// create an object, hold onto its reference
16+
PythonQtObjectPtr tag = mainModule.evalScript("EyeD3Tagger()\n", Py_eval_input);
17+
Q_ASSERT(!tag.isNull());
18+
tag.call("setFileName", QVariantList() << "t.mp3");
19+
QVariant fn = tag.call("fileName", QVariantList());
20+
Q_ASSERT(fn.toString() == QString("t.mp3"));
21+
// tag goes out of scope, reference count decremented.
22+
}
23+
{
24+
// Allow the python system path to recognize QFile paths in the sys.path
25+
PythonQt::self()->setImporter(NULL);
26+
// append the Qt resource root directory to the sys.path
27+
mainModule.evalScript("sys.path.append(':')\n");
28+
mainModule.evalScript("import eyed3tagger\n");
29+
PythonQtObjectPtr tag = mainModule.evalScript("eyed3tagger.EyeD3Tagger()\n", Py_eval_input);
30+
Q_ASSERT(!tag.isNull());
31+
tag.call("setFileName", QVariantList() << "t.mp3");
32+
QVariant fn = tag.call("fileName", QVariantList());
33+
Q_ASSERT(fn.toString() == QString("t.mp3"));
34+
}
35+
{ // alternative using import and loading it as a real module from sys.path
36+
// import sys first
37+
mainModule.evalScript(QString("sys.path.append('%1')\n").arg(QDir::currentPath()));
38+
mainModule.evalScript("import eyed3tagger\n");
39+
PythonQtObjectPtr tag = mainModule.evalScript("eyed3tagger.EyeD3Tagger()\n", Py_eval_input);
40+
Q_ASSERT(!tag.isNull());
41+
tag.call("setFileName", QVariantList() << "t.mp3");
42+
QVariant fn = tag.call("fileName", QVariantList());
43+
Q_ASSERT(fn.toString() == QString("t.mp3"));
44+
}
45+
qDebug() << "finished";
46+
return 0;
4647
}

examples/PyCPPWrapperExample/CustomObjects.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,3 @@
4040
//----------------------------------------------------------------------------------
4141

4242
#include "CustomObjects.h"
43-

examples/PyCPPWrapperExample/CustomObjects.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,24 @@
4646
#include "PythonQtCppWrapperFactory.h"
4747
#include <QObject>
4848

49-
5049
// declare our own custom object
51-
class CustomObject {
50+
class CustomObject
51+
{
5252
public:
5353
CustomObject() {}
54-
CustomObject(const QString& first, const QString& last) { _firstName = first; _lastName = last; }
54+
CustomObject(const QString& first, const QString& last)
55+
{
56+
_firstName = first;
57+
_lastName = last;
58+
}
5559

5660
QString _firstName;
5761
QString _lastName;
58-
5962
};
6063

61-
6264
// add a decorator that allows to access the CustomObject from PythonQt
63-
class CustomObjectWrapper : public QObject {
65+
class CustomObjectWrapper : public QObject
66+
{
6467

6568
Q_OBJECT
6669

@@ -79,7 +82,6 @@ public Q_SLOTS:
7982
void setFirstName(CustomObject* o, const QString& name) { o->_firstName = name; }
8083

8184
void setLastName(CustomObject* o, const QString& name) { o->_lastName = name; }
82-
8385
};
8486

8587
#endif

examples/PyCPPWrapperExample/main.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,17 @@
4545

4646
#include <QApplication>
4747

48-
int main(int argc, char *argv[])
48+
int main(int argc, char* argv[])
4949
{
5050
QApplication qapp(argc, argv);
5151

5252
PythonQt::init(PythonQt::IgnoreSiteModule | PythonQt::RedirectStdOut);
5353

54-
PythonQtObjectPtr mainContext = PythonQt::self()->getMainModule();
54+
PythonQtObjectPtr mainContext = PythonQt::self()->getMainModule();
5555
PythonQtScriptingConsole console(NULL, mainContext);
5656

5757
// register the new object as a known classname and add it's wrapper object
58-
PythonQt::self()->registerCPPClass("CustomObject", "","example", PythonQtCreateObject<CustomObjectWrapper>);
58+
PythonQt::self()->registerCPPClass("CustomObject", "", "example", PythonQtCreateObject<CustomObjectWrapper>);
5959

6060
mainContext.evalFile(":example.py");
6161

@@ -64,4 +64,3 @@ int main(int argc, char *argv[])
6464

6565
return qapp.exec();
6666
}
67-

examples/PyCustomMetaTypeExample/CustomObject.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,3 @@
4040
//----------------------------------------------------------------------------------
4141

4242
#include "CustomObject.h"
43-

examples/PyCustomMetaTypeExample/CustomObject.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,27 @@
4545
#include "PythonQt.h"
4646
#include <QObject>
4747

48-
4948
// declare our own copyable custom object
50-
class CustomObject {
49+
class CustomObject
50+
{
5151
public:
5252
CustomObject() {}
53-
CustomObject(const QString& first, const QString& last) { _firstName = first; _lastName = last; }
53+
CustomObject(const QString& first, const QString& last)
54+
{
55+
_firstName = first;
56+
_lastName = last;
57+
}
5458

5559
QString _firstName;
5660
QString _lastName;
57-
5861
};
5962

6063
// register it to the meta type system
6164
Q_DECLARE_METATYPE(CustomObject)
6265

6366
// add a wrapper that allows to access the CustomObject from PythonQt
64-
class CustomObjectWrapper : public QObject {
67+
class CustomObjectWrapper : public QObject
68+
{
6569

6670
Q_OBJECT
6771

@@ -78,8 +82,6 @@ public Q_SLOTS:
7882
void setFirstName(CustomObject* o, const QString& name) { o->_firstName = name; }
7983

8084
void setLastName(CustomObject* o, const QString& name) { o->_lastName = name; }
81-
8285
};
8386

84-
8587
#endif

examples/PyCustomMetaTypeExample/main.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,19 @@
4545

4646
#include <QApplication>
4747

48-
int main(int argc, char *argv[])
48+
int main(int argc, char* argv[])
4949
{
5050
QApplication qapp(argc, argv);
5151

5252
PythonQt::init(PythonQt::IgnoreSiteModule | PythonQt::RedirectStdOut);
5353

54-
PythonQtObjectPtr mainContext = PythonQt::self()->getMainModule();
54+
PythonQtObjectPtr mainContext = PythonQt::self()->getMainModule();
5555
PythonQtScriptingConsole console(NULL, mainContext);
5656

5757
// register the type with QMetaType
5858
qRegisterMetaType<CustomObject>("CustomObject");
5959
// add a wrapper object for the new variant type
60-
PythonQt::self()->registerCPPClass("CustomObject","","example", PythonQtCreateObject<CustomObjectWrapper>);
60+
PythonQt::self()->registerCPPClass("CustomObject", "", "example", PythonQtCreateObject<CustomObjectWrapper>);
6161

6262
mainContext.evalFile(":example.py");
6363

@@ -66,4 +66,3 @@ int main(int argc, char *argv[])
6666

6767
return qapp.exec();
6868
}
69-

examples/PyDecoratorsExample/PyExampleDecorators.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,3 @@
4040
//----------------------------------------------------------------------------------
4141

4242
#include "PyExampleDecorators.h"
43-

examples/PyDecoratorsExample/PyExampleDecorators.h

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,18 @@
4848
#include <QPushButton>
4949

5050
// an example CPP object
51-
class YourCPPObject {
51+
class YourCPPObject
52+
{
5253
public:
53-
YourCPPObject(int arg1, float arg2) { a = arg1; b = arg2; }
54+
YourCPPObject(int arg1, float arg2)
55+
{
56+
a = arg1;
57+
b = arg2;
58+
}
5459

55-
float doSomething(int arg1) { return arg1*a*b; };
60+
float doSomething(int arg1) { return arg1 * a * b; };
5661

57-
private:
62+
private:
5863

5964
int a;
6065
float b;
@@ -70,7 +75,7 @@ public Q_SLOTS:
7075
QSize* new_QSize(const QPoint& p) { return new QSize(p.x(), p.y()); }
7176

7277
// add a constructor for QPushButton that takes a text and a parent widget
73-
QPushButton* new_QPushButton(const QString& text, QWidget* parent=NULL) { return new QPushButton(text, parent); }
78+
QPushButton* new_QPushButton(const QString& text, QWidget* parent = NULL) { return new QPushButton(text, parent); }
7479

7580
// add a constructor for a CPP object
7681
YourCPPObject* new_YourCPPObject(int arg1, float arg2) { return new YourCPPObject(arg1, arg2); }
@@ -85,11 +90,10 @@ public Q_SLOTS:
8590
void move(QWidget* w, const QPoint& p) { w->move(p); }
8691

8792
// add an additional slot to QWidget, overloading the above move method
88-
void move(QWidget* w, int x, int y) { w->move(x,y); }
93+
void move(QWidget* w, int x, int y) { w->move(x, y); }
8994

9095
// add a method to your own CPP object
9196
int doSomething(YourCPPObject* obj, int arg1) { return obj->doSomething(arg1); }
9297
};
9398

94-
9599
#endif

examples/PyDecoratorsExample/main.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,18 @@
4545

4646
#include <QApplication>
4747

48-
int main(int argc, char *argv[])
48+
int main(int argc, char* argv[])
4949
{
5050
QApplication qapp(argc, argv);
5151

5252
PythonQt::init(PythonQt::IgnoreSiteModule | PythonQt::RedirectStdOut);
5353

54-
PythonQtObjectPtr mainContext = PythonQt::self()->getMainModule();
54+
PythonQtObjectPtr mainContext = PythonQt::self()->getMainModule();
5555
PythonQtScriptingConsole console(NULL, mainContext);
56-
56+
5757
PythonQt::self()->addDecorators(new PyExampleDecorators());
5858
PythonQt::self()->registerClass(&QPushButton::staticMetaObject, "QtGui");
59-
PythonQt::self()->registerCPPClass("YourCPPObject","", "example");
59+
PythonQt::self()->registerCPPClass("YourCPPObject", "", "example");
6060

6161
mainContext.evalFile(":example.py");
6262

@@ -65,4 +65,3 @@ int main(int argc, char *argv[])
6565

6666
return qapp.exec();
6767
}
68-

0 commit comments

Comments
 (0)