Slicer 5.9
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
qSlicerBaseQTCorePythonQtDecorators.h
Go to the documentation of this file.
1/*=auto=========================================================================
2
3 Portions (c) Copyright 2005 Brigham and Women's Hospital (BWH)
4 All Rights Reserved.
5
6 See COPYRIGHT.txt
7 or http://www.slicer.org/copyright/copyright.txt for details.
8
9 Program: 3D Slicer
10
11=========================================================================auto=*/
12
13#ifndef __qSlicerBaseQTCorePythonQtDecorators_h
14#define __qSlicerBaseQTCorePythonQtDecorators_h
15
16// PythonQt includes
17#include <PythonQt.h>
18
19// Slicer includes
22#include "qSlicerUtils.h"
23
24#include "qSlicerBaseQTCoreExport.h"
25
26// NOTE:
27//
28// For decorators it is assumed that the methods will never be called
29// with the self argument as nullptr. The self argument is the first argument
30// for non-static methods.
31//
32
34{
35 Q_OBJECT
36public:
37
39 {
40 PythonQt::self()->registerClass(&qSlicerCoreApplication::staticMetaObject);
41 PythonQt::self()->registerClass(&qSlicerAbstractCoreModule::staticMetaObject);
42 PythonQt::self()->registerCPPClass("qSlicerUtils", nullptr, "qSlicerBaseQTCore");
43 // Note: Use registerCPPClassForPythonQt to register pure Cpp classes
44 }
45
46public slots:
47
48 //----------------------------------------------------------------------------
49 // qSlicerCoreApplication
50
51 //----------------------------------------------------------------------------
52 // static methods
53
54 //----------------------------------------------------------------------------
59
60 //----------------------------------------------------------------------------
61 // instance methods
62
63 //----------------------------------------------------------------------------
64 void sendEvent(qSlicerCoreApplication* app, QObject* _receiver, QEvent* _event)
65 {
66 app->sendEvent(_receiver, _event);
67 }
68
69 //----------------------------------------------------------------------------
71 {
72 app->processEvents();
73 }
74
75 //----------------------------------------------------------------------------
76 // qSlicerUtils
77
78 //----------------------------------------------------------------------------
79 // static methods
80
83 QString static_qSlicerUtils_replaceWikiUrlVersion(const QString& text,
84 const QString& version)
85 {
86 return qSlicerUtils::replaceWikiUrlVersion(text, version);
87 }
88
90 const QString& hostname,
91 const QString& version)
92 {
93 return qSlicerUtils::replaceDocumentationUrlVersion(text, hostname, version);
94 }
95};
96
97//-----------------------------------------------------------------------------
99{
100 PythonQt::self()->addDecorators(new qSlicerBaseQTBasePythonQtDecorators);
101}
102
103#endif
QString static_qSlicerUtils_replaceDocumentationUrlVersion(const QString &text, const QString &hostname, const QString &version)
void sendEvent(qSlicerCoreApplication *app, QObject *_receiver, QEvent *_event)
QString static_qSlicerUtils_replaceWikiUrlVersion(const QString &text, const QString &version)
static bool testAttribute(qSlicerCoreApplication::ApplicationAttribute attribute)
static QString replaceDocumentationUrlVersion(const QString &text, const QString &hostname, const QString &version)
Return an updated text where Slicer documentation URL version is replaced with the provided one.
static QString replaceWikiUrlVersion(const QString &text, const QString &version)
Return an updated text where Slicer wiki URL version is replaced with the provided one....
void initqSlicerBaseQTCorePythonQtDecorators()