aboutsummaryrefslogtreecommitdiffstats
path: root/sources
diff options
context:
space:
mode:
Diffstat (limited to 'sources')
-rw-r--r--sources/pyside2/PySide2/QtConcurrent/curr_errors.txt4
-rw-r--r--sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.cpp22
-rw-r--r--sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.h14
-rw-r--r--sources/pyside2/PySide2/QtCore/typesystem_core_common.xml2
-rw-r--r--sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml16
-rw-r--r--sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml8
-rw-r--r--sources/pyside2/PySide2/QtQml/pysideqmlregistertype.cpp70
-rw-r--r--sources/pyside2/PySide2/QtQml/pysideqmlregistertype.h4
-rw-r--r--sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp4
-rw-r--r--sources/pyside2/PySide2/QtQuickWidgets/typesystem_quickwidgets.xml2
-rw-r--r--sources/pyside2/PySide2/QtScript/qscript_value_iterator_glue.cpp2
-rw-r--r--sources/pyside2/PySide2/QtUiTools/glue/plugins.h9
-rw-r--r--sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml2
-rw-r--r--sources/pyside2/PySide2/glue/qtcore.cpp212
-rw-r--r--sources/pyside2/PySide2/glue/qtgui.cpp20
-rw-r--r--sources/pyside2/PySide2/glue/qtmultimedia.cpp3
-rw-r--r--sources/pyside2/PySide2/glue/qtopengl.cpp8
-rw-r--r--sources/pyside2/PySide2/glue/qtscript.cpp2
-rw-r--r--sources/pyside2/PySide2/glue/qtuitools.cpp14
-rw-r--r--sources/pyside2/PySide2/glue/qtwebkitwidgets.cpp4
-rw-r--r--sources/pyside2/PySide2/glue/qtwidgets.cpp201
-rw-r--r--sources/pyside2/PySide2/glue/qtxml.cpp4
-rw-r--r--sources/pyside2/PySide2/glue/qtxmlpatterns.cpp4
-rw-r--r--sources/pyside2/PySide2/pysideqtesttouch.h22
-rw-r--r--sources/pyside2/PySide2/qpytextobject.h7
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/accessibilityfactorysnippet.cpp77
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/accessibilitypluginsnippet.cpp84
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/brush/brush.cpp96
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/brush/gradientcreationsnippet.cpp72
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/brushstyles/main.cpp61
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/brushstyles/renderarea.cpp88
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/brushstyles/stylewidget.cpp154
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/buffer/buffer.cpp133
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/clipboard/main.cpp62
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/code/src_corelib_global_qglobal.cpp514
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/code/src_gui_dialogs_qmessagebox.cpp152
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/code/src_gui_text_qtextdocument.cpp60
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/code/src_sql_kernel_qsqldatabase.cpp146
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/coordsys/coordsys.cpp86
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/customstyle/customstyle.cpp98
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/customstyle/main.cpp64
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/customviewstyle.cpp79
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/designer/autoconnection/imagedialog.cpp79
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/designer/autoconnection/main.cpp61
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/designer/imagedialog/main.cpp63
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/designer/multipleinheritance/imagedialog.cpp69
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/designer/multipleinheritance/main.cpp61
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/designer/noautoconnection/imagedialog.cpp86
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/designer/noautoconnection/main.cpp61
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/designer/singleinheritance/imagedialog.cpp69
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/designer/singleinheritance/main.cpp61
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/dockwidgets/main.cpp62
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/dockwidgets/mainwindow.cpp131
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/draganddrop/dragwidget.cpp163
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/draganddrop/main.cpp63
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/draganddrop/mainwindow.cpp94
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/dragging/main.cpp61
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/dropactions/main.cpp61
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/dropactions/window.cpp115
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/dropevents/main.cpp62
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/dropevents/window.cpp97
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/droprectangle/main.cpp61
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/droprectangle/window.cpp106
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/eventfilters/filterobject.cpp84
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/eventfilters/main.cpp64
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/events/events.cpp107
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/explicitlysharedemployee/employee.cpp119
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/explicitlysharedemployee/main.cpp60
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/file/file.cpp130
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/filedialogurls.cpp71
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/fileinfo/main.cpp102
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/graphicssceneadditemsnippet.cpp90
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/i18n-non-qt-class/main.cpp64
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/i18n-non-qt-class/myclass.cpp57
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/inherited-slot/button.cpp63
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/inherited-slot/main.cpp76
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/itemselection/main.cpp125
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/javastyle.cpp2755
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/moc/main.cpp75
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/modelview-subclasses/main.cpp78
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/modelview-subclasses/model.cpp162
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/modelview-subclasses/view.cpp324
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/modelview-subclasses/window.cpp122
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/painterpath/painterpath.cpp86
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/persistentindexes/main.cpp61
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/persistentindexes/mainwindow.cpp130
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/plaintextlayout/main.cpp62
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/plaintextlayout/window.cpp118
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/pointer/pointer.cpp70
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/porting4-dropevents/main.cpp62
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/porting4-dropevents/window.cpp134
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/printing-qprinter/main.cpp63
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/printing-qprinter/object.cpp81
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/process/process.cpp86
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qcalendarwidget/main.cpp74
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qcolumnview/main.cpp89
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qdebug/qdebugsnippet.cpp83
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qdir-filepaths/main.cpp64
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qelapsedtimer/main.cpp119
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qgl-namespace/main.cpp56
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qlabel/main.cpp98
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qlineargradient/main.cpp60
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qlineargradient/paintwidget.cpp77
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qlistview-dnd/main.cpp61
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qlistview-dnd/mainwindow.cpp93
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qlistview-dnd/model.cpp161
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qlistview-using/main.cpp61
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qlistview-using/mainwindow.cpp147
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qlistwidget-dnd/main.cpp61
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qlistwidget-dnd/mainwindow.cpp97
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qlistwidget-using/main.cpp61
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qlistwidget-using/mainwindow.cpp168
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qmetaobject-invokable/main.cpp62
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qmetaobject-invokable/window.cpp67
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qprocess-environment/main.cpp88
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qprocess/qprocess-simpleexecution.cpp75
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qsignalmapper/buttonwidget.cpp77
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qsignalmapper/main.cpp71
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qsortfilterproxymodel/main.cpp87
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qsplashscreen/mainwindow.cpp60
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qsql-namespace/main.cpp56
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qstack/main.cpp65
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qstackedlayout/main.cpp99
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qstandarditemmodel/main.cpp81
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qstringlistmodel/main.cpp78
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qstyleplugin/main.cpp107
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qsvgwidget/main.cpp69
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qt-namespace/main.cpp56
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qtablewidget-dnd/main.cpp61
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qtablewidget-dnd/mainwindow.cpp153
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qtablewidget-resizing/main.cpp61
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qtablewidget-resizing/mainwindow.cpp124
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qtablewidget-using/main.cpp61
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qtablewidget-using/mainwindow.cpp159
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qtcast/qtcast.cpp89
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qtest-namespace/main.cpp57
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qtreeview-dnd/main.cpp61
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qtreeview-dnd/mainwindow.cpp100
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qtreeview-dnd/treeitem.cpp135
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qtreeview-dnd/treemodel.cpp272
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qtreewidget-using/main.cpp61
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qtreewidgetitemiterator-using/main.cpp61
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qtscript/evaluation/main.cpp60
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qtscript/registeringobjects/main.cpp66
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qtscript/registeringobjects/myobject.cpp63
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qtscript/registeringvalues/main.cpp62
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qtscript/scriptedslot/main.cpp82
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/quiloader/main.cpp77
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/quiloader/mywidget.cpp69
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qx11embedcontainer/main.cpp77
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qx11embedwidget/embedwidget.cpp76
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qx11embedwidget/main.cpp71
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qxmlschema/main.cpp124
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/qxmlstreamwriter/main.cpp86
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/reading-selections/main.cpp69
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/reading-selections/window.cpp130
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/scribe-overview/main.cpp81
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/scriptdebugger.cpp113
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/separations/finalwidget.cpp136
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/separations/main.cpp60
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/separations/screenwidget.cpp227
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/separations/viewer.cpp338
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/settings/settings.cpp188
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/sharedemployee/employee.cpp51
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/sharedemployee/main.cpp60
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/sharedtablemodel/main.cpp99
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/signalmapper/filereader.cpp109
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/signalmapper/main.cpp63
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/signalsandslots/lcdnumber.cpp87
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/signalsandslots/signalsandslots.cpp94
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/simplemodel-use/main.cpp103
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/simpleparse/handler.cpp148
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/simpleparse/main.cpp97
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/splitterhandle/main.cpp67
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/splitterhandle/splitter.cpp88
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/streaming/main.cpp118
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/stringlistmodel/main.cpp89
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/textblock-formats/main.cpp128
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/textblock-fragments/main.cpp62
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/textblock-fragments/mainwindow.cpp158
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/textblock-fragments/xmlwriter.cpp128
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-blocks/main.cpp62
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-blocks/mainwindow.cpp166
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-blocks/xmlwriter.cpp94
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-charformats/main.cpp102
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-cursors/main.cpp89
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-find/main.cpp101
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-frames/main.cpp63
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-frames/mainwindow.cpp171
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-frames/xmlwriter.cpp126
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-imagedrop/main.cpp62
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-imagedrop/textedit.cpp81
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-imageformat/main.cpp108
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-images/main.cpp82
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-listitems/main.cpp62
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-listitems/mainwindow.cpp207
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-lists/main.cpp62
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-lists/mainwindow.cpp201
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-printing/main.cpp62
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-printing/mainwindow.cpp134
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-selections/main.cpp62
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-selections/mainwindow.cpp213
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-tables/main.cpp62
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-tables/xmlwriter.cpp163
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/textdocumentendsnippet.cpp68
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/threads/threads.cpp130
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/timeline/main.cpp82
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/uitools/calculatorform/main.cpp67
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/updating-selections/main.cpp69
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/updating-selections/window.cpp119
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/webkit/webpage/main.cpp93
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/widget-mask/main.cpp64
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/widgets-tutorial/childwidget/main.cpp67
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/widgets-tutorial/nestedlayouts/main.cpp98
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/widgets-tutorial/toplevel/main.cpp63
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/widgets-tutorial/windowlayout/main.cpp69
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/xml/rsslisting/handler.cpp188
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/xml/rsslisting/main.cpp73
-rw-r--r--sources/pyside2/doc/codesnippets/doc/src/snippets/xml/rsslisting/rsslisting.cpp255
-rw-r--r--sources/pyside2/doc/codesnippets/examples/dialogs/classwizard/main.cpp73
-rw-r--r--sources/pyside2/doc/codesnippets/examples/dialogs/licensewizard/licensewizard.cpp358
-rw-r--r--sources/pyside2/doc/codesnippets/examples/dialogs/licensewizard/main.cpp73
-rw-r--r--sources/pyside2/doc/codesnippets/examples/dialogs/trivialwizard/trivialwizard.cpp143
-rw-r--r--sources/pyside2/doc/codesnippets/examples/itemviews/simpledommodel/dommodel.cpp197
-rw-r--r--sources/pyside2/doc/codesnippets/examples/linguist/hellotr/main.cpp78
-rw-r--r--sources/pyside2/doc/codesnippets/examples/sql/querymodel/editablesqlmodel.cpp112
-rw-r--r--sources/pyside2/doc/codesnippets/examples/svggenerator/window.cpp107
-rw-r--r--sources/pyside2/doc/codesnippets/examples/uitools/textfinder/textfinder.cpp141
-rw-r--r--sources/pyside2/doc/codesnippets/examples/widgets/analogclock/analogclock.cpp155
-rw-r--r--sources/pyside2/doc/codesnippets/examples/xml/streambookmarks/xbelreader.cpp210
-rw-r--r--sources/pyside2/doc/codesnippets/examples/xml/streambookmarks/xbelwriter.cpp100
-rw-r--r--sources/pyside2/doc/codesnippets/snippets/textdocument-resources/main.cpp93
-rw-r--r--sources/pyside2/doc/deployment.rst51
-rw-r--r--sources/pyside2/doc/tutorials/basictutorial/qml.rst2
-rw-r--r--sources/pyside2/doc/tutorials/basictutorial/widgets.rst3
-rw-r--r--sources/pyside2/doc/tutorials/datavisualize/index.rst8
-rw-r--r--sources/pyside2/doc/tutorials/qmlapp/qmlapplication.rst3
-rw-r--r--sources/pyside2/libpyside/destroylistener.cpp12
-rw-r--r--sources/pyside2/libpyside/destroylistener.h10
-rw-r--r--sources/pyside2/libpyside/dynamicqmetaobject_p.h22
-rw-r--r--sources/pyside2/libpyside/globalreceiverv2.cpp52
-rw-r--r--sources/pyside2/libpyside/globalreceiverv2.h16
-rw-r--r--sources/pyside2/libpyside/pyside.cpp88
-rw-r--r--sources/pyside2/libpyside/pyside.h20
-rw-r--r--sources/pyside2/libpyside/pysideclassinfo.cpp36
-rw-r--r--sources/pyside2/libpyside/pysidemetafunction.cpp30
-rw-r--r--sources/pyside2/libpyside/pysidemetafunction.h4
-rw-r--r--sources/pyside2/libpyside/pysidemetafunction_p.h4
-rw-r--r--sources/pyside2/libpyside/pysideproperty.cpp127
-rw-r--r--sources/pyside2/libpyside/pysideqflags.cpp26
-rw-r--r--sources/pyside2/libpyside/pysidesignal.cpp224
-rw-r--r--sources/pyside2/libpyside/pysideslot.cpp24
-rw-r--r--sources/pyside2/libpyside/pysideweakref.cpp14
-rw-r--r--sources/pyside2/libpyside/signalmanager.cpp132
-rw-r--r--sources/pyside2/plugins/customwidget.cpp20
-rw-r--r--sources/pyside2/plugins/customwidgets.cpp11
-rw-r--r--sources/pyside2/tests/QtCore/qmetaobject_test.py2
-rw-r--r--sources/pyside2/tests/QtCore/qobject_connect_notify_test.py2
-rw-r--r--sources/pyside2/tests/QtCore/qslot_object_test.py6
-rw-r--r--sources/pyside2/tests/QtGui/qregion_test.py2
-rw-r--r--sources/pyside2/tests/QtGui/timed_app_test.py2
-rwxr-xr-xsources/pyside2/tests/QtQml/bug_726.py2
-rwxr-xr-xsources/pyside2/tests/QtQml/bug_997.qml2
-rw-r--r--sources/pyside2/tests/QtScript/bug_1022.py2
-rw-r--r--sources/pyside2/tests/QtSvg/tiger.svg2
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_307.py6
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_338.py6
-rw-r--r--sources/pyside2/tests/QtWidgets/bug_688.py48
-rw-r--r--sources/pyside2/tests/QtWidgets/qfontdialog_test.py2
-rw-r--r--sources/pyside2/tests/QtWidgets/qgraphicsitem_isblocked_test.py4
-rw-r--r--sources/pyside2/tests/QtWidgets/reference_count_test.py2
-rw-r--r--sources/pyside2/tests/pysidetest/curr_errors.txt2
-rw-r--r--sources/pyside2/tests/pysidetest/hiddenobject.cpp2
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp171
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h12
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetalang.cpp92
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetalang.h25
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetalang_typedefs.h16
-rw-r--r--sources/shiboken2/ApiExtractor/apiextractor.cpp14
-rw-r--r--sources/shiboken2/ApiExtractor/apiextractor.h10
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp10
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/clangbuilder.h2
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/clangparser.cpp2
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/clangparser.h8
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/clangutils.h10
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp5
-rw-r--r--sources/shiboken2/ApiExtractor/dependency.h2
-rw-r--r--sources/shiboken2/ApiExtractor/docparser.h2
-rw-r--r--sources/shiboken2/ApiExtractor/doxygenparser.h2
-rw-r--r--sources/shiboken2/ApiExtractor/fileout.h2
-rw-r--r--sources/shiboken2/ApiExtractor/graph.cpp12
-rw-r--r--sources/shiboken2/ApiExtractor/graph.h2
-rw-r--r--sources/shiboken2/ApiExtractor/header_paths.h2
-rw-r--r--sources/shiboken2/ApiExtractor/include.h6
-rw-r--r--sources/shiboken2/ApiExtractor/merge.xsl16
-rw-r--r--sources/shiboken2/ApiExtractor/parser/codemodel.cpp43
-rw-r--r--sources/shiboken2/ApiExtractor/parser/codemodel.h24
-rw-r--r--sources/shiboken2/ApiExtractor/parser/codemodel_fwd.h52
-rw-r--r--sources/shiboken2/ApiExtractor/qtdocparser.cpp4
-rw-r--r--sources/shiboken2/ApiExtractor/qtdocparser.h2
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testabstractmetaclass.cpp2
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testconversionoperator.cpp2
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testconversionruletag.cpp6
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testimplicitconversions.cpp2
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testreverseoperators.cpp6
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testutil.h4
-rw-r--r--sources/shiboken2/ApiExtractor/typedatabase.cpp46
-rw-r--r--sources/shiboken2/ApiExtractor/typedatabase.h60
-rw-r--r--sources/shiboken2/ApiExtractor/typedatabase_typedefs.h16
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem.cpp56
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem.h30
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem_p.h2
-rw-r--r--sources/shiboken2/ApiExtractor/typesystem_typedefs.h8
-rw-r--r--sources/shiboken2/generator/generator.cpp72
-rw-r--r--sources/shiboken2/generator/generator.h82
-rw-r--r--sources/shiboken2/generator/main.cpp10
-rw-r--r--sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp39
-rw-r--r--sources/shiboken2/generator/qtdoc/qtdocgenerator.h18
-rw-r--r--sources/shiboken2/generator/shiboken2/cppgenerator.cpp802
-rw-r--r--sources/shiboken2/generator/shiboken2/cppgenerator.h201
-rw-r--r--sources/shiboken2/generator/shiboken2/headergenerator.cpp72
-rw-r--r--sources/shiboken2/generator/shiboken2/headergenerator.h22
-rw-r--r--sources/shiboken2/generator/shiboken2/overloaddata.cpp106
-rw-r--r--sources/shiboken2/generator/shiboken2/overloaddata.h62
-rw-r--r--sources/shiboken2/generator/shiboken2/shibokengenerator.cpp358
-rw-r--r--sources/shiboken2/generator/shiboken2/shibokengenerator.h276
-rw-r--r--sources/shiboken2/libshiboken/autodecref.h28
-rw-r--r--sources/shiboken2/libshiboken/basewrapper.cpp397
-rw-r--r--sources/shiboken2/libshiboken/basewrapper.h154
-rw-r--r--sources/shiboken2/libshiboken/basewrapper_p.h46
-rw-r--r--sources/shiboken2/libshiboken/bindingmanager.cpp114
-rw-r--r--sources/shiboken2/libshiboken/bindingmanager.h34
-rw-r--r--sources/shiboken2/libshiboken/bufferprocs_py37.cpp11
-rw-r--r--sources/shiboken2/libshiboken/debugfreehook.cpp8
-rw-r--r--sources/shiboken2/libshiboken/gilstate.cpp1
-rw-r--r--sources/shiboken2/libshiboken/gilstate.h10
-rw-r--r--sources/shiboken2/libshiboken/helper.cpp35
-rw-r--r--sources/shiboken2/libshiboken/helper.h24
-rw-r--r--sources/shiboken2/libshiboken/pep384_issue33738.cpp2
-rw-r--r--sources/shiboken2/libshiboken/pep384impl.cpp22
-rw-r--r--sources/shiboken2/libshiboken/python25compat.h8
-rw-r--r--sources/shiboken2/libshiboken/qapp_macro.cpp26
-rw-r--r--sources/shiboken2/libshiboken/sbkarrayconverter.cpp18
-rw-r--r--sources/shiboken2/libshiboken/sbkarrayconverter.h13
-rw-r--r--sources/shiboken2/libshiboken/sbkarrayconverter_p.h2
-rw-r--r--sources/shiboken2/libshiboken/sbkconverter.cpp102
-rw-r--r--sources/shiboken2/libshiboken/sbkconverter.h150
-rw-r--r--sources/shiboken2/libshiboken/sbkconverter_p.h182
-rw-r--r--sources/shiboken2/libshiboken/sbkdbg.h32
-rw-r--r--sources/shiboken2/libshiboken/sbkenum.cpp195
-rw-r--r--sources/shiboken2/libshiboken/sbkenum.h42
-rw-r--r--sources/shiboken2/libshiboken/sbkmodule.cpp30
-rw-r--r--sources/shiboken2/libshiboken/sbkmodule.h24
-rw-r--r--sources/shiboken2/libshiboken/sbknumpyarrayconverter.cpp14
-rw-r--r--sources/shiboken2/libshiboken/sbkstring.cpp38
-rw-r--r--sources/shiboken2/libshiboken/sbkstring.h24
-rw-r--r--sources/shiboken2/libshiboken/shibokenbuffer.cpp14
-rw-r--r--sources/shiboken2/libshiboken/shibokenbuffer.h8
-rw-r--r--sources/shiboken2/libshiboken/signature.cpp44
-rw-r--r--sources/shiboken2/libshiboken/threadstatesaver.cpp6
-rw-r--r--sources/shiboken2/libshiboken/threadstatesaver.h10
-rw-r--r--sources/shiboken2/libshiboken/tmp-referencetopython/sbkconverter.cpp59
-rw-r--r--sources/shiboken2/libshiboken/tmp-referencetopython/sbkconverter.h46
-rw-r--r--sources/shiboken2/libshiboken/typespec.cpp15
-rw-r--r--sources/shiboken2/libshiboken/typespec.h8
-rw-r--r--sources/shiboken2/libshiboken/voidptr.cpp78
-rw-r--r--sources/shiboken2/tests/libminimal/typedef.h4
-rw-r--r--sources/shiboken2/tests/libother/otherderived.cpp2
-rw-r--r--sources/shiboken2/tests/libother/othermultiplederived.cpp2
-rw-r--r--sources/shiboken2/tests/libsample/abstract.cpp2
-rw-r--r--sources/shiboken2/tests/libsample/abstract.h2
-rw-r--r--sources/shiboken2/tests/libsample/blackbox.cpp6
-rw-r--r--sources/shiboken2/tests/libsample/derived.cpp4
-rw-r--r--sources/shiboken2/tests/libsample/expression.cpp12
-rw-r--r--sources/shiboken2/tests/libsample/functions.cpp6
-rw-r--r--sources/shiboken2/tests/libsample/handle.h8
-rw-r--r--sources/shiboken2/tests/libsample/listuser.h2
-rw-r--r--sources/shiboken2/tests/libsample/modifications.h2
-rw-r--r--sources/shiboken2/tests/libsample/objectmodel.h4
-rw-r--r--sources/shiboken2/tests/libsample/objecttype.cpp16
-rw-r--r--sources/shiboken2/tests/libsample/objecttype.h4
-rw-r--r--sources/shiboken2/tests/libsample/objectview.h2
-rw-r--r--sources/shiboken2/tests/libsample/overload.h2
-rw-r--r--sources/shiboken2/tests/libsample/photon.h6
-rw-r--r--sources/shiboken2/tests/libsample/polygon.h2
-rw-r--r--sources/shiboken2/tests/libsample/protected.h6
-rw-r--r--sources/shiboken2/tests/libsample/samplenamespace.cpp2
-rw-r--r--sources/shiboken2/tests/libsample/samplenamespace.h10
-rw-r--r--sources/shiboken2/tests/libsample/simplefile.cpp6
-rw-r--r--sources/shiboken2/tests/libsample/size.h4
-rw-r--r--sources/shiboken2/tests/libsample/sometime.h2
-rw-r--r--sources/shiboken2/tests/libsample/str.h6
-rw-r--r--sources/shiboken2/tests/libsample/strlist.h2
-rw-r--r--sources/shiboken2/tests/libsample/virtualmethods.cpp2
-rw-r--r--sources/shiboken2/tests/libsample/voidholder.h2
-rw-r--r--sources/shiboken2/tests/libsmart/smart.h6
396 files changed, 3393 insertions, 26978 deletions
diff --git a/sources/pyside2/PySide2/QtConcurrent/curr_errors.txt b/sources/pyside2/PySide2/QtConcurrent/curr_errors.txt
index 827ebea5c..d8405c755 100644
--- a/sources/pyside2/PySide2/QtConcurrent/curr_errors.txt
+++ b/sources/pyside2/PySide2/QtConcurrent/curr_errors.txt
@@ -3,7 +3,7 @@ Generating enum model... [OK]
Generating namespace model... [WARNING]
enum 'QtConcurrent::ThreadFunctionResult' does not have a type entry or is not an enum
enum 'QtConcurrent::ReduceQueueThrottleLimit' does not have a type entry or is not an enum
-
+
Resolving typedefs... [OK]
Fixing class inheritance... [OK]
@@ -14,7 +14,7 @@ Done, 2 warnings (506 known issues)
Scanning dependencies of target QtConcurrent
[ 21%] Building CXX object PySide/QtConcurrent/CMakeFiles/QtConcurrent.dir/PySide/QtConcurrent/qtconcurrent_module_wrapper.cpp.o
In file included from /Users/tismer/src/pyside-setup2/pyside_build/py3.4-qt5.4.2-64bit-debug/pyside/PySide/QtConcurrent/PySide/QtConcurrent/qtconcurrent_module_wrapper.cpp:30:
-/Users/tismer/src/pyside-setup2/pyside_build/py3.4-qt5.4.2-64bit-debug/pyside/PySide/QtConcurrent/PySide/QtConcurrent/pyside_qtconcurrent_python.h:44:10: fatal error:
+/Users/tismer/src/pyside-setup2/pyside_build/py3.4-qt5.4.2-64bit-debug/pyside/PySide/QtConcurrent/PySide/QtConcurrent/pyside_qtconcurrent_python.h:44:10: fatal error:
'qtconcurrentexception.h' file not found
#include <qtconcurrentexception.h>
^
diff --git a/sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.cpp b/sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.cpp
index 46a69be31..6629d3c91 100644
--- a/sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.cpp
+++ b/sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.cpp
@@ -47,13 +47,13 @@
#define __ECF_ATT_NAME__ "__ecf__"
#define MAX_CUSTOM_FUNCTIONS 10
-static void deleteData(void* data);
+static void deleteData(void *data);
struct CustomFunctionsData
{
static CustomFunctionsData m_list[MAX_CUSTOM_FUNCTIONS];
- PySideEasingCurveFunctor* m_obj;
+ PySideEasingCurveFunctor *m_obj;
QEasingCurve::EasingFunction m_func;
};
@@ -95,9 +95,9 @@ struct CustomFunctions<0>
}
};
-void deleteData(void* data)
+void deleteData(void *data)
{
- delete (PySideEasingCurveFunctor*)(data);
+ delete (PySideEasingCurveFunctor *)(data);
}
void PySideEasingCurveFunctor::init()
@@ -105,10 +105,10 @@ void PySideEasingCurveFunctor::init()
CustomFunctions<MAX_CUSTOM_FUNCTIONS-1>::init();
}
-QEasingCurve::EasingFunction PySideEasingCurveFunctor::createCustomFuntion(PyObject* parent, PyObject* pyFunc)
+QEasingCurve::EasingFunction PySideEasingCurveFunctor::createCustomFuntion(PyObject *parent, PyObject *pyFunc)
{
for(int i=0; i < MAX_CUSTOM_FUNCTIONS; i++) {
- CustomFunctionsData& data = CustomFunctionsData::m_list[i];
+ CustomFunctionsData &data = CustomFunctionsData::m_list[i];
if (data.m_obj == 0) {
data.m_obj = new PySideEasingCurveFunctor(i, parent, pyFunc);
return data.m_func;
@@ -128,8 +128,8 @@ PySideEasingCurveFunctor::~PySideEasingCurveFunctor()
qreal PySideEasingCurveFunctor::operator()(qreal progress)
{
Shiboken::GilState state;
- PyObject* args = Py_BuildValue("(f)", progress);
- PyObject* result = PyObject_CallObject(m_func, args);
+ PyObject *args = Py_BuildValue("(f)", progress);
+ PyObject *result = PyObject_CallObject(m_func, args);
qreal cppResult = 0.0;
if (result) {
Shiboken::Conversions::pythonToCppCopy(Shiboken::Conversions::PrimitiveTypeConverter<qreal>(), result, &cppResult);
@@ -139,18 +139,18 @@ qreal PySideEasingCurveFunctor::operator()(qreal progress)
return cppResult;
}
-PyObject* PySideEasingCurveFunctor::callable()
+PyObject *PySideEasingCurveFunctor::callable()
{
Py_INCREF(m_func);
return m_func;
}
-PyObject* PySideEasingCurveFunctor::callable(PyObject* parent)
+PyObject *PySideEasingCurveFunctor::callable(PyObject *parent)
{
return PyObject_GetAttrString(parent, __ECF_ATT_NAME__);
}
-PySideEasingCurveFunctor::PySideEasingCurveFunctor(int index, PyObject* parent, PyObject* pyFunc)
+PySideEasingCurveFunctor::PySideEasingCurveFunctor(int index, PyObject *parent, PyObject *pyFunc)
: m_parent(parent), m_func(pyFunc), m_index(index)
{
PyObject_SetAttrString(m_parent, __ECF_ATT_NAME__, m_func);
diff --git a/sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.h b/sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.h
index 358ea9eec..f6c80fa99 100644
--- a/sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.h
+++ b/sources/pyside2/PySide2/QtCore/glue/qeasingcurve_glue.h
@@ -38,7 +38,7 @@
****************************************************************************/
#ifndef __QEASINGCURVE_GLUE__
-#define __QEASINGCURVE_GLUE__
+#define __QEASINGCURVE_GLUE__
#include <sbkpython.h>
#include <QEasingCurve>
@@ -47,20 +47,20 @@ class PySideEasingCurveFunctor
{
public:
static void init();
- static QEasingCurve::EasingFunction createCustomFuntion(PyObject* parent, PyObject* pyFunc);
+ static QEasingCurve::EasingFunction createCustomFuntion(PyObject *parent, PyObject *pyFunc);
qreal operator()(qreal progress);
- PyObject* callable(); //Return New reference
- static PyObject* callable(PyObject* parent); //Return New reference
+ PyObject *callable(); //Return New reference
+ static PyObject *callable(PyObject *parent); //Return New reference
~PySideEasingCurveFunctor();
private:
- PyObject* m_parent;
- PyObject* m_func;
+ PyObject *m_parent;
+ PyObject *m_func;
int m_index;
- PySideEasingCurveFunctor(int index, PyObject* parent, PyObject *pyFunc);
+ PySideEasingCurveFunctor(int index, PyObject *parent, PyObject *pyFunc);
};
#endif
diff --git a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
index ef8b1b4c5..58db97aa8 100644
--- a/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
+++ b/sources/pyside2/PySide2/QtCore/typesystem_core_common.xml
@@ -303,8 +303,6 @@
</conversion-rule>
</primitive-type>
- <primitive-type name="QVariantMap" target-lang-api-name="PyDict"/>
- <inject-code class="target" position="end" file="../glue/qtcore.cpp" snippet="qvariantmap-register"/>
<inject-code class="native" position="beginning" file="../glue/qtcore.cpp" snippet="qvariantmap-check"/>
<primitive-type name="QStringList">
<include file-name="QStringList" location="global"/>
diff --git a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
index b42391148..95b85a918 100644
--- a/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
+++ b/sources/pyside2/PySide2/QtGui/typesystem_gui_common.xml
@@ -903,7 +903,7 @@
<!-- get* methods. Inject code -->
<modify-function signature="getCmyk(int*,int*,int*,int*,int*)">
<modify-argument index="0">
- <replace-type modified-type="PyObject *"/>
+ <replace-type modified-type="PyObject*"/>
</modify-argument>
<modify-argument index="1">
<remove-argument/>
@@ -930,7 +930,7 @@
</modify-function>
<modify-function signature="getCmykF(qreal*,qreal*,qreal*,qreal*,qreal*)">
<modify-argument index="0">
- <replace-type modified-type="PyObject *"/>
+ <replace-type modified-type="PyObject*"/>
</modify-argument>
<modify-argument index="1">
<remove-argument/>
@@ -957,7 +957,7 @@
</modify-function>
<modify-function signature="getHsl(int*,int*,int*,int*)const" since="4.6">
<modify-argument index="0">
- <replace-type modified-type="PyObject *"/>
+ <replace-type modified-type="PyObject*"/>
</modify-argument>
<modify-argument index="1">
<remove-argument/>
@@ -980,7 +980,7 @@
</modify-function>
<modify-function signature="getHslF(qreal*,qreal*,qreal*,qreal*)const" since="4.6">
<modify-argument index="0">
- <replace-type modified-type="PyObject *"/>
+ <replace-type modified-type="PyObject*"/>
</modify-argument>
<modify-argument index="1">
<remove-argument/>
@@ -1003,7 +1003,7 @@
</modify-function>
<modify-function signature="getHsv(int*,int*,int*,int*)const">
<modify-argument index="0">
- <replace-type modified-type="PyObject *"/>
+ <replace-type modified-type="PyObject*"/>
</modify-argument>
<modify-argument index="1">
<remove-argument/>
@@ -1026,7 +1026,7 @@
</modify-function>
<modify-function signature="getHsvF(qreal*,qreal*,qreal*,qreal*)const">
<modify-argument index="0">
- <replace-type modified-type="PyObject *"/>
+ <replace-type modified-type="PyObject*"/>
</modify-argument>
<modify-argument index="1">
<remove-argument/>
@@ -1049,7 +1049,7 @@
</modify-function>
<modify-function signature="getRgb(int*,int*,int*,int*)const">
<modify-argument index="0">
- <replace-type modified-type="PyObject *"/>
+ <replace-type modified-type="PyObject*"/>
</modify-argument>
<modify-argument index="1">
<remove-argument/>
@@ -1072,7 +1072,7 @@
</modify-function>
<modify-function signature="getRgbF(qreal*,qreal*,qreal*,qreal*)const">
<modify-argument index="0">
- <replace-type modified-type="PyObject *"/>
+ <replace-type modified-type="PyObject*"/>
</modify-argument>
<modify-argument index="1">
<remove-argument/>
diff --git a/sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml b/sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml
index 2e69f98e0..f7ac67857 100644
--- a/sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml
+++ b/sources/pyside2/PySide2/QtMultimedia/typesystem_multimedia_common.xml
@@ -177,13 +177,13 @@
<enum-type name="Status"/>
<modify-function signature="setViewfinder(QVideoWidget*)">
<modify-argument index="1">
- <replace-type modified-type="QObject *"/>
+ <replace-type modified-type="QObject*"/>
</modify-argument>
<inject-code class="target" position="beginning" file="../glue/qtmultimedia.cpp" snippet="upcast"/>
</modify-function>
<modify-function signature="setViewfinder(QGraphicsVideoItem*)">
<modify-argument index="1">
- <replace-type modified-type="QObject *"/>
+ <replace-type modified-type="QObject*"/>
</modify-argument>
<inject-code class="target" position="beginning" file="../glue/qtmultimedia.cpp" snippet="upcast"/>
</modify-function>
@@ -272,13 +272,13 @@
<enum-type name="Error"/>
<modify-function signature="setVideoOutput(QVideoWidget*)">
<modify-argument index="1">
- <replace-type modified-type="QObject *"/>
+ <replace-type modified-type="QObject*"/>
</modify-argument>
<inject-code class="target" position="beginning" file="../glue/qtmultimedia.cpp" snippet="upcast"/>
</modify-function>
<modify-function signature="setVideoOutput(QGraphicsVideoItem*)">
<modify-argument index="1">
- <replace-type modified-type="QObject *"/>
+ <replace-type modified-type="QObject*"/>
</modify-argument>
<inject-code class="target" position="beginning" file="../glue/qtmultimedia.cpp" snippet="upcast"/>
</modify-function>
diff --git a/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.cpp b/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.cpp
index 9d9ddc799..2386620ca 100644
--- a/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.cpp
+++ b/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.cpp
@@ -54,19 +54,19 @@
#ifndef PYSIDE_MAX_QML_TYPES
// Maximum number of different Qt QML types the user can export to QML using
// qmlRegisterType. This limit exists because the QML engine instantiates objects
-// by calling a function with one argument (a void* pointer where the object should
+// by calling a function with one argument (a void *pointer where the object should
// be created), and thus does not allow us to choose which object to create. Thus
// we create a C++ factory function for each new registered type at compile time.
#define PYSIDE_MAX_QML_TYPES 50
#endif
// Forward declarations.
-static void propListMetaCall(PySideProperty* pp, PyObject* self, QMetaObject::Call call,
+static void propListMetaCall(PySideProperty *pp, PyObject *self, QMetaObject::Call call,
void **args);
// All registered python types and their creation functions.
-static PyObject* pyTypes[PYSIDE_MAX_QML_TYPES];
-static void (*createFuncs[PYSIDE_MAX_QML_TYPES])(void*);
+static PyObject *pyTypes[PYSIDE_MAX_QML_TYPES];
+static void (*createFuncs[PYSIDE_MAX_QML_TYPES])(void *);
// Mutex used to avoid race condition on PySide::nextQObjectMemoryAddr.
static QMutex nextQmlElementMutex;
@@ -74,12 +74,12 @@ static QMutex nextQmlElementMutex;
template<int N>
struct ElementFactoryBase
{
- static void createInto(void* memory)
+ static void createInto(void *memory)
{
QMutexLocker locker(&nextQmlElementMutex);
PySide::setNextQObjectMemoryAddr(memory);
Shiboken::GilState state;
- PyObject* obj = PyObject_CallObject(pyTypes[N], 0);
+ PyObject *obj = PyObject_CallObject(pyTypes[N], 0);
if (!obj || PyErr_Occurred())
PyErr_Print();
PySide::setNextQObjectMemoryAddr(0);
@@ -152,7 +152,7 @@ int PySide::qmlRegisterType(PyObject *pyObj, const char *uri, int versionMajor,
pyTypes[nextType] = pyObj;
// FIXME: Fix this to assign new type ids each time.
- type.typeId = qMetaTypeId<QObject*>();
+ type.typeId = qMetaTypeId<QObject *>();
type.listId = qMetaTypeId<QQmlListProperty<QObject> >();
type.attachedPropertiesFunction = QQmlPrivate::attachedPropertiesFunc<QObject>();
type.attachedPropertiesMetaObject = QQmlPrivate::attachedPropertiesMetaObject<QObject>();
@@ -194,22 +194,22 @@ extern "C"
// This is the user data we store in the property.
struct QmlListProperty
{
- PyTypeObject* type;
- PyObject* append;
- PyObject* at;
- PyObject* clear;
- PyObject* count;
+ PyTypeObject *type;
+ PyObject *append;
+ PyObject *at;
+ PyObject *clear;
+ PyObject *count;
};
-static int propListTpInit(PyObject* self, PyObject* args, PyObject* kwds)
+static int propListTpInit(PyObject *self, PyObject *args, PyObject *kwds)
{
static const char *kwlist[] = {"type", "append", "at", "clear", "count", 0};
- PySideProperty* pySelf = reinterpret_cast<PySideProperty*>(self);
- QmlListProperty* data = new QmlListProperty;
+ PySideProperty *pySelf = reinterpret_cast<PySideProperty *>(self);
+ QmlListProperty *data = new QmlListProperty;
memset(data, 0, sizeof(QmlListProperty));
if (!PyArg_ParseTupleAndKeywords(args, kwds,
- "OO|OOO:QtQml.ListProperty", (char**) kwlist,
+ "OO|OOO:QtQml.ListProperty", (char **) kwlist,
&data->type,
&data->append,
&data->at,
@@ -224,10 +224,10 @@ static int propListTpInit(PyObject* self, PyObject* args, PyObject* kwds)
return 1;
}
-void propListTpFree(void* self)
+void propListTpFree(void *self)
{
- PySideProperty* pySelf = reinterpret_cast<PySideProperty*>(self);
- delete reinterpret_cast<QmlListProperty*>(PySide::Property::userData(pySelf));
+ auto pySelf = reinterpret_cast<PySideProperty *>(self);
+ delete reinterpret_cast<QmlListProperty *>(PySide::Property::userData(pySelf));
// calls base type constructor
Py_TYPE(pySelf)->tp_base->tp_free(self);
}
@@ -266,10 +266,10 @@ void propListAppender(QQmlListProperty<QObject> *propList, QObject *item)
Shiboken::GilState state;
Shiboken::AutoDecRef args(PyTuple_New(2));
- PyTuple_SET_ITEM(args, 0, Shiboken::Conversions::pointerToPython((SbkObjectType*)SbkPySide2_QtCoreTypes[SBK_QOBJECT_IDX], propList->object));
- PyTuple_SET_ITEM(args, 1, Shiboken::Conversions::pointerToPython((SbkObjectType*)SbkPySide2_QtCoreTypes[SBK_QOBJECT_IDX], item));
+ PyTuple_SET_ITEM(args, 0, Shiboken::Conversions::pointerToPython((SbkObjectType *)SbkPySide2_QtCoreTypes[SBK_QOBJECT_IDX], propList->object));
+ PyTuple_SET_ITEM(args, 1, Shiboken::Conversions::pointerToPython((SbkObjectType *)SbkPySide2_QtCoreTypes[SBK_QOBJECT_IDX], item));
- QmlListProperty* data = reinterpret_cast<QmlListProperty*>(propList->data);
+ auto data = reinterpret_cast<QmlListProperty *>(propList->data);
Shiboken::AutoDecRef retVal(PyObject_CallObject(data->append, args));
if (PyErr_Occurred())
@@ -282,9 +282,9 @@ int propListCount(QQmlListProperty<QObject> *propList)
Shiboken::GilState state;
Shiboken::AutoDecRef args(PyTuple_New(1));
- PyTuple_SET_ITEM(args, 0, Shiboken::Conversions::pointerToPython((SbkObjectType*)SbkPySide2_QtCoreTypes[SBK_QOBJECT_IDX], propList->object));
+ PyTuple_SET_ITEM(args, 0, Shiboken::Conversions::pointerToPython((SbkObjectType *)SbkPySide2_QtCoreTypes[SBK_QOBJECT_IDX], propList->object));
- QmlListProperty* data = reinterpret_cast<QmlListProperty*>(propList->data);
+ auto data = reinterpret_cast<QmlListProperty *>(propList->data);
Shiboken::AutoDecRef retVal(PyObject_CallObject(data->count, args));
// Check return type
@@ -303,17 +303,17 @@ QObject *propListAt(QQmlListProperty<QObject> *propList, int index)
Shiboken::GilState state;
Shiboken::AutoDecRef args(PyTuple_New(2));
- PyTuple_SET_ITEM(args, 0, Shiboken::Conversions::pointerToPython((SbkObjectType*)SbkPySide2_QtCoreTypes[SBK_QOBJECT_IDX], propList->object));
+ PyTuple_SET_ITEM(args, 0, Shiboken::Conversions::pointerToPython((SbkObjectType *)SbkPySide2_QtCoreTypes[SBK_QOBJECT_IDX], propList->object));
PyTuple_SET_ITEM(args, 1, Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<int>(), &index));
- QmlListProperty* data = reinterpret_cast<QmlListProperty*>(propList->data);
+ auto data = reinterpret_cast<QmlListProperty *>(propList->data);
Shiboken::AutoDecRef retVal(PyObject_CallObject(data->at, args));
QObject *result = 0;
if (PyErr_Occurred())
PyErr_Print();
else if (PyType_IsSubtype(Py_TYPE(retVal), data->type))
- Shiboken::Conversions::pythonToCppPointer((SbkObjectType*)SbkPySide2_QtCoreTypes[SBK_QOBJECT_IDX], retVal, &result);
+ Shiboken::Conversions::pythonToCppPointer((SbkObjectType *)SbkPySide2_QtCoreTypes[SBK_QOBJECT_IDX], retVal, &result);
return result;
}
@@ -323,9 +323,9 @@ void propListClear(QQmlListProperty<QObject> * propList)
Shiboken::GilState state;
Shiboken::AutoDecRef args(PyTuple_New(1));
- PyTuple_SET_ITEM(args, 0, Shiboken::Conversions::pointerToPython((SbkObjectType*)SbkPySide2_QtCoreTypes[SBK_QOBJECT_IDX], propList->object));
+ PyTuple_SET_ITEM(args, 0, Shiboken::Conversions::pointerToPython((SbkObjectType *)SbkPySide2_QtCoreTypes[SBK_QOBJECT_IDX], propList->object));
- QmlListProperty* data = reinterpret_cast<QmlListProperty*>(propList->data);
+ auto data = reinterpret_cast<QmlListProperty *>(propList->data);
Shiboken::AutoDecRef retVal(PyObject_CallObject(data->clear, args));
if (PyErr_Occurred())
@@ -333,18 +333,18 @@ void propListClear(QQmlListProperty<QObject> * propList)
}
// qt_metacall specialization for ListProperties
-static void propListMetaCall(PySideProperty* pp, PyObject* self, QMetaObject::Call call, void** args)
+static void propListMetaCall(PySideProperty *pp, PyObject *self, QMetaObject::Call call, void **args)
{
if (call != QMetaObject::ReadProperty)
return;
- QmlListProperty* data = reinterpret_cast<QmlListProperty*>(PySide::Property::userData(pp));
- QObject* qobj;
- Shiboken::Conversions::pythonToCppPointer((SbkObjectType*)SbkPySide2_QtCoreTypes[SBK_QOBJECT_IDX], self, &qobj);
+ auto data = reinterpret_cast<QmlListProperty *>(PySide::Property::userData(pp));
+ QObject *qobj;
+ Shiboken::Conversions::pythonToCppPointer((SbkObjectType *)SbkPySide2_QtCoreTypes[SBK_QOBJECT_IDX], self, &qobj);
QQmlListProperty<QObject> declProp(qobj, data, &propListAppender, &propListCount, &propListAt, &propListClear);
// Copy the data to the memory location requested by the meta call
- void* v = args[0];
+ void *v = args[0];
*reinterpret_cast<QQmlListProperty<QObject> *>(v) = declProp;
}
@@ -469,7 +469,7 @@ PyTypeObject *QtQml_VolatileBoolTypeF(void)
return type;
}
-void PySide::initQmlSupport(PyObject* module)
+void PySide::initQmlSupport(PyObject *module)
{
ElementFactory<PYSIDE_MAX_QML_TYPES - 1>::init();
diff --git a/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.h b/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.h
index 0ef6539a5..e94ea043f 100644
--- a/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.h
+++ b/sources/pyside2/PySide2/QtQml/pysideqmlregistertype.h
@@ -47,7 +47,7 @@ struct SbkObjectType;
namespace PySide
{
-extern void* nextQmlElementMemoryAddr;
+extern void *nextQmlElementMemoryAddr;
/**
* Init the QML support doing things like registering QtQml.ListProperty and create the necessary stuff for
@@ -55,7 +55,7 @@ extern void* nextQmlElementMemoryAddr;
*
* \param module QtQml python module
*/
-void initQmlSupport(PyObject* module);
+void initQmlSupport(PyObject *module);
/**
* PySide implementation of qmlRegisterType<T> function.
diff --git a/sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp b/sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp
index e50b1dfc7..a042ac2cc 100644
--- a/sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp
+++ b/sources/pyside2/PySide2/QtQuick/pysidequickregistertype.cpp
@@ -62,7 +62,7 @@
// All registered python types and their creation functions.
static PyObject *pyTypes[PYSIDE_MAX_QUICK_TYPES];
-static void (*createFuncs[PYSIDE_MAX_QUICK_TYPES])(void*);
+static void (*createFuncs[PYSIDE_MAX_QUICK_TYPES])(void *);
// Mutex used to avoid race condition on PySide::nextQObjectMemoryAddr.
static QMutex nextQmlElementMutex;
@@ -154,7 +154,7 @@ void registerTypeIfInheritsFromClass(
sizeof(QQmlListProperty<WrapperClass>),
static_cast< ::QFlags<QMetaType::TypeFlag> >(
QtPrivate::QMetaTypeTypeFlags<QQmlListProperty<WrapperClass> >::Flags),
- static_cast<QMetaObject*>(0));
+ nullptr);
if (lstType == -1) {
PyErr_Format(PyExc_TypeError, "Meta type registration of \"%s\" for QML usage failed.",
typeListName.constData());
diff --git a/sources/pyside2/PySide2/QtQuickWidgets/typesystem_quickwidgets.xml b/sources/pyside2/PySide2/QtQuickWidgets/typesystem_quickwidgets.xml
index b77e06573..b272eec19 100644
--- a/sources/pyside2/PySide2/QtQuickWidgets/typesystem_quickwidgets.xml
+++ b/sources/pyside2/PySide2/QtQuickWidgets/typesystem_quickwidgets.xml
@@ -46,7 +46,7 @@
<load-typesystem name="QtQml/typesystem_qml.xml" generate="no"/>
<load-typesystem name="QtWidgets/typesystem_widgets.xml" generate="no"/>
-
+
<object-type name="QQuickWidget">
<enum-type name="ResizeMode"/>
<enum-type name="Status"/>
diff --git a/sources/pyside2/PySide2/QtScript/qscript_value_iterator_glue.cpp b/sources/pyside2/PySide2/QtScript/qscript_value_iterator_glue.cpp
index fd9cd84a3..11dfd19b0 100644
--- a/sources/pyside2/PySide2/QtScript/qscript_value_iterator_glue.cpp
+++ b/sources/pyside2/PySide2/QtScript/qscript_value_iterator_glue.cpp
@@ -1,3 +1,3 @@
%PYARG_0 = Shiboken::Object::newObject(
- reinterpret_cast<SbkObjectType*>(Shiboken::SbkType< ::QScriptValueIterator >()),
+ reinterpret_cast<SbkObjectType *>(Shiboken::SbkType< ::QScriptValueIterator >()),
new QScriptValueIterator(*%CPPSELF), true, true);
diff --git a/sources/pyside2/PySide2/QtUiTools/glue/plugins.h b/sources/pyside2/PySide2/QtUiTools/glue/plugins.h
index d1b250d50..9bfcec6ea 100644
--- a/sources/pyside2/PySide2/QtUiTools/glue/plugins.h
+++ b/sources/pyside2/PySide2/QtUiTools/glue/plugins.h
@@ -43,13 +43,14 @@
#include <QPluginLoader>
#include "customwidgets.h"
-inline void registerCustomWidget(PyObject* obj)
+inline void registerCustomWidget(PyObject *obj)
{
- static PyCustomWidgets* plugin = 0;
+ static PyCustomWidgets *plugin = nullptr;
if (plugin == 0) {
- foreach(QObject* o, QPluginLoader::staticInstances()) {
- plugin = qobject_cast<PyCustomWidgets*>(o);
+ const auto &instances = QPluginLoader::staticInstances();
+ for (QObject *o : instances) {
+ plugin = qobject_cast<PyCustomWidgets *>(o);
if (plugin)
break;
}
diff --git a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml
index 207c3e831..23fb4857e 100644
--- a/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml
+++ b/sources/pyside2/PySide2/QtWidgets/typesystem_widgets_common.xml
@@ -2676,7 +2676,7 @@
<modify-function signature="del()" rename="del_"/>
<modify-function signature="getTextMargins(int*,int*,int*,int*)const">
<modify-argument index="0">
- <replace-type modified-type="PyObject *"/>
+ <replace-type modified-type="PyObject*"/>
</modify-argument>
<modify-argument index="1">
<remove-argument/>
diff --git a/sources/pyside2/PySide2/glue/qtcore.cpp b/sources/pyside2/PySide2/glue/qtcore.cpp
index 9db4e2e82..930ad9349 100644
--- a/sources/pyside2/PySide2/glue/qtcore.cpp
+++ b/sources/pyside2/PySide2/glue/qtcore.cpp
@@ -60,8 +60,8 @@ bool py2kStrCheck(PyObject *obj)
static const char *QVariant_resolveMetaType(PyTypeObject *type, int *typeId)
{
if (PyObject_TypeCheck(type, SbkObjectType_TypeF())) {
- SbkObjectType* sbkType = (SbkObjectType*)type;
- const char* typeName = Shiboken::ObjectType::getOriginalName(sbkType);
+ auto sbkType = reinterpret_cast<SbkObjectType *>(type);
+ const char *typeName = Shiboken::ObjectType::getOriginalName(sbkType);
if (!typeName)
return nullptr;
const bool valueType = '*' != typeName[qstrlen(typeName) - 1];
@@ -105,7 +105,7 @@ static QVariant QVariant_convertToValueList(PyObject *list)
Shiboken::AutoDecRef element(PySequence_GetItem(list, 0));
int typeId;
- const char *typeName = QVariant_resolveMetaType(element.cast<PyTypeObject*>(), &typeId);
+ const char *typeName = QVariant_resolveMetaType(element.cast<PyTypeObject *>(), &typeId);
if (typeName) {
QByteArray listTypeName("QList<");
listTypeName += typeName;
@@ -190,10 +190,6 @@ static QVariant QVariant_convertToVariantList(PyObject *list)
}
// @snippet qvariant-conversion
-// @snippet qvariantmap-register
-Shiboken::Conversions::registerConverterName(SbkPySide2_QtCoreTypeConverters[SBK_QTCORE_QMAP_QSTRING_QVARIANT_IDX], "QVariantMap");
-// @snippet qvariantmap-register
-
// @snippet qvariantmap-check
static bool QVariantType_isStringList(PyObject *list)
{
@@ -220,7 +216,7 @@ double _abs = qAbs(%1);
// @snippet qt-postroutine
namespace PySide {
-static QStack<PyObject*> globalPostRoutineFunctions;
+static QStack<PyObject *> globalPostRoutineFunctions;
void globalPostRoutineCallback()
{
Shiboken::GilState state;
@@ -260,7 +256,7 @@ PyModule_AddStringConstant(module, "__version__", qVersion());
// @snippet qt-version
// @snippet qobject-connect
-static bool isDecorator(PyObject* method, PyObject* self)
+static bool isDecorator(PyObject *method, PyObject *self)
{
Shiboken::AutoDecRef methodName(PyObject_GetAttrString(method, "__name__"));
if (!PyObject_HasAttr(self, methodName))
@@ -269,18 +265,18 @@ static bool isDecorator(PyObject* method, PyObject* self)
return PyMethod_GET_FUNCTION(otherMethod.object()) != PyMethod_GET_FUNCTION(method);
}
-static bool getReceiver(QObject *source, const char* signal, PyObject* callback, QObject** receiver, PyObject** self, QByteArray* callbackSig)
+static bool getReceiver(QObject *source, const char *signal, PyObject *callback, QObject **receiver, PyObject **self, QByteArray *callbackSig)
{
bool forceGlobalReceiver = false;
if (PyMethod_Check(callback)) {
*self = PyMethod_GET_SELF(callback);
- if (%CHECKTYPE[QObject*](*self))
- *receiver = %CONVERTTOCPP[QObject*](*self);
+ if (%CHECKTYPE[QObject *](*self))
+ *receiver = %CONVERTTOCPP[QObject *](*self);
forceGlobalReceiver = isDecorator(callback, *self);
} else if (PyCFunction_Check(callback)) {
*self = PyCFunction_GET_SELF(callback);
- if (*self && %CHECKTYPE[QObject*](*self))
- *receiver = %CONVERTTOCPP[QObject*](*self);
+ if (*self && %CHECKTYPE[QObject *](*self))
+ *receiver = %CONVERTTOCPP[QObject *](*self);
} else if (PyCallable_Check(callback)) {
// Ok, just a callable object
*receiver = nullptr;
@@ -292,14 +288,14 @@ static bool getReceiver(QObject *source, const char* signal, PyObject* callback,
// Check if this callback is a overwrite of a non-virtual Qt slot.
if (!usingGlobalReceiver && receiver && self) {
*callbackSig = PySide::Signal::getCallbackSignature(signal, *receiver, callback, usingGlobalReceiver).toLatin1();
- const QMetaObject* metaObject = (*receiver)->metaObject();
+ const QMetaObject *metaObject = (*receiver)->metaObject();
int slotIndex = metaObject->indexOfSlot(callbackSig->constData());
if (slotIndex != -1 && slotIndex < metaObject->methodOffset() && PyMethod_Check(callback))
usingGlobalReceiver = true;
}
if (usingGlobalReceiver) {
- PySide::SignalManager& signalManager = PySide::SignalManager::instance();
+ PySide::SignalManager &signalManager = PySide::SignalManager::instance();
*receiver = signalManager.globalReceiver(source, callback);
*callbackSig = PySide::Signal::getCallbackSignature(signal, *receiver, callback, usingGlobalReceiver).toLatin1();
}
@@ -307,7 +303,7 @@ static bool getReceiver(QObject *source, const char* signal, PyObject* callback,
return usingGlobalReceiver;
}
-static bool qobjectConnect(QObject* source, const char* signal, QObject* receiver, const char* slot, Qt::ConnectionType type)
+static bool qobjectConnect(QObject *source, const char *signal, QObject *receiver, const char *slot, Qt::ConnectionType type)
{
if (!signal || !slot)
return false;
@@ -329,12 +325,12 @@ static bool qobjectConnect(QObject* source, const char* signal, QObject* receive
return connection;
}
-static bool qobjectConnect(QObject* source, QMetaMethod signal, QObject* receiver, QMetaMethod slot, Qt::ConnectionType type)
+static bool qobjectConnect(QObject *source, QMetaMethod signal, QObject *receiver, QMetaMethod slot, Qt::ConnectionType type)
{
return qobjectConnect(source, signal.methodSignature(), receiver, slot.methodSignature(), type);
}
-static bool qobjectConnectCallback(QObject* source, const char* signal, PyObject* callback, Qt::ConnectionType type)
+static bool qobjectConnectCallback(QObject *source, const char *signal, PyObject *callback, Qt::ConnectionType type)
{
if (!signal || !PySide::Signal::checkQtSignal(signal))
return false;
@@ -344,23 +340,23 @@ static bool qobjectConnectCallback(QObject* source, const char* signal, PyObject
if (signalIndex == -1)
return false;
- PySide::SignalManager& signalManager = PySide::SignalManager::instance();
+ PySide::SignalManager &signalManager = PySide::SignalManager::instance();
// Extract receiver from callback
- QObject* receiver = nullptr;
- PyObject* self = nullptr;
+ QObject *receiver = nullptr;
+ PyObject *self = nullptr;
QByteArray callbackSig;
bool usingGlobalReceiver = getReceiver(source, signal, callback, &receiver, &self, &callbackSig);
if (receiver == nullptr && self == nullptr)
return false;
- const QMetaObject* metaObject = receiver->metaObject();
- const char* slot = callbackSig.constData();
+ const QMetaObject *metaObject = receiver->metaObject();
+ const char *slot = callbackSig.constData();
int slotIndex = metaObject->indexOfSlot(slot);
QMetaMethod signalMethod = metaObject->method(signalIndex);
if (slotIndex == -1) {
- if (!usingGlobalReceiver && self && !Shiboken::Object::hasCppWrapper((SbkObject*)self)) {
+ if (!usingGlobalReceiver && self && !Shiboken::Object::hasCppWrapper(reinterpret_cast<SbkObject *>(self))) {
qWarning("You can't add dynamic slots on an object originated from C++.");
if (usingGlobalReceiver)
signalManager.releaseGlobalReceiver(source, receiver);
@@ -388,11 +384,11 @@ static bool qobjectConnectCallback(QObject* source, const char* signal, PyObject
if (usingGlobalReceiver)
signalManager.notifyGlobalReceiver(receiver);
#ifndef AVOID_PROTECTED_HACK
- source->connectNotify(signalMethod); //Qt5: QMetaMethod instead of char*
+ source->connectNotify(signalMethod); //Qt5: QMetaMethod instead of char *
#else
- // Need to cast to QObjectWrapper* and call the public version of
+ // Need to cast to QObjectWrapper * and call the public version of
// connectNotify when avoiding the protected hack.
- reinterpret_cast<QObjectWrapper*>(source)->connectNotify(signalMethod); //Qt5: QMetaMethod instead of char*
+ reinterpret_cast<QObjectWrapper *>(source)->connectNotify(signalMethod); //Qt5: QMetaMethod instead of char *
#endif
return connection;
@@ -405,23 +401,23 @@ static bool qobjectConnectCallback(QObject* source, const char* signal, PyObject
}
-static bool qobjectDisconnectCallback(QObject* source, const char* signal, PyObject* callback)
+static bool qobjectDisconnectCallback(QObject *source, const char *signal, PyObject *callback)
{
if (!PySide::Signal::checkQtSignal(signal))
return false;
- PySide::SignalManager& signalManager = PySide::SignalManager::instance();
+ PySide::SignalManager &signalManager = PySide::SignalManager::instance();
// Extract receiver from callback
- QObject* receiver = nullptr;
- PyObject* self = nullptr;
+ QObject *receiver = nullptr;
+ PyObject *self = nullptr;
QByteArray callbackSig;
QMetaMethod slotMethod;
bool usingGlobalReceiver = getReceiver(nullptr, signal, callback, &receiver, &self, &callbackSig);
if (receiver == nullptr && self == nullptr)
return false;
- const QMetaObject* metaObject = receiver->metaObject();
+ const QMetaObject *metaObject = receiver->metaObject();
int signalIndex = source->metaObject()->indexOfSignal(++signal);
int slotIndex = -1;
@@ -438,11 +434,11 @@ static bool qobjectDisconnectCallback(QObject* source, const char* signal, PyObj
signalManager.releaseGlobalReceiver(source, receiver);
#ifndef AVOID_PROTECTED_HACK
- source->disconnectNotify(slotMethod); //Qt5: QMetaMethod instead of char*
+ source->disconnectNotify(slotMethod); //Qt5: QMetaMethod instead of char *
#else
- // Need to cast to QObjectWrapper* and call the public version of
+ // Need to cast to QObjectWrapper * and call the public version of
// connectNotify when avoiding the protected hack.
- reinterpret_cast<QObjectWrapper*>(source)->disconnectNotify(slotMethod); //Qt5: QMetaMethod instead of char*
+ reinterpret_cast<QObjectWrapper *>(source)->disconnectNotify(slotMethod); //Qt5: QMetaMethod instead of char *
#endif
return true;
}
@@ -519,6 +515,7 @@ PySide::runCleanupFunctions();
Shiboken::Conversions::registerConverterName(SbkPySide2_QtCoreTypeConverters[SBK_QSTRING_IDX], "unicode");
Shiboken::Conversions::registerConverterName(SbkPySide2_QtCoreTypeConverters[SBK_QSTRING_IDX], "str");
Shiboken::Conversions::registerConverterName(SbkPySide2_QtCoreTypeConverters[SBK_QTCORE_QLIST_QVARIANT_IDX], "QVariantList");
+Shiboken::Conversions::registerConverterName(SbkPySide2_QtCoreTypeConverters[SBK_QTCORE_QMAP_QSTRING_QVARIANT_IDX], "QVariantMap");
PySide::registerInternalQtConf();
PySide::init(module);
@@ -706,10 +703,10 @@ qRegisterMetaType<QVector<int> >("QVector<int>");
// @snippet qobject-metaobject
// @snippet qobject-findchild-1
-static QObject* _findChildHelper(const QObject* parent, const QString& name, PyTypeObject* desiredType)
+static QObject *_findChildHelper(const QObject *parent, const QString &name, PyTypeObject *desiredType)
{
for (auto *child : parent->children()) {
- Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QObject*](child));
+ Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QObject *](child));
if (PyType_IsSubtype(Py_TYPE(pyChild), desiredType)
&& (name.isNull() || name == child->objectName())) {
return child;
@@ -724,21 +721,21 @@ static QObject* _findChildHelper(const QObject* parent, const QString& name, PyT
return nullptr;
}
-static inline bool _findChildrenComparator(const QObject*& child, const QRegExp& name)
+static inline bool _findChildrenComparator(const QObject *&child, const QRegExp &name)
{
return name.indexIn(child->objectName()) != -1;
}
-static inline bool _findChildrenComparator(const QObject*& child, const QString& name)
+static inline bool _findChildrenComparator(const QObject *&child, const QString &name)
{
return name.isNull() || name == child->objectName();
}
template<typename T>
-static void _findChildrenHelper(const QObject* parent, const T& name, PyTypeObject* desiredType, PyObject* result)
+static void _findChildrenHelper(const QObject *parent, const T& name, PyTypeObject *desiredType, PyObject *result)
{
for (const auto *child : parent->children()) {
- Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QObject*](child));
+ Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QObject *](child));
if (PyType_IsSubtype(Py_TYPE(pyChild), desiredType) && _findChildrenComparator(child, name))
PyList_Append(result, pyChild);
_findChildrenHelper(child, name, desiredType, result);
@@ -747,18 +744,18 @@ static void _findChildrenHelper(const QObject* parent, const T& name, PyTypeObje
// @snippet qobject-findchild-1
// @snippet qobject-findchild-2
-QObject *child = _findChildHelper(%CPPSELF, %2, (PyTypeObject*)%PYARG_1);
-%PYARG_0 = %CONVERTTOPYTHON[QObject*](child);
+QObject *child = _findChildHelper(%CPPSELF, %2, reinterpret_cast<PyTypeObject *>(%PYARG_1));
+%PYARG_0 = %CONVERTTOPYTHON[QObject *](child);
// @snippet qobject-findchild-2
// @snippet qobject-findchildren-1
%PYARG_0 = PyList_New(0);
-_findChildrenHelper(%CPPSELF, %2, (PyTypeObject*)%PYARG_1, %PYARG_0);
+_findChildrenHelper(%CPPSELF, %2, reinterpret_cast<PyTypeObject *>(%PYARG_1), %PYARG_0);
// @snippet qobject-findchildren-1
// @snippet qobject-findchildren-2
%PYARG_0 = PyList_New(0);
-_findChildrenHelper(%CPPSELF, %2, (PyTypeObject*)%PYARG_1, %PYARG_0);
+_findChildrenHelper(%CPPSELF, %2, reinterpret_cast<PyTypeObject *>(%PYARG_1), %PYARG_0);
// @snippet qobject-findchildren-2
// @snippet qobject-tr
@@ -942,8 +939,7 @@ if (PyIndex_Check(_key)) {
int overflow;
long ival = PyLong_AsLongAndOverflow(item, &overflow);
// Not suppose to bigger than 255 because only bytes, bytearray, QByteArray were accept
- const char *el = reinterpret_cast<const char*>(&ival);
- temp = QByteArray(el);
+ temp = QByteArray(reinterpret_cast<const char *>(&ival));
} else {
temp = %CONVERTTOCPP[QByteArray](item);
}
@@ -969,18 +965,19 @@ extern "C" {
// QByteArray buffer protocol functions
// see: http://www.python.org/dev/peps/pep-3118/
-static int SbkQByteArray_getbufferproc(PyObject* obj, Py_buffer *view, int flags)
+static int SbkQByteArray_getbufferproc(PyObject *obj, Py_buffer *view, int flags)
{
if (!view || !Shiboken::Object::isValid(obj))
return -1;
- QByteArray* cppSelf = %CONVERTTOCPP[QByteArray*](obj);
+ QByteArray * cppSelf = %CONVERTTOCPP[QByteArray *](obj);
+ //XXX /|\ omitting this space crashes shiboken!
view->obj = obj;
- view->buf = reinterpret_cast<void*>(cppSelf->data());
+ view->buf = reinterpret_cast<void *>(cppSelf->data());
view->len = cppSelf->size();
view->readonly = 0;
view->itemsize = 1;
- view->format = const_cast<char*>("c");
+ view->format = const_cast<char *>("c");
view->ndim = 1;
view->shape = NULL;
view->strides = &view->itemsize;
@@ -992,20 +989,21 @@ static int SbkQByteArray_getbufferproc(PyObject* obj, Py_buffer *view, int flags
}
#if PY_VERSION_HEX < 0x03000000
-static Py_ssize_t SbkQByteArray_segcountproc(PyObject* self, Py_ssize_t* lenp)
+static Py_ssize_t SbkQByteArray_segcountproc(PyObject *self, Py_ssize_t *lenp)
{
if (lenp)
*lenp = Py_TYPE(self)->tp_as_sequence->sq_length(self);
return 1;
}
-static Py_ssize_t SbkQByteArray_readbufferproc(PyObject* self, Py_ssize_t segment, void** ptrptr)
+static Py_ssize_t SbkQByteArray_readbufferproc(PyObject *self, Py_ssize_t segment, void **ptrptr)
{
if (segment || !Shiboken::Object::isValid(self))
return -1;
- QByteArray* cppSelf = %CONVERTTOCPP[QByteArray*](self);
- *ptrptr = reinterpret_cast<void*>(cppSelf->data());
+ QByteArray * cppSelf = %CONVERTTOCPP[QByteArray *](self);
+ //XXX /|\ omitting this space crashes shiboken!
+ *ptrptr = reinterpret_cast<void *>(cppSelf->data());
return cppSelf->size();
}
@@ -1191,7 +1189,7 @@ return !result ? -1 : 0;
// @snippet qbytearray-setitem
// @snippet qfiledevice-unmap
-uchar *ptr = reinterpret_cast<uchar*>(Shiboken::Buffer::getPointer(%PYARG_1));
+uchar *ptr = reinterpret_cast<uchar *>(Shiboken::Buffer::getPointer(%PYARG_1));
%RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(ptr);
%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
// @snippet qfiledevice-unmap
@@ -1229,8 +1227,8 @@ if (socket != nullptr) {
// @snippet qtranslator-load
Py_ssize_t size;
-uchar *ptr = reinterpret_cast<uchar*>(Shiboken::Buffer::getPointer(%PYARG_1, &size));
-%RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(const_cast<const uchar*>(ptr), size);
+uchar *ptr = reinterpret_cast<uchar *>(Shiboken::Buffer::getPointer(%PYARG_1, &size));
+%RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(const_cast<const uchar *>(ptr), size);
%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
// @snippet qtranslator-load
@@ -1241,17 +1239,18 @@ Shiboken::AutoDecRef emptyTuple(PyTuple_New(0));
PyObject *pyTimer = reinterpret_cast<PyTypeObject *>(Shiboken::SbkType<QTimer>())->tp_new(Shiboken::SbkType<QTimer>(), emptyTuple, 0);
reinterpret_cast<PyTypeObject *>(Shiboken::SbkType<QTimer>())->tp_init(pyTimer, emptyTuple, 0);
-QTimer* timer = %CONVERTTOCPP[QTimer*](pyTimer);
+QTimer * timer = %CONVERTTOCPP[QTimer *](pyTimer);
+//XXX /|\ omitting this space crashes shiboken!
Shiboken::AutoDecRef result(
PyObject_CallMethod(pyTimer,
- const_cast<char*>("connect"),
- const_cast<char*>("OsOs"),
+ const_cast<char *>("connect"),
+ const_cast<char *>("OsOs"),
pyTimer,
SIGNAL(timeout()),
%PYARG_2,
%3)
);
-Shiboken::Object::releaseOwnership((SbkObject*)pyTimer);
+Shiboken::Object::releaseOwnership((SbkObject *)pyTimer);
Py_XDECREF(pyTimer);
timer->setSingleShot(true);
timer->connect(timer, SIGNAL(timeout()), timer, SLOT(deleteLater()));
@@ -1263,16 +1262,16 @@ timer->start(%1);
Shiboken::AutoDecRef emptyTuple(PyTuple_New(0));
PyObject *pyTimer = reinterpret_cast<PyTypeObject *>(Shiboken::SbkType<QTimer>())->tp_new(Shiboken::SbkType<QTimer>(), emptyTuple, 0);
reinterpret_cast<PyTypeObject *>(Shiboken::SbkType<QTimer>())->tp_init(pyTimer, emptyTuple, 0);
-QTimer* timer = %CONVERTTOCPP[QTimer*](pyTimer);
+QTimer * timer = %CONVERTTOCPP[QTimer *](pyTimer);
timer->setSingleShot(true);
if (PyObject_TypeCheck(%2, PySideSignalInstanceTypeF())) {
- PySideSignalInstance *signalInstance = reinterpret_cast<PySideSignalInstance*>(%2);
+ PySideSignalInstance *signalInstance = reinterpret_cast<PySideSignalInstance *>(%2);
Shiboken::AutoDecRef signalSignature(Shiboken::String::fromFormat("2%s", PySide::Signal::getSignature(signalInstance)));
Shiboken::AutoDecRef result(
PyObject_CallMethod(pyTimer,
- const_cast<char*>("connect"),
- const_cast<char*>("OsOO"),
+ const_cast<char *>("connect"),
+ const_cast<char *>("OsOO"),
pyTimer,
SIGNAL(timeout()),
PySide::Signal::getObject(signalInstance),
@@ -1281,8 +1280,8 @@ if (PyObject_TypeCheck(%2, PySideSignalInstanceTypeF())) {
} else {
Shiboken::AutoDecRef result(
PyObject_CallMethod(pyTimer,
- const_cast<char*>("connect"),
- const_cast<char*>("OsO"),
+ const_cast<char *>("connect"),
+ const_cast<char *>("OsO"),
pyTimer,
SIGNAL(timeout()),
%PYARG_2)
@@ -1290,7 +1289,7 @@ if (PyObject_TypeCheck(%2, PySideSignalInstanceTypeF())) {
}
timer->connect(timer, SIGNAL(timeout()), timer, SLOT(deleteLater()), Qt::DirectConnection);
-Shiboken::Object::releaseOwnership((SbkObject*)pyTimer);
+Shiboken::Object::releaseOwnership(reinterpret_cast<SbkObject *>(pyTimer));
Py_XDECREF(pyTimer);
timer->start(%1);
// @snippet qtimer-singleshot-2
@@ -1322,7 +1321,7 @@ static void QCoreApplicationConstructor(PyObject *self, PyObject *pyargv, QCoreA
PyObject *stringlist = PyTuple_GET_ITEM(pyargv, 0);
if (Shiboken::listToArgcArgv(stringlist, &argc, &argv, "PySideApp")) {
*cptr = new QCoreApplicationWrapper(argc, argv);
- Shiboken::Object::releaseOwnership(reinterpret_cast<SbkObject*>(self));
+ Shiboken::Object::releaseOwnership(reinterpret_cast<SbkObject *>(self));
PySide::registerCleanupFunction(&PySide::destroyQCoreApplication);
}
}
@@ -1342,10 +1341,10 @@ if (!PyTuple_SetItem(empty, 0, PyList_New(0))) {
// @snippet qcoreapplication-instance
PyObject *pyApp = Py_None;
if (qApp) {
- pyApp = reinterpret_cast<PyObject*>(
+ pyApp = reinterpret_cast<PyObject *>(
Shiboken::BindingManager::instance().retrieveWrapper(qApp));
if (!pyApp)
- pyApp = %CONVERTTOPYTHON[QCoreApplication*](qApp);
+ pyApp = %CONVERTTOPYTHON[QCoreApplication *](qApp);
// this will keep app live after python exit (extra ref)
}
// PYSIDE-571: make sure that we return the singleton "None"
@@ -1379,7 +1378,7 @@ Shiboken::Object::releaseOwnership(%PYARG_0);
// @snippet qanimationgroup-clear
for (int counter = 0, count = %CPPSELF.animationCount(); counter < count; ++counter ) {
QAbstractAnimation *animation = %CPPSELF.animationAt(counter);
- PyObject *obj = %CONVERTTOPYTHON[QAbstractAnimation*](animation);
+ PyObject *obj = %CONVERTTOPYTHON[QAbstractAnimation *](animation);
Shiboken::Object::setParent(nullptr, obj);
Py_DECREF(obj);
}
@@ -1403,11 +1402,12 @@ if (func)
// @snippet qsignaltransition
if (PyObject_TypeCheck(%1, PySideSignalInstanceTypeF())) {
- PyObject *dataSource = PySide::Signal::getObject((PySideSignalInstance*)%PYARG_1);
+ PyObject *dataSource = PySide::Signal::getObject((PySideSignalInstance *)%PYARG_1);
Shiboken::AutoDecRef obType(PyObject_Type(dataSource));
- QObject* sender = %CONVERTTOCPP[QObject*](dataSource);
+ QObject * sender = %CONVERTTOCPP[QObject *](dataSource);
+ //XXX /|\ omitting this space crashes shiboken!
if (sender) {
- const char*dataSignature = PySide::Signal::getSignature((PySideSignalInstance*)%PYARG_1);
+ const char *dataSignature = PySide::Signal::getSignature((PySideSignalInstance *)%PYARG_1);
QByteArray signature(dataSignature); // Append SIGNAL flag (2)
signature.prepend('2');
%0 = new QSignalTransitionWrapper(sender, signature, %2);
@@ -1419,7 +1419,7 @@ if (PyObject_TypeCheck(%1, PySideSignalInstanceTypeF())) {
QString signalName(%2);
if (PySide::SignalManager::registerMetaMethod(%1, signalName.mid(1).toLatin1().data(), QMetaMethod::Signal)) {
QSignalTransition *%0 = %CPPSELF->addTransition(%1, %2, %3);
- %PYARG_0 = %CONVERTTOPYTHON[QSignalTransition*](%0);
+ %PYARG_0 = %CONVERTTOPYTHON[QSignalTransition *](%0);
} else {
Py_INCREF(Py_None);
%PYARG_0 = Py_None;
@@ -1433,16 +1433,17 @@ if (PySide::SignalManager::registerMetaMethod(%1, signalName.mid(1).toLatin1().d
// http://bugs.openbossa.org/show_bug.cgi?id=362
if (!PyObject_TypeCheck(%1, PySideSignalInstanceTypeF()))
goto Sbk_%TYPEFunc_%FUNCTION_NAME_TypeError;
-PySideSignalInstance *signalInstance = reinterpret_cast<PySideSignalInstance*>(%1);
-QObject* sender = %CONVERTTOCPP[QObject*](PySide::Signal::getObject(signalInstance));
+PySideSignalInstance *signalInstance = reinterpret_cast<PySideSignalInstance *>(%1);
+QObject * sender = %CONVERTTOCPP[QObject *](PySide::Signal::getObject(signalInstance));
+//XXX /|\ omitting this space crashes shiboken!
QSignalTransition *%0 = %CPPSELF->%FUNCTION_NAME(sender, PySide::Signal::getSignature(signalInstance),%2);
-%PYARG_0 = %CONVERTTOPYTHON[QSignalTransition*](%0);
+%PYARG_0 = %CONVERTTOPYTHON[QSignalTransition *](%0);
// @snippet qstate-addtransition-2
// @snippet qstatemachine-configuration
%PYARG_0 = PySet_New(0);
for (auto *abs_state : %CPPSELF.configuration()) {
- Shiboken::AutoDecRef obj(%CONVERTTOPYTHON[QAbstractState*](abs_state));
+ Shiboken::AutoDecRef obj(%CONVERTTOPYTHON[QAbstractState *](abs_state));
Shiboken::Object::setParent(self, obj);
PySet_Add(%PYARG_0, obj);
}
@@ -1451,7 +1452,7 @@ for (auto *abs_state : %CPPSELF.configuration()) {
// @snippet qstatemachine-defaultanimations
%PYARG_0 = PyList_New(0);
for (auto *abs_anim : %CPPSELF.defaultAnimations()) {
- Shiboken::AutoDecRef obj(%CONVERTTOPYTHON[QAbstractAnimation*](abs_anim));
+ Shiboken::AutoDecRef obj(%CONVERTTOPYTHON[QAbstractAnimation *](abs_anim));
Shiboken::Object::setParent(self, obj);
PyList_Append(%PYARG_0, obj);
}
@@ -1482,16 +1483,16 @@ QT_END_NAMESPACE
// @snippet qt-registerresourcedata
// @snippet qt-qregisterresourcedata
-%RETURN_TYPE %0 = %FUNCTION_NAME(%1, reinterpret_cast<uchar*>(PyBytes_AS_STRING(%PYARG_2)),
- reinterpret_cast<uchar*>(PyBytes_AS_STRING(%PYARG_3)),
- reinterpret_cast<uchar*>(PyBytes_AS_STRING(%PYARG_4)));
+%RETURN_TYPE %0 = %FUNCTION_NAME(%1, reinterpret_cast<uchar *>(PyBytes_AS_STRING(%PYARG_2)),
+ reinterpret_cast<uchar *>(PyBytes_AS_STRING(%PYARG_3)),
+ reinterpret_cast<uchar *>(PyBytes_AS_STRING(%PYARG_4)));
%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
// @snippet qt-qregisterresourcedata
// @snippet qt-qunregisterresourcedata
-%RETURN_TYPE %0 = %FUNCTION_NAME(%1, reinterpret_cast<uchar*>(PyBytes_AS_STRING(%PYARG_2)),
- reinterpret_cast<uchar*>(PyBytes_AS_STRING(%PYARG_3)),
- reinterpret_cast<uchar*>(PyBytes_AS_STRING(%PYARG_4)));
+%RETURN_TYPE %0 = %FUNCTION_NAME(%1, reinterpret_cast<uchar *>(PyBytes_AS_STRING(%PYARG_2)),
+ reinterpret_cast<uchar *>(PyBytes_AS_STRING(%PYARG_3)),
+ reinterpret_cast<uchar *>(PyBytes_AS_STRING(%PYARG_4)));
%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
// @snippet qt-qunregisterresourcedata
@@ -1502,8 +1503,8 @@ QT_END_NAMESPACE
// @snippet use-stream-for-format-security
// @snippet qresource-registerResource
- auto ptr = reinterpret_cast<uchar*>(Shiboken::Buffer::getPointer(%PYARG_1));
- %RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(const_cast<const uchar*>(ptr), %2);
+ auto ptr = reinterpret_cast<uchar *>(Shiboken::Buffer::getPointer(%PYARG_1));
+ %RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(const_cast<const uchar *>(ptr), %2);
%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
// @snippet qresource-registerResource
@@ -1529,11 +1530,11 @@ QString &res = *%0;
// @snippet return-readData
%RETURN_TYPE %0 = 0;
if (PyBytes_Check(%PYARG_0)) {
- %0 = PyBytes_GET_SIZE((PyObject*)%PYARG_0);
- memcpy(%1, PyBytes_AS_STRING((PyObject*)%PYARG_0), %0);
+ %0 = PyBytes_GET_SIZE((PyObject *)%PYARG_0);
+ memcpy(%1, PyBytes_AS_STRING((PyObject *)%PYARG_0), %0);
} else if (Shiboken::String::check(%PYARG_0)) {
- %0 = Shiboken::String::len((PyObject*)%PYARG_0);
- memcpy(%1, Shiboken::String::toCString((PyObject*)%PYARG_0), %0);
+ %0 = Shiboken::String::len((PyObject *)%PYARG_0);
+ memcpy(%1, Shiboken::String::toCString((PyObject *)%PYARG_0), %0);
}
// @snippet return-readData
@@ -1545,7 +1546,7 @@ QByteArray ba(1 + int(%2), char(0));
// @snippet qt-module-shutdown
{ // Avoid name clash
- Shiboken::AutoDecRef regFunc((PyObject*)NULL);
+ Shiboken::AutoDecRef regFunc(static_cast<PyObject *>(nullptr));
Shiboken::AutoDecRef atexit(Shiboken::Module::import("atexit"));
if (atexit.isNull()) {
qWarning("Module atexit not found for registering __moduleShutdown");
@@ -1586,12 +1587,12 @@ QByteArray ba(1 + int(%2), char(0));
// @snippet conversion-pyunicode
#ifndef Py_LIMITED_API
-Py_UNICODE* unicode = PyUnicode_AS_UNICODE(%in);
+Py_UNICODE *unicode = PyUnicode_AS_UNICODE(%in);
# if defined(Py_UNICODE_WIDE)
// cast as Py_UNICODE can be a different type
-%out = QString::fromUcs4((const uint*)unicode);
+%out = QString::fromUcs4((const uint *)unicode);
# else
-%out = QString::fromUtf16((const ushort*)unicode, PyUnicode_GET_SIZE(%in));
+%out = QString::fromUtf16((const ushort *)unicode, PyUnicode_GET_SIZE(%in));
# endif
#else
wchar_t *temp = PyUnicode_AsWideCharString(%in, NULL);
@@ -1602,7 +1603,8 @@ PyMem_Free(temp);
// @snippet conversion-pystring
#ifndef IS_PY3K
-const char* str = %CONVERTTOCPP[const char*](%in);
+const char * str = %CONVERTTOCPP[const char *](%in);
+//XXX /|\ omitting this space crashes shiboken!
%out = %OUTTYPE(str);
#endif
// @snippet conversion-pystring
@@ -1650,7 +1652,7 @@ if (!typeCode || !typeName) {
%out = QVariant::fromValue(PySide::PyObjectWrapper(%in));
}
else {
- QVariant var(typeCode, (void*)0);
+ QVariant var(typeCode, nullptr);
Shiboken::Conversions::SpecificConverter converter(typeName);
converter.toCpp(pyIn, var.data());
%out = var;
@@ -1680,12 +1682,12 @@ QVariant ret = QVariant_convertToVariantList(%in);
const char *typeName;
if (Shiboken::String::checkType(reinterpret_cast<PyTypeObject *>(%in)))
typeName = "QString";
-else if (%in == reinterpret_cast<PyObject*>(&PyFloat_Type))
+else if (%in == reinterpret_cast<PyObject *>(&PyFloat_Type))
typeName = "double"; // float is a UserType in QVariant.
-else if (%in == reinterpret_cast<PyObject*>(&PyLong_Type))
+else if (%in == reinterpret_cast<PyObject *>(&PyLong_Type))
typeName = "int"; // long is a UserType in QVariant.
else if (Py_TYPE(%in) == SbkObjectType_TypeF())
- typeName = Shiboken::ObjectType::getOriginalName((SbkObjectType*)%in);
+ typeName = Shiboken::ObjectType::getOriginalName((SbkObjectType *)%in);
else
typeName = reinterpret_cast<PyTypeObject *>(%in)->tp_name;
%out = QVariant::nameToType(typeName);
@@ -1825,7 +1827,7 @@ PyObject *%out;
PyTypeObject *pyType = nullptr;
if (typeName)
pyType = Shiboken::Conversions::getPythonTypeObject(typeName);
-%out = pyType ? (reinterpret_cast<PyObject*>(pyType)) : Py_None;
+%out = pyType ? (reinterpret_cast<PyObject *>(pyType)) : Py_None;
Py_INCREF(%out);
return %out;
// @snippet return-qvariant-type
diff --git a/sources/pyside2/PySide2/glue/qtgui.cpp b/sources/pyside2/PySide2/glue/qtgui.cpp
index aef9e4b59..5be8cc287 100644
--- a/sources/pyside2/PySide2/glue/qtgui.cpp
+++ b/sources/pyside2/PySide2/glue/qtgui.cpp
@@ -72,7 +72,7 @@ if (QTransform::squareToQuad(%1, _result)) {
// @snippet qtransform-squaretoquad
// @snippet qbitmap-fromdata
-uchar *buffer = reinterpret_cast<uchar*>(Shiboken::Buffer::getPointer(%PYARG_2));
+uchar *buffer = reinterpret_cast<uchar *>(Shiboken::Buffer::getPointer(%PYARG_2));
QBitmap %0 = QBitmap::fromData(%1, buffer, %3);
%PYARG_0 = %CONVERTTOPYTHON[QBitmap](%0);
// @snippet qbitmap-fromdata
@@ -102,7 +102,7 @@ return %CONVERTTOPYTHON[int](item);
// @snippet qtextblock-setuserdata
const QTextDocument *doc = %CPPSELF.document();
if (doc) {
- Shiboken::AutoDecRef pyDocument(%CONVERTTOPYTHON[QTextDocument*](doc));
+ Shiboken::AutoDecRef pyDocument(%CONVERTTOPYTHON[QTextDocument *](doc));
Shiboken::Object::setParent(pyDocument, %PYARG_1);
}
// @snippet qtextblock-setuserdata
@@ -110,7 +110,7 @@ if (doc) {
// @snippet qtextblock-userdata
const QTextDocument *doc = %CPPSELF.document();
if (doc) {
- Shiboken::AutoDecRef pyDocument(%CONVERTTOPYTHON[QTextDocument*](doc));
+ Shiboken::AutoDecRef pyDocument(%CONVERTTOPYTHON[QTextDocument *](doc));
Shiboken::Object::setParent(pyDocument, %PYARG_0);
}
// @snippet qtextblock-userdata
@@ -138,7 +138,7 @@ for (int i = 0, i_max = %CPPSELF.count(); i < i_max; ++i){
// @snippet qpolygon-operatorlowerlower
// %FUNCTION_NAME()
*%CPPSELF << %1;
-%PYARG_0 = %CONVERTTOPYTHON[QPolygon*](%CPPSELF);
+%PYARG_0 = %CONVERTTOPYTHON[QPolygon *](%CPPSELF);
// @snippet qpolygon-operatorlowerlower
// @snippet qpixmap
@@ -372,7 +372,7 @@ if (%CPPSELF.%FUNCTION_NAME(%1, &p)) {
// Clear parent from the old child
QStandardItem *_i = %CPPSELF->child(%1, %2);
if (_i) {
- PyObject *_pyI = %CONVERTTOPYTHON[QStandardItem*](_i);
+ PyObject *_pyI = %CONVERTTOPYTHON[QStandardItem *](_i);
Shiboken::Object::setParent(nullptr, _pyI);
}
// @snippet qstandarditem-setchild-1
@@ -381,7 +381,7 @@ if (_i) {
// Clear parent from the old child
QStandardItem *_i = %CPPSELF->child(%1);
if (_i) {
- PyObject *_pyI = %CONVERTTOPYTHON[QStandardItem*](_i);
+ PyObject *_pyI = %CONVERTTOPYTHON[QStandardItem *](_i);
Shiboken::Object::setParent(nullptr, _pyI);
}
// @snippet qstandarditem-setchild-2
@@ -395,7 +395,7 @@ bool ret = !(&%CPPSELF == %1);
// Clear parent from the old child
QStandardItem *_i = %CPPSELF->item(%1, %2);
if (_i) {
- PyObject *_pyI = %CONVERTTOPYTHON[QStandardItem*](_i);
+ PyObject *_pyI = %CONVERTTOPYTHON[QStandardItem *](_i);
Shiboken::Object::setParent(nullptr, _pyI);
}
// @snippet qstandarditemmodel-setitem-1
@@ -404,7 +404,7 @@ if (_i) {
// Clear parent from the old child
QStandardItem *_i = %CPPSELF->item(%1);
if (_i) {
- PyObject *_pyI = %CONVERTTOPYTHON[QStandardItem*](_i);
+ PyObject *_pyI = %CONVERTTOPYTHON[QStandardItem *](_i);
Shiboken::Object::setParent(nullptr, _pyI);
}
// @snippet qstandarditemmodel-setitem-2
@@ -413,7 +413,7 @@ if (_i) {
// Clear parent from the old child
QStandardItem *_i = %CPPSELF->verticalHeaderItem(%1);
if (_i) {
- PyObject *_pyI = %CONVERTTOPYTHON[QStandardItem*](_i);
+ PyObject *_pyI = %CONVERTTOPYTHON[QStandardItem *](_i);
Shiboken::Object::setParent(nullptr, _pyI);
}
// @snippet qstandarditemmodel-setverticalheaderitem
@@ -503,7 +503,7 @@ static void QGuiApplicationConstructor(PyObject *self, PyObject *pyargv, QGuiApp
PyObject *stringlist = PyTuple_GET_ITEM(pyargv, 0);
if (Shiboken::listToArgcArgv(stringlist, &argc, &argv, "PySideApp")) {
*cptr = new QGuiApplicationWrapper(argc, argv, 0);
- Shiboken::Object::releaseOwnership(reinterpret_cast<SbkObject*>(self));
+ Shiboken::Object::releaseOwnership(reinterpret_cast<SbkObject *>(self));
PySide::registerCleanupFunction(&PySide::destroyQCoreApplication);
}
}
diff --git a/sources/pyside2/PySide2/glue/qtmultimedia.cpp b/sources/pyside2/PySide2/glue/qtmultimedia.cpp
index 520b5c4fa..5a3f3a5e7 100644
--- a/sources/pyside2/PySide2/glue/qtmultimedia.cpp
+++ b/sources/pyside2/PySide2/glue/qtmultimedia.cpp
@@ -39,7 +39,8 @@
// @snippet upcast
%BEGIN_ALLOW_THREADS
-QObject* upcastedArg = %CONVERTTOCPP[QObject*](%PYARG_1);
+QObject * upcastedArg = %CONVERTTOCPP[QObject *](%PYARG_1);
+//XXX /|\ omitting this space crashes shiboken!
%CPPSELF.%FUNCTION_NAME(reinterpret_cast< %ARG1_TYPE >(upcastedArg));
%END_ALLOW_THREADS
// @snippet upcast
diff --git a/sources/pyside2/PySide2/glue/qtopengl.cpp b/sources/pyside2/PySide2/glue/qtopengl.cpp
index 6c106522c..25b6ee096 100644
--- a/sources/pyside2/PySide2/glue/qtopengl.cpp
+++ b/sources/pyside2/PySide2/glue/qtopengl.cpp
@@ -39,7 +39,7 @@
// @snippet qglbuffer-allocate
int size = (%2 < 0) ? %1.size() : %2;
-%CPPSELF.allocate((const void*) %1.data(), size);
+%CPPSELF.allocate(static_cast<const void *>(%1.data()), size);
// @snippet qglbuffer-allocate
// @snippet qglbuffer-read
@@ -47,7 +47,7 @@ char *data = new char[%3];
bool result = %CPPSELF.read(%1, data, %3);
QByteArray ret;
if (result)
- ret.append((const char*)data, %3);
+ ret.append(data, %3);
%PYARG_0 = PyTuple_New(2);
PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[bool](result));
PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QByteArray](ret));
@@ -56,12 +56,12 @@ delete[] data;
// @snippet qglbuffer-write
int size = (%3 < 0) ? %2.size() : %3;
-%CPPSELF.write(%1, (const void*) %2.data(), size);
+%CPPSELF.write(%1, static_cast<const void *>(%2.data()), size);
// @snippet qglbuffer-write
// @snippet qglbuffer-map
Py_ssize_t dataSize = %CPPSELF.size();
-void* data = %CPPSELF.map(%1);
+void *data = %CPPSELF.map(%1);
if (!data) {
Py_INCREF(Py_None);
diff --git a/sources/pyside2/PySide2/glue/qtscript.cpp b/sources/pyside2/PySide2/glue/qtscript.cpp
index 7efc26f3e..cf168d6bd 100644
--- a/sources/pyside2/PySide2/glue/qtscript.cpp
+++ b/sources/pyside2/PySide2/glue/qtscript.cpp
@@ -54,7 +54,7 @@ QVariant res = %CPPSELF.property(Shiboken::String::toCString(key.object())).toVa
if (res.isValid()) {
return %CONVERTTOPYTHON[QVariant](res);
} else {
- PyObject* errorType = PyInt_Check(_key) ? PyExc_IndexError : PyExc_KeyError;
+ PyObject *errorType = PyInt_Check(_key) ? PyExc_IndexError : PyExc_KeyError;
PyErr_SetString(errorType, "Key not found.");
return 0;
}
diff --git a/sources/pyside2/PySide2/glue/qtuitools.cpp b/sources/pyside2/PySide2/glue/qtuitools.cpp
index d0469e97d..552a9009c 100644
--- a/sources/pyside2/PySide2/glue/qtuitools.cpp
+++ b/sources/pyside2/PySide2/glue/qtuitools.cpp
@@ -48,14 +48,14 @@
#include <QFile>
#include <QWidget>
-static void createChildrenNameAttributes(PyObject* root, QObject* object)
+static void createChildrenNameAttributes(PyObject *root, QObject *object)
{
for (auto *child : object->children()) {
const QByteArray name = child->objectName().toLocal8Bit();
if (!name.isEmpty() && !name.startsWith("_") && !name.startsWith("qt_")) {
if (!PyObject_HasAttrString(root, name.constData())) {
- Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QObject*](child));
+ Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QObject *](child));
PyObject_SetAttrString(root, name.constData(), pyChild);
}
createChildrenNameAttributes(root, child);
@@ -64,15 +64,15 @@ static void createChildrenNameAttributes(PyObject* root, QObject* object)
}
}
-static PyObject* QUiLoadedLoadUiFromDevice(QUiLoader* self, QIODevice* dev, QWidget* parent)
+static PyObject *QUiLoadedLoadUiFromDevice(QUiLoader *self, QIODevice *dev, QWidget *parent)
{
- QWidget* wdg = self->load(dev, parent);
+ QWidget *wdg = self->load(dev, parent);
if (wdg) {
- PyObject* pyWdg = %CONVERTTOPYTHON[QWidget*](wdg);
+ PyObject *pyWdg = %CONVERTTOPYTHON[QWidget *](wdg);
createChildrenNameAttributes(pyWdg, wdg);
if (parent) {
- Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget*](parent));
+ Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget *](parent));
Shiboken::Object::setParent(pyParent, pyWdg);
}
return pyWdg;
@@ -83,7 +83,7 @@ static PyObject* QUiLoadedLoadUiFromDevice(QUiLoader* self, QIODevice* dev, QWid
return nullptr;
}
-static PyObject* QUiLoaderLoadUiFromFileName(QUiLoader* self, const QString& uiFile, QWidget* parent)
+static PyObject *QUiLoaderLoadUiFromFileName(QUiLoader *self, const QString &uiFile, QWidget *parent)
{
QFile fd(uiFile);
return QUiLoadedLoadUiFromDevice(self, &fd, parent);
diff --git a/sources/pyside2/PySide2/glue/qtwebkitwidgets.cpp b/sources/pyside2/PySide2/glue/qtwebkitwidgets.cpp
index 086ee3b85..c0f182747 100644
--- a/sources/pyside2/PySide2/glue/qtwebkitwidgets.cpp
+++ b/sources/pyside2/PySide2/glue/qtwebkitwidgets.cpp
@@ -38,7 +38,7 @@
****************************************************************************/
// @snippet qwebview-page
-SbkObject* _pyReturn = reinterpret_cast<SbkObject*>(%PYARG_0);
+auto _pyReturn = reinterpret_cast<SbkObject *>(%PYARG_0);
if (!Shiboken::Object::hasParentInfo(_pyReturn))
Shiboken::Object::setParent(%PYSELF, %PYARG_0);
// @snippet qwebview-page
@@ -67,7 +67,7 @@ if (_signalIndex == -1) {
if (_signalIndex == id) {
Shiboken::GilState gil;
- PyObject* self = (PyObject*)Shiboken::BindingManager::instance().retrieveWrapper(this);
+ auto self = reinterpret_cast<PyObject *>(Shiboken::BindingManager::instance().retrieveWrapper(this));
if (self) {
Shiboken::AutoDecRef _pyMethod(PyObject_GetAttrString(self, "shouldInterruptJavaScript"));
diff --git a/sources/pyside2/PySide2/glue/qtwidgets.cpp b/sources/pyside2/PySide2/glue/qtwidgets.cpp
index b44be183d..0e0b025a6 100644
--- a/sources/pyside2/PySide2/glue/qtwidgets.cpp
+++ b/sources/pyside2/PySide2/glue/qtwidgets.cpp
@@ -44,13 +44,13 @@
// @snippet qtreewidgetitemiterator-next
if (**%CPPSELF) {
QTreeWidgetItemIterator *%0 = new QTreeWidgetItemIterator((*%CPPSELF)++);
- %PYARG_0 = %CONVERTTOPYTHON[QTreeWidgetItemIterator*](%0);
+ %PYARG_0 = %CONVERTTOPYTHON[QTreeWidgetItemIterator *](%0);
}
// @snippet qtreewidgetitemiterator-next
// @snippet qtreewidgetitemiterator-value
-QTreeWidgetItem *%0 = %CPPSELF.operator*();
-%PYARG_0 = %CONVERTTOPYTHON[QTreeWidgetItem*](%0);
+QTreeWidgetItem *%0 = %CPPSELF.operator *();
+%PYARG_0 = %CONVERTTOPYTHON[QTreeWidgetItem *](%0);
Shiboken::Object::releaseOwnership(%PYARG_0);
// @snippet qtreewidgetitemiterator-value
@@ -62,7 +62,7 @@ PyDict_SetItemString(reinterpret_cast<PyTypeObject *>(Sbk_QGraphicsItem_TypeF())
// @snippet qgraphicsitem-scene-return-parenting
if (%0) {
QObject *parent = %0->parent();
- Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QObject*](parent));
+ Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QObject *](parent));
Shiboken::Object::setParent(pyParent, %PYARG_0);
}
// @snippet qgraphicsitem-scene-return-parenting
@@ -72,7 +72,7 @@ QGraphicsItem *item_ = NULL;
%RETURN_TYPE retval_ = %CPPSELF.%FUNCTION_NAME(&item_);
%PYARG_0 = PyTuple_New(2);
PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](retval_));
-PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QGraphicsItem*](item_));
+PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QGraphicsItem *](item_));
// @snippet qgraphicsitem-isblockedbymodalpanel
// @snippet qitemeditorfactory-registereditor
@@ -81,7 +81,7 @@ Shiboken::Object::releaseOwnership(%PYARG_2);
// @snippet qitemeditorfactory-setdefaultfactory
//this function is static we need keep ref to default value, to be able to call python virtual functions
-static PyObject* _defaultValue = 0;
+static PyObject *_defaultValue = nullptr;
%CPPSELF.%FUNCTION_NAME(%1);
Py_INCREF(%PYARG_1);
if (_defaultValue)
@@ -111,9 +111,9 @@ PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[%ARG5_TYPE](%5));
// @snippet qfiledialog-return
// @snippet qmenu-glue
-inline PyObject* addActionWithPyObject(QMenu* self, const QIcon& icon, const QString& text, PyObject* callback, const QKeySequence& shortcut)
+inline PyObject *addActionWithPyObject(QMenu *self, const QIcon &icon, const QString &text, PyObject *callback, const QKeySequence &shortcut)
{
- QAction* act = self->addAction(text);
+ QAction *act = self->addAction(text);
if (!icon.isNull())
act->setIcon(icon);
@@ -123,7 +123,7 @@ inline PyObject* addActionWithPyObject(QMenu* self, const QIcon& icon, const QSt
self->addAction(act);
- PyObject* pyAct = %CONVERTTOPYTHON[QAction*](act);
+ PyObject *pyAct = %CONVERTTOPYTHON[QAction *](act);
Shiboken::AutoDecRef result(PyObject_CallMethod(pyAct,
const_cast<char *>("connect"),
const_cast<char *>("OsO"),
@@ -151,7 +151,7 @@ inline PyObject* addActionWithPyObject(QMenu* self, const QIcon& icon, const QSt
// @snippet qmenu-addaction-3
// @snippet qmenu-clear
-Shiboken::BindingManager& bm = Shiboken::BindingManager::instance();
+Shiboken::BindingManager &bm = Shiboken::BindingManager::instance();
const auto &actions = %CPPSELF.actions();
for (auto *act : actions) {
if (auto wrapper = bm.retrieveWrapper(act)) {
@@ -165,15 +165,15 @@ for (auto *act : actions) {
// @snippet qmenu-clear
// @snippet qmenubar-glue
-inline PyObject*
-addActionWithPyObject(QMenuBar* self, const QString& text, PyObject* callback)
+inline PyObject *
+addActionWithPyObject(QMenuBar *self, const QString &text, PyObject *callback)
{
- QAction* act = self->addAction(text);
+ QAction *act = self->addAction(text);
self->addAction(act);
- PyObject* pyAct = %CONVERTTOPYTHON[QAction*](act);
- PyObject* result = PyObject_CallMethod(pyAct,
+ PyObject *pyAct = %CONVERTTOPYTHON[QAction *](act);
+ PyObject *result = PyObject_CallMethod(pyAct,
const_cast<char *>("connect"),
const_cast<char *>("OsO"),
pyAct,
@@ -193,7 +193,7 @@ addActionWithPyObject(QMenuBar* self, const QString& text, PyObject* callback)
// @snippet qmenubar-clear
const auto &actions = %CPPSELF.actions();
for (auto *act : actions) {
- Shiboken::AutoDecRef pyAct(%CONVERTTOPYTHON[QAction*](act));
+ Shiboken::AutoDecRef pyAct(%CONVERTTOPYTHON[QAction *](act));
Shiboken::Object::setParent(NULL, pyAct);
Shiboken::Object::invalidate(pyAct);
}
@@ -224,28 +224,28 @@ if (!result.isNull())
// @snippet qtoolbox-removeitem
QWidget *_widget = %CPPSELF.widget(%1);
if (_widget) {
- Shiboken::AutoDecRef pyWidget(%CONVERTTOPYTHON[QWidget*](_widget));
+ Shiboken::AutoDecRef pyWidget(%CONVERTTOPYTHON[QWidget *](_widget));
Shiboken::Object::setParent(0, pyWidget);
}
// @snippet qtoolbox-removeitem
// @snippet qlayout-help-functions
-void addLayoutOwnership(QLayout* layout, QLayoutItem* item);
-void removeLayoutOwnership(QLayout* layout, QWidget* widget);
+void addLayoutOwnership(QLayout *layout, QLayoutItem *item);
+void removeLayoutOwnership(QLayout *layout, QWidget *widget);
-inline QByteArray retrieveObjectName(PyObject* obj)
+inline QByteArray retrieveObjectName(PyObject *obj)
{
Shiboken::AutoDecRef objName(PyObject_Str(obj));
return Shiboken::String::toCString(objName);
}
-inline void addLayoutOwnership(QLayout* layout, QWidget* widget)
+inline void addLayoutOwnership(QLayout *layout, QWidget *widget)
{
//transfer ownership to parent widget
QWidget *lw = layout->parentWidget();
QWidget *pw = widget->parentWidget();
- Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QWidget*](widget));
+ Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QWidget *](widget));
//Transfer parent to layout widget
if (pw && lw && pw != lw)
@@ -253,99 +253,98 @@ inline void addLayoutOwnership(QLayout* layout, QWidget* widget)
if (!lw && !pw) {
//keep the reference while the layout is orphan
- Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget*](layout));
- Shiboken::Object::keepReference(reinterpret_cast<SbkObject*>(pyParent.object()), retrieveObjectName(pyParent).data(), pyChild, true);
+ Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget *](layout));
+ Shiboken::Object::keepReference(reinterpret_cast<SbkObject *>(pyParent.object()), retrieveObjectName(pyParent).data(), pyChild, true);
} else {
if (!lw)
lw = pw;
- Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget*](lw));
+ Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget *](lw));
Shiboken::Object::setParent(pyParent, pyChild);
}
}
-inline void addLayoutOwnership(QLayout* layout, QLayout* other)
+inline void addLayoutOwnership(QLayout *layout, QLayout *other)
{
//transfer all children widgets from other to layout parent widget
- QWidget* parent = layout->parentWidget();
+ QWidget *parent = layout->parentWidget();
if (!parent) {
//keep the reference while the layout is orphan
- Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QLayout*](layout));
- Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QLayout*](other));
- Shiboken::Object::keepReference(reinterpret_cast<SbkObject*>(pyParent.object()), retrieveObjectName(pyParent).data(), pyChild, true);
+ Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QLayout *](layout));
+ Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QLayout *](other));
+ Shiboken::Object::keepReference(reinterpret_cast<SbkObject *>(pyParent.object()),
+ retrieveObjectName(pyParent).data(), pyChild, true);
return;
}
for (int i=0, i_max=other->count(); i < i_max; i++) {
- QLayoutItem* item = other->itemAt(i);
+ QLayoutItem *item = other->itemAt(i);
if (PyErr_Occurred() || !item)
return;
addLayoutOwnership(layout, item);
}
- Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QLayout*](layout));
- Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QLayout*](other));
+ Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QLayout *](layout));
+ Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QLayout *](other));
Shiboken::Object::setParent(pyParent, pyChild);
}
-inline void addLayoutOwnership(QLayout* layout, QLayoutItem* item)
+inline void addLayoutOwnership(QLayout *layout, QLayoutItem *item)
{
if (!item)
return;
- QWidget* w = item->widget();
- if (w)
+ if (QWidget *w = item->widget()) {
addLayoutOwnership(layout, w);
- else {
- QLayout* l = item->layout();
- if (l)
+ } else {
+ if (QLayout *l = item->layout())
addLayoutOwnership(layout, l);
}
- Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QLayout*](layout));
- Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QLayoutItem*](item));
+ Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QLayout *](layout));
+ Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QLayoutItem *](item));
Shiboken::Object::setParent(pyParent, pyChild);
}
-static void removeWidgetFromLayout(QLayout* layout, QWidget* widget)
+static void removeWidgetFromLayout(QLayout *layout, QWidget *widget)
{
- QWidget* parent = widget->parentWidget();
+ QWidget *parent = widget->parentWidget();
if (!parent) {
//remove reference on layout
- Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget*](layout));
- Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QWidget*](widget));
- Shiboken::Object::removeReference(reinterpret_cast<SbkObject*>(pyParent.object()), retrieveObjectName(pyParent).data(), pyChild);
+ Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget *](layout));
+ Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QWidget *](widget));
+ Shiboken::Object::removeReference(reinterpret_cast<SbkObject *>(pyParent.object()),
+ retrieveObjectName(pyParent).data(), pyChild);
} else {
//give the ownership to parent
- Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget*](parent));
- Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QWidget*](widget));
+ Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget *](parent));
+ Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QWidget *](widget));
Shiboken::Object::setParent(pyParent, pyChild);
}
}
-inline void removeLayoutOwnership(QLayout* layout, QLayoutItem* item)
+inline void removeLayoutOwnership(QLayout *layout, QLayoutItem *item)
{
- QWidget* w = item->widget();
- if (w)
+ if (QWidget *w = item->widget()) {
removeWidgetFromLayout(layout, w);
- else {
- QLayout* l = item->layout();
+ } else {
+ QLayout *l = item->layout();
if (l && item != l)
removeLayoutOwnership(layout, l);
}
- Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QLayoutItem*](item));
+ Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QLayoutItem *](item));
Shiboken::Object::invalidate(pyChild);
Shiboken::Object::setParent(0, pyChild);
}
-inline void removeLayoutOwnership(QLayout* layout, QWidget* widget)
+inline void removeLayoutOwnership(QLayout *layout, QWidget *widget)
{
if (!widget)
return;
for (int i=0, i_max=layout->count(); i < i_max; i++) {
- QLayoutItem* item = layout->itemAt(i);
+ QLayoutItem *item = layout->itemAt(i);
if (PyErr_Occurred() || !item)
return;
if (item->widget() == widget)
@@ -385,11 +384,11 @@ PyTuple_SET_ITEM(%PYARG_0, 3, %CONVERTTOPYTHON[int](d));
// @snippet qgridlayout-getitemposition
// @snippet qgraphicsscene-destroyitemgroup
-QGraphicsItem* parentItem = %1->parentItem();
-Shiboken::AutoDecRef parent(%CONVERTTOPYTHON[QGraphicsItem*](parentItem));
+QGraphicsItem *parentItem = %1->parentItem();
+Shiboken::AutoDecRef parent(%CONVERTTOPYTHON[QGraphicsItem *](parentItem));
const auto &childItems = %1->childItems();
for (auto *item : childItems)
- Shiboken::Object::setParent(parent, %CONVERTTOPYTHON[QGraphicsItem*](item));
+ Shiboken::Object::setParent(parent, %CONVERTTOPYTHON[QGraphicsItem *](item));
%BEGIN_ALLOW_THREADS
%CPPSELF.%FUNCTION_NAME(%1);
%END_ALLOW_THREADS
@@ -400,16 +399,16 @@ Shiboken::Object::invalidate(%PYARG_1);
// @snippet qgraphicsscene-addwidget
%RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(%1, %2);
%PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%0);
-Shiboken::Object::keepReference((SbkObject*)%PYARG_0, "setWidget(QWidget*)1", %PYARG_1);
+Shiboken::Object::keepReference(reinterpret_cast<SbkObject *>(%PYARG_0), "setWidget(QWidget*)1", %PYARG_1);
// @snippet qgraphicsscene-addwidget
// @snippet qgraphicsscene-clear
-const QList<QGraphicsItem*> items = %CPPSELF.items();
-Shiboken::BindingManager& bm = Shiboken::BindingManager::instance();
+const QList<QGraphicsItem *> items = %CPPSELF.items();
+Shiboken::BindingManager &bm = Shiboken::BindingManager::instance();
for (auto *item : items) {
- SbkObject* obj = bm.retrieveWrapper(item);
+ SbkObject *obj = bm.retrieveWrapper(item);
if (obj) {
- if (reinterpret_cast<PyObject*>(obj)->ob_refcnt > 1) // If the refcnt is 1 the object will vannish anyway.
+ if (reinterpret_cast<PyObject *>(obj)->ob_refcnt > 1) // If the refcnt is 1 the object will vannish anyway.
Shiboken::Object::invalidate(obj);
Shiboken::Object::removeParent(obj);
}
@@ -422,9 +421,8 @@ QTreeWidgetItem *rootItem = %CPPSELF.invisibleRootItem();
Shiboken::BindingManager &bm = Shiboken::BindingManager::instance();
for (int i = 0, i_count = rootItem->childCount(); i < i_count; ++i) {
QTreeWidgetItem *item = rootItem->child(i);
- SbkObject* wrapper = bm.retrieveWrapper(item);
- if (wrapper)
- Shiboken::Object::setParent(0, reinterpret_cast<PyObject*>(wrapper));
+ if (SbkObject *wrapper = bm.retrieveWrapper(item))
+ Shiboken::Object::setParent(nullptr, reinterpret_cast<PyObject *>(wrapper));
}
// @snippet qtreewidget-clear
@@ -440,7 +438,7 @@ Shiboken::BindingManager &bm = Shiboken::BindingManager::instance();
for (int i = 0, count = %CPPSELF.count(); i < count; ++i) {
QListWidgetItem *item = %CPPSELF.item(i);
if (auto wrapper = bm.retrieveWrapper(item)) {
- auto pyObj = reinterpret_cast<PyObject*>(wrapper);
+ auto pyObj = reinterpret_cast<PyObject *>(wrapper);
Py_INCREF(pyObj);
Shiboken::Object::setParent(NULL, pyObj);
Shiboken::Object::invalidate(pyObj);
@@ -461,31 +459,30 @@ static QString retrieveObjectName(PyObject *obj)
// Transfer objects ownership from layout to widget
static inline void qwidgetReparentLayout(QWidget *parent, QLayout *layout)
{
- Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget*](parent));
+ Shiboken::AutoDecRef pyParent(%CONVERTTOPYTHON[QWidget *](parent));
for (int i=0, i_count = layout->count(); i < i_count; i++) {
- QLayoutItem* item = layout->itemAt(i);
+ QLayoutItem *item = layout->itemAt(i);
if (PyErr_Occurred() || !item)
return;
- QWidget* w = item->widget();
- if (w) {
- QWidget* pw = w->parentWidget();
+ if (QWidget *w = item->widget()) {
+ QWidget *pw = w->parentWidget();
if (pw != parent) {
- Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QWidget*](w));
+ Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QWidget *](w));
Shiboken::Object::setParent(pyParent, pyChild);
}
} else {
- QLayout* l = item->layout();
- if (l)
+ if (QLayout *l = item->layout())
qwidgetReparentLayout(parent, l);
}
}
- Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QLayout*](layout));
+ Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QLayout *](layout));
Shiboken::Object::setParent(pyParent, pyChild);
//remove previous references
- Shiboken::Object::keepReference(reinterpret_cast<SbkObject*>(pyChild.object()), qPrintable(retrieveObjectName(pyChild)), Py_None);
+ Shiboken::Object::keepReference(reinterpret_cast<SbkObject *>(pyChild.object()),
+ qPrintable(retrieveObjectName(pyChild)), Py_None);
}
static inline void qwidgetSetLayout(QWidget *self, QLayout *layout)
@@ -493,11 +490,11 @@ static inline void qwidgetSetLayout(QWidget *self, QLayout *layout)
if (!layout || self->layout())
return;
- QObject* oldParent = layout->parent();
+ QObject *oldParent = layout->parent();
if (oldParent && oldParent != self) {
if (oldParent->isWidgetType()) {
// remove old parent policy
- Shiboken::AutoDecRef pyLayout(%CONVERTTOPYTHON[QLayout*](layout));
+ Shiboken::AutoDecRef pyLayout(%CONVERTTOPYTHON[QLayout *](layout));
Shiboken::Object::setParent(Py_None, pyLayout);
} else {
PyErr_Format(PyExc_RuntimeError, "QWidget::setLayout: Attempting to set QLayout \"%s\" on %s \"%s\", when the QLayout already has a parent",
@@ -517,20 +514,20 @@ static inline void qwidgetSetLayout(QWidget *self, QLayout *layout)
// @snippet qwidget-glue
// @snippet qwidget-setstyle
-Shiboken::Object::keepReference(reinterpret_cast<SbkObject*>(%PYSELF), "__style__", %PYARG_1);
+Shiboken::Object::keepReference(reinterpret_cast<SbkObject *>(%PYSELF), "__style__", %PYARG_1);
// @snippet qwidget-setstyle
// @snippet qwidget-style
-QStyle* myStyle = %CPPSELF->style();
+QStyle *myStyle = %CPPSELF->style();
if (myStyle && qApp) {
-%PYARG_0 = %CONVERTTOPYTHON[QStyle*](myStyle);
+%PYARG_0 = %CONVERTTOPYTHON[QStyle *](myStyle);
QStyle *appStyle = qApp->style();
if (appStyle == myStyle) {
- Shiboken::AutoDecRef pyApp(%CONVERTTOPYTHON[QApplication*](qApp));
+ Shiboken::AutoDecRef pyApp(%CONVERTTOPYTHON[QApplication *](qApp));
Shiboken::Object::setParent(pyApp, %PYARG_0);
Shiboken::Object::releaseOwnership(%PYARG_0);
} else {
- Shiboken::Object::keepReference(reinterpret_cast<SbkObject*>(%PYSELF), "__style__", %PYARG_0);
+ Shiboken::Object::keepReference(reinterpret_cast<SbkObject *>(%PYSELF), "__style__", %PYARG_0);
}
}
// @snippet qwidget-style
@@ -543,7 +540,7 @@ static void QApplicationConstructor(PyObject *self, PyObject *pyargv, QApplicati
PyObject *stringlist = PyTuple_GET_ITEM(pyargv, 0);
if (Shiboken::listToArgcArgv(stringlist, &argc, &argv, "PySideApp")) {
*cptr = new QApplicationWrapper(argc, argv, 0);
- Shiboken::Object::releaseOwnership(reinterpret_cast<SbkObject*>(self));
+ Shiboken::Object::releaseOwnership(reinterpret_cast<SbkObject *>(self));
PySide::registerCleanupFunction(&PySide::destroyQCoreApplication);
}
}
@@ -551,7 +548,7 @@ static void QApplicationConstructor(PyObject *self, PyObject *pyargv, QApplicati
// @snippet qapplication-setStyle
if (qApp) {
- Shiboken::AutoDecRef pyApp(%CONVERTTOPYTHON[QApplication*](qApp));
+ Shiboken::AutoDecRef pyApp(%CONVERTTOPYTHON[QApplication *](qApp));
Shiboken::Object::setParent(pyApp, %PYARG_1);
Shiboken::Object::releaseOwnership(%PYARG_1);
}
@@ -563,19 +560,19 @@ qwidgetSetLayout(%CPPSELF, %1);
// @snippet qwidget-setlayout
// @snippet qtabwidget-removetab
-QWidget* tab = %CPPSELF.widget(%1);
+QWidget *tab = %CPPSELF.widget(%1);
if (tab) {
- Shiboken::AutoDecRef pyWidget(%CONVERTTOPYTHON[QWidget*](tab));
+ Shiboken::AutoDecRef pyWidget(%CONVERTTOPYTHON[QWidget *](tab));
%CPPSELF.%FUNCTION_NAME(%1);
}
// @snippet qtabwidget-removetab
// @snippet qtabwidget-clear
-Shiboken::BindingManager& bm = Shiboken::BindingManager::instance();
+Shiboken::BindingManager &bm = Shiboken::BindingManager::instance();
for (int i = 0, count = %CPPSELF.count(); i < count; ++i) {
- QWidget* widget = %CPPSELF.widget(i);
+ QWidget *widget = %CPPSELF.widget(i);
if (bm.hasWrapper(widget)) {
- Shiboken::AutoDecRef pyWidget(%CONVERTTOPYTHON[QWidget*](widget));
+ Shiboken::AutoDecRef pyWidget(%CONVERTTOPYTHON[QWidget *](widget));
Shiboken::Object::releaseOwnership(pyWidget);
}
}
@@ -588,7 +585,7 @@ for (int i = 0, count = %CPPSELF.count(); i < count; ++i) {
// @snippet qtoolbar-addaction-1
QAction *action = %CPPSELF.addAction(%1, %2);
-%PYARG_0 = %CONVERTTOPYTHON[QAction*](action);
+%PYARG_0 = %CONVERTTOPYTHON[QAction *](action);
Shiboken::AutoDecRef result(PyObject_CallMethod(%PYARG_0,
const_cast<char *>("connect"),
const_cast<char *>("OsO"),
@@ -598,7 +595,7 @@ Shiboken::AutoDecRef result(PyObject_CallMethod(%PYARG_0,
// @snippet qtoolbar-addaction-2
QAction *action = %CPPSELF.addAction(%1);
-%PYARG_0 = %CONVERTTOPYTHON[QAction*](action);
+%PYARG_0 = %CONVERTTOPYTHON[QAction *](action);
Shiboken::AutoDecRef result(PyObject_CallMethod(%PYARG_0,
const_cast<char *>("connect"),
const_cast<char *>("OsO"),
@@ -611,12 +608,12 @@ Shiboken::AutoDecRef result(PyObject_CallMethod(%PYARG_0,
// @snippet qtoolbar-addaction-3
// @snippet qtoolbar-clear
-QList<PyObject* > lst;
-Shiboken::BindingManager& bm = Shiboken::BindingManager::instance();
-const auto &toolButtonChildren = %CPPSELF.findChildren<QToolButton*>();
+QList<PyObject *> lst;
+Shiboken::BindingManager &bm = Shiboken::BindingManager::instance();
+const auto &toolButtonChildren = %CPPSELF.findChildren<QToolButton *>();
for (auto *child : toolButtonChildren) {
if (bm.hasWrapper(child)) {
- PyObject* pyChild = %CONVERTTOPYTHON[QToolButton*](child);
+ PyObject *pyChild = %CONVERTTOPYTHON[QToolButton *](child);
Shiboken::Object::setParent(0, pyChild);
lst << pyChild;
}
@@ -625,14 +622,14 @@ for (auto *child : toolButtonChildren) {
//Remove actions
const auto &actions = %CPPSELF.actions();
for (auto *act : actions) {
- Shiboken::AutoDecRef pyAct(%CONVERTTOPYTHON[QAction*](act));
+ Shiboken::AutoDecRef pyAct(%CONVERTTOPYTHON[QAction *](act));
Shiboken::Object::setParent(NULL, pyAct);
Shiboken::Object::invalidate(pyAct);
}
%CPPSELF.clear();
for (auto *obj : lst) {
- Shiboken::Object::invalidate(reinterpret_cast<SbkObject* >(obj));
+ Shiboken::Object::invalidate(reinterpret_cast<SbkObject *>(obj));
Py_XDECREF(obj);
}
// @snippet qtoolbar-clear
@@ -648,9 +645,9 @@ if (!PyTuple_SetItem(empty, 0, PyList_New(0)))
// @snippet qapplication-2
// @snippet qgraphicsproxywidget-setwidget
-QWidget* _old = %CPPSELF.widget();
+QWidget *_old = %CPPSELF.widget();
if (_old)
- Shiboken::Object::setParent(nullptr, %CONVERTTOPYTHON[QWidget*](_old));
+ Shiboken::Object::setParent(nullptr, %CONVERTTOPYTHON[QWidget *](_old));
%CPPSELF.%FUNCTION_NAME(%1);
Shiboken::Object::setParent(%PYSELF, %PYARG_1);
// @snippet qgraphicsproxywidget-setwidget
diff --git a/sources/pyside2/PySide2/glue/qtxml.cpp b/sources/pyside2/PySide2/glue/qtxml.cpp
index ff8be58e2..684ff33c4 100644
--- a/sources/pyside2/PySide2/glue/qtxml.cpp
+++ b/sources/pyside2/PySide2/glue/qtxml.cpp
@@ -38,13 +38,13 @@
****************************************************************************/
// @snippet qxmlentityresolver-resolveentity
-QXmlInputSource* _qxmlinputsource_arg_ = nullptr;
+QXmlInputSource *_qxmlinputsource_arg_ = nullptr;
%BEGIN_ALLOW_THREADS
%RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(%1, %2, _qxmlinputsource_arg_);
%END_ALLOW_THREADS
%PYARG_0 = PyTuple_New(2);
PyTuple_SET_ITEM(%PYARG_0, 0, %CONVERTTOPYTHON[%RETURN_TYPE](%0));
-PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QXmlInputSource*](_qxmlinputsource_arg_));
+PyTuple_SET_ITEM(%PYARG_0, 1, %CONVERTTOPYTHON[QXmlInputSource *](_qxmlinputsource_arg_));
// @snippet qxmlentityresolver-resolveentity
// @snippet qdomdocument-setcontent
diff --git a/sources/pyside2/PySide2/glue/qtxmlpatterns.cpp b/sources/pyside2/PySide2/glue/qtxmlpatterns.cpp
index b559ad1d4..75ad3b265 100644
--- a/sources/pyside2/PySide2/glue/qtxmlpatterns.cpp
+++ b/sources/pyside2/PySide2/glue/qtxmlpatterns.cpp
@@ -38,6 +38,6 @@
****************************************************************************/
// @snippet qxmlschemavalidator-schema
-QXmlSchema* %0 = new QXmlSchema(%CPPSELF.schema());
-%PYARG_0 = %CONVERTTOPYTHON[QXmlSchema*](%0);
+QXmlSchema *%0 = new QXmlSchema(%CPPSELF.schema());
+%PYARG_0 = %CONVERTTOPYTHON[QXmlSchema *](%0);
// @snippet qxmlschemavalidator-schema
diff --git a/sources/pyside2/PySide2/pysideqtesttouch.h b/sources/pyside2/PySide2/pysideqtesttouch.h
index 60d3bbe25..115c7835e 100644
--- a/sources/pyside2/PySide2/pysideqtesttouch.h
+++ b/sources/pyside2/PySide2/pysideqtesttouch.h
@@ -66,28 +66,28 @@ namespace QTest
if (commitWhenDestroyed)
commit();
}
- PySideQTouchEventSequence* press(int touchId, const QPoint &pt, QWindow *window = 0)
+ PySideQTouchEventSequence *press(int touchId, const QPoint &pt, QWindow *window = nullptr)
{
QTouchEvent::TouchPoint &p = point(touchId);
p.setScreenPos(mapToScreen(window, pt));
p.setState(Qt::TouchPointPressed);
return this;
}
- PySideQTouchEventSequence* move(int touchId, const QPoint &pt, QWindow *window = 0)
+ PySideQTouchEventSequence *move(int touchId, const QPoint &pt, QWindow *window = nullptr)
{
QTouchEvent::TouchPoint &p = point(touchId);
p.setScreenPos(mapToScreen(window, pt));
p.setState(Qt::TouchPointMoved);
return this;
}
- PySideQTouchEventSequence* release(int touchId, const QPoint &pt, QWindow *window = 0)
+ PySideQTouchEventSequence *release(int touchId, const QPoint &pt, QWindow *window = nullptr)
{
QTouchEvent::TouchPoint &p = point(touchId);
p.setScreenPos(mapToScreen(window, pt));
p.setState(Qt::TouchPointReleased);
return this;
}
- PySideQTouchEventSequence* stationary(int touchId)
+ PySideQTouchEventSequence *stationary(int touchId)
{
QTouchEvent::TouchPoint &p = pointOrPreviousPoint(touchId);
p.setState(Qt::TouchPointStationary);
@@ -95,7 +95,7 @@ namespace QTest
}
#ifdef QT_WIDGETS_LIB
- PySideQTouchEventSequence* press(int touchId, const QPoint &pt, QWidget *widget = 0)
+ PySideQTouchEventSequence *press(int touchId, const QPoint &pt, QWidget *widget = nullptr)
{
QTouchEvent::TouchPoint &p = point(touchId);
p.setScreenPos(mapToScreen(widget, pt));
@@ -103,7 +103,7 @@ namespace QTest
return this;
}
- PySideQTouchEventSequence* move(int touchId, const QPoint &pt, QWidget *widget = 0)
+ PySideQTouchEventSequence *move(int touchId, const QPoint &pt, QWidget *widget = nullptr)
{
QTouchEvent::TouchPoint &p = point(touchId);
p.setScreenPos(mapToScreen(widget, pt));
@@ -111,7 +111,7 @@ namespace QTest
return this;
}
- PySideQTouchEventSequence* release(int touchId, const QPoint &pt, QWidget *widget = 0)
+ PySideQTouchEventSequence *release(int touchId, const QPoint &pt, QWidget *widget = nullptr)
{
QTouchEvent::TouchPoint &p = point(touchId);
p.setScreenPos(mapToScreen(widget, pt));
@@ -198,14 +198,14 @@ private:
QTouchDevice *device;
bool commitWhenDestroyed;
#ifdef QT_WIDGETS_LIB
- friend PySideQTouchEventSequence* generateTouchEvent(QWidget *, QTouchDevice*, bool);
+ friend PySideQTouchEventSequence *generateTouchEvent(QWidget *, QTouchDevice *, bool);
#endif
- friend PySideQTouchEventSequence* generateTouchEvent(QWindow *, QTouchDevice*, bool);
+ friend PySideQTouchEventSequence *generateTouchEvent(QWindow *, QTouchDevice *, bool);
};
#ifdef QT_WIDGETS_LIB
inline
- PySideQTouchEventSequence* generateTouchEvent(QWidget *widget,
+ PySideQTouchEventSequence *generateTouchEvent(QWidget *widget,
QTouchDevice *device,
bool autoCommit = true)
{
@@ -213,7 +213,7 @@ private:
}
#endif
inline
- PySideQTouchEventSequence* generateTouchEvent(QWindow *window,
+ PySideQTouchEventSequence *generateTouchEvent(QWindow *window,
QTouchDevice *device,
bool autoCommit = true)
{
diff --git a/sources/pyside2/PySide2/qpytextobject.h b/sources/pyside2/PySide2/qpytextobject.h
index ecdfa7fb5..1968ac385 100644
--- a/sources/pyside2/PySide2/qpytextobject.h
+++ b/sources/pyside2/PySide2/qpytextobject.h
@@ -54,9 +54,10 @@ class QPyTextObject : public QObject, public QTextObjectInterface
Q_OBJECT
Q_INTERFACES(QTextObjectInterface)
public:
- QPyTextObject(QObject* parent = 0) : QObject(parent) {}
- void drawObject(QPainter* painter, const QRectF& rect, QTextDocument* doc, int posInDocument, const QTextFormat& format ) = 0;
- QSizeF intrinsicSize(QTextDocument* doc, int posInDocument, const QTextFormat& format ) = 0;
+ QPyTextObject(QObject *parent = nullptr) : QObject(parent) {}
+ void drawObject(QPainter *painter, const QRectF &rect, QTextDocument *doc,
+ int posInDocument, const QTextFormat &format) = 0;
+ QSizeF intrinsicSize(QTextDocument *doc, int posInDocument, const QTextFormat &format) = 0;
};
#endif
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/accessibilityfactorysnippet.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/accessibilityfactorysnippet.cpp
deleted file mode 100644
index 92ce5d2de..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/accessibilityfactorysnippet.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-//! [0]
-QAccessibleInterface *sliderFactory(const QString &classname, QObject *object)
-{
- QAccessibleInterface *interface = 0;
-
- if (classname == "QSlider" && object && object->isWidgetType())
- interface = new SliderInterface(classname,
- static_cast<QWidget *>(object));
-
- return interface;
-}
-
-int main(int argv, char **args)
-{
- QApplication app(argv, args);
- QAccessible::installFactory(sliderFactory);
-//! [0]
-
- QMainWindow mainWindow;
- mainWindow.show();
-
- return app.exec();
-//! [1]
-}
-//! [1]
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/accessibilitypluginsnippet.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/accessibilitypluginsnippet.cpp
deleted file mode 100644
index 438514d8e..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/accessibilitypluginsnippet.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-class SliderPlugin : public QAccessiblePlugin
-{
-public:
- SliderPlugin() {}
-
- QStringList keys() const;
- QAccessibleInterface *create(const QString &classname, QObject *object);
-};
-
-//! [0]
-QStringList SliderPlugin::keys() const
-{
- return QStringList() << "QSlider";
-}
-//! [0]
-
-//! [1]
-QAccessibleInterface *SliderPlugin::create(const QString &classname, QObject *object)
-{
- QAccessibleInterface *interface = 0;
-
- if (classname == "QSlider" && object && object->isWidgetType())
- interface = new AccessibleSlider(classname, static_cast<QWidget *>(object));
-
- return interface;
-}
-//! [1]
-
-//! [2]
-Q_EXPORT_STATIC_PLUGIN(SliderPlugin)
-Q_EXPORT_PLUGIN2(acc_sliderplugin, SliderPlugin)
-//! [2]
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/brush/brush.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/brush/brush.cpp
deleted file mode 100644
index ad842a982..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/brush/brush.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-int main()
-{
- QWidget anyPaintDevice;
- {
- // PEN SNIPPET
- QPainter painter;
- QPen pen(Qt::red, 2); // red solid line, 2 pixels wide
- painter.begin(&anyPaintDevice); // paint something
- painter.setPen(pen); // set the red, wide pen
- painter.drawRect(40,30, 200,100); // draw a rectangle
- painter.setPen(Qt::blue); // set blue pen, 0 pixel width
- painter.drawLine(40,30, 240,130); // draw a diagonal in rectangle
- painter.end(); // painting done
- }
-
- {
- // BRUSH SNIPPET
- QPainter painter;
- QBrush brush(Qt::yellow); // yellow solid pattern
- painter.begin(&anyPaintDevice); // paint something
- painter.setBrush(brush); // set the yellow brush
- painter.setPen(Qt::NoPen); // do not draw outline
- painter.drawRect(40,30, 200,100); // draw filled rectangle
- painter.setBrush(Qt::NoBrush); // do not fill
- painter.setPen(Qt::black); // set black pen, 0 pixel width
- painter.drawRect(10,10, 30,20); // draw rectangle outline
- painter.end(); // painting done
- }
-
- // LINEAR
-//! [0]
- linearGrad = QLinearGradient(QPointF(100, 100), QPointF(200, 200))
- linearGrad.setColorAt(0, Qt.black)
- linearGrad.setColorAt(1, Qt.white)
-//! [0]
-
- // RADIAL
-//! [1]
- radialGrad = QRadialGradient(QPointF(100, 100), 100)
- radialGrad.setColorAt(0, Qt.red)
- radialGrad.setColorAt(0.5, Qt.blue)
- radialGrad.setColorAt(1, Qt.green)
-//! [1]
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/brush/gradientcreationsnippet.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/brush/gradientcreationsnippet.cpp
deleted file mode 100644
index 25d6667d8..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/brush/gradientcreationsnippet.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-int main(int argv, char **args)
-{
- QApplication app(argv, args);
-
-//! [0]
- gradient = QRadialGradient gradient(50, 50, 50, 50, 50)
- gradient.setColorAt(0, QColor.fromRgbF(0, 1, 0, 1))
- gradient.setColorAt(1, QColor.fromRgbF(0, 0, 0, 0))
-
- brush = QBrush(gradient)
-//! [0]
-
- QWidget widget;
- QPalette palette;
- palette.setBrush(widget.backgroundRole(), brush);
- widget.setPalette(palette);
- widget.show();
-
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/brushstyles/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/brushstyles/main.cpp
deleted file mode 100644
index c87400118..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/brushstyles/main.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-
-#include "stylewidget.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- StyleWidget widget;
- widget.show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/brushstyles/renderarea.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/brushstyles/renderarea.cpp
deleted file mode 100644
index b40bddc5b..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/brushstyles/renderarea.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "renderarea.h"
-
-RenderArea::RenderArea(QBrush *brush, QWidget *parent)
- : QWidget(parent)
-{
- currentBrush = brush;
-}
-
-QSize RenderArea::minimumSizeHint() const
-{
- return QSize(120, 60);
-}
-
-void RenderArea::paintEvent(QPaintEvent *)
-{
- QPainter painter(this);
- painter.setPen(Qt::NoPen);
- painter.setRenderHint(QPainter::Antialiasing);
-
-
- if(currentBrush->style() == Qt::LinearGradientPattern) {
- currentBrush = new QBrush(QLinearGradient(0, 0, width(), 60));
- } else if(currentBrush->style() == Qt::RadialGradientPattern) {
- QRadialGradient radial(width() / 2, 30, width() / 2, width() / 2, 30);
- radial.setColorAt(0, Qt::white);
- radial.setColorAt(1, Qt::black);
- currentBrush = new QBrush(radial);
- } else if(currentBrush->style() == Qt::ConicalGradientPattern) {
- currentBrush = new QBrush(QConicalGradient(width() / 2, 30, 90));
- }
- painter.setBrush(*currentBrush);
-
- QPainterPath path;
- path.addRect(0, 0, parentWidget()->width(), 60);
- painter.drawPath(path);
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/brushstyles/stylewidget.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/brushstyles/stylewidget.cpp
deleted file mode 100644
index 92e9e7f7f..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/brushstyles/stylewidget.cpp
+++ /dev/null
@@ -1,154 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "stylewidget.h"
-
-StyleWidget::StyleWidget(QWidget *parent)
- : QWidget(parent)
-{
- solid = new RenderArea(new QBrush(Qt::SolidPattern));
- dense1 = new RenderArea(new QBrush(Qt::Dense1Pattern));
- dense2 = new RenderArea(new QBrush(Qt::Dense2Pattern));
- dense3 = new RenderArea(new QBrush(Qt::Dense3Pattern));
- dense4 = new RenderArea(new QBrush(Qt::Dense4Pattern));
- dense5 = new RenderArea(new QBrush(Qt::Dense5Pattern));
- dense6 = new RenderArea(new QBrush(Qt::Dense6Pattern));
- dense7 = new RenderArea(new QBrush(Qt::Dense7Pattern));
- no = new RenderArea(new QBrush(Qt::NoBrush));
- hor = new RenderArea(new QBrush(Qt::HorPattern));
- ver = new RenderArea(new QBrush(Qt::VerPattern));
- cross = new RenderArea(new QBrush(Qt::CrossPattern));
- bdiag = new RenderArea(new QBrush(Qt::BDiagPattern));
- fdiag = new RenderArea(new QBrush(Qt::FDiagPattern));
- diagCross = new RenderArea(new QBrush(Qt::DiagCrossPattern));
- linear = new RenderArea(new QBrush(QLinearGradient()));
- radial = new RenderArea(new QBrush(QRadialGradient()));
- conical = new RenderArea(new QBrush(QConicalGradient()));
- texture = new RenderArea(new QBrush(QPixmap("qt-logo.png")));
-
- solidLabel = new QLabel("Qt::SolidPattern");
- dense1Label = new QLabel("Qt::Dense1Pattern");
- dense2Label = new QLabel("Qt::Dense2Pattern");
- dense3Label = new QLabel("Qt::Dense3Pattern");
- dense4Label = new QLabel("Qt::Dense4Pattern");
- dense5Label = new QLabel("Qt::Dense5Pattern");
- dense6Label = new QLabel("Qt::Dense6Pattern");
- dense7Label = new QLabel("Qt::Dense7Pattern");
- noLabel = new QLabel("Qt::NoPattern");
- horLabel = new QLabel("Qt::HorPattern");
- verLabel = new QLabel("Qt::VerPattern");
- crossLabel = new QLabel("Qt::CrossPattern");
- bdiagLabel = new QLabel("Qt::BDiagPattern");
- fdiagLabel = new QLabel("Qt::FDiagPattern");
- diagCrossLabel = new QLabel("Qt::DiagCrossPattern");
- linearLabel = new QLabel("Qt::LinearGradientPattern");
- radialLabel = new QLabel("Qt::RadialGradientPattern");
- conicalLabel = new QLabel("Qt::ConicalGradientPattern");
- textureLabel = new QLabel("Qt::TexturePattern");
-
- QGridLayout *layout = new QGridLayout;
- layout->addWidget(solid, 0, 0);
- layout->addWidget(dense1, 0, 1);
- layout->addWidget(dense2, 0, 2);
- layout->addWidget(solidLabel, 1, 0);
- layout->addWidget(dense1Label, 1, 1);
- layout->addWidget(dense2Label, 1, 2);
-
- layout->addWidget(dense3, 2, 0 );
- layout->addWidget(dense4, 2, 1);
- layout->addWidget(dense5, 2, 2);
- layout->addWidget(dense3Label, 3, 0);
- layout->addWidget(dense4Label, 3, 1);
- layout->addWidget(dense5Label, 3, 2);
-
- layout->addWidget(dense6, 4, 0);
- layout->addWidget(dense7, 4, 1);
- layout->addWidget(no, 4, 2);
- layout->addWidget(dense6Label, 5, 0);
- layout->addWidget(dense7Label, 5, 1);
- layout->addWidget(noLabel, 5, 2);
-
- layout->addWidget(hor, 6, 0);
- layout->addWidget(ver, 6, 1);
- layout->addWidget(cross, 6, 2);
- layout->addWidget(horLabel, 7, 0);
- layout->addWidget(verLabel, 7, 1);
- layout->addWidget(crossLabel, 7, 2);
-
- layout->addWidget(bdiag, 8, 0);
- layout->addWidget(fdiag, 8, 1);
- layout->addWidget(diagCross, 8, 2);
- layout->addWidget(bdiagLabel, 9, 0);
- layout->addWidget(fdiagLabel, 9, 1);
- layout->addWidget(diagCrossLabel, 9, 2);
-
- layout->addWidget(linear, 10, 0);
- layout->addWidget(radial, 10, 1);
- layout->addWidget(conical, 10, 2);
- layout->addWidget(linearLabel, 11, 0);
- layout->addWidget(radialLabel, 11, 1);
- layout->addWidget(conicalLabel, 11, 2);
-
- layout->addWidget(texture, 12, 0, 1, 3);
- layout->addWidget(textureLabel, 13, 0, 1, 3);
-
- setLayout(layout);
-
- QPalette newPalette = palette();
- newPalette.setColor(QPalette::Window, Qt::white);
- setPalette(newPalette);
-
- setWindowTitle(tr("Brush Styles"));
- resize(430, 605);
-}
-
-
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/buffer/buffer.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/buffer/buffer.cpp
deleted file mode 100644
index 8034fa63c..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/buffer/buffer.cpp
+++ /dev/null
@@ -1,133 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QBuffer>
-#include <QPalette>
-
-static void main_snippet()
-{
-//! [0]
- buffer = QBuffer()
-
- buffer.open(QBuffer.ReadWrite)
- buffer.write("Qt rocks!")
- buffer.seek(0)
- ch = buffer.getChar() # ch == 'Q'
- ch = buffer.getChar() # ch == 't'
- ch = buffer.getChar() # ch == ' '
- ch = buffer.getChar() # ch == 'r'
-//! [0]
-}
-
-static void write_datastream_snippets()
-{
-//! [1]
- byteArray = QByteArray()
- buffer = QBuffer(byteArray)
- buffer.open(QIODevice.WriteOnly)
-
- out = QDataStream(buffer)
- out << QApplication.palette()
-//! [1]
-}
-
-static void read_datastream_snippets()
-{
- QByteArray byteArray;
-
-//! [2]
- palette = QPalette()
- buffer = QBuffer(byteArray)
- buffer.open(QIODevice.ReadOnly)
-
- in = QDataStream(buffer)
- in >> palette
-//! [2]
-}
-
-static void bytearray_ptr_ctor_snippet()
-{
-//! [3]
- byteArray = QByteArray("abc")
- buffer = QBuffer(byteArray)
- buffer.open(QIODevice.WriteOnly)
- buffer.seek(3)
- buffer.write("def")
- buffer.close()
- # byteArray == "abcdef"
-//! [3]
-}
-
-static void setBuffer_snippet()
-{
-//! [4]
- byteArray = QByteArray("abc")
- buffer = QBuffer()
- buffer.setBuffer(byteArray)
- buffer.open(QIODevice.WriteOnly)
- buffer.seek(3)
- buffer.write("def")
- buffer.close()
- # byteArray == "abcdef"
-//! [4]
-}
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- main_snippet();
- bytearray_ptr_ctor_snippet();
- write_datastream_snippets();
- read_datastream_snippets();
- setBuffer_snippet();
- return 0;
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/clipboard/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/clipboard/main.cpp
deleted file mode 100644
index f7eea6c1e..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/clipboard/main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-
-#include "clipwindow.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- ClipWindow *window = new ClipWindow;
- window->resize(640, 480);
- window->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/code/src_corelib_global_qglobal.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/code/src_corelib_global_qglobal.cpp
deleted file mode 100644
index c172beb21..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/code/src_corelib_global_qglobal.cpp
+++ /dev/null
@@ -1,514 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-label.setAlignment(Qt.AlignLeft | Qt.AlignTop)
-//! [0]
-
-
-//! [1]
-class MyClass
-{
-public:
- enum Option {
- NoOptions = 0x0,
- ShowTabs = 0x1,
- ShowAll = 0x2,
- SqueezeBlank = 0x4
- };
- Q_DECLARE_FLAGS(Options, Option)
- ...
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(MyClass::Options)
-//! [1]
-
-//! [meta-object flags]
-Q_FLAGS(Options)
-//! [meta-object flags]
-
-//! [2]
-typedef QFlags<Enum> Flags;
-//! [2]
-
-
-//! [3]
-int myValue = 10;
-int minValue = 2;
-int maxValue = 6;
-
-int boundedValue = qBound(minValue, myValue, maxValue);
-// boundedValue == 6
-//! [3]
-
-
-//! [4]
-if (!driver()->isOpen() || driver()->isOpenError()) {
- qWarning("QSqlQuery::exec: database not open");
- return false;
-}
-//! [4]
-
-
-//! [5]
-qint64 value = Q_INT64_C(932838457459459);
-//! [5]
-
-
-//! [6]
-quint64 value = Q_UINT64_C(932838457459459);
-//! [6]
-
-
-//! [7]
-void myMsgHandler(QtMsgType, const char *);
-//! [7]
-
-
-//! [8]
-qint64 value = Q_INT64_C(932838457459459);
-//! [8]
-
-
-//! [9]
-quint64 value = Q_UINT64_C(932838457459459);
-//! [9]
-
-
-//! [10]
-myValue = -4
-absoluteValue = qAbs(myValue)
-// absoluteValue == 4
-//! [10]
-
-
-//! [11]
-valueA = 2.3
-valueB = 2.7
-
-roundedValueA = qRound(valueA)
-// roundedValueA = 2
-roundedValueB = qRound(valueB)
-// roundedValueB = 3
-//! [11]
-
-
-//! [12]
-valueA = 42949672960.3
-valueB = 42949672960.7
-
-roundedValueA = qRound(valueA)
-// roundedValueA = 42949672960
-roundedValueB = qRound(valueB)
-// roundedValueB = 42949672961
-//! [12]
-
-
-//! [13]
-myValue = 6
-yourValue = 4
-
-minValue = qMin(myValue, yourValue)
-// minValue == yourValue
-//! [13]
-
-
-//! [14]
-myValue = 6
-yourValue = 4
-
-maxValue = qMax(myValue, yourValue)
-// maxValue == myValue
-//! [14]
-
-
-//! [15]
-myValue = 10
-minValue = 2
-maxValue = 6
-
-boundedValue = qBound(minValue, myValue, maxValue)
-// boundedValue == 6
-//! [15]
-
-
-//! [16]
-#if QT_VERSION >= 0x040100
- QIcon icon = style()->standardIcon(QStyle::SP_TrashIcon);
-#else
- QPixmap pixmap = style()->standardPixmap(QStyle::SP_TrashIcon);
- QIcon icon(pixmap);
-#endif
-//! [16]
-
-
-//! [17]
-// File: div.cpp
-
-#include <QtGlobal>
-
-int divide(int a, int b)
-{
- Q_ASSERT(b != 0);
- return a / b;
-}
-//! [17]
-
-
-//! [18]
-ASSERT: "b == 0" in file div.cpp, line 7
-//! [18]
-
-
-//! [19]
-// File: div.cpp
-
-#include <QtGlobal>
-
-int divide(int a, int b)
-{
- Q_ASSERT_X(b != 0, "divide", "division by zero");
- return a / b;
-}
-//! [19]
-
-
-//! [20]
-ASSERT failure in divide: "division by zero", file div.cpp, line 7
-//! [20]
-
-
-//! [21]
-int *a;
-
-Q_CHECK_PTR(a = new int[80]); // WRONG!
-
-a = new (nothrow) int[80]; // Right
-Q_CHECK_PTR(a);
-//! [21]
-
-
-//! [22]
-template<typename TInputType>
-const TInputType &myMin(const TInputType &value1, const TInputType &value2)
-{
- qDebug() << Q_FUNC_INFO << "was called with value1:" << value1 << "value2:" << value2;
-
- if(value1 < value2)
- return value1;
- else
- return value2;
-}
-//! [22]
-
-
-//! [23]
-#include <qapplication.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-void myMessageOutput(QtMsgType type, const char *msg)
-{
- switch (type) {
- case QtDebugMsg:
- fprintf(stderr, "Debug: %s\n", msg);
- break;
- case QtWarningMsg:
- fprintf(stderr, "Warning: %s\n", msg);
- break;
- case QtCriticalMsg:
- fprintf(stderr, "Critical: %s\n", msg);
- break;
- case QtFatalMsg:
- fprintf(stderr, "Fatal: %s\n", msg);
- abort();
- }
-}
-
-int main(int argc, char **argv)
-{
- qInstallMsgHandler(myMessageOutput);
- QApplication app(argc, argv);
- ...
- return app.exec();
-}
-//! [23]
-
-
-//! [24]
-qDebug("Items in list: %d", myList.size());
-//! [24]
-
-
-//! [25]
-qDebug() << "Brush:" << myQBrush << "Other value:" << i;
-//! [25]
-
-
-//! [26]
-void f(int c)
-{
- if (c > 200)
- qWarning("f: bad argument, c == %d", c);
-}
-//! [26]
-
-
-//! [27]
-qWarning() << "Brush:" << myQBrush << "Other value:"
-<< i;
-//! [27]
-
-
-//! [28]
-void load(const QString &fileName)
-{
- QFile file(fileName);
- if (!file.exists())
- qCritical("File '%s' does not exist!", qPrintable(fileName));
-}
-//! [28]
-
-
-//! [29]
-qCritical() << "Brush:" << myQBrush << "Other
-value:" << i;
-//! [29]
-
-
-//! [30]
-int divide(int a, int b)
-{
- if (b == 0) // program error
- qFatal("divide: cannot divide by zero");
- return a / b;
-}
-//! [30]
-
-
-//! [31]
-forever {
- ...
-}
-//! [31]
-
-
-//! [32]
-CONFIG += no_keywords
-//! [32]
-
-
-//! [33]
-CONFIG += no_keywords
-//! [33]
-
-
-//! [34]
-QString FriendlyConversation::greeting(int type)
-{
-static const char *greeting_strings[] = {
- QT_TR_NOOP("Hello"),
- QT_TR_NOOP("Goodbye")
-};
-return tr(greeting_strings[type]);
-}
-//! [34]
-
-
-//! [35]
-static const char *greeting_strings[] = {
- QT_TRANSLATE_NOOP("FriendlyConversation", "Hello"),
- QT_TRANSLATE_NOOP("FriendlyConversation", "Goodbye")
-};
-
-QString FriendlyConversation::greeting(int type)
-{
- return tr(greeting_strings[type]);
-}
-
-QString global_greeting(int type)
-{
- return qApp->translate("FriendlyConversation",
- greeting_strings[type]);
-}
-//! [35]
-
-
-//! [36]
-
-static { const char *source; const char *comment; } greeting_strings[] =
-{
- QT_TRANSLATE_NOOP3("FriendlyConversation", "Hello",
- "A really friendly hello"),
- QT_TRANSLATE_NOOP3("FriendlyConversation", "Goodbye",
- "A really friendly goodbye")
-};
-
-QString FriendlyConversation::greeting(int type)
-{
- return tr(greeting_strings[type].source,
- greeting_strings[type].comment);
-}
-
-QString global_greeting(int type)
-{
- return qApp->translate("FriendlyConversation",
- greeting_strings[type].source,
- greeting_strings[type].comment);
-}
-//! [36]
-
-
-//! [37]
-qWarning("%s: %s", qPrintable(key), qPrintable(value));
-//! [37]
-
-
-//! [38]
-struct Point2D
-{
- int x;
- int y;
-};
-
-Q_DECLARE_TYPEINFO(Point2D, Q_PRIMITIVE_TYPE);
-//! [38]
-
-
-//! [39]
-class Point2D
-{
-public:
- Point2D() { data = new int[2]; }
- Point2D(const Point2D &other) { ... }
- ~Point2D() { delete[] data; }
-
- Point2D &operator=(const Point2D &other) { ... }
-
- int x() const { return data[0]; }
- int y() const { return data[1]; }
-
-private:
- int *data;
-};
-
-Q_DECLARE_TYPEINFO(Point2D, Q_MOVABLE_TYPE);
-//! [39]
-
-
-//! [40]
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
-...
-#endif
-
-or
-
-#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
-...
-#endif
-
-//! [40]
-
-
-//! [41]
-
-#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
-...
-#endif
-
-//! [41]
-
-
-//! [42]
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
-...
-#endif
-
-//! [42]
-
-//! [begin namespace macro]
-namespace QT_NAMESPACE {
-//! [begin namespace macro]
-
-//! [end namespace macro]
-}
-//! [end namespace macro]
-
-//! [43]
-class MyClass : public QObject
-{
-
- private:
- Q_DISABLE_COPY(MyClass)
-};
-
-//! [43]
-
-//! [44]
-class MyClass : public QObject
-{
-
- private:
- MyClass(const MyClass &);
- MyClass &operator=(const MyClass &);
-};
-//! [44]
-
-//! [45]
- w = QWidget()
-//! [45]
-
-//! [46]
- // Instead of comparing with 0.0
- qFuzzyCompare(0.0,1.0e-200); // This will return false
- // Compare adding 1 to both values will fix the problem
- qFuzzyCompare(1 + 0.0, 1 + 1.0e-200); // This will return true
-//! [46]
-
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/code/src_gui_dialogs_qmessagebox.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/code/src_gui_dialogs_qmessagebox.cpp
deleted file mode 100644
index 55cdf8148..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/code/src_gui_dialogs_qmessagebox.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-ret = QMessageBox.warning(self, self.tr("My Application"),
- self.tr("The document has been modified.\n" + \
- "Do you want to save your changes?"),
- QMessageBox.Save | QMessageBox.Discard
- | QMessageBox.Cancel,
- QMessageBox.Save)
-//! [0]
-
-
-//! [1]
-msgBox = QMessageBox()
-msgBox.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
-result = msgBox.exec_()
-
-if result == QMessageBox.Yes:
- # yes was clicked
-elif result == QMessageBox.No:
- # no was clicked
-else:
- # should never be reached
-//! [1]
-
-
-//! [2]
-msgBox = QMessageBox()
-connectButton = msgBox.addButton(self.tr("Connect"), QMessageBox.ActionRole)
-abortButton = msgBox.addButton(QMessageBox.Abort)
-
-msgBox.exec_()
-
-if msgBox.clickedButton() == connectButton:
- # connect
-elif msgBox.clickedButton() == abortButton:
- # abort
-}
-//! [2]
-
-
-//! [3]
-messageBox = QMessageBox(self)
-disconnectButton = messageBox.addButton(self.tr("Disconnect"),
- QMessageBox.ActionRole)
-...
-messageBox.exec_()
-if messageBox.clickedButton() == disconnectButton:
- ...
-
-//! [3]
-
-
-//! [4]
-#include <QApplication>
-#include <QMessageBox>
-
-int main(int argc, char *argv[])
-{
-# Not Supported by PySide
- QT_REQUIRE_VERSION(argc, argv, "4.0.2")
-
- QApplication app(argc, argv);
- ...
- return app.exec();
-}
-//! [4]
-
-//! [5]
-msgBox = QMessageBox()
-msgBox.setText("The document has been modified.")
-msgBox.exec_()
-//! [5]
-
-//! [6]
-msgBox = QMessageBox()
-msgBox.setText("The document has been modified.")
-msgBox.setInformativeText("Do you want to save your changes?")
-msgBox.setStandardButtons(QMessageBox.Save | QMessageBox.Discard | QMessageBox.Cancel)
-msgBox.setDefaultButton(QMessageBox.Save)
-ret = msgBox.exec_()
-//! [6]
-
-//! [7]
-
-if ret == QMessageBox.Save:
- # Save was clicked
-elif ret == QMessageBox.Discard:
- # Don't save was clicked
-elif ret == QMessageBox.Cancel:
- # cancel was clicked
-else:
- # should never be reached
-
-//! [7]
-
-//! [9]
-msgBox = QMessageBox(self)
-msgBox.setText(tr("The document has been modified.\n" + \
- "Do you want to save your changes?"))
-msgBox.setStandardButtons(QMessageBox.Save | QMessageBox.Discard
- | QMessageBox.Cancel)
-msgBox.setDefaultButton(QMessageBox.Save)
-//! [9]
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/code/src_gui_text_qtextdocument.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/code/src_gui_text_qtextdocument.cpp
deleted file mode 100644
index 201d14fbe..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/code/src_gui_text_qtextdocument.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-plain = QString("#include <QtCore>")
-html = Qt::escape(plain)
-# html == "#include &lt;QtCore&gt;"
-//! [0]
-
-
-//! [1]
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body>...
-//! [1]
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/code/src_sql_kernel_qsqldatabase.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/code/src_sql_kernel_qsqldatabase.cpp
deleted file mode 100644
index 6bf0e003b..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/code/src_sql_kernel_qsqldatabase.cpp
+++ /dev/null
@@ -1,146 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-# WRONG
-db = QSqlDatabase.database("sales")
-query = QSqlQuery("SELECT NAME, DOB FROM EMPLOYEES", db)
-QSqlDatabase.removeDatabase("sales") # will output a warning
-
-# "db" is now a dangling invalid database connection,
-# "query" contains an invalid result set
-//! [0]
-
-
-//! [1]
-db = QSqlDatabase.database("sales")
-query = QSqlQuery("SELECT NAME, DOB FROM EMPLOYEES", db)
-# Both "db" and "query" are destroyed because they are out of scope
-QSqlDatabase.removeDatabase("sales") # correct
-//! [1]
-
-
-//! [2]
-class MyDatabaseDriverCreatorBase(QtSql.QSqlDriverCreatorBase):
- ...
- def createObject(self):
- return MyDatabaseDriver()
-
-mydriver = MyDatabaseDriverCreatorBase()
-QtSql.QSqlDatabase.registerSqlDriver("MYDRIVER", mydriver)
-db = QtSql.QSqlDatabase.addDatabase("MYDRIVER")
-//! [2]
-
-
-//! [3]
-...
-db = QSqlDatabase.addDatabase("QODBC")
-db.setDatabaseName("DRIVER={Microsoft Access Driver (*.mdb)};FIL={MS Access};DBQ=myaccessfile.mdb")
-if db.open():
- # success!
- pass
-...
-//! [3]
-
-
-//! [4]
-...
-# MySQL connection
-db.setConnectOptions("CLIENT_SSL=1;CLIENT_IGNORE_SPACE=1") # use an SSL connection to the server
-if not db.open():
- db.setConnectOptions() # clears the connect option string
- ...
-...
-# PostgreSQL connection
-db.setConnectOptions("requiressl=1") # enable PostgreSQL SSL connections
-if not db.open():
- db.setConnectOptions() # clear options
- ...
-...
-# ODBC connection
-# set ODBC options
-db.setConnectOptions("SQL_ATTR_ACCESS_MODE=SQL_MODE_READ_ONLY;SQL_ATTR_TRACE=SQL_OPT_TRACE_ON")
-if not db.open():
- db.setConnectOptions() # don't try to set this option
- ...
-//! [4]
-
-
-//! [5]
-#include "qtdir/src/sql/drivers/psql/qsql_psql.cpp"
-//! [5]
-
-
-//! [6]
-con = PQconnectdb("host=server user=bart password=simpson dbname=springfield")
-drv = QPSQLDriver(con)
-db = QSqlDatabase.addDatabase(drv) # becomes the new default connection
-query = QSqlQuery()
-query.exec_("SELECT NAME, ID FROM STAFF")
-...
-//! [6]
-
-
-//! [7]
-unix:LIBS += -lpq
-win32:LIBS += libpqdll.lib
-//! [7]
-
-
-//! [8]
-db = QSqlDatabase()
-print(db.isValid()) # Returns False
-
-db = QSqlDatabase.database("sales")
-print(db.isValid()) # Returns True if "sales" connection exists
-
-QSqlDatabase.removeDatabase("sales")
-print(db.isValid()) # Returns False
-//! [8]
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/coordsys/coordsys.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/coordsys/coordsys.cpp
deleted file mode 100644
index 068864fdd..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/coordsys/coordsys.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-class MyWidget : public QWidget
-{
-public:
- MyWidget();
-
-protected:
- void paintEvent(QPaintEvent *);
-};
-
-MyWidget::MyWidget()
-{
- QPalette palette(MyWidget::palette());
- palette.setColor(backgroundRole(), Qt::white);
- setPalette(palette);
-}
-
-void MyWidget::paintEvent(QPaintEvent *)
-{
- QPainter painter(this);
- painter.setRenderHint(QPainter::Antialiasing);
- painter.setPen(Qt::darkGreen);
- painter.drawRect(1, 2, 6, 4);
-
- //painter.setPen(Qt::darkGray);
- //painter.drawLine(2, 8, 6, 2);
-}
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- MyWidget widget;
- widget.show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/customstyle/customstyle.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/customstyle/customstyle.cpp
deleted file mode 100644
index cd0af7819..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/customstyle/customstyle.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "customstyle.h"
-
-CustomStyle::CustomStyle()
-{
-//! [0]
- if widget:
-//! [0] //! [1]
-//! [1]
-}
-
-//! [2]
-def drawPrimitive(element, option, painter, widget):
- if element == PE_IndicatorSpinUp or element == PE_IndicatorSpinDown:
- points = QPolygon(3)
- x = option->rect.x()
- y = option->rect.y()
- w = option->rect.width() / 2
- h = option->rect.height() / 2
- x += (option->rect.width() - w) / 2
- y += (option->rect.height() - h) / 2
-
- if element == PE_IndicatorSpinUp:
- points[0] = QPoint(x, y + h)
- points[1] = QPoint(x + w, y + h)
- points[2] = QPoint(x + w / 2, y)
- else: # PE_SpinBoxDown
- points[0] = QPoint(x, y)
- points[1] = QPoint(x + w, y)
- points[2] = QPoint(x + w / 2, y + h)
-
- if option.state & State_Enabled:
- painter.setPen(option.palette.mid().color())
- painter.setBrush(option.palette.buttonText())
- else:
- painter.setPen(option.palette.buttonText().color())
- painter.setBrush(option.palette.mid())
-
- painter.drawPolygon(points)
-
- else:
- QWindowsStyle.drawPrimitive(element, option, painter, widget)
-//! [2] //! [3]
-
-//! [3] //! [4]
-}
-//! [4]
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/customstyle/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/customstyle/main.cpp
deleted file mode 100644
index ec0636e8d..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/customstyle/main.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [using a custom style]
-#include <QtWidgets>
-
-#include "customstyle.h"
-
-int main(int argc, char *argv[])
-{
- QApplication::setStyle(new CustomStyle);
- QApplication app(argc, argv);
- QSpinBox spinBox;
- spinBox.show();
- return app.exec();
-}
-//! [using a custom style]
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/customviewstyle.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/customviewstyle.cpp
deleted file mode 100644
index a8a9364d9..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/customviewstyle.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "customviewstyle.h"
-
-
-
-void CustomViewStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
-{
-
-//![0]
- switch (element) {
- case (PE_PanelItemViewItem): {
- painter->save();
-
- QPoint topLeft = option->rect.topLeft();
- QPoint bottomRight = option->rect.topRight();
- QLinearGradient backgroundGradient(topLeft, bottomRight);
- backgroundGradient.setColorAt(0.0, QColor(Qt::yellow).lighter(190));
- backgroundGradient.setColorAt(1.0, Qt::white);
- painter->fillRect(option->rect, QBrush(backgroundGradient));
-
- painter->restore();
- break;
- }
- default:
- QProxyStyle::drawPrimitive(element, option, painter, widget);
- }
-//![0]
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/designer/autoconnection/imagedialog.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/designer/autoconnection/imagedialog.cpp
deleted file mode 100644
index c0a732682..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/designer/autoconnection/imagedialog.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "imagedialog.h"
-
-ImageDialog::ImageDialog(QWidget *parent)
- : QDialog(parent)
-{
- setupUi(this);
- okButton->setAutoDefault(false);
- cancelButton->setAutoDefault(false);
-
- colorDepthCombo->addItem(tr("2 colors (1 bit per pixel)"));
- colorDepthCombo->addItem(tr("4 colors (2 bits per pixel)"));
- colorDepthCombo->addItem(tr("16 colors (4 bits per pixel)"));
- colorDepthCombo->addItem(tr("256 colors (8 bits per pixel)"));
- colorDepthCombo->addItem(tr("65536 colors (16 bits per pixel)"));
- colorDepthCombo->addItem(tr("16 million colors (24 bits per pixel)"));
-
- connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
-}
-
-void ImageDialog::on_okButton_clicked()
-{
- if (nameLineEdit->text().isEmpty())
- (void) QMessageBox::information(this, tr("No Image Name"),
- tr("Please supply a name for the image."), QMessageBox::Cancel);
- else
- accept();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/designer/autoconnection/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/designer/autoconnection/main.cpp
deleted file mode 100644
index db74fe0e2..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/designer/autoconnection/main.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "imagedialog.h"
-
-#include <QApplication>
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- ImageDialog *dialog = new ImageDialog;
- dialog->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/designer/imagedialog/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/designer/imagedialog/main.cpp
deleted file mode 100644
index aed18a234..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/designer/imagedialog/main.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "ui_imagedialog.h"
-#include <QApplication>
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- QDialog *window = new QDialog;
- Ui::ImageDialog ui;
- ui.setupUi(window);
-
- window->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/designer/multipleinheritance/imagedialog.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/designer/multipleinheritance/imagedialog.cpp
deleted file mode 100644
index fede71a5e..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/designer/multipleinheritance/imagedialog.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "imagedialog.h"
-
-ImageDialog::ImageDialog(QWidget *parent)
- : QDialog(parent)
-{
- setupUi(this);
-
- colorDepthCombo->addItem(tr("2 colors (1 bit per pixel)"));
- colorDepthCombo->addItem(tr("4 colors (2 bits per pixel)"));
- colorDepthCombo->addItem(tr("16 colors (4 bits per pixel)"));
- colorDepthCombo->addItem(tr("256 colors (8 bits per pixel)"));
- colorDepthCombo->addItem(tr("65536 colors (16 bits per pixel)"));
- colorDepthCombo->addItem(tr("16 million colors (24 bits per pixel)"));
-
- connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
- connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/designer/multipleinheritance/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/designer/multipleinheritance/main.cpp
deleted file mode 100644
index db74fe0e2..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/designer/multipleinheritance/main.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "imagedialog.h"
-
-#include <QApplication>
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- ImageDialog *dialog = new ImageDialog;
- dialog->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/designer/noautoconnection/imagedialog.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/designer/noautoconnection/imagedialog.cpp
deleted file mode 100644
index 6dae19212..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/designer/noautoconnection/imagedialog.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "imagedialog.h"
-
-//! [0]
-ImageDialog::ImageDialog(QWidget *parent)
- : QDialog(parent)
-{
- setupUi(this);
- okButton->setAutoDefault(false);
- cancelButton->setAutoDefault(false);
-//! [0]
-
- colorDepthCombo->addItem(tr("2 colors (1 bit per pixel)"));
- colorDepthCombo->addItem(tr("4 colors (2 bits per pixel)"));
- colorDepthCombo->addItem(tr("16 colors (4 bits per pixel)"));
- colorDepthCombo->addItem(tr("256 colors (8 bits per pixel)"));
- colorDepthCombo->addItem(tr("65536 colors (16 bits per pixel)"));
- colorDepthCombo->addItem(tr("16 million colors (24 bits per pixel)"));
-
- connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
-//! [1]
- connect(okButton, SIGNAL(clicked()), this, SLOT(checkValues()));
-}
-//! [1]
-
-//! [2]
-void ImageDialog::checkValues()
-{
- if (nameLineEdit->text().isEmpty())
- (void) QMessageBox::information(this, tr("No Image Name"),
- tr("Please supply a name for the image."), QMessageBox::Cancel);
- else
- accept();
-}
-//! [2]
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/designer/noautoconnection/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/designer/noautoconnection/main.cpp
deleted file mode 100644
index db74fe0e2..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/designer/noautoconnection/main.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "imagedialog.h"
-
-#include <QApplication>
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- ImageDialog *dialog = new ImageDialog;
- dialog->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/designer/singleinheritance/imagedialog.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/designer/singleinheritance/imagedialog.cpp
deleted file mode 100644
index b7c316856..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/designer/singleinheritance/imagedialog.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "imagedialog.h"
-
-ImageDialog::ImageDialog(QWidget *parent)
- : QDialog(parent)
-{
- ui.setupUi(this);
-
- ui.colorDepthCombo->addItem(tr("2 colors (1 bit per pixel)"));
- ui.colorDepthCombo->addItem(tr("4 colors (2 bits per pixel)"));
- ui.colorDepthCombo->addItem(tr("16 colors (4 bits per pixel)"));
- ui.colorDepthCombo->addItem(tr("256 colors (8 bits per pixel)"));
- ui.colorDepthCombo->addItem(tr("65536 colors (16 bits per pixel)"));
- ui.colorDepthCombo->addItem(tr("16 million colors (24 bits per pixel)"));
-
- connect(ui.okButton, SIGNAL(clicked()), this, SLOT(accept()));
- connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/designer/singleinheritance/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/designer/singleinheritance/main.cpp
deleted file mode 100644
index db74fe0e2..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/designer/singleinheritance/main.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "imagedialog.h"
-
-#include <QApplication>
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- ImageDialog *dialog = new ImageDialog;
- dialog->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/dockwidgets/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/dockwidgets/main.cpp
deleted file mode 100644
index 455aa8c0b..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/dockwidgets/main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-
-#include "mainwindow.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- QMainWindow *window = new MainWindow;
- window->show();
- window->resize(640, 480);
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/dockwidgets/mainwindow.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/dockwidgets/mainwindow.cpp
deleted file mode 100644
index 8bc0fae87..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/dockwidgets/mainwindow.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-
-MainWindow::MainWindow(QWidget *parent)
- : QMainWindow(parent)
-{
- setWindowTitle("Dock Widgets");
-
- setupDockWindow();
- setupContents();
- setupMenus();
-
- textBrowser = new QTextBrowser(this);
-
- connect(headingList, SIGNAL(itemClicked(QListWidgetItem *)),
- this, SLOT(updateText(QListWidgetItem *)));
-
- updateText(headingList->item(0));
- headingList->setCurrentRow(0);
- setCentralWidget(textBrowser);
-}
-
-void MainWindow::setupContents()
-{
- QFile titlesFile(":/Resources/titles.txt");
- titlesFile.open(QFile::ReadOnly);
- int chapter = 0;
-
- do {
- QString line = titlesFile.readLine().trimmed();
- QStringList parts = line.split("\t", QString::SkipEmptyParts);
- if (parts.size() != 2)
- break;
-
- QString chapterTitle = parts[0];
- QString fileName = parts[1];
-
- QFile chapterFile(fileName);
-
- chapterFile.open(QFile::ReadOnly);
- QListWidgetItem *item = new QListWidgetItem(chapterTitle, headingList);
- item->setData(Qt::DisplayRole, chapterTitle);
- item->setData(Qt::UserRole, chapterFile.readAll());
- item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
- chapterFile.close();
-
- chapter++;
- } while (titlesFile.isOpen());
-
- titlesFile.close();
-}
-
-void MainWindow::setupDockWindow()
-{
-//! [0]
- contentsWindow = QDockWidget(tr("Table of Contents"), self)
- contentsWindow.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea)
- addDockWidget(Qt.LeftDockWidgetArea, contentsWindow)
-
- headingList = QListWidget(contentsWindow)
- contentsWindow.setWidget(headingList)
-//! [0]
-}
-
-void MainWindow::setupMenus()
-{
- QAction *exitAct = new QAction(tr("E&xit"), this);
- exitAct->setShortcut(tr("Ctrl+Q"));
- exitAct->setStatusTip(tr("Exit the application"));
- connect(exitAct, SIGNAL(triggered()), qApp, SLOT(closeAllWindows()));
-
- QMenu *fileMenu = menuBar()->addMenu(tr("&File"));
- fileMenu->addAction(exitAct);
-}
-
-void MainWindow::updateText(QListWidgetItem *item)
-{
- QString text = item->data(Qt::UserRole).toString();
- textBrowser->setHtml(text);
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/draganddrop/dragwidget.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/draganddrop/dragwidget.cpp
deleted file mode 100644
index a50581c21..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/draganddrop/dragwidget.cpp
+++ /dev/null
@@ -1,163 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "dragwidget.h"
-
-DragWidget::DragWidget(QWidget *parent)
- : QFrame(parent)
-{
- setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
- dragDropLabel = new QLabel("", this);
- dragDropLabel->setAlignment(Qt::AlignHCenter);
-
- QHBoxLayout *layout = new QHBoxLayout(this);
- layout->addStretch(0);
- layout->addWidget(dragDropLabel);
- layout->addStretch(0);
-
- setAcceptDrops(true);
-}
-
-// Accept all actions, but deal with them separately later.
-//! [0]
-void DragWidget::dragEnterEvent(QDragEnterEvent *event)
-{
- event->acceptProposedAction();
-}
-//! [0]
-
-//! [1]
-void DragWidget::dropEvent(QDropEvent *event)
-{
- if (event->source() == this && event->possibleActions() & Qt::MoveAction)
- return;
-//! [1]
-
-//! [2]
- if (event->proposedAction() == Qt::MoveAction) {
- event->acceptProposedAction();
- // Process the data from the event.
-//! [2]
- emit dragResult(tr("The data was moved here."));
-//! [3]
- } else if (event->proposedAction() == Qt::CopyAction) {
- event->acceptProposedAction();
- // Process the data from the event.
-//! [3]
- emit dragResult(tr("The data was copied here."));
-//! [4]
- } else {
- // Ignore the drop.
- return;
- }
-//! [4]
- // End of quote
-
- emit mimeTypes(event->mimeData()->formats());
- setData(event->mimeData()->formats()[0],
- event->mimeData()->data(event->mimeData()->formats()[0]));
-//! [5]
-}
-//! [5]
-
-//! [6]
-void DragWidget::mousePressEvent(QMouseEvent *event)
-{
- if (event->button() == Qt::LeftButton)
- dragStartPosition = event->pos();
-}
-//! [6]
-
-//! [7]
-void DragWidget::mouseMoveEvent(QMouseEvent *event)
-{
- if (!(event->buttons() & Qt::LeftButton))
- return;
- if ((event->pos() - dragStartPosition).manhattanLength()
- < QApplication::startDragDistance())
- return;
-
- QDrag *drag = new QDrag(this);
- QMimeData *mimeData = new QMimeData;
-
- mimeData->setData(mimeType, data);
- drag->setMimeData(mimeData);
-
- Qt::DropAction dropAction = drag->exec(Qt::CopyAction | Qt::MoveAction);
-//! [7]
-
- switch (dropAction) {
- case Qt::CopyAction:
- emit dragResult(tr("The text was copied."));
- break;
- case Qt::MoveAction:
- emit dragResult(tr("The text was moved."));
- break;
- default:
- emit dragResult(tr("Unknown action."));
- break;
- }
-//! [8]
-}
-//! [8]
-
-void DragWidget::setData(const QString &mimetype, const QByteArray &newData)
-{
- mimeType = mimetype;
- data = QByteArray(newData);
-
- dragDropLabel->setText(tr("%1 bytes").arg(data.size()));
-
- QStringList formats;
- formats << mimetype;
- emit mimeTypes(formats);
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/draganddrop/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/draganddrop/main.cpp
deleted file mode 100644
index cf9c3fa27..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/draganddrop/main.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- MainWindow *window1 = new MainWindow;
- MainWindow *window2 = new MainWindow;
- window1->show();
- window2->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/draganddrop/mainwindow.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/draganddrop/mainwindow.cpp
deleted file mode 100644
index 9485326ed..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/draganddrop/mainwindow.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "dragwidget.h"
-#include "mainwindow.h"
-
-MainWindow::MainWindow(QWidget *parent)
- : QMainWindow(parent)
-{
- QFrame *centralWidget = new QFrame(this);
-
- QLabel *mimeTypeLabel = new QLabel(tr("MIME types:"), centralWidget);
- mimeTypeCombo = new QComboBox(centralWidget);
-
- QLabel *dataLabel = new QLabel(tr("Amount of data (bytes):"), centralWidget);
- dragWidget = new DragWidget(centralWidget);
-
- connect(dragWidget, SIGNAL(mimeTypes(const QStringList &)),
- this, SLOT(setMimeTypes(const QStringList &)));
- connect(dragWidget, SIGNAL(dragResult(const QString &)),
- this, SLOT(setDragResult(const QString &)));
-
- QVBoxLayout *mainLayout = new QVBoxLayout(centralWidget);
- mainLayout->addWidget(mimeTypeLabel);
- mainLayout->addWidget(mimeTypeCombo);
- mainLayout->addSpacing(32);
- mainLayout->addWidget(dataLabel);
- mainLayout->addWidget(dragWidget);
-
- statusBar();
- dragWidget->setData(QString("text/plain"), QByteArray("Hello world"));
- setCentralWidget(centralWidget);
- setWindowTitle(tr("Drag and Drop"));
-}
-
-void MainWindow::setDragResult(const QString &actionText)
-{
- statusBar()->showMessage(actionText);
-}
-
-void MainWindow::setMimeTypes(const QStringList &types)
-{
- mimeTypeCombo->clear();
- mimeTypeCombo->addItems(types);
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/dragging/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/dragging/main.cpp
deleted file mode 100644
index e76756fe8..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/dragging/main.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- MainWindow *window = new MainWindow;
- window->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/dropactions/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/dropactions/main.cpp
deleted file mode 100644
index f910d2896..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/dropactions/main.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "window.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- Window *window = new Window;
- window->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/dropactions/window.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/dropactions/window.cpp
deleted file mode 100644
index 70a54e547..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/dropactions/window.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "window.h"
-
-Window::Window(QWidget *parent)
- : QWidget(parent)
-{
- QLabel *textLabel = new QLabel(tr("Data:"), this);
- textBrowser = new QTextBrowser(this);
-
- QLabel *mimeTypeLabel = new QLabel(tr("MIME types:"), this);
- mimeTypeCombo = new QComboBox(this);
-
- QVBoxLayout *layout = new QVBoxLayout(this);
- layout->addWidget(textLabel);
- layout->addWidget(textBrowser);
- layout->addWidget(mimeTypeLabel);
- layout->addWidget(mimeTypeCombo);
-/*
- ...
- setAcceptDrops(true);
-*/
- setAcceptDrops(true);
- setWindowTitle(tr("Drop Actions"));
-}
-
-void Window::dragEnterEvent(QDragEnterEvent *event)
-{
- if (event->mimeData()->hasFormat("text/plain"))
- event->acceptProposedAction();
-}
-
-void Window::dropEvent(QDropEvent *event)
-{
- QMenu actionMenu(this);
- QAction *copyAction = 0;
- QAction *moveAction = 0;
- QAction *linkAction = 0;
- QAction *ignoreAction = 0;
- if (event->possibleActions() & Qt::CopyAction)
- copyAction = actionMenu.addAction(tr("Copy"));
- if (event->possibleActions() & Qt::MoveAction)
- moveAction = actionMenu.addAction(tr("Move"));
- if (event->possibleActions() & Qt::LinkAction)
- linkAction = actionMenu.addAction(tr("Link"));
- if (event->possibleActions() & Qt::IgnoreAction)
- ignoreAction = actionMenu.addAction(tr("Ignore"));
-
- QAction *result = actionMenu.exec(QCursor::pos());
-
- if (copyAction && result == copyAction)
- event->setDropAction(Qt::CopyAction);
- else if (moveAction && result == moveAction)
- event->setDropAction(Qt::MoveAction);
- else if (linkAction && result == linkAction)
- event->setDropAction(Qt::LinkAction);
- else {
- event->setDropAction(Qt::IgnoreAction);
- return;
- }
-
- textBrowser->setPlainText(event->mimeData()->text());
- mimeTypeCombo->clear();
- mimeTypeCombo->addItems(event->mimeData()->formats());
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/dropevents/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/dropevents/main.cpp
deleted file mode 100644
index 6d4e9fb1f..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/dropevents/main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "window.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- Window *window = new Window;
- window->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/dropevents/window.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/dropevents/window.cpp
deleted file mode 100644
index 409ab5b78..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/dropevents/window.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "window.h"
-
-//! [0]
-Window::Window(QWidget *parent)
- : QWidget(parent)
-{
-//! [0]
- QLabel *textLabel = new QLabel(tr("Data:"), this);
- textBrowser = new QTextBrowser(this);
-
- QLabel *mimeTypeLabel = new QLabel(tr("MIME types:"), this);
- mimeTypeCombo = new QComboBox(this);
-
- QVBoxLayout *layout = new QVBoxLayout(this);
- layout->addWidget(textLabel);
- layout->addWidget(textBrowser);
- layout->addWidget(mimeTypeLabel);
- layout->addWidget(mimeTypeCombo);
-
-//! [1]
- setAcceptDrops(true);
-//! [1]
- setWindowTitle(tr("Drop Events"));
-//! [2]
-}
-//! [2]
-
-//! [3]
-void Window::dragEnterEvent(QDragEnterEvent *event)
-{
- if (event->mimeData()->hasFormat("text/plain"))
- event->acceptProposedAction();
-}
-//! [3]
-
-//! [4]
-void Window::dropEvent(QDropEvent *event)
-{
- textBrowser->setPlainText(event->mimeData()->text());
- mimeTypeCombo->clear();
- mimeTypeCombo->addItems(event->mimeData()->formats());
-
- event->acceptProposedAction();
-}
-//! [4]
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/droprectangle/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/droprectangle/main.cpp
deleted file mode 100644
index f910d2896..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/droprectangle/main.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "window.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- Window *window = new Window;
- window->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/droprectangle/window.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/droprectangle/window.cpp
deleted file mode 100644
index 5f8ff73ee..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/droprectangle/window.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "window.h"
-
-Window::Window(QWidget *parent)
- : QWidget(parent)
-{
- QLabel *textLabel = new QLabel(tr("Data:"), this);
- textBrowser = new QTextBrowser(this);
-
- QLabel *mimeTypeLabel = new QLabel(tr("MIME types:"), this);
- mimeTypeCombo = new QComboBox(this);
-
- dropFrame = new QFrame(this);
- dropFrame->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
- QLabel *dropLabel = new QLabel(tr("Drop items here"), dropFrame);
- dropLabel->setAlignment(Qt::AlignHCenter);
-
- QVBoxLayout *dropFrameLayout = new QVBoxLayout(dropFrame);
- dropFrameLayout->addWidget(dropLabel);
-
- QHBoxLayout *dropLayout = new QHBoxLayout;
- dropLayout->addStretch(0);
- dropLayout->addWidget(dropFrame);
- dropLayout->addStretch(0);
-
- QVBoxLayout *mainLayout = new QVBoxLayout(this);
- mainLayout->addWidget(textLabel);
- mainLayout->addWidget(textBrowser);
- mainLayout->addWidget(mimeTypeLabel);
- mainLayout->addWidget(mimeTypeCombo);
- mainLayout->addSpacing(32);
- mainLayout->addLayout(dropLayout);
-
- setAcceptDrops(true);
- setWindowTitle(tr("Drop Rectangle"));
-}
-
-//! [0]
-void Window::dragMoveEvent(QDragMoveEvent *event)
-{
- if (event->mimeData()->hasFormat("text/plain")
- && event->answerRect().intersects(dropFrame->geometry()))
-
- event->acceptProposedAction();
-}
-//! [0]
-
-void Window::dropEvent(QDropEvent *event)
-{
- textBrowser->setPlainText(event->mimeData()->text());
- mimeTypeCombo->clear();
- mimeTypeCombo->addItems(event->mimeData()->formats());
-
- event->acceptProposedAction();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/eventfilters/filterobject.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/eventfilters/filterobject.cpp
deleted file mode 100644
index 183d2ef8d..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/eventfilters/filterobject.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "filterobject.h"
-
-FilterObject::FilterObject(QObject *parent)
- : QObject(parent), target(0)
-{
-}
-
-//! [0]
-bool FilterObject::eventFilter(QObject *object, QEvent *event)
-{
- if (object == target && event->type() == QEvent::KeyPress) {
- QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
- if (keyEvent->key() == Qt::Key_Tab) {
- // Special tab handling
- return true;
- } else
- return false;
- }
- return false;
-}
-//! [0]
-
-void FilterObject::setFilteredObject(QObject *object)
-{
- if (target)
- target->removeEventFilter(this);
-
- target = object;
-
- if (target)
- target->installEventFilter(this);
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/eventfilters/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/eventfilters/main.cpp
deleted file mode 100644
index b1d3e70df..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/eventfilters/main.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QTextEdit>
-
-#include "filterobject.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- QTextEdit editor;
- FilterObject filter;
- filter.setFilteredObject(&editor);
- editor.show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/events/events.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/events/events.cpp
deleted file mode 100644
index 030cf2336..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/events/events.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QCheckBox>
-#include <QMouseEvent>
-
-class MyCheckBox : public QCheckBox
-{
-public:
- void mousePressEvent(QMouseEvent *event);
-};
-
-//! [0]
-void MyCheckBox::mousePressEvent(QMouseEvent *event)
-{
- if (event->button() == Qt::LeftButton) {
- // handle left mouse button here
- } else {
- // pass on other buttons to base class
- QCheckBox::mousePressEvent(event);
- }
-}
-//! [0]
-
-class MyWidget : public QWidget
-{
-public:
- bool event(QEvent *event);
-};
-
-static const int MyCustomEventType = 1099;
-
-class MyCustomEvent : public QEvent
-{
-public:
- MyCustomEvent() : QEvent((QEvent::Type)MyCustomEventType) {}
-};
-
-//! [1]
-bool MyWidget::event(QEvent *event)
-{
- if (event->type() == QEvent::KeyPress) {
- QKeyEvent *ke = static_cast<QKeyEvent *>(event);
- if (ke->key() == Qt::Key_Tab) {
- // special tab handling here
- return true;
- }
- } else if (event->type() == MyCustomEventType) {
- MyCustomEvent *myEvent = static_cast<MyCustomEvent *>(event);
- // custom event handling here
- return true;
- }
-
- return QWidget::event(event);
-}
-//! [1]
-
-int main()
-{
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/explicitlysharedemployee/employee.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/explicitlysharedemployee/employee.cpp
deleted file mode 100644
index d862513ef..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/explicitlysharedemployee/employee.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "employee.h"
-
-//! [0]
-EmployeeData::EmployeeData()
-{
- id = -1;
- name = 0;
-}
-//! [0]
-
-//! [1]
-EmployeeData::EmployeeData(const EmployeeData &other)
-//! [1] //! [2]
- : QSharedData(other)
-{
- id = other.id;
- if (other.name) {
- name = new QString(*other.name);
- } else {
- name = 0;
- }
-}
-//! [2]
-
-//! [3]
-EmployeeData::~EmployeeData()
-//! [3] //! [4]
-{
- delete name;
-}
-//! [4]
-
-//! [5]
-Employee::Employee()
-//! [5] //! [6]
-{
- d = new EmployeeData;
-}
-//! [6]
-
-//! [7]
-Employee::Employee(int id, const QString &name)
-//! [7] //! [8]
-{
- d = new EmployeeData;
- setId(id);
- setName(name);
-}
-//! [8]
-
-//! [9]
-void Employee::setName(const QString &name)
-//! [9] //! [10]
-{
- if (!d->name)
- d->name = new QString;
- *d->name = name;
-}
-//! [10]
-
-//! [11]
-QString Employee::name() const
-//! [11] //! [12]
-{
- if (!d->name)
- return QString();
- return *d->name;
-}
-//! [12]
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/explicitlysharedemployee/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/explicitlysharedemployee/main.cpp
deleted file mode 100644
index 13571ac85..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/explicitlysharedemployee/main.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "employee.h"
-
-int main()
-{
- {
- Employee e1(10, "Albrecht Durer");
- Employee e2 = e1;
- e1.setName("Hans Holbein");
- }
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/file/file.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/file/file.cpp
deleted file mode 100644
index 3818e6a7f..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/file/file.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QFile>
-#include <QTextStream>
-
-static void process_line(const QByteArray &)
-{
-}
-
-static void process_line(const QString &)
-{
-}
-
-static void noStream_snippet()
-{
-//! [0]
- file = QFile("in.txt")
- if not file.open(QIODevice.ReadOnly | QIODevice.Text):
- return
-
- while not file.atEnd():
- line = file.readLine() # A QByteArray
- process_line(line)
-//! [0]
-}
-
-static void readTextStream_snippet()
-{
-//! [1]
- file = QFile("in.txt")
- if not file.open(QIODevice.ReadOnly | QIODevice.Text):
- return
-
- in = QTextStream(file)
- while not in.atEnd():
- line = in.readLine() # A QByteArray
- process_line(line)
-//! [1]
-}
-
-static void writeTextStream_snippet()
-{
-//! [2]
- file = QFile("out.txt")
- if not file.open(QIODevice.WriteOnly | QIODevice.Text):
- return
-
- out = QTextStream(file)
- out << "The magic number is: " << 49 << "\n"
-//! [2]
-}
-
-static void writeTextStream_snippet()
-{
- QFile file("out.dat");
- if (!file.open(QIODevice.WriteOnly))
- return;
-
- QDataStream out(&file);
- out << "The magic number is: " << 49 << "\n";
-}
-
-static void readRegularEmptyFile_snippet()
-{
-//! [3]
- file = QFile("/proc/modules")
- if not file.open(QIODevice.ReadOnly | QIODevice.Text):
- return
-
- in = QTextStream(file)
- line = in.readLine()
- while not line.isNull():
- process_line(line)
- line = in.readLine()
-//! [3]
-}
-
-int main()
-{
- lineByLine_snippet();
- writeStream_snippet();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/filedialogurls.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/filedialogurls.cpp
deleted file mode 100644
index 192188e81..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/filedialogurls.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-int main(int argv, char **args)
-{
- QApplication app(argv, args);
-
-//![0]
- QList<QUrl> urls;
- urls << QUrl::fromLocalFile("/home/gvatteka/dev/qt-45")
- << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::MusicLocation));
-
- QFileDialog dialog;
- dialog.setSidebarUrls(urls);
- dialog.setFileMode(QFileDialog::AnyFile);
- if(dialog.exec()) {
- // ...
- }
-//![0]
-
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/fileinfo/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/fileinfo/main.cpp
deleted file mode 100644
index 09ff00bf8..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/fileinfo/main.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QPushButton>
-#include <QFileInfo>
-#include <QDir>
-#include <QGroupBox>
-#include <QVBoxLayout>
-#include <QDebug>
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
-//! [0]
- fileInfo1 = QFileInfo("~/examples/191697/.")
- fileInfo2 = QFileInfo("~/examples/191697/..")
- fileInfo3 = QFileInfo("~/examples/191697/main.cpp")
-//! [0]
-//! [1]
- fileInfo4 = QFileInfo(".")
- fileInfo5 = QFileInfo("..")
- fileInfo6 = QFileInfo("main.cpp")
-//! [1]
-
- qDebug() << fileInfo1.fileName();
- qDebug() << fileInfo2.fileName();
- qDebug() << fileInfo3.fileName();
- qDebug() << fileInfo4.fileName();
- qDebug() << fileInfo5.fileName();
- qDebug() << fileInfo6.fileName();
-
- QPushButton* button1 = new QPushButton(fileInfo1.dir().path());
- QPushButton* button2 = new QPushButton(fileInfo2.dir().path());
- QPushButton* button3 = new QPushButton(fileInfo3.dir().path());
- QPushButton* button4 = new QPushButton(fileInfo4.dir().path());
- QPushButton* button5 = new QPushButton(fileInfo5.dir().path());
- QPushButton* button6 = new QPushButton(fileInfo6.dir().path());
-
- QVBoxLayout* vbox = new QVBoxLayout;
- vbox->addWidget(button1);
- vbox->addWidget(button2);
- vbox->addWidget(button3);
- vbox->addWidget(button4);
- vbox->addWidget(button5);
- vbox->addWidget(button6);
- vbox->addStretch(1);
-
- QGroupBox *groupBox = new QGroupBox("QFileInfo::dir() test");
- groupBox->setLayout(vbox);
- groupBox->show();
-
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/graphicssceneadditemsnippet.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/graphicssceneadditemsnippet.cpp
deleted file mode 100644
index 8a5c819b4..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/graphicssceneadditemsnippet.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-class CustomScene : public QGraphicsScene
-{
-public:
- CustomScene()
- { addItem(new QGraphicsEllipseItem(QRect(10, 10, 30, 30))); }
-
- void drawItems(QPainter *painter, int numItems, QGraphicsItem *items[],
- const QStyleOptionGraphicsItem options[],
- QWidget *widget = 0);
-};
-
-//! [0]
-void CustomScene::drawItems(QPainter *painter, int numItems,
- QGraphicsItem *items[],
- const QStyleOptionGraphicsItem options[],
- QWidget *widget)
-{
- for (int i = 0; i < numItems; ++i) {
- // Draw the item
- painter->save();
- painter->setMatrix(items[i]->sceneMatrix(), true);
- items[i]->paint(painter, &options[i], widget);
- painter->restore();
- }
-}
-//! [0]
-
-int main(int argv, char **args)
-{
- QApplication app(argv, args);
-
- CustomScene scene;
- QGraphicsView view(&scene);
-
- view.show();
-
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/i18n-non-qt-class/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/i18n-non-qt-class/main.cpp
deleted file mode 100644
index cbcc30471..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/i18n-non-qt-class/main.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore>
-#include "myclass.h"
-
-int main(int argc, char *argv[])
-{
- QCoreApplication app(argc, argv);
-
- QTranslator translator;
- translator.load(":/translations/i18n-non-qt-class_" + QLocale::system().name());
- app.installTranslator(&translator);
-
- MyClass instance;
- return 0;
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/i18n-non-qt-class/myclass.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/i18n-non-qt-class/myclass.cpp
deleted file mode 100644
index 506dac2b1..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/i18n-non-qt-class/myclass.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <iostream>
-#include "myclass.h"
-
-MyClass::MyClass()
-{
- std::cout << tr("Hello Qt!\n").toLocal8Bit().constData();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/inherited-slot/button.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/inherited-slot/button.cpp
deleted file mode 100644
index f15066b04..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/inherited-slot/button.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QDebug>
-#include "button.h"
-
-Button::Button(QWidget *parent)
- : QPushButton(parent)
-{
-}
-
-void Button::animateClick()
-{
- qDebug() << "Extra code goes here...";
- QPushButton::animateClick();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/inherited-slot/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/inherited-slot/main.cpp
deleted file mode 100644
index b17010633..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/inherited-slot/main.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QDebug>
-#include <QHBoxLayout>
-#include <QLineEdit>
-#include <QMetaMethod>
-#include <QWidget>
-#include "button.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- QWidget window;
- QHBoxLayout *layout = new QHBoxLayout(&window);
- QLineEdit *lineEdit = new QLineEdit;
- Button *button = new Button;
-
- QObject::connect(lineEdit, SIGNAL(returnPressed()), button, SLOT(animateClick()));
-
- layout->addWidget(lineEdit);
- layout->addWidget(button);
- window.show();
-
- for (int i = 0; i < button->metaObject()->methodCount(); ++i)
- qDebug() << i << button->metaObject()->method(i).signature();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/itemselection/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/itemselection/main.cpp
deleted file mode 100644
index 83b06b988..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/itemselection/main.cpp
+++ /dev/null
@@ -1,125 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*
- main.cpp
-
- A simple example that shows how selections can be used directly on a model.
- It shows the result of some selections made using a table view.
-*/
-
-#include <QApplication>
-#include <QItemSelection>
-#include <QItemSelectionModel>
-#include <QTableView>
-
-#include "model.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
-//! [0]
- TableModel *model = new TableModel(8, 4, &app);
-
- QTableView *table = new QTableView(0);
- table->setModel(model);
-
- QItemSelectionModel *selectionModel = table->selectionModel();
-//! [0] //! [1]
- QModelIndex topLeft;
- QModelIndex bottomRight;
-
- topLeft = model->index(0, 0, QModelIndex());
- bottomRight = model->index(5, 2, QModelIndex());
-//! [1]
-
-//! [2]
- QItemSelection selection(topLeft, bottomRight);
- selectionModel->select(selection, QItemSelectionModel::Select);
-//! [2]
-
-//! [3]
- QItemSelection toggleSelection;
-
- topLeft = model->index(2, 1, QModelIndex());
- bottomRight = model->index(7, 3, QModelIndex());
- toggleSelection.select(topLeft, bottomRight);
-
- selectionModel->select(toggleSelection, QItemSelectionModel::Toggle);
-//! [3]
-
-//! [4]
- QItemSelection columnSelection;
-
- topLeft = model->index(0, 1, QModelIndex());
- bottomRight = model->index(0, 2, QModelIndex());
-
- columnSelection.select(topLeft, bottomRight);
-
- selectionModel->select(columnSelection,
- QItemSelectionModel::Select | QItemSelectionModel::Columns);
-
- QItemSelection rowSelection;
-
- topLeft = model->index(0, 0, QModelIndex());
- bottomRight = model->index(1, 0, QModelIndex());
-
- rowSelection.select(topLeft, bottomRight);
-
- selectionModel->select(rowSelection,
- QItemSelectionModel::Select | QItemSelectionModel::Rows);
-//! [4]
-
- table->setWindowTitle("Selected items in a table model");
- table->show();
- table->resize(460, 280);
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/javastyle.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/javastyle.cpp
deleted file mode 100644
index 96548086c..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/javastyle.cpp
+++ /dev/null
@@ -1,2755 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "javastyle.h"
-#include <math.h>
-
-static const int windowsItemFrame = 2;
-static const int windowsSepHeight = 2;
-static const int windowsItemHMargin = 3;
-static const int windowsItemVMargin = 2;
-static const int windowsArrowHMargin = 6;
-static const int windowsTabSpacing = 12;
-static const int windowsCheckMarkHMargin = 2;
-static const int windowsRightBorder = 15;
-static const int windowsCheckMarkWidth = 12;
-
-JavaStyle::JavaStyle()
-{
- qApp->setPalette(standardPalette());
-}
-
-
-inline QPoint JavaStyle::adjustScrollPoint(const QPoint &point,
- Qt::Orientation orientation,
- bool add) const
-{
- int adder = add ? -1 : 1;
- QPoint retPoint;
-
- if (orientation == Qt::Horizontal) {
- retPoint = QPoint(point.y() * adder, point.x());
- } else {
- retPoint = QPoint(point.x(), point.y() * adder);
- }
-
- return retPoint;
-}
-
-QPalette JavaStyle::standardPalette() const
-{
- QPalette palette = QWindowsStyle::standardPalette();
-
- palette.setBrush(QPalette::Active, QPalette::Button,
- QColor(184, 207, 229));
- palette.setBrush(QPalette::Active, QPalette::WindowText,
- Qt::black);
- palette.setBrush(QPalette::Active, QPalette::Background,
- QColor(238, 238, 238));
- palette.setBrush(QPalette::Active, QPalette::Window,
- QColor(238 ,238, 238));
- palette.setBrush(QPalette::Active, QPalette::Base, Qt::white);
- palette.setBrush(QPalette::Active, QPalette::AlternateBase, QColor(238, 238, 238));
- palette.setBrush(QPalette::Active, QPalette::Text, Qt::black);
- palette.setBrush(QPalette::Active, QPalette::BrightText, Qt::white);
-
- palette.setBrush(QPalette::Active, QPalette::Light, QColor(163, 184, 204)); // focusFrameColor
- palette.setBrush(QPalette::Active, QPalette::Midlight, QColor(99, 130, 191)); // tabBarBorderColor
- palette.setBrush(QPalette::Active, QPalette::Dark, QColor(106, 104, 100));
- palette.setBrush(QPalette::Active, QPalette::Mid, QColor(122, 138, 153)); //defaultFrameColor
- palette.setBrush(QPalette::Active, QPalette::Shadow, QColor(122, 138, 153)); // defaultFrame
-
- palette.setBrush(QPalette::Active, QPalette::Highlight, QColor(184, 207, 229));
- palette.setBrush(QPalette::Active, QPalette::HighlightedText, Qt::black);
-
- palette.setBrush(QPalette::Inactive, QPalette::Highlight, QColor(184, 207, 229));
- palette.setBrush(QPalette::Inactive, QPalette::HighlightedText, Qt::black);
-
- palette.setBrush(QPalette::Disabled, QPalette::Button,
- QColor(238, 238, 238));
- palette.setBrush(QPalette::Disabled, QPalette::WindowText,
- QColor(153, 153, 153));
- palette.setBrush(QPalette::Disabled, QPalette::Background, QColor(238, 238, 238));
-
- palette.setBrush(QPalette::Inactive, QPalette::Button,
- QColor(184, 207, 229));
- palette.setBrush(QPalette::Inactive, QPalette::Background,
- QColor(238, 238, 238));
- palette.setBrush(QPalette::Inactive, QPalette::Window,
- QColor(238 ,238, 238));
- palette.setBrush(QPalette::Inactive, QPalette::Light, QColor(163, 184, 204)); // focusFrameColor
- palette.setBrush(QPalette::Inactive, QPalette::Midlight, QColor(99, 130, 191)); // tabBarBorderColor
- palette.setBrush(QPalette::Inactive, QPalette::Dark,QColor(106, 104, 100));
- palette.setBrush(QPalette::Inactive, QPalette::Mid, QColor(122, 138, 153)); //defaultFrame
- palette.setBrush(QPalette::Inactive, QPalette::Shadow, QColor(122, 138, 153)); // defaultFrame
-
- return palette;
-}
-
-inline void JavaStyle::drawScrollBarArrow(const QRect &rect, QPainter *painter,
- const QStyleOptionSlider *option,
- bool add) const
-{
-
- painter->save();
-
- Qt::Orientation orient = option->orientation;
- QPoint offset;
-
- if (add) {
- if (orient == Qt::Vertical) {
- offset = rect.bottomLeft();
- } else {
- offset = rect.topRight();
- }
- } else {
- offset = rect.topLeft();
- }
-
- QPainterPath arrow;
- arrow.moveTo(offset + adjustScrollPoint(QPoint(4, 8), orient, add));
- arrow.lineTo(offset + adjustScrollPoint(QPoint(7, 5), orient, add));
- arrow.lineTo(offset + adjustScrollPoint(QPoint(8, 5), orient, add));
- arrow.lineTo(offset + adjustScrollPoint(QPoint(11, 8), orient, add));
- arrow.lineTo(offset + adjustScrollPoint(QPoint(4, 8), orient, add));
-
- QColor fillColor;
- if (option->state & State_Sunken)
- fillColor = QColor(option->palette.color(QPalette::Button));
- else
- fillColor = option->palette.color(QPalette::Background);
-
- painter->fillRect(rect, fillColor);
-
- painter->setPen(option->palette.color(QPalette::Base));
- int adjust = option->state & State_Sunken ? 0 : 1;
- painter->drawRect(rect.adjusted(adjust, adjust, -1, -1));
- painter->setPen(option->palette.color(QPalette::Mid));
- painter->drawRect(rect.adjusted(0, 0, -1, -1));
-
- painter->setPen(option->palette.color(QPalette::WindowText));
- painter->setBrush(option->palette.color(QPalette::WindowText));
- painter->drawPath(arrow);
-
- painter->restore();
-}
-
-inline QPoint JavaStyle::adjustScrollHandlePoint(Qt::Orientation orig,
- const QPoint &point) const
-{
- QPoint retPoint;
-
- if (orig == Qt::Vertical)
- retPoint = point;
- else
- retPoint = QPoint(point.y(), point.x());
-
- return retPoint;
-}
-
-void JavaStyle::drawControl(ControlElement control, const QStyleOption *option,
- QPainter *painter, const QWidget *widget) const
-{
-
- painter->save();
-
- switch (control) {
- case CE_ToolBoxTabShape: {
- const QStyleOptionToolBox *box =
- qstyleoption_cast<const QStyleOptionToolBox *>(option);
-
- painter->save();
-
- if (box->direction == Qt::RightToLeft) {
- painter->rotate(1);
- painter->translate(box->rect.width(), -box->rect.height());
- }
-
- int textWidth = box->fontMetrics.width(box->text) + 20;
-
- QPolygon innerLine;
- innerLine << (box->rect.topLeft() + QPoint(0, 1)) <<
- (box->rect.topLeft() + QPoint(textWidth, 1)) <<
- (box->rect.bottomLeft() + QPoint(textWidth + 15, -3)) <<
- (box->rect.bottomRight() + QPoint(0, -3)) <<
- box->rect.bottomRight() <<
- box->rect.bottomLeft() <<
- box->rect.topLeft();
-
- painter->setPen(box->palette.color(QPalette::Base));
- painter->setBrush(QColor(200, 221, 242));
- painter->drawPolygon(innerLine);
-
- QPolygon outerLine;
- outerLine << (box->rect.bottomRight() + QPoint(0, -3)) <<
- box->rect.bottomRight() <<
- box->rect.bottomLeft() <<
- box->rect.topLeft() <<
- (box->rect.topLeft() + QPoint(textWidth, 0)) <<
- (box->rect.bottomLeft() + QPoint(textWidth + 15, -4)) <<
- (box->rect.bottomRight() + QPoint(0, -4));
-
- painter->setPen(box->palette.color(QPalette::Midlight));
- painter->setBrush(Qt::NoBrush);
- painter->drawPolyline(outerLine);
-
- painter->restore();
- break;
- }
- case CE_DockWidgetTitle: {
- const QStyleOptionDockWidgetV2 *docker =
- new QStyleOptionDockWidgetV2(
- *qstyleoption_cast<const QStyleOptionDockWidget *>(option));
-
- QRect rect = docker->rect;
- QRect titleRect = rect;
- if (docker->verticalTitleBar) {
- QRect r = rect;
- QSize s = r.size();
- s.transpose();
- r.setSize(s);
-
- titleRect = QRect(r.left() + rect.bottom()
- - titleRect.bottom(),
- r.top() + titleRect.left() - rect.left(),
- titleRect.height(), titleRect.width());
-
- painter->translate(r.left(), r.top() + r.width());
- painter->rotate(-90);
- painter->translate(-r.left(), -r.top());
-
- rect = r;
- }
-
- QLinearGradient gradient(rect.topLeft(),
- rect.bottomLeft());
- gradient.setColorAt(1.0, QColor(191, 212, 231));
- gradient.setColorAt(0.3, Qt::white);
- gradient.setColorAt(0.0, QColor(221, 232, 243));
-
- painter->setPen(Qt::NoPen);
- painter->setBrush(gradient);
- painter->drawRect(rect.adjusted(0, 0, -1, -1));
-
- if (!docker->title.isEmpty()) {
- QRect textRect = docker->fontMetrics.boundingRect(docker->title);
- textRect.moveCenter(rect.center());
-
- QFont font = painter->font();
- font.setPointSize(font.pointSize() - 1);
- painter->setFont(font);
- painter->setPen(docker->palette.text().color());
- painter->drawText(textRect, docker->title,
- QTextOption(Qt::AlignHCenter |
- Qt::AlignVCenter));
- }
- break;
- }
- case CE_RubberBand: {
- painter->setPen(option->palette.color(QPalette::Active,
- QPalette::WindowText));
- painter->drawRect(option->rect.adjusted(0, 0, -1, -1));
- break;
- }
- case CE_SizeGrip: {
- break;
- }
- case CE_HeaderSection: {
- const QStyleOptionHeader *header =
- qstyleoption_cast<const QStyleOptionHeader *>(option);
-
- painter->setPen(Qt::NoPen);
- painter->setBrush(option->palette.color(QPalette::Active,
- QPalette::Background));
- painter->drawRect(option->rect);
-
- painter->setPen(header->palette.color(QPalette::Mid));
- if (header->orientation == Qt::Horizontal) {
- if (header->position == QStyleOptionHeader::Beginning ||
- header->position == QStyleOptionHeader::OnlyOneSection) {
- painter->drawRect(header->rect.adjusted(0, 0, -1, -1));
- painter->setPen(header->palette.color(QPalette::Base));
- painter->drawLine(header->rect.bottomLeft() + QPoint(1, -1),
- header->rect.topLeft() + QPoint(1, 1));
- painter->drawLine(header->rect.topLeft() + QPoint(1, 1),
- header->rect.topRight() + QPoint(-1, 1));
- } else {
- painter->drawLine(header->rect.bottomRight(),
- header->rect.topRight());
- painter->drawLine(header->rect.topLeft(),
- header->rect.topRight());
- painter->drawLine(header->rect.bottomLeft(),
- header->rect.bottomRight());
- painter->setPen(option->palette.color(QPalette::Base));
- painter->drawLine(header->rect.bottomLeft() + QPoint(0, -1),
- header->rect.topLeft() + QPoint(0, 1));
- painter->drawLine(header->rect.topLeft() + QPoint(1, 1),
- header->rect.topRight() + QPoint(-1, 1));
- }
- } else { // Vertical
- if (header->position == QStyleOptionHeader::Beginning ||
- header->position == QStyleOptionHeader::OnlyOneSection) {
- painter->drawRect(header->rect.adjusted(0, 0, -1, -1));
- painter->setPen(header->palette.color(QPalette::Base));
- painter->drawLine(header->rect.bottomLeft() + QPoint(1, -1),
- header->rect.topLeft() + QPoint(1, 1));
- painter->drawLine(header->rect.topLeft() + QPoint(1, 1),
- header->rect.topRight() + QPoint(-1, 1));
- } else {
- painter->drawLine(header->rect.bottomLeft(),
- header->rect.bottomRight());
- painter->drawLine(header->rect.topLeft(),
- header->rect.bottomLeft());
- painter->drawLine(header->rect.topRight(),
- header->rect.bottomRight());
- painter->setPen(header->palette.color(QPalette::Base));
- painter->drawLine(header->rect.topLeft(),
- header->rect.topRight() + QPoint(-1, 0));
- painter->drawLine(header->rect.bottomLeft() + QPoint(1, -1),
- header->rect.topLeft() + QPoint(1, 0));
- }
- }
- break;
- }
- case CE_ToolBar: {
- QRect rect = option->rect;
-
- QLinearGradient gradient(rect.topLeft(), rect.bottomLeft());
- gradient.setColorAt(1.0, QColor(221, 221, 221));
- gradient.setColorAt(0.0, QColor(241, 241, 241));
-
- if (option->state & State_Horizontal) {
- painter->setPen(QColor(204, 204, 204));
- painter->setBrush(gradient);
- } else {
- painter->setPen(Qt::NoPen);
- painter->setBrush(option->palette.color(QPalette::Background));
- }
- painter->drawRect(rect.adjusted(0, 0, -1, -1));
- break;
- }
- case CE_ProgressBar: {
- const QStyleOptionProgressBar *bar1 =
- qstyleoption_cast<const QStyleOptionProgressBar *>(option);
-
- QStyleOptionProgressBarV2 *bar = new QStyleOptionProgressBarV2(*bar1);
-
- QRect rect = bar->rect;
- if (bar->orientation == Qt::Vertical) {
- rect = QRect(rect.left(), rect.top(), rect.height(), rect.width());
- QMatrix m;
- m.translate(rect.height()-1, 0);
- m.rotate(90.0);
- painter->setMatrix(m);
- }
-
- painter->setPen(bar->palette.color(QPalette::Mid));
- painter->drawRect(rect.adjusted(0, 0, -1, -1));
-
- QRect grooveRect = subElementRect(SE_ProgressBarGroove, bar,
- widget);
- if (bar->orientation == Qt::Vertical) {
- grooveRect = QRect(grooveRect.left(), grooveRect.top(),
- grooveRect.height(), grooveRect.width());
- }
-
- QStyleOptionProgressBar grooveBar = *bar;
- grooveBar.rect = grooveRect;
-
- drawControl(CE_ProgressBarGroove, &grooveBar, painter, widget);
-
- QRect progressRect = subElementRect(SE_ProgressBarContents, bar,
- widget);
- if (bar->orientation == Qt::Vertical) {
- progressRect = QRect(progressRect.left(), progressRect.top(),
- progressRect.height(), progressRect.width());
- progressRect.adjust(0, 0, 0, -1);
- }
- QStyleOptionProgressBar progressOpt = *bar;
- progressOpt.rect = progressRect;
- drawControl(CE_ProgressBarContents, &progressOpt, painter, widget);
-
- QRect labelRect = subElementRect(SE_ProgressBarLabel, bar, widget);
- if (bar->orientation == Qt::Vertical) {
- labelRect = QRect(labelRect.left(), labelRect.top(),
- labelRect.height(), labelRect.width());
- }
- QStyleOptionProgressBar subBar = *bar;
- subBar.rect = labelRect;
- if (bar->textVisible)
- drawControl(CE_ProgressBarLabel, &subBar, painter, widget);
-
- delete bar;
- break;
- }
- case CE_ProgressBarGroove: {
- painter->setBrush(option->palette.color(QPalette::Background));
- painter->setPen(Qt::NoPen);
- painter->drawRect(option->rect.adjusted(0, 0, -1, -1));
-
- painter->setPen(option->palette.color(QPalette::Button));
- painter->drawLine(option->rect.topLeft() + QPoint(0, 0),
- option->rect.topRight() + QPoint(0, 0));
- break;
- }
- case CE_ProgressBarContents: {
- const QStyleOptionProgressBar *bar =
- qstyleoption_cast<const QStyleOptionProgressBar *>(option);
- int progress = int((double(bar->progress) /
- double(bar->maximum - bar->minimum)) *
- bar->rect.width());
-
- painter->setBrush(bar->palette.color(QPalette::Light));
- painter->setPen(Qt::NoPen);
- QRect progressRect = QRect(bar->rect.topLeft(), QPoint(progress,
- bar->rect.bottom()));
- painter->drawRect(progressRect);
-
- painter->setPen(bar->palette.color(QPalette::Midlight));
- painter->setBrush(Qt::NoBrush);
-
- painter->drawLine(bar->rect.bottomLeft(), bar->rect.topLeft());
- painter->drawLine(bar->rect.topLeft(), QPoint(progress,
- bar->rect.top()));
- break;
- }
- case CE_ProgressBarLabel: {
- painter->save();
- const QStyleOptionProgressBar *bar =
- qstyleoption_cast<const QStyleOptionProgressBar *>(option);
-
- QRect rect = bar->rect;
- QRect leftRect;
-
- int progressIndicatorPos = int((double(bar->progress) /
- double(bar->maximum - bar->minimum)) *
- bar->rect.width());
-
- QFont font;
- font.setBold(true);
- painter->setFont(font);
- painter->setPen(bar->palette.color(QPalette::Midlight));
-
- if (progressIndicatorPos >= 0 &&
- progressIndicatorPos <= rect.width()) {
- leftRect = QRect(bar->rect.topLeft(),
- QPoint(progressIndicatorPos,
- bar->rect.bottom()));
- } else if (progressIndicatorPos > rect.width()) {
- painter->setPen(bar->palette.color(QPalette::Base));
- } else {
- painter->setPen(bar->palette.color(QPalette::Midlight));
- }
-
- QRect textRect = QFontMetrics(font).boundingRect(bar->text);
- textRect.moveCenter(option->rect.center());
- painter->drawText(textRect, bar->text,
- QTextOption(Qt::AlignCenter));
- if (!leftRect.isNull()) {
- painter->setPen(bar->palette.color(QPalette::Base));
- painter->setClipRect(leftRect, Qt::IntersectClip);
- painter->drawText(textRect, bar->text,
- QTextOption(Qt::AlignCenter));
- }
-
- painter->restore();
- break;
- }
- case CE_MenuBarEmptyArea: {
- QRect emptyArea = option->rect.adjusted(0, 0, -1, -1);
- QLinearGradient gradient(emptyArea.topLeft(), emptyArea.bottomLeft()
- - QPoint(0, 1));
- gradient.setColorAt(0.0, option->palette.color(QPalette::Base));
- gradient.setColorAt(1.0, QColor(223, 223, 223));
-
- painter->setPen(QColor(238, 238, 238));
- painter->setBrush(gradient);
- painter->drawRect(emptyArea.adjusted(0, 0, 0, -1));
- break;
- }
- case CE_MenuBarItem: {
- if (!(option->state & State_Sunken)) {
- QLinearGradient gradient(option->rect.topLeft(),
- option->rect.bottomLeft());
- gradient.setColorAt(0.0, Qt::white);
- gradient.setColorAt(1.0, QColor(223, 223, 223));
-
- painter->setPen(Qt::NoPen);
- painter->setBrush(gradient);
- } else {
- painter->setBrush(option->palette.color(QPalette::Light));
- }
-
- painter->drawRect(option->rect);
- if (option->state & State_Sunken) {
- painter->setPen(option->palette.color(QPalette::Mid));
- painter->drawRect(option->rect.adjusted(0, 0, -1, -1));
- painter->setPen(option->palette.color(QPalette::Base));
- painter->setBrush(Qt::NoBrush);
- painter->drawLine(option->rect.bottomRight() + QPoint(0, -1),
- option->rect.topRight() + QPoint(0, -1));
- }
- QCommonStyle::drawControl(control, option, painter, widget);
- break;
- }
- case CE_MenuItem: {
- const QStyleOptionMenuItem *menuItem =
- qstyleoption_cast<const QStyleOptionMenuItem *>(option);
-
- bool selected = menuItem->state & State_Selected;
- bool checkable = menuItem->checkType !=
- QStyleOptionMenuItem::NotCheckable;
- bool checked = menuItem->checked;
-
- if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) {
- QPoint center = menuItem->rect.center();
-
- painter->setPen(menuItem->palette.color(QPalette::Midlight));
- painter->drawLine(QPoint(menuItem->rect.left() - 2, center.y()),
- QPoint(menuItem->rect.right(), center.y()));
- painter->setPen(menuItem->palette.color(QPalette::Base));
- painter->drawLine(QPoint(menuItem->rect.left() - 2,
- center.y() + 1),
- QPoint(menuItem->rect.right(),
- center.y() + 1));
-
- break;
- }
-
- if (selected) {
- painter->setBrush(menuItem->palette.color(QPalette::Light));
- painter->setPen(Qt::NoPen);
- painter->drawRect(menuItem->rect);
- painter->setPen(menuItem->palette.color(QPalette::Midlight));
- painter->drawLine(menuItem->rect.topLeft(),
- menuItem->rect.topRight());
- painter->setPen(menuItem->palette.color(QPalette::Base));
- painter->drawLine(menuItem->rect.bottomLeft(),
- menuItem->rect.bottomRight());
- }
-
- if (checkable) {
- QRect checkRect(option->rect.left() + 5,
- option->rect.center().y() - 5, 10, 10);
- if (menuItem->checkType & QStyleOptionMenuItem::Exclusive) {
- QStyleOptionButton button;
- button.rect = checkRect;
- button.state = menuItem->state;
- if (button.state & State_Sunken)
- button.state ^= State_Sunken;
- if (checked)
- button.state |= State_On;
- button.palette = menuItem->palette;
- drawPrimitive(PE_IndicatorRadioButton, &button, painter,
- widget);
- } else {
- QBrush buttonBrush = gradientBrush(option->rect);
- painter->setBrush(buttonBrush);
- painter->setPen(option->palette.color(QPalette::Mid));
-
- painter->drawRect(checkRect);
-
- if (checked) {
- QImage image(":/images/checkboxchecked.png");
- painter->drawImage(QPoint(option->rect.left() + 5,
- option->rect.center().y() - 8), image);
- }
- }
- }
-
- bool dis = !(menuItem->state & State_Enabled);
- bool act = menuItem->state & State_Selected;
- const QStyleOption *opt = option;
- const QStyleOptionMenuItem *menuitem = menuItem;
- int checkcol = qMax(menuitem->maxIconWidth, 20);
- if (menuItem->icon.isNull())
- checkcol = 0;
-
- QPainter *p = painter;
- QRect vCheckRect = visualRect(opt->direction, menuitem->rect,
- QRect(menuitem->rect.x(),
- menuitem->rect.y(),
- checkcol, menuitem->rect.height()));
- if (!menuItem->icon.isNull()) {
- QIcon::Mode mode = dis ? QIcon::Disabled : QIcon::Normal;
- if (act && !dis)
- mode = QIcon::Active;
- QPixmap pixmap;
- if (checked)
- pixmap = menuItem->icon.pixmap(
- pixelMetric(PM_SmallIconSize), mode, QIcon::On);
- else
- pixmap = menuItem->icon.pixmap(
- pixelMetric(PM_SmallIconSize), mode);
- int pixw = pixmap.width();
- int pixh = pixmap.height();
-
- int adjustedIcon = checkable ? 15 : 0;
- QRect pmr(0, 0, pixw, pixh);
- pmr.moveCenter(vCheckRect.center());
- painter->setPen(menuItem->palette.text().color());
- if (checkable && checked)
- painter->drawPixmap(QPoint(pmr.left() +
- adjustedIcon, pmr.top() + 1), pixmap);
- else
- painter->drawPixmap(pmr.topLeft() +
- QPoint(adjustedIcon, 0), pixmap);
- }
-
- if (selected) {
- painter->setPen(menuItem->palette.highlightedText().color());
- } else {
- painter->setPen(menuItem->palette.text().color());
- }
- int x, y, w, h;
- menuitem->rect.getRect(&x, &y, &w, &h);
- int tab = menuitem->tabWidth;
- QColor discol;
- if (dis) {
- discol = menuitem->palette.text().color();
- p->setPen(discol);
- }
- int xm = windowsItemFrame + checkcol + windowsItemHMargin;
- int xpos = menuitem->rect.x() + xm;
- QRect textRect;
- if (!menuItem->icon.isNull())
- textRect.setRect(xpos, y + windowsItemVMargin, w - xm -
- windowsRightBorder - tab + 1, h - 2 * windowsItemVMargin);
- else
- textRect.setRect(menuItem->rect.left() + 9,
- y + windowsItemVMargin,
- w - xm - windowsRightBorder - tab,
- h - 2 * windowsItemVMargin);
-
- if (checkable)
- textRect.adjust(10, 0, 10, 0);
-
- QRect vTextRect = visualRect(opt->direction, menuitem->rect,
- textRect);
- QString s = menuitem->text;
- if (!s.isEmpty()) {
- int t = s.indexOf(QLatin1Char('\t'));
- int text_flags = Qt::AlignVCenter | Qt::TextShowMnemonic |
- Qt::TextDontClip | Qt::TextSingleLine;
- if (!styleHint(SH_UnderlineShortcut, menuitem, widget))
- text_flags |= Qt::TextHideMnemonic;
- text_flags |= Qt::AlignLeft;
- if (t >= 0) {
- QRect vShortcutRect = visualRect(opt->direction,
- menuitem->rect,
- QRect(textRect.topRight(),
- QPoint(menuitem->rect.right(), textRect.bottom())));
- if (dis && !act) {
- p->setPen(menuitem->palette.light().color());
- p->drawText(vShortcutRect.adjusted(1, 1, 1, 1),
- text_flags,
- s.mid(t + 1));
- p->setPen(discol);
- }
- p->drawText(vShortcutRect, text_flags, s.mid(t + 1));
- s = s.left(t);
- }
- QFont font = menuitem->font;
- if (menuitem->menuItemType == QStyleOptionMenuItem::DefaultItem)
- font.setBold(true);
- p->setFont(font);
- if (dis && !act) {
- p->setPen(menuitem->palette.light().color());
- p->drawText(vTextRect.adjusted(1,1,1,1), text_flags,
- s.left(t));
- p->setPen(discol);
- }
- p->drawText(vTextRect, text_flags, s.left(t));
- }
-
- if (menuItem->menuItemType & QStyleOptionMenuItem::SubMenu) {
- QPoint center = menuItem->rect.center();
- QPoint drawStart(menuItem->rect.right() - 6, center.y() + 4);
-
- QPainterPath arrow;
- arrow.moveTo(drawStart);
- arrow.lineTo(drawStart + QPoint(0, -8));
- arrow.lineTo(drawStart + QPoint(4, -5));
- arrow.lineTo(drawStart + QPoint(4, -4));
- arrow.lineTo(drawStart + QPoint(0, 0));
-
- painter->save();
- painter->setBrush(menuItem->palette.color(QPalette::Text));
- painter->setPen(Qt::NoPen);
- painter->drawPath(arrow);
- painter->restore();
- }
-
- break;
- }
- case CE_MenuVMargin: {
- break;
- }
- case CE_MenuHMargin: {
- break;
- }
- case CE_Splitter: {
- drawSplitter(option, painter, option->state & State_Horizontal);
- break;
- }
- case CE_ScrollBarAddPage: {
- case CE_ScrollBarSubPage:
- const QStyleOptionSlider *scrollBar =
- qstyleoption_cast<const QStyleOptionSlider *>(option);
- QRect myRect;
- if (scrollBar->orientation == Qt::Horizontal) {
- myRect = QRect(option->rect.topLeft(),
- option->rect.bottomRight()).adjusted(0, 0, 1, -1);
- } else {
- myRect = option->rect;
- }
-
- painter->setPen(Qt::NoPen);
- painter->setBrush(option->palette.color(QPalette::Background));
- painter->drawRect(myRect);
-
- painter->setBrush(Qt::NoBrush);
- painter->setPen(scrollBar->palette.color(QPalette::Mid));
- painter->drawRect(myRect.adjusted(0, 0, -1, 0));
- painter->setPen(scrollBar->palette.color(QPalette::Button));
- painter->drawLine(myRect.bottomLeft() + QPoint(1, 0),
- myRect.topLeft() + QPoint(1, 1));
- painter->drawLine(myRect.topLeft() + QPoint(1, 1),
- myRect.topRight() + QPoint(-1, 1));
- break;
- }
- case CE_ScrollBarSubLine: {
- const QStyleOptionSlider *scrollBar =
- qstyleoption_cast<const QStyleOptionSlider *>(option);
- int scrollBarExtent = pixelMetric(PM_ScrollBarExtent);
- QRect scrollBarSubLine = option->rect;
-
- QRect button1;
- QRect button2;
-
- if (scrollBar->orientation == Qt::Horizontal) {
- button1.setRect(scrollBarSubLine.left(), scrollBarSubLine.top(),
- 16, scrollBarExtent);
- button2.setRect(scrollBarSubLine.right() - 15,
- scrollBarSubLine.top(), 16, scrollBarExtent);
- } else {
- button1.setRect(scrollBarSubLine.left(), scrollBarSubLine.top(),
- scrollBarExtent, 16);
- button2.setRect(scrollBarSubLine.left(),
- scrollBarSubLine.bottom() - 15, scrollBarExtent, 16);
- }
-
- painter->fillRect(button2, Qt::blue);
-
- drawScrollBarArrow(button1, painter, scrollBar);
- drawScrollBarArrow(button2, painter, scrollBar);
- break;
- }
- case CE_ScrollBarAddLine: {
- const QStyleOptionSlider *scrollBar =
- qstyleoption_cast<const QStyleOptionSlider *>(option);
- QRect button(option->rect.left(), option->rect.top(), 16, 16);
- drawScrollBarArrow(button, painter, scrollBar, true);
- break;
- }
- case CE_ScrollBarSlider: {
- const QStyleOptionSlider *scrollBar =
- qstyleoption_cast<const QStyleOptionSlider *>(option);
-
- painter->setPen(scrollBar->palette.color(QPalette::Midlight));
- painter->drawRect(scrollBar->rect.adjusted(-1, 0, -3, -1));
-
- QPoint g1, g2;
- if (scrollBar->orientation == Qt::Horizontal) {
- g1 = option->rect.topLeft();
- g2 = option->rect.bottomLeft();
- } else {
- g1 = option->rect.topLeft();
- g2 = option->rect.topRight();
- }
-
- if (scrollBar->state & State_Enabled) {
- QLinearGradient gradient(g1, g2);
- gradient.setColorAt(1.0, QColor(188, 210, 230));
- gradient.setColorAt(0.3, Qt::white);
- gradient.setColorAt(0.0, QColor(223, 233, 243));
- painter->setBrush(gradient);
- } else {
- painter->setPen(scrollBar->palette.buttonText().color());
- painter->setBrush(scrollBar->palette.button());
- }
- painter->drawRect(scrollBar->rect.adjusted(0, 0, -1, -1));
-
- int sliderLength = option->rect.height();
- int drawPos = scrollBar->orientation == Qt::Vertical ?
- (sliderLength / 2) + 1 : 1 - ((option->rect.width() / 2));
-
- QPoint origin;
- if (scrollBar->orientation == Qt::Vertical)
- origin = option->rect.bottomLeft();
- else
- origin = option->rect.topLeft();
-
- painter->setPen(scrollBar->palette.color(QPalette::Base));
- painter->drawLine(origin + adjustScrollHandlePoint(
- scrollBar->orientation,
- QPoint(4, -drawPos)),
- origin + adjustScrollHandlePoint(
- scrollBar->orientation,
- QPoint(13, -drawPos)));
- painter->drawLine(origin + adjustScrollHandlePoint(
- scrollBar->orientation,
- QPoint(4, 2 - drawPos)),
- origin + adjustScrollHandlePoint(
- scrollBar->orientation,
- QPoint(13, 2 - drawPos)));
- painter->drawLine(origin + adjustScrollHandlePoint(
- scrollBar->orientation,
- QPoint(4, 4 - drawPos)),
- origin + adjustScrollHandlePoint(
- scrollBar->orientation,
- QPoint(13, 4 - drawPos)));
-
- painter->setPen(option->palette.color(QPalette::Midlight));
- painter->drawLine(origin + adjustScrollHandlePoint(
- scrollBar->orientation,
- QPoint(3, -(drawPos + 1))),
- origin + adjustScrollHandlePoint(
- scrollBar->orientation,
- QPoint(12, -(drawPos + 1))));
- painter->drawLine(origin + adjustScrollHandlePoint(
- scrollBar->orientation,
- QPoint(3, 1 - drawPos)),
- origin + adjustScrollHandlePoint(
- scrollBar->orientation,
- QPoint(12, 1 - drawPos)));
- painter->drawLine(origin + adjustScrollHandlePoint(
- scrollBar->orientation,
- QPoint(3, 3 - drawPos)),
- origin + adjustScrollHandlePoint(
- scrollBar->orientation,
- QPoint(12, 3 - drawPos)));
-
- break;
- }
- case CE_TabBarTabLabel: {
- QStyleOptionTab copy =
- *qstyleoption_cast<const QStyleOptionTab *>(option);
- if (copy.state & State_HasFocus)
- copy.state ^= State_HasFocus;
- painter->setBrush(Qt::NoBrush);
- QWindowsStyle::drawControl(CE_TabBarTabLabel, &copy, painter,
- widget);
- break;
- }
- case CE_TabBarTabShape: {
- const QStyleOptionTab *tab =
- qstyleoption_cast<const QStyleOptionTab *>(option);
- QRect myRect = option->rect;
- QPoint bottomLeft, bottomRight, topLeft, topRight;
-
- if ((tab->position == QStyleOptionTab::Beginning) ||
- (tab->position == QStyleOptionTab::OnlyOneTab)) {
- if (tab->shape == QTabBar::RoundedSouth ||
- tab->shape == QTabBar::RoundedNorth) {
- myRect = myRect.adjusted(2, 0, 0, 0);
- } else {
- myRect = myRect.adjusted(0, 2, 0, 0);
- }
- }
-
- switch (tab->shape) {
- case QTabBar::RoundedNorth:
- topLeft = myRect.topLeft();
- topRight = myRect.topRight();
- bottomLeft = myRect.bottomLeft();
- bottomRight = myRect.bottomRight();
- break;
- case QTabBar::RoundedSouth:
- topLeft = myRect.bottomLeft();
- topRight = myRect.bottomRight();
- bottomLeft = myRect.topLeft();
- bottomRight = myRect.topRight();
- break;
- case QTabBar::RoundedWest:
- topLeft = myRect.topLeft();
- topRight = myRect.bottomLeft();
- bottomLeft = myRect.topRight();
- bottomRight = myRect.bottomRight();
- break;
- case QTabBar::RoundedEast:
- topLeft = myRect.topRight();
- topRight = myRect.bottomRight();
- bottomLeft = myRect.topLeft();
- bottomRight = myRect.bottomLeft();
- break;
- default:
- ;
- }
-
- QPainterPath outerPath;
- outerPath.moveTo(bottomLeft + adjustTabPoint(QPoint(0, -2),
- tab->shape));
- outerPath.lineTo(bottomLeft + adjustTabPoint(QPoint(0, -14),
- tab->shape));
- outerPath.lineTo(topLeft + adjustTabPoint(QPoint(6 , 0),
- tab->shape));
- outerPath.lineTo(topRight + adjustTabPoint(QPoint(0, 0),
- tab->shape));
- outerPath.lineTo(bottomRight + adjustTabPoint(QPoint(0, -2),
- tab->shape));
-
- if (tab->state & State_Selected ||
- tab->position == QStyleOptionTab::OnlyOneTab) {
- QPainterPath innerPath;
- innerPath.moveTo(topLeft + adjustTabPoint(QPoint(6, 2),
- tab->shape));
- innerPath.lineTo(topRight + adjustTabPoint(QPoint(-1, 2),
- tab->shape));
- innerPath.lineTo(bottomRight + adjustTabPoint(QPoint(-1 , -2),
- tab->shape));
- innerPath.lineTo(bottomLeft + adjustTabPoint(QPoint(2 , -2),
- tab->shape));
- innerPath.lineTo(bottomLeft + adjustTabPoint(QPoint(2 , -14),
- tab->shape));
- innerPath.lineTo(topLeft + adjustTabPoint(QPoint(6, 2),
- tab->shape));
-
- QPainterPath whitePath;
- whitePath.moveTo(bottomLeft + adjustTabPoint(QPoint(1, -2),
- tab->shape));
- whitePath.lineTo(bottomLeft + adjustTabPoint(QPoint(1, -14),
- tab->shape));
- whitePath.lineTo(topLeft + adjustTabPoint(QPoint(6, 1),
- tab->shape));
- whitePath.lineTo(topRight + adjustTabPoint(QPoint(-1, 1),
- tab->shape));
-
- painter->setPen(tab->palette.color(QPalette::Midlight));
- painter->setBrush(QColor(200, 221, 242));
- painter->drawPath(outerPath);
- painter->setPen(QColor(200, 221, 242));
- painter->drawRect(QRect(bottomLeft + adjustTabPoint(
- QPoint(2, -3), tab->shape),
- bottomRight + adjustTabPoint(
- QPoint(-2, 0), tab->shape)));
- painter->setPen(tab->palette.color(QPalette::Base));
- painter->setBrush(Qt::NoBrush);
- painter->drawPath(whitePath);
-
- if (option->state & State_HasFocus) {
- painter->setPen(option->palette.color(QPalette::Mid));
- painter->drawPath(innerPath);
- }
- } else {
- painter->setPen(tab->palette.color(QPalette::Mid));
- painter->drawPath(outerPath);
- }
- break;
- }
- case CE_PushButtonLabel:
- painter->save();
-
- if (const QStyleOptionButton *button =
- qstyleoption_cast<const QStyleOptionButton *>(option)) {
- QRect ir = button->rect;
- uint tf = Qt::AlignVCenter | Qt::TextShowMnemonic;
- if (!styleHint(SH_UnderlineShortcut, button, widget))
- tf |= Qt::TextHideMnemonic;
-
- if (!button->icon.isNull()) {
- QPoint point;
-
- QIcon::Mode mode = button->state & State_Enabled ? QIcon::Normal
- : QIcon::Disabled;
- if (mode == QIcon::Normal && button->state & State_HasFocus)
- mode = QIcon::Active;
- QIcon::State state = QIcon::Off;
- if (button->state & State_On)
- state = QIcon::On;
-
- QPixmap pixmap = button->icon.pixmap(button->iconSize, mode,
- state);
- int w = pixmap.width();
- int h = pixmap.height();
-
- if (!button->text.isEmpty())
- w += button->fontMetrics.width(button->text) + 2;
-
- point = QPoint(ir.x() + ir.width() / 2 - w / 2,
- ir.y() + ir.height() / 2 - h / 2);
-
- if (button->direction == Qt::RightToLeft)
- point.rx() += pixmap.width();
-
- painter->drawPixmap(visualPos(button->direction, button->rect,
- point), pixmap);
-
- if (button->direction == Qt::RightToLeft)
- ir.translate(-point.x() - 2, 0);
- else
- ir.translate(point.x() + pixmap.width(), 0);
-
- if (!button->text.isEmpty())
- tf |= Qt::AlignLeft;
-
- } else {
- tf |= Qt::AlignHCenter;
- }
-
- if (button->fontMetrics.height() > 14)
- ir.translate(0, 1);
-
- drawItemText(painter, ir, tf, button->palette, (button->state &
- State_Enabled),
- button->text, QPalette::ButtonText);
- }
-
- painter->restore();
- break;
-
- default:
- QWindowsStyle::drawControl(control, option, painter, widget);
- }
- painter->restore();
-}
-
-inline QPoint JavaStyle::adjustTabPoint(const QPoint &point,
- QTabBar::Shape shape) const
-{
- QPoint rPoint;
-
- switch (shape) {
- case QTabBar::RoundedWest:
- rPoint = QPoint(point.y(), point.x());
- break;
- case QTabBar::RoundedSouth:
- rPoint = QPoint(point.x(), point.y() * -1);
- break;
- case QTabBar::RoundedEast:
- rPoint = QPoint(point.y() * -1, point.x());
- break;
- default:
- rPoint = point;
- }
- return rPoint;
-}
-
-QRect JavaStyle::subControlRect(ComplexControl control,
- const QStyleOptionComplex *option,
- SubControl subControl,
- const QWidget *widget) const
-{
- QRect rect = QWindowsStyle::subControlRect(control, option, subControl,
- widget);
-
- switch (control) {
- case CC_TitleBar: {
- const QStyleOptionTitleBar *bar =
- qstyleoption_cast<const QStyleOptionTitleBar *>(option);
-
- switch (subControl) {
- case SC_TitleBarMinButton: {
- rect = QRect(bar->rect.topRight() + QPoint(-68, 2),
- QSize(15, 15));
- break;
- }
- case SC_TitleBarMaxButton: {
- rect = QRect(bar->rect.topRight() + QPoint(-43, 3),
- QSize(15, 15));
- break;
- }
- case SC_TitleBarCloseButton: {
- rect = QRect(bar->rect.topRight() + QPoint(-18, 3),
- QSize(15, 15));
- break;
- }
- case SC_TitleBarLabel: {
- QRect labelRect = bar->fontMetrics.boundingRect(bar->text);
- rect = labelRect;
- rect.translate(bar->rect.left() + 30, 0);
- rect.moveTop(bar->rect.top());
- rect.adjust(0, 2, 2, 2);
- break;
- }
- case SC_TitleBarSysMenu: {
- rect = QRect(bar->rect.topLeft() + QPoint(6, 3),
- QSize(16, 16));
- break;
- }
- default:
- ;
- }
- break;
- }
- case CC_GroupBox: {
- const QStyleOptionGroupBox *box =
- qstyleoption_cast<const QStyleOptionGroupBox *>(option);
- bool hasCheckbox = box->subControls & SC_GroupBoxCheckBox;
- int checkAdjust = 13;
-
- QRect textRect = box->fontMetrics.boundingRect(box->text);
-
- switch (subControl) {
- case SC_GroupBoxFrame: {
- rect = box->rect;
- break;
- }
- case SC_GroupBoxCheckBox: {
- if (hasCheckbox) {
- rect = QRect(box->rect.topLeft() + QPoint(7, 4 +
- (textRect.height() / 2 - checkAdjust / 2)),
- QSize(checkAdjust, checkAdjust));
- }
- else {
- rect = QRect();
- }
- break;
- }
- case SC_GroupBoxLabel: {
- rect = QRect(box->rect.topLeft() + QPoint(7 + (hasCheckbox ?
- checkAdjust + 2 : 0), 4), textRect.size());
- break;
- }
- case SC_GroupBoxContents: {
- rect = box->rect.adjusted(10, 10 + textRect.height(), -10,
- -10);
- break;
- }
- default:
- ;
- }
- break;
- }
- case CC_SpinBox: {
- const QStyleOptionSpinBox *spinBox =
- qstyleoption_cast<const QStyleOptionSpinBox *>(option);
- int spinnerWidth = 16;
- QRect myRect = spinBox->rect;
- QPoint center = myRect.center();
- int frameWidth = pixelMetric(PM_SpinBoxFrameWidth, spinBox, widget);
-
- switch (subControl) {
- case SC_SpinBoxUp: {
- rect = QRect(myRect.topRight() + QPoint(-16, 0),
- QSize(16, center.y() - myRect.topRight().y()));
- break;
- }
- case SC_SpinBoxDown: {
- rect = QRect(QPoint(myRect.bottomRight().x() - 16,
- center.y() + 1),
- QSize(16, myRect.bottomRight().y() -
- center.y() - 1));
- break;
- }
- case SC_SpinBoxFrame: {
- rect = QRect(myRect.topLeft(), myRect.bottomRight() +
- QPoint(-16, 0));
- break;
- }
- case SC_SpinBoxEditField: {
- rect = QRect(myRect.topLeft() + QPoint(2, 2),
- myRect.bottomRight() + QPoint(-15 - frameWidth, -2));
- break;
- }
- default:
- ;
- }
- break;
- }
- case CC_ToolButton: {
- const QStyleOptionToolButton *button =
- qstyleoption_cast<const QStyleOptionToolButton *>(option);
-
- switch (subControl) {
- case SC_ToolButton: {
- rect = option->rect.adjusted(1, 1, -1, -1);
- break;
- }
- case SC_ToolButtonMenu: {
- rect = QRect(option->rect.bottomRight() +
- QPoint(-11, -11), QSize(10, 10));
- break;
- }
- }
- break;
- }
- case CC_ComboBox: {
- const QStyleOptionComboBox *combo =
- qstyleoption_cast<const QStyleOptionComboBox *>(option);
-
- bool reverse = combo->direction == Qt::RightToLeft;
-
- switch (subControl) {
- case SC_ComboBoxFrame:
- rect = combo->rect;
- break;
- case SC_ComboBoxArrow:
- if (reverse) {
- rect = QRect(combo->rect.topLeft(),
- combo->rect.bottomLeft() + QPoint(17, 0));
- } else {
- rect = QRect(combo->rect.topRight() + QPoint(-17, 0),
- combo->rect.bottomRight());
- }
- break;
- case SC_ComboBoxEditField:
- if (reverse) {
- rect = QRect(combo->rect.topLeft() + QPoint(19, 2),
- combo->rect.bottomRight() + QPoint(-2, 2));
- } else {
- rect = QRect(combo->rect.topLeft() + QPoint(2, 2),
- combo->rect.bottomRight() + QPoint(-19, -2));
- }
- break;
- case SC_ComboBoxListBoxPopup:
- rect = combo->rect;
- break;
- }
- break;
- }
- case CC_ScrollBar: {
- const QStyleOptionSlider *scrollBar =
- qstyleoption_cast<const QStyleOptionSlider *>(option);
- int scrollBarExtent = pixelMetric(PM_ScrollBarExtent, scrollBar,
- widget);
- int sliderMaxLength = ((scrollBar->orientation == Qt::Horizontal) ?
- scrollBar->rect.width() :
- scrollBar->rect.height()) - (16 * 3);
- int sliderMinLength = pixelMetric(PM_ScrollBarSliderMin, scrollBar,
- widget);
- int sliderLength;
-
- if (scrollBar->maximum != scrollBar->minimum) {
- uint valueRange = scrollBar->maximum - scrollBar->minimum;
- sliderLength = (scrollBar->pageStep * sliderMaxLength) /
- (valueRange + scrollBar->pageStep);
-
- if (sliderLength < sliderMinLength || valueRange > INT_MAX / 2)
- sliderLength = sliderMinLength;
- if (sliderLength > sliderMaxLength)
- sliderLength = sliderMaxLength;
- } else {
- sliderLength = sliderMaxLength;
- }
- int sliderStart = 16 + sliderPositionFromValue(scrollBar->minimum,
- scrollBar->maximum,
- scrollBar->sliderPosition,
- sliderMaxLength - sliderLength,
- scrollBar->upsideDown);
- QRect scrollBarRect = scrollBar->rect;
-
- switch (subControl) {
- case SC_ScrollBarSubLine:
- if (scrollBar->orientation == Qt::Horizontal) {
- rect.setRect(scrollBarRect.left(), scrollBarRect.top(),
- scrollBarRect.width() - 16, scrollBarExtent);
- } else {
- rect.setRect(scrollBarRect.left(), scrollBarRect.top(),
- scrollBarExtent, scrollBarRect.height() - 16);
- }
- break;
- case SC_ScrollBarAddLine:
- if (scrollBar->orientation == Qt::Horizontal) {
- rect.setRect(scrollBarRect.right() - 15,
- scrollBarRect.top(), 16, scrollBarExtent);
- } else {
- rect.setRect(scrollBarRect.left(), scrollBarRect.bottom()
- - 15, scrollBarExtent, 16);
- }
- break;
- case SC_ScrollBarSubPage:
- if (scrollBar->orientation == Qt::Horizontal) {
- rect.setRect(scrollBarRect.left() + 16, scrollBarRect.top(),
- sliderStart - (scrollBarRect.left() + 16),
- scrollBarExtent);
- } else {
- rect.setRect(scrollBarRect.left(), scrollBarRect.top() + 16,
- scrollBarExtent,
- sliderStart - (scrollBarRect.left() + 16));
- }
- break;
- case SC_ScrollBarAddPage:
- if (scrollBar->orientation == Qt::Horizontal)
- rect.setRect(sliderStart + sliderLength, 0,
- sliderMaxLength - sliderStart -
- sliderLength + 16, scrollBarExtent);
- else
- rect.setRect(0, sliderStart + sliderLength,
- scrollBarExtent, sliderMaxLength -
- sliderStart - sliderLength + 16);
- break;
- case SC_ScrollBarGroove:
- if (scrollBar->orientation == Qt::Horizontal) {
- rect = scrollBarRect.adjusted(16, 0, -32, 0);
- } else {
- rect = scrollBarRect.adjusted(0, 16, 0, -32);
- }
- break;
- case SC_ScrollBarSlider:
- if (scrollBar->orientation == Qt::Horizontal) {
- rect.setRect(sliderStart, 0, sliderLength,
- scrollBarExtent);
- } else {
- rect.setRect(0, sliderStart, scrollBarExtent,
- sliderLength);
- }
- break;
- default:
- return QWindowsStyle::subControlRect(control, option,
- subControl, widget);
- }
- break;
- }
- case CC_Slider: {
- const QStyleOptionSlider *slider =
- qstyleoption_cast<const QStyleOptionSlider *>(option);
- rect = slider->rect;
- int tickSize = pixelMetric(PM_SliderTickmarkOffset, option, widget);
- int handleSize = pixelMetric(PM_SliderControlThickness, option,
- widget);
-
- int dist = slider->orientation == Qt::Vertical ? slider->rect.height() :
- slider->rect.width();
- int pos = QStyle::sliderPositionFromValue(slider->minimum,
- slider->maximum, slider->sliderValue, dist - handleSize);
-
- switch (subControl) {
- case SC_SliderGroove: {
- QPoint center = rect.center();
-
- if (slider->orientation == Qt::Horizontal) {
- rect.setHeight(handleSize);
- if (slider->tickPosition == QSlider::TicksBelow) {
- center.ry() -= tickSize;
- }
- } else {
- rect.adjust(0, 0, 0, 0);
- rect.setWidth(handleSize);
- if (slider->tickPosition == QSlider::TicksBelow) {
- center.rx() -= tickSize;
- }
- }
- rect.moveCenter(center);
- break;
- }
- case SC_SliderHandle: {
- QPoint center = rect.center();
-
- if (slider->orientation == Qt::Horizontal) {
- rect.setHeight(handleSize);
- if (slider->tickPosition == QSlider::TicksBelow) {
- center.ry() -= tickSize;
- }
-
- rect.moveCenter(center);
-
- if (slider->upsideDown)
- rect.setLeft(slider->rect.right() -
- pos - (handleSize - 1));
- else
- rect.setLeft(pos);
-
- rect.setWidth(handleSize - 1);
- } else {
- rect.setWidth(handleSize);
- if (slider->tickPosition == QSlider::TicksBelow) {
- center.rx() -= tickSize;
- }
-
- rect.moveCenter(center);
-
- if (slider->upsideDown)
- rect.setTop(slider->rect.bottom() -
- ((pos + handleSize) - 2));
- else
- rect.setTop(slider->rect.top() + pos);
-
- rect.setHeight(handleSize);
- }
- break;
- }
- case SC_SliderTickmarks: {
- QPoint center = slider->rect.center();
-
- if (slider->tickPosition & QSlider::TicksBelow) {
- if (slider->orientation == Qt::Horizontal) {
- rect.setHeight(tickSize);
- center.ry() += tickSize / 2;
- rect.adjust(6, 0, -10, 0);
- } else {
- rect.setWidth(tickSize);
- center.rx() += tickSize / 2;
- rect.adjust(0, 6, 0, -10);
- }
- } else {
- rect = QRect();
- }
- rect.moveCenter(center);
- break;
- }
- default:
- ;
- }
- break;
- }
- default:
- return QWindowsStyle::subControlRect(control, option, subControl,
- widget);
- }
- return rect;
-}
-
-static const char * const sliderHandleImage[] = {
- "15 16 7 1",
- " c None",
- "+ c #FFFFFF",
- "@ c #FFFFFF",
- "$ c #FFFFFF",
- "( c #E5EDF5",
- ") c #F2F6FA",
- "[ c #FFFFFF",
- " +++++++++++++ ",
- "+@@@@@@@@@@@@@+",
- "+@(((((((((((@+",
- "+@(((((((((((@+",
- "+@)))))))))))@+",
- "+@[[[[[[[[[[[@+",
- "+@[[[[[[[[[[[@+",
- "+@)))))))))))@+",
- "+@)))))))))))@+",
- " +@)))))))))@+ ",
- " +@(((((((@+ ",
- " +@(((((@+ ",
- " +@(((@+ ",
- " +@(@+ ",
- " +@+ ",
- " + "};
-
-
-void JavaStyle::drawComplexControl(ComplexControl control,
- const QStyleOptionComplex *option,
- QPainter *painter,
- const QWidget *widget) const
-{
- painter->save();
-
- switch (control) {
- case CC_TitleBar: {
- const QStyleOptionTitleBar *bar =
- qstyleoption_cast<const QStyleOptionTitleBar *>(option);
-
- bool sunken = bar->state & State_Sunken;
-
- QLinearGradient gradient(bar->rect.bottomLeft(),
- bar->rect.topLeft());
- gradient.setColorAt(0.0, QColor(191, 212, 231));
- gradient.setColorAt(0.7, Qt::white);
- gradient.setColorAt(1.0, QColor(221, 232, 243));
-
- painter->setPen(Qt::NoPen);
- if (bar->titleBarState & State_Active) {
- painter->setBrush(gradient);
- }
- else
- painter->setBrush(bar->palette.color(QPalette::Active,
- QPalette::Background));
-
- painter->drawRect(bar->rect.adjusted(0, 0, -1, -1));
-
- painter->setBrush(QColor(233, 233, 233));
- painter->drawRect(QRect(bar->rect.bottomLeft() + QPoint(0, 1),
- bar->rect.bottomRight() + QPoint(0, 2)));
-
- QRect minButtonRect = subControlRect(control, bar,
- SC_TitleBarMinButton);
- QRect maxButtonRect = subControlRect(control, bar,
- SC_TitleBarMaxButton);
- QRect closeButtonRect = subControlRect(control, bar,
- SC_TitleBarCloseButton);
- QRect systemButtonRect = subControlRect(control, bar,
- SC_TitleBarSysMenu);
- QRect labelRect = subControlRect(control, bar, SC_TitleBarLabel);
- QRect gripRect = QRect(QPoint(labelRect.right() + 5, bar->rect.top() + 5),
- QPoint(minButtonRect.left() - 5,
- bar->rect.bottom() - 4));
-
- QColor textColor = option->palette.color(QPalette::Text);
- painter->setPen(textColor);
- painter->setBrush(Qt::NoBrush);
-
- drawItemText(painter, labelRect, Qt::TextShowMnemonic |
- Qt::AlignHCenter | Qt::AlignCenter,
- bar->palette, bar->state & State_Enabled, bar->text,
- textColor.isValid() ? QPalette::NoRole :
- QPalette::WindowText);
-
- for (int i = 0; i < gripRect.width(); ++i) {
- painter->setPen(i % 2 ? bar->palette.color(QPalette::Midlight)
- : Qt::white);
-
- for (int j = 0; j < 4; ++j) {
- painter->drawPoint(i + gripRect.left(),
- gripRect.top() - 2 + i % 4 + 4 * j);
- }
- }
-
- QPixmap maximizePixmap(":/images/internalmaximize.png");
- QPixmap minimizePixmap(":/images/internalminimize.png");
- QPixmap closePixmap(":/images/internalclose.png");
- QPixmap internalPixmap(":/images/internalsystem.png");
- QPixmap internalCloseDownPixmap(":/images/internalclosedown.png");
- QPixmap minimizeDownPixmap(":/images/internalminimizedown.png");
- QPixmap maximizeDownPixmap(":/images/internalmaximizedown.png");
-
- if (bar->activeSubControls & SC_TitleBarCloseButton &&
- bar->state & State_Sunken)
- painter->drawPixmap(closeButtonRect.topLeft(),
- internalCloseDownPixmap);
- else
- painter->drawPixmap(closeButtonRect.topLeft(), closePixmap);
-
- if (bar->activeSubControls & SC_TitleBarMinButton &&
- bar->state & State_Sunken)
- painter->drawPixmap(minButtonRect.topLeft(),
- minimizeDownPixmap);
- else
- painter->drawPixmap(minButtonRect.topLeft(), minimizePixmap);
-
- if (bar->activeSubControls & SC_TitleBarMaxButton &&
- bar->state & State_Sunken)
- painter->drawPixmap(maxButtonRect.topLeft(),
- maximizeDownPixmap);
- else
- painter->drawPixmap(maxButtonRect.topLeft(), maximizePixmap);
-
- painter->drawPixmap(systemButtonRect.topLeft(), internalPixmap);
-
- break;
- }
- case CC_GroupBox: {
- const QStyleOptionGroupBox *box =
- qstyleoption_cast<const QStyleOptionGroupBox *>(option);
-
- QRect frameRect = subControlRect(control, box, SC_GroupBoxFrame);
- QRect labelRect = subControlRect(control, box, SC_GroupBoxLabel);
- QRect contentsRect = subControlRect(control, box,
- SC_GroupBoxContents);
- QRect checkerRect = subControlRect(control, box,
- SC_GroupBoxCheckBox);
-
- int y = labelRect.center().y();
-
- painter->setPen(box->palette.color(QPalette::Button));
- painter->drawRect(frameRect.adjusted(2, y - frameRect.top(), -2,
- -2));
-
- painter->setPen(box->palette.color(QPalette::Background));
-
- if (box->subControls & SC_GroupBoxCheckBox) {
- painter->drawLine(checkerRect.left() - 1, y,
- checkerRect.right() + 2, y);
- QStyleOptionButton checker;
- checker.QStyleOption::operator=(*box);
- checker.rect = checkerRect;
- drawPrimitive(PE_IndicatorCheckBox, &checker, painter, widget);
- }
-
- if (box->subControls & SC_GroupBoxLabel && !box->text.isEmpty()) {
- painter->drawLine(labelRect.left() - 1, y,
- labelRect.right() +1, y);
-
- QColor textColor = box->textColor;
- if (textColor.isValid())
- painter->setPen(textColor);
-
- drawItemText(painter, labelRect, Qt::TextShowMnemonic |
- Qt::AlignHCenter | int(box->textAlignment),
- box->palette, box->state & State_Enabled,
- box->text, textColor.isValid() ? QPalette::NoRole :
- QPalette::WindowText);
- }
- break;
- }
- case CC_SpinBox: {
- const QStyleOptionSpinBox *spinner =
- qstyleoption_cast<const QStyleOptionSpinBox *>(option);
-
- QRect frameRect = subControlRect(control, spinner, SC_SpinBoxFrame);
- QRect upRect = subControlRect(control, spinner, SC_SpinBoxUp);
- QRect downRect = subControlRect(control, spinner, SC_SpinBoxDown);
-
- painter->setPen(Qt::white);
- painter->drawRect(frameRect.adjusted(1, 1, -1, -1));
- painter->drawPoint(frameRect.bottomLeft());
-
- painter->setPen(spinner->palette.color(QPalette::Mid));
- painter->drawRect(frameRect.adjusted(0, 0, -1, -2));
-
- bool isEnabled = (spinner->state & State_Enabled);
- bool hover = isEnabled && (spinner->state & State_MouseOver);
- bool sunken = (spinner->state & State_Sunken);
- bool upIsActive = (spinner->activeSubControls == SC_SpinBoxUp);
- bool downIsActive = (spinner->activeSubControls == SC_SpinBoxDown);
- bool stepUpEnabled = spinner->stepEnabled &
- QAbstractSpinBox::StepUpEnabled;
- bool stepDownEnabled = spinner->stepEnabled &
- QAbstractSpinBox::StepDownEnabled;
-
- painter->setBrush(spinner->palette.color(QPalette::Background));
-
- painter->drawRect(upRect);
- if (upIsActive && stepUpEnabled) {
- if (sunken) {
- drawSunkenButtonShadow(painter, upRect,
- spinner->palette.color(QPalette::Mid));
- } else if (hover) {
- drawButtonHoverFrame(painter, upRect,
- spinner->palette.color(QPalette::Mid),
- spinner->palette.color(QPalette::Button));
- }
- }
-
- QStyleOptionSpinBox upSpin = *spinner;
- upSpin.rect = upRect;
- drawPrimitive(PE_IndicatorSpinUp, &upSpin, painter, widget);
-
- painter->drawRect(downRect);
- if (downIsActive && stepDownEnabled) {
- if (sunken) {
- drawSunkenButtonShadow(painter, downRect,
- spinner->palette.color(QPalette::Mid));
- } else if (hover) {
- drawButtonHoverFrame(painter, downRect,
- spinner->palette.color(QPalette::Mid),
- spinner->palette.color(QPalette::Button));
- }
- }
-
- QStyleOptionSpinBox downSpin = *spinner;
- downSpin.rect = downRect;
- drawPrimitive(PE_IndicatorSpinDown, &downSpin, painter, widget);
-
- break;
- }
- case CC_ToolButton: {
- const QStyleOptionToolButton *button =
- qstyleoption_cast<const QStyleOptionToolButton *>(option);
-
- painter->setPen(Qt::white);
- painter->drawRect(button->rect.adjusted(1, 1, -1, -1));
-
- QStyleOptionToolButton panelOption = *button;
- QRect panelRect;
- if (!(button->state & State_MouseOver) &&
- !(button->state & State_On)) {
- painter->setPen(QColor(153, 153, 153));
- painter->drawRect(button->rect.adjusted(0, 0, -2, -2));
-
- panelRect = subControlRect(control, option, SC_ToolButton);
- panelOption.rect = panelRect;
- } else {
- panelOption.rect.adjust(0, 0, -1, -1);
- }
-
- QRect menuRect = subControlRect(control, option, SC_ToolButtonMenu);
-
- drawPrimitive(PE_PanelButtonTool, &panelOption, painter, widget);
-
- QStyleOptionToolButton menuOption = *button;
- menuOption.rect = menuRect;
-
- QStyleOptionToolButton label = *button;
- int fw = 5;
-
- drawControl(CE_ToolButtonLabel, &label, painter, widget);
- if (button->subControls & SC_ToolButtonMenu) {
- painter->setPen(button->palette.color(QPalette::WindowText));
- drawPrimitive(PE_IndicatorArrowDown, &menuOption, painter, widget);
- }
-
- if (button->state & State_HasFocus) {
- QStyleOptionToolButton focusOption = *button;
- focusOption.rect = label.rect.adjusted(-1, -1, 1, 1);
-
- drawPrimitive(PE_FrameFocusRect, &focusOption, painter, widget);
- }
-
- break;
- }
- case CC_ComboBox: {
- const QStyleOptionComboBox *combo =
- qstyleoption_cast<const QStyleOptionComboBox *>(option);
-
- QRect frameRect = subControlRect(control, option, SC_ComboBoxFrame,
- widget);
- painter->setPen(combo->palette.color(QPalette::Mid));
-
- if (option->state & State_HasFocus)
- painter->setBrush(option->palette.color(QPalette::Light));
- else
- painter->setBrush(combo->palette.color(QPalette::Background));
-
- painter->drawRect(frameRect.adjusted(0, 0, -1, -1));
-
- QRect arrowRect = subControlRect(control, option, SC_ComboBoxArrow,
- widget);
- painter->setPen(combo->palette.color(QPalette::Button));
- painter->setBrush(Qt::NoBrush);
-
- if (combo->direction == Qt::LeftToRight) {
- painter->drawRect(QRect(frameRect.topLeft() + QPoint(1, 1),
- arrowRect.bottomLeft() + QPoint(-2, -2)));
- } else {
- painter->drawRect(QRect(arrowRect.topLeft() + QPoint(1, 1),
- frameRect.bottomRight() + QPoint(-2, -2)));
- }
-
- QStyleOptionButton button;
- button.rect = arrowRect;
- button.state = combo->state;
- button.palette = combo->palette;
-
- if (button.state & State_On)
- button.state ^= State_On;
-
- painter->save();
- drawButtonBackground(&button, painter, false);
- painter->restore();
-
- QPoint center = arrowRect.center();
- QPoint offset = QPoint(arrowRect.bottomLeft().x() + 1,
- center.y() + 7);
- QPainterPath arrow;
- arrow.moveTo(offset + QPoint(4, -8));
- arrow.lineTo(offset + QPoint(7, -5));
- arrow.lineTo(offset + QPoint(8, -5));
- arrow.lineTo(offset + QPoint(11, -8));
- arrow.lineTo(offset + QPoint(4, -8));
-
- painter->setBrush(combo->palette.color(QPalette::WindowText));
- painter->setPen(combo->palette.color(QPalette::WindowText));
-
- painter->drawPath(arrow);
-
- QRect fieldRect = subControlRect(control, option,
- SC_ComboBoxEditField, widget);
-
- break;
- }
- case CC_Slider: {
- const QStyleOptionSlider *slider =
- qstyleoption_cast<const QStyleOptionSlider *>(option);
-
- bool horizontal = slider->orientation == Qt::Horizontal;
-
- QRect groove = subControlRect(control, option, SC_SliderGroove,
- widget);
- QRect ticks = subControlRect(control, option, SC_SliderTickmarks,
- widget);
- QRect handle = subControlRect(control, option, SC_SliderHandle,
- widget);
-
- QRect afterHandle = QRect(handle.topLeft() + xySwitch(QPoint(4, 6), horizontal),
- groove.bottomRight() + xySwitch(QPoint(-4, -6), horizontal));
- QRect beforeHandle = QRect(groove.topLeft() + xySwitch(QPoint(4, 6), horizontal),
- handle.bottomRight() + xySwitch(QPoint(-4, -6), horizontal));
-
- if (slider->upsideDown || !horizontal) {
- QRect remember;
- remember = afterHandle;
- afterHandle = beforeHandle;
- beforeHandle = remember;
- }
-
- painter->setPen(slider->palette.color(QPalette::Mid));
- painter->setBrush(option->palette.color(QPalette::Background));
- painter->drawRect(afterHandle);
- painter->setPen(slider->palette.color(QPalette::Light));
- painter->drawLine(afterHandle.topLeft() + xySwitch(QPoint(0, 1), horizontal),
- afterHandle.topRight() + xySwitch(QPoint(0, 1), horizontal));
- painter->setPen(option->palette.color(QPalette::Midlight));
-
- if (horizontal) {
- painter->setBrush(gradientBrush(QRect(QPoint(groove.x(),
- handle.y() + 1),
- QSize(groove.width(),
- handle.height() + 1))));
- } else {
- QRect rect = QRect(QPoint(groove.x(),
- handle.x() - 1),
- QSize(groove.height(),
- handle.width() + 1));
- QLinearGradient gradient(groove.bottomLeft(),
- groove.bottomRight());
- gradient.setColorAt(1.0, QColor(188, 210, 230));
- gradient.setColorAt(0.3, Qt::white);
- gradient.setColorAt(0.0, QColor(223, 233, 243));
-
- painter->setBrush(gradient);
- }
-
- painter->drawRect(beforeHandle);
-
- QPainterPath handlePath;
- QPainterPath innerPath;
- QPoint topLeft, topRight, bottomLeft;
- if (horizontal) {
- topLeft = handle.topLeft();
- topRight = handle.topRight();
- bottomLeft = handle.bottomLeft();
- } else {
- topLeft = handle.bottomLeft();
- topRight = handle.topLeft();
- bottomLeft = handle.topRight();
- }
-
- if (horizontal) {
- QImage image(sliderHandleImage);
-
- image.setColor(1,
- option->palette.color(QPalette::Midlight).rgb());
- image.setColor(2,
- option->palette.color(QPalette::Button).rgb());
-
- if (!(slider->state & State_Enabled)) {
- image.setColor(4, slider->palette.color(QPalette::Background).rgb());
- image.setColor(5, slider->palette.color(QPalette::Background).rgb());
- image.setColor(6, slider->palette.color(QPalette::Background).rgb());
- }
-
- painter->drawImage(handle.topLeft(), image);
- } else {
- QImage image(":/images/verticalsliderhandle.png");
- painter->drawImage(handle.topLeft(), image);
- }
-
- if (slider->tickPosition & QSlider::TicksBelow) {
- painter->setPen(slider->palette.color(QPalette::Light));
- int tickInterval = slider->tickInterval ? slider->tickInterval :
- slider->pageStep;
-
- for (int i = 0; i <= slider->maximum; i += tickInterval) {
- if (horizontal) {
- int pos = int(((i / double(slider->maximum)) *
- ticks.width()) - 1);
- painter->drawLine(QPoint(ticks.left() + pos,
- ticks.top() + 2), QPoint(ticks.left() + pos, ticks.top() + 8));
- } else {
- int pos = int(((i / double(slider->maximum)) *
- ticks.height()) - 1);
- painter->drawLine(QPoint(ticks.left() + 2, ticks.bottom() - pos),
- QPoint(ticks.right() - 2, ticks.bottom() - pos));
- }
- }
- if (horizontal) {
- painter->drawLine(QPoint(ticks.right(), ticks.top() + 2),
- QPoint(ticks.right(), ticks.top() + 8));
- } else {
- painter->drawLine(QPoint(ticks.left() + 2, ticks.top()),
- QPoint(ticks.right() - 2, ticks.top()));
- }
- }
- break;
- }
- default:
- QWindowsStyle::drawComplexControl(control, option, painter, widget);
- }
- painter->restore();
-}
-
-inline void JavaStyle::drawSunkenButtonShadow(QPainter *painter,
- QRect rect,
- const QColor &frameColor,
- bool reverse) const
-{
- painter->save();
-
- painter->setPen(frameColor);
-
- if (!reverse) {
- painter->drawLine(QLine(QPoint(rect.x() + 1, rect.y() + 1),
- QPoint(rect.x() + rect.width() - 1, rect.y() + 1)));
- painter->drawLine(QLine(QPoint(rect.x() + 1, rect.y()),
- QPoint(rect.x() + 1, rect.y() + rect.height())));
- } else {
- painter->drawLine(QLine(QPoint(rect.right(), rect.bottom()),
- QPoint(rect.right(), rect.top())));
- painter->drawLine(QLine(QPoint(rect.left(), rect.top() + 1),
- QPoint(rect.right(), rect.top() + 1)));
- }
- painter->restore();
-}
-
-inline void JavaStyle::drawButtonHoverFrame(QPainter *painter, QRect rect,
- const QColor &frameColor,
- const QColor &activeFrame) const
-{
- painter->save();
-
- painter->setPen(activeFrame);
- painter->drawRect(rect);
- rect.adjust(1, 1, -1, -1);
- painter->setPen(frameColor);
- painter->drawRect(rect);
- rect.adjust(1, 1, -1, -1);
- painter->setPen(activeFrame);
- painter->drawRect(rect);
-
- painter->restore();
-}
-
-QStyle::SubControl JavaStyle::hitTestComplexControl(ComplexControl control,
- const QStyleOptionComplex *option,
- const QPoint &pos,
- const QWidget *widget) const
-{
- SubControl ret = SC_None;
-
- switch (control) {
- case CC_TitleBar: {
- const QStyleOptionTitleBar *bar =
- qstyleoption_cast<const QStyleOptionTitleBar *>(option);
-
- QRect maximize = subControlRect(control, bar, SC_TitleBarMaxButton);
- if (maximize.contains(pos)) {
- ret = SC_TitleBarMaxButton;
- break;
- }
- QRect minimize = subControlRect(control, bar, SC_TitleBarMinButton);
- if (minimize.contains(pos)) {
- ret = SC_TitleBarMinButton;
- break;
- }
- QRect close = subControlRect(control, bar, SC_TitleBarCloseButton);
- if (close.contains(pos)) {
- ret = SC_TitleBarCloseButton;
- break;
- }
- QRect system = subControlRect(control, bar, SC_TitleBarSysMenu);
- if (system.contains(pos)) {
- ret = SC_TitleBarSysMenu;
- break;
- }
- ret = SC_TitleBarLabel;
- break;
- }
- case CC_ScrollBar:
- if (const QStyleOptionSlider *scrollBar =
- qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- QRect slider = subControlRect(control, scrollBar,
- SC_ScrollBarSlider, widget);
- if (slider.contains(pos)) {
- ret = SC_ScrollBarSlider;
- break;
- }
-
- QRect scrollBarAddLine = subControlRect(control, scrollBar,
- SC_ScrollBarAddLine, widget);
- if (scrollBarAddLine.contains(pos)) {
- ret = SC_ScrollBarAddLine;
- break;
- }
-
- QRect scrollBarSubPage = subControlRect(control, scrollBar,
- SC_ScrollBarSubPage, widget);
- if (scrollBarSubPage.contains(pos)) {
- ret = SC_ScrollBarSubPage;
- break;
- }
-
- QRect scrollBarAddPage = subControlRect(control, scrollBar,
- SC_ScrollBarAddPage, widget);
- if (scrollBarAddPage.contains(pos)) {
- ret = SC_ScrollBarAddPage;
- break;
- }
-
- QRect scrollBarSubLine = subControlRect(control, scrollBar,
- SC_ScrollBarSubLine, widget);
- if (scrollBarSubLine.contains(pos)) {
- ret = SC_ScrollBarSubLine;
- break;
- }
- }
- break;
-
- default:
- ret = QWindowsStyle::hitTestComplexControl(control, option, pos,
- widget);
- }
- return ret;
-}
-
-void JavaStyle::polish(QWidget *widget)
-{
- if (qobject_cast<QCheckBox *>(widget) ||
- qobject_cast<QRadioButton *>(widget) ||
- qobject_cast<QPushButton *>(widget) ||
- qobject_cast<QToolButton *>(widget) ||
- qobject_cast<QSpinBox *>(widget) ||
- qobject_cast<QGroupBox *>(widget))
- widget->setAttribute(Qt::WA_Hover, true);
-}
-
-void JavaStyle::unpolish(QWidget *widget)
-{
- if (qobject_cast<QPushButton *>(widget) ||
- qobject_cast<QCheckBox *>(widget) ||
- qobject_cast<QRadioButton *>(widget) ||
- qobject_cast<QToolButton *>(widget) ||
- qobject_cast<QSpinBox *>(widget) ||
- qobject_cast<QGroupBox *>(widget))
- widget->setAttribute(Qt::WA_Hover, false);
-}
-
-void JavaStyle::drawSplitter(const QStyleOption *option, QPainter *painter,
- bool horizontal) const
-{
- QRect rect = option->rect;
-
- painter->setPen(Qt::NoPen);
- painter->setBrush(option->palette.color(QPalette::Background));
-
- painter->drawRect(rect);
-
- QColor colors[] = { Qt::white, option->palette.color(QPalette::Mid) };
- int iterations = horizontal ? rect.height() - 1 : rect.width() - 1;
- for (int i = 0; i < iterations; ++i) {
- painter->setPen(colors[i % 2]);
- painter->drawPoint(xySwitch(QPoint(rect.x() + 0 + (i % 4),
- rect.y() + i), horizontal));
- }
-}
-
-inline QPoint JavaStyle::xySwitch(const QPoint &point, bool horizontal) const
-{
- QPoint retPoint = point;
-
- if (!horizontal) {
- retPoint = QPoint(point.y(), point.x());
- }
-
- return retPoint;
-}
-
-void JavaStyle::drawPrimitive(PrimitiveElement element,
- const QStyleOption *option,
- QPainter *painter,
- const QWidget *widget) const
-{
- painter->save();
-
- switch (element) {
- case PE_PanelButtonBevel:
- case PE_FrameButtonBevel: {
- painter->save();
- painter->setBrush(option->palette.background());
- painter->setPen(Qt::NoPen);
- painter->drawRect(option->rect);
- painter->restore();
- break;
- }
- case PE_IndicatorBranch: {
- painter->save();
- QColor lineColor(204, 204, 255);
- QPixmap openPixmap(":/images/jtreeopen.png");
- QPixmap closedPixmap(":/images/jtreeclosed.png");
- QRect pixmapRect(QPoint(0, 0), QSize(12, 12));
- pixmapRect.moveCenter(option->rect.center());
- pixmapRect.translate(2, 0);
- QPoint center = option->rect.center();
-
- painter->setPen(lineColor);
- painter->setBrush(Qt::NoBrush);
-
- if (option->state & State_Item) {
- painter->drawLine(center,
- QPoint(option->rect.right(), center.y()));
-
- painter->drawLine(center, QPoint(center.x(),
- option->rect.top()));
-
- if (option->state & State_Sibling) {
- painter->drawLine(center, QPoint(center.x(),
- option->rect.bottom()));
- }
-
- if (option->state & State_Children)
- if (option->state & State_Open)
- painter->drawPixmap(pixmapRect.topLeft(), closedPixmap);
- else
- painter->drawPixmap(pixmapRect.topLeft(), openPixmap);
- } else if (option->state & State_Sibling) {
- painter->drawLine(center.x(), option->rect.top(), center.x(),
- option->rect.bottom());
- }
-
- painter->restore();
- break;
- }
- case PE_IndicatorViewItemCheck: {
- break;
- }
- case PE_FrameWindow: {
- painter->save();
- bool active = option->state & State_Active;
-
- painter->setPen(Qt::NoPen);
- painter->setBrush(active ? option->palette.color(QPalette::Midlight)
- : option->palette.color(QPalette::Mid));
-
- painter->drawRect(QRect(option->rect.topLeft(), option->rect.bottomLeft() + QPoint(5, 0)));
- painter->drawRect(QRect(option->rect.bottomLeft(), option->rect.bottomRight() + QPoint(0, -5)));
- painter->drawRect(QRect(option->rect.bottomRight() + QPoint(-5, 0), option->rect.topRight()));
- painter->drawRect(QRect(option->rect.topLeft(), option->rect.topRight() + QPoint(0, 4)));
-
- painter->setBrush(Qt::NoBrush);
- painter->setPen(option->palette.color(QPalette::Active, QPalette::WindowText));
- painter->drawLine(option->rect.topLeft() + QPoint(2, 14),
- option->rect.bottomLeft() + QPoint(2, -14));
-
- painter->drawLine(option->rect.topRight() + QPoint(-2, 14),
- option->rect.bottomRight() + QPoint(-2, -14));
-
- painter->drawLine(option->rect.topLeft() + QPoint(14, 2),
- option->rect.topRight() + QPoint(-14, 2));
-
- painter->drawLine(option->rect.bottomLeft() + QPoint(14, -2),
- option->rect.bottomRight() + QPoint(-14, -2));
-
- painter->setPen(active ? option->palette.color(QPalette::Light) :
- option->palette.color(QPalette::Button));
- painter->drawLine(option->rect.topLeft() + QPoint(3, 15),
- option->rect.bottomLeft() + QPoint(3, -13));
-
- painter->drawLine(option->rect.topRight() + QPoint(-1, 15),
- option->rect.bottomRight() + QPoint(-1, -13));
-
- painter->drawLine(option->rect.topLeft() + QPoint(15, 3),
- option->rect.topRight() + QPoint(-13, 3));
-
- painter->drawLine(option->rect.bottomLeft() + QPoint(15, -1),
- option->rect.bottomRight() + QPoint(-13, -1));
-
- painter->restore();
- break;
- }
- case PE_IndicatorSpinUp: {
- const QStyleOptionSpinBox *spinner =
- qstyleoption_cast<const QStyleOptionSpinBox *>(option);
- int add = spinner->state & State_Sunken &&
- spinner->activeSubControls & SC_SpinBoxUp ? 1 : 0;
-
- QPoint center = option->rect.center();
- painter->drawLine(center.x() + add, center.y() + 1 + add,
- center.x() + 2 + add, center.y() + 1 + add);
- painter->drawPoint(center.x() + 1 + add, center.y() + add);
- break;
- }
- case PE_IndicatorSpinDown: {
- const QStyleOptionSpinBox *spinner =
- qstyleoption_cast<const QStyleOptionSpinBox *>(option);
-
- int add = spinner->state & State_Sunken &&
- spinner->activeSubControls & SC_SpinBoxDown ? 1 : 0;
- QPoint center = option->rect.center();
- painter->drawLine(center.x() + add, center.y() + add,
- center.x() + 2 + add, center.y() + add);
- painter->drawPoint(center.x() + 1 + add, center.y() + 1 + add);
- break;
- }
- case PE_FrameDockWidget: {
- drawPrimitive(PE_FrameWindow, option, painter, widget);
- break;
- }
- case PE_IndicatorToolBarHandle: {
- QPoint offset;
- bool horizontal = option->state & State_Horizontal;
-
- if (horizontal)
- offset = option->rect.topLeft();
- else
- offset = option->rect.topLeft();
-
- int iterations = horizontal ? option->rect.height() :
- option->rect.width();
-
- for (int i = 0; i < iterations; ++i) {
- painter->setPen(i % 2 ? Qt::white :
- option->palette.color(QPalette::Mid));
- int add = i % 4;
- painter->drawPoint(offset + xySwitch(QPoint(add, i),
- horizontal));
- painter->drawPoint(offset + xySwitch(QPoint(add + 4, i),
- horizontal));
- if (add + 8 < 10)
- painter->drawPoint(offset + xySwitch(QPoint(add + 8, i),
- horizontal));
- }
-
- break;
- }
- case PE_IndicatorToolBarSeparator: {
- break;
- }
- case PE_PanelButtonTool: {
- const QStyleOptionToolButton *button =
- qstyleoption_cast<const QStyleOptionToolButton *>(option);
-
- if (!button) {
- painter->setPen(Qt::red);
- if (!(option->state & State_Enabled))
- painter->drawRect(option->rect.adjusted(0, 0, -1, -1));
- drawButtonBackground(option, painter, false);
- break;
- }
-
- if (button->state & State_MouseOver || button->state & State_On) {
- QStyleOptionButton bevel;
- bevel.state = button->state;
- bevel.rect = button->rect;
- bevel.palette = button->palette;
-
- drawButtonBackground(&bevel, painter, false);
- } else {
- painter->setPen(Qt::NoPen);
- painter->setBrush(button->palette.color(QPalette::Background));
-
- painter->drawRect(button->rect.adjusted(0, 0, -1, -1));
- }
- break;
- }
- case PE_FrameMenu: {
- painter->setPen(option->palette.color(QPalette::Midlight));
- painter->drawRect(option->rect.adjusted(0, 0, -1, -1));
- break;
- }
- case PE_PanelButtonCommand: {
- const QStyleOptionButton *btn =
- qstyleoption_cast<const QStyleOptionButton *>(option);
- bool hover = (btn->state & State_Enabled) &&
- (btn->state & State_MouseOver);
- bool sunken = btn->state & State_Sunken;
- bool isDefault = btn->features & QStyleOptionButton::DefaultButton;
- bool on = option->state & State_On;
-
- drawButtonBackground(option, painter, false);
-
- QRect rect = option->rect.adjusted(0, 0, -1, -1);
- if (hover && !sunken && !isDefault && !on) {
- drawButtonHoverFrame(painter, rect,
- btn->palette.color(QPalette::Mid),
- btn->palette.color(QPalette::Button));
- } else if (isDefault) {
- drawPrimitive(PE_FrameDefaultButton, option, painter, widget);
- }
- break;
- }
- case PE_FrameDefaultButton: {
- painter->setPen(option->palette.color(QPalette::Mid));
- QRect rect = option->rect.adjusted(0, 0, -1, -1);
- painter->drawRect(rect);
- painter->drawRect(rect.adjusted(1, 1, -1, -1));
- break;
- }
-//! [0]
- case PE_IndicatorCheckBox: {
- painter->save();
- drawButtonBackground(option, painter, true);
-
- if (option->state & State_Enabled &&
- option->state & State_MouseOver &&
- !(option->state & State_Sunken)) {
- painter->setPen(option->palette.color(QPalette::Button));
- QRect rect = option->rect.adjusted(1, 1, -2, -2);
- painter->drawRect(rect);
- rect = rect.adjusted(1, 1, -1, -1);
- painter->drawRect(rect);
- }
-
- if (option->state & State_On) {
- QImage image(":/images/checkboxchecked.png");
- painter->drawImage(option->rect.topLeft(), image);
- }
- painter->restore();
- break;
-//! [0]
- }
- case PE_IndicatorRadioButton: {
- painter->save();
- QBrush radioBrush = option->palette.button();
-
- if (!(option->state & State_Sunken) &&
- option->state & State_Enabled)
- radioBrush = gradientBrush(option->rect);
-
- painter->setBrush(radioBrush);
- if (option->state & State_Enabled)
- painter->setPen(option->palette.color(QPalette::Mid));
- else
- painter->setPen(option->palette.color(QPalette::Disabled,
- QPalette::WindowText));
- painter->drawEllipse(option->rect.adjusted(0, 0, -1, -1));
-
- if (option->state & State_MouseOver &&
- option->state & State_Enabled &&
- !(option->state & State_Sunken)) {
- gradientBrush(option->rect);
- painter->setPen(option->palette.color(QPalette::Button));
- painter->setBrush(Qt::NoBrush);
- QRect rect = option->rect.adjusted(1, 1, -2, -2);
- painter->drawEllipse(rect);
- rect = rect.adjusted(1, 1, -1, -1);
- painter->drawEllipse(rect);
- }
-
- if (option->state & State_On) {
- painter->setBrush(option->palette.color(QPalette::Text));
- painter->setPen(Qt::NoPen);
- painter->drawEllipse(option->rect.adjusted(3, 3, -3, -3));
- }
- if (option->state & State_Sunken &&
- option->state & State_Enabled) {
- painter->setPen(option->palette.color(QPalette::Mid));
- painter->drawArc(option->rect.adjusted(1, 1, -2, -2), 80 * 16,
- 100 * 16);
- }
- painter->restore();
- break;
- }
- case PE_FrameTabWidget: {
- painter->setPen(option->palette.color(QPalette::Midlight));
- painter->drawRect(option->rect.adjusted(0, 0, -1, -1));
- painter->setPen(Qt::white);
- painter->drawRect(option->rect.adjusted(1, 1, -2, -2));
- break;
- }
- case PE_Frame:
- case PE_FrameLineEdit: {
- const QStyleOptionFrame *frame =
- qstyleoption_cast<const QStyleOptionFrame *>(option);
- const QStyleOptionFrameV2 frameV2(*frame);
-
- painter->setPen(frame->palette.color(QPalette::Mid));
- painter->drawRect(frameV2.rect.adjusted(0, 0, -2, -2));
- painter->setPen(Qt::white);
- painter->drawRect(frameV2.rect.adjusted(1, 1, -1, -1));
- painter->setPen(frameV2.palette.color(QPalette::Active,
- QPalette::Background));
- painter->drawLine(frameV2.rect.bottomLeft(),
- frameV2.rect.bottomLeft() + QPoint(1, -1));
- painter->drawLine(frameV2.rect.topRight(),
- frameV2.rect.topRight() + QPoint(-1, 1));
- break;
- }
- case PE_FrameFocusRect: {
- painter->setPen(option->palette.color(QPalette::Light));
- painter->setBrush(Qt::NoBrush);
- QRect rect = option->rect;
- rect = rect.adjusted(0,0, -1, -1);
- painter->drawRect(rect);
- break;
- }
- default:
- QWindowsStyle::drawPrimitive(element, option, painter, widget);
- }
- painter->restore();
-}
-
-//! [1]
-void JavaStyle::drawButtonBackground(const QStyleOption *option,
- QPainter *painter, bool isCheckbox) const
-{
- QBrush buttonBrush = option->palette.button();
- bool sunken = option->state & State_Sunken;
- bool disabled = !(option->state & State_Enabled);
- bool on = option->state & State_On;
-
- if (!sunken && !disabled && (!on || isCheckbox))
- buttonBrush = gradientBrush(option->rect);
-
- painter->fillRect(option->rect, buttonBrush);
-
- QRect rect = option->rect.adjusted(0, 0, -1, -1);
-
- if (disabled)
- painter->setPen(option->palette.color(QPalette::Disabled,
- QPalette::WindowText));
- else
- painter->setPen(option->palette.color(QPalette::Mid));
-
- painter->drawRect(rect);
-
- if (sunken && !disabled) {
- drawSunkenButtonShadow(painter, rect,
- option->palette.color(QPalette::Mid),
- option->direction == Qt::RightToLeft);
- }
-}
-//! [1]
-
-QBrush JavaStyle::gradientBrush(const QRect &rect) const
-{
- QLinearGradient gradient(rect.topLeft(), rect.bottomLeft());
- gradient.setColorAt(1.0, QColor(188, 210, 230));
- gradient.setColorAt(0.3, Qt::white);
- gradient.setColorAt(0.0, QColor(223, 233, 243));
-
- return QBrush(gradient);
-}
-
-QRect JavaStyle::subElementRect(SubElement element,
- const QStyleOption *option,
- const QWidget *widget) const
-{
- QRect rect;
-
- switch (element) {
- case SE_ToolBoxTabContents: {
- const QStyleOptionToolBox *box =
- qstyleoption_cast<const QStyleOptionToolBox *>(option);
-
- rect.moveTopLeft(box->rect.topLeft() + QPoint(0, 2));
- rect.setHeight(box->rect.height() - 4);
- rect.setWidth(box->fontMetrics.width(box->text) + 15);
- break;
- }
- case SE_ProgressBarLabel:
- case SE_ProgressBarGroove:
- case SE_ProgressBarContents: {
- rect = option->rect.adjusted(1, 1, -1, -1);
- break;
- }
- case SE_PushButtonFocusRect: {
- const QStyleOptionButton *btn =
- qstyleoption_cast<const QStyleOptionButton *>(option);
-
- rect = btn->fontMetrics.boundingRect(btn->text);
- rect = QRect(0, 0, btn->fontMetrics.width(btn->text),
- rect.height());
-
- if (!btn->icon.isNull()) {
- rect.adjust(0, 0, btn->iconSize.width(), btn->iconSize.height()
- > rect.height() ? btn->iconSize.height() - rect.height() : 0);
- rect.translate(-btn->iconSize.width(), 0);
- rect.adjust(-1, -1, 1, 1);
- }
- rect = QRect(int(ceil((btn->rect.width() - rect.width()) / 2.0)),
- int(ceil((btn->rect.height() - rect.height()) / 2.0)),
- rect.width() - 1, rect.height());
- rect.adjust(-1, 0, 1, 0);
-
- break;
- }
- default:
- rect = QWindowsStyle::subElementRect(element, option, widget);
- }
- return rect;
-}
-
-int JavaStyle::pixelMetric(PixelMetric metric,
- const QStyleOption* /* option */,
- const QWidget* /*widget*/) const
-{
- int value = 0;
-
- switch (metric) {
- case PM_ButtonShiftHorizontal:
- case PM_ButtonShiftVertical:
- case PM_TabBarTabShiftHorizontal:
- case PM_ButtonDefaultIndicator:
- case PM_TabBarTabShiftVertical:
- value = 0;
- break;
- case PM_TabBarBaseOverlap:
- case PM_DefaultFrameWidth:
- value = 2;
- break;
- case PM_TabBarTabVSpace:
- value = 4;
- break;
- case PM_ScrollBarExtent:
- value = 16;
- break;
- case PM_ScrollBarSliderMin:
- value = 26;
- break;
- case PM_SplitterWidth:
- value = 8;
- break;
- case PM_SliderThickness:
- value = 16;
- break;
- case PM_SliderControlThickness:
- value = 16;
- break;
- case PM_SliderTickmarkOffset:
- value = 10;
- break;
- case PM_SliderSpaceAvailable:
- break;
- case PM_MenuPanelWidth:
- value = 1;
- break;
- case PM_MenuVMargin:
- value = 2;
- break;
- case PM_MenuBarPanelWidth:
- value = 1;
- break;
- case PM_MenuBarItemSpacing:
- value = 0;
- break;
- case PM_MenuBarHMargin:
- value = 3;
- break;
- case PM_MenuBarVMargin:
- value = 0;
- break;
- case PM_ComboBoxFrameWidth:
- value = 1;
- break;
- case PM_MenuButtonIndicator:
- value = 15;
- break;
- case PM_ToolBarItemMargin:
- value = 3;
- break;
- case PM_ToolBarHandleExtent:
- value = 13;
- break;
- case PM_SpinBoxFrameWidth:
- value = 2;
- break;
- case PM_TitleBarHeight: {
- value = 21;
- break;
- case PM_MDIFrameWidth:
- value = 6;
- break;
- }
- case PM_DockWidgetFrameWidth: {
- value = 5;
- break;
- }
- default:
- value = QWindowsStyle::pixelMetric(metric);
- }
- return value;
-}
-
-
-int JavaStyle::styleHint(StyleHint hint, const QStyleOption *option,
- const QWidget *widget,
- QStyleHintReturn *returnData) const
-{
- int ret;
-
- switch (hint) {
- case SH_Table_GridLineColor: {
- ret = static_cast<int>(option->palette.color(QPalette::Mid).rgb());
- break;
- }
- case QStyle::SH_Menu_Scrollable:
- ret = 1;
- break;
- default:
- ret = QWindowsStyle::styleHint(hint, option, widget, returnData);
- }
- return ret;
-}
-
-QPixmap JavaStyle::standardPixmap(StandardPixmap standardPixmap,
- const QStyleOption *option,
- const QWidget *widget) const
-{
- QPixmap pixmap = QWindowsStyle::standardPixmap(standardPixmap, option,
- widget);
-
- QPixmap maximizePixmap(":/images/internalmaximize.png");
- QPixmap minimizePixmap(":/images/internalminimize.png");
- QPixmap closePixmap(":/images/internalclose.png");
- QPixmap internalPixmap(":/images/internalsystem.png");
- QPixmap internalCloseDownPixmap(":/images/internalclosedown.png");
- QPixmap minimizeDownPixmap(":/images/internalminimizedown.png");
- QPixmap maximizeDownPixmap(":/images/internalmaximizedown.png");
- QPixmap dirOpenPixmap(":/images/open24.png");
- QPixmap filePixmap(":/images/file.png");
-
- switch (standardPixmap) {
- case SP_DirLinkIcon:
- case SP_DirClosedIcon:
- case SP_DirIcon:
- case SP_DirOpenIcon: {
- pixmap = closePixmap;
- break;
- }
- case SP_FileIcon: {
- pixmap = filePixmap;
- break;
- }
- case SP_FileDialogBack: {
- pixmap = QPixmap(":/images/fileback.png");
- break;
- }
- case SP_FileDialogToParent: {
- pixmap = QPixmap(":/images/fileparent.png");
- break;
- }
- case SP_FileDialogNewFolder: {
- pixmap = QPixmap(":/images/open24.png");
- break;
- }
- case SP_FileDialogListView: {
- pixmap = QPixmap(":/images/filelist.png");
- break;
- }
- case SP_FileDialogDetailedView: {
- pixmap = QPixmap(":/images/filedetail.png");
- break;
- }
- case SP_MessageBoxInformation: {
- pixmap = QPixmap(":/images/information.png");
- break;
- }
- case SP_MessageBoxWarning: {
- pixmap = QPixmap(":/images/warning.png");
- }
- case SP_MessageBoxCritical: {
- pixmap = QPixmap(":/images/critical.png");
- break;
- }
- case SP_MessageBoxQuestion: {
- pixmap = QPixmap(":/images/question.png");
- break;
- }
- case SP_TitleBarNormalButton:
- pixmap = maximizePixmap;
- break;
- case SP_TitleBarCloseButton:
- pixmap = closePixmap;
- break;
- default:
- ;
- }
-
- return pixmap;
-}
-
-QSize JavaStyle::sizeFromContents(ContentsType type,
- const QStyleOption *option,
- const QSize &contentsSize,
- const QWidget *widget) const
-{
- switch (type) {
- case CT_ComboBox: {
- return QSize(contentsSize.width() + 27, contentsSize.height());
- }
- case CT_Slider: {
- const QStyleOptionSlider *slider =
- qstyleoption_cast<const QStyleOptionSlider *>(option);
- if (slider->tickPosition == QSlider::TicksBelow) {
- return QSize(contentsSize.width(), contentsSize.height() + 15);
- } else {
- return contentsSize;
- }
- }
- case CT_MenuBarItem: {
- const QStyleOptionMenuItem *menuItem =
- qstyleoption_cast<const QStyleOptionMenuItem *>(option);
- QFontMetrics metrics(menuItem->font);
- QRect boundingRect = metrics.boundingRect(menuItem->text);
- int width = boundingRect.width() + 14;
- int height = boundingRect.height() + 3;
- if (height < 20)
- height = 20;
-
- return QSize(width, height);
- }
- case CT_MenuItem: {
- const QStyleOptionMenuItem *menuItem =
- qstyleoption_cast<const QStyleOptionMenuItem *>(option);
- QSize defaultSize = QWindowsStyle::sizeFromContents(type, option,
- contentsSize, widget);
-
- if (menuItem->menuItemType == QStyleOptionMenuItem::Separator)
- return defaultSize;
-
- int width = 30;
- int height = 0;
-
- if (!menuItem->icon.isNull()) {
- width += 20;
- height += 20;
- }
- if (!menuItem->text.isEmpty()) {
- QFontMetrics metrics(menuItem->font);
- QString text = menuItem->text;
- text.remove(QLatin1Char('\t'));
- QRect textRect = metrics.boundingRect(text);
- width += textRect.width();
- if (height < textRect.height())
- height += textRect.height();
- }
- if (menuItem->checkType != QStyleOptionMenuItem::NotCheckable) {
- width += 10;
- if (height < 10)
- height = 10;
- }
- return QSize(width, height);
- }
- default:
- return QWindowsStyle::sizeFromContents(type, option, contentsSize,
- widget);
- }
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/moc/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/moc/main.cpp
deleted file mode 100644
index 0a1763a34..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/moc/main.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "myclass1.h"
-
-MyClass::MyClass(QObject *) {}
-MyClass::~MyClass() {}
-void MyClass::mySlot() {}
-#undef MyClass
-
-#include "myclass2.h"
-
-MyClass::MyClass(QObject *) {}
-MyClass::~MyClass() {}
-void MyClass::setPriority(Priority) {}
-MyClass::Priority MyClass::priority() const { return High; }
-#undef MyClass
-
-#include "myclass3.h"
-
-MyClass::MyClass(QObject *) {}
-MyClass::~MyClass() {}
-#undef MyClass
-
-int main()
-{
- return 0;
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/modelview-subclasses/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/modelview-subclasses/main.cpp
deleted file mode 100644
index fd43b1aad..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/modelview-subclasses/main.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*
- main.cpp
-
- An example of a main window application that used a subclassed model
- and view to display data from sound files.
-*/
-
-#include <QApplication>
-
-#include "model.h"
-#include "view.h"
-#include "window.h"
-
-/*!
- The main function for the linear model example. This creates and
- populates a model with long integers then displays the contents of the
- model using a QListView widget.
-*/
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- MainWindow *window = new MainWindow;
-
- window->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/modelview-subclasses/model.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/modelview-subclasses/model.cpp
deleted file mode 100644
index e4d4033a7..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/modelview-subclasses/model.cpp
+++ /dev/null
@@ -1,162 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*
- model.cpp
-
- A simple model that uses a QVector as its data source.
-*/
-
-#include "model.h"
-
-/*!
- Returns the number of items in the string list as the number of rows
- in the model.
-*/
-
-int LinearModel::rowCount(const QModelIndex &parent) const
-{
- Q_USING(parent);
-
- return values.count();
-}
-
-/*
- Returns an appropriate value for the requested data.
- If the view requests an invalid index, an invalid variant is returned.
- If a header is requested then we just return the column or row number,
- depending on the orientation of the header.
- Any valid index that corresponds to a string in the list causes that
- string to be returned.
-*/
-
-/*!
- Returns a model index for other component to use when referencing the
- item specified by the given row, column, and type. The parent index
- is ignored.
-*/
-
-QModelIndex LinearModel::index(int row, int column, const QModelIndex &parent) const
-{
- if (parent == QModelIndex() && row >= 0 && row < rowCount()
- && column == 0)
- return createIndex(row, column, 0);
- else
- return QModelIndex();
-}
-
-QVariant LinearModel::data(const QModelIndex &index, int role) const
-{
- Q_UNUSED(role);
-
- if (!index.isValid())
- return QVariant();
-
- return values.at(index.row());
-}
-
-/*!
- Returns Qt::ItemIsEditable so that all items in the vector can be edited.
-*/
-
-Qt::ItemFlags LinearModel::flags(const QModelIndex &index) const
-{
- // all items in the model are editable
- return QAbstractListModel::flags(index) | Qt::ItemIsEditable;
-}
-
-/*!
- Changes an item in the string list, but only if the following conditions
- are met:
-
- * The index supplied is valid.
- * The index corresponds to an item to be shown in a view.
- * The role associated with editing text is specified.
-
- The dataChanged() signal is emitted if the item is changed.
-*/
-
-bool LinearModel::setData(const QModelIndex &index,
- const QVariant &value, int role)
-{
- if (!index.isValid() || role != Qt::EditRole)
- return false;
- values.replace(index.row(), value.toInt());
- emit dataChanged(index, index);
- return true;
-}
-
-/*!
- Inserts a number of rows into the model at the specified position.
-*/
-
-bool LinearModel::insertRows(int position, int rows, const QModelIndex &parent)
-{
- beginInsertRows(parent, position, position + rows - 1);
-
- values.insert(position, rows, 0);
-
- endInsertRows();
- return true;
-}
-
-/*!
- Removes a number of rows from the model at the specified position.
-*/
-
-bool LinearModel::removeRows(int position, int rows, const QModelIndex &parent)
-{
- beginRemoveRows(QModelIndex(), position, position+rows-1);
-
- values.remove(position, rows);
-
- endRemoveRows();
- return true;
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/modelview-subclasses/view.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/modelview-subclasses/view.cpp
deleted file mode 100644
index eb13a0fee..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/modelview-subclasses/view.cpp
+++ /dev/null
@@ -1,324 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- view.cpp
-
- Provides a view to represent a one-dimensional sequence of integers
- obtained from a list model as a series of rows.
-*/
-
-#include <QAbstractItemModel>
-#include <QBrush>
-#include <QItemSelection>
-#include <QPainter>
-#include <QPaintEvent>
-#include <QPen>
-#include <QPoint>
-#include <QResizeEvent>
-#include <QScrollBar>
-#include <QSizePolicy>
-
-#include "view.h"
-
-LinearView::LinearView(QWidget *parent)
- : QAbstractItemView(parent)
-{
- setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
-}
-
-/*!
- Returns the position of the item in viewport coordinates.
-*/
-
-QRect LinearView::itemViewportRect(const QModelIndex &index) const
-{
- QRect rect = itemRect(index);
- QRect result(rect.left() - horizontalScrollBar()->value(),
- rect.top() - verticalScrollBar()->value(),
- rect.width(), viewport()->height());
-
- return result;
-}
-
-/*!
- Returns the rectangle of the item at position \a index in the
- model. The rectangle is in contents coordinates.
-*/
-
-QRect LinearView::itemRect(const QModelIndex &index) const
-{
- if (!index.isValid())
- return QRect();
- else
- return QRect(index.row(), 0, 1, 1);
-}
-
-
-void LinearView::ensureVisible(const QModelIndex &index)
-{
- QRect area = viewport()->rect();
- QRect rect = itemViewportRect(index);
-
- if (rect.left() < area.left())
- horizontalScrollBar()->setValue(
- horizontalScrollBar()->value() - rect.left());
- else if (rect.right() > area.right())
- horizontalScrollBar()->setValue(
- horizontalScrollBar()->value() + rect.left() - area.width());
-}
-
-/*!
- Returns the item that covers the coordinate given in the view.
-*/
-
-QModelIndex LinearView::itemAt(int x, int /* y */) const
-{
- int row = x + horizontalScrollBar()->value();
-
- return model()->index(row, 0, QModelIndex());
-}
-
-//void LinearView::dataChanged(const QModelIndex &/* topLeft */,
-// const QModelIndex &/* bottomRight */)
-//{
-// updateGeometries();
-// if (isVisible())
-// repaint();
-//}
-
-void LinearView::rowsInserted(const QModelIndex &/* parent */, int /* start */,
- int /* end */)
-{
- updateGeometries();
- if (isVisible())
- repaint();
-}
-
-void LinearView::rowsRemoved(const QModelIndex &/* parent */, int /* start */,
- int /* end */)
-{
- updateGeometries();
- if (isVisible())
- repaint();
-}
-/*
-void LinearView::verticalScrollbarAction(int action)
-{
-}
-
-void LinearView::horizontalScrollbarAction(int action)
-{
-}
-*/
-
-/*!
- Select the items in the model that lie within the rectangle specified by
- \a rect, using the selection \a command.
-*/
-
-void LinearView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command)
-{
- QModelIndex leftIndex = itemAt(rect.left(), 0);
- QModelIndex rightIndex = itemAt(rect.right(), 0);
-
- QItemSelection selection(leftIndex, rightIndex);
-
- selectionModel()->select(selection, command);
-}
-
-QModelIndex LinearView::moveCursor(QAbstractItemView::CursorAction cursorAction,
- Qt::KeyboardModifiers)
-{
- QModelIndex current = currentIndex();
-
- switch (cursorAction) {
- case MoveLeft:{
- if (current.row() > 0)
- return model()->index(current.row() - 1, 0, QModelIndex());
- else
- return model()->index(0, 0, QModelIndex());
- break;}
- case MoveRight:{
- if (current.row() < rows(current) - 1)
- return model()->index(current.row() + 1, 0, QModelIndex());
- else
- return model()->index(rows(current) - 1, 0,QModelIndex());
- break;}
- case MoveUp:
- return current;
- case MoveDown:
- return current;
- case MovePageUp:
- return current;
- case MovePageDown:
- return current;
- case MoveHome:
- return model()->index(0, 0, QModelIndex());
- case MoveEnd:
- return model()->index(rows(current) - 1, 0, QModelIndex());
- default:
- return current;
- }
-}
-
-int LinearView::horizontalOffset() const
-{
- return horizontalScrollBar()->value();
-}
-
-int LinearView::verticalOffset() const
-{
- return verticalScrollBar()->value();
-}
-
-/*!
- Returns a rectangle corresponding to the selection in viewport cooridinates.
-*/
-
-QRect LinearView::selectionViewportRect(const QItemSelection &selection) const
-{
- int ranges = selection.count();
-
- if (ranges == 0)
- return QRect();
-
- // Note that we use the top and bottom functions of the selection range
- // since the data is stored in rows.
-
- int firstRow = selection.at(0).top();
- int lastRow = selection.at(0).top();
-
- for (int i = 0; i < ranges; ++i) {
- firstRow = qMin(firstRow, selection.at(i).top());
- lastRow = qMax(lastRow, selection.at(i).bottom());
- }
-
- QModelIndex firstItem = model()->index(qMin(firstRow, lastRow), 0,
- QModelIndex());
- QModelIndex lastItem = model()->index(qMax(firstRow, lastRow), 0,
- QModelIndex());
-
- QRect firstRect = itemViewportRect(firstItem);
- QRect lastRect = itemViewportRect(lastItem);
-
- return QRect(firstRect.left(), firstRect.top(),
- lastRect.right() - firstRect.left(), firstRect.height());
-}
-
-void LinearView::paintEvent(QPaintEvent *event)
-{
- QPainter painter(viewport());
-
- QRect updateRect = event->rect();
- QBrush background(Qt::black);
- QPen foreground(Qt::white);
-
- painter.fillRect(updateRect, background);
- painter.setPen(foreground);
-
- QModelIndex firstItem = itemAt(updateRect.left(), updateRect.top());
- if (!firstItem.isValid())
- firstItem = model()->index(0, 0, QModelIndex());
-
- QModelIndex lastItem = itemAt(updateRect.right(), updateRect.bottom());
- if (!lastItem.isValid())
- lastItem = model()->index(rows() - 1, 0, QModelIndex());
-
- int x = updateRect.left();
- //int top = updateRect.top();
- //int bottom = updateRect.bottom();
-
- int row = firstItem.row();
- QModelIndex index = model()->index(row, 0, QModelIndex());
- int value = model()->data(index, Qt::DisplayRole).toInt();
- int midPoint = viewport()->height()/2;
- int y2 = midPoint - int(value * midPoint/255.0);
-
- while (row <= lastItem.row()) {
-
- QModelIndex index = model()->index(row, 0, QModelIndex());
- int value = model()->data(index, Qt::DisplayRole).toInt();
-
- int y1 = y2;
- y2 = midPoint - int(value * midPoint/255.0);
-
- painter.drawLine(x-1, y1, x, y2);
- ++row; ++x;
- }
-}
-
-void LinearView::resizeEvent(QResizeEvent * /* event */)
-{
- updateGeometries();
-}
-
-void LinearView::updateGeometries()
-{
- if (viewport()->width() < rows()) {
- horizontalScrollBar()->setPageStep(viewport()->width());
- horizontalScrollBar()->setRange(0, rows() - viewport()->width() - 1);
- }
-}
-
-QSize LinearView::sizeHint() const
-{
- return QSize(rows(), 200);
-}
-
-int LinearView::rows(const QModelIndex &index) const
-{
- return model()->rowCount(model()->parent(index));
-}
-
-bool LinearView::isIndexHidden(const QModelIndex &index) const
-{
- return false;
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/modelview-subclasses/window.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/modelview-subclasses/window.cpp
deleted file mode 100644
index fcd61d2c8..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/modelview-subclasses/window.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QAction>
-#include <QDataStream>
-#include <QMenu>
-#include <QMenuBar>
-#include <QFile>
-#include <QFileDialog>
-#include <QListView>
-
-#include "window.h"
-
-MainWindow::MainWindow(QWidget *parent)
- : QMainWindow(parent)
-{
- setWindowTitle("Model/View example");
-
- setupModelView();
-
- QAction *openAction = new QAction(tr("&Open"), this);
- QAction *quitAction = new QAction(tr("E&xit"), this);
- QMenu *fileMenu = new QMenu(tr("&File"), this);
- fileMenu->addAction(openAction);
- fileMenu->addAction(quitAction);
- menuBar()->addMenu(fileMenu);
-
- connect(openAction, SIGNAL(triggered()), this, SLOT(selectOpenFile()));
- connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));
-
- setCentralWidget(view);
-}
-
-void MainWindow::setupModelView()
-{
- model = new LinearModel(this);
- view = new LinearView(this);
- view->setModel(model);
-}
-
-void MainWindow::selectOpenFile()
-{
- QString fileName = QFileDialog::getOpenFileName(this,
- tr("Select a file to open"), "", tr("Sound files (*.wav)"));
-
- if (!fileName.isEmpty())
- openFile(fileName);
-}
-
-void MainWindow::openFile(const QString &fileName)
-{
- QFile file(fileName);
- int length = file.size();
-
- if (file.open(QFile::ReadOnly)) {
- model->removeRows(0, model->rowCount());
-
- int rows = (length - 0x2c)/2;
- model->insertRows(0, rows);
-
- // Perform some dodgy tricks to extract the data from the file.
- QDataStream stream(&file);
- stream.setByteOrder(QDataStream::LittleEndian);
-
- Q_INT16 left;
- Q_INT16 right;
-
- for (int row = 0; row < rows; ++row) {
- QModelIndex index = model->index(row);
-
- stream >> left >> right;
- model->setData(index, int(left / 256));
- }
- }
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/painterpath/painterpath.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/painterpath/painterpath.cpp
deleted file mode 100644
index ea589b663..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/painterpath/painterpath.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-
-
-int main(int argc, char **argv)
-{
- QApplication app(argc, argv);
-
- QImage image(100, 100, QImage::Format_RGB32);
-
- QPainterPath path;
- path.addRect(20, 20, 60, 60);
-
- path.moveTo(0, 0);
- path.cubicTo(99, 0, 50, 50, 99, 99);
- path.cubicTo(0, 99, 50, 50, 0, 0);
-
- QPainter painter(&image);
- painter.fillRect(0, 0, 100, 100, Qt::white);
-
- painter.save();
- painter.translate(0.5, 0.5);
- painter.setPen(QPen(QColor(79, 106, 25), 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin));
- painter.setBrush(QColor(122, 163, 39));
- painter.setRenderHint(QPainter::Antialiasing);
-
- painter.drawPath(path);
-
- painter.restore();
- painter.end();
-
- QLabel lab;
- lab.setPixmap(QPixmap::fromImage(image));
- lab.show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/persistentindexes/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/persistentindexes/main.cpp
deleted file mode 100644
index 3e610dc18..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/persistentindexes/main.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-
-#include "mainwindow.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- MainWindow *window = new MainWindow;
- window->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/persistentindexes/mainwindow.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/persistentindexes/mainwindow.cpp
deleted file mode 100644
index 0d8941638..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/persistentindexes/mainwindow.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-#include "model.h"
-
-/*!
- The main window constructor creates and populates a model with values
- from a string list then displays the contents of the model using a
- QListView widget.
-*/
-
-MainWindow::MainWindow(QWidget *parent)
- : QMainWindow(parent)
-{
- QMenu *fileMenu = new QMenu(tr("&File"));
-
- QAction *quitAction = fileMenu->addAction(tr("E&xit"));
- quitAction->setShortcut(tr("Ctrl+Q"));
-
- QMenu *itemsMenu = new QMenu(tr("&Items"));
-
- insertAction = itemsMenu->addAction(tr("&Insert Item"));
- removeAction = itemsMenu->addAction(tr("&Remove Item"));
-
- menuBar()->addMenu(fileMenu);
- menuBar()->addMenu(itemsMenu);
-
- QStringList numbers;
- numbers << tr("One") << tr("Two") << tr("Three") << tr("Four") << tr("Five")
- << tr("Six") << tr("Seven") << tr("Eight") << tr("Nine") << tr("Ten");
-
- model = new StringListModel(numbers);
- QListView *view = new QListView(this);
- view->setModel(model);
-
- selectionModel = view->selectionModel();
-
- connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
- connect(insertAction, SIGNAL(triggered()), this, SLOT(insertItem()));
- connect(removeAction, SIGNAL(triggered()), this, SLOT(removeItem()));
- connect(selectionModel,
- SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
- this, SLOT(updateMenus(const QModelIndex &)));
-
- setCentralWidget(view);
- setWindowTitle("View onto a string list model");
-}
-
-void MainWindow::insertItem()
-{
- if (!selectionModel->currentIndex().isValid())
- return;
-
- QString itemText = QInputDialog::getText(this, tr("Insert Item"),
- tr("Input text for the new item:"));
-
- if (itemText.isNull())
- return;
-
- int row = selectionModel->currentIndex().row();
-
- if (model->insertRows(row, 1))
- model->setData(model->index(row, 0), itemText, Qt::EditRole);
-}
-
-void MainWindow::removeItem()
-{
- if (!selectionModel->currentIndex().isValid())
- return;
-
- int row = selectionModel->currentIndex().row();
-
- model->removeRows(row, 1);
-}
-
-void MainWindow::updateMenus(const QModelIndex &currentIndex)
-{
- insertAction->setEnabled(currentIndex.isValid());
- removeAction->setEnabled(currentIndex.isValid());
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/plaintextlayout/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/plaintextlayout/main.cpp
deleted file mode 100644
index 2149c6b5e..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/plaintextlayout/main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "window.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- Window *window = new Window;
- window->resize(337, 343);
- window->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/plaintextlayout/window.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/plaintextlayout/window.cpp
deleted file mode 100644
index 00db9a820..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/plaintextlayout/window.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-#include <math.h>
-
-#include "window.h"
-
-Window::Window(QWidget *parent)
- : QWidget(parent)
-{
- text = QString("Support for text rendering and layout in Qt 4 has been "
- "redesigned around a system that allows textual content to "
- "be represented in a more flexible way than was possible "
- "with Qt 3. Qt 4 also provides a more convenient "
- "programming interface for editing documents. These "
- "improvements are made available through a reimplementation "
- "of the existing text rendering engine, and the "
- "introduction of several new classes. "
- "See the relevant module overview for a detailed discussion "
- "of this framework. The following sections provide a brief "
- "overview of the main concepts behind Scribe.");
-
- setWindowTitle(tr("Plain Text Layout"));
-}
-
-void Window::paintEvent(QPaintEvent *event)
-{
-//! [0]
- QTextLayout textLayout(text, font);
- qreal margin = 10;
- qreal radius = qMin(width()/2.0, height()/2.0) - margin;
- QFontMetrics fm(font);
-
- qreal lineHeight = fm.height();
- qreal y = 0;
-
- textLayout.beginLayout();
-
- while (1) {
- // create a new line
- QTextLine line = textLayout.createLine();
- if (!line.isValid())
- break;
-
- qreal x1 = qMax(0.0, pow(pow(radius,2)-pow(radius-y,2), 0.5));
- qreal x2 = qMax(0.0, pow(pow(radius,2)-pow(radius-(y+lineHeight),2), 0.5));
- qreal x = qMax(x1, x2) + margin;
- qreal lineWidth = (width() - margin) - x;
-
- line.setLineWidth(lineWidth);
- line.setPosition(QPointF(x, margin+y));
- y += line.height();
- }
-
- textLayout.endLayout();
-
- QPainter painter;
- painter.begin(this);
- painter.setRenderHint(QPainter::Antialiasing);
- painter.fillRect(rect(), Qt::white);
- painter.setBrush(QBrush(Qt::black));
- painter.setPen(QPen(Qt::black));
- textLayout.draw(&painter, QPoint(0,0));
-
- painter.setBrush(QBrush(QColor("#a6ce39")));
- painter.setPen(QPen(Qt::black));
- painter.drawEllipse(QRectF(-radius, margin, 2*radius, 2*radius));
- painter.end();
-//! [0]
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/pointer/pointer.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/pointer/pointer.cpp
deleted file mode 100644
index e75addb88..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/pointer/pointer.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QLabel>
-#include <QPointer>
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
-//! [0]
- QPointer<QLabel> label = new QLabel;
- label->setText("&Status:");
-//! [0]
-
-//! [1]
- if (label)
-//! [1] //! [2]
- label->show();
-//! [2]
- return 0;
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/porting4-dropevents/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/porting4-dropevents/main.cpp
deleted file mode 100644
index 66f5e5556..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/porting4-dropevents/main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "window.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- MyWidget window;
- window.show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/porting4-dropevents/window.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/porting4-dropevents/window.cpp
deleted file mode 100644
index 64e8f4297..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/porting4-dropevents/window.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "window.h"
-
-MyWidget::MyWidget(QWidget *parent)
- : QWidget(parent)
-{
- QLabel *textLabel = new QLabel(tr("Data:"), this);
- dataLabel = new QLabel(this);
- dataLabel->setFixedSize(200, 200);
-
- QVBoxLayout *layout = new QVBoxLayout(this);
- layout->addWidget(textLabel);
- layout->addWidget(dataLabel);
-
- setAcceptDrops(true);
- setWindowTitle(tr("Drop Events"));
-}
-
-//! [0]
-void MyWidget::dragEnterEvent(QDragEnterEvent *event)
-{
- if (event->mimeData()->hasText() || event->mimeData()->hasImage())
- event->acceptProposedAction();
-}
-//! [0]
-
-//! [1]
-void MyWidget::dropEvent(QDropEvent *event)
-{
- if (event->mimeData()->hasText())
- dataLabel->setText(event->mimeData()->text());
- else if (event->mimeData()->hasImage()) {
- QVariant imageData = event->mimeData()->imageData();
- dataLabel->setPixmap(qvariant_cast<QPixmap>(imageData));
- }
- event->acceptProposedAction();
-}
-//! [1]
-
-//! [2]
-void MyWidget::mousePressEvent(QMouseEvent *event)
-{
-//! [2]
- QString text = dataLabel->text();
- QPixmap iconPixmap(32, 32);
- iconPixmap.fill(qRgba(255, 0, 0, 127));
- QImage image(100, 100, QImage::Format_RGB32);
- image.fill(qRgb(0, 0, 255));
-
-//! [3]
- if (event->button() == Qt::LeftButton) {
-
- QDrag *drag = new QDrag(this);
- QMimeData *mimeData = new QMimeData;
-
- mimeData->setText(text);
- mimeData->setImageData(image);
- drag->setMimeData(mimeData);
- drag->setPixmap(iconPixmap);
-
- Qt::DropAction dropAction = drag->exec();
-//! [3]
- // ...
-//! [4]
- event->accept();
- }
-//! [4]
- else if (event->button() == Qt::MidButton) {
-
- QDrag *drag = new QDrag(this);
- QMimeData *mimeData = new QMimeData;
-
- mimeData->setImageData(image);
- drag->setMimeData(mimeData);
- drag->setPixmap(iconPixmap);
-
- Qt::DropAction dropAction = drag->exec();
- // ...
- event->accept();
- }
-//! [5]
-}
-//! [5]
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/printing-qprinter/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/printing-qprinter/main.cpp
deleted file mode 100644
index 6e0815fba..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/printing-qprinter/main.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-#include "object.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- Object object;
- QTimer timer;
- timer.setSingleShot(true);
- timer.connect(&timer, SIGNAL(timeout()), &object, SLOT(print()));
- timer.start(0);
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/printing-qprinter/object.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/printing-qprinter/object.cpp
deleted file mode 100644
index 1ad520061..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/printing-qprinter/object.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-#include "object.h"
-
-Object::Object(QObject *parent)
- : QObject(parent)
-{
-}
-
-void Object::print()
-{
- int numberOfPages = 10;
- int lastPage = numberOfPages - 1;
-
-//! [0]
- QPrinter printer(QPrinter::HighResolution);
- printer.setOutputFileName("print.ps");
- QPainter painter;
- painter.begin(&printer);
-
- for (int page = 0; page < numberOfPages; ++page) {
-
- // Use the painter to draw on the page.
-
- if (page != lastPage)
- printer.newPage();
- }
-
- painter.end();
-//! [0]
- qApp->quit();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/process/process.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/process/process.cpp
deleted file mode 100644
index 178aa804a..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/process/process.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QProcess>
-
-bool zip()
-{
-//! [0]
- gzip = QProcess()
- gzip.start("gzip", ["-c"])
- if not gzip.waitForStarted():
- return False
-
- gzip.write("Qt rocks!")
- gzip.closeWriteChannel()
-
- if not gzip.waitForFinished():
- return False
-
- result = gzip.readAll()
-//! [0]
-
- gzip.start("gzip", QStringList() << "-d" << "-c");
- gzip.write(result);
- gzip.closeWriteChannel();
-
- if (!gzip.waitForFinished())
- return false;
-
- qDebug("Result: %s", gzip.readAll().data());
- return true;
-}
-
-
-int main()
-{
- zip();
- return 0;
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qcalendarwidget/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qcalendarwidget/main.cpp
deleted file mode 100644
index 479779d17..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qcalendarwidget/main.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QCalendarWidget>
-
-int main(int argc, char **argv)
-{
- QApplication app(argc, argv);
-
- QCalendarWidget calendar;
- calendar.setSelectedDate(calendar.selectedDate().addDays(3));
- calendar.setGridVisible(true);
- calendar.show();
-
- QCalendarWidget calendarMin;
- calendarMin.setMinimumDate(calendarMin.selectedDate().addDays(-7));
- calendarMin.setGridVisible(true);
- calendarMin.show();
-
- QCalendarWidget calendarMax;
- calendarMax.setMaximumDate(calendarMax.selectedDate().addDays(7));
- calendarMax.setGridVisible(true);
- calendarMax.show();
-
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qcolumnview/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qcolumnview/main.cpp
deleted file mode 100644
index b14e30828..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qcolumnview/main.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- QStandardItemModel model;
-
- QStandardItem *name = new QStandardItem("Name");
- QStandardItem *firstName = new QStandardItem("First Name");
- QStandardItem *lastName = new QStandardItem("Last Name");
-
- name->appendRow(firstName);
- name->appendRow(lastName);
- model.appendRow(name);
-
- QStandardItem *john = new QStandardItem("John");
- QStandardItem *smith = new QStandardItem("Smith");
-
- firstName->appendRow(john);
- lastName->appendRow(smith);
-
- QStandardItem *address = new QStandardItem("Address");
- QStandardItem *street = new QStandardItem("Street");
- QStandardItem *city = new QStandardItem("City");
- QStandardItem *state = new QStandardItem("State");
- QStandardItem *country = new QStandardItem("Country");
-
- address->appendRow(street);
- address->appendRow(city);
- address->appendRow(state);
- address->appendRow(country);
- model.appendRow(address);
-
- QColumnView columnView;
- columnView.setModel(&model);
- columnView.show();
-
- return app.exec();
-} \ No newline at end of file
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qdebug/qdebugsnippet.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qdebug/qdebugsnippet.cpp
deleted file mode 100644
index ff482e4d6..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qdebug/qdebugsnippet.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-#include <QtDebug>
-
-class Coordinate : public QObject
-{
-public:
- int myX, myY;
-
- int x() const { return myX; };
- int y() const { return myY; };
-};
-
-//! [0]
-QDebug operator<<(QDebug dbg, const Coordinate &c)
-{
- dbg.nospace() << "(" << c.x() << ", " << c.y() << ")";
-
- return dbg.space();
-}
-//! [0]
-
-int main(int argv, char **args)
-{
- Coordinate coordinate;
- coordinate.myX = 10;
- coordinate.myY = 44;
-
-//! [1]
- qDebug() << "Date:" << QDate::currentDate();
- qDebug() << "Types:" << QString("String") << QChar('x') << QRect(0, 10, 50, 40);
- qDebug() << "Custom coordinate type:" << coordinate;
-//! [1]
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qdir-filepaths/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qdir-filepaths/main.cpp
deleted file mode 100644
index ca9321323..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qdir-filepaths/main.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QDir>
-#include <iostream>
-
-int main(int argc, char *argv[])
-{
- QDir directory("Documents/Letters");
- QString path = directory.filePath("contents.txt");
- QString absolutePath = directory.absoluteFilePath("contents.txt");
-
- std::cout << qPrintable(directory.dirName()) << std::endl;
- std::cout << qPrintable(path) << std::endl;
- std::cout << qPrintable(absolutePath) << std::endl;
- return 0;
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qelapsedtimer/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qelapsedtimer/main.cpp
deleted file mode 100644
index 0e81fcae9..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qelapsedtimer/main.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include <QtCore>
-
-void slowOperation1()
-{
- static char buf[256];
- for (int i = 0; i < (1<<20); ++i)
- buf[i % sizeof buf] = i;
-}
-
-void slowOperation2(int) { slowOperation1(); }
-
-void startExample()
-{
-//![0]
- timer = QElapsedTimer()
- timer.start()
-
- slowOperation1()
-
- sys.stderr.write("The slow operation took" + timer.elapsed() + "milliseconds")
-//![0]
-}
-
-//![1]
-def executeSlowOperations(timeout):
- timer = QElapsedTimer()
- timer.start()
- slowOperation1()
-
- remainingTime = timeout - timer.elapsed()
- if remainingTime > 0:
- slowOperation2(remainingTime)
-//![1]
-
-//![2]
-def executeOperationsForTime(ms):
- timer = QElapsedTimer()
- timer.start()
-
- while not timer.hasExpired(ms):
- slowOperation1()
-//![2]
-
-int restartExample()
-{
-//![3]
- timer = QElapsedTimer()
-
- count = 1
- timer.start()
-
- while True:
- count *= 2
- slowOperation2(count)
- if timer.restart() < 250:
- break
-
- return count
-//![3]
-}
-
-int main(int argc, char **argv)
-{
- QCoreApplication app(argc, argv);
-
- startExample();
- restartExample();
- executeSlowOperations(5);
- executeOperationsForTime(5);
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qgl-namespace/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qgl-namespace/main.cpp
deleted file mode 100644
index 691cfc828..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qgl-namespace/main.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QGL>
-
-int main(int argc, char *argv[])
-{
- return 0;
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qlabel/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qlabel/main.cpp
deleted file mode 100644
index b40aade61..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qlabel/main.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-class Updater : public QObject
-{
- Q_OBJECT
-
-public:
- Updater(QWidget *widget);
-
-public slots:
- void adjustSize();
-
-private:
- QWidget *widget;
-};
-
-Updater::Updater(QWidget *widget)
- : widget(widget)
-{
-}
-
-void Updater::adjustSize()
-{
- widget->adjustSize();
-}
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- QLabel *label = new QLabel("My label");
- QLineEdit *editor = new QLineEdit("New text");
- QWidget window;
- //Updater updater(&label);
- QObject::connect(editor, SIGNAL(textChanged(const QString &)),
- label, SLOT(setText(const QString &)));
- //QObject::connect(editor, SIGNAL(textChanged(const QString &)),
- // &updater, SLOT(adjustSize()));
- //editor.show();
- //label.show();
- QVBoxLayout *layout = new QVBoxLayout;
- layout->addWidget(label);
- layout->addWidget(editor);
- window.setLayout(layout);
- window.show();
- return app.exec();
-}
-
-#include "main.moc"
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qlineargradient/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qlineargradient/main.cpp
deleted file mode 100644
index 8b850a53f..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qlineargradient/main.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-#include "paintwidget.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- PaintWidget window;
- window.show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qlineargradient/paintwidget.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qlineargradient/paintwidget.cpp
deleted file mode 100644
index 2bd363730..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qlineargradient/paintwidget.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-#include "paintwidget.h"
-
-PaintWidget::PaintWidget(QWidget *parent)
- : QWidget(parent)
-{
-}
-
-void PaintWidget::paintEvent(QPaintEvent *event)
-{
- QLinearGradient gradient1(rect().topLeft(), rect().bottomRight());
- gradient1.setColorAt(0, QColor("#ffffcc"));
- gradient1.setColorAt(1, QColor("#ccccff"));
-
- QRectF ellipseRect(width()*0.25, height()*0.25, width()*0.5, height()*0.5);
- QLinearGradient gradient2(ellipseRect.topLeft(), ellipseRect.bottomRight());
- gradient2.setColorAt(0, QColor("#ccccff"));
- gradient2.setColorAt(1, QColor("#ffffcc"));
-
- QPainter painter;
- painter.begin(this);
- painter.setRenderHint(QPainter::Antialiasing);
- painter.fillRect(rect(), QBrush(gradient1));
- painter.setBrush(QBrush(gradient2));
- painter.drawEllipse(ellipseRect);
- painter.end();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qlistview-dnd/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qlistview-dnd/main.cpp
deleted file mode 100644
index e76756fe8..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qlistview-dnd/main.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- MainWindow *window = new MainWindow;
- window->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qlistview-dnd/mainwindow.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qlistview-dnd/mainwindow.cpp
deleted file mode 100644
index 5403a8979..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qlistview-dnd/mainwindow.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-#include "model.h"
-
-MainWindow::MainWindow()
-{
- QMenu *fileMenu = new QMenu(tr("&File"));
-
- QAction *quitAction = fileMenu->addAction(tr("E&xit"));
- quitAction->setShortcut(tr("Ctrl+Q"));
-
- menuBar()->addMenu(fileMenu);
-
-// For convenient quoting:
-//! [0]
-QListView *listView = new QListView(this);
-listView->setSelectionMode(QAbstractItemView::ExtendedSelection);
-listView->setDragEnabled(true);
-listView->setAcceptDrops(true);
-listView->setDropIndicatorShown(true);
-//! [0]
-
- this->listView = listView;
-
- connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));
-
- setupListItems();
-
- setCentralWidget(listView);
- setWindowTitle(tr("List View"));
-}
-
-void MainWindow::setupListItems()
-{
- QStringList items;
- items << tr("Oak") << tr("Fir") << tr("Pine") << tr("Birch") << tr("Hazel")
- << tr("Redwood") << tr("Sycamore") << tr("Chestnut")
- << tr("Mahogany");
-
- DragDropListModel *model = new DragDropListModel(items, this);
- listView->setModel(model);
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qlistview-dnd/model.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qlistview-dnd/model.cpp
deleted file mode 100644
index 5464ff4c2..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qlistview-dnd/model.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*
- model.cpp
-
- A simple model that uses a QStringList as its data source.
-*/
-
-#include <QtWidgets>
-
-#include "model.h"
-
-DragDropListModel::DragDropListModel(const QStringList &strings,
- QObject *parent)
- : QStringListModel(strings, parent)
-{
-}
-
-//! [0]
-bool DragDropListModel::dropMimeData(const QMimeData *data,
- Qt::DropAction action, int row, int column, const QModelIndex &parent)
-{
- if (action == Qt::IgnoreAction)
- return true;
-
- if (!data->hasFormat("application/vnd.text.list"))
- return false;
-
- if (column > 0)
-//! [0] //! [1]
- return false;
-//! [1]
-
-//! [2]
- int beginRow;
-
- if (row != -1)
- beginRow = row;
-//! [2] //! [3]
- else if (parent.isValid())
- beginRow = parent.row();
-//! [3] //! [4]
- else
- beginRow = rowCount(QModelIndex());
-//! [4]
-
-//! [5]
- QByteArray encodedData = data->data("application/vnd.text.list");
- QDataStream stream(&encodedData, QIODevice::ReadOnly);
- QStringList newItems;
- int rows = 0;
-
- while (!stream.atEnd()) {
- QString text;
- stream >> text;
- newItems << text;
- ++rows;
- }
-//! [5]
-
-//! [6]
- insertRows(beginRow, rows, QModelIndex());
- foreach (QString text, newItems) {
- QModelIndex idx = index(beginRow, 0, QModelIndex());
- setData(idx, text);
- beginRow++;
- }
-
- return true;
-}
-//! [6]
-
-//! [7]
-Qt::ItemFlags DragDropListModel::flags(const QModelIndex &index) const
-{
- Qt::ItemFlags defaultFlags = QStringListModel::flags(index);
-
- if (index.isValid())
- return Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | defaultFlags;
- else
- return Qt::ItemIsDropEnabled | defaultFlags;
-}
-//! [7]
-
-//! [8]
-def mimeData(self, indexes):
- mimeData = QMimeData()
- encodedData = QByteArray()
- stream = QDataStream(encodedData, QIODevice.WriteOnly)
-
- for index in indexes:
- if index.isValid():
- stream << data(index, Qt.DisplayRole)
-
- mimeData.setData("application/vnd.text.list", encodedData)
- return mimeData;
-//! [8]
-
-//! [9]
-QStringList DragDropListModel::mimeTypes() const
-{
- QStringList types;
- types << "application/vnd.text.list";
- return types;
-}
-//! [9]
-
-//! [10]
-Qt::DropActions DragDropListModel::supportedDropActions() const
-{
- return Qt::CopyAction | Qt::MoveAction;
-}
-//! [10]
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qlistview-using/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qlistview-using/main.cpp
deleted file mode 100644
index e76756fe8..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qlistview-using/main.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- MainWindow *window = new MainWindow;
- window->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qlistview-using/mainwindow.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qlistview-using/mainwindow.cpp
deleted file mode 100644
index 3c4905556..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qlistview-using/mainwindow.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-#include "model.h"
-
-MainWindow::MainWindow()
-{
- QMenu *fileMenu = new QMenu(tr("&File"));
-
- QAction *quitAction = fileMenu->addAction(tr("E&xit"));
- quitAction->setShortcut(tr("Ctrl+Q"));
-
- QMenu *itemsMenu = new QMenu(tr("&Items"));
-
- insertAction = itemsMenu->addAction(tr("&Insert Item"));
- removeAction = itemsMenu->addAction(tr("&Remove Item"));
- QAction *ascendingAction = itemsMenu->addAction(tr("Sort in &Ascending Order"));
- QAction *descendingAction = itemsMenu->addAction(tr("Sort in &Descending Order"));
-
- menuBar()->addMenu(fileMenu);
- menuBar()->addMenu(itemsMenu);
-
- QStringList strings;
- strings << tr("Oak") << tr("Fir") << tr("Pine") << tr("Birch")
- << tr("Hazel") << tr("Redwood") << tr("Sycamore") << tr("Chestnut");
- model = new StringListModel(strings, this);
-/* For convenient quoting:
- QListView *listView = new QListView(this);
-*/
- listView = new QListView(this);
- listView->setModel(model);
- listView->setSelectionMode(QAbstractItemView::SingleSelection);
-
- connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));
- connect(ascendingAction, SIGNAL(triggered()), this, SLOT(sortAscending()));
- connect(descendingAction, SIGNAL(triggered()), this, SLOT(sortDescending()));
- connect(insertAction, SIGNAL(triggered()), this, SLOT(insertItem()));
- connect(removeAction, SIGNAL(triggered()), this, SLOT(removeItem()));
- connect(listView->selectionModel(),
- SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
- this, SLOT(updateMenus(const QModelIndex &)));
-
- updateMenus(listView->selectionModel()->currentIndex());
-
- setCentralWidget(listView);
- setWindowTitle(tr("List View"));
-}
-
-void MainWindow::sortAscending()
-{
- model->sort(0, Qt::AscendingOrder);
-}
-
-void MainWindow::sortDescending()
-{
- model->sort(0, Qt::DescendingOrder);
-}
-
-void MainWindow::insertItem()
-{
- QModelIndex currentIndex = listView->currentIndex();
- if (!currentIndex.isValid())
- return;
-
- QString itemText = QInputDialog::getText(this, tr("Insert Item"),
- tr("Input text for the new item:"));
-
- if (itemText.isNull())
- return;
-
- if (model->insertRow(currentIndex.row(), QModelIndex())) {
- QModelIndex newIndex = model->index(currentIndex.row(), 0, QModelIndex());
- model->setData(newIndex, itemText, Qt::EditRole);
-
- QString toolTipText = tr("Tooltip:") + itemText;
- QString statusTipText = tr("Status tip:") + itemText;
- QString whatsThisText = tr("What's This?:") + itemText;
- model->setData(newIndex, toolTipText, Qt::ToolTipRole);
- model->setData(newIndex, toolTipText, Qt::StatusTipRole);
- model->setData(newIndex, whatsThisText, Qt::WhatsThisRole);
- }
-}
-
-void MainWindow::removeItem()
-{
- QModelIndex currentIndex = listView->currentIndex();
- if (!currentIndex.isValid())
- return;
-
- model->removeRow(currentIndex.row(), QModelIndex());
-}
-
-void MainWindow::updateMenus(const QModelIndex &current)
-{
- insertAction->setEnabled(current.isValid());
- removeAction->setEnabled(current.isValid());
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qlistwidget-dnd/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qlistwidget-dnd/main.cpp
deleted file mode 100644
index e76756fe8..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qlistwidget-dnd/main.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- MainWindow *window = new MainWindow;
- window->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qlistwidget-dnd/mainwindow.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qlistwidget-dnd/mainwindow.cpp
deleted file mode 100644
index a80b2fc38..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qlistwidget-dnd/mainwindow.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-
-MainWindow::MainWindow()
-{
- QMenu *fileMenu = new QMenu(tr("&File"));
-
- QAction *quitAction = fileMenu->addAction(tr("E&xit"));
- quitAction->setShortcut(tr("Ctrl+Q"));
-
- menuBar()->addMenu(fileMenu);
-
-// For convenient quoting:
-//! [0]
-QListWidget *listWidget = new QListWidget(this);
-listWidget->setSelectionMode(QAbstractItemView::SingleSelection);
-listWidget->setDragEnabled(true);
-listWidget->viewport()->setAcceptDrops(true);
-listWidget->setDropIndicatorShown(true);
-//! [0] //! [1]
-listWidget->setDragDropMode(QAbstractItemView::InternalMove);
-//! [1]
-
- this->listWidget = listWidget;
-
- connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));
-
- setupListItems();
-
- setCentralWidget(listWidget);
- setWindowTitle(tr("List Widget"));
-}
-
-void MainWindow::setupListItems()
-{
- QListWidgetItem *item;
- item = new QListWidgetItem(tr("Oak"), listWidget);
- item = new QListWidgetItem(tr("Fir"), listWidget);
- item = new QListWidgetItem(tr("Pine"), listWidget);
- item = new QListWidgetItem(tr("Birch"), listWidget);
- item = new QListWidgetItem(tr("Hazel"), listWidget);
- item = new QListWidgetItem(tr("Redwood"), listWidget);
- item = new QListWidgetItem(tr("Sycamore"), listWidget);
- item = new QListWidgetItem(tr("Chestnut"), listWidget);
- item = new QListWidgetItem(tr("Mahogany"), listWidget);
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qlistwidget-using/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qlistwidget-using/main.cpp
deleted file mode 100644
index e76756fe8..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qlistwidget-using/main.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- MainWindow *window = new MainWindow;
- window->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qlistwidget-using/mainwindow.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qlistwidget-using/mainwindow.cpp
deleted file mode 100644
index efc2836f3..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qlistwidget-using/mainwindow.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-
-MainWindow::MainWindow()
-{
- QMenu *fileMenu = new QMenu(tr("&File"));
-
- QAction *quitAction = fileMenu->addAction(tr("E&xit"));
- quitAction->setShortcut(tr("Ctrl+Q"));
-
- QMenu *itemsMenu = new QMenu(tr("&Items"));
-
- insertAction = itemsMenu->addAction(tr("&Insert Item"));
- removeAction = itemsMenu->addAction(tr("&Remove Item"));
- QAction *ascendingAction = itemsMenu->addAction(tr("Sort in &Ascending Order"));
- QAction *descendingAction = itemsMenu->addAction(tr("Sort in &Descending Order"));
-
- menuBar()->addMenu(fileMenu);
- menuBar()->addMenu(itemsMenu);
-
-/* For convenient quoting:
-//! [0]
- listWidget = QListWidget(self)
-//! [0]
-*/
- listWidget = new QListWidget(this);
- listWidget->setSelectionMode(QAbstractItemView::SingleSelection);
-
- connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));
- connect(ascendingAction, SIGNAL(triggered()), this, SLOT(sortAscending()));
- connect(descendingAction, SIGNAL(triggered()), this, SLOT(sortDescending()));
- connect(insertAction, SIGNAL(triggered()), this, SLOT(insertItem()));
- connect(removeAction, SIGNAL(triggered()), this, SLOT(removeItem()));
- connect(listWidget,
- SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)),
- this, SLOT(updateMenus(QListWidgetItem *)));
-
- setupListItems();
- updateMenus(listWidget->currentItem());
-
- setCentralWidget(listWidget);
- setWindowTitle(tr("List Widget"));
-}
-
-void MainWindow::setupListItems()
-{
-//! [1]
- QListWidgetItem(tr("Oak"), listWidget)
- QListWidgetItem(tr("Fir"), listWidget)
- QListWidgetItem(tr("Pine"), listWidget)
-//! [1]
- new QListWidgetItem(tr("Birch"), listWidget);
-//! [2]
- QListWidgetItem(tr("Hazel"), listWidget)
-//! [2]
- new QListWidgetItem(tr("Redwood"), listWidget);
-//! [3]
- QListWidgetItem(tr("Sycamore"), listWidget)
- QListWidgetItem(tr("Chestnut"), listWidget)
- QListWidgetItem(tr("Mahogany"), listWidget)
-//! [3]
-}
-
-void MainWindow::sortAscending()
-{
-//! [4]
- listWidget.sortItems(Qt.AscendingOrder)
-//! [4]
-}
-
-void MainWindow::sortDescending()
-{
-//! [5]
- listWidget.sortItems(Qt.DescendingOrder)
-//! [5]
-}
-
-void MainWindow::insertItem()
-{
- if (!listWidget->currentItem())
- return;
-
- QString itemText = QInputDialog::getText(this, tr("Insert Item"),
- tr("Input text for the new item:"));
-
- if (itemText.isNull())
- return;
-
-//! [6]
- newItem = QListWidgetItem()
- newItem.setText(itemText)
-//! [6]
- int row = listWidget->row(listWidget->currentItem());
-//! [7]
- listWidget.insertItem(row, newItem)
-//! [7]
-
- QString toolTipText = tr("Tooltip:") + itemText;
- QString statusTipText = tr("Status tip:") + itemText;
- QString whatsThisText = tr("What's This?:") + itemText;
-//! [8]
- newItem.setToolTip(toolTipText)
- newItem.setStatusTip(toolTipText)
- newItem.setWhatsThis(whatsThisText)
-//! [8]
-}
-
-void MainWindow::removeItem()
-{
- listWidget->takeItem(listWidget->row(listWidget->currentItem()));
-}
-
-void MainWindow::updateMenus(QListWidgetItem *current)
-{
- insertAction->setEnabled(current != 0);
- removeAction->setEnabled(current != 0);
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qmetaobject-invokable/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qmetaobject-invokable/main.cpp
deleted file mode 100644
index ed05fec41..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qmetaobject-invokable/main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QDebug>
-#include "window.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- Window window;
- qDebug() << window.metaObject()->methodCount();
- window.show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qmetaobject-invokable/window.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qmetaobject-invokable/window.cpp
deleted file mode 100644
index 2a06203af..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qmetaobject-invokable/window.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "window.h"
-
-Window::Window()
-{
-}
-
-void Window::normalMethod()
-{
- // Cannot be called by the meta-object system.
- show();
-}
-
-void Window::invokableMethod()
-{
- // Can be called by the meta-object system.
- show();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qprocess-environment/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qprocess-environment/main.cpp
deleted file mode 100644
index 93b5855ff..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qprocess-environment/main.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore>
-
-void startProcess()
-{
- {
-//! [0]
-import re
-from PySide2.QtCore import QProcess
-
-process = QProcess()
-
-env = QProcess.systemEnvironment()
-env.append("TMPDIR=C:\\MyApp\\temp") # Add an environment variable
-regex = re.compile(r'^PATH=(.*)', re.IGNORECASE)
-env = [regex.sub(r'PATH=\1;C:\\Bin', var) for var in env]
-process.setEnvironment(env)
-process.start("myapp")
-//! [0]
- }
-
- {
-//! [1]
-process = QProcess()
-env = QProcessEnvironment.systemEnvironment()
-env.insert("TMPDIR", "C:\\MyApp\\temp") # Add an environment variable
-env.insert("PATH", env.value("Path") + ";C:\\Bin")
-process.setProcessEnvironment(env)
-process.start("myapp")
-//! [1]
- }
-}
-
-int main(int argc, char *argv[])
-{
- QCoreApplication app(argc, argv);
- startProcess();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qprocess/qprocess-simpleexecution.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qprocess/qprocess-simpleexecution.cpp
deleted file mode 100644
index c7d964b44..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qprocess/qprocess-simpleexecution.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QtWidgets>
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-//! [0]
- ...
-//! [0]
- parent = &app;
-
-//! [1]
- program = "./path/to/Qt/examples/widgets/analogclock"
-//! [1]
- program = "./../../../../examples/widgets/analogclock/analogclock";
-
-//! [2]
- arguments = ["-style", "fusion"]
-
- myProcess = QProcess(parent)
- myProcess.start(program, arguments)
-//! [2]
-
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qsignalmapper/buttonwidget.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qsignalmapper/buttonwidget.cpp
deleted file mode 100644
index 8bf807230..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qsignalmapper/buttonwidget.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "buttonwidget.h"
-
-//! [0]
-
-def __init__(self, texts, parent):
- QWidget.__init__(self, parent)
-
- self.signalMapper = QSignalMapper(self)
-
- layout = QGridLayout()
-
- for text, index in enumerate(texts):
- button = QPushButton(text)
- self.connect(SIGNAL("clicked()"), self.signalMapper, SLOT("map()"))
-//! [0] //! [1]
- self.signalMapper.setMapping(button, text)
- layout.addWidget(button, index / 3, index % 3)
-
- self.signalMapper.connect(SIGNAL("mapped(const QString &)"),
-//! [1] //! [2]
- self, SLOT("clicked(const QString &)"))
-
- self.setLayout(layout)
-
-//! [2]
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qsignalmapper/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qsignalmapper/main.cpp
deleted file mode 100644
index f570a9b0c..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qsignalmapper/main.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-
-#include "buttonwidget.h"
-#include "mainwindow.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- QStringList texts;
- texts << "January" << "February" << "March" << "April"
- << "May" << "June" << "July" << "August"
- << "September" << "October" << "November"
- << "December";
- MainWindow *mw = new MainWindow;
- ButtonWidget *buttons = new ButtonWidget(texts, mw);
- mw->setCentralWidget(buttons);
- mw->show();
- QObject::connect(buttons, SIGNAL(clicked(const QString &)),
- mw, SLOT(buttonPressed(const QString &)));
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qsortfilterproxymodel/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qsortfilterproxymodel/main.cpp
deleted file mode 100644
index a1a1a2387..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qsortfilterproxymodel/main.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- QObject *parent = &app;
-
- QStringList numbers;
- numbers << "One" << "Two" << "Three" << "Four" << "Five";
-
- QAbstractItemModel *stringListModel = new QStringListModel(numbers, parent);
-
-//! [0]
- QSortFilterProxyModel *filterModel = new QSortFilterProxyModel(parent);
- filterModel->setSourceModel(stringListModel);
-//! [0]
-
- QWidget *window = new QWidget;
-
-//! [1]
- QListView *filteredView = new QListView;
- filteredView->setModel(filterModel);
-//! [1]
- filteredView->setWindowTitle("Filtered view onto a string list model");
-
- QLineEdit *patternEditor = new QLineEdit;
- QObject::
- connect(patternEditor, SIGNAL(textChanged(const QString &)),
- filterModel, SLOT(setFilterRegExp(const QString &)));
-
- QVBoxLayout *layout = new QVBoxLayout(window);
- layout->addWidget(filteredView);
- layout->addWidget(patternEditor);
-
- window->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qsplashscreen/mainwindow.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qsplashscreen/mainwindow.cpp
deleted file mode 100644
index d9489856b..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qsplashscreen/mainwindow.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-
-MainWindow::MainWindow()
-{
- QLabel *label = new QLabel(tr("This is the main window."));
- label->setAlignment(Qt::AlignCenter);
- setCentralWidget(label);
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qsql-namespace/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qsql-namespace/main.cpp
deleted file mode 100644
index 7f512e091..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qsql-namespace/main.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QSql>
-
-int main(int argc, char *argv[])
-{
- return 0;
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qstack/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qstack/main.cpp
deleted file mode 100644
index 60b83bfcb..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qstack/main.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-#include <iostream>
-using namespace std;
-
-int main(int argc, char *argv[])
-{
-//! [0]
- QStack<int> stack;
- stack.push(1);
- stack.push(2);
- stack.push(3);
- while (!stack.isEmpty())
- cout << stack.pop() << endl;
-//! [0]
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qstackedlayout/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qstackedlayout/main.cpp
deleted file mode 100644
index 9652a0ef4..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qstackedlayout/main.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-#include <QApplication>
-
-class Widget : public QWidget
-{
-public:
- Widget(QWidget *parent = 0);
-};
-
-Widget::Widget(QWidget *parent)
- : QWidget(parent)
-{
-//! [0]
- QWidget *firstPageWidget = new QWidget;
- QWidget *secondPageWidget = new QWidget;
- QWidget *thirdPageWidget = new QWidget;
-
- QStackedLayout *stackedLayout = new QStackedLayout;
- stackedLayout->addWidget(firstPageWidget);
- stackedLayout->addWidget(secondPageWidget);
- stackedLayout->addWidget(thirdPageWidget);
-
-//! [0] //! [1]
- QComboBox *pageComboBox = new QComboBox;
- pageComboBox->addItem(tr("Page 1"));
- pageComboBox->addItem(tr("Page 2"));
- pageComboBox->addItem(tr("Page 3"));
- connect(pageComboBox, SIGNAL(activated(int)),
- stackedLayout, SLOT(setCurrentIndex(int)));
-//! [1]
-
-//! [2]
- QVBoxLayout *mainLayout = new QVBoxLayout;
-//! [2]
- mainLayout->addWidget(pageComboBox);
-//! [3]
- mainLayout->addLayout(stackedLayout);
- setLayout(mainLayout);
-//! [3]
-}
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- Widget widget;
- widget.show();
- return app.exec();
-}
-
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qstandarditemmodel/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qstandarditemmodel/main.cpp
deleted file mode 100644
index c5b9ab923..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qstandarditemmodel/main.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-#include <QApplication>
-
-class Widget : public QWidget
-{
-public:
- Widget(QWidget *parentWidget = 0);
-};
-
-Widget::Widget(QWidget *parentWidget)
- : QWidget(parentWidget)
-{
- QStandardItemModel *model = new QStandardItemModel();
- QModelIndex parent;
- for (int i = 0; i < 4; ++i) {
- parent = model->index(0, 0, parent);
- model->insertRows(0, 1, parent);
- model->insertColumns(0, 1, parent);
- QModelIndex index = model->index(0, 0, parent);
- model->setData(index, i);
- }
-}
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- Widget widget;
- widget.show();
- return app.exec();
-}
-
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qstringlistmodel/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qstringlistmodel/main.cpp
deleted file mode 100644
index 07c77f949..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qstringlistmodel/main.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-class Widget : public QWidget
-{
-public:
- Widget(QWidget *parent = 0);
-};
-
-Widget::Widget(QWidget *parent)
- : QWidget(parent)
-{
-//! [0]
- model = QStringListModel()
- list = QStringList()
- list.append("a")
- list.append("b")
- list.append("c")
- model.setStringList(list)
-//! [0]
-}
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- Widget widget;
- widget.show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qstyleplugin/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qstyleplugin/main.cpp
deleted file mode 100644
index 67c5b519f..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qstyleplugin/main.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QtWidgets>
-
-class MyStylePlugin : public QStylePlugin
-{
-public:
- MyStylePlugin(QObject *parent = 0);
-
- QStyle *create(const QString &key);
- QStringList keys() const;
-};
-
-class RocketStyle : public QCommonStyle
-{
-public:
- RocketStyle() {};
-
-};
-
-class StarBusterStyle : public QCommonStyle
-{
-public:
- StarBusterStyle() {};
-};
-
-MyStylePlugin::MyStylePlugin(QObject *parent)
- : QStylePlugin(parent)
-{
-}
-
-//! [0]
-QStringList MyStylePlugin::keys() const
-{
- return QStringList() << "Rocket" << "StarBuster";
-}
-//! [0]
-
-//! [1]
-QStyle *MyStylePlugin::create(const QString &key)
-{
- QString lcKey = key;
- if (lcKey == "rocket") {
- return new RocketStyle;
- } else if (lcKey == "starbuster") {
- return new StarBusterStyle;
- }
- return 0;
-//! [1] //! [2]
-}
-//! [2]
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- MyStylePlugin plugin;
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qsvgwidget/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qsvgwidget/main.cpp
deleted file mode 100644
index 537c8ac69..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qsvgwidget/main.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-#include <QtSvg>
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-//! [0]
- QSvgWidget window(":/files/spheres.svg");
- window.show();
-//! [0]
- QSvgRenderer *renderer = window.renderer();
- QImage image(150, 150, QImage::Format_RGB32);
- QPainter painter;
- painter.begin(&image);
- renderer->render(&painter);
- painter.end();
- image.save("spheres.png", "PNG", 9);
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qt-namespace/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qt-namespace/main.cpp
deleted file mode 100644
index 90d3f00ed..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qt-namespace/main.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <Qt>
-
-int main(int argc, char *argv[])
-{
- return 0;
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtablewidget-dnd/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qtablewidget-dnd/main.cpp
deleted file mode 100644
index e76756fe8..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtablewidget-dnd/main.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- MainWindow *window = new MainWindow;
- window->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtablewidget-dnd/mainwindow.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qtablewidget-dnd/mainwindow.cpp
deleted file mode 100644
index e0ac8a2db..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtablewidget-dnd/mainwindow.cpp
+++ /dev/null
@@ -1,153 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-#include "math.h"
-
-#include "mainwindow.h"
-
-MainWindow::MainWindow()
-{
- QMenu *fileMenu = new QMenu(tr("&File"));
-
- QAction *quitAction = fileMenu->addAction(tr("E&xit"));
- quitAction->setShortcut(tr("Ctrl+Q"));
-
- QMenu *itemsMenu = new QMenu(tr("&Items"));
-
- QAction *sumItemsAction = itemsMenu->addAction(tr("&Sum Items"));
- QAction *averageItemsAction = itemsMenu->addAction(tr("&Average Items"));
-
- menuBar()->addMenu(fileMenu);
- menuBar()->addMenu(itemsMenu);
-
- tableWidget = new QTableWidget(12, 3, this);
- tableWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
- tableWidget->setDragEnabled(true);
- tableWidget->setAcceptDrops(true);
- tableWidget->setDropIndicatorShown(true);
-
- QTableWidgetItem *valuesHeaderItem = new QTableWidgetItem(tr("Values"));
- tableWidget->setHorizontalHeaderItem(0, valuesHeaderItem);
- valuesHeaderItem->setTextAlignment(Qt::AlignVCenter);
- QTableWidgetItem *squaresHeaderItem = new QTableWidgetItem(tr("Squares"));
- squaresHeaderItem->setIcon(QIcon(QPixmap(":/Images/squared.png")));
- squaresHeaderItem->setTextAlignment(Qt::AlignVCenter);
- QTableWidgetItem *cubesHeaderItem = new QTableWidgetItem(tr("Cubes"));
- cubesHeaderItem->setIcon(QIcon(QPixmap(":/Images/cubed.png")));
- cubesHeaderItem->setTextAlignment(Qt::AlignVCenter);
- tableWidget->setHorizontalHeaderItem(1, squaresHeaderItem);
- tableWidget->setHorizontalHeaderItem(2, cubesHeaderItem);
-
- connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));
- connect(sumItemsAction, SIGNAL(triggered()), this, SLOT(sumItems()));
- connect(averageItemsAction, SIGNAL(triggered()), this, SLOT(averageItems()));
-
- setupTableItems();
-
- setCentralWidget(tableWidget);
- setWindowTitle(tr("Table Widget"));
-}
-
-void MainWindow::setupTableItems()
-{
- for (int row = 0; row < tableWidget->rowCount()-1; ++row) {
- for (int column = 0; column < tableWidget->columnCount(); ++column) {
- QTableWidgetItem *newItem = new QTableWidgetItem(tr("%1").arg(
- pow((float)row, (float)column+1)));
- tableWidget->setItem(row, column, newItem);
- }
- }
- for (int column = 0; column < tableWidget->columnCount(); ++column) {
- QTableWidgetItem *newItem = new QTableWidgetItem;
- newItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable);
- tableWidget->setItem(tableWidget->rowCount()-1, column, newItem);
- }
-}
-
-void MainWindow::averageItems()
-{
- QList<QTableWidgetItem *> selected = tableWidget->selectedItems();
- QTableWidgetItem *item;
- int number = 0;
- double total = 0;
-
- foreach (item, selected) {
- bool ok;
- double value = item->text().toDouble(&ok);
-
- if (ok && !item->text().isEmpty()) {
- total += value;
- number++;
- }
- }
- if (number > 0)
- tableWidget->currentItem()->setText(QString::number(total/number));
-}
-
-void MainWindow::sumItems()
-{
- QList<QTableWidgetItem *> selected = tableWidget->selectedItems();
- QTableWidgetItem *item;
- int number = 0;
- double total = 0;
-
- foreach (item, selected) {
- bool ok;
- double value = item->text().toDouble(&ok);
-
- if (ok && !item->text().isEmpty()) {
- total += value;
- number++;
- }
- }
- if (number > 0)
- tableWidget->currentItem()->setText(QString::number(total));
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtablewidget-resizing/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qtablewidget-resizing/main.cpp
deleted file mode 100644
index e76756fe8..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtablewidget-resizing/main.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- MainWindow *window = new MainWindow;
- window->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtablewidget-resizing/mainwindow.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qtablewidget-resizing/mainwindow.cpp
deleted file mode 100644
index fcaa77648..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtablewidget-resizing/mainwindow.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-
-MainWindow::MainWindow()
-{
- QMenu *fileMenu = new QMenu(tr("&File"));
-
- QAction *quitAction = fileMenu->addAction(tr("E&xit"));
- quitAction->setShortcut(tr("Ctrl+Q"));
-
- QMenu *tableMenu = new QMenu(tr("&Table"));
-
- QAction *tableWidthAction = tableMenu->addAction(tr("Change Table &Width"));
- QAction *tableHeightAction = tableMenu->addAction(tr("Change Table &Height"));
-
- menuBar()->addMenu(fileMenu);
- menuBar()->addMenu(tableMenu);
-
-//! [0]
- tableWidget = QTableWidget()
-//! [0]
- tableWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
-
- connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));
- connect(tableWidthAction, SIGNAL(triggered()), this, SLOT(changeWidth()));
- connect(tableHeightAction, SIGNAL(triggered()), this, SLOT(changeHeight()));
-
- setupTableItems();
-
- setCentralWidget(tableWidget);
- setWindowTitle(tr("Table Widget Resizing"));
-}
-
-void MainWindow::setupTableItems()
-{
-//! [1]
- tableWidget.setRowCount(10)
- tableWidget.setColumnCount(5)
-//! [1]
-
- for (int row = 0; row < tableWidget->rowCount(); ++row) {
- for (int column = 0; column < tableWidget->columnCount(); ++column) {
-//! [2]
- newItem = QTableWidgetItem(tr("%s" % ((row+1)*(column+1))))
- tableWidget.setItem(row, column, newItem)
-//! [2]
- }
- }
-}
-
-void MainWindow::changeWidth()
-{
- bool ok;
-
- int newWidth = QInputDialog::getInteger(this, tr("Change table width"),
- tr("Input the number of columns required (1-20):"),
- tableWidget->columnCount(), 1, 20, 1, &ok);
-
- if (ok)
- tableWidget->setColumnCount(newWidth);
-}
-
-void MainWindow::changeHeight()
-{
- bool ok;
-
- int newHeight = QInputDialog::getInteger(this, tr("Change table height"),
- tr("Input the number of rows required (1-20):"),
- tableWidget->rowCount(), 1, 20, 1, &ok);
-
- if (ok)
- tableWidget->setRowCount(newHeight);
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtablewidget-using/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qtablewidget-using/main.cpp
deleted file mode 100644
index e76756fe8..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtablewidget-using/main.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- MainWindow *window = new MainWindow;
- window->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtablewidget-using/mainwindow.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qtablewidget-using/mainwindow.cpp
deleted file mode 100644
index e98359539..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtablewidget-using/mainwindow.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-#include "math.h"
-
-#include "mainwindow.h"
-
-MainWindow::MainWindow()
-{
- QMenu *fileMenu = new QMenu(tr("&File"));
-
- QAction *quitAction = fileMenu->addAction(tr("E&xit"));
- quitAction->setShortcut(tr("Ctrl+Q"));
-
- QMenu *itemsMenu = new QMenu(tr("&Items"));
-
- QAction *sumItemsAction = itemsMenu->addAction(tr("&Sum Items"));
- QAction *averageItemsAction = itemsMenu->addAction(tr("&Average Items"));
-
- menuBar()->addMenu(fileMenu);
- menuBar()->addMenu(itemsMenu);
-
-//! [0]
- tableWidget = QTableWidget(12, 3, self)
-//! [0]
- tableWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
-
-//! [1]
- valuesHeaderItem = QTableWidgetItem(tr("Values"))
- tableWidget.setHorizontalHeaderItem(0, valuesHeaderItem)
-//! [1]
- valuesHeaderItem->setTextAlignment(Qt::AlignVCenter);
- QTableWidgetItem *squaresHeaderItem = new QTableWidgetItem(tr("Squares"));
- squaresHeaderItem->setIcon(QIcon(QPixmap(":/Images/squared.png")));
- squaresHeaderItem->setTextAlignment(Qt::AlignVCenter);
-//! [2]
- cubesHeaderItem = QTableWidgetItem(tr("Cubes"))
- cubesHeaderItem.setIcon(QIcon(QPixmap(":/Images/cubed.png")))
- cubesHeaderItem.setTextAlignment(Qt::AlignVCenter)
-//! [2]
- tableWidget->setHorizontalHeaderItem(1, squaresHeaderItem);
- tableWidget->setHorizontalHeaderItem(2, cubesHeaderItem);
-
- connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));
- connect(sumItemsAction, SIGNAL(triggered()), this, SLOT(sumItems()));
- connect(averageItemsAction, SIGNAL(triggered()), this, SLOT(averageItems()));
-
- setupTableItems();
-
- setCentralWidget(tableWidget);
- setWindowTitle(tr("Table Widget"));
-}
-
-void MainWindow::setupTableItems()
-{
- for (int row = 0; row < tableWidget->rowCount()-1; ++row) {
- for (int column = 0; column < tableWidget->columnCount(); ++column) {
-//! [3]
- newItem = QTableWidgetItem(tr("%s" % pow(row, column+1)))
- tableWidget.setItem(row, column, newItem)
-//! [3]
- }
- }
- for (int column = 0; column < tableWidget->columnCount(); ++column) {
- QTableWidgetItem *newItem = new QTableWidgetItem;
- newItem->setFlags(Qt::ItemIsEnabled);
- tableWidget->setItem(tableWidget->rowCount()-1, column, newItem);
- }
-}
-
-void MainWindow::averageItems()
-{
- QList<QTableWidgetItem *> selected = tableWidget->selectedItems();
- QTableWidgetItem *item;
- int number = 0;
- double total = 0;
-
- foreach (item, selected) {
- bool ok;
- double value = item->text().toDouble(&ok);
-
- if (ok && !item->text().isEmpty()) {
- total += value;
- number++;
- }
- }
- if (number > 0)
- tableWidget->currentItem()->setText(QString::number(total/number));
-}
-
-void MainWindow::sumItems()
-{
-//! [4]
- QList<QTableWidgetItem *> selected = tableWidget->selectedItems();
- QTableWidgetItem *item;
- int number = 0;
- double total = 0;
-
- foreach (item, selected) {
- bool ok;
- double value = item->text().toDouble(&ok);
-
- if (ok && !item->text().isEmpty()) {
- total += value;
- number++;
- }
- }
-//! [4]
- if (number > 0)
- tableWidget->currentItem()->setText(QString::number(total));
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtcast/qtcast.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qtcast/qtcast.cpp
deleted file mode 100644
index 88e97f4a2..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtcast/qtcast.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QLabel>
-#include <QPushButton>
-
-#include "qtcast.h"
-
-MyWidget::MyWidget()
-{
-//! [0]
- QObject *obj = new MyWidget;
-//! [0]
-
-//! [1]
- QWidget *widget = qobject_cast<QWidget *>(obj);
-//! [1]
-
-//! [2]
- MyWidget *myWidget = qobject_cast<MyWidget *>(obj);
-//! [2]
-
-//! [3]
- QLabel *label = qobject_cast<QLabel *>(obj);
-//! [3] //! [4]
- // label is 0
-//! [4]
-
-//! [5]
- if (QLabel *label = qobject_cast<QLabel *>(obj)) {
-//! [5] //! [6]
- label->setText(tr("Ping"));
- } else if (QPushButton *button = qobject_cast<QPushButton *>(obj)) {
- button->setText(tr("Pong!"));
- }
-//! [6]
-}
-
-int main()
-{
- return 0;
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtest-namespace/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qtest-namespace/main.cpp
deleted file mode 100644
index 8661d6ed0..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtest-namespace/main.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QTest>
-
-int main(int argc, char *argv[])
-{
- QTest::qSleep(10);
- return 0;
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtreeview-dnd/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qtreeview-dnd/main.cpp
deleted file mode 100644
index e76756fe8..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtreeview-dnd/main.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- MainWindow *window = new MainWindow;
- window->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtreeview-dnd/mainwindow.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qtreeview-dnd/mainwindow.cpp
deleted file mode 100644
index 929f8ee33..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtreeview-dnd/mainwindow.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-#include "dragdropmodel.h"
-
-MainWindow::MainWindow()
-{
- QMenu *fileMenu = new QMenu(tr("&File"));
-
- QAction *quitAction = fileMenu->addAction(tr("E&xit"));
- quitAction->setShortcut(tr("Ctrl+Q"));
-
- menuBar()->addMenu(fileMenu);
-
-// For convenient quoting:
- QTreeView *treeView = new QTreeView(this);
- treeView->setSelectionMode(QAbstractItemView::ExtendedSelection);
- treeView->setDragEnabled(true);
- treeView->setAcceptDrops(true);
- treeView->setDropIndicatorShown(true);
-
- this->treeView = treeView;
-
- connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));
-
- setupItems();
-
- setCentralWidget(treeView);
- setWindowTitle(tr("Tree View"));
-}
-
-void MainWindow::setupItems()
-{
- QStringList items;
- items << tr("Widgets\tUser interface objects used to create GUI applications.")
- << tr(" QWidget\tThe basic building block for all other widgets.")
- << tr(" QDialog\tThe base class for dialog windows.")
- << tr("Tools\tUtilities and applications for Qt developers.")
- << tr(" Qt Designer\tA GUI form designer for Qt applications.")
- << tr(" Qt Assistant\tA documentation browser for Qt documentation.");
-
- DragDropModel *model = new DragDropModel(items, this);
- QModelIndex index = model->index(0, 0, QModelIndex());
- model->insertRows(2, 3, index);
- index = model->index(0, 0, QModelIndex());
- index = model->index(2, 0, index);
- model->setData(index, QVariant("QFrame"));
- model->removeRows(3, 2, index.parent());
- treeView->setModel(model);
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtreeview-dnd/treeitem.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qtreeview-dnd/treeitem.cpp
deleted file mode 100644
index 63270d248..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtreeview-dnd/treeitem.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*
- treeitem.cpp
-
- A container for items of data supplied by the simple tree model.
-*/
-
-#include <QStringList>
-
-#include "treeitem.h"
-
-TreeItem::TreeItem(const QList<QVariant> &data, TreeItem *parent)
-{
- parentItem = parent;
- itemData = data;
-}
-
-TreeItem::~TreeItem()
-{
- qDeleteAll(childItems);
-}
-
-void TreeItem::appendChild(TreeItem *item)
-{
- childItems.append(item);
-}
-
-TreeItem *TreeItem::child(int row)
-{
- return childItems.value(row);
-}
-
-int TreeItem::childCount() const
-{
- return childItems.count();
-}
-
-int TreeItem::columnCount() const
-{
- return itemData.count();
-}
-
-QVariant TreeItem::data(int column) const
-{
- return itemData.value(column);
-}
-
-bool TreeItem::insertChild(int row, TreeItem *item)
-{
- if (row < 0 || row > childItems.count())
- return false;
-
- childItems.insert(row, item);
- return true;
-}
-
-TreeItem *TreeItem::parent()
-{
- return parentItem;
-}
-
-bool TreeItem::removeChild(int row)
-{
- if (row < 0 || row >= childItems.count())
- return false;
-
- delete childItems.takeAt(row);
- return true;
-}
-
-int TreeItem::row() const
-{
- if (parentItem)
- return parentItem->childItems.indexOf(const_cast<TreeItem*>(this));
-
- return 0;
-}
-
-bool TreeItem::setData(int column, const QVariant &data)
-{
- if (column < 0 || column >= itemData.count())
- return false;
-
- itemData.replace(column, data);
- return true;
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtreeview-dnd/treemodel.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qtreeview-dnd/treemodel.cpp
deleted file mode 100644
index 731a77889..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtreeview-dnd/treemodel.cpp
+++ /dev/null
@@ -1,272 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*
- treemodel.cpp
-
- Provides a simple tree model to show how to create and use hierarchical
- models.
-*/
-
-#include <QtWidgets>
-
-#include "treeitem.h"
-#include "treemodel.h"
-
-TreeModel::TreeModel(const QStringList &strings, QObject *parent)
- : QAbstractItemModel(parent)
-{
- QList<QVariant> rootData;
- rootData << "Title" << "Summary";
- rootItem = new TreeItem(rootData);
- setupModelData(strings, rootItem);
-}
-
-TreeModel::~TreeModel()
-{
- delete rootItem;
-}
-
-int TreeModel::columnCount(const QModelIndex &parent) const
-{
- if (parent.isValid())
- return static_cast<TreeItem*>(parent.internalPointer())->columnCount();
- else
- return rootItem->columnCount();
-}
-
-QVariant TreeModel::data(const QModelIndex &index, int role) const
-{
- if (!index.isValid())
- return QVariant();
-
- if (role != Qt::DisplayRole)
- return QVariant();
-
- TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
-
- return item->data(index.column());
-}
-
-Qt::ItemFlags TreeModel::flags(const QModelIndex &index) const
-{
- if (!index.isValid())
- return Qt::ItemIsEnabled;
-
- return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
-}
-
-QVariant TreeModel::headerData(int section, Qt::Orientation orientation,
- int role) const
-{
- if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
- return rootItem->data(section);
-
- return QVariant();
-}
-
-QModelIndex TreeModel::index(int row, int column, const QModelIndex &parent)
- const
-{
- TreeItem *parentItem;
-
- if (!parent.isValid())
- parentItem = rootItem;
- else
- parentItem = static_cast<TreeItem*>(parent.internalPointer());
-
- TreeItem *childItem = parentItem->child(row);
- if (childItem)
- return createIndex(row, column, childItem);
- else
- return QModelIndex();
-}
-
-bool TreeModel::insertRows(int position, int rows, const QModelIndex &parent)
-{
- TreeItem *parentItem;
-
- if (!parent.isValid())
- parentItem = rootItem;
- else
- parentItem = static_cast<TreeItem*>(parent.internalPointer());
-
- if (position < 0 || position > parentItem->childCount())
- return false;
-
- QList<QVariant> blankList;
- for (int column = 0; column < columnCount(); ++column)
- blankList << QVariant("");
-
- beginInsertRows(parent, position, position + rows - 1);
-
- for (int row = 0; row < rows; ++row) {
- TreeItem *newItem = new TreeItem(blankList, parentItem);
- if (!parentItem->insertChild(position, newItem))
- break;
- }
-
- endInsertRows();
- return true;
-}
-
-QModelIndex TreeModel::parent(const QModelIndex &index) const
-{
- if (!index.isValid())
- return QModelIndex();
-
- TreeItem *childItem = static_cast<TreeItem*>(index.internalPointer());
- TreeItem *parentItem = childItem->parent();
-
- if (parentItem == rootItem)
- return QModelIndex();
-
- return createIndex(parentItem->row(), 0, parentItem);
-}
-
-bool TreeModel::removeRows(int position, int rows, const QModelIndex &parent)
-{
- TreeItem *parentItem;
-
- if (!parent.isValid())
- parentItem = rootItem;
- else
- parentItem = static_cast<TreeItem*>(parent.internalPointer());
-
- if (position < 0 || position > parentItem->childCount())
- return false;
-
- beginRemoveRows(parent, position, position + rows - 1);
-
- for (int row = 0; row < rows; ++row) {
- if (!parentItem->removeChild(position))
- break;
- }
-
- endRemoveRows();
- return true;
-}
-
-int TreeModel::rowCount(const QModelIndex &parent) const
-{
- TreeItem *parentItem;
-
- if (!parent.isValid())
- parentItem = rootItem;
- else
- parentItem = static_cast<TreeItem*>(parent.internalPointer());
-
- return parentItem->childCount();
-}
-
-bool TreeModel::setData(const QModelIndex &index,
- const QVariant &value, int role)
-{
- if (!index.isValid() || role != Qt::EditRole)
- return false;
-
- TreeItem *item = static_cast<TreeItem*>(index.internalPointer());
-
- if (item->setData(index.column(), value))
- emit dataChanged(index, index);
- else
- return false;
-
- return true;
-}
-
-void TreeModel::setupModelData(const QStringList &lines, TreeItem *parent)
-{
- QList<TreeItem*> parents;
- QList<int> indentations;
- parents << parent;
- indentations << 0;
-
- int number = 0;
-
- while (number < lines.count()) {
- int position = 0;
- while (position < lines[number].length()) {
- if (lines[number].mid(position, 1) != " ")
- break;
- position++;
- }
-
- QString lineData = lines[number].mid(position).trimmed();
-
- if (!lineData.isEmpty()) {
- // Read the column data from the rest of the line.
- QStringList columnStrings = lineData.split("\t", QString::SkipEmptyParts);
- QList<QVariant> columnData;
- for (int column = 0; column < columnStrings.count(); ++column)
- columnData << columnStrings[column];
-
- if (position > indentations.last()) {
- // The last child of the current parent is now the new parent
- // unless the current parent has no children.
-
- if (parents.last()->childCount() > 0) {
- parents << parents.last()->child(parents.last()->childCount()-1);
- indentations << position;
- }
- } else {
- while (position < indentations.last() && parents.count() > 0) {
- parents.pop_back();
- indentations.pop_back();
- }
- }
-
- // Append a new item to the current parent's list of children.
- parents.last()->appendChild(new TreeItem(columnData, parents.last()));
- }
-
- number++;
- }
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtreewidget-using/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qtreewidget-using/main.cpp
deleted file mode 100644
index e76756fe8..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtreewidget-using/main.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- MainWindow *window = new MainWindow;
- window->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtreewidgetitemiterator-using/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qtreewidgetitemiterator-using/main.cpp
deleted file mode 100644
index e76756fe8..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtreewidgetitemiterator-using/main.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- MainWindow *window = new MainWindow;
- window->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtscript/evaluation/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qtscript/evaluation/main.cpp
deleted file mode 100644
index d7fcc83ab..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtscript/evaluation/main.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtScript>
-
-int main(int argc, char *argv[])
-{
-//! [0]
- QScriptEngine engine;
- qDebug() << "the magic number is:" << engine.evaluate("1 + 2").toNumber();
-//! [0]
- return 0;
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtscript/registeringobjects/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qtscript/registeringobjects/main.cpp
deleted file mode 100644
index afd3da83f..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtscript/registeringobjects/main.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QObject>
-#include <QtScript>
-#include "myobject.h"
-
-int main(int argc, char *argv[])
-{
-//! [0]
- QScriptEngine engine;
- QObject *someObject = new MyObject;
- QScriptValue objectValue = engine.newQObject(someObject);
- engine.globalObject().setProperty("myObject", objectValue);
-//! [0]
- qDebug() << "myObject's calculate() function returns"
- << engine.evaluate("myObject.calculate(10)").toNumber();
- return 0;
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtscript/registeringobjects/myobject.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qtscript/registeringobjects/myobject.cpp
deleted file mode 100644
index f6a795e66..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtscript/registeringobjects/myobject.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "myobject.h"
-
-MyObject::MyObject()
-{
-}
-
-int MyObject::calculate(int value) const
-{
- int total = 0;
- for (int i = 0; i <= value; ++i)
- total += i;
- return total;
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtscript/registeringvalues/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qtscript/registeringvalues/main.cpp
deleted file mode 100644
index 871216489..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtscript/registeringvalues/main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtScript>
-
-int main(int argc, char *argv[])
-{
- QScriptEngine engine;
-//! [0]
- engine.globalObject().setProperty("foo", 123);
- qDebug() << "foo times two is:" << engine.evaluate("foo * 2").toNumber();
-//! [0]
- return 0;
-}
-
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtscript/scriptedslot/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qtscript/scriptedslot/main.cpp
deleted file mode 100644
index 4f1e57863..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qtscript/scriptedslot/main.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QTextEdit>
-#include <QTimer>
-#include <QtScript>
-#include "myobject.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- QScriptEngine engine;
- QFile scriptFile(":/object.js");
- scriptFile.open(QFile::ReadOnly);
- engine.evaluate(scriptFile.readAll());
- scriptFile.close();
-
- QTextEdit editor;
- QTimer timer;
- QScriptValue constructor = engine.evaluate("Object");
- QScriptValueList arguments;
- arguments << engine.newQObject(&timer);
- arguments << engine.newQObject(&editor);
- QScriptValue object = constructor.construct(arguments);
- if (engine.hasUncaughtException()) {
- qDebug() << engine.uncaughtException().toString();
- }
-
- editor.show();
- timer.start(1000);
-
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/quiloader/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/quiloader/main.cpp
deleted file mode 100644
index 53684a444..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/quiloader/main.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-#include <QtUiTools>
-
-#include "mywidget.h"
-
-//! [0]
-def loadCustomWidget(parent):
- loader = QUiLoader()
-
- availableWidgets = loader.availableWidgets()
-
- if availableWidgets.contains("AnalogClock"):
- myWidget = loader.createWidget("AnalogClock", parent)
-
- return myWidget
-//! [0]
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- MyWidget widget;
- widget.show();
-
- QWidget *customWidget = loadCustomWidget(0);
- customWidget->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/quiloader/mywidget.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/quiloader/mywidget.cpp
deleted file mode 100644
index 351678ad9..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/quiloader/mywidget.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-#include <QtUiTools>
-
-#include "mywidget.h"
-
-//! [0]
-class MyWidget(QWidget):
- def __init__(self, parent):
- super(QWidget, self).__init__(parent)
- loader = QUiLoader()
- file = QFile(":/forms/myform.ui")
- file.open(QFile.ReadOnly)
- myWidget = loader.load(file, self)
- file.close()
-
- layout = QVBoxLayout()
- layout.addWidget(myWidget)
- self.setLayout(layout)
-//! [0]
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qx11embedcontainer/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qx11embedcontainer/main.cpp
deleted file mode 100644
index c23e2e89d..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qx11embedcontainer/main.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-#include <QX11EmbedContainer>
-
-//! [0]
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- if (app.arguments().count() != 2) {
- qFatal("Error - expected executable path as argument");
- return 1;
- }
-
- QX11EmbedContainer container;
- container.show();
-
- QProcess process(&container);
- QString executable(app.arguments()[1]);
- QStringList arguments;
- arguments << QString::number(container.winId());
- process.start(executable, arguments);
-
- int status = app.exec();
- process.close();
- return status;
-}
-//! [0]
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qx11embedwidget/embedwidget.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qx11embedwidget/embedwidget.cpp
deleted file mode 100644
index cd1fbe713..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qx11embedwidget/embedwidget.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "embedwidget.h"
-
-EmbedWidget::EmbedWidget(QWidget *parent)
- : QX11EmbedWidget(parent)
-{
- gradient = QRadialGradient(100, 100, 90, 60, 60);
- gradient.setColorAt(0.0, Qt::white);
- gradient.setColorAt(0.9, QColor(192, 192, 255));
- gradient.setColorAt(1.0, QColor(0, 32, 64));
-}
-
-QSize EmbedWidget::sizeHint() const
-{
- return QSize(200, 200);
-}
-
-void EmbedWidget::paintEvent(QPaintEvent *event)
-{
- QPainter painter;
- painter.begin(this);
- painter.setRenderHint(QPainter::Antialiasing);
- painter.fillRect(event->rect(), QBrush(gradient));
- painter.end();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qx11embedwidget/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qx11embedwidget/main.cpp
deleted file mode 100644
index c6f6443cb..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qx11embedwidget/main.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include "embedwidget.h"
-
-//! [0]
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- if (app.arguments().count() != 2) {
- qFatal("Error - expected window id as argument");
- return 1;
- }
-
- QString windowId(app.arguments()[1]);
- EmbedWidget window;
- window.embedInto(windowId.toULong());
- window.show();
-
- return app.exec();
-}
-//! [0]
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qxmlschema/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qxmlschema/main.cpp
deleted file mode 100644
index 70014457c..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qxmlschema/main.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore>
-#include <QtXmlPatterns>
-
-class Schema
-{
- public:
- void loadFromUrl() const;
- void loadFromFile() const;
- void loadFromData() const;
-};
-
-void Schema::loadFromUrl() const
-{
-//! [0]
- url = QUrl("http://www.schema-example.org/myschema.xsd")
-
- schema = QXmlSchema()
- if schema.load(url):
- qDebug("schema is valid")
- else:
- qDebug("schema is invalid")
-//! [0]
-}
-
-void Schema::loadFromFile() const
-{
-//! [1]
- file = QFile("myschema.xsd")
- file.open(QIODevice.ReadOnly)
-
- schema = QXmlSchema()
- schema.load(file, QUrl.fromLocalFile(file.fileName()))
-
- if schema.isValid():
- qDebug("schema is valid")
- else:
- qDebug("schema is invalid")
-//! [1]
-}
-
-void Schema::loadFromData() const
-{
-//! [2]
- data = QByteArray("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
- + "<xsd:schema"
- + " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""
- + " xmlns=\"http://qt.nokia.com/xmlschematest\""
- + " targetNamespace=\"http://qt.nokia.com/xmlschematest\""
- + " version=\"1.0\""
- + " elementFormDefault=\"qualified\">"
- + "</xsd:schema>" )
-
- schema = QXmlSchema()
- schema.load(data)
-
- if schema.isValid():
- qDebug("schema is valid")
- else:
- qDebug("schema is invalid")
-//! [2]
-}
-
-int main(int argc, char **argv)
-{
- QCoreApplication app(argc, argv);
-
- Schema schema;
-
- schema.loadFromUrl();
- schema.loadFromFile();
- schema.loadFromData();
-
- return 0;
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/qxmlstreamwriter/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/qxmlstreamwriter/main.cpp
deleted file mode 100644
index 3649f0fa7..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/qxmlstreamwriter/main.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QCoreApplication>
-#include <QFile>
-#include <QXmlStreamWriter>
-#include <stdio.h>
-
-int main(int argc, char *argv[])
-{
- QCoreApplication app(argc, argv);
- QFile output;
- output.open(stdout, QIODevice::WriteOnly);
-//! [write output]
-//! [start stream]
- QXmlStreamWriter stream(&output);
- stream.setAutoFormatting(true);
- stream.writeStartDocument();
-//! [start stream]
- stream.writeDTD("<!DOCTYPE xbel>");
- stream.writeStartElement("xbel");
- stream.writeAttribute("version", "1.0");
- stream.writeStartElement("folder");
- stream.writeAttribute("folded", "no");
-//! [write element]
- stream.writeStartElement("bookmark");
- stream.writeAttribute("href", "http://qt-project.org/");
- stream.writeTextElement("title", "Qt Home");
- stream.writeEndElement(); // bookmark
-//! [write element]
- stream.writeEndElement(); // folder
- stream.writeEndElement(); // xbel
-//! [finish stream]
- stream.writeEndDocument();
-//! [finish stream]
-//! [write output]
- output.close();
- return 0;
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/reading-selections/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/reading-selections/main.cpp
deleted file mode 100644
index 3ae4962ad..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/reading-selections/main.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*
- main.cpp
-
- A simple example that shows how selections can be used directly on a model.
- It shows the result of some selections made using a table view.
-*/
-
-#include <QApplication>
-
-#include "window.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- QMainWindow *window = new MainWindow;
- window->show();
- window->resize(640, 480);
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/reading-selections/window.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/reading-selections/window.cpp
deleted file mode 100644
index 269a18da8..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/reading-selections/window.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*
- window.cpp
-
- A minimal subclass of QTableView with slots to allow the selection model
- to be monitored.
-*/
-
-#include <QAbstractItemModel>
-#include <QItemSelection>
-#include <QItemSelectionModel>
-#include <QMenu>
-#include <QMenuBar>
-#include <QStatusBar>
-
-#include "model.h"
-#include "window.h"
-
-MainWindow::MainWindow(QWidget *parent)
- : QMainWindow(parent)
-{
- setWindowTitle("Selected Items in a Table Model");
-
- model = new TableModel(8, 4, this);
-
- table = new QTableView(this);
- table->setModel(model);
-
- QMenu *actionMenu = new QMenu(tr("&Actions"), this);
- QAction *fillAction = actionMenu->addAction(tr("&Fill Selection"));
- QAction *clearAction = actionMenu->addAction(tr("&Clear Selection"));
- QAction *selectAllAction = actionMenu->addAction(tr("&Select All"));
- menuBar()->addMenu(actionMenu);
-
- connect(fillAction, SIGNAL(triggered()), this, SLOT(fillSelection()));
- connect(clearAction, SIGNAL(triggered()), this, SLOT(clearSelection()));
- connect(selectAllAction, SIGNAL(triggered()), this, SLOT(selectAll()));
-
- selectionModel = table->selectionModel();
-
- statusBar();
- setCentralWidget(table);
-}
-
-void MainWindow::fillSelection()
-{
-//! [0]
- QModelIndexList indexes = selectionModel->selectedIndexes();
- QModelIndex index;
-
- foreach(index, indexes) {
- QString text = QString("(%1,%2)").arg(index.row()).arg(index.column());
- model->setData(index, text);
- }
-//! [0]
-}
-
-void MainWindow::clearSelection()
-{
- QModelIndexList indexes = selectionModel->selectedIndexes();
- QModelIndex index;
-
- foreach(index, indexes)
- model->setData(index, "");
-}
-
-void MainWindow::selectAll()
-{
-//! [1]
- QModelIndex parent = QModelIndex();
-//! [1] //! [2]
- QModelIndex topLeft = model->index(0, 0, parent);
- QModelIndex bottomRight = model->index(model->rowCount(parent)-1,
- model->columnCount(parent)-1, parent);
-//! [2]
-
-//! [3]
- QItemSelection selection(topLeft, bottomRight);
- selectionModel->select(selection, QItemSelectionModel::Select);
-//! [3]
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/scribe-overview/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/scribe-overview/main.cpp
deleted file mode 100644
index 5f94ded20..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/scribe-overview/main.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-from PySide2.QtGui import *
-
-# edit : QTextEdit
-def mergeFormat(edit):
-//! [0]
- document = edit.document()
- cursor = QTextCursor(document)
-
- cursor.movePosition(QTextCursor.Start)
- cursor.movePosition(QTextCursor.EndOfLine, QTextCursor.KeepAnchor)
-
- format = QTextCharFormat()
- format.setFontWeight(QFont.Bold)
-
- cursor.mergeCharFormat(format)
-//! [0]
-
-def main():
- aStringContainingHTMLtext QString("<h1>Scribe Overview</h1>")
-
- app = QApplication(sys.argv)
-
-//! [1]
- editor = QTextEdit(None)
- editor.setHtml(aStringContainingHTMLtext)
- editor.show()
-//! [1]
-
- return app.exec_()
-
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/scriptdebugger.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/scriptdebugger.cpp
deleted file mode 100644
index 83b5fb2a5..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/scriptdebugger.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-#include <QtScript>
-#include <QtScriptTools>
-
-// Perhaps shpw entire example for getting debugger up with script
-int main(int argv, char **args)
-{
- QApplication app(argv, args);
-
- QString fileName("helloscript.qs");
- QFile scriptFile(fileName);
- scriptFile.open(QIODevice::ReadOnly);
- QTextStream stream(&scriptFile);
- QString contents = stream.readAll();
- scriptFile.close();
-
- QScriptEngine *engine = new QScriptEngine();
-
- QScriptEngineDebugger *debugger = new QScriptEngineDebugger();
- debugger->attachTo(engine);
-
- // Set up configuration with only stack and code
- QWidget *widget = new QWidget;
-//![0]
- codeWindow = debugger.widget(QScriptEngineDebugger.CodeWidget)
- stackWidget = debugger.widget(QScriptEngineDebugger.StackWidget)
-
- layout = QHBoxLayout()
- layout.addWidget(codeWindow)
- layout.addWidget(stackWidget)
-//![0]
-
-//![1]
- continueAction = debugger.action(QScriptEngineDebugger.ContinueAction)
- stepOverAction = debugger.action(QScriptEngineDebugger.StepOverAction)
- stepIntoAction = debugger.action(QScriptEngineDebugger.StepIntoAction)
-
- toolBar = QToolBar()
- toolBar.addAction(continueAction)
-//![1]
- toolBar->addAction(stepOverAction);
- toolBar->addAction(stepIntoAction);
-
- layout->addWidget(toolBar);
- continueAction->setIcon(QIcon("copy.png"));
-
- debugger->setAutoShowStandardWindow(false);
-
- widget->setLayout(layout);
- widget->show();
-
- QPushButton button;
- QScriptValue scriptButton = engine->newQObject(&button);
- engine->globalObject().setProperty("button", scriptButton);
-
-//![2]
- debugger.action(QScriptEngineDebugger.InterruptAction).trigger()
- engine.evaluate(contents, fileName)
-//![2]
-
- return app.exec();
-}
-
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/separations/finalwidget.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/separations/finalwidget.cpp
deleted file mode 100644
index d9b5a78e1..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/separations/finalwidget.cpp
+++ /dev/null
@@ -1,136 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*
-finalwidget.cpp
-
-A widget to display an image and a label containing a description.
-*/
-
-#include <QtWidgets>
-#include "finalwidget.h"
-
-FinalWidget::FinalWidget(QWidget *parent, const QString &name,
- const QSize &labelSize)
- : QFrame(parent)
-{
- hasImage = false;
- imageLabel = new QLabel;
- imageLabel->setFrameShadow(QFrame::Sunken);
- imageLabel->setFrameShape(QFrame::StyledPanel);
- imageLabel->setMinimumSize(labelSize);
- nameLabel = new QLabel(name);
-
- QVBoxLayout *layout = new QVBoxLayout;
- layout->addWidget(imageLabel, 1);
- layout->addWidget(nameLabel, 0);
- setLayout(layout);
-}
-
-/*!
- If the mouse moves far enough when the left mouse button is held down,
- start a drag and drop operation.
-*/
-
-void FinalWidget::mouseMoveEvent(QMouseEvent *event)
-{
- if (!(event->buttons() & Qt::LeftButton))
- return;
- if ((event->pos() - dragStartPosition).manhattanLength()
- < QApplication::startDragDistance())
- return;
- if (!hasImage)
- return;
-
- QDrag *drag = new QDrag(this);
- QMimeData *mimeData = new QMimeData;
-
-//! [0]
- output = QByteArray()
- outputBuffer = QBuffer(output)
- outputBuffer.open(QIODevice.WriteOnly)
- imageLabel.pixmap().toImage().save(outputBuffer, "PNG")
- mimeData.setData("image/png", output)
-//! [0]
-/*
-//! [1]
- mimeData.setImageData(QVariant(imageLabel.pixmap()))
-//! [1]
-*/
- drag.setMimeData(mimeData)
- drag.setPixmap(imageLabel.pixmap().scaled(64, 64, Qt.KeepAspectRatio))
-//! [2]
- drag.setHotSpot(QPoint(drag.pixmap().width()/2,
- drag.pixmap().height()))
-//! [2]
-
- drag->start();
-}
-
-/*!
- Check for left mouse button presses in order to enable drag and drop.
-*/
-
-void FinalWidget::mousePressEvent(QMouseEvent *event)
-{
- if (event->button() == Qt::LeftButton)
- dragStartPosition = event->pos();
-}
-
-const QPixmap* FinalWidget::pixmap() const
-{
- return imageLabel->pixmap();
-}
-
-void FinalWidget::setPixmap(const QPixmap &pixmap)
-{
- imageLabel->setPixmap(pixmap);
- hasImage = true;
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/separations/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/separations/main.cpp
deleted file mode 100644
index f2ea7f2cf..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/separations/main.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include "viewer.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- Viewer viewer;
- viewer.show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/separations/screenwidget.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/separations/screenwidget.cpp
deleted file mode 100644
index 5f0bd6f4d..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/separations/screenwidget.cpp
+++ /dev/null
@@ -1,227 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*
-screenwidget.cpp
-
-A widget to display colour components from an image using independently
-selected colors. Controls are provided to allow the image to be inverted, and
-the color to be selection via a standard dialog. The image is displayed in a
-label widget.
-*/
-
-#include <QApplication>
-#include <QColorDialog>
-#include <QGridLayout>
-#include <QImage>
-#include <QLabel>
-#include <QMenu>
-#include <QMimeData>
-#include <QMouseEvent>
-#include <QPixmap>
-#include <QPushButton>
-#include <QWidget>
-
-#include "screenwidget.h"
-
-/*!
-Initializes the paint color, the mask color (cyan, magenta,
-or yellow), connects the color selector and invert checkbox to functions,
-and creates a two-by-two grid layout.
-*/
-
-ScreenWidget::ScreenWidget(QWidget *parent, QColor initialColor,
- const QString &name, Separation mask,
- const QSize &labelSize)
- : QFrame(parent)
-{
- paintColor = initialColor;
- maskColor = mask;
- inverted = false;
-
- imageLabel = new QLabel;
- imageLabel->setFrameShadow(QFrame::Sunken);
- imageLabel->setFrameShape(QFrame::StyledPanel);
- imageLabel->setMinimumSize(labelSize);
-
- nameLabel = new QLabel(name);
- colorButton = new QPushButton(tr("Modify..."));
- colorButton->setBackgroundRole(QPalette::Button);
- colorButton->setMinimumSize(32, 32);
-
- QPalette palette(colorButton->palette());
- palette.setColor(QPalette::Button, initialColor);
- colorButton->setPalette(palette);
-
- invertButton = new QPushButton(tr("Invert"));
- //invertButton->setToggleButton(true);
- //invertButton->setOn(inverted);
- invertButton->setEnabled(false);
-
- connect(colorButton, SIGNAL(clicked()), this, SLOT(setColor()));
- connect(invertButton, SIGNAL(clicked()), this, SLOT(invertImage()));
-
- QGridLayout *gridLayout = new QGridLayout;
- gridLayout->addWidget(imageLabel, 0, 0, 1, 2);
- gridLayout->addWidget(nameLabel, 1, 0);
- gridLayout->addWidget(colorButton, 1, 1);
- gridLayout->addWidget(invertButton, 2, 1, 1, 1);
- setLayout(gridLayout);
-}
-
-/*!
- Creates a new image by separating out the cyan, magenta, or yellow
- component, depending on the mask color specified in the constructor.
-
- The amount of the component found in each pixel of the image is used
- to determine how much of a user-selected ink is used for each pixel
- in the new image for the label widget.
-*/
-
-void ScreenWidget::createImage()
-{
- newImage = originalImage.copy();
-
- // Create CMY components for the ink being used.
- float cyanInk = (255 - paintColor.red())/255.0;
- float magentaInk = (255 - paintColor.green())/255.0;
- float yellowInk = (255 - paintColor.blue())/255.0;
-
- int (*convert)(QRgb);
-
- switch (maskColor) {
- case Cyan:
- convert = qRed;
- break;
- case Magenta:
- convert = qGreen;
- break;
- case Yellow:
- convert = qBlue;
- break;
- }
-
- for (int y = 0; y < newImage.height(); ++y) {
- for (int x = 0; x < newImage.width(); ++x) {
- QRgb p(originalImage.pixel(x, y));
-
- // Separate the source pixel into its cyan component.
- int amount;
-
- if (inverted)
- amount = convert(p);
- else
- amount = 255 - convert(p);
-
- QColor newColor(
- 255 - qMin(int(amount * cyanInk), 255),
- 255 - qMin(int(amount * magentaInk), 255),
- 255 - qMin(int(amount * yellowInk), 255));
-
- newImage.setPixel(x, y, newColor.rgb());
- }
- }
-
- imageLabel->setPixmap(QPixmap::fromImage(newImage));
-}
-
-/*!
- Returns a pointer to the modified image.
-*/
-
-QImage* ScreenWidget::image()
-{
- return &newImage;
-}
-
-/*!
- Sets whether the amount of ink applied to the canvas is to be inverted
- (subtracted from the maximum value) before the ink is applied.
-*/
-
-void ScreenWidget::invertImage()
-{
- //inverted = invertButton->isOn();
- inverted = !inverted;
- createImage();
- emit imageChanged();
-}
-
-/*!
- Separate the current image into cyan, magenta, and yellow components.
- Create a representation of how each component might appear when applied
- to a blank white piece of paper.
-*/
-
-void ScreenWidget::setColor()
-{
- QColor newColor = QColorDialog::getColor(paintColor);
-
- if (newColor.isValid()) {
- paintColor = newColor;
- QPalette palette(colorButton->palette());
- palette.setColor(QPalette::Button, paintColor);
- colorButton->setPalette(palette);
- createImage();
- emit imageChanged();
- }
-}
-
-/*!
- Records the original image selected by the user, creates a color
- separation, and enables the invert image checkbox.
-*/
-
-void ScreenWidget::setImage(QImage &image)
-{
- originalImage = image;
- createImage();
- invertButton->setEnabled(true);
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/separations/viewer.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/separations/viewer.cpp
deleted file mode 100644
index 008279c1a..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/separations/viewer.cpp
+++ /dev/null
@@ -1,338 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*
-viewer.cpp
-
-Provides a main window for displaying a user-specified original image
-with three color separations in a grid layout.
-
-A main menu provides entries for selecting files, and adjusting the
-brightness of the separations.
-*/
-
-#include <QtWidgets>
-
-#include "finalwidget.h"
-#include "screenwidget.h"
-#include "viewer.h"
-
-/*
- Constructor: initializes a default value for the brightness, creates
- the main menu entries, and constructs a central widget that contains
- enough space for images to be displayed.
-*/
-
-Viewer::Viewer()
-{
- setWindowTitle(tr("QImage Color Separations"));
-
- brightness = 255;
-
- createMenus();
- setCentralWidget(createCentralWidget());
-}
-
-/*
- Creates a main menu with two entries: a File menu, to allow the image
- to be selected, and a Brightness menu to allow the brightness of the
- separations to be changed.
-
- Initially, the Brightness menu items are disabled, but the first entry in
- the menu is checked to reflect the default brightness.
-*/
-
-void Viewer::createMenus()
-{
- fileMenu = new QMenu(tr("&File"), this);
- brightnessMenu = new QMenu(tr("&Brightness"), this);
-
- QAction *openAction = fileMenu->addAction(tr("&Open..."));
- openAction->setShortcut(QKeySequence("Ctrl+O"));
- saveAction = fileMenu->addAction(tr("&Save..."));
- saveAction->setShortcut(QKeySequence("Ctrl+S"));
- saveAction->setEnabled(false);
- QAction *quitAction = fileMenu->addAction(tr("E&xit"));
- quitAction->setShortcut(QKeySequence("Ctrl+Q"));
-
- QAction *noBrightness = brightnessMenu->addAction(tr("&0%"));
- noBrightness->setCheckable(true);
- QAction *quarterBrightness = brightnessMenu->addAction(tr("&25%"));
- quarterBrightness->setCheckable(true);
- QAction *halfBrightness = brightnessMenu->addAction(tr("&50%"));
- halfBrightness->setCheckable(true);
- QAction *threeQuartersBrightness = brightnessMenu->addAction(tr("&75%"));
- threeQuartersBrightness->setCheckable(true);
- QAction *fullBrightness = brightnessMenu->addAction(tr("&100%"));
- fullBrightness->setCheckable(true);
-
- menuMap[noBrightness] = None;
- menuMap[quarterBrightness] = Quarter;
- menuMap[halfBrightness] = Half;
- menuMap[threeQuartersBrightness] = ThreeQuarters;
- menuMap[fullBrightness] = Full;
-
- currentBrightness = fullBrightness;
- currentBrightness->setChecked(true);
- brightnessMenu->setEnabled(false);
-
- menuBar()->addMenu(fileMenu);
- menuBar()->addMenu(brightnessMenu);
-
- connect(openAction, SIGNAL(triggered()), this, SLOT(chooseFile()));
- connect(saveAction, SIGNAL(triggered()), this, SLOT(saveImage()));
- connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
- connect(brightnessMenu, SIGNAL(triggered(QAction *)), this,
- SLOT(setBrightness(QAction *)));
-}
-
-/*
- Constructs a central widget for the window consisting of a two-by-two
- grid of labels, each of which will contain an image. We restrict the
- size of the labels to 256 pixels, and ensure that the window cannot
- be resized.
-*/
-
-QFrame* Viewer::createCentralWidget()
-{
- QFrame* frame = new QFrame(this);
- grid = new QGridLayout(frame);
- grid->setSpacing(8);
- grid->setMargin(4);
-
- layout()->setSizeConstraint(QLayout::SetFixedSize);
-
- QSize labelSize(256, 256);
-
- finalWidget = new FinalWidget(frame, tr("Final image"), labelSize);
-
- cyanWidget = new ScreenWidget(frame, Qt::cyan, tr("Cyan"),
- ScreenWidget::Cyan, labelSize);
- magentaWidget = new ScreenWidget(frame, Qt::magenta, tr("Magenta"),
- ScreenWidget::Magenta, labelSize);
- yellowWidget = new ScreenWidget(frame, Qt::yellow, tr("Yellow"),
- ScreenWidget::Yellow, labelSize);
-
- connect(cyanWidget, SIGNAL(imageChanged()), this, SLOT(createImage()));
- connect(magentaWidget, SIGNAL(imageChanged()), this, SLOT(createImage()));
- connect(yellowWidget, SIGNAL(imageChanged()), this, SLOT(createImage()));
-
- grid->addWidget(finalWidget, 0, 0, Qt::AlignTop | Qt::AlignHCenter);
- grid->addWidget(cyanWidget, 0, 1, Qt::AlignTop | Qt::AlignHCenter);
- grid->addWidget(magentaWidget, 1, 0, Qt::AlignTop | Qt::AlignHCenter);
- grid->addWidget(yellowWidget, 1, 1, Qt::AlignTop | Qt::AlignHCenter);
-
- return frame;
-}
-
-/*
- Provides a dialog window to allow the user to specify an image file.
- If a file is selected, the appropriate function is called to process
- and display it.
-*/
-
-void Viewer::chooseFile()
-{
- QString imageFile = QFileDialog::getOpenFileName(this,
- tr("Choose an image file to open"), path, tr("Images (*.*)"));
-
- if (!imageFile.isEmpty()) {
- openImageFile(imageFile);
- path = imageFile;
- }
-}
-
-/*
- Changes the value of the brightness according to the entry selected in the
- Brightness menu. The selected entry is checked, and the previously selected
- entry is unchecked.
-
- The color separations are updated to use the new value for the brightness.
-*/
-
-void Viewer::setBrightness(QAction *action)
-{
- if (!menuMap.contains(action) || scaledImage.isNull())
- return;
-
- Brightness amount = menuMap[action];
-
- switch (amount) {
- case None:
- brightness = 0; break;
- case Quarter:
- brightness = 64; break;
- case Half:
- brightness = 128; break;
- case ThreeQuarters:
- brightness = 191; break;
- case Full:
- brightness = 255; break;
- default: return;
- }
-
- currentBrightness->setChecked(false);
- currentBrightness = action;
- currentBrightness->setChecked(true);
-
- createImage();
-}
-
-/*
- Load the image from the file given, and create four pixmaps based
- on the original image.
-
- The window caption is set, and the Brightness menu enabled if the image file
- can be loaded.
-*/
-
-void Viewer::openImageFile(QString &imageFile)
-{
- QImage originalImage;
-
- if (originalImage.load(imageFile)) {
- setWindowTitle(imageFile);
- //menuBar()->setItemEnabled(brightnessMenuId, true);
- saveAction->setEnabled(true);
- brightnessMenu->setEnabled(true);
-
- /* Note: the ScaleMin value may be different for Qt 4. */
- scaledImage = originalImage.scaled(256, 256, Qt::KeepAspectRatio);
-
- cyanWidget->setImage(scaledImage);
- magentaWidget->setImage(scaledImage);
- yellowWidget->setImage(scaledImage);
- createImage();
- }
- else
- (void) QMessageBox::warning(this, tr("Cannot open file"),
- tr("The selected file could not be opened."),
- QMessageBox::Cancel, QMessageBox::NoButton, QMessageBox::NoButton);
-}
-
-/*
- Creates an image by combining the contents of the three screens
- to present a page preview.
-
- The image associated with each screen is separated into cyan,
- magenta, and yellow components. We add up the values for each
- component from the three screen images, and subtract the totals
- from the maximum value for each corresponding primary color.
-*/
-
-void Viewer::createImage()
-{
- QImage newImage = scaledImage.copy();
-
- QImage *image1 = cyanWidget->image();
- QImage *image2 = magentaWidget->image();
- QImage *image3 = yellowWidget->image();
- int darkness = 255 - brightness;
-
- for (int y = 0; y < newImage.height(); ++y) {
- for (int x = 0; x < newImage.width(); ++x) {
-
- // Create three screens, using the quantities of the source
- // CMY components to determine how much of each of the
- // inks are to be put on each screen.
- QRgb p1(image1->pixel(x, y));
- float cyan1 = 255 - qRed(p1);
- float magenta1 = 255 - qGreen(p1);
- float yellow1 = 255 - qBlue(p1);
-
- QRgb p2(image2->pixel(x, y));
- float cyan2 = 255 - qRed(p2);
- float magenta2 = 255 - qGreen(p2);
- float yellow2 = 255 - qBlue(p2);
-
- QRgb p3(image3->pixel(x, y));
- float cyan3 = 255 - qRed(p3);
- float magenta3 = 255 - qGreen(p3);
- float yellow3 = 255 - qBlue(p3);
-
- QColor newColor(
- qMax(255 - int(cyan1+cyan2+cyan3) - darkness, 0),
- qMax(255 - int(magenta1+magenta2+magenta3) - darkness, 0),
- qMax(255 - int(yellow1+yellow2+yellow3) - darkness, 0));
-
- newImage.setPixel(x, y, newColor.rgb());
- }
- }
-
- finalWidget->setPixmap(QPixmap::fromImage(newImage));
-}
-
-/*
- Provides a dialog window to allow the user to save the image file.
-*/
-
-void Viewer::saveImage()
-{
- QString imageFile = QFileDialog::getSaveFileName(this,
- tr("Choose a filename to save the image"), "", tr("Images (*.png)"));
-
- QFileInfo info(imageFile);
-
- if (!info.baseName().isEmpty()) {
- QString newImageFile = QFileInfo(info.absoluteDir(),
- info.baseName() + ".png").absoluteFilePath();
-
- if (!finalWidget->pixmap()->save(newImageFile, "PNG"))
- (void) QMessageBox::warning(this, tr("Cannot save file"),
- tr("The file could not be saved."),
- QMessageBox::Cancel, QMessageBox::NoButton,
- QMessageBox::NoButton);
- }
- else
- (void) QMessageBox::warning(this, tr("Cannot save file"),
- tr("Please enter a valid filename."),
- QMessageBox::Cancel, QMessageBox::NoButton,
- QMessageBox::NoButton);
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/settings/settings.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/settings/settings.cpp
deleted file mode 100644
index e4bb50f1e..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/settings/settings.cpp
+++ /dev/null
@@ -1,188 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-QWidget *win
-QWidget *panel
-
-void snippet_ctor1()
-{
-//! [0]
- settings = QSettings("MySoft", "Star Runner")
-//! [0]
-}
-
-void snippet_ctor2()
-{
-//! [1]
- QCoreApplication.setOrganizationName("MySoft")
-//! [1] //! [2]
- QCoreApplication.setOrganizationDomain("mysoft.com")
-//! [2] //! [3]
- QCoreApplication.setApplicationName("Star Runner")
-//! [3]
-
-//! [4]
- settings = QSettings()
-//! [4]
-
-//! [5]
- settings.setValue("editor/wrapMargin", 68)
-//! [5] //! [6]
- margin = int(settings.value("editor/wrapMargin"))
-//! [6]
- {
-//! [7]
- margin = int(settings.value("editor/wrapMargin", 80))
-//! [7]
- }
-
-//! [8]
- settings.setValue("mainwindow/size", win.size())
-//! [8] //! [9]
- settings.setValue("mainwindow/fullScreen", win.isFullScreen())
-//! [9] //! [10]
- settings.setValue("outputpanel/visible", panel.isVisible())
-//! [10]
-
-//! [11]
- settings.beginGroup("mainwindow")
- settings.setValue("size", win.size())
- settings.setValue("fullScreen", win.isFullScreen())
- settings.endGroup()
-//! [11]
-
-//! [12]
- settings.beginGroup("outputpanel")
- settings.setValue("visible", panel.isVisible())
- settings.endGroup()
-//! [12]
-}
-
-void snippet_locations()
-{
-//! [13]
- obj1 = QSettings("MySoft", "Star Runner")
-//! [13] //! [14]
- obj2 = QSettings("MySoft")
- obj3 = QSettings(QSettings.SystemScope, "MySoft", "Star Runner")
- obj4 = QSettings(QSettings.SystemScope, "MySoft")
-//! [14]
-
- {
-//! [15]
- settings = QSettings(QSettings.IniFormat, QSettings.UserScope,
- "MySoft", "Star Runner")
-//! [15]
- }
-
- {
- QSettings settings("starrunner.ini", QSettings.IniFormat)
- }
-
- {
- QSettings settings("HKEY_CURRENT_USER\\Software\\Microsoft",
- QSettings.NativeFormat)
- }
-}
-
-class MainWindow : public QMainWindow
-{
-public:
- MainWindow()
-
- void writeSettings()
- void readSettings()
-
-protected:
- void closeEvent(QCloseEvent *event)
-}
-
-//! [16]
-class MainWindow(QMainWindow):
- ...
- def writeSettings(self):
- self.settings = QSettings("Moose Soft", "Clipper")
- self.settings.beginGroup("MainWindow")
- self.settings.setValue("size", self.size())
- self.settings.setValue("pos", self.pos())
- self.settings.endGroup()
-//! [16]
-
-//! [17]
- def readSettings(self):
- self.settings = QSettings("Moose Soft", "Clipper")
- self.settings.beginGroup("MainWindow")
- self.resize(settings.value("size", QSize(400, 400)).toSize())
- self.move(settings.value("pos", QPoint(200, 200)).toPoint())
- self.settings.endGroup()
-//! [17]
-
-//! [18]
- def __init__(self):
- self.settings = None
-//! [18] //! [19]
- self.readSettings()
-//! [19] //! [20]
-
-//! [20]
-
-bool userReallyWantsToQuit() { return true; }
-
-//! [21]
- # event : QCloseEvent
- def closeEvent(self, event):
- if self.userReallyWantsToQuit():
- self.writeSettings()
- event.accept()
- else:
- event.ignore()
-//! [21]
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/sharedemployee/employee.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/sharedemployee/employee.cpp
deleted file mode 100644
index 689b6b271..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/sharedemployee/employee.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "employee.h"
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/sharedemployee/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/sharedemployee/main.cpp
deleted file mode 100644
index 5faa8919c..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/sharedemployee/main.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-#include "employee.h"
-
-int main()
-{
- Employee e1(1001, "Albrecht Durer");
- Employee e2 = e1;
- e1.setName("Hans Holbein");
-}
-//! [0]
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/sharedtablemodel/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/sharedtablemodel/main.cpp
deleted file mode 100644
index 8dc6701c7..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/sharedtablemodel/main.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*
- main.cpp
-
- A simple example that shows how a single model can be shared between
- multiple views.
-*/
-
-#include <QApplication>
-#include <QHeaderView>
-#include <QItemSelectionModel>
-#include <QTableView>
-
-#include "model.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- TableModel *model = new TableModel(4, 2, &app);
-
-//! [0]
- QTableView *firstTableView = new QTableView;
- QTableView *secondTableView = new QTableView;
-//! [0]
-
-//! [1]
- firstTableView->setModel(model);
- secondTableView->setModel(model);
-//! [1]
-
- firstTableView->horizontalHeader()->setModel(model);
-
- for (int row = 0; row < 4; ++row) {
- for (int column = 0; column < 2; ++column) {
- QModelIndex index = model->index(row, column, QModelIndex());
- model->setData(index, QVariant(QString("(%1, %2)").arg(row).arg(column)));
- }
- }
-
-//! [2]
- secondTableView->setSelectionModel(firstTableView->selectionModel());
-//! [2]
-
- firstTableView->setWindowTitle("First table view");
- secondTableView->setWindowTitle("Second table view");
- firstTableView->show();
- secondTableView->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/signalmapper/filereader.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/signalmapper/filereader.cpp
deleted file mode 100644
index f7e5b5c0c..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/signalmapper/filereader.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-#include "filereader.h"
-
-
-FileReader::FileReader(QWidget *parent)
- : QWidget(parent)
-{
- textEdit = new QTextEdit;
-
- taxFileButton = new QPushButton("Tax File");
- accountFileButton = new QPushButton("Accounts File");
- reportFileButton = new QPushButton("Report File");
-
-//! [0]
- signalMapper = new QSignalMapper(this);
- signalMapper->setMapping(taxFileButton, QString("taxfile.txt"));
- signalMapper->setMapping(accountFileButton, QString("accountsfile.txt"));
- signalMapper->setMapping(reportFileButton, QString("reportfile.txt"));
-
- connect(taxFileButton, SIGNAL(clicked()),
- signalMapper, SLOT (map()));
- connect(accountFileButton, SIGNAL(clicked()),
- signalMapper, SLOT (map()));
- connect(reportFileButton, SIGNAL(clicked()),
- signalMapper, SLOT (map()));
-//! [0]
-
-//! [1]
- connect(signalMapper, SIGNAL(mapped(const QString &)),
- this, SLOT(readFile(const QString &)));
-//! [1]
-
- QHBoxLayout *buttonLayout = new QHBoxLayout;
- buttonLayout->addWidget(taxFileButton);
- buttonLayout->addWidget(accountFileButton);
- buttonLayout->addWidget(reportFileButton);
-
- QVBoxLayout *mainLayout = new QVBoxLayout;
- mainLayout->addWidget(textEdit);
- mainLayout->addLayout(buttonLayout);
-
- setLayout(mainLayout);
-}
-
-void FileReader::readFile(const QString &filename)
-{
- QFile file(filename);
-
- if (!file.open(QIODevice::ReadOnly)) {
- QMessageBox::information(this, tr("Unable to open file"),
- file.errorString());
- return;
- }
-
-
- QTextStream in(&file);
- textEdit->setPlainText(in.readAll());
-}
-
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/signalmapper/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/signalmapper/main.cpp
deleted file mode 100644
index 404756691..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/signalmapper/main.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-#include "filereader.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- FileReader *reader = new FileReader;
- reader->show();
-
- return app.exec();
-}
-
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/signalsandslots/lcdnumber.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/signalsandslots/lcdnumber.cpp
deleted file mode 100644
index c24a03d98..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/signalsandslots/lcdnumber.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "lcdnumber.h"
-
-LcdNumber::LcdNumber(QWidget *parent)
-{
-}
-
-void LcdNumber::display(int)
-{
-}
-
-void LcdNumber::display(double)
-{
-}
-
-void LcdNumber::display(const QString &)
-{
-}
-
-void LcdNumber::setHexMode()
-{
-}
-
-void LcdNumber::setDecMode()
-{
-}
-
-void LcdNumber::setOctMode()
-{
-}
-
-void LcdNumber::setBinMode()
-{
-}
-
-void LcdNumber::setSmallDecimalPoint(bool)
-{
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/signalsandslots/signalsandslots.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/signalsandslots/signalsandslots.cpp
deleted file mode 100644
index 8e77a3236..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/signalsandslots/signalsandslots.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QAbstractButton>
-
-#include "signalsandslots.h"
-
-//! [0]
-void Counter::setValue(int value)
-{
- if (value != m_value) {
- m_value = value;
- emit valueChanged(value);
- }
-}
-//! [0]
-
-int main()
-{
-//! [1]
- Counter a, b;
-//! [1] //! [2]
- QObject::connect(&a, SIGNAL(valueChanged(int)),
- &b, SLOT(setValue(int)));
-//! [2]
-
-//! [3]
- a.setValue(12); // a.value() == 12, b.value() == 12
-//! [3] //! [4]
- b.setValue(48); // a.value() == 12, b.value() == 48
-//! [4]
-
-
- QWidget *widget = reinterpret_cast<QWidget *>(new QObject(0));
-//! [5]
- if (widget->inherits("QAbstractButton")) {
- QAbstractButton *button = static_cast<QAbstractButton *>(widget);
- button->toggle();
-//! [5] //! [6]
- }
-//! [6]
-
-//! [7]
- if (QAbstractButton *button = qobject_cast<QAbstractButton *>(widget))
- button->toggle();
-//! [7]
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/simplemodel-use/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/simplemodel-use/main.cpp
deleted file mode 100644
index b0184e338..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/simplemodel-use/main.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*
- main.cpp
-
- A simple example of how to access items from an existing model.
-*/
-
-#include <QtWidgets>
-
-/*!
- Create a default directory model and, using the index-based interface to
- the model and some QLabel widgets, populate the window's layout with the
- names of objects in the directory.
-
- Note that we only want to read the filenames in the highest level of the
- directory, so we supply a default (invalid) QModelIndex to the model in
- order to indicate that we want top-level items.
-*/
-
-def main():
- app = QApplication(sys.argc, sys.argv)
-
- window = QWidget()
- layout = QVBoxLayout(window)
- title = QLabel("Some items from the directory model", window)
- title.setBackgroundRole(QPalette.Base)
- title.setMargin(8)
- layout.addWidget(title)
-
-//! [0]
- model = QFileSystemModel()
- parentIndex = model.index(QDir.currentPath())
- numRows = model.rowCount(parentIndex)
-//! [0]
-
-//! [1]
- for row in range(numRows):
- index = model.index(row, 0, parentIndex)
-//! [1]
-
-//! [2]
- text = model.data(index, Qt.DisplayRole)
- // Display the text in a widget.
-//! [2]
-
- label = QLabel(text, window)
- layout.addWidget(label)
-//! [3]
-//! [3]
-
- window.setWindowTitle("A simple model example")
- window.show()
- return app.exec_()
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/simpleparse/handler.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/simpleparse/handler.cpp
deleted file mode 100644
index 1bb2e805e..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/simpleparse/handler.cpp
+++ /dev/null
@@ -1,148 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*
-handler.cpp
-
-Provides a handler for processing XML elements found by the reader.
-
-The handler stores the names of elements it finds and their indentation
-levels. The indentation level is initially set to zero.
-When a starting element is found, the indentation level is increased;
-when an ending element is found, the indentation level is decreased.
-*/
-
-#include <QDebug>
-#include "handler.h"
-
-/*!
- Reset the state of the handler to ensure that new documents are
- read correctly.
-
- We return true to indicate that parsing should continue.
-*/
-
-bool Handler::startDocument()
-{
- elementName.clear();
- elementIndentation.clear();
- indentationLevel = 0;
-
- return true;
-}
-
-/*!
- Process each starting element in the XML document.
-
- Append the element name to the list of elements found; add its
- corresponding indentation level to the list of indentation levels.
-
- Increase the level of indentation by one column.
-
- We return true to indicate that parsing should continue.
-*/
-
-bool Handler::startElement(const QString &, const QString &,
- const QString & qName, const QXmlAttributes &)
-{
- elementName.append(qName);
- elementIndentation.append(indentationLevel);
- indentationLevel += 1;
-
- return true;
-}
-
-/*!
- Process each ending element in the XML document.
-
- Decrease the level of indentation by one column.
-
- We return true to indicate that parsing should continue.
-*/
-
-bool Handler::endElement(const QString &, const QString &,
- const QString &)
-{
- indentationLevel -= 1;
-
- return true;
-}
-
-/*!
- Report a fatal parsing error, and return false to indicate to the reader
- that parsing should stop.
-*/
-
-bool Handler::fatalError (const QXmlParseException & exception)
-{
- qWarning() << QString("Fatal error on line %1, column %2: %3").arg(
- exception.lineNumber()).arg(exception.columnNumber()).arg(
- exception.message());
-
- return false;
-}
-
-/*!
- Return the list of element names found.
-*/
-
-QStringList& Handler::names ()
-{
- return elementName;
-}
-
-/*!
- Return the list of indentations used for each element found.
-*/
-
-QList<int>& Handler::indentations ()
-{
- return elementIndentation;
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/simpleparse/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/simpleparse/main.cpp
deleted file mode 100644
index 810e442d1..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/simpleparse/main.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qfile.h>
-#include <qxml.h>
-#include "handler.h"
-
-#include <iostream>
-
-int main(int argc, char **argv)
-{
- if (argc != 2) {
- std::cout << "Usage: " << argv[0] << " <filename>" << std::endl;
- return 1;
- }
-
- QFile *file = new QFile(argv[1]);
-
-//! [0]
- xmlReader = QXmlSimpleReader()
- source = QXmlInputSource(filename)
-//! [0]
-
-//! [1]
- handler = Handler()
- xmlReader.setContentHandler(handler)
- xmlReader.setErrorHandler(handler)
-//! [1]
-
-//! [2]
- ok = xmlReader.parse(source)
-
- if not ok:
- print "Parsing failed."
-//! [2]
- else {
- QStringList names = handler->names();
- QList<int> indentations = handler->indentations();
-
- int items = names.count();
-
- for (int i = 0; i < items; ++i) {
- for (int j = 0; j < indentations[i]; ++j)
- std::cout << " ";
- std::cout << names[i].toLocal8Bit().constData() << std::endl;
- }
- }
-
- return 0;
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/splitterhandle/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/splitterhandle/main.cpp
deleted file mode 100644
index f9065226f..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/splitterhandle/main.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QLabel>
-
-#include "splitter.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- Splitter splitter(Qt::Horizontal);
- splitter.addWidget(new QLabel("Hello"));
- splitter.addWidget(new QLabel("World"));
- Splitter verticalSplitter(Qt::Vertical, &splitter);
- verticalSplitter.addWidget(new QLabel("A"));
- verticalSplitter.addWidget(new QLabel("B"));
- splitter.show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/splitterhandle/splitter.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/splitterhandle/splitter.cpp
deleted file mode 100644
index 7b9c06474..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/splitterhandle/splitter.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "splitter.h"
-
-SplitterHandle::SplitterHandle(Qt::Orientation orientation, QSplitter *parent)
- : QSplitterHandle(orientation, parent)
-{
- gradient.setColorAt(0.0, Qt::darkGreen);
- gradient.setColorAt(0.25, Qt::white);
- gradient.setColorAt(1.0, Qt::darkGreen);
-}
-
-//! [0]
-void SplitterHandle::paintEvent(QPaintEvent *event)
-{
- QPainter painter(this);
- if (orientation() == Qt::Horizontal) {
- gradient.setStart(rect().left(), rect().height()/2);
- gradient.setFinalStop(rect().right(), rect().height()/2);
- } else {
- gradient.setStart(rect().width()/2, rect().top());
- gradient.setFinalStop(rect().width()/2, rect().bottom());
- }
- painter.fillRect(event->rect(), QBrush(gradient));
-}
-//! [0]
-
-Splitter::Splitter(Qt::Orientation orientation, QWidget *parent)
- : QSplitter(orientation, parent)
-{
-}
-
-//! [1]
-QSplitterHandle *Splitter::createHandle()
-{
- return new SplitterHandle(orientation(), this);
-}
-//! [1]
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/streaming/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/streaming/main.cpp
deleted file mode 100644
index d81ae3a76..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/streaming/main.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-#include <QByteArray>
-#include <QDataStream>
-
-//! [0]
-struct Movie
-{
- int id;
- QString title;
- QDate releaseDate;
-};
-//! [0]
-
-//! [1]
-QDataStream &operator<<(QDataStream &out, const Movie &movie)
-{
- out << (quint32)movie.id << movie.title
- << movie.releaseDate;
- return out;
-}
-//! [1]
-
-//! [2]
-QDataStream &operator>>(QDataStream &in, Movie &movie)
-{
- quint32 id;
- QDate date;
-
- in >> id >> movie.title >> date;
- movie.id = (int)id;
- movie.releaseDate = date;
- return in;
-}
-//! [2]
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- Movie m;
- m.id = 0001;
- m.title = "Happy Meal";
- m.releaseDate = QDate(1995, 5, 17);
-
- QByteArray byteArray;
- QDataStream stream(&byteArray, QIODevice::WriteOnly);
- stream << m;
-
- // display
- qDebug() << m.id << m.releaseDate << m.title;
-
- Movie m2;
-
- int id2;
- QString title2;
- QDate date2;
-
- QDataStream stream2(byteArray);
- stream2 >> id2 >> title2 >> date2;
-
- m2.id = id2;
- m2.title = title2;
- m2.releaseDate = date2;
-
- qDebug() << id2 << " " << date2 << " " << title2;
-
- return 0;
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/stringlistmodel/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/stringlistmodel/main.cpp
deleted file mode 100644
index b95a9f245..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/stringlistmodel/main.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- The main function for the string list model example. This creates and
- populates a model with values from a string list then displays the
- contents of the model using a QListView widget.
-*/
-
-#include <QAbstractItemModel>
-#include <QApplication>
-#include <QListView>
-
-#include "model.h"
-
-//! [0]
-
-app = QApplication(sys.argv)
-
-// Unindented for quoting purposes:
-//! [1]
-numbers = ["One", "Two", "Three", "Four", "Five"]
-
-model = StringListModel(numbers)
-//! [0] //! [1] //! [2] //! [3]
-view = QListView()
-//! [2]
-view.setWindowTitle("View onto a string list model")
-//! [4]
-view.setModel(model)
-//! [3] //! [4]
-
- model.insertRows(5, 7, QModelIndex())
-
- for row in range(5, 12):
- index = model.index(row, 0, QModelIndex())
- model.setData(index, str(row+1))
-
-//! [5]
- view.show()
- sys.exit(app.exec_())
-//! [5]
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/textblock-formats/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/textblock-formats/main.cpp
deleted file mode 100644
index f1b9d312c..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/textblock-formats/main.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-QString tr(const char *text)
-{
- return QApplication::translate(text, text);
-}
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
-//! [0]
- QTextEdit *editor = new QTextEdit();
- QTextCursor cursor(editor->textCursor());
-//! [0]
- cursor.movePosition(QTextCursor::Start);
-
- QTextBlockFormat blockFormat = cursor.blockFormat();
- blockFormat.setTopMargin(4);
- blockFormat.setLeftMargin(4);
- blockFormat.setRightMargin(4);
- blockFormat.setBottomMargin(4);
-
- cursor.setBlockFormat(blockFormat);
- cursor.insertText(tr("This contains plain text inside a "
- "text block with margins to keep it separate "
- "from other parts of the document."));
-
- cursor.insertBlock();
-
-//! [1]
- QTextBlockFormat backgroundFormat = blockFormat;
- backgroundFormat.setBackground(QColor("lightGray"));
-
- cursor.setBlockFormat(backgroundFormat);
-//! [1]
- cursor.insertText(tr("The background color of a text block can be "
- "changed to highlight text."));
-
- cursor.insertBlock();
-
- QTextBlockFormat rightAlignedFormat = blockFormat;
- rightAlignedFormat.setAlignment(Qt::AlignRight);
-
- cursor.setBlockFormat(rightAlignedFormat);
- cursor.insertText(tr("The alignment of the text within a block is "
- "controlled by the alignment properties of "
- "the block itself. This text block is "
- "right-aligned."));
-
- cursor.insertBlock();
-
- QTextBlockFormat paragraphFormat = blockFormat;
- paragraphFormat.setAlignment(Qt::AlignJustify);
- paragraphFormat.setTextIndent(32);
-
- cursor.setBlockFormat(paragraphFormat);
- cursor.insertText(tr("Text can be formatted so that the first "
- "line in a paragraph has its own margin. "
- "This makes the text more readable."));
-
- cursor.insertBlock();
-
- QTextBlockFormat reverseFormat = blockFormat;
- reverseFormat.setAlignment(Qt::AlignJustify);
- reverseFormat.setTextIndent(32);
-
- cursor.setBlockFormat(reverseFormat);
- cursor.insertText(tr("The direction of the text can be reversed. "
- "This is useful for right-to-left "
- "languages."));
-
- editor->setWindowTitle(tr("Text Block Formats"));
- editor->resize(480, 480);
- editor->show();
-
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/textblock-fragments/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/textblock-fragments/main.cpp
deleted file mode 100644
index 42d8bc990..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/textblock-fragments/main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- MainWindow *window = new MainWindow;
- window->resize(640, 480);
- window->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/textblock-fragments/mainwindow.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/textblock-fragments/mainwindow.cpp
deleted file mode 100644
index 9f11ca77c..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/textblock-fragments/mainwindow.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-#include "xmlwriter.h"
-
-MainWindow::MainWindow()
-{
- QMenu *fileMenu = new QMenu(tr("&File"));
-
- QAction *saveAction = fileMenu->addAction(tr("&Save..."));
- saveAction->setShortcut(tr("Ctrl+S"));
-
- QAction *quitAction = fileMenu->addAction(tr("E&xit"));
- quitAction->setShortcut(tr("Ctrl+Q"));
-
- QMenu *insertMenu = new QMenu(tr("&Insert"));
-
- QAction *calendarAction = insertMenu->addAction(tr("&Calendar"));
- calendarAction->setShortcut(tr("Ctrl+I"));
-
- menuBar()->addMenu(fileMenu);
- menuBar()->addMenu(insertMenu);
-
- editor = new QTextEdit(this);
-
- connect(saveAction, SIGNAL(triggered()), this, SLOT(saveFile()));
- connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));
- connect(calendarAction, SIGNAL(triggered()), this, SLOT(insertCalendar()));
-
- setCentralWidget(editor);
- setWindowTitle(tr("Text Document Writer"));
-}
-
-void MainWindow::saveFile()
-{
- QString fileName = QFileDialog::getSaveFileName(this,
- tr("Save document as:"), "", tr("XML (*.xml)"));
-
- if (!fileName.isEmpty()) {
- if (writeXml(fileName))
- setWindowTitle(fileName);
- else
- QMessageBox::warning(this, tr("Warning"),
- tr("Failed to save the document."), QMessageBox::Cancel,
- QMessageBox::NoButton);
- }
-}
-
-void MainWindow::insertCalendar()
-{
- QTextCursor cursor(editor->textCursor());
- cursor.movePosition(QTextCursor::Start);
-
- QTextCharFormat format(cursor.charFormat());
- format.setFontFamily("Courier");
-
- QTextCharFormat boldFormat = format;
- boldFormat.setFontWeight(QFont::Bold);
-
- cursor.insertBlock();
- cursor.insertText(" ", boldFormat);
-
- QDate date = QDate::currentDate();
- int year = date.year(), month = date.month();
-
- for (int weekDay = 1; weekDay <= 7; ++weekDay) {
- cursor.insertText(QString("%1 ").arg(QDate::shortDayName(weekDay), 3),
- boldFormat);
- }
-
- cursor.insertBlock();
- cursor.insertText(" ", format);
-
- for (int column = 1; column < QDate(year, month, 1).dayOfWeek(); ++column) {
- cursor.insertText(" ", format);
- }
-
- for (int day = 1; day <= date.daysInMonth(); ++day) {
- int weekDay = QDate(year, month, day).dayOfWeek();
-
- if (QDate(year, month, day) == date)
- cursor.insertText(QString("%1 ").arg(day, 3), boldFormat);
- else
- cursor.insertText(QString("%1 ").arg(day, 3), format);
-
- if (weekDay == 7) {
- cursor.insertBlock();
- cursor.insertText(" ", format);
- }
- }
-}
-
-bool MainWindow::writeXml(const QString &fileName)
-{
- XmlWriter documentWriter(editor->document());
-
- QDomDocument *domDocument = documentWriter.toXml();
- QFile file(fileName);
-
- if (file.open(QFile::WriteOnly)) {
- QTextStream textStream(&file);
-
- textStream << domDocument->toByteArray(1);
- return true;
- }
- else
- return false;
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/textblock-fragments/xmlwriter.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/textblock-fragments/xmlwriter.cpp
deleted file mode 100644
index 78af3fe91..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/textblock-fragments/xmlwriter.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "xmlwriter.h"
-
-QDomDocument *XmlWriter::toXml()
-{
- QDomImplementation implementation;
- QDomDocumentType docType = implementation.createDocumentType(
- "scribe-document", "scribe", "qtsoftware.com/scribe");
-
- document = new QDomDocument(docType);
-
- // ### This processing instruction is required to ensure that any kind
- // of encoding is given when the document is written.
- QDomProcessingInstruction process = document->createProcessingInstruction(
- "xml", "version=\"1.0\" encoding=\"utf-8\"");
- document->appendChild(process);
-
- QDomElement documentElement = document->createElement("document");
- document->appendChild(documentElement);
-
-//! [0]
- QTextBlock currentBlock = textDocument->begin();
-
- while (currentBlock.isValid()) {
-//! [0]
- QDomElement blockElement = document->createElement("block");
- document->appendChild(blockElement);
-
- readFragment(currentBlock, blockElement, document);
-
-//! [1]
- processBlock(currentBlock);
-//! [1]
-
-//! [2]
- currentBlock = currentBlock.next();
- }
-//! [2]
-
- return document;
-}
-
-void XmlWriter::readFragment(const QTextBlock &currentBlock,
- QDomElement blockElement,
- QDomDocument *document)
-{
-//! [3] //! [4]
- QTextBlock::iterator it;
- for (it = currentBlock.begin(); !(it.atEnd()); ++it) {
- QTextFragment currentFragment = it.fragment();
- if (currentFragment.isValid())
-//! [3] //! [5]
- processFragment(currentFragment);
-//! [4] //! [5]
-
- if (currentFragment.isValid()) {
- QDomElement fragmentElement = document->createElement("fragment");
- blockElement.appendChild(fragmentElement);
-
- fragmentElement.setAttribute("length", currentFragment.length());
- QDomText fragmentText = document->createTextNode(currentFragment.text());
-
- fragmentElement.appendChild(fragmentText);
-//! [6]
- }
-//! [7]
- }
-//! [6] //! [7]
-}
-
-void XmlWriter::processBlock(const QTextBlock &currentBlock)
-{
-}
-
-void XmlWriter::processFragment(const QTextFragment &currentFragment)
-{
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-blocks/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-blocks/main.cpp
deleted file mode 100644
index 42d8bc990..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-blocks/main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- MainWindow *window = new MainWindow;
- window->resize(640, 480);
- window->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-blocks/mainwindow.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-blocks/mainwindow.cpp
deleted file mode 100644
index 33a08e4e0..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-blocks/mainwindow.cpp
+++ /dev/null
@@ -1,166 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-#include "xmlwriter.h"
-
-MainWindow::MainWindow()
-{
- QMenu *fileMenu = new QMenu(tr("&File"));
-
- QAction *saveAction = fileMenu->addAction(tr("&Save..."));
- saveAction->setShortcut(tr("Ctrl+S"));
-
- QAction *quitAction = fileMenu->addAction(tr("E&xit"));
- quitAction->setShortcut(tr("Ctrl+Q"));
-
- QMenu *insertMenu = new QMenu(tr("&Insert"));
-
- QAction *calendarAction = insertMenu->addAction(tr("&Calendar"));
- calendarAction->setShortcut(tr("Ctrl+I"));
-
- menuBar()->addMenu(fileMenu);
- menuBar()->addMenu(insertMenu);
-
-//! [0]
- editor = new QTextEdit(this);
-//! [0]
-
- connect(saveAction, SIGNAL(triggered()), this, SLOT(saveFile()));
- connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));
- connect(calendarAction, SIGNAL(triggered()), this, SLOT(insertCalendar()));
-
- setCentralWidget(editor);
- setWindowTitle(tr("Text Document Writer"));
-}
-
-void MainWindow::saveFile()
-{
- QString fileName = QFileDialog::getSaveFileName(this,
- tr("Save document as:"), "", tr("XML (*.xml)"));
-
- if (!fileName.isEmpty()) {
- if (writeXml(fileName))
- setWindowTitle(fileName);
- else
- QMessageBox::warning(this, tr("Warning"),
- tr("Failed to save the document."), QMessageBox::Cancel,
- QMessageBox::NoButton);
- }
-}
-
-void MainWindow::insertCalendar()
-{
-//! [1]
- QTextCursor cursor(editor->textCursor());
- cursor.movePosition(QTextCursor::Start);
-
- QTextCharFormat format(cursor.charFormat());
- format.setFontFamily("Courier");
-
- QTextCharFormat boldFormat = format;
- boldFormat.setFontWeight(QFont::Bold);
-
- cursor.insertBlock();
- cursor.insertText(" ", boldFormat);
-
- QDate date = QDate::currentDate();
- int year = date.year(), month = date.month();
-
- for (int weekDay = 1; weekDay <= 7; ++weekDay) {
- cursor.insertText(QString("%1 ").arg(QDate::shortDayName(weekDay), 3),
- boldFormat);
- }
-
- cursor.insertBlock();
- cursor.insertText(" ", format);
-
- for (int column = 1; column < QDate(year, month, 1).dayOfWeek(); ++column) {
- cursor.insertText(" ", format);
- }
-
- for (int day = 1; day <= date.daysInMonth(); ++day) {
-//! [1] //! [2]
- int weekDay = QDate(year, month, day).dayOfWeek();
-
- if (QDate(year, month, day) == date)
- cursor.insertText(QString("%1 ").arg(day, 3), boldFormat);
- else
- cursor.insertText(QString("%1 ").arg(day, 3), format);
-
- if (weekDay == 7) {
- cursor.insertBlock();
- cursor.insertText(" ", format);
- }
-//! [2] //! [3]
- }
-//! [3]
-}
-
-bool MainWindow::writeXml(const QString &fileName)
-{
- XmlWriter documentWriter(editor->document());
-
- QDomDocument *domDocument = documentWriter.toXml();
- QFile file(fileName);
-
- if (file.open(QFile::WriteOnly)) {
- QTextStream textStream(&file);
- textStream.setCodec(QTextCodec::codecForName("UTF-8"));
-
- textStream << domDocument->toString(1).toUtf8();
- file.close();
- return true;
- }
- else
- return false;
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-blocks/xmlwriter.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-blocks/xmlwriter.cpp
deleted file mode 100644
index a03a130f2..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-blocks/xmlwriter.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "xmlwriter.h"
-
-QDomDocument *XmlWriter::toXml()
-{
- QDomImplementation implementation;
- QDomDocumentType docType = implementation.createDocumentType(
- "scribe-document", "scribe", "qtsoftware.com/scribe");
-
- document = new QDomDocument(docType);
-
- // ### This processing instruction is required to ensure that any kind
- // of encoding is given when the document is written.
- QDomProcessingInstruction process = document->createProcessingInstruction(
- "xml", "version=\"1.0\" encoding=\"utf-8\"");
- document->appendChild(process);
-
- QDomElement documentElement = document->createElement("document");
- document->appendChild(documentElement);
-
- QTextBlock firstBlock = textDocument->begin();
- createItems(documentElement, firstBlock);
-
- return document;
-}
-
-void XmlWriter::createItems(QDomElement &parent, const QTextBlock &block)
-{
- QTextBlock currentBlock = block;
-
- while (currentBlock.isValid()) {
- QDomElement blockElement = document->createElement("block");
- blockElement.setAttribute("length", currentBlock.length());
- parent.appendChild(blockElement);
-
- if (!(currentBlock.text().isNull())) {
- QDomText textNode = document->createTextNode(currentBlock.text());
- blockElement.appendChild(textNode);
- }
-
- currentBlock = currentBlock.next();
- }
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-charformats/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-charformats/main.cpp
deleted file mode 100644
index 092f991ef..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-charformats/main.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-QString tr(const char *text)
-{
- return QApplication::translate(text, text);
-}
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- QTextEdit *editor = new QTextEdit();
-
- QTextCursor cursor(editor->textCursor());
- cursor.movePosition(QTextCursor::Start);
-
- QTextCharFormat plainFormat(cursor.charFormat());
-
- QTextCharFormat headingFormat = plainFormat;
- headingFormat.setFontWeight(QFont::Bold);
- headingFormat.setFontPointSize(16);
-
- QTextCharFormat emphasisFormat = plainFormat;
- emphasisFormat.setFontItalic(true);
-
- QTextCharFormat qtFormat = plainFormat;
- qtFormat.setForeground(QColor("#990000"));
-
- QTextCharFormat underlineFormat = plainFormat;
- underlineFormat.setFontUnderline(true);
-
-//! [0]
- cursor.insertText(tr("Character formats"),
- headingFormat);
-
- cursor.insertBlock();
-
- cursor.insertText(tr("Text can be displayed in a variety of "
- "different character formats. "), plainFormat);
- cursor.insertText(tr("We can emphasize text by "));
- cursor.insertText(tr("making it italic"), emphasisFormat);
-//! [0]
- cursor.insertText(tr(", give it a "), plainFormat);
- cursor.insertText(tr("different color "), qtFormat);
- cursor.insertText(tr("to the default text color, "), plainFormat);
- cursor.insertText(tr("underline it"), underlineFormat);
- cursor.insertText(tr(", and use many other effects."), plainFormat);
-
- editor->setWindowTitle(tr("Text Document Character Formats"));
- editor->resize(320, 480);
- editor->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-cursors/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-cursors/main.cpp
deleted file mode 100644
index b224ed46e..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-cursors/main.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-QString tr(const char *text)
-{
- return QApplication::translate(text, text);
-}
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- QTextEdit *editor = new QTextEdit;
-
-//! [0]
- QTextDocument *document = editor->document();
- QTextCursor redCursor(document);
-//! [0] //! [1]
- QTextCursor blueCursor(document);
-//! [1]
-
- QTextCharFormat redFormat(redCursor.charFormat());
- redFormat.setForeground(Qt::red);
- QTextCharFormat blueFormat(blueCursor.charFormat());
- blueFormat.setForeground(Qt::blue);
-
- redCursor.setCharFormat(redFormat);
- blueCursor.setCharFormat(blueFormat);
-
- for (int i = 0; i < 20; ++i) {
- if (i % 2 == 0)
- redCursor.insertText(tr("%1 ").arg(i), redFormat);
- if (i % 5 == 0)
- blueCursor.insertText(tr("%1 ").arg(i), blueFormat);
- }
-
- editor->setWindowTitle(tr("Text Document Cursors"));
- editor->resize(320, 480);
- editor->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-find/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-find/main.cpp
deleted file mode 100644
index 52187e9d2..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-find/main.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-QString tr(const char *text)
-{
- return QApplication::translate(text, text);
-}
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- QTextEdit *editor = new QTextEdit();
-
- QTextCursor cursor(editor->textCursor());
- cursor.movePosition(QTextCursor::Start);
-
- QTextCharFormat plainFormat(cursor.charFormat());
- QTextCharFormat colorFormat = plainFormat;
- colorFormat.setForeground(Qt::red);
-
- cursor.insertText(tr("Text can be displayed in a variety of "
- "different character "
- "formats. "), plainFormat);
- cursor.insertText(tr("We can emphasize text by making it "));
- cursor.insertText(tr("italic, give it a different color "));
- cursor.insertText(tr("to the default text color, underline it, "));
- cursor.insertText(tr("and use many other effects."));
-
- QString searchString = tr("text");
-
- QTextDocument *document = editor->document();
-//! [0]
- QTextCursor newCursor(document);
-
- while (!newCursor.isNull() && !newCursor.atEnd()) {
- newCursor = document->find(searchString, newCursor);
-
- if (!newCursor.isNull()) {
- newCursor.movePosition(QTextCursor::WordRight,
- QTextCursor::KeepAnchor);
-
- newCursor.mergeCharFormat(colorFormat);
- }
-//! [0] //! [1]
- }
-//! [1]
-
- editor->setWindowTitle(tr("Text Document Find"));
- editor->resize(320, 480);
- editor->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-frames/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-frames/main.cpp
deleted file mode 100644
index 2cb0b3313..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-frames/main.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- MainWindow *window = new MainWindow;
- window->resize(480, 480);
- window->show();
- return app.exec();
-}
-
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-frames/mainwindow.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-frames/mainwindow.cpp
deleted file mode 100644
index 76bc692b3..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-frames/mainwindow.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-#include "xmlwriter.h"
-
-MainWindow::MainWindow()
-{
- QMenu *fileMenu = new QMenu(tr("&File"));
-
- QAction *saveAction = fileMenu->addAction(tr("&Save..."));
- saveAction->setShortcut(tr("Ctrl+S"));
-
- QAction *quitAction = fileMenu->addAction(tr("E&xit"));
- quitAction->setShortcut(tr("Ctrl+Q"));
-
- menuBar()->addMenu(fileMenu);
- editor = new QTextEdit();
-
- QTextCursor cursor(editor->textCursor());
- cursor.movePosition(QTextCursor::Start);
-
- QTextFrame *mainFrame = cursor.currentFrame();
-
- QTextCharFormat plainCharFormat;
- QTextCharFormat boldCharFormat;
- boldCharFormat.setFontWeight(QFont::Bold);
-/* main frame
-//! [0]
- QTextFrame *mainFrame = cursor.currentFrame();
- cursor.insertText(...);
-//! [0]
-*/
- cursor.insertText("Text documents are represented by the "
- "QTextDocument class, rather than by QString objects. "
- "Each QTextDocument object contains information about "
- "the document's internal representation, its structure, "
- "and keeps track of modifications to provide undo/redo "
- "facilities. This approach allows features such as the "
- "layout management to be delegated to specialized "
- "classes, but also provides a focus for the framework.",
- plainCharFormat);
-
-//! [1]
- QTextFrameFormat frameFormat;
- frameFormat.setMargin(32);
- frameFormat.setPadding(8);
- frameFormat.setBorder(4);
-//! [1]
- cursor.insertFrame(frameFormat);
-
-/* insert frame
-//! [2]
- cursor.insertFrame(frameFormat);
- cursor.insertText(...);
-//! [2]
-*/
- cursor.insertText("Documents are either converted from external sources "
- "or created from scratch using Qt. The creation process "
- "can done by an editor widget, such as QTextEdit, or by "
- "explicit calls to the Scribe API.", boldCharFormat);
-
- cursor = mainFrame->lastCursorPosition();
-/* last cursor
-//! [3]
- cursor = mainFrame->lastCursorPosition();
- cursor.insertText(...);
-//! [3]
-*/
- cursor.insertText("There are two complementary ways to visualize the "
- "contents of a document: as a linear buffer that is "
- "used by editors to modify the contents, and as an "
- "object hierarchy containing structural information "
- "that is useful to layout engines. In the hierarchical "
- "model, the objects generally correspond to visual "
- "elements such as frames, tables, and lists. At a lower "
- "level, these elements describe properties such as the "
- "style of text used and its alignment. The linear "
- "representation of the document is used for editing and "
- "manipulation of the document's contents.",
- plainCharFormat);
-
-
- connect(saveAction, SIGNAL(triggered()), this, SLOT(saveFile()));
- connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));
-
- setCentralWidget(editor);
- setWindowTitle(tr("Text Document Frames"));
-}
-
-void MainWindow::saveFile()
-{
- QString fileName = QFileDialog::getSaveFileName(this,
- tr("Save document as:"), "", tr("XML (*.xml)"));
-
- if (!fileName.isEmpty()) {
- if (writeXml(fileName))
- setWindowTitle(fileName);
- else
- QMessageBox::warning(this, tr("Warning"),
- tr("Failed to save the document."), QMessageBox::Cancel,
- QMessageBox::NoButton);
- }
-}
-bool MainWindow::writeXml(const QString &fileName)
-{
- XmlWriter documentWriter(editor->document());
-
- QDomDocument *domDocument = documentWriter.toXml();
- QFile file(fileName);
-
- if (file.open(QFile::WriteOnly)) {
- QTextStream textStream(&file);
- textStream.setCodec(QTextCodec::codecForName("UTF-8"));
-
- textStream << domDocument->toString(1).toUtf8();
- file.close();
- return true;
- }
- else
- return false;
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-frames/xmlwriter.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-frames/xmlwriter.cpp
deleted file mode 100644
index 5949a91b1..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-frames/xmlwriter.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "xmlwriter.h"
-
-QDomDocument *XmlWriter::toXml()
-{
- QDomImplementation implementation;
- QDomDocumentType docType = implementation.createDocumentType(
- "scribe-document", "scribe", "qtsoftware.com/scribe");
-
- document = new QDomDocument(docType);
-
- // ### This processing instruction is required to ensure that any kind
- // of encoding is given when the document is written.
- QDomProcessingInstruction process = document->createProcessingInstruction(
- "xml", "version=\"1.0\" encoding=\"utf-8\"");
- document->appendChild(process);
-
- QDomElement documentElement = document->createElement("document");
- document->appendChild(documentElement);
-
-//! [0]
- QTextFrame *root = textDocument->rootFrame();
-//! [0]
-
- if (root)
- processFrame(documentElement, root);
-
- return document;
-}
-
-void XmlWriter::processBlock(QDomElement &parent, const QTextBlock &block)
-{
- QDomElement blockElement = document->createElement("block");
- blockElement.setAttribute("position", block.position());
- blockElement.setAttribute("length", block.length());
- parent.appendChild(blockElement);
-
- QTextBlock::iterator it;
- for (it = block.begin(); !(it.atEnd()); ++it) {
- QTextFragment fragment = it.fragment();
-
- if (fragment.isValid()) {
- QDomElement fragmentElement = document->createElement("fragment");
- blockElement.appendChild(fragmentElement);
-
- fragmentElement.setAttribute("length", fragment.length());
- QDomText fragmentText = document->createTextNode(fragment.text());
-
- fragmentElement.appendChild(fragmentText);
- }
- }
-}
-
-void XmlWriter::processFrame(QDomElement &parent, QTextFrame *frame)
-{
- QDomElement frameElement = document->createElement("frame");
- frameElement.setAttribute("begin", frame->firstPosition());
- frameElement.setAttribute("end", frame->lastPosition());
- parent.appendChild(frameElement);
-
-//! [1]
- QTextFrame::iterator it;
- for (it = frame->begin(); !(it.atEnd()); ++it) {
-
- QTextFrame *childFrame = it.currentFrame();
- QTextBlock childBlock = it.currentBlock();
-
- if (childFrame)
-//! [1] //! [2]
- processFrame(frameElement, childFrame);
- else if (childBlock.isValid())
- processBlock(frameElement, childBlock);
- }
-//! [2]
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-imagedrop/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-imagedrop/main.cpp
deleted file mode 100644
index 4ae9b689f..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-imagedrop/main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-#include "textedit.h"
-
-int main(int argc, char * argv[])
-{
- QApplication app(argc, argv);
-
- TextEdit *textEdit = new TextEdit;
- textEdit->show();
-
- return app.exec();
-} \ No newline at end of file
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-imagedrop/textedit.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-imagedrop/textedit.cpp
deleted file mode 100644
index a0392cc94..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-imagedrop/textedit.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "textedit.h"
-#include <QtWidgets>
-
-TextEdit::TextEdit(QWidget *parent)
- : QTextEdit(parent)
-{
-}
-
-//! [0]
-
-def canInsertFromMimeData(source):
- if source.hasImage:
- return True
- else:
- return QTextEdit.canInsertFromMimeData(source)
-
-//! [0]
-
-//! [1]
-void TextEdit::insertFromMimeData( const QMimeData *source )
-{
- if (source->hasImage())
- {
- QImage image = qvariant_cast<QImage>(source->imageData());
- QTextCursor cursor = this->textCursor();
- QTextDocument *document = this->document();
- document->addResource(QTextDocument::ImageResource, QUrl("image"), image);
- cursor.insertImage("image");
- }
-}
-//! [1]
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-imageformat/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-imageformat/main.cpp
deleted file mode 100644
index 5b59a20ec..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-imageformat/main.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-QString tr(const char *text)
-{
- return QApplication::translate(text, text);
-}
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- QTextEdit *editor = new QTextEdit;
-
- QTextDocument *document = new QTextDocument(editor);
- QTextCursor cursor(document);
-
- QTextImageFormat imageFormat;
- imageFormat.setName(":/images/advert.png");
- cursor.insertImage(imageFormat);
-
- QTextBlock block = cursor.block();
- QTextFragment fragment;
- QTextBlock::iterator it;
-
- for (it = block.begin(); !(it.atEnd()); ++it) {
- fragment = it.fragment();
-
- if (fragment.contains(cursor.position()))
- break;
- }
-
-//! [0]
- if (fragment.isValid()) {
- QTextImageFormat newImageFormat = fragment.charFormat().toImageFormat();
-
- if (newImageFormat.isValid()) {
- newImageFormat.setName(":/images/newimage.png");
- QTextCursor helper = cursor;
-
- helper.setPosition(fragment.position());
- helper.setPosition(fragment.position() + fragment.length(),
- QTextCursor::KeepAnchor);
- helper.setCharFormat(newImageFormat);
-//! [0] //! [1]
- }
-//! [1] //! [2]
- }
-//! [2]
-
- cursor.insertBlock();
- cursor.insertText("Code less. Create more.");
-
- editor->setDocument(document);
- editor->setWindowTitle(tr("Text Document Image Format"));
- editor->resize(320, 480);
- editor->show();
-
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-images/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-images/main.cpp
deleted file mode 100644
index f60ba32e1..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-images/main.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-QString tr(const char *text)
-{
- return QApplication::translate(text, text);
-}
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- QTextEdit *editor = new QTextEdit;
-
-//! [0]
- QTextDocument *document = new QTextDocument(editor);
- QTextCursor cursor(document);
-//! [0]
-
-//! [1]
- QTextImageFormat imageFormat;
- imageFormat.setName(":/images/advert.png");
- cursor.insertImage(imageFormat);
-//! [1]
-
- cursor.insertBlock();
- cursor.insertText("Code less. Create more.");
-
- editor->setDocument(document);
- editor->setWindowTitle(tr("Text Document Images"));
- editor->resize(320, 480);
- editor->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-listitems/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-listitems/main.cpp
deleted file mode 100644
index 42d8bc990..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-listitems/main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- MainWindow *window = new MainWindow;
- window->resize(640, 480);
- window->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-listitems/mainwindow.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-listitems/mainwindow.cpp
deleted file mode 100644
index 55f4a8655..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-listitems/mainwindow.cpp
+++ /dev/null
@@ -1,207 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-
-MainWindow::MainWindow()
-{
- QMenu *fileMenu = new QMenu(tr("&File"));
-
- fileMenu->addAction(tr("E&xit"), this, SLOT(close()),
- QKeySequence(tr("Ctrl+Q", "File|Exit")));
-
- QMenu *actionsMenu = new QMenu(tr("&Actions"));
- actionsMenu->addAction(tr("&Highlight List Items"),
- this, SLOT(highlightListItems()));
- actionsMenu->addAction(tr("&Show Current List"), this, SLOT(showList()));
-
- QMenu *insertMenu = new QMenu(tr("&Insert"));
-
- insertMenu->addAction(tr("&List"), this, SLOT(insertList()),
- QKeySequence(tr("Ctrl+L", "Insert|List")));
-
- menuBar()->addMenu(fileMenu);
- menuBar()->addMenu(insertMenu);
- menuBar()->addMenu(actionsMenu);
-
- editor = new QTextEdit(this);
- document = new QTextDocument(this);
- editor->setDocument(document);
-
- setCentralWidget(editor);
- setWindowTitle(tr("Text Document List Items"));
-}
-
-void MainWindow::highlightListItems()
-{
- QTextCursor cursor = editor->textCursor();
- QTextList *list = cursor.currentList();
-
- if (!list)
- return;
-
- cursor.beginEditBlock();
-//! [0]
- for (int index = 0; index < list->count(); ++index) {
- QTextBlock listItem = list->item(index);
-//! [0]
- QTextBlockFormat newBlockFormat = listItem.blockFormat();
- newBlockFormat.setBackground(Qt::lightGray);
- QTextCursor itemCursor = cursor;
- itemCursor.setPosition(listItem.position());
- //itemCursor.movePosition(QTextCursor::StartOfBlock);
- itemCursor.movePosition(QTextCursor::EndOfBlock,
- QTextCursor::KeepAnchor);
- itemCursor.setBlockFormat(newBlockFormat);
- /*
-//! [1]
- processListItem(listItem);
-//! [1]
- */
-//! [2]
- }
-//! [2]
- cursor.endEditBlock();
-}
-
-void MainWindow::showList()
-{
- QTextCursor cursor = editor->textCursor();
- QTextFrame *frame = cursor.currentFrame();
-
- if (!frame)
- return;
-
- QTreeWidget *treeWidget = new QTreeWidget;
- treeWidget->setColumnCount(1);
- QStringList headerLabels;
- headerLabels << tr("Lists");
- treeWidget->setHeaderLabels(headerLabels);
-
- QTreeWidgetItem *parentItem = 0;
- QTreeWidgetItem *item;
- QTreeWidgetItem *lastItem = 0;
- parentItems.clear();
- previousItems.clear();
-
-//! [3]
- QTextFrame::iterator it;
- for (it = frame->begin(); !(it.atEnd()); ++it) {
-
- QTextBlock block = it.currentBlock();
-
- if (block.isValid()) {
-
- QTextList *list = block.textList();
-
- if (list) {
- int index = list->itemNumber(block);
-//! [3]
- if (index == 0) {
- parentItems.append(parentItem);
- previousItems.append(lastItem);
- listStructures.append(list);
- parentItem = lastItem;
- lastItem = 0;
-
- if (parentItem != 0)
- item = new QTreeWidgetItem(parentItem, lastItem);
- else
- item = new QTreeWidgetItem(treeWidget, lastItem);
-
- } else {
-
- while (parentItem != 0 && listStructures.last() != list) {
- listStructures.pop_back();
- parentItem = parentItems.takeLast();
- lastItem = previousItems.takeLast();
- }
- if (parentItem != 0)
- item = new QTreeWidgetItem(parentItem, lastItem);
- else
- item = new QTreeWidgetItem(treeWidget, lastItem);
- }
- item->setText(0, block.text());
- lastItem = item;
- /*
-//! [4]
- processListItem(list, index);
-//! [4]
- */
-//! [5]
- }
-//! [5] //! [6]
- }
-//! [6] //! [7]
- }
-//! [7]
-
- treeWidget->setWindowTitle(tr("List Contents"));
- treeWidget->show();
-}
-
-void MainWindow::insertList()
-{
- QTextCursor cursor = editor->textCursor();
- cursor.beginEditBlock();
-
- QTextList *list = cursor.currentList();
- QTextListFormat listFormat;
- if (list)
- listFormat = list->format();
-
- listFormat.setStyle(QTextListFormat::ListDisc);
- listFormat.setIndent(listFormat.indent() + 1);
- cursor.insertList(listFormat);
-
- cursor.endEditBlock();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-lists/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-lists/main.cpp
deleted file mode 100644
index 42d8bc990..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-lists/main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- MainWindow *window = new MainWindow;
- window->resize(640, 480);
- window->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-lists/mainwindow.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-lists/mainwindow.cpp
deleted file mode 100644
index 45f1ae8e0..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-lists/mainwindow.cpp
+++ /dev/null
@@ -1,201 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-
-MainWindow::MainWindow()
-{
- QMenu *fileMenu = new QMenu(tr("&File"));
-
- fileMenu->addAction(tr("E&xit"), this, SLOT(close()),
- QKeySequence(tr("Ctrl+Q", "File|Exit")));
-
- QMenu *editMenu = new QMenu(tr("&Edit"));
-
- cutAction = editMenu->addAction(tr("Cu&t"), this, SLOT(cutSelection()),
- QKeySequence(tr("Ctrl+X", "Edit|Cut")));
- copyAction = editMenu->addAction(tr("&Copy"), this, SLOT(copySelection()),
- QKeySequence(tr("Ctrl+C", "Edit|Copy")));
- pasteAction = editMenu->addAction(tr("&Paste"), this,
- SLOT(pasteSelection()), QKeySequence(tr("Ctrl+V", "Edit|Paste")));
-
- QMenu *selectMenu = new QMenu(tr("&Select"));
- selectMenu->addAction(tr("&Word"), this, SLOT(selectWord()));
- selectMenu->addAction(tr("&Line"), this, SLOT(selectLine()));
- selectMenu->addAction(tr("&Block"), this, SLOT(selectBlock()));
- selectMenu->addAction(tr("&Frame"), this, SLOT(selectFrame()));
-
- QMenu *insertMenu = new QMenu(tr("&Insert"));
-
- insertMenu->addAction(tr("&List"), this, SLOT(insertList()),
- QKeySequence(tr("Ctrl+L", "Insert|List")));
-
- menuBar()->addMenu(fileMenu);
- menuBar()->addMenu(editMenu);
- menuBar()->addMenu(selectMenu);
- menuBar()->addMenu(insertMenu);
-
- editor = new QTextEdit(this);
- document = new QTextDocument(this);
- editor->setDocument(document);
-
- connect(editor, SIGNAL(selectionChanged()), this, SLOT(updateMenus()));
-
- updateMenus();
-
- setCentralWidget(editor);
- setWindowTitle(tr("Text Document Writer"));
-}
-
-void MainWindow::cutSelection()
-{
- QTextCursor cursor = editor->textCursor();
- if (cursor.hasSelection()) {
- selection = cursor.selection();
- cursor.removeSelectedText();
- }
-}
-
-void MainWindow::copySelection()
-{
- QTextCursor cursor = editor->textCursor();
- if (cursor.hasSelection()) {
- selection = cursor.selection();
- cursor.clearSelection();
- }
-}
-
-void MainWindow::pasteSelection()
-{
- QTextCursor cursor = editor->textCursor();
- cursor.insertFragment(selection);
-}
-
-void MainWindow::selectWord()
-{
- QTextCursor cursor = editor->textCursor();
- QTextBlock block = cursor.block();
-
- cursor.beginEditBlock();
- cursor.movePosition(QTextCursor::StartOfWord);
- cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor);
- cursor.endEditBlock();
-
- editor->setTextCursor(cursor);
-}
-
-void MainWindow::selectLine()
-{
- QTextCursor cursor = editor->textCursor();
- QTextBlock block = cursor.block();
-
- cursor.beginEditBlock();
- cursor.movePosition(QTextCursor::StartOfLine);
- cursor.movePosition(QTextCursor::EndOfLine, QTextCursor::KeepAnchor);
- cursor.endEditBlock();
-
- editor->setTextCursor(cursor);
-}
-
-void MainWindow::selectBlock()
-{
- QTextCursor cursor = editor->textCursor();
- QTextBlock block = cursor.block();
-
- cursor.beginEditBlock();
- cursor.movePosition(QTextCursor::StartOfBlock);
- cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
- cursor.endEditBlock();
-
- editor->setTextCursor(cursor);
-}
-
-void MainWindow::selectFrame()
-{
- QTextCursor cursor = editor->textCursor();
- QTextFrame *frame = cursor.currentFrame();
-
- cursor.beginEditBlock();
- cursor.setPosition(frame->firstPosition());
- cursor.setPosition(frame->lastPosition(), QTextCursor::KeepAnchor);
- cursor.endEditBlock();
-
- editor->setTextCursor(cursor);
-}
-
-void MainWindow::insertList()
-{
- QTextCursor cursor = editor->textCursor();
- cursor.beginEditBlock();
-
- QTextList *list = cursor.currentList();
-//! [0]
- listFormat = QTextListFormat()
- if list:
- listFormat = list.format()
- listFormat.setIndent(listFormat.indent() + 1)
-
- listFormat.setStyle(QTextListFormat.ListDisc)
- cursor.insertList(listFormat)
-//! [0]
-
- cursor.endEditBlock();
-}
-
-void MainWindow::updateMenus()
-{
- QTextCursor cursor = editor->textCursor();
- cutAction->setEnabled(cursor.hasSelection());
- copyAction->setEnabled(cursor.hasSelection());
-
- pasteAction->setEnabled(!selection.isEmpty());
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-printing/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-printing/main.cpp
deleted file mode 100644
index 42d8bc990..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-printing/main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- MainWindow *window = new MainWindow;
- window->resize(640, 480);
- window->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-printing/mainwindow.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-printing/mainwindow.cpp
deleted file mode 100644
index b5ce5df5e..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-printing/mainwindow.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-
-MainWindow::MainWindow()
-{
- QMenu *fileMenu = new QMenu(tr("&File"));
-
- fileMenu->addAction(tr("&Open..."), this, SLOT(openFile()),
- QKeySequence(tr("Ctrl+O", "File|Open")));
-
- printAction = fileMenu->addAction(tr("&Print..."), this, SLOT(printFile()));
- printAction->setEnabled(false);
-
- pdfPrintAction = fileMenu->addAction(tr("Print as P&DF..."), this, SLOT(printPdf()));
- pdfPrintAction->setEnabled(false);
-
- fileMenu->addAction(tr("E&xit"), this, SLOT(close()),
- QKeySequence(tr("Ctrl+Q", "File|Exit")));
-
- menuBar()->addMenu(fileMenu);
-
- editor = new QTextEdit(this);
- document = new QTextDocument(this);
- editor->setDocument(document);
-
- connect(editor, SIGNAL(selectionChanged()), this, SLOT(updateMenus()));
-
- setCentralWidget(editor);
- setWindowTitle(tr("Text Document Writer"));
-}
-
-void MainWindow::openFile()
-{
- QString fileName = QFileDialog::getOpenFileName(this,
- tr("Open file"), currentFile, "HTML files (*.html);;Text files (*.txt)");
-
- if (!fileName.isEmpty()) {
- QFileInfo info(fileName);
- if (info.completeSuffix() == "html") {
- QFile file(fileName);
-
- if (file.open(QIODevice::ReadOnly)) {
- editor->setHtml(file.readAll());
- file.close();
- currentFile = fileName;
- }
- } else if (info.completeSuffix() == "txt") {
- QFile file(fileName);
-
- if (file.open(QIODevice::ReadOnly)) {
- editor->setPlainText(file.readAll());
- file.close();
- currentFile = fileName;
- }
- }
- printAction->setEnabled(true);
- pdfPrintAction->setEnabled(true);
- }
-}
-
-void MainWindow::printFile()
-{
-//! [0]
- QTextDocument *document = editor->document();
- QPrinter printer;
-
- QPrintDialog *dlg = new QPrintDialog(&printer, this);
- if (dlg->exec() != QDialog::Accepted)
- return;
-
- document->print(&printer);
-//! [0]
-}
-
-void MainWindow::printPdf()
-{
- QPrinter printer(QPrinter::HighResolution);
- printer.setOutputFormat(QPrinter::PdfFormat);
-
- QPrintDialog *printDialog = new QPrintDialog(&printer, this);
- if (printDialog->exec() == QDialog::Accepted)
- editor->document()->print(&printer);
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-selections/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-selections/main.cpp
deleted file mode 100644
index 42d8bc990..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-selections/main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- MainWindow *window = new MainWindow;
- window->resize(640, 480);
- window->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-selections/mainwindow.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-selections/mainwindow.cpp
deleted file mode 100644
index 847dafe76..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-selections/mainwindow.cpp
+++ /dev/null
@@ -1,213 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-
-MainWindow::MainWindow()
-{
- QMenu *fileMenu = new QMenu(tr("&File"));
-
- fileMenu->addAction(tr("&Open..."), this, SLOT(openFile()),
- QKeySequence(tr("Ctrl+O", "File|Open")));
-
- QAction *quitAction = fileMenu->addAction(tr("E&xit"), this, SLOT(close()));
- quitAction->setShortcut(tr("Ctrl+Q"));
-
- QMenu *editMenu = new QMenu(tr("&Edit"));
-
- cutAction = editMenu->addAction(tr("Cu&t"), this, SLOT(cutSelection()));
- cutAction->setShortcut(tr("Ctrl+X"));
- cutAction->setEnabled(false);
-
- copyAction = editMenu->addAction(tr("&Copy"), this, SLOT(copySelection()));
- copyAction->setShortcut(tr("Ctrl+C"));
- copyAction->setEnabled(false);
-
- pasteAction = editMenu->addAction(tr("&Paste"), this, SLOT(pasteSelection()));
- pasteAction->setShortcut(tr("Ctrl+V"));
- pasteAction->setEnabled(false);
-
- QMenu *selectMenu = new QMenu(tr("&Select"));
- selectMenu->addAction(tr("&Word"), this, SLOT(selectWord()));
- selectMenu->addAction(tr("&Line"), this, SLOT(selectLine()));
- selectMenu->addAction(tr("&Block"), this, SLOT(selectBlock()));
- selectMenu->addAction(tr("&Frame"), this, SLOT(selectFrame()));
-
- menuBar()->addMenu(fileMenu);
- menuBar()->addMenu(editMenu);
- menuBar()->addMenu(selectMenu);
-
- editor = new QTextEdit(this);
- document = new QTextDocument(this);
- editor->setDocument(document);
-
- connect(editor, SIGNAL(selectionChanged()), this, SLOT(updateMenus()));
-
- setCentralWidget(editor);
- setWindowTitle(tr("Text Document Writer"));
-}
-
-void MainWindow::openFile()
-{
- QString fileName = QFileDialog::getOpenFileName(this,
- tr("Open file"), currentFile, "HTML files (*.html);;Text files (*.txt)");
-
- if (!fileName.isEmpty()) {
- QFileInfo info(fileName);
- if (info.completeSuffix() == "html") {
- QFile file(fileName);
-
- if (file.open(QFile::ReadOnly)) {
- editor->setHtml(QString(file.readAll()));
- file.close();
- currentFile = fileName;
- }
- } else if (info.completeSuffix() == "txt") {
- QFile file(fileName);
-
- if (file.open(QFile::ReadOnly)) {
- editor->setPlainText(file.readAll());
- file.close();
- currentFile = fileName;
- }
- }
- }
-}
-
-void MainWindow::cutSelection()
-{
- QTextCursor cursor = editor->textCursor();
- if (cursor.hasSelection()) {
- selection = cursor.selection();
- cursor.removeSelectedText();
- }
-}
-
-void MainWindow::copySelection()
-{
- QTextCursor cursor = editor->textCursor();
- if (cursor.hasSelection()) {
- selection = cursor.selection();
- cursor.clearSelection();
- }
-}
-
-void MainWindow::pasteSelection()
-{
- QTextCursor cursor = editor->textCursor();
- cursor.insertFragment(selection);
-}
-
-void MainWindow::selectWord()
-{
- QTextCursor cursor = editor->textCursor();
- QTextBlock block = cursor.block();
-
-//! [0]
- cursor.beginEditBlock();
-//! [1]
- cursor.movePosition(QTextCursor::StartOfWord);
- cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor);
-//! [1]
- cursor.endEditBlock();
-//! [0]
-
- editor->setTextCursor(cursor);
-}
-
-void MainWindow::selectLine()
-{
- QTextCursor cursor = editor->textCursor();
- QTextBlock block = cursor.block();
-
- cursor.beginEditBlock();
- cursor.movePosition(QTextCursor::StartOfLine);
- cursor.movePosition(QTextCursor::EndOfLine, QTextCursor::KeepAnchor);
- cursor.endEditBlock();
-
- editor->setTextCursor(cursor);
-}
-
-void MainWindow::selectBlock()
-{
- QTextCursor cursor = editor->textCursor();
- QTextBlock block = cursor.block();
-
- cursor.beginEditBlock();
- cursor.movePosition(QTextCursor::StartOfBlock);
- cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
- cursor.endEditBlock();
-
- editor->setTextCursor(cursor);
-}
-
-void MainWindow::selectFrame()
-{
- QTextCursor cursor = editor->textCursor();
- QTextFrame *frame = cursor.currentFrame();
-
- cursor.beginEditBlock();
- cursor.setPosition(frame->firstPosition());
- cursor.setPosition(frame->lastPosition(), QTextCursor::KeepAnchor);
- cursor.endEditBlock();
-
- editor->setTextCursor(cursor);
-}
-
-void MainWindow::updateMenus()
-{
- QTextCursor cursor = editor->textCursor();
- cutAction->setEnabled(cursor.hasSelection());
- copyAction->setEnabled(cursor.hasSelection());
-
- pasteAction->setEnabled(!selection.isEmpty());
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-tables/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-tables/main.cpp
deleted file mode 100644
index b9a13a851..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-tables/main.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "mainwindow.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- MainWindow *window = new MainWindow;
- window->resize(480, 480);
- window->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-tables/xmlwriter.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-tables/xmlwriter.cpp
deleted file mode 100644
index b7eca8a8a..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-tables/xmlwriter.cpp
+++ /dev/null
@@ -1,163 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "xmlwriter.h"
-
-QDomDocument *XmlWriter::toXml()
-{
- QDomImplementation implementation;
- QDomDocumentType docType = implementation.createDocumentType(
- "scribe-document", "scribe", "qtsoftware.com/scribe");
-
- document = new QDomDocument(docType);
-
- // ### This processing instruction is required to ensure that any kind
- // of encoding is given when the document is written.
- QDomProcessingInstruction process = document->createProcessingInstruction(
- "xml", "version=\"1.0\" encoding=\"utf-8\"");
- document->appendChild(process);
-
- QDomElement documentElement = document->createElement("document");
- document->appendChild(documentElement);
-
- QTextFrame *root = textDocument->rootFrame();
-
- if (root)
- processFrame(documentElement, root);
-
- return document;
-}
-
-void XmlWriter::processBlock(QDomElement &parent, const QTextBlock &block)
-{
- QDomElement blockElement = document->createElement("block");
- blockElement.setAttribute("position", block.position());
- blockElement.setAttribute("length", block.length());
- parent.appendChild(blockElement);
-
- QTextBlock::iterator it;
- for (it = block.begin(); !(it.atEnd()); ++it) {
- QTextFragment fragment = it.fragment();
-
- if (fragment.isValid()) {
- QDomElement fragmentElement = document->createElement("fragment");
- blockElement.appendChild(fragmentElement);
-
- fragmentElement.setAttribute("length", fragment.length());
- QDomText fragmentText = document->createTextNode(fragment.text());
-
- fragmentElement.appendChild(fragmentText);
- }
- }
-}
-
-void XmlWriter::processFrame(QDomElement &parent, QTextFrame *frame)
-{
- QDomElement frameElement = document->createElement("frame");
- frameElement.setAttribute("begin", frame->firstPosition());
- frameElement.setAttribute("end", frame->lastPosition());
- parent.appendChild(frameElement);
-
-//! [0]
- QTextFrame::iterator it;
- for (it = frame->begin(); !(it.atEnd()); ++it) {
-
- QTextFrame *childFrame = it.currentFrame();
- QTextBlock childBlock = it.currentBlock();
-
- if (childFrame) {
- QTextTable *childTable = qobject_cast<QTextTable*>(childFrame);
-
- if (childTable)
- processTable(frameElement, childTable);
- else
- processFrame(frameElement, childFrame);
-
- } else if (childBlock.isValid())
-//! [0] //! [1]
- processBlock(frameElement, childBlock);
- }
-//! [1]
-}
-
-void XmlWriter::processTable(QDomElement &parent, QTextTable *table)
-{
- QDomElement element = document->createElement("table");
-
- for (int row = 0; row < table->rows(); ++row) {
- for (int column = 0; column < table->columns(); ++column) {
- QTextTableCell cell = table->cellAt(row, column);
- processTableCell(element, cell);
- }
- }
- parent.appendChild(element);
-}
-
-void XmlWriter::processTableCell(QDomElement &parent, const QTextTableCell &cell)
-{
- QDomElement element = document->createElement("cell");
- element.setAttribute("row", cell.row());
- element.setAttribute("column", cell.column());
-
- QTextFrame::iterator it;
- for (it = cell.begin(); !(it.atEnd()); ++it) {
-
- QTextFrame *childFrame = it.currentFrame();
- QTextBlock childBlock = it.currentBlock();
-
- if (childFrame)
- processFrame(element, childFrame);
- else if (childBlock.isValid())
- processBlock(element, childBlock);
- }
- parent.appendChild(element);
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocumentendsnippet.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocumentendsnippet.cpp
deleted file mode 100644
index c73013439..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/textdocumentendsnippet.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-#include <iostream.h>
-
-int main(int argv, char **args)
-{
- QString contentString("One\nTwp\nThree");
-
- QTextDocument *doc = new QTextDocument(contentString);
-
-//! [0]
- it = doc.begin()
- while it != doc.end():
- print it.text()
- it = it.next()
-//! [0]
-
- return 0;
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/threads/threads.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/threads/threads.cpp
deleted file mode 100644
index bc31e0f08..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/threads/threads.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QCache>
-#include <QMutex>
-#include <QThreadStorage>
-
-#include "threads.h"
-
-//! [0]
-void MyThread::run()
-//! [0] //! [1]
-{
-//! [1] //! [2]
-}
-//! [2]
-
-#define Counter ReentrantCounter
-
-//! [3]
-class Counter
-//! [3] //! [4]
-{
-public:
- Counter() { n = 0; }
-
- void increment() { ++n; }
- void decrement() { --n; }
- int value() const { return n; }
-
-private:
- int n;
-};
-//! [4]
-
-#undef Counter
-#define Counter ThreadSafeCounter
-
-//! [5]
-class Counter
-//! [5] //! [6]
-{
-public:
- Counter() { n = 0; }
-
- void increment() { QMutexLocker locker(&mutex); ++n; }
- void decrement() { QMutexLocker locker(&mutex); --n; }
- int value() const { QMutexLocker locker(&mutex); return n; }
-
-private:
- mutable QMutex mutex;
- int n;
-};
-//! [6]
-
-typedef int SomeClass;
-
-//! [7]
-QThreadStorage<QCache<QString, SomeClass> *> caches;
-
-void cacheObject(const QString &key, SomeClass *object)
-//! [7] //! [8]
-{
- if (!caches.hasLocalData())
- caches.setLocalData(new QCache<QString, SomeClass>);
-
- caches.localData()->insert(key, object);
-}
-
-void removeFromCache(const QString &key)
-//! [8] //! [9]
-{
- if (!caches.hasLocalData())
- return;
-
- caches.localData()->remove(key);
-}
-//! [9]
-
-int main()
-{
- return 0;
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/timeline/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/timeline/main.cpp
deleted file mode 100644
index 22e7b515c..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/timeline/main.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-#include <math.h>
-
-int main(int argv, char *args[])
-{
- QApplication app(argv, args)
-
-//! [0]
- ball = QGraphicsEllipseItem(0, 0, 20, 20)
-
- timer = QTimeLine(5000)
- timer.setFrameRange(0, 100)
-
- animation = QGraphicsItemAnimation()
- animation.setItem(ball)
- animation.setTimeLine(timer)
-
- for i in range(200):
- animation.setPosAt(i / 200.0, QPointF(i, i))
-
- scene = QGraphicsScene()
- scene.setSceneRect(0, 0, 250, 250)
- scene.addItem(ball)
-
- view = QGraphicsView(scene)
- view.show()
-
- timer.start()
-//! [0]
-
- return app.exec()
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/uitools/calculatorform/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/uitools/calculatorform/main.cpp
deleted file mode 100644
index 3545412a4..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/uitools/calculatorform/main.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-#include "ui_calculatorform.h"
-//! [0]
-#include <QApplication>
-
-//! [1]
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- QWidget *widget = new QWidget;
- Ui::CalculatorForm ui;
- ui.setupUi(widget);
-
- widget->show();
- return app.exec();
-}
-//! [1]
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/updating-selections/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/updating-selections/main.cpp
deleted file mode 100644
index 3ae4962ad..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/updating-selections/main.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*
- main.cpp
-
- A simple example that shows how selections can be used directly on a model.
- It shows the result of some selections made using a table view.
-*/
-
-#include <QApplication>
-
-#include "window.h"
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- QMainWindow *window = new MainWindow;
- window->show();
- window->resize(640, 480);
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/updating-selections/window.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/updating-selections/window.cpp
deleted file mode 100644
index bba70c647..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/updating-selections/window.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*
- window.cpp
-
- A minimal subclass of QTableView with slots to allow the selection model
- to be monitored.
-*/
-
-#include <QAbstractItemModel>
-#include <QItemSelection>
-#include <QItemSelectionModel>
-#include <QStatusBar>
-
-#include "model.h"
-#include "window.h"
-
-MainWindow::MainWindow(QWidget *parent)
- : QMainWindow(parent)
-{
- setWindowTitle("Selected items in a table model");
-
- model = new TableModel(8, 4, this);
-
- table = new QTableView(this);
- table->setModel(model);
-
- selectionModel = table->selectionModel();
- connect(selectionModel,
- SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
- this, SLOT(updateSelection(const QItemSelection &, const QItemSelection &)));
- connect(selectionModel,
- SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
- this, SLOT(changeCurrent(const QModelIndex &, const QModelIndex &)));
-
- statusBar();
- setCentralWidget(table);
-}
-
-//! [0]
-void MainWindow::updateSelection(const QItemSelection &selected,
- const QItemSelection &deselected)
-{
- QModelIndex index;
- QModelIndexList items = selected.indexes();
-
- foreach (index, items) {
- QString text = QString("(%1,%2)").arg(index.row()).arg(index.column());
- model->setData(index, text);
-//! [0] //! [1]
- }
-//! [1]
-
-//! [2]
- items = deselected.indexes();
-
- foreach (index, items)
- model->setData(index, "");
-}
-//! [2]
-
-//! [3]
-void MainWindow::changeCurrent(const QModelIndex &current,
- const QModelIndex &previous)
-{
- statusBar()->showMessage(
- tr("Moved from (%1,%2) to (%3,%4)")
- .arg(previous.row()).arg(previous.column())
- .arg(current.row()).arg(current.column()));
-}
-//! [3]
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/webkit/webpage/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/webkit/webpage/main.cpp
deleted file mode 100644
index 3d4784804..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/webkit/webpage/main.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-from PySide2.QtGui import *
-from PySide2.QWebKit import QWebPage
-from PySide2.QWebKit import QWebFrame
-
-
-//! [0]
-class Thumbnailer(QObject):
- page = QWebPage()
-//! [1]
- def __init__(self, url):
- page.mainFrame().load(url)
- connect(page, SIGNAL("loadFinished(bool)"),
- self, SLOT("render()"))
-//! [1]
-
-//! [2]
- def render(self):
- page.setViewportSize(page.mainFrame().contentsSize())
- image = QImage(page.viewportSize(), QImage.Format_ARGB32)
- painter = QPainter(image)
-
- page.mainFrame().render(painter)
- painter.end()
-
- thumbnail = image.scaled(400, 400)
- thumbnail.save("thumbnail.png")
-
- self.finished()
-//! [2]
-
-//! [0]
-
-def main():
- app = QApplication([])
- thumbnail = Thumbnailer(QUrl("http://qtsoftware.com"))
- QObject.connect(thumbnail, SIGNAL("finished()"),
- app, SLOT("quit()"))
-
- return app.exec_()
-
-
-
-#include "main.moc"
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/widget-mask/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/widget-mask/main.cpp
deleted file mode 100644
index f875eab00..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/widget-mask/main.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-//! [0]
- QLabel topLevelLabel;
- QPixmap pixmap(":/images/tux.png");
- topLevelLabel.setPixmap(pixmap);
- topLevelLabel.setMask(pixmap.mask());
-//! [0]
- topLevelLabel.show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/widgets-tutorial/childwidget/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/widgets-tutorial/childwidget/main.cpp
deleted file mode 100644
index 4b7854800..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/widgets-tutorial/childwidget/main.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- QWidget *window = new QWidget();
- window->resize(320, 240);
- window->setWindowTitle(tr("Child widget"));
- window->show();
-
-//! [create, position and show]
- QPushButton *button = new QPushButton(tr("Press me"), window);
- button->move(100, 100);
- button->show();
-//! [create, position and show]
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/widgets-tutorial/nestedlayouts/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/widgets-tutorial/nestedlayouts/main.cpp
deleted file mode 100644
index aae4d4d7f..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/widgets-tutorial/nestedlayouts/main.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- QWidget *window = new QWidget();
-//! [create, lay out widgets and show]
- QLabel *queryLabel = new QLabel(tr("Query:"));
- QLineEdit *queryEdit = new QLineEdit();
- QTableView *resultView = new QTableView();
-
- QHBoxLayout *queryLayout = new QHBoxLayout();
- queryLayout->addWidget(queryLabel);
- queryLayout->addWidget(queryEdit);
-
- QVBoxLayout *mainLayout = new QVBoxLayout();
- mainLayout->addLayout(queryLayout);
- mainLayout->addWidget(resultView);
- window->setLayout(mainLayout);
-//! [create, lay out widgets and show]
-
- QStandardItemModel model;
- model.setHorizontalHeaderLabels(QStringList() << tr("Name") << tr("Office"));
- QList<QStringList> rows = QList<QStringList>()
- << (QStringList() << "Verne Nilsen" << "123")
- << (QStringList() << "Carlos Tang" << "77")
- << (QStringList() << "Bronwyn Hawcroft" << "119")
- << (QStringList() << "Alessandro Hanssen" << "32")
- << (QStringList() << "Andrew John Bakken" << "54")
- << (QStringList() << "Vanessa Weatherley" << "85")
- << (QStringList() << "Rebecca Dickens" << "17")
- << (QStringList() << "David Bradley" << "42")
- << (QStringList() << "Knut Walters" << "25")
- << (QStringList() << "Andrea Jones" << "34");
- foreach (QStringList row, rows) {
- QList<QStandardItem *> items;
- foreach (QString text, row)
- items.append(new QStandardItem(text));
- model.appendRow(items);
- }
-
- resultView->setModel(&model);
- resultView->verticalHeader()->hide();
- resultView->horizontalHeader()->setStretchLastSection(true);
- window->setWindowTitle(tr("Nested layouts"));
- window->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/widgets-tutorial/toplevel/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/widgets-tutorial/toplevel/main.cpp
deleted file mode 100644
index de018bbea..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/widgets-tutorial/toplevel/main.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-//! [create, resize and show]
- QWidget *window = new QWidget();
- window->resize(320, 240);
- window->show();
-//! [create, resize and show]
- window->setWindowTitle(tr("Top-level widget"));
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/widgets-tutorial/windowlayout/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/widgets-tutorial/windowlayout/main.cpp
deleted file mode 100644
index e5c6f86ed..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/widgets-tutorial/windowlayout/main.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- QWidget *window = new QWidget();
-//! [create, lay out widgets and show]
- QLabel *label = new QLabel(tr("Name:"));
- QLineEdit *lineEdit = new QLineEdit();
-
- QHBoxLayout *layout = new QHBoxLayout();
- layout->addWidget(label);
- layout->addWidget(lineEdit);
- window->setLayout(layout);
-//! [create, lay out widgets and show]
- window->setWindowTitle(tr("Window layout"));
- window->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/xml/rsslisting/handler.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/xml/rsslisting/handler.cpp
deleted file mode 100644
index ff08b4e55..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/xml/rsslisting/handler.cpp
+++ /dev/null
@@ -1,188 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*
-handler.cpp
-
-Provides a handler for processing XML elements found by the reader.
-
-The handler looks for <title> and <link> elements within <item> elements,
-and records the text found within them. Link information stored within
-rdf:about attributes of <item> elements is also recorded when it is
-available.
-
-For each item found, a signal is emitted which specifies its title and
-link information. This may be used by user interfaces for the purpose of
-displaying items as they are read.
-*/
-
-#include <QtWidgets>
-
-#include "handler.h"
-
-/*
- Reset the state of the handler to ensure that new documents are
- read correctly.
-
- We return true to indicate that parsing should continue.
-*/
-
-bool Handler::startDocument()
-{
- inItem = false;
- inTitle = false;
- inLink = false;
-
- return true;
-}
-
-/*
- Process each starting element in the XML document.
-
- Nested item, title, or link elements are not allowed, so we return false
- if we encounter any of these. We also prohibit multiple definitions of
- title strings.
-
- Link destinations are read by this function if they are specified as
- attributes in item elements.
-
- For all cases not explicitly checked for, we return true to indicate that
- the element is acceptable, and that parsing should continue. By doing
- this, we can ignore elements in which we are not interested.
-*/
-
-bool Handler::startElement(const QString &, const QString &,
- const QString & qName, const QXmlAttributes &attr)
-{
- if (qName == "item") {
-
- if (inItem)
- return false;
- else {
- inItem = true;
- linkString = attr.value("rdf:about");
- }
- }
- else if (qName == "title") {
-
- if (inTitle)
- return false;
- else if (!titleString.isEmpty())
- return false;
- else if (inItem)
- inTitle = true;
- }
- else if (qName == "link") {
-
- if (inLink)
- return false;
- else if (inItem)
- inLink = true;
- }
-
- return true;
-}
-
-/*
- Process each ending element in the XML document.
-
- For recognized elements, we reset flags to ensure that we can read new
- instances of these elements. If we have read an item element, emit a
- signal to indicate that a new item is available for display.
-
- We return true to indicate that parsing should continue.
-*/
-
-bool Handler::endElement(const QString &, const QString &,
- const QString & qName)
-{
- if (qName == "title" && inTitle)
- inTitle = false;
- else if (qName == "link" && inLink)
- inLink = false;
- else if (qName == "item") {
- if (!titleString.isEmpty() && !linkString.isEmpty())
- emit newItem(titleString, linkString);
- inItem = false;
- titleString = "";
- linkString = "";
- }
-
- return true;
-}
-
-/*
- Collect characters when reading the contents of title or link elements
- when they occur within an item element.
-
- We return true to indicate that parsing should continue.
-*/
-
-bool Handler::characters (const QString &chars)
-{
- if (inTitle)
- titleString += chars;
- else if (inLink)
- linkString += chars;
-
- return true;
-}
-
-/*
- Report a fatal parsing error, and return false to indicate to the reader
- that parsing should stop.
-*/
-
-//! [0]
-def fatalError(self, exception):
- qWarning("Fatal error on line %d, column %d:%s" % (exception.lineNumber(), exception.columnNumber(), exception.message())
-
- return False
-//! [0]
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/xml/rsslisting/main.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/xml/rsslisting/main.cpp
deleted file mode 100644
index 1f326d591..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/xml/rsslisting/main.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*
-main.cpp
-
-Provides the main function for the RSS news reader example.
-*/
-
-#include <QtWidgets>
-
-#include "rsslisting.h"
-
-/*!
- Create an application and a main widget. Open the main widget for
- user input, and exit with an appropriate return value when it is
- closed.
-*/
-
-int main(int argc, char **argv)
-{
- QApplication app(argc, argv);
- RSSListing *rsslisting = new RSSListing;
- rsslisting->show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/doc/src/snippets/xml/rsslisting/rsslisting.cpp b/sources/pyside2/doc/codesnippets/doc/src/snippets/xml/rsslisting/rsslisting.cpp
deleted file mode 100644
index b7fe2843f..000000000
--- a/sources/pyside2/doc/codesnippets/doc/src/snippets/xml/rsslisting/rsslisting.cpp
+++ /dev/null
@@ -1,255 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*
-rsslisting.cpp
-
-Provides a widget for displaying news items from RDF news sources.
-RDF is an XML-based format for storing items of information (see
-http://www.w3.org/RDF/ for details).
-
-The widget itself provides a simple user interface for specifying
-the URL of a news source, and controlling the downloading of news.
-
-The widget downloads and parses the XML asynchronously, feeding the
-data to an XML reader in pieces. This allows the user to interrupt
-its operation, and also allows very large data sources to be read.
-*/
-
-
-#include <QtCore>
-#include <QtWidgets>
-#include <QtNetwork>
-#include <QtXml>
-
-#include "rsslisting.h"
-
-
-/*
- Constructs an RSSListing widget with a simple user interface, and sets
- up the XML reader to use a custom handler class.
-
- The user interface consists of a line edit, two push buttons, and a
- list view widget. The line edit is used for entering the URLs of news
- sources; the push buttons start and abort the process of reading the
- news.
-*/
-
-RSSListing::RSSListing(QWidget *parent)
- : QWidget(parent)
-{
- lineEdit = new QLineEdit(this);
-
- fetchButton = new QPushButton(tr("Fetch"), this);
- abortButton = new QPushButton(tr("Abort"), this);
- abortButton->setEnabled(false);
-
- treeWidget = new QTreeWidget(this);
- QStringList headerLabels;
- headerLabels << tr("Title") << tr("Link");
- treeWidget->setHeaderLabels(headerLabels);
-
- handler = 0;
-
- connect(&http, SIGNAL(readyRead(const QHttpResponseHeader &)),
- this, SLOT(readData(const QHttpResponseHeader &)));
-
- connect(&http, SIGNAL(requestFinished(int, bool)),
- this, SLOT(finished(int, bool)));
-
- connect(lineEdit, SIGNAL(returnPressed()), this, SLOT(fetch()));
- connect(fetchButton, SIGNAL(clicked()), this, SLOT(fetch()));
- connect(abortButton, SIGNAL(clicked()), &http, SLOT(abort()));
-
- QVBoxLayout *layout = new QVBoxLayout(this);
-
- QHBoxLayout *hboxLayout = new QHBoxLayout;
-
- hboxLayout->addWidget(lineEdit);
- hboxLayout->addWidget(fetchButton);
- hboxLayout->addWidget(abortButton);
-
- layout->addLayout(hboxLayout);
- layout->addWidget(treeWidget);
-
- setWindowTitle(tr("RSS listing example"));
-}
-
-/*
- Starts fetching data from a news source specified in the line
- edit widget.
-
- The line edit is made read only to prevent the user from modifying its
- contents during the fetch; this is only for cosmetic purposes.
- The fetch button is disabled, and the abort button is enabled to allow
- the user to interrupt processing. The list view is cleared, and we
- define the last list view item to be 0, meaning that there are no
- existing items in the list.
-
- We reset the flag used to determine whether parsing should begin again
- or continue. A new handler is created, if required, and made available
- to the reader.
-
- The HTTP handler is supplied with the raw contents of the line edit and
- a fetch is initiated. We keep the ID value returned by the HTTP handler
- for future reference.
-*/
-
-void RSSListing::fetch()
-{
- lineEdit->setReadOnly(true);
- fetchButton->setEnabled(false);
- abortButton->setEnabled(true);
- treeWidget->clear();
-
- lastItemCreated = 0;
-
- newInformation = true;
-
- if (handler != 0)
- delete handler;
- handler = new Handler;
-
-//! [0]
- xmlReader.setContentHandler(handler)
- xmlReader.setErrorHandler(handler)
-//! [0]
-
- connect(handler, SIGNAL(newItem(QString &, QString &)),
- this, SLOT(addItem(QString &, QString &)));
-
- QUrl url(lineEdit->text());
-
- http.setHost(url.host());
- connectionId = http.get(url.path());
-}
-
-/*
- Reads data received from the RDF source.
-
- We read all the available data, and pass it to the XML
- input source. The first time we receive new information,
- the reader is set up for a new incremental parse;
- we continue parsing using a different function on
- subsequent calls involving the same data source.
-
- If parsing fails for any reason, we abort the fetch.
-*/
-
-//! [1]
-def readData(self, resp):
- if resp.statusCode() != 200:
- self.http.abort()
- else:
- xmlInput.setData(self.http.readAll())
-
- if newInformation:
- ok = xmlReader.parse(xmlInput, True)
- newInformation = False
- else:
- ok = xmlReader.parseContinue()
-
- if not ok:
- self.http.abort()
-//! [1]
-
-/*
- Finishes processing an HTTP request.
-
- The default behavior is to keep the text edit read only.
-
- If an error has occurred, the user interface is made available
- to the user for further input, allowing a new fetch to be
- started.
-
- If the HTTP get request has finished, we perform a final
- parsing operation on the data returned to ensure that it was
- well-formed. Whether this is successful or not, we make the
- user interface available to the user for further input.
-*/
-
-void RSSListing::finished(int id, bool error)
-{
- if (error) {
- qWarning("Received error during HTTP fetch.");
- lineEdit->setReadOnly(false);
- abortButton->setEnabled(false);
- fetchButton->setEnabled(true);
- }
- else if (id == connectionId) {
-
- bool ok = xmlReader.parseContinue();
- if (!ok)
- qWarning("Parse error at the end of input.");
-
- lineEdit->setReadOnly(false);
- abortButton->setEnabled(false);
- fetchButton->setEnabled(true);
- }
-}
-
-/*
- Adds an item to the list view as it is reported by the handler.
-
- We keep a record of the last item created to ensure that the
- items are created in sequence.
-*/
-
-void RSSListing::addItem(QString &title, QString &link)
-{
- QTreeWidgetItem *item;
-
- item = new QTreeWidgetItem(treeWidget, lastItemCreated);
- item->setText(0, title);
- item->setText(1, link);
-
- lastItemCreated = item;
-}
-
diff --git a/sources/pyside2/doc/codesnippets/examples/dialogs/classwizard/main.cpp b/sources/pyside2/doc/codesnippets/examples/dialogs/classwizard/main.cpp
deleted file mode 100644
index 9e9566d37..000000000
--- a/sources/pyside2/doc/codesnippets/examples/dialogs/classwizard/main.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QTranslator>
-#include <QLocale>
-#include <QLibraryInfo>
-
-#include "classwizard.h"
-
-int main(int argc, char *argv[])
-{
- Q_INIT_RESOURCE(classwizard);
-
- QApplication app(argc, argv);
-
- QString translatorFileName = QLatin1String("qt_");
- translatorFileName += QLocale::system().name();
- QTranslator *translator = new QTranslator(&app);
- if (translator->load(translatorFileName, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
- app.installTranslator(translator);
-
- ClassWizard wizard;
- wizard.show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/examples/dialogs/licensewizard/licensewizard.cpp b/sources/pyside2/doc/codesnippets/examples/dialogs/licensewizard/licensewizard.cpp
deleted file mode 100644
index 453dac773..000000000
--- a/sources/pyside2/doc/codesnippets/examples/dialogs/licensewizard/licensewizard.cpp
+++ /dev/null
@@ -1,358 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "licensewizard.h"
-
-//! [0] //! [1] //! [2]
-# class LicenseWizard
-def __init__(self, parent)
- QWizard(self, parent)
-//! [0]
- self.setPage(self.Page_Intro, IntroPage())
- self.setPage(self.Page_Evaluate, EvaluatePage())
- self.setPage(self.Page_Register, RegisterPage())
- self.setPage(self.Page_Details, DetailsPage())
- self.setPage(self.Page_Conclusion, ConclusionPage())
-//! [1]
-
- self.setStartId(self.Page_Intro);
-//! [2]
-
-//! [3]
-
-//! [3] //! [4]
- self.setWizardStyle(QWizard.ModernStyle);
-
-//! [4] //! [5]
- self.setOption(HaveHelpButton, True);
-//! [5] //! [6]
- self.setPixmap(QWizard.LogoPixmap, QPixmap(":/images/logo.png"));
-
-//! [7]
- connect(this, SIGNAL(helpRequested()), this, SLOT(showHelp()));
-//! [7]
-
- setWindowTitle(tr("License Wizard"));
-//! [8]
-}
-//! [6] //! [8]
-
-//! [9] //! [10]
-void LicenseWizard::showHelp()
-//! [9] //! [11]
-{
- static QString lastHelpMessage;
-
- message = ""
-
- switch (currentId()) {
- case Page_Intro:
- message = tr("The decision you make here will affect which page you "
- "get to see next.");
- break;
-//! [10] //! [11]
- case Page_Evaluate:
- message = tr("Make sure to provide a valid email address, such as "
- "toni.buddenbrook@example.de.");
- break;
- case Page_Register:
- message = tr("If you don't provide an upgrade key, you will be "
- "asked to fill in your details.");
- break;
- case Page_Details:
- message = tr("Make sure to provide a valid email address, such as "
- "thomas.gradgrind@example.co.uk.");
- break;
- case Page_Conclusion:
- message = tr("You must accept the terms and conditions of the "
- "license to proceed.");
- break;
-//! [12] //! [13]
- default:
- message = tr("This help is likely not to be of any help.");
- }
-//! [12]
-
- if (lastHelpMessage == message)
- message = tr("Sorry, I already gave what help I could. "
- "Maybe you should try asking a human?");
-
-//! [14]
- QMessageBox::information(this, tr("License Wizard Help"), message);
-//! [14]
-
- lastHelpMessage = message;
-//! [15]
-}
-//! [13] //! [15]
-
-//! [16]
-IntroPage::IntroPage(QWidget *parent)
- : QWizardPage(parent)
-{
- setTitle(tr("Introduction"));
- setPixmap(QWizard::WatermarkPixmap, QPixmap(":/images/watermark.png"));
-
- topLabel = new QLabel(tr("This wizard will help you register your copy of "
- "<i>Super Product One</i>&trade; or start "
- "evaluating the product."));
- topLabel->setWordWrap(true);
-
- registerRadioButton = new QRadioButton(tr("&Register your copy"));
- evaluateRadioButton = new QRadioButton(tr("&Evaluate the product for 30 "
- "days"));
- registerRadioButton->setChecked(true);
-
- QVBoxLayout *layout = new QVBoxLayout;
- layout->addWidget(topLabel);
- layout->addWidget(registerRadioButton);
- layout->addWidget(evaluateRadioButton);
- setLayout(layout);
-}
-//! [16] //! [17]
-
-//! [18]
-# class IntroPage
-def nextId(self):
-//! [17] //! [19]
- if evaluateRadioButton.isChecked():
- return LicenseWizard.Page_Evaluate
- else:
- return LicenseWizard.Page_Register
-//! [18] //! [19]
-
-//! [20]
-EvaluatePage::EvaluatePage(QWidget *parent)
- : QWizardPage(parent)
-{
- setTitle(tr("Evaluate <i>Super Product One</i>&trade;"));
- setSubTitle(tr("Please fill both fields. Make sure to provide a valid "
- "email address (e.g., john.smith@example.com)."));
-
- nameLabel = new QLabel(tr("N&ame:"));
- nameLineEdit = new QLineEdit;
-//! [20]
- nameLabel->setBuddy(nameLineEdit);
-
- emailLabel = new QLabel(tr("&Email address:"));
- emailLineEdit = new QLineEdit;
- emailLineEdit->setValidator(new QRegExpValidator(QRegExp(".*@.*"), this));
- emailLabel->setBuddy(emailLineEdit);
-
-//! [21]
- registerField("evaluate.name*", nameLineEdit);
- registerField("evaluate.email*", emailLineEdit);
-//! [21]
-
- QGridLayout *layout = new QGridLayout;
- layout->addWidget(nameLabel, 0, 0);
- layout->addWidget(nameLineEdit, 0, 1);
- layout->addWidget(emailLabel, 1, 0);
- layout->addWidget(emailLineEdit, 1, 1);
- setLayout(layout);
-//! [22]
-}
-//! [22]
-
-//! [23]
-# class EvaluatePage
-def nextId(self):
- return LicenseWizard.Page_Conclusion
-//! [23]
-
-RegisterPage::RegisterPage(QWidget *parent)
- : QWizardPage(parent)
-{
- setTitle(tr("Register Your Copy of <i>Super Product One</i>&trade;"));
- setSubTitle(tr("If you have an upgrade key, please fill in "
- "the appropriate field."));
-
- nameLabel = new QLabel(tr("N&ame:"));
- nameLineEdit = new QLineEdit;
- nameLabel->setBuddy(nameLineEdit);
-
- upgradeKeyLabel = new QLabel(tr("&Upgrade key:"));
- upgradeKeyLineEdit = new QLineEdit;
- upgradeKeyLabel->setBuddy(upgradeKeyLineEdit);
-
- registerField("register.name*", nameLineEdit);
- registerField("register.upgradeKey", upgradeKeyLineEdit);
-
- QGridLayout *layout = new QGridLayout;
- layout->addWidget(nameLabel, 0, 0);
- layout->addWidget(nameLineEdit, 0, 1);
- layout->addWidget(upgradeKeyLabel, 1, 0);
- layout->addWidget(upgradeKeyLineEdit, 1, 1);
- setLayout(layout);
-}
-
-//! [24]
-# class RegisterPage
-def nextId(self):
- if self.upgradeKeyLineEdit.text().isEmpty():
- return LicenseWizard::Page_Details
- else:
- return LicenseWizard::Page_Conclusion
-//! [24]
-
-DetailsPage::DetailsPage(QWidget *parent)
- : QWizardPage(parent)
-{
- setTitle(tr("Fill In Your Details"));
- setSubTitle(tr("Please fill all three fields. Make sure to provide a valid "
- "email address (e.g., tanaka.aya@example.co.jp)."));
-
- companyLabel = new QLabel(tr("&Company name:"));
- companyLineEdit = new QLineEdit;
- companyLabel->setBuddy(companyLineEdit);
-
- emailLabel = new QLabel(tr("&Email address:"));
- emailLineEdit = new QLineEdit;
- emailLineEdit->setValidator(new QRegExpValidator(QRegExp(".*@.*"), this));
- emailLabel->setBuddy(emailLineEdit);
-
- postalLabel = new QLabel(tr("&Postal address:"));
- postalLineEdit = new QLineEdit;
- postalLabel->setBuddy(postalLineEdit);
-
- registerField("details.company*", companyLineEdit);
- registerField("details.email*", emailLineEdit);
- registerField("details.postal*", postalLineEdit);
-
- QGridLayout *layout = new QGridLayout;
- layout->addWidget(companyLabel, 0, 0);
- layout->addWidget(companyLineEdit, 0, 1);
- layout->addWidget(emailLabel, 1, 0);
- layout->addWidget(emailLineEdit, 1, 1);
- layout->addWidget(postalLabel, 2, 0);
- layout->addWidget(postalLineEdit, 2, 1);
- setLayout(layout);
-}
-
-//! [25]
-# class DetailsPage
-def nextId(self):
- return LicenseWizard.Page_Conclusion
-//! [25]
-
-ConclusionPage::ConclusionPage(QWidget *parent)
- : QWizardPage(parent)
-{
- setTitle(tr("Complete Your Registration"));
- setPixmap(QWizard::WatermarkPixmap, QPixmap(":/images/watermark.png"));
-
- bottomLabel = new QLabel;
- bottomLabel->setWordWrap(true);
-
- agreeCheckBox = new QCheckBox(tr("I agree to the terms of the license"));
-
- registerField("conclusion.agree*", agreeCheckBox);
-
- QVBoxLayout *layout = new QVBoxLayout;
- layout->addWidget(bottomLabel);
- layout->addWidget(agreeCheckBox);
- setLayout(layout);
-}
-
-//! [26]
-#class ConclusionPage
-def nextId(self):
- return -1
-//! [26]
-
-//! [27]
-# class ConclusionPage
-def initializePage(self):
- if wizard().hasVisitedPage(LicenseWizard::Page_Evaluate):
- licenseText = self.tr("<u>Evaluation License Agreement:</u> " \
- "You can use this software for 30 days and make one " \
- "backup, but you are not allowed to distribute it.")
- elsif wizard().hasVisitedPage(LicenseWizard.Page_Details):
- licenseText = self.tr("<u>First-Time License Agreement:</u> " \
- "You can use this software subject to the license " \
- "you will receive by email.")
- else:
- licenseText = self.tr("<u>Upgrade License Agreement:</u> " \
- "This software is licensed under the terms of your " \
- "current license.")
- }
- bottomLabel.setText(licenseText)
-//! [27]
-
-//! [28]
-void ConclusionPage::setVisible(bool visible)
-{
- QWizardPage::setVisible(visible);
-
- if (visible) {
-//! [29]
- self.wizard().setButtonText(QWizard.CustomButton1, self.tr("&Print"))
- self.wizard().setOption(QWizard.HaveCustomButton1, True)
- self.connect(wizard(), SIGNAL("customButtonClicked(int)"), self, SLOT("printButtonClicked()"))
-//! [29]
- } else {
- wizard()->setOption(QWizard::HaveCustomButton1, false);
- disconnect(wizard(), SIGNAL(customButtonClicked(int)),
- this, SLOT(printButtonClicked()));
- }
-}
-//! [28]
-
-void ConclusionPage::printButtonClicked()
-{
- QPrinter printer;
- QPrintDialog dialog(&printer, this);
- if (dialog.exec())
- QMessageBox::warning(this, tr("Print License"),
- tr("As an environmentally friendly measure, the "
- "license text will not actually be printed."));
-}
diff --git a/sources/pyside2/doc/codesnippets/examples/dialogs/licensewizard/main.cpp b/sources/pyside2/doc/codesnippets/examples/dialogs/licensewizard/main.cpp
deleted file mode 100644
index e372e9c17..000000000
--- a/sources/pyside2/doc/codesnippets/examples/dialogs/licensewizard/main.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QTranslator>
-#include <QLocale>
-#include <QLibraryInfo>
-
-#include "licensewizard.h"
-
-int main(int argc, char *argv[])
-{
- Q_INIT_RESOURCE(licensewizard);
-
- QApplication app(argc, argv);
-
- QString translatorFileName = QLatin1String("qt_");
- translatorFileName += QLocale::system().name();
- QTranslator *translator = new QTranslator(&app);
- if (translator->load(translatorFileName, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
- app.installTranslator(translator);
-
- LicenseWizard wizard;
- wizard.show();
- return app.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/examples/dialogs/trivialwizard/trivialwizard.cpp b/sources/pyside2/doc/codesnippets/examples/dialogs/trivialwizard/trivialwizard.cpp
deleted file mode 100644
index 6a06c1725..000000000
--- a/sources/pyside2/doc/codesnippets/examples/dialogs/trivialwizard/trivialwizard.cpp
+++ /dev/null
@@ -1,143 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-#include <QTranslator>
-#include <QLocale>
-#include <QLibraryInfo>
-
-//! [0] //! [1]
-def createIntroPage(self):
- page = QWizardPage()
- page.setTitle("Introduction")
-
- label = QLabel("This wizard will help you register your copy of Super Product Two.")
- label.setWordWrap(True)
-
- layout = QVBoxLayout()
- layout.addWidget(label)
- page.setLayout(layout)
-
- return page
-//! [0]
-
-//! [2]
-QWizardPage *createRegistrationPage()
-//! [1] //! [3]
-
-//! [3]
- QWizardPage *page = new QWizardPage;
- page->setTitle("Registration");
- page->setSubTitle("Please fill both fields.");
-
- QLabel *nameLabel = new QLabel("Name:");
- QLineEdit *nameLineEdit = new QLineEdit;
-
- QLabel *emailLabel = new QLabel("Email address:");
- QLineEdit *emailLineEdit = new QLineEdit;
-
- QGridLayout *layout = new QGridLayout;
- layout->addWidget(nameLabel, 0, 0);
- layout->addWidget(nameLineEdit, 0, 1);
- layout->addWidget(emailLabel, 1, 0);
- layout->addWidget(emailLineEdit, 1, 1);
- page->setLayout(layout);
-
- return page;
-//! [4]
-
-//! [2] //! [4]
-
-//! [5] //! [6]
-def createConclusionPage(self):
-//! [5] //! [7]
-
-//! [7]
- QWizardPage *page = new QWizardPage;
- page->setTitle("Conclusion");
-
- QLabel *label = new QLabel("You are now successfully registered. Have a "
- "nice day!");
- label->setWordWrap(true);
-
- QVBoxLayout *layout = new QVBoxLayout;
- layout->addWidget(label);
- page->setLayout(layout);
-
- return page;
-//! [8]
-
-//! [6] //! [8]
-
-//! [9] //! [10]
-
-//! [9] //! [11]
-def main():
- app = QApplication(sys.argv)
-
- translatorFileName = "qt_"
- translatorFileName += QLocale.system().name()
- translator = QTranslator(app)
- if translator.load(translatorFileName, QLibraryInfo.location(QLibraryInfo.TranslationsPath)):
- app.installTranslator(translator)
-
- wizard = QWizard()
- wizard.addPage(createIntroPage())
- wizard.addPage(createRegistrationPage())
- wizard.addPage(createConclusionPage())
-
- wizard.setWindowTitle("Trivial Wizard")
- wizard.show()
-
- return app.exec_()
-
-if __name__ == "__main__":
- main()
-//! [10] //! [11]
diff --git a/sources/pyside2/doc/codesnippets/examples/itemviews/simpledommodel/dommodel.cpp b/sources/pyside2/doc/codesnippets/examples/itemviews/simpledommodel/dommodel.cpp
deleted file mode 100644
index b9f582640..000000000
--- a/sources/pyside2/doc/codesnippets/examples/itemviews/simpledommodel/dommodel.cpp
+++ /dev/null
@@ -1,197 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-#include <QtXml>
-
-#include "domitem.h"
-#include "dommodel.h"
-
-//! [0]
-DomModel::DomModel(QDomDocument document, QObject *parent)
- : QAbstractItemModel(parent), domDocument(document)
-{
- rootItem = new DomItem(domDocument, 0);
-}
-//! [0]
-
-//! [1]
-DomModel::~DomModel()
-{
- delete rootItem;
-}
-//! [1]
-
-//! [2]
-def columnCount(self, parent):
- return 3
-//! [2]
-
-//! [3]
-QVariant DomModel::data(const QModelIndex &index, int role) const
-{
- if (!index.isValid())
- return QVariant();
-
- if (role != Qt::DisplayRole)
- return QVariant();
-
- DomItem *item = static_cast<DomItem*>(index.internalPointer());
-
- QDomNode node = item->node();
-//! [3] //! [4]
- QStringList attributes;
- QDomNamedNodeMap attributeMap = node.attributes();
-
- switch (index.column()) {
- case 0:
- return node.nodeName();
- case 1:
- for (int i = 0; i < attributeMap.count(); ++i) {
- QDomNode attribute = attributeMap.item(i);
- attributes << attribute.nodeName() + "=\""
- +attribute.nodeValue() + "\"";
- }
- return attributes.join(" ");
- case 2:
- return node.nodeValue().split("\n").join(" ");
- default:
- return QVariant();
- }
-}
-//! [4]
-
-//! [5]
-Qt::ItemFlags DomModel::flags(const QModelIndex &index) const
-{
- if (!index.isValid())
- return 0;
-
- return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
-}
-//! [5]
-
-//! [6]
-QVariant DomModel::headerData(int section, Qt::Orientation orientation,
- int role) const
-{
- if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
- switch (section) {
- case 0:
- return tr("Name");
- case 1:
- return tr("Attributes");
- case 2:
- return tr("Value");
- default:
- return QVariant();
- }
- }
-
- return QVariant();
-}
-//! [6]
-
-//! [7]
-QModelIndex DomModel::index(int row, int column, const QModelIndex &parent)
- const
-{
- if (!hasIndex(row, column, parent))
- return QModelIndex();
-
- DomItem *parentItem;
-
- if (!parent.isValid())
- parentItem = rootItem;
- else
- parentItem = static_cast<DomItem*>(parent.internalPointer());
-//! [7]
-
-//! [8]
- DomItem *childItem = parentItem->child(row);
- if (childItem)
- return createIndex(row, column, childItem);
- else
- return QModelIndex();
-}
-//! [8]
-
-//! [9]
-QModelIndex DomModel::parent(const QModelIndex &child) const
-{
- if (!child.isValid())
- return QModelIndex();
-
- DomItem *childItem = static_cast<DomItem*>(child.internalPointer());
- DomItem *parentItem = childItem->parent();
-
- if (!parentItem || parentItem == rootItem)
- return QModelIndex();
-
- return createIndex(parentItem->row(), 0, parentItem);
-}
-//! [9]
-
-//! [10]
-int DomModel::rowCount(const QModelIndex &parent) const
-{
- if (parent.column() > 0)
- return 0;
-
- DomItem *parentItem;
-
- if (!parent.isValid())
- parentItem = rootItem;
- else
- parentItem = static_cast<DomItem*>(parent.internalPointer());
-
- return parentItem->node().childNodes().count();
-}
-//! [10]
diff --git a/sources/pyside2/doc/codesnippets/examples/linguist/hellotr/main.cpp b/sources/pyside2/doc/codesnippets/examples/linguist/hellotr/main.cpp
deleted file mode 100644
index 7125841ef..000000000
--- a/sources/pyside2/doc/codesnippets/examples/linguist/hellotr/main.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QPushButton>
-//! [0]
-from PySide2.QtCore import QTranslator
-//! [0]
-
-//! [1] //! [2]
-def main(args):
-//! [1] //! [3] //! [4]
- app = QApplication(args)
-//! [3]
-
-//! [5]
- translator = QTranslator()
-//! [5] //! [6]
- translator.load("hellotr_la")
-//! [6] //! [7]
- app.installTranslator(translator)
-//! [4] //! [7]
-
-//! [8]
- hello = QPushButton(QPushButton.tr("Hello world!"))
-//! [8]
- hello.resize(100, 30)
-
- hello.show()
- return app.exec_()
-//! [2]
diff --git a/sources/pyside2/doc/codesnippets/examples/sql/querymodel/editablesqlmodel.cpp b/sources/pyside2/doc/codesnippets/examples/sql/querymodel/editablesqlmodel.cpp
deleted file mode 100644
index 844ee7711..000000000
--- a/sources/pyside2/doc/codesnippets/examples/sql/querymodel/editablesqlmodel.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtSql>
-
-#include "editablesqlmodel.h"
-
-EditableSqlModel::EditableSqlModel(QObject *parent)
- : QSqlQueryModel(parent)
-{
-}
-
-//! [0]
-def flags(self, index):
- flags = QSqlQueryModel.flags(index)
- if index.column() == 1 or index.column() == 2:
- flags |= Qt.ItemIsEditable
- return flags
-//! [0]
-
-//! [1]
-def setData(self, index, value, role):
- if index.column() < 1 or index.column() > 2:
- return False
-
- primaryKeyIndex = QSqlQueryModel.index(index.row(), 0)
- id = self.data(primaryKeyIndex).toInt()
-
- self.clear()
-
- ok = False
- if index.column() == 1:
- ok = self.setFirstName(id, value)
- else:
- ok = self.setLastName(id, value)
- self.refresh()
- return ok
-}
-//! [1]
-
-void EditableSqlModel::refresh()
-{
- setQuery("select * from person");
- setHeaderData(0, Qt::Horizontal, QObject::tr("ID"));
- setHeaderData(1, Qt::Horizontal, QObject::tr("First name"));
- setHeaderData(2, Qt::Horizontal, QObject::tr("Last name"));
-}
-
-//! [2]
-def setFirstName(self, personId, firstName):
- query = QSqlQuery()
- query.prepare("update person set firstname = ? where id = ?")
- query.addBindValue(firstName)
- query.addBindValue(personId)
- return query.exec()
-//! [2]
-
-bool EditableSqlModel::setLastName(int personId, const QString &lastName)
-{
- QSqlQuery query;
- query.prepare("update person set lastname = ? where id = ?");
- query.addBindValue(lastName);
- query.addBindValue(personId);
- return query.exec();
-}
diff --git a/sources/pyside2/doc/codesnippets/examples/svggenerator/window.cpp b/sources/pyside2/doc/codesnippets/examples/svggenerator/window.cpp
deleted file mode 100644
index 60c415949..000000000
--- a/sources/pyside2/doc/codesnippets/examples/svggenerator/window.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QColorDialog>
-#include <QFileDialog>
-#include <QPainter>
-#include <QSvgGenerator>
-#include "window.h"
-#include "displaywidget.h"
-
-Window::Window(QWidget *parent)
- : QWidget(parent)
-{
- setupUi(this);
-}
-
-void Window::updateBackground(int background)
-{
- displayWidget->setBackground(DisplayWidget::Background(background));
-}
-
-void Window::updateColor()
-{
- QColor color = QColorDialog::getColor(displayWidget->color());
- if (color.isValid())
- displayWidget->setColor(color);
-}
-
-void Window::updateShape(int shape)
-{
- displayWidget->setShape(DisplayWidget::Shape(shape));
-}
-
-//! [save SVG]
-def saveSvg(self):
- newPath = QFileDialog.getSaveFileName(self, QObject.tr("Save SVG"), path, QObject.tr("SVG files (*.svg)"))
-
- if newPath.isEmpty():
- return
-
- path = newPath
-
-//![configure SVG generator]
- generator = QSvgGenerator()
- generator.setFileName(path)
- generator.setSize(QSize(200, 200))
- generator.setViewBox(QRect(0, 0, 200, 200))
- generator.setTitle(QObject.tr("SVG Generator Example Drawing"))
- generator.setDescription(QObject.tr("An SVG drawing created by the SVG Generator Example provided with Qt."))
-//![configure SVG generator]
-//![begin painting]
- painter = QPainter()
- painter.begin(generator)
-//![begin painting]
- displayWidget->paint(painter)
-//![end painting]
- painter.end()
-//![end painting]
-
-//! [save SVG]
diff --git a/sources/pyside2/doc/codesnippets/examples/uitools/textfinder/textfinder.cpp b/sources/pyside2/doc/codesnippets/examples/uitools/textfinder/textfinder.cpp
deleted file mode 100644
index e493945c9..000000000
--- a/sources/pyside2/doc/codesnippets/examples/uitools/textfinder/textfinder.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtUiTools>
-#include <QtWidgets>
-#include "textfinder.h"
-
-//! [0]
-def __init__(self, parent = None):
- QWidget.__init__(self. parent)
- formWidget = self.loadUiFile()
-
-//! [1]
- self.ui_findButton = qFindChild(QPushButton, self, "findButton")
- self.ui_textEdit = qFindChild(QTextEdit, self, "textEdit")
- self.ui_lineEdit = qFindChild(QLineEdit, self, "lineEdit")
-//! [0] //! [1]
-
-//! [2]
- QMetaObject.connectSlotsByName(self)
-//! [2]
-
-//! [3a]
- self.loadTextFile()
-//! [3a]
-
-//! [3b]
- layout = QVBoxLayout()
- layout.addWidget(formWidget)
- self.setLayout(layout)
-//! [3b]
-
-//! [3c]
- self.setWindowTitle("Text Finder")
- self.isFirstTime = True
-//! [3c]
-
-//! [4]
-def loadUiFile(self):
- loader = QUiLoader()
- return loader.load(":/forms/textfinder.ui", self)
-//! [4]
-
-//! [5]
-def loadTextFile(self):
- inputFile = QFile(":/forms/input.txt")
- inputFile.open(QIODevice.ReadOnly)
- in = QTextStream(inputFile)
- line = in.readAll()
- inputFile.close()
-
- self.ui_textEdit.append(line)
- self.ui_textEdit.setUndoRedoEnabled(False)
- self.ui_textEdit.setUndoRedoEnabled(True)
-//! [5]
-
-//! [6] //! [7]
-@Slot()
-def on_findButton_clicked(self):
- searchString = self.ui_lineEdit.text()
- document = self.ui_textEdit.document()
-
- found = False
-
- if not self.isFirstTime:
- document.undo()
-
- if not searchString:
- QMessageBox.information(self, "Empty Search Field",
- "The search field is empty. Please enter a word and click Find.")
- else:
- highlightCursor = QTextCursor(document)
- cursor = QTextCursor(document)
- cursor.beginEditBlock()
-//! [6]
- plainFormat = QTextCharFormat(highlightCursor.charFormat())
- colorFormat = QTextCharFormat(plainFormat)
- colorFormat.setForeground(Qt.red)
-
- while not highlightCursor.isNull() and not highlightCursor.atEnd():
- highlightCursor = document.find(searchString, highlightCursor, QTextDocument.FindWholeWords)
-
- if not highlightCursor.isNull():
- found = True
- highlightCursor.movePosition(QTextCursor.WordRight, QTextCursor.KeepAnchor)
- highlightCursor.mergeCharFormat(colorFormat)
-//! [8]
- cursor.endEditBlock()
-//! [7] //! [9]
- self.isFirstTime = False
-
- if not found:
- QMessageBox.information(self, "Word Not Found", "Sorry, the word cannot be found.");
-//! [8] //! [9]
diff --git a/sources/pyside2/doc/codesnippets/examples/widgets/analogclock/analogclock.cpp b/sources/pyside2/doc/codesnippets/examples/widgets/analogclock/analogclock.cpp
deleted file mode 100644
index dcd24b275..000000000
--- a/sources/pyside2/doc/codesnippets/examples/widgets/analogclock/analogclock.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "analogclock.h"
-
-//! [0] //! [1]
-AnalogClock::AnalogClock(QWidget *parent)
-//! [0] //! [2]
- : QWidget(parent)
-//! [2] //! [3]
-{
-//! [3] //! [4]
- timer = QTimer(self)
-//! [4] //! [5]
- self.connect(timer, SIGNAL("timeout()"), self.update)
-//! [5] //! [6]
- timer.start(1000)
-//! [6]
-
- setWindowTitle(tr("Analog Clock"));
- resize(200, 200);
-//! [7]
-}
-//! [1] //! [7]
-
-//! [8] //! [9]
-void AnalogClock::paintEvent(QPaintEvent *)
-//! [8] //! [10]
-{
- static const QPoint hourHand[3] = {
- QPoint(7, 8),
- QPoint(-7, 8),
- QPoint(0, -40)
- };
- static const QPoint minuteHand[3] = {
- QPoint(7, 8),
- QPoint(-7, 8),
- QPoint(0, -70)
- };
-
- QColor hourColor(127, 0, 127);
- QColor minuteColor(0, 127, 127, 191);
-
- int side = qMin(width(), height());
- QTime time = QTime::currentTime();
-//! [10]
-
-//! [11]
- QPainter painter(this);
-//! [11] //! [12]
- painter.setRenderHint(QPainter::Antialiasing);
-//! [12] //! [13]
- painter.translate(width() / 2, height() / 2);
-//! [13] //! [14]
- painter.scale(side / 200.0, side / 200.0);
-//! [9] //! [14]
-
-//! [15]
- painter.setPen(Qt::NoPen);
-//! [15] //! [16]
- painter.setBrush(hourColor);
-//! [16]
-
-//! [17] //! [18]
- painter.save();
-//! [17] //! [19]
- painter.rotate(30.0 * ((time.hour() + time.minute() / 60.0)));
- painter.drawConvexPolygon(hourHand, 3);
- painter.restore();
-//! [18] //! [19]
-
-//! [20]
- painter.setPen(hourColor);
-//! [20] //! [21]
-
- for (int i = 0; i < 12; ++i) {
- painter.drawLine(88, 0, 96, 0);
- painter.rotate(30.0);
- }
-//! [21]
-
-//! [22]
- painter.setPen(Qt::NoPen);
-//! [22] //! [23]
- painter.setBrush(minuteColor);
-
-//! [24]
- painter.save();
- painter.rotate(6.0 * (time.minute() + time.second() / 60.0));
- painter.drawConvexPolygon(minuteHand, 3);
- painter.restore();
-//! [23] //! [24]
-
-//! [25]
- painter.setPen(minuteColor);
-//! [25] //! [26]
-
-//! [27]
- for (int j = 0; j < 60; ++j) {
- if ((j % 5) != 0)
- painter.drawLine(92, 0, 96, 0);
- painter.rotate(6.0);
- }
-//! [27]
-}
-//! [26]
diff --git a/sources/pyside2/doc/codesnippets/examples/xml/streambookmarks/xbelreader.cpp b/sources/pyside2/doc/codesnippets/examples/xml/streambookmarks/xbelreader.cpp
deleted file mode 100644
index c82f02752..000000000
--- a/sources/pyside2/doc/codesnippets/examples/xml/streambookmarks/xbelreader.cpp
+++ /dev/null
@@ -1,210 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "xbelreader.h"
-
-//! [0]
-XbelReader::XbelReader(QTreeWidget *treeWidget)
- : treeWidget(treeWidget)
-{
- QStyle *style = treeWidget->style();
-
- folderIcon.addPixmap(style->standardPixmap(QStyle::SP_DirClosedIcon),
- QIcon::Normal, QIcon::Off);
- folderIcon.addPixmap(style->standardPixmap(QStyle::SP_DirOpenIcon),
- QIcon::Normal, QIcon::On);
- bookmarkIcon.addPixmap(style->standardPixmap(QStyle::SP_FileIcon));
-}
-//! [0]
-
-//! [1]
-def read(self, device):
- self.setDevice(device)
-
- while not atEnd():
- readNext()
-
- if isStartElement():
- if self.name() == "xbel" and self.attributes().value("version") == "1.0":
- self.readXBEL()
- else:
- self.raiseError(QObject.tr("The file is not an XBEL version 1.0 file."));
-
- return not self.error();
-//! [1]
-
-//! [2]
-void XbelReader::readUnknownElement()
-{
- Q_ASSERT(isStartElement());
-
- while (!atEnd()) {
- readNext();
-
- if (isEndElement())
- break;
-
- if (isStartElement())
- readUnknownElement();
- }
-}
-//! [2]
-
-//! [3]
-void XbelReader::readXBEL()
-{
- Q_ASSERT(isStartElement() && name() == "xbel");
-
- while (!atEnd()) {
- readNext();
-
- if (isEndElement())
- break;
-
- if (isStartElement()) {
- if (name() == "folder")
- readFolder(0);
- else if (name() == "bookmark")
- readBookmark(0);
- else if (name() == "separator")
- readSeparator(0);
- else
- readUnknownElement();
- }
- }
-}
-//! [3]
-
-//! [4]
-void XbelReader::readTitle(QTreeWidgetItem *item)
-{
- Q_ASSERT(isStartElement() && name() == "title");
-
- QString title = readElementText();
- item->setText(0, title);
-}
-//! [4]
-
-//! [5]
-void XbelReader::readSeparator(QTreeWidgetItem *item)
-{
- QTreeWidgetItem *separator = createChildItem(item);
- separator->setFlags(item->flags() & ~Qt::ItemIsSelectable);
- separator->setText(0, QString(30, 0xB7));
- readElementText();
-}
-//! [5]
-
-void XbelReader::readFolder(QTreeWidgetItem *item)
-{
- Q_ASSERT(isStartElement() && name() == "folder");
-
- QTreeWidgetItem *folder = createChildItem(item);
- bool folded = (attributes().value("folded") != "no");
- treeWidget->setItemExpanded(folder, !folded);
-
- while (!atEnd()) {
- readNext();
-
- if (isEndElement())
- break;
-
- if (isStartElement()) {
- if (name() == "title")
- readTitle(folder);
- else if (name() == "folder")
- readFolder(folder);
- else if (name() == "bookmark")
- readBookmark(folder);
- else if (name() == "separator")
- readSeparator(folder);
- else
- readUnknownElement();
- }
- }
-}
-
-void XbelReader::readBookmark(QTreeWidgetItem *item)
-{
- Q_ASSERT(isStartElement() && name() == "bookmark");
-
- QTreeWidgetItem *bookmark = createChildItem(item);
- bookmark->setFlags(bookmark->flags() | Qt::ItemIsEditable);
- bookmark->setIcon(0, bookmarkIcon);
- bookmark->setText(0, QObject::tr("Unknown title"));
- bookmark->setText(1, attributes().value("href").toString());
- while (!atEnd()) {
- readNext();
-
- if (isEndElement())
- break;
-
- if (isStartElement()) {
- if (name() == "title")
- readTitle(bookmark);
- else
- readUnknownElement();
- }
- }
-}
-
-QTreeWidgetItem *XbelReader::createChildItem(QTreeWidgetItem *item)
-{
- QTreeWidgetItem *childItem;
- if (item) {
- childItem = new QTreeWidgetItem(item);
- } else {
- childItem = new QTreeWidgetItem(treeWidget);
- }
- childItem->setData(0, Qt::UserRole, name().toString());
- return childItem;
-}
diff --git a/sources/pyside2/doc/codesnippets/examples/xml/streambookmarks/xbelwriter.cpp b/sources/pyside2/doc/codesnippets/examples/xml/streambookmarks/xbelwriter.cpp
deleted file mode 100644
index 372bc53bf..000000000
--- a/sources/pyside2/doc/codesnippets/examples/xml/streambookmarks/xbelwriter.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-#include "xbelwriter.h"
-
-//! [0]
-XbelWriter::XbelWriter(QTreeWidget *treeWidget)
- : treeWidget(treeWidget)
-{
- setAutoFormatting(true);
-}
-//! [0]
-
-//! [1]
-def writeFile(self, device):
- self.setDevice(device)
-
- self.writeStartDocument()
- self.writeDTD("<!DOCTYPE xbel>")
- self.writeStartElement("xbel")
- self.writeAttribute("version", "1.0")
- for i in range(0, self.treeWidget.topLevelItemCount()):
- self.writeItem(self.treeWidget.topLevelItem(i))
-
- self.writeEndDocument()
- return True;
-//! [1]
-
-//! [2]
-void XbelWriter::writeItem(QTreeWidgetItem *item)
-{
- QString tagName = item->data(0, Qt::UserRole).toString();
- if (tagName == "folder") {
- bool folded = !treeWidget->isItemExpanded(item);
- writeStartElement(tagName);
- writeAttribute("folded", folded ? "yes" : "no");
- writeTextElement("title", item->text(0));
- for (int i = 0; i < item->childCount(); ++i)
- writeItem(item->child(i));
- writeEndElement();
- } else if (tagName == "bookmark") {
- writeStartElement(tagName);
- if (!item->text(1).isEmpty())
- writeAttribute("href", item->text(1));
- writeTextElement("title", item->text(0));
- writeEndElement();
- } else if (tagName == "separator") {
- writeEmptyElement(tagName);
- }
-}
-//! [2]
diff --git a/sources/pyside2/doc/codesnippets/snippets/textdocument-resources/main.cpp b/sources/pyside2/doc/codesnippets/snippets/textdocument-resources/main.cpp
deleted file mode 100644
index 7a2f9b83a..000000000
--- a/sources/pyside2/doc/codesnippets/snippets/textdocument-resources/main.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of Qt for Python.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtWidgets>
-
-QString tr(const char *text)
-{
- return QApplication::translate(text, text);
-}
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- QTextEdit *editor = new QTextEdit;
-
- QTextDocument *document = new QTextDocument(editor);
- QTextCursor cursor(document);
-
- QImage image(64, 64, QImage::Format_RGB32);
- image.fill(qRgb(255, 160, 128));
-
-//! [Adding a resource]
- document.addResource(QTextDocument.ImageResource,
- QUrl("mydata://image.png"), image)
-//! [Adding a resource]
-
-//! [Inserting an image with a cursor]
- imageFormat = QTextImageFormat()
- imageFormat.setName("mydata://image.png")
- cursor.insertImage(imageFormat)
-//! [Inserting an image with a cursor]
-
- cursor.insertBlock();
- cursor.insertText("Code less. Create more.");
-
- editor->setDocument(document);
- editor->setWindowTitle(tr("Text Document Images"));
- editor->resize(320, 480);
- editor->show();
-
-//! [Inserting an image using HTML]
- editor.append("<img src=\"mydata://image.png\" />")
-//! [Inserting an image using HTML]
-
- return app.exec();
-}
diff --git a/sources/pyside2/doc/deployment.rst b/sources/pyside2/doc/deployment.rst
index a125dc4d7..eb8d77b0d 100644
--- a/sources/pyside2/doc/deployment.rst
+++ b/sources/pyside2/doc/deployment.rst
@@ -6,23 +6,23 @@ Deploying or freezing an application is a crucial part of many Python projects.
Most large projects are not based on a single Python file, so
the distribution of these applications becomes more difficult.
-The options for a project are:
+Here are a few distribution options that you could use:
1. Sending a normal zip-file with the application's content.
2. Building a proper `Python package (wheel) <https://packaging.python.org/>`_.
- 3. Freezing the application in a single binary file, or into a directory.
+ 3. Freezing the application into a single binary file or a directory.
-For the **third** option, there are many available tools:
+If you choose the **third** option, consider using one of these tools:
* `fbs <https://build-system.fman.io/>`_,
* `PyInstaller <https://www.pyinstaller.org/>`_,
* `cx_Freeze <https://anthony-tuininga.github.io/cx_Freeze/>`_,
* `py2exe <http://www.py2exe.org/>`_,
* `py2app <https://py2app.readthedocs.io/en/latest/>`_,
-Since |project| is a cross-platform framework,
-we would like to focus on solutions that at least work on
-the three major platform supported by Qt: Linux, macOS, and Windows.
-
-The following table summarizes the above mentioned tools support:
+|project| is a cross-platform framework,
+so we would like to focus on solutions that work on the three
+major platforms supported by Qt: Linux, macOS, and Windows.
+The following table summarizes the platform support for those packaging
+tools:
=========== ======= ===== ===== =======
Name License Linux macOS Windows
@@ -34,34 +34,27 @@ py2exe MIT no no yes
py2app MIT no yes no
=========== ======= ===== ===== =======
-From the table we can see that only *fbs*, *cx_Freeze* and *PyInstaller*
-meet our requirements.
+According to this table, only *fbs*, *cx_Freeze*, and *PyInstaller*
+meets our cross-platform requirement.
-All tools are command-line based, and it could become
-a hard task to include more resources to your application, such as
-images, icons, and meta-information, because you will need to create
-special hooks or separate scripts to handle them.
-Additionally, since this only
-allows you to freeze your current application, you don't have
-any mechanism to update your application.
+As these are command-line tools, it could be hard to include
+resources to your application, such as images, icons, and
+meta-information. This means, you will need special hooks
+or scripts to handle them before adding to the package.
+In addition to this, these tools does not offer a mechanism
+to update your application packages.
-To cover the update part, there is a tool built around PyInstaller
-called `PyUpdater <https://www.pyupdater.org/>`_ which enables
-a simple mechanism to ship applications updates.
+To create update packages, use the `PyUpdater <https://www.pyupdater.org/>`_,
+which is built around PyInstaller.
-On top of all these features, including also a nice interface
-that allows the user to install the application step by step,
-or even better, provide templates to create new projects to easily
-freeze-them-up is something really beneficial for both developers
-and end-users.
-This is where `fbs <https://build-system.fman.io>`_ enters the
-game, being based on PyInstaller, but including all the nice features
-we previously mentioned.
+The `fbs <https://build-system.fman.io>`_ tool offers a nice UI
+that allows the user to install the application step-by-step.
Here you can find a set of tutorials on how to use the previously
described tools.
-.. note:: Deployment is possible only in Qt for Python 5.12.2
+.. note:: Deployment is supported only from Qt for Python 5.12.2 and
+later.
.. toctree::
:name: mastertoc
diff --git a/sources/pyside2/doc/tutorials/basictutorial/qml.rst b/sources/pyside2/doc/tutorials/basictutorial/qml.rst
index 0b26b3b83..81583096b 100644
--- a/sources/pyside2/doc/tutorials/basictutorial/qml.rst
+++ b/sources/pyside2/doc/tutorials/basictutorial/qml.rst
@@ -3,7 +3,7 @@ Your First Application Using PySide2 and QtQuick/QML
QML is a declarative language that lets you develop applications
faster than with traditional languages. It is ideal for designing the
-UI of your applicataion because of its declarative nature. In QML, a
+UI of your application because of its declarative nature. In QML, a
user interface is specified as a tree of objects with properties. In
this tutorial, we will show how to make a simple "Hello World"
application with PySide2 and QML.
diff --git a/sources/pyside2/doc/tutorials/basictutorial/widgets.rst b/sources/pyside2/doc/tutorials/basictutorial/widgets.rst
index 80c137cac..c864e3d47 100644
--- a/sources/pyside2/doc/tutorials/basictutorial/widgets.rst
+++ b/sources/pyside2/doc/tutorials/basictutorial/widgets.rst
@@ -32,8 +32,7 @@ After the creation of the application object, we have created a
# This HTML approach will be valid too!
label = QLabel("<font color=red size=40>Hello World!</font>")
-.. note:: After the creation of the label, we are calling the
-method `show()` to show the label.
+.. note:: After creating the label, we call `show()` on it.
Finally, we call `app.exec_()` to enter the Qt main loop and start
to execute the Qt code. In reality, it is only here where the label
diff --git a/sources/pyside2/doc/tutorials/datavisualize/index.rst b/sources/pyside2/doc/tutorials/datavisualize/index.rst
index 750012d84..ff18c654e 100644
--- a/sources/pyside2/doc/tutorials/datavisualize/index.rst
+++ b/sources/pyside2/doc/tutorials/datavisualize/index.rst
@@ -14,9 +14,13 @@ visualize data from a CSV in a line chart.
.. toctree::
:glob:
:titlesonly:
- :reversed:
- *
+ read*
+ filter*
+ add_main*
+ add_tab*
+ add_chart*
+ plot*
You can download the sources from :download:`here <datavisualize.tar.bz2>`.
diff --git a/sources/pyside2/doc/tutorials/qmlapp/qmlapplication.rst b/sources/pyside2/doc/tutorials/qmlapp/qmlapplication.rst
index 78bae94a8..0cb296071 100644
--- a/sources/pyside2/doc/tutorials/qmlapp/qmlapplication.rst
+++ b/sources/pyside2/doc/tutorials/qmlapp/qmlapplication.rst
@@ -129,5 +129,4 @@ Related information
********************
* `QML Reference <https://doc.qt.io/qt-5/qmlreference.html>`_
-* :doc:`../qmltutorial/index`
-* :doc:`../qmladvancedtutorial/index`
+* :doc:`../qmlintegration/qmlintegration`
diff --git a/sources/pyside2/libpyside/destroylistener.cpp b/sources/pyside2/libpyside/destroylistener.cpp
index c6dc54713..319a126cf 100644
--- a/sources/pyside2/libpyside/destroylistener.cpp
+++ b/sources/pyside2/libpyside/destroylistener.cpp
@@ -42,7 +42,7 @@
#include <shiboken.h>
-PySide::DestroyListener* PySide::DestroyListener::m_instance = 0;
+PySide::DestroyListener *PySide::DestroyListener::m_instance = nullptr;
namespace PySide
{
@@ -53,7 +53,7 @@ struct DestroyListenerPrivate
};
-DestroyListener* DestroyListener::instance()
+DestroyListener *DestroyListener::instance()
{
if (!m_instance)
m_instance = new DestroyListener(0);
@@ -71,19 +71,19 @@ void DestroyListener::destroy()
void DestroyListener::listen(QObject *obj)
{
- SbkObject* wrapper = Shiboken::BindingManager::instance().retrieveWrapper(obj);
+ SbkObject *wrapper = Shiboken::BindingManager::instance().retrieveWrapper(obj);
if (!wrapper) // avoid problem with multiple inheritance
return;
if (Py_IsInitialized() == 0)
onObjectDestroyed(obj);
else
- QObject::connect(obj, SIGNAL(destroyed(QObject*)), this, SLOT(onObjectDestroyed(QObject*)), Qt::DirectConnection);
+ QObject::connect(obj, SIGNAL(destroyed(QObject *)), this, SLOT(onObjectDestroyed(QObject *)), Qt::DirectConnection);
}
-void DestroyListener::onObjectDestroyed(QObject* obj)
+void DestroyListener::onObjectDestroyed(QObject *obj)
{
- SbkObject* wrapper = Shiboken::BindingManager::instance().retrieveWrapper(obj);
+ SbkObject *wrapper = Shiboken::BindingManager::instance().retrieveWrapper(obj);
if (wrapper) //make sure the object exists before destroy
Shiboken::Object::destroy(wrapper, obj);
}
diff --git a/sources/pyside2/libpyside/destroylistener.h b/sources/pyside2/libpyside/destroylistener.h
index b1a0597c5..dedcca662 100644
--- a/sources/pyside2/libpyside/destroylistener.h
+++ b/sources/pyside2/libpyside/destroylistener.h
@@ -52,16 +52,16 @@ class PYSIDE_API DestroyListener : public QObject
{
Q_OBJECT
public:
- PYSIDE_DEPRECATED(static DestroyListener* instance());
+ PYSIDE_DEPRECATED(static DestroyListener *instance());
static void destroy();
- void listen(QObject* obj);
+ void listen(QObject *obj);
public Q_SLOTS:
- void onObjectDestroyed(QObject* obj);
+ void onObjectDestroyed(QObject *obj);
private:
- static DestroyListener* m_instance;
- DestroyListenerPrivate* m_d;
+ static DestroyListener *m_instance;
+ DestroyListenerPrivate *m_d;
DestroyListener(QObject *parent);
~DestroyListener() override;
};
diff --git a/sources/pyside2/libpyside/dynamicqmetaobject_p.h b/sources/pyside2/libpyside/dynamicqmetaobject_p.h
index 738b950ba..534be5825 100644
--- a/sources/pyside2/libpyside/dynamicqmetaobject_p.h
+++ b/sources/pyside2/libpyside/dynamicqmetaobject_p.h
@@ -58,19 +58,19 @@ namespace PySide
* \param signature method signature
* \param type method return type
*/
- MethodData(QMetaMethod::MethodType mtype,
- const QByteArray& signature,
- const QByteArray& rtype = QByteArray("void"));
+ MethodData(QMetaMethod::MethodType mtype,
+ const QByteArray &signature,
+ const QByteArray &rtype = QByteArray("void"));
void clear();
bool isValid() const;
- const QByteArray& signature() const { return m_signature; }
- const QByteArray& returnType() const { return m_rtype; }
+ const QByteArray &signature() const { return m_signature; }
+ const QByteArray &returnType() const { return m_rtype; }
QMetaMethod::MethodType methodType() const { return m_mtype; }
//Qt5 moc: now we have to store method parameter names, count, type
QList<QByteArray> parameterTypes() const;
int parameterCount() const;
QByteArray name() const;
- bool operator==(const MethodData& other) const;
+ bool operator==(const MethodData &other) const;
private:
QByteArray m_signature;
@@ -84,22 +84,22 @@ namespace PySide
public:
PropertyData();
PropertyData(const char *name, int cachedNotifyId = 0, PySideProperty *data = 0);
- const QByteArray& name() const { return m_name; }
+ const QByteArray &name() const { return m_name; }
PySideProperty *data() const { return m_data; }
QByteArray type() const;
uint flags() const;
bool isValid() const;
int cachedNotifyId() const;
- bool operator==(const PropertyData& other) const;
- bool operator==(const char* name) const;
+ bool operator==(const PropertyData &other) const;
+ bool operator==(const char *name) const;
private:
QByteArray m_name;
int m_cachedNotifyId;
- PySideProperty* m_data;
+ PySideProperty *m_data;
};
-inline bool MethodData::operator==(const MethodData& other) const
+inline bool MethodData::operator==(const MethodData &other) const
{
return m_mtype == other.methodType() && m_signature == other.signature();
}
diff --git a/sources/pyside2/libpyside/globalreceiverv2.cpp b/sources/pyside2/libpyside/globalreceiverv2.cpp
index 65b8f74e3..283fb9cd2 100644
--- a/sources/pyside2/libpyside/globalreceiverv2.cpp
+++ b/sources/pyside2/libpyside/globalreceiverv2.cpp
@@ -62,27 +62,27 @@ class DynamicSlotDataV2
{
Q_DISABLE_COPY(DynamicSlotDataV2)
public:
- DynamicSlotDataV2(PyObject* callback, GlobalReceiverV2* parent);
+ DynamicSlotDataV2(PyObject *callback, GlobalReceiverV2 *parent);
~DynamicSlotDataV2();
- int addSlot(const char* signature);
- int id(const char* signature) const;
- PyObject* callback();
+ int addSlot(const char *signature);
+ int id(const char *signature) const;
+ PyObject *callback();
QByteArray hash() const;
void notify();
- static void onCallbackDestroyed(void* data);
+ static void onCallbackDestroyed(void *data);
static QByteArray hash(PyObject *callback);
private:
bool m_isMethod;
- PyObject* m_callback;
- PyObject* m_pythonSelf;
- PyObject* m_pyClass;
- PyObject* m_weakRef;
+ PyObject *m_callback;
+ PyObject *m_pythonSelf;
+ PyObject *m_pyClass;
+ PyObject *m_weakRef;
QMap<QByteArray, int> m_signatures;
- GlobalReceiverV2* m_parent;
+ GlobalReceiverV2 *m_parent;
QByteArray m_hash;
};
@@ -90,7 +90,7 @@ class DynamicSlotDataV2
using namespace PySide;
-DynamicSlotDataV2::DynamicSlotDataV2(PyObject* callback, GlobalReceiverV2* parent)
+DynamicSlotDataV2::DynamicSlotDataV2(PyObject *callback, GlobalReceiverV2 *parent)
: m_pythonSelf(0), m_pyClass(0), m_weakRef(0), m_parent(parent)
{
Shiboken::GilState gil;
@@ -124,7 +124,7 @@ QByteArray DynamicSlotDataV2::hash() const
return m_hash;
}
-QByteArray DynamicSlotDataV2::hash(PyObject* callback)
+QByteArray DynamicSlotDataV2::hash(PyObject *callback)
{
Shiboken::GilState gil;
if (PyMethod_Check(callback)) {
@@ -134,9 +134,9 @@ QByteArray DynamicSlotDataV2::hash(PyObject* callback)
return QByteArray::number(qlonglong(PyObject_Hash(callback)));
}
-PyObject* DynamicSlotDataV2::callback()
+PyObject *DynamicSlotDataV2::callback()
{
- PyObject* callback = m_callback;
+ PyObject *callback = m_callback;
//create a callback based on method data
if (m_isMethod)
@@ -151,13 +151,13 @@ PyObject* DynamicSlotDataV2::callback()
return callback;
}
-int DynamicSlotDataV2::id(const char* signature) const
+int DynamicSlotDataV2::id(const char *signature) const
{
const auto it = m_signatures.constFind(signature);
return it != m_signatures.cend() ? it.value() : -1;
}
-int DynamicSlotDataV2::addSlot(const char* signature)
+int DynamicSlotDataV2::addSlot(const char *signature)
{
int index = id(signature);
if (index == -1)
@@ -167,7 +167,7 @@ int DynamicSlotDataV2::addSlot(const char* signature)
void DynamicSlotDataV2::onCallbackDestroyed(void *data)
{
- DynamicSlotDataV2* self = reinterpret_cast<DynamicSlotDataV2*>(data);
+ auto self = reinterpret_cast<DynamicSlotDataV2 *>(data);
self->m_weakRef = 0;
Py_BEGIN_ALLOW_THREADS
delete self->m_parent;
@@ -222,12 +222,12 @@ GlobalReceiverV2::~GlobalReceiverV2()
delete data;
}
-int GlobalReceiverV2::addSlot(const char* signature)
+int GlobalReceiverV2::addSlot(const char *signature)
{
return m_data->addSlot(signature);
}
-void GlobalReceiverV2::incRef(const QObject* link)
+void GlobalReceiverV2::incRef(const QObject *link)
{
if (link) {
if (!m_refs.contains(link)) {
@@ -247,7 +247,7 @@ void GlobalReceiverV2::incRef(const QObject* link)
}
}
-void GlobalReceiverV2::decRef(const QObject* link)
+void GlobalReceiverV2::decRef(const QObject *link)
{
if (m_refs.empty())
return;
@@ -273,7 +273,7 @@ void GlobalReceiverV2::decRef(const QObject* link)
}
-int GlobalReceiverV2::refCount(const QObject* link) const
+int GlobalReceiverV2::refCount(const QObject *link) const
{
if (link)
return m_refs.count(link);
@@ -283,7 +283,7 @@ int GlobalReceiverV2::refCount(const QObject* link) const
void GlobalReceiverV2::notify()
{
- const QSet<const QObject*> objSet(m_refs.cbegin(), m_refs.cend());
+ const QSet<const QObject *> objSet(m_refs.cbegin(), m_refs.cend());
Py_BEGIN_ALLOW_THREADS
for (const QObject *o : objSet) {
QMetaObject::disconnect(o, DESTROY_SIGNAL_ID, this, DESTROY_SLOT_ID);
@@ -297,17 +297,17 @@ QByteArray GlobalReceiverV2::hash() const
return m_data->hash();
}
-QByteArray GlobalReceiverV2::hash(PyObject* callback)
+QByteArray GlobalReceiverV2::hash(PyObject *callback)
{
return DynamicSlotDataV2::hash(callback);
}
-const QMetaObject* GlobalReceiverV2::metaObject() const
+const QMetaObject *GlobalReceiverV2::metaObject() const
{
return const_cast<GlobalReceiverV2 *>(this)->m_metaObject.update();
}
-int GlobalReceiverV2::qt_metacall(QMetaObject::Call call, int id, void** args)
+int GlobalReceiverV2::qt_metacall(QMetaObject::Call call, int id, void **args)
{
Shiboken::GilState gil;
Q_ASSERT(call == QMetaObject::InvokeMetaMethod);
@@ -328,7 +328,7 @@ int GlobalReceiverV2::qt_metacall(QMetaObject::Call call, int id, void** args)
if (id == DESTROY_SLOT_ID) {
if (m_refs.empty())
return -1;
- QObject *obj = *reinterpret_cast<QObject**>(args[1]);
+ auto obj = *reinterpret_cast<QObject **>(args[1]);
incRef(); //keep the object live (safe ref)
m_refs.removeAll(obj); // remove all refs to this object
decRef(); //remove the safe ref
diff --git a/sources/pyside2/libpyside/globalreceiverv2.h b/sources/pyside2/libpyside/globalreceiverv2.h
index b92be93a8..433f587a9 100644
--- a/sources/pyside2/libpyside/globalreceiverv2.h
+++ b/sources/pyside2/libpyside/globalreceiverv2.h
@@ -82,8 +82,8 @@ public:
/**
* Reimplemented function from QObject
**/
- int qt_metacall(QMetaObject::Call call, int id, void** args) override;
- const QMetaObject* metaObject() const override;
+ int qt_metacall(QMetaObject::Call call, int id, void **args) override;
+ const QMetaObject *metaObject() const override;
/**
* Add a extra slot to this object
@@ -91,7 +91,7 @@ public:
* @param signature The signature of the slot to be added
* @return The index of this slot on metaobject
**/
- int addSlot(const char* signature);
+ int addSlot(const char *signature);
/**
* Notify to GlobalReceiver about when a new connection was made
@@ -103,14 +103,14 @@ public:
*
* @param link This is a optional paramenter used to link the ref to some QObject life
**/
- void incRef(const QObject* link = 0);
+ void incRef(const QObject *link = nullptr);
/**
* Used to decrement the reference of the GlobalReceiver object
*
* @param link This is a optional paramenter used to dismiss the link ref to some QObject
**/
- void decRef(const QObject* link = 0);
+ void decRef(const QObject *link = nullptr);
/*
* Return the count of refs which the GlobalReceiver has
@@ -118,7 +118,7 @@ public:
* @param link If any QObject was passed, the function return the number of references relative to this 'link' object
* @return The number of references
**/
- int refCount(const QObject* link) const;
+ int refCount(const QObject *link) const;
/**
* Use to retrieve the unique hash of this GlobalReceiver object
@@ -133,7 +133,7 @@ public:
* @param callback The Python callable object used to calculate the id
* @return a string with a unique id based on GlobalReceiver contents
**/
- static QByteArray hash(PyObject* callback);
+ static QByteArray hash(PyObject *callback);
const MetaObjectBuilder &metaObjectBuilder() const { return m_metaObject; }
MetaObjectBuilder &metaObjectBuilder() { return m_metaObject; }
@@ -141,7 +141,7 @@ public:
private:
MetaObjectBuilder m_metaObject;
DynamicSlotDataV2 *m_data;
- QList<const QObject*> m_refs;
+ QList<const QObject *> m_refs;
SharedMap m_sharedMap;
};
diff --git a/sources/pyside2/libpyside/pyside.cpp b/sources/pyside2/libpyside/pyside.cpp
index fff28a9e7..9ee20f461 100644
--- a/sources/pyside2/libpyside/pyside.cpp
+++ b/sources/pyside2/libpyside/pyside.cpp
@@ -72,7 +72,7 @@
#include <typeinfo>
static QStack<PySide::CleanupFunction> cleanupFunctionList;
-static void* qobjectNextAddr;
+static void *qobjectNextAddr;
QT_BEGIN_NAMESPACE
extern bool qRegisterResourceData(int, const unsigned char *, const unsigned char *,
@@ -94,7 +94,7 @@ void init(PyObject *module)
SignalManager::instance();
}
-static bool _setProperty(PyObject* qObj, PyObject *name, PyObject *value, bool *accept)
+static bool _setProperty(PyObject *qObj, PyObject *name, PyObject *value, bool *accept)
{
QByteArray propName(Shiboken::String::toCString(name));
propName[0] = std::toupper(propName[0]);
@@ -112,14 +112,14 @@ static bool _setProperty(PyObject* qObj, PyObject *name, PyObject *value, bool *
Shiboken::AutoDecRef attr(PyObject_GenericGetAttr(qObj, name));
if (PySide::Property::checkType(attr)) {
*accept = true;
- if (PySide::Property::setValue(reinterpret_cast<PySideProperty*>(attr.object()), qObj, value) < 0)
+ if (PySide::Property::setValue(reinterpret_cast<PySideProperty *>(attr.object()), qObj, value) < 0)
return false;
}
}
return true;
}
-bool fillQtProperties(PyObject* qObj, const QMetaObject* metaObj, PyObject* kwds, const char** blackList, unsigned int blackListSize)
+bool fillQtProperties(PyObject *qObj, const QMetaObject *metaObj, PyObject *kwds, const char **blackList, unsigned int blackListSize)
{
PyObject *key, *value;
@@ -170,11 +170,11 @@ void runCleanupFunctions()
PySide::DestroyListener::destroy();
}
-static void destructionVisitor(SbkObject* pyObj, void* data)
+static void destructionVisitor(SbkObject *pyObj, void *data)
{
- void** realData = reinterpret_cast<void**>(data);
- SbkObject* pyQApp = reinterpret_cast<SbkObject*>(realData[0]);
- PyTypeObject* pyQObjectType = reinterpret_cast<PyTypeObject*>(realData[1]);
+ auto realData = reinterpret_cast<void **>(data);
+ auto pyQApp = reinterpret_cast<SbkObject *>(realData[0]);
+ auto pyQObjectType = reinterpret_cast<PyTypeObject *>(realData[1]);
if (pyObj != pyQApp && PyObject_TypeCheck(pyObj, pyQObjectType)) {
if (Shiboken::Object::hasOwnership(pyObj) && Shiboken::Object::isValid(pyObj, false)) {
@@ -190,17 +190,17 @@ static void destructionVisitor(SbkObject* pyObj, void* data)
void destroyQCoreApplication()
{
- QCoreApplication* app = QCoreApplication::instance();
+ QCoreApplication *app = QCoreApplication::instance();
if (!app)
return;
SignalManager::instance().clear();
- Shiboken::BindingManager& bm = Shiboken::BindingManager::instance();
- SbkObject* pyQApp = bm.retrieveWrapper(app);
- PyTypeObject* pyQObjectType = Shiboken::Conversions::getPythonTypeObject("QObject*");
+ Shiboken::BindingManager &bm = Shiboken::BindingManager::instance();
+ SbkObject *pyQApp = bm.retrieveWrapper(app);
+ PyTypeObject *pyQObjectType = Shiboken::Conversions::getPythonTypeObject("QObject*");
assert(pyQObjectType);
- void* data[2] = {pyQApp, pyQObjectType};
+ void *data[2] = {pyQApp, pyQObjectType};
bm.visitAllPyObjects(&destructionVisitor, &data);
// in the end destroy app
@@ -214,26 +214,26 @@ void destroyQCoreApplication()
MakeSingletonQAppWrapper(NULL);
}
-std::size_t getSizeOfQObject(SbkObjectType* type)
+std::size_t getSizeOfQObject(SbkObjectType *type)
{
return retrieveTypeUserData(type)->cppObjSize;
}
-void initDynamicMetaObject(SbkObjectType* type, const QMetaObject* base, std::size_t cppObjSize)
+void initDynamicMetaObject(SbkObjectType *type, const QMetaObject *base, std::size_t cppObjSize)
{
//create DynamicMetaObject based on python type
auto userData =
- new TypeUserData(reinterpret_cast<PyTypeObject*>(type), base, cppObjSize);
+ new TypeUserData(reinterpret_cast<PyTypeObject *>(type), base, cppObjSize);
userData->mo.update();
Shiboken::ObjectType::setTypeUserData(type, userData, Shiboken::callCppDestructor<TypeUserData>);
//initialize staticQMetaObject property
void *metaObjectPtr = const_cast<QMetaObject *>(userData->mo.update());
- static SbkConverter* converter = Shiboken::Conversions::getConverter("QMetaObject");
+ static SbkConverter *converter = Shiboken::Conversions::getConverter("QMetaObject");
if (!converter)
return;
Shiboken::AutoDecRef pyMetaObject(Shiboken::Conversions::pointerToPython(converter, metaObjectPtr));
- PyObject_SetAttrString(reinterpret_cast<PyObject*>(type), "staticMetaObject", pyMetaObject);
+ PyObject_SetAttrString(reinterpret_cast<PyObject *>(type), "staticMetaObject", pyMetaObject);
}
TypeUserData *retrieveTypeUserData(SbkObjectType *sbkTypeObj)
@@ -266,23 +266,23 @@ const QMetaObject *retrieveMetaObject(PyObject *pyObj)
return retrieveMetaObject(pyTypeObj);
}
-void initDynamicMetaObject(SbkObjectType* type, const QMetaObject* base)
+void initDynamicMetaObject(SbkObjectType *type, const QMetaObject *base)
{
initDynamicMetaObject(type, base, 0);
}
void initQObjectSubType(SbkObjectType *type, PyObject *args, PyObject * /* kwds */)
{
- PyTypeObject* qObjType = Shiboken::Conversions::getPythonTypeObject("QObject*");
+ PyTypeObject *qObjType = Shiboken::Conversions::getPythonTypeObject("QObject*");
QByteArray className(Shiboken::String::toCString(PyTuple_GET_ITEM(args, 0)));
- PyObject* bases = PyTuple_GET_ITEM(args, 1);
+ PyObject *bases = PyTuple_GET_ITEM(args, 1);
int numBases = PyTuple_GET_SIZE(bases);
TypeUserData *userData = nullptr;
for (int i = 0; i < numBases; ++i) {
- PyTypeObject* base = reinterpret_cast<PyTypeObject*>(PyTuple_GET_ITEM(bases, i));
+ auto base = reinterpret_cast<PyTypeObject *>(PyTuple_GET_ITEM(bases, i));
if (PyType_IsSubtype(base, qObjType)) {
userData = retrieveTypeUserData(base);
break;
@@ -295,14 +295,14 @@ void initQObjectSubType(SbkObjectType *type, PyObject *args, PyObject * /* kwds
initDynamicMetaObject(type, userData->mo.update(), userData->cppObjSize);
}
-PyObject* getMetaDataFromQObject(QObject* cppSelf, PyObject* self, PyObject* name)
+PyObject *getMetaDataFromQObject(QObject *cppSelf, PyObject *self, PyObject *name)
{
- PyObject* attr = PyObject_GenericGetAttr(self, name);
- if (!Shiboken::Object::isValid(reinterpret_cast<SbkObject*>(self), false))
+ PyObject *attr = PyObject_GenericGetAttr(self, name);
+ if (!Shiboken::Object::isValid(reinterpret_cast<SbkObject *>(self), false))
return attr;
if (attr && Property::checkType(attr)) {
- PyObject *value = Property::getValue(reinterpret_cast<PySideProperty*>(attr), self);
+ PyObject *value = Property::getValue(reinterpret_cast<PySideProperty *>(attr), self);
Py_DECREF(attr);
if (!value)
return 0;
@@ -312,17 +312,17 @@ PyObject* getMetaDataFromQObject(QObject* cppSelf, PyObject* self, PyObject* nam
//mutate native signals to signal instance type
if (attr && PyObject_TypeCheck(attr, PySideSignalTypeF())) {
- PyObject* signal = reinterpret_cast<PyObject*>(Signal::initialize(reinterpret_cast<PySideSignal*>(attr), name, self));
- PyObject_SetAttr(self, name, reinterpret_cast<PyObject*>(signal));
+ PyObject *signal = reinterpret_cast<PyObject *>(Signal::initialize(reinterpret_cast<PySideSignal *>(attr), name, self));
+ PyObject_SetAttr(self, name, reinterpret_cast<PyObject *>(signal));
return signal;
}
//search on metaobject (avoid internal attributes started with '__')
if (!attr) {
- const char* cname = Shiboken::String::toCString(name);
+ const char *cname = Shiboken::String::toCString(name);
uint cnameLen = qstrlen(cname);
if (std::strncmp("__", cname, 2)) {
- const QMetaObject* metaObject = cppSelf->metaObject();
+ const QMetaObject *metaObject = cppSelf->metaObject();
//signal
QList<QMetaMethod> signalList;
for(int i=0, i_max = metaObject->methodCount(); i < i_max; i++) {
@@ -334,7 +334,7 @@ PyObject* getMetaDataFromQObject(QObject* cppSelf, PyObject* self, PyObject* nam
if (method.methodType() == QMetaMethod::Signal) {
signalList.append(method);
} else {
- PySideMetaFunction* func = MetaFunction::newObject(cppSelf, i);
+ PySideMetaFunction *func = MetaFunction::newObject(cppSelf, i);
if (func) {
PyObject *result = reinterpret_cast<PyObject *>(func);
PyObject_SetAttr(self, name, result);
@@ -344,7 +344,7 @@ PyObject* getMetaDataFromQObject(QObject* cppSelf, PyObject* self, PyObject* nam
}
}
if (!signalList.empty()) {
- PyObject* pySignal = reinterpret_cast<PyObject*>(Signal::newObjectFromMethod(self, signalList));
+ PyObject *pySignal = reinterpret_cast<PyObject *>(Signal::newObjectFromMethod(self, signalList));
PyObject_SetAttr(self, name, pySignal);
return pySignal;
}
@@ -353,24 +353,24 @@ PyObject* getMetaDataFromQObject(QObject* cppSelf, PyObject* self, PyObject* nam
return attr;
}
-bool inherits(PyTypeObject* objType, const char* class_name)
+bool inherits(PyTypeObject *objType, const char *class_name)
{
if (strcmp(objType->tp_name, class_name) == 0)
return true;
- PyTypeObject* base = objType->tp_base;
+ PyTypeObject *base = objType->tp_base;
if (base == 0)
return false;
return inherits(base, class_name);
}
-void* nextQObjectMemoryAddr()
+void *nextQObjectMemoryAddr()
{
return qobjectNextAddr;
}
-void setNextQObjectMemoryAddr(void* addr)
+void setNextQObjectMemoryAddr(void *addr)
{
qobjectNextAddr = addr;
}
@@ -379,27 +379,27 @@ void setNextQObjectMemoryAddr(void* addr)
// A QSharedPointer is used with a deletion function to invalidate a pointer
// when the property value is cleared. This should be a QSharedPointer with
-// a void* pointer, but that isn't allowed
+// a void *pointer, but that isn't allowed
typedef char any_t;
Q_DECLARE_METATYPE(QSharedPointer<any_t>);
namespace PySide
{
-static void invalidatePtr(any_t* object)
+static void invalidatePtr(any_t *object)
{
Shiboken::GilState state;
- SbkObject* wrapper = Shiboken::BindingManager::instance().retrieveWrapper(object);
+ SbkObject *wrapper = Shiboken::BindingManager::instance().retrieveWrapper(object);
if (wrapper != NULL)
Shiboken::BindingManager::instance().releaseWrapper(wrapper);
}
static const char invalidatePropertyName[] = "_PySideInvalidatePtr";
-PyObject* getWrapperForQObject(QObject* cppSelf, SbkObjectType* sbk_type)
+PyObject *getWrapperForQObject(QObject *cppSelf, SbkObjectType *sbk_type)
{
- PyObject* pyOut = reinterpret_cast<PyObject *>(Shiboken::BindingManager::instance().retrieveWrapper(cppSelf));
+ PyObject *pyOut = reinterpret_cast<PyObject *>(Shiboken::BindingManager::instance().retrieveWrapper(cppSelf));
if (pyOut) {
Py_INCREF(pyOut);
return pyOut;
@@ -410,7 +410,7 @@ PyObject* getWrapperForQObject(QObject* cppSelf, SbkObjectType* sbk_type)
// set and check if it's created after the set call
QVariant existing = cppSelf->property(invalidatePropertyName);
if (!existing.isValid()) {
- QSharedPointer<any_t> shared_with_del(reinterpret_cast<any_t*>(cppSelf), invalidatePtr);
+ QSharedPointer<any_t> shared_with_del(reinterpret_cast<any_t *>(cppSelf), invalidatePtr);
cppSelf->setProperty(invalidatePropertyName, QVariant::fromValue(shared_with_del));
pyOut = reinterpret_cast<PyObject *>(Shiboken::BindingManager::instance().retrieveWrapper(cppSelf));
if (pyOut) {
@@ -419,7 +419,7 @@ PyObject* getWrapperForQObject(QObject* cppSelf, SbkObjectType* sbk_type)
}
}
- const char* typeName = typeid(*cppSelf).name();
+ const char *typeName = typeid(*cppSelf).name();
pyOut = Shiboken::Object::newObject(sbk_type, cppSelf, false, false, typeName);
return pyOut;
@@ -509,7 +509,7 @@ bool registerInternalQtConf()
#if PY_MAJOR_VERSION >= 3
QString::fromWCharArray(Py_GetProgramFullPath());
#else
- // Python 2 unfortunately returns a char* array instead of a wchar*, which means that on
+ // Python 2 unfortunately returns a char * array instead of a wchar *, which means that on
// Windows if the executable path contains unicode characters, the returned path will be
// invalid. We can't use QCoreApplication::applicationFilePath because it requires an
// existing QCoreApplication instance despite being a static method.
diff --git a/sources/pyside2/libpyside/pyside.h b/sources/pyside2/libpyside/pyside.h
index b53048eba..1529d79c9 100644
--- a/sources/pyside2/libpyside/pyside.h
+++ b/sources/pyside2/libpyside/pyside.h
@@ -76,7 +76,7 @@ inline uint hash(const T& value)
* \param kwds key->value dictonary.
* \return True if everything goes well, false with a Python error setted otherwise.
*/
-PYSIDE_API bool fillQtProperties(PyObject* qObj, const QMetaObject* metaObj, PyObject* kwds, const char** blackList, unsigned int blackListSize);
+PYSIDE_API bool fillQtProperties(PyObject *qObj, const QMetaObject *metaObj, PyObject *kwds, const char **blackList, unsigned int blackListSize);
/**
* If the type \p T was registered on Qt meta type system with Q_DECLARE_METATYPE macro, this class will initialize
@@ -99,13 +99,13 @@ template<typename T>
struct initQtMetaType<T, false> {
};
-PYSIDE_DEPRECATED(PYSIDE_API void initDynamicMetaObject(SbkObjectType* type, const QMetaObject* base));
-PYSIDE_API void initDynamicMetaObject(SbkObjectType* type, const QMetaObject* base,
+PYSIDE_DEPRECATED(PYSIDE_API void initDynamicMetaObject(SbkObjectType *type, const QMetaObject *base));
+PYSIDE_API void initDynamicMetaObject(SbkObjectType *type, const QMetaObject *base,
std::size_t cppObjSize);
-PYSIDE_API void initQObjectSubType(SbkObjectType* type, PyObject* args, PyObject* kwds);
+PYSIDE_API void initQObjectSubType(SbkObjectType *type, PyObject *args, PyObject *kwds);
/// Return the size in bytes of a type that inherits QObject.
-PYSIDE_API std::size_t getSizeOfQObject(SbkObjectType* type);
+PYSIDE_API std::size_t getSizeOfQObject(SbkObjectType *type);
typedef void (*CleanupFunction)(void);
@@ -127,7 +127,7 @@ PYSIDE_API void destroyQCoreApplication();
* \param name Name of the argument which the function will try retrieve from MetaData
* \return The Python object which contains the Data obtained in metaObject or the Python attribute related with name
*/
-PYSIDE_API PyObject* getMetaDataFromQObject(QObject* cppSelf, PyObject* self, PyObject* name);
+PYSIDE_API PyObject *getMetaDataFromQObject(QObject *cppSelf, PyObject *self, PyObject *name);
/**
* Check if self inherits from class_name
@@ -135,12 +135,12 @@ PYSIDE_API PyObject* getMetaDataFromQObject(QObject* cppSelf, PyObject* self, Py
* \param class_name strict with the class name
* \return Returns true if self object inherits from class_name, otherwise returns false
*/
-PYSIDE_API bool inherits(PyTypeObject* self, const char* class_name);
+PYSIDE_API bool inherits(PyTypeObject *self, const char *class_name);
-PYSIDE_API void* nextQObjectMemoryAddr();
-PYSIDE_API void setNextQObjectMemoryAddr(void* addr);
+PYSIDE_API void *nextQObjectMemoryAddr();
+PYSIDE_API void setNextQObjectMemoryAddr(void *addr);
-PYSIDE_API PyObject* getWrapperForQObject(QObject* cppSelf, SbkObjectType* sbk_type);
+PYSIDE_API PyObject *getWrapperForQObject(QObject *cppSelf, SbkObjectType *sbk_type);
#ifdef PYSIDE_QML_SUPPORT
// Used by QtQuick module to notify QtQml that custom QtQuick items can be registered.
diff --git a/sources/pyside2/libpyside/pysideclassinfo.cpp b/sources/pyside2/libpyside/pysideclassinfo.cpp
index 4edf0fa91..bf2a1307f 100644
--- a/sources/pyside2/libpyside/pysideclassinfo.cpp
+++ b/sources/pyside2/libpyside/pysideclassinfo.cpp
@@ -51,10 +51,10 @@
extern "C"
{
-static PyObject* classInfoTpNew(PyTypeObject* subtype, PyObject* args, PyObject* kwds);
-static int classInfoTpInit(PyObject*, PyObject*, PyObject*);
-static void classInfoFree(void*);
-static PyObject* classCall(PyObject*, PyObject*, PyObject*);
+static PyObject *classInfoTpNew(PyTypeObject *subtype, PyObject *args, PyObject *kwds);
+static int classInfoTpInit(PyObject *, PyObject *, PyObject *);
+static void classInfoFree(void *);
+static PyObject *classCall(PyObject *, PyObject *, PyObject *);
static PyType_Slot PySideClassInfoType_slots[] = {
{Py_tp_call, (void *)classCall},
@@ -89,8 +89,8 @@ PyObject *classCall(PyObject *self, PyObject *args, PyObject * /* kw */)
return 0;
}
- PySideClassInfo* data = reinterpret_cast<PySideClassInfo*>(self);
- PySideClassInfoPrivate* pData = data->d;
+ PySideClassInfo *data = reinterpret_cast<PySideClassInfo *>(self);
+ PySideClassInfoPrivate *pData = data->d;
if (pData->m_alreadyWrapped) {
PyErr_SetString(PyExc_TypeError, "This instance of ClassInfo() was already used to wrap an object");
@@ -106,7 +106,7 @@ PyObject *classCall(PyObject *self, PyObject *args, PyObject * /* kw */)
return 0;
}
- PyTypeObject *klassType = reinterpret_cast<PyTypeObject*>(klass);
+ PyTypeObject *klassType = reinterpret_cast<PyTypeObject *>(klass);
if (Shiboken::ObjectType::checkType(klassType)) {
if (auto userData = PySide::retrieveTypeUserData(klassType)) {
PySide::MetaObjectBuilder &mo = userData->mo;
@@ -127,7 +127,7 @@ PyObject *classCall(PyObject *self, PyObject *args, PyObject * /* kw */)
static PyObject *classInfoTpNew(PyTypeObject *subtype, PyObject * /* args */, PyObject * /* kwds */)
{
- PySideClassInfo* me = reinterpret_cast<PySideClassInfo*>(subtype->tp_alloc(subtype, 0));
+ PySideClassInfo *me = reinterpret_cast<PySideClassInfo *>(subtype->tp_alloc(subtype, 0));
me->d = new PySideClassInfoPrivate;
me->d->m_alreadyWrapped = false;
@@ -135,18 +135,18 @@ static PyObject *classInfoTpNew(PyTypeObject *subtype, PyObject * /* args */, Py
return reinterpret_cast<PyObject *>(me);
}
-int classInfoTpInit(PyObject* self, PyObject* args, PyObject* kwds)
+int classInfoTpInit(PyObject *self, PyObject *args, PyObject *kwds)
{
if (PyTuple_Check(args) && PyTuple_Size(args) > 0) {
PyErr_Format(PyExc_TypeError, "ClassInfo() takes exactly 0 positional arguments (%zd given)", PyTuple_Size(args));
return -1;
}
- PySideClassInfo* data = reinterpret_cast<PySideClassInfo*>(self);
- PySideClassInfoPrivate* pData = data->d;
+ PySideClassInfo *data = reinterpret_cast<PySideClassInfo *>(self);
+ PySideClassInfoPrivate *pData = data->d;
- PyObject* key;
- PyObject* value;
+ PyObject *key;
+ PyObject *value;
Py_ssize_t pos = 0;
// PyDict_Next causes a segfault if kwds is empty
@@ -166,8 +166,8 @@ int classInfoTpInit(PyObject* self, PyObject* args, PyObject* kwds)
void classInfoFree(void *self)
{
- PyObject* pySelf = reinterpret_cast<PyObject*>(self);
- PySideClassInfo* data = reinterpret_cast<PySideClassInfo*>(self);
+ auto pySelf = reinterpret_cast<PyObject *>(self);
+ auto data = reinterpret_cast<PySideClassInfo *>(self);
delete data->d;
Py_TYPE(pySelf)->tp_base->tp_free(self);
@@ -179,7 +179,7 @@ void classInfoFree(void *self)
namespace PySide { namespace ClassInfo {
-void init(PyObject* module)
+void init(PyObject *module)
{
if (PyType_Ready(PySideClassInfoTypeF()) < 0)
return;
@@ -188,14 +188,14 @@ void init(PyObject* module)
PyModule_AddObject(module, CLASSINFO_CLASS_NAME, reinterpret_cast<PyObject *>(PySideClassInfoTypeF()));
}
-bool checkType(PyObject* pyObj)
+bool checkType(PyObject *pyObj)
{
if (pyObj)
return PyType_IsSubtype(Py_TYPE(pyObj), PySideClassInfoTypeF());
return false;
}
-QMap<QByteArray, QByteArray> getMap(PySideClassInfo* obj)
+QMap<QByteArray, QByteArray> getMap(PySideClassInfo *obj)
{
return obj->d->m_data;
}
diff --git a/sources/pyside2/libpyside/pysidemetafunction.cpp b/sources/pyside2/libpyside/pysidemetafunction.cpp
index 4cdc7ec16..346117201 100644
--- a/sources/pyside2/libpyside/pysidemetafunction.cpp
+++ b/sources/pyside2/libpyside/pysidemetafunction.cpp
@@ -49,13 +49,13 @@ extern "C"
struct PySideMetaFunctionPrivate
{
- QObject* qobject;
+ QObject *qobject;
int methodIndex;
};
//methods
-static void functionFree(void*);
-static PyObject* functionCall(PyObject*, PyObject*, PyObject*);
+static void functionFree(void *);
+static PyObject *functionCall(PyObject *, PyObject *, PyObject *);
static PyType_Slot PySideMetaFunctionType_slots[] = {
{Py_tp_call, (void *)functionCall},
@@ -83,15 +83,15 @@ PyTypeObject *PySideMetaFunctionTypeF(void)
void functionFree(void *self)
{
- PySideMetaFunction* function = reinterpret_cast<PySideMetaFunction*>(self);
+ PySideMetaFunction *function = reinterpret_cast<PySideMetaFunction *>(self);
delete function->d;
}
PyObject *functionCall(PyObject *self, PyObject *args, PyObject * /* kw */)
{
- PySideMetaFunction* function = reinterpret_cast<PySideMetaFunction*>(self);
+ PySideMetaFunction *function = reinterpret_cast<PySideMetaFunction *>(self);
- PyObject* retVal;
+ PyObject *retVal;
if (!PySide::MetaFunction::call(function->d->qobject, function->d->methodIndex, args, &retVal))
return 0;
return retVal;
@@ -101,7 +101,7 @@ PyObject *functionCall(PyObject *self, PyObject *args, PyObject * /* kw */)
namespace PySide { namespace MetaFunction {
-void init(PyObject* module)
+void init(PyObject *module)
{
if (PyType_Ready(PySideMetaFunctionTypeF()) < 0)
return;
@@ -109,7 +109,7 @@ void init(PyObject* module)
PyModule_AddObject(module, "MetaFunction", reinterpret_cast<PyObject *>(PySideMetaFunctionTypeF()));
}
-PySideMetaFunction* newObject(QObject* source, int methodIndex)
+PySideMetaFunction *newObject(QObject *source, int methodIndex)
{
if (methodIndex >= source->metaObject()->methodCount())
return 0;
@@ -117,7 +117,7 @@ PySideMetaFunction* newObject(QObject* source, int methodIndex)
QMetaMethod method = source->metaObject()->method(methodIndex);
if ((method.methodType() == QMetaMethod::Slot) ||
(method.methodType() == QMetaMethod::Method)) {
- PySideMetaFunction* function = PyObject_New(PySideMetaFunction, PySideMetaFunctionTypeF());
+ PySideMetaFunction *function = PyObject_New(PySideMetaFunction, PySideMetaFunctionTypeF());
function->d = new PySideMetaFunctionPrivate();
function->d->qobject = source;
function->d->methodIndex = methodIndex;
@@ -126,7 +126,7 @@ PySideMetaFunction* newObject(QObject* source, int methodIndex)
return 0;
}
-bool call(QObject* self, int methodIndex, PyObject* args, PyObject** retVal)
+bool call(QObject *self, int methodIndex, PyObject *args, PyObject **retVal)
{
QMetaMethod method = self->metaObject()->method(methodIndex);
@@ -150,11 +150,11 @@ bool call(QObject* self, int methodIndex, PyObject* args, PyObject** retVal)
return false;
}
- QVariant* methValues = new QVariant[numArgs];
- void** methArgs = new void*[numArgs];
+ QVariant *methValues = new QVariant[numArgs];
+ void **methArgs = new void *[numArgs];
// Prepare room for return type
- const char* returnType = method.typeName();
+ const char *returnType = method.typeName();
if (returnType && std::strcmp("void", returnType))
argTypes.prepend(returnType);
else
@@ -162,7 +162,7 @@ bool call(QObject* self, int methodIndex, PyObject* args, PyObject** retVal)
int i;
for (i = 0; i < numArgs; ++i) {
- const QByteArray& typeName = argTypes[i];
+ const QByteArray &typeName = argTypes.at(i);
// This must happen only when the method hasn't return type.
if (typeName.isEmpty()) {
methArgs[i] = 0;
@@ -204,7 +204,7 @@ bool call(QObject* self, int methodIndex, PyObject* args, PyObject** retVal)
if (retVal) {
if (methArgs[0]) {
- static SbkConverter* qVariantTypeConverter = Shiboken::Conversions::getConverter("QVariant");
+ static SbkConverter *qVariantTypeConverter = Shiboken::Conversions::getConverter("QVariant");
Q_ASSERT(qVariantTypeConverter);
*retVal = Shiboken::Conversions::copyToPython(qVariantTypeConverter, &methValues[0]);
} else {
diff --git a/sources/pyside2/libpyside/pysidemetafunction.h b/sources/pyside2/libpyside/pysidemetafunction.h
index 1085ecb5e..f7cc5307b 100644
--- a/sources/pyside2/libpyside/pysidemetafunction.h
+++ b/sources/pyside2/libpyside/pysidemetafunction.h
@@ -54,7 +54,7 @@ extern "C"
struct PYSIDE_API PySideMetaFunction
{
PyObject_HEAD
- PySideMetaFunctionPrivate* d;
+ PySideMetaFunctionPrivate *d;
};
}; //extern "C"
@@ -67,7 +67,7 @@ namespace PySide { namespace MetaFunction {
* @param methodIndex The index of this function on MetaObject
* @return Return a new reference of PySideMetaFunction
**/
-PYSIDE_API PySideMetaFunction* newObject(QObject* obj, int methodIndex);
+PYSIDE_API PySideMetaFunction *newObject(QObject *obj, int methodIndex);
} //namespace MetaFunction
} //namespace PySide
diff --git a/sources/pyside2/libpyside/pysidemetafunction_p.h b/sources/pyside2/libpyside/pysidemetafunction_p.h
index 442e05ea7..c67233857 100644
--- a/sources/pyside2/libpyside/pysidemetafunction_p.h
+++ b/sources/pyside2/libpyside/pysidemetafunction_p.h
@@ -50,11 +50,11 @@ QT_END_NAMESPACE
namespace PySide { namespace MetaFunction {
- void init(PyObject* module);
+ void init(PyObject *module);
/**
* Does a Qt metacall on a QObject
*/
- bool call(QObject* self, int methodIndex, PyObject* args, PyObject** retVal = 0);
+ bool call(QObject *self, int methodIndex, PyObject *args, PyObject **retVal = nullptr);
} //namespace MetaFunction
} //namespace PySide
diff --git a/sources/pyside2/libpyside/pysideproperty.cpp b/sources/pyside2/libpyside/pysideproperty.cpp
index c48a6f882..a2bf5fd2b 100644
--- a/sources/pyside2/libpyside/pysideproperty.cpp
+++ b/sources/pyside2/libpyside/pysideproperty.cpp
@@ -51,16 +51,16 @@
extern "C"
{
-static PyObject* qpropertyTpNew(PyTypeObject* subtype, PyObject* args, PyObject* kwds);
-static int qpropertyTpInit(PyObject*, PyObject*, PyObject*);
-static void qpropertyDeAlloc(PyObject* self);
+static PyObject *qpropertyTpNew(PyTypeObject *subtype, PyObject *args, PyObject *kwds);
+static int qpropertyTpInit(PyObject *, PyObject *, PyObject *);
+static void qpropertyDeAlloc(PyObject *self);
//methods
-static PyObject* qPropertyCall(PyObject*, PyObject*, PyObject*);
-static PyObject* qPropertySetter(PyObject*, PyObject*);
-static PyObject* qPropertyGetter(PyObject*, PyObject*);
-static int qpropertyTraverse(PyObject* self, visitproc visit, void* arg);
-static int qpropertyClear(PyObject* self);
+static PyObject *qPropertyCall(PyObject *, PyObject *, PyObject *);
+static PyObject *qPropertySetter(PyObject *, PyObject *);
+static PyObject *qPropertyGetter(PyObject *, PyObject *);
+static int qpropertyTraverse(PyObject *self, visitproc visit, void *arg);
+static int qpropertyClear(PyObject *self);
static PyMethodDef PySidePropertyMethods[] = {
{"setter", (PyCFunction)qPropertySetter, METH_O, 0},
@@ -98,7 +98,7 @@ PyTypeObject *PySidePropertyTypeF(void)
return type;
}
-static void qpropertyMetaCall(PySideProperty* pp, PyObject* self, QMetaObject::Call call, void** args)
+static void qpropertyMetaCall(PySideProperty *pp, PyObject *self, QMetaObject::Call call, void **args)
{
Shiboken::Conversions::SpecificConverter converter(pp->d->typeName);
Q_ASSERT(converter);
@@ -109,7 +109,7 @@ static void qpropertyMetaCall(PySideProperty* pp, PyObject* self, QMetaObject::C
case QMetaObject::ReadProperty:
{
Shiboken::GilState gil;
- PyObject* value = PySide::Property::getValue(pp, self);
+ PyObject *value = PySide::Property::getValue(pp, self);
if (value) {
converter.toCpp(value, args[0]);
Py_DECREF(value);
@@ -150,16 +150,16 @@ static void qpropertyMetaCall(PySideProperty* pp, PyObject* self, QMetaObject::C
static PyObject *qpropertyTpNew(PyTypeObject *subtype, PyObject * /* args */, PyObject * /* kwds */)
{
- PySideProperty* me = reinterpret_cast<PySideProperty*>(subtype->tp_alloc(subtype, 0));
+ PySideProperty *me = reinterpret_cast<PySideProperty *>(subtype->tp_alloc(subtype, 0));
me->d = new PySidePropertyPrivate;
return reinterpret_cast<PyObject *>(me);
}
-int qpropertyTpInit(PyObject* self, PyObject* args, PyObject* kwds)
+int qpropertyTpInit(PyObject *self, PyObject *args, PyObject *kwds)
{
- PyObject* type = 0;
- PySideProperty* data = reinterpret_cast<PySideProperty*>(self);
- PySidePropertyPrivate* pData = data->d;
+ PyObject *type = nullptr;
+ auto data = reinterpret_cast<PySideProperty *>(self);
+ PySidePropertyPrivate *pData = data->d;
pData->metaCallHandler = &qpropertyMetaCall;
static const char *kwlist[] = {"type", "fget", "fset", "freset", "fdel", "doc", "notify",
@@ -169,7 +169,7 @@ int qpropertyTpInit(PyObject* self, PyObject* args, PyObject* kwds)
if (!PyArg_ParseTupleAndKeywords(args, kwds,
"O|OOOOsObbbbbb:QtCore.QProperty",
- const_cast<char**>(kwlist),
+ const_cast<char **>(kwlist),
/*OO*/ &type, &(pData->fget),
/*OOO*/ &(pData->fset), &(pData->freset), &(pData->fdel),
/*s*/ &doc,
@@ -208,7 +208,7 @@ int qpropertyTpInit(PyObject* self, PyObject* args, PyObject* kwds)
return -1;
}
-void qpropertyDeAlloc(PyObject* self)
+void qpropertyDeAlloc(PyObject *self)
{
qpropertyClear(self);
Py_TYPE(self)->tp_free(self);
@@ -218,8 +218,8 @@ PyObject *qPropertyCall(PyObject *self, PyObject *args, PyObject * /* kw */)
{
PyObject *callback = PyTuple_GetItem(args, 0);
if (PyFunction_Check(callback)) {
- PySideProperty *prop = reinterpret_cast<PySideProperty*>(self);
- PySidePropertyPrivate* pData = prop->d;
+ auto prop = reinterpret_cast<PySideProperty *>(self);
+ PySidePropertyPrivate *pData = prop->d;
Py_INCREF(callback);
pData->fget = callback;
@@ -231,11 +231,11 @@ PyObject *qPropertyCall(PyObject *self, PyObject *args, PyObject * /* kw */)
return nullptr;
}
-PyObject* qPropertySetter(PyObject* self, PyObject* callback)
+PyObject *qPropertySetter(PyObject *self, PyObject *callback)
{
if (PyFunction_Check(callback)) {
- PySideProperty *prop = reinterpret_cast<PySideProperty*>(self);
- PySidePropertyPrivate* pData = prop->d;
+ PySideProperty *prop = reinterpret_cast<PySideProperty *>(self);
+ PySidePropertyPrivate *pData = prop->d;
Py_INCREF(callback);
pData->fset = callback;
@@ -247,11 +247,11 @@ PyObject* qPropertySetter(PyObject* self, PyObject* callback)
return nullptr;
}
-PyObject* qPropertyGetter(PyObject* self, PyObject* callback)
+PyObject *qPropertyGetter(PyObject *self, PyObject *callback)
{
if (PyFunction_Check(callback)) {
- PySideProperty *prop = reinterpret_cast<PySideProperty*>(self);
- PySidePropertyPrivate* pData = prop->d;
+ PySideProperty *prop = reinterpret_cast<PySideProperty *>(self);
+ PySidePropertyPrivate *pData = prop->d;
Py_INCREF(callback);
pData->fget = callback;
@@ -263,9 +263,9 @@ PyObject* qPropertyGetter(PyObject* self, PyObject* callback)
return nullptr;
}
-static int qpropertyTraverse(PyObject* self, visitproc visit, void* arg)
+static int qpropertyTraverse(PyObject *self, visitproc visit, void *arg)
{
- PySidePropertyPrivate* data = reinterpret_cast<PySideProperty*>(self)->d;
+ PySidePropertyPrivate *data = reinterpret_cast<PySideProperty *>(self)->d;
if (!data)
return 0;
@@ -277,9 +277,9 @@ static int qpropertyTraverse(PyObject* self, visitproc visit, void* arg)
return 0;
}
-static int qpropertyClear(PyObject* self)
+static int qpropertyClear(PyObject *self)
{
- PySidePropertyPrivate* data = reinterpret_cast<PySideProperty*>(self)->d;
+ PySidePropertyPrivate *data = reinterpret_cast<PySideProperty *>(self)->d;
if (!data)
return 0;
@@ -291,7 +291,7 @@ static int qpropertyClear(PyObject* self)
delete data;
- reinterpret_cast<PySideProperty*>(self)->d = 0;
+ reinterpret_cast<PySideProperty *>(self)->d = nullptr;
return 0;
}
@@ -299,16 +299,16 @@ static int qpropertyClear(PyObject* self)
namespace {
-static PyObject* getFromType(PyTypeObject* type, PyObject* name)
+static PyObject *getFromType(PyTypeObject *type, PyObject *name)
{
- PyObject* attr = 0;
+ PyObject *attr = nullptr;
attr = PyDict_GetItem(type->tp_dict, name);
if (!attr) {
- PyObject* bases = type->tp_bases;
+ PyObject *bases = type->tp_bases;
int size = PyTuple_GET_SIZE(bases);
for(int i=0; i < size; i++) {
- PyObject* base = PyTuple_GET_ITEM(bases, i);
- attr = getFromType(reinterpret_cast<PyTypeObject*>(base), name);
+ PyObject *base = PyTuple_GET_ITEM(bases, i);
+ attr = getFromType(reinterpret_cast<PyTypeObject *>(base), name);
if (attr)
return attr;
}
@@ -321,7 +321,7 @@ static PyObject* getFromType(PyTypeObject* type, PyObject* name)
namespace PySide { namespace Property {
-void init(PyObject* module)
+void init(PyObject *module)
{
if (PyType_Ready(PySidePropertyTypeF()) < 0)
return;
@@ -330,7 +330,7 @@ void init(PyObject* module)
PyModule_AddObject(module, QPROPERTY_CLASS_NAME, reinterpret_cast<PyObject *>(PySidePropertyTypeF()));
}
-bool checkType(PyObject* pyObj)
+bool checkType(PyObject *pyObj)
{
if (pyObj) {
return PyType_IsSubtype(Py_TYPE(pyObj), PySidePropertyTypeF());
@@ -338,14 +338,14 @@ bool checkType(PyObject* pyObj)
return false;
}
-bool isPropertyType(PyObject* pyObj)
+bool isPropertyType(PyObject *pyObj)
{
return checkType(pyObj);
}
-int setValue(PySideProperty* self, PyObject* source, PyObject* value)
+int setValue(PySideProperty *self, PyObject *source, PyObject *value)
{
- PyObject* fset = self->d->fset;
+ PyObject *fset = self->d->fset;
if (fset) {
Shiboken::AutoDecRef args(PyTuple_New(2));
PyTuple_SET_ITEM(args, 0, source);
@@ -360,9 +360,9 @@ int setValue(PySideProperty* self, PyObject* source, PyObject* value)
return -1;
}
-PyObject* getValue(PySideProperty* self, PyObject* source)
+PyObject *getValue(PySideProperty *self, PyObject *source)
{
- PyObject* fget = self->d->fget;
+ PyObject *fget = self->d->fget;
if (fget) {
Shiboken::AutoDecRef args(PyTuple_New(1));
Py_INCREF(source);
@@ -372,9 +372,9 @@ PyObject* getValue(PySideProperty* self, PyObject* source)
return 0;
}
-int reset(PySideProperty* self, PyObject* source)
+int reset(PySideProperty *self, PyObject *source)
{
- PyObject* freset = self->d->freset;
+ PyObject *freset = self->d->freset;
if (freset) {
Shiboken::AutoDecRef args(PyTuple_New(1));
Py_INCREF(source);
@@ -385,25 +385,24 @@ int reset(PySideProperty* self, PyObject* source)
return -1;
}
-const char* getTypeName(const PySideProperty* self)
+const char *getTypeName(const PySideProperty *self)
{
return self->d->typeName;
}
-PySideProperty* getObject(PyObject* source, PyObject* name)
+PySideProperty *getObject(PyObject *source, PyObject *name)
{
- PyObject* attr = 0;
+ PyObject *attr = nullptr;
if (Shiboken::Object::isUserType(source)) {
- PyObject* dict = reinterpret_cast<SbkObject*>(source)->ob_dict;
- if (dict)
+ if (auto dict = reinterpret_cast<SbkObject *>(source)->ob_dict)
attr = PyDict_GetItem(dict, name);
}
attr = getFromType(Py_TYPE(source), name);
if (attr && checkType(attr)) {
Py_INCREF(attr);
- return reinterpret_cast<PySideProperty*>(attr);
+ return reinterpret_cast<PySideProperty *>(attr);
}
if (!attr)
@@ -417,50 +416,50 @@ bool isReadable(const PySideProperty * /* self */)
return true;
}
-bool isWritable(const PySideProperty* self)
+bool isWritable(const PySideProperty *self)
{
return (self->d->fset != 0);
}
-bool hasReset(const PySideProperty* self)
+bool hasReset(const PySideProperty *self)
{
return (self->d->freset != 0);
}
-bool isDesignable(const PySideProperty* self)
+bool isDesignable(const PySideProperty *self)
{
return self->d->designable;
}
-bool isScriptable(const PySideProperty* self)
+bool isScriptable(const PySideProperty *self)
{
return self->d->scriptable;
}
-bool isStored(const PySideProperty* self)
+bool isStored(const PySideProperty *self)
{
return self->d->stored;
}
-bool isUser(const PySideProperty* self)
+bool isUser(const PySideProperty *self)
{
return self->d->user;
}
-bool isConstant(const PySideProperty* self)
+bool isConstant(const PySideProperty *self)
{
return self->d->constant;
}
-bool isFinal(const PySideProperty* self)
+bool isFinal(const PySideProperty *self)
{
return self->d->final;
}
-const char* getNotifyName(PySideProperty* self)
+const char *getNotifyName(PySideProperty *self)
{
if (self->d->notifySignature.isEmpty()) {
- PyObject* str = PyObject_Str(self->d->notify);
+ PyObject *str = PyObject_Str(self->d->notify);
self->d->notifySignature = Shiboken::String::toCString(str);
Py_DECREF(str);
}
@@ -469,22 +468,22 @@ const char* getNotifyName(PySideProperty* self)
? nullptr : self->d->notifySignature.constData();
}
-void setMetaCallHandler(PySideProperty* self, MetaCallHandler handler)
+void setMetaCallHandler(PySideProperty *self, MetaCallHandler handler)
{
self->d->metaCallHandler = handler;
}
-void setTypeName(PySideProperty* self, const char* typeName)
+void setTypeName(PySideProperty *self, const char *typeName)
{
self->d->typeName = typeName;
}
-void setUserData(PySideProperty* self, void* data)
+void setUserData(PySideProperty *self, void *data)
{
self->d->userData = data;
}
-void* userData(PySideProperty* self)
+void *userData(PySideProperty *self)
{
return self->d->userData;
}
diff --git a/sources/pyside2/libpyside/pysideqflags.cpp b/sources/pyside2/libpyside/pysideqflags.cpp
index cb57031b0..fd0ed005f 100644
--- a/sources/pyside2/libpyside/pysideqflags.cpp
+++ b/sources/pyside2/libpyside/pysideqflags.cpp
@@ -47,8 +47,8 @@ extern "C" {
struct PySideQFlagsTypePrivate
{
- SbkConverter** converterPtr;
- SbkConverter* converter;
+ SbkConverter **converterPtr;
+ SbkConverter *converter;
};
/**
* Type of all QFlags
@@ -58,13 +58,13 @@ extern "C" {
PyTypeObject type;
};
- #define PYSIDE_QFLAGS(X) reinterpret_cast<PySideQFlagsObject*>(X)
+ #define PYSIDE_QFLAGS(X) reinterpret_cast<PySideQFlagsObject *>(X)
PyObject *PySideQFlagsNew(PyTypeObject *type, PyObject *args, PyObject * /* kwds */)
{
long val = 0;
if (PyTuple_GET_SIZE(args)) {
- PyObject* arg = PyTuple_GET_ITEM(args, 0);
+ PyObject *arg = PyTuple_GET_ITEM(args, 0);
if (Shiboken::isShibokenEnum(arg)) {// faster call
val = Shiboken::Enum::getValue(arg);
} else if (PyNumber_Check(arg)) {
@@ -75,18 +75,18 @@ extern "C" {
return 0;
}
}
- PySideQFlagsObject* self = PyObject_New(PySideQFlagsObject, type);
+ PySideQFlagsObject *self = PyObject_New(PySideQFlagsObject, type);
self->ob_value = val;
- return reinterpret_cast<PyObject*>(self);
+ return reinterpret_cast<PyObject *>(self);
}
- static long getNumberValue(PyObject* v)
+ static long getNumberValue(PyObject *v)
{
Shiboken::AutoDecRef number(PyNumber_Long(v));
return PyLong_AsLong(number);
}
- PyObject* PySideQFlagsRichCompare(PyObject* self, PyObject* other, int op)
+ PyObject *PySideQFlagsRichCompare(PyObject *self, PyObject *other, int op)
{
int result = 0;
if (!PyNumber_Check(other)) {
@@ -163,7 +163,7 @@ namespace QFlags
SbkNewQFlagsType_slots,
};
- PyTypeObject *create(const char* name, PyType_Slot numberMethods[])
+ PyTypeObject *create(const char *name, PyType_Slot numberMethods[])
{
char qualname[200];
// PYSIDE-747: Here we insert now the full class name.
@@ -183,7 +183,7 @@ namespace QFlags
PyTypeObject *type = (PyTypeObject *)PyType_FromSpec(newspec);
Py_TYPE(type) = &PyType_Type;
- PySideQFlagsType* flagsType = reinterpret_cast<PySideQFlagsType*>(type);
+ PySideQFlagsType *flagsType = reinterpret_cast<PySideQFlagsType *>(type);
PepType_PFTP(flagsType)->converterPtr = &PepType_PFTP(flagsType)->converter;
if (PyType_Ready(type) < 0)
@@ -192,14 +192,14 @@ namespace QFlags
return type;
}
- PySideQFlagsObject* newObject(long value, PyTypeObject* type)
+ PySideQFlagsObject *newObject(long value, PyTypeObject *type)
{
- PySideQFlagsObject* qflags = PyObject_New(PySideQFlagsObject, type);
+ PySideQFlagsObject *qflags = PyObject_New(PySideQFlagsObject, type);
qflags->ob_value = value;
return qflags;
}
- long getValue(PySideQFlagsObject* self)
+ long getValue(PySideQFlagsObject *self)
{
return self->ob_value;
}
diff --git a/sources/pyside2/libpyside/pysidesignal.cpp b/sources/pyside2/libpyside/pysidesignal.cpp
index 0f1993e79..169028f0c 100644
--- a/sources/pyside2/libpyside/pysidesignal.cpp
+++ b/sources/pyside2/libpyside/pysidesignal.cpp
@@ -71,11 +71,11 @@ namespace Signal {
QMetaMethod::Attributes m_attributes = QMetaMethod::Compatibility;
};
- static QByteArray buildSignature(const QByteArray &, const QByteArray &);
- static void appendSignature(PySideSignal*, const SignalSignature &);
- static void instanceInitialize(PySideSignalInstance*, PyObject*, PySideSignal*, PyObject*, int);
- static QByteArray parseSignature(PyObject *);
- static PyObject* buildQtCompatible(const QByteArray &);
+ static QByteArray buildSignature(const QByteArray &, const QByteArray &);
+ static void appendSignature(PySideSignal *, const SignalSignature &);
+ static void instanceInitialize(PySideSignalInstance *, PyObject *, PySideSignal *, PyObject *, int);
+ static QByteArray parseSignature(PyObject *);
+ static PyObject *buildQtCompatible(const QByteArray &);
}
}
@@ -83,22 +83,22 @@ extern "C"
{
// Signal methods
-static int signalTpInit(PyObject*, PyObject*, PyObject*);
-static void signalFree(void*);
-static void signalInstanceFree(void*);
-static PyObject* signalGetItem(PyObject* self, PyObject* key);
-static PyObject* signalToString(PyObject* self);
+static int signalTpInit(PyObject *, PyObject *, PyObject *);
+static void signalFree(void *);
+static void signalInstanceFree(void *);
+static PyObject *signalGetItem(PyObject *self, PyObject *key);
+static PyObject *signalToString(PyObject *self);
// Signal Instance methods
-static PyObject* signalInstanceConnect(PyObject*, PyObject*, PyObject*);
-static PyObject* signalInstanceDisconnect(PyObject*, PyObject*);
-static PyObject* signalInstanceEmit(PyObject*, PyObject*);
-static PyObject* signalInstanceGetItem(PyObject*, PyObject*);
+static PyObject *signalInstanceConnect(PyObject *, PyObject *, PyObject *);
+static PyObject *signalInstanceDisconnect(PyObject *, PyObject *);
+static PyObject *signalInstanceEmit(PyObject *, PyObject *);
+static PyObject *signalInstanceGetItem(PyObject *, PyObject *);
-static PyObject* signalInstanceCall(PyObject* self, PyObject* args, PyObject* kw);
-static PyObject* signalCall(PyObject*, PyObject*, PyObject*);
+static PyObject *signalInstanceCall(PyObject *self, PyObject *args, PyObject *kw);
+static PyObject *signalCall(PyObject *, PyObject *, PyObject *);
-static PyObject* metaSignalCheck(PyObject*, PyObject*);
+static PyObject *metaSignalCheck(PyObject *, PyObject *);
static PyMethodDef Signal_methods[] = {
@@ -200,28 +200,28 @@ PyTypeObject *PySideSignalInstanceTypeF(void)
return type;
}
-int signalTpInit(PyObject* self, PyObject* args, PyObject* kwds)
+int signalTpInit(PyObject *self, PyObject *args, PyObject *kwds)
{
- static PyObject* emptyTuple = 0;
- static const char* kwlist[] = {"name", 0};
- char* argName = 0;
+ static PyObject *emptyTuple = nullptr;
+ static const char *kwlist[] = {"name", nullptr};
+ char *argName = nullptr;
if (emptyTuple == 0)
emptyTuple = PyTuple_New(0);
if (!PyArg_ParseTupleAndKeywords(emptyTuple, kwds,
- "|s:QtCore." SIGNAL_CLASS_NAME, const_cast<char**>(kwlist), &argName))
+ "|s:QtCore." SIGNAL_CLASS_NAME, const_cast<char **>(kwlist), &argName))
return 0;
bool tupledArgs = false;
- PySideSignal* data = reinterpret_cast<PySideSignal*>(self);
+ PySideSignal *data = reinterpret_cast<PySideSignal *>(self);
if (!data->data)
data->data = new PySideSignalData;
if (argName)
data->data->signalName = argName;
for (Py_ssize_t i = 0, i_max = PyTuple_Size(args); i < i_max; i++) {
- PyObject* arg = PyTuple_GET_ITEM(args, i);
+ PyObject *arg = PyTuple_GET_ITEM(args, i);
if (PySequence_Check(arg) && !Shiboken::String::check(arg)) {
tupledArgs = true;
const auto sig = PySide::Signal::parseSignature(arg);
@@ -241,10 +241,10 @@ int signalTpInit(PyObject* self, PyObject* args, PyObject* kwds)
return 1;
}
-void signalFree(void* self)
+void signalFree(void *self)
{
- PyObject* pySelf = reinterpret_cast<PyObject*>(self);
- PySideSignal* data = reinterpret_cast<PySideSignal*>(self);
+ auto pySelf = reinterpret_cast<PyObject *>(self);
+ auto data = reinterpret_cast<PySideSignal *>(self);
delete data->data;
data->data = nullptr;
Py_XDECREF(data->homonymousMethod);
@@ -253,9 +253,9 @@ void signalFree(void* self)
Py_TYPE(pySelf)->tp_base->tp_free(self);
}
-PyObject* signalGetItem(PyObject* self, PyObject* key)
+PyObject *signalGetItem(PyObject *self, PyObject *key)
{
- PySideSignal* data = reinterpret_cast<PySideSignal*>(self);
+ auto data = reinterpret_cast<PySideSignal *>(self);
QByteArray sigKey;
if (key) {
sigKey = PySide::Signal::parseSignature(key);
@@ -268,17 +268,17 @@ PyObject* signalGetItem(PyObject* self, PyObject* key)
}
-PyObject* signalToString(PyObject* self)
+PyObject *signalToString(PyObject *self)
{
return signalGetItem(self, 0);
}
-void signalInstanceFree(void* self)
+void signalInstanceFree(void *self)
{
- PyObject* pySelf = reinterpret_cast<PyObject*>(self);
- PySideSignalInstance* data = reinterpret_cast<PySideSignalInstance*>(self);
+ auto pySelf = reinterpret_cast<PyObject *>(self);
+ auto data = reinterpret_cast<PySideSignalInstance *>(self);
- PySideSignalInstancePrivate* dataPvt = data->d;
+ PySideSignalInstancePrivate *dataPvt = data->d;
Py_XDECREF(dataPvt->homonymousMethod);
@@ -291,27 +291,27 @@ void signalInstanceFree(void* self)
Py_TYPE(pySelf)->tp_base->tp_free(self);
}
-PyObject* signalInstanceConnect(PyObject* self, PyObject* args, PyObject* kwds)
+PyObject *signalInstanceConnect(PyObject *self, PyObject *args, PyObject *kwds)
{
- PyObject* slot = 0;
- PyObject* type = 0;
- static const char* kwlist[] = {"slot", "type", 0};
+ PyObject *slot = nullptr;
+ PyObject *type = nullptr;
+ static const char *kwlist[] = {"slot", "type", nullptr};
if (!PyArg_ParseTupleAndKeywords(args, kwds,
- "O|O:" SIGNAL_INSTANCE_NAME, const_cast<char**>(kwlist), &slot, &type))
+ "O|O:" SIGNAL_INSTANCE_NAME, const_cast<char **>(kwlist), &slot, &type))
return 0;
- PySideSignalInstance* source = reinterpret_cast<PySideSignalInstance*>(self);
+ PySideSignalInstance *source = reinterpret_cast<PySideSignalInstance *>(self);
Shiboken::AutoDecRef pyArgs(PyList_New(0));
bool match = false;
if (Py_TYPE(slot) == PySideSignalInstanceTypeF()) {
- PySideSignalInstance* sourceWalk = source;
- PySideSignalInstance* targetWalk;
+ PySideSignalInstance *sourceWalk = source;
+ PySideSignalInstance *targetWalk;
//find best match
while (sourceWalk && !match) {
- targetWalk = reinterpret_cast<PySideSignalInstance*>(slot);
+ targetWalk = reinterpret_cast<PySideSignalInstance *>(slot);
while (targetWalk && !match) {
if (QMetaObject::checkConnectArgs(sourceWalk->d->signature, targetWalk->d->signature)) {
PyList_Append(pyArgs, sourceWalk->d->source);
@@ -324,9 +324,9 @@ PyObject* signalInstanceConnect(PyObject* self, PyObject* args, PyObject* kwds)
match = true;
}
- targetWalk = reinterpret_cast<PySideSignalInstance*>(targetWalk->d->next);
+ targetWalk = reinterpret_cast<PySideSignalInstance *>(targetWalk->d->next);
}
- sourceWalk = reinterpret_cast<PySideSignalInstance*>(sourceWalk->d->next);
+ sourceWalk = reinterpret_cast<PySideSignalInstance *>(sourceWalk->d->next);
}
} else {
// Check signature of the slot (method or function) to match signal
@@ -399,7 +399,7 @@ PyObject* signalInstanceConnect(PyObject* self, PyObject* args, PyObject* kwds)
PyErr_SetString(PyExc_RuntimeError, "method 'connect' vanished!");
return 0;
}
- PyObject* result = PyObject_CallObject(pyMethod, tupleArgs);
+ PyObject *result = PyObject_CallObject(pyMethod, tupleArgs);
if (result == Py_True || result == Py_False)
return result;
Py_XDECREF(result);
@@ -415,9 +415,9 @@ int argCountInSignature(const char *signature)
return QByteArray(signature).count(",") + 1;
}
-PyObject* signalInstanceEmit(PyObject* self, PyObject* args)
+PyObject *signalInstanceEmit(PyObject *self, PyObject *args)
{
- PySideSignalInstance* source = reinterpret_cast<PySideSignalInstance*>(self);
+ PySideSignalInstance *source = reinterpret_cast<PySideSignalInstance *>(self);
Shiboken::AutoDecRef pyArgs(PyList_New(0));
int numArgsGiven = PySequence_Fast_GET_SIZE(args);
@@ -453,15 +453,15 @@ PyObject* signalInstanceEmit(PyObject* self, PyObject* args)
return PyObject_CallObject(pyMethod, tupleArgs);
}
-PyObject* signalInstanceGetItem(PyObject* self, PyObject* key)
+PyObject *signalInstanceGetItem(PyObject *self, PyObject *key)
{
- PySideSignalInstance* data = reinterpret_cast<PySideSignalInstance*>(self);
+ auto data = reinterpret_cast<PySideSignalInstance *>(self);
const auto sigName = data->d->signalName;
const auto sigKey = PySide::Signal::parseSignature(key);
const auto sig = PySide::Signal::buildSignature(sigName, sigKey);
while (data) {
if (data->d->signature == sig) {
- PyObject* result = reinterpret_cast<PyObject*>(data);
+ PyObject *result = reinterpret_cast<PyObject *>(data);
Py_INCREF(result);
return result;
}
@@ -473,12 +473,12 @@ PyObject* signalInstanceGetItem(PyObject* self, PyObject* key)
return 0;
}
-PyObject* signalInstanceDisconnect(PyObject* self, PyObject* args)
+PyObject *signalInstanceDisconnect(PyObject *self, PyObject *args)
{
- PySideSignalInstance* source = reinterpret_cast<PySideSignalInstance*>(self);
+ auto source = reinterpret_cast<PySideSignalInstance *>(self);
Shiboken::AutoDecRef pyArgs(PyList_New(0));
- PyObject* slot;
+ PyObject *slot;
if (PyTuple_Check(args) && PyTuple_GET_SIZE(args))
slot = PyTuple_GET_ITEM(args, 0);
else
@@ -486,7 +486,7 @@ PyObject* signalInstanceDisconnect(PyObject* self, PyObject* args)
bool match = false;
if (Py_TYPE(slot) == PySideSignalInstanceTypeF()) {
- PySideSignalInstance* target = reinterpret_cast<PySideSignalInstance*>(slot);
+ PySideSignalInstance *target = reinterpret_cast<PySideSignalInstance *>(slot);
if (QMetaObject::checkConnectArgs(source->d->signature, target->d->signature)) {
PyList_Append(pyArgs, source->d->source);
Shiboken::AutoDecRef source_signature(PySide::Signal::buildQtCompatible(source->d->signature));
@@ -513,7 +513,7 @@ PyObject* signalInstanceDisconnect(PyObject* self, PyObject* args)
if (match) {
Shiboken::AutoDecRef tupleArgs(PyList_AsTuple(pyArgs));
Shiboken::AutoDecRef pyMethod(PyObject_GetAttrString(source->d->source, "disconnect"));
- PyObject* result = PyObject_CallObject(pyMethod, tupleArgs);
+ PyObject *result = PyObject_CallObject(pyMethod, tupleArgs);
if (!result || result == Py_True)
return result;
else
@@ -525,9 +525,9 @@ PyObject* signalInstanceDisconnect(PyObject* self, PyObject* args)
return 0;
}
-PyObject* signalCall(PyObject* self, PyObject* args, PyObject* kw)
+PyObject *signalCall(PyObject *self, PyObject *args, PyObject *kw)
{
- PySideSignal* signal = reinterpret_cast<PySideSignal*>(self);
+ auto signal = reinterpret_cast<PySideSignal *>(self);
// Native C++ signals can't be called like functions, thus we throw an exception.
// The only way calling a signal can succeed (the Python equivalent of C++'s operator() )
@@ -553,9 +553,9 @@ PyObject* signalCall(PyObject* self, PyObject* args, PyObject* kw)
return callFunc(homonymousMethod, args, kw);
}
-PyObject* signalInstanceCall(PyObject* self, PyObject* args, PyObject* kw)
+PyObject *signalInstanceCall(PyObject *self, PyObject *args, PyObject *kw)
{
- PySideSignalInstance* PySideSignal = reinterpret_cast<PySideSignalInstance*>(self);
+ auto PySideSignal = reinterpret_cast<PySideSignalInstance *>(self);
if (!PySideSignal->d->homonymousMethod) {
PyErr_SetString(PyExc_TypeError, "native Qt signal is not callable");
return 0;
@@ -566,7 +566,7 @@ PyObject* signalInstanceCall(PyObject* self, PyObject* args, PyObject* kw)
return PyCFunction_Call(homonymousMethod, args, kw);
}
-static PyObject *metaSignalCheck(PyObject * /* klass */, PyObject* args)
+static PyObject *metaSignalCheck(PyObject * /* klass */, PyObject *args)
{
if (PyType_IsSubtype(Py_TYPE(args), PySideSignalInstanceTypeF()))
Py_RETURN_TRUE;
@@ -579,7 +579,7 @@ static PyObject *metaSignalCheck(PyObject * /* klass */, PyObject* args)
namespace PySide {
namespace Signal {
-void init(PyObject* module)
+void init(PyObject *module)
{
if (PyType_Ready(PySideSignalMetaTypeF()) < 0)
return;
@@ -596,25 +596,25 @@ void init(PyObject* module)
Py_INCREF(PySideSignalInstanceTypeF());
}
-bool checkType(PyObject* pyObj)
+bool checkType(PyObject *pyObj)
{
if (pyObj)
return PyType_IsSubtype(Py_TYPE(pyObj), PySideSignalTypeF());
return false;
}
-void updateSourceObject(PyObject* source)
+void updateSourceObject(PyObject *source)
{
- PyTypeObject* objType = reinterpret_cast<PyTypeObject*>(PyObject_Type(source));
+ PyTypeObject *objType = reinterpret_cast<PyTypeObject *>(PyObject_Type(source));
Py_ssize_t pos = 0;
- PyObject* value;
- PyObject* key;
+ PyObject *value;
+ PyObject *key;
while (PyDict_Next(objType->tp_dict, &pos, &key, &value)) {
if (PyObject_TypeCheck(value, PySideSignalTypeF())) {
Shiboken::AutoDecRef signalInstance(reinterpret_cast<PyObject *>(PyObject_New(PySideSignalInstance, PySideSignalInstanceTypeF())));
- instanceInitialize(signalInstance.cast<PySideSignalInstance*>(), key, reinterpret_cast<PySideSignal*>(value), source, 0);
+ instanceInitialize(signalInstance.cast<PySideSignalInstance *>(), key, reinterpret_cast<PySideSignal *>(value), source, 0);
PyObject_SetAttr(source, key, signalInstance);
}
}
@@ -625,13 +625,13 @@ void updateSourceObject(PyObject* source)
QByteArray getTypeName(PyObject *type)
{
if (PyType_Check(type)) {
- if (PyType_IsSubtype(reinterpret_cast<PyTypeObject*>(type),
- reinterpret_cast<PyTypeObject*>(SbkObject_TypeF()))) {
- SbkObjectType* objType = reinterpret_cast<SbkObjectType*>(type);
+ if (PyType_IsSubtype(reinterpret_cast<PyTypeObject *>(type),
+ reinterpret_cast<PyTypeObject *>(SbkObject_TypeF()))) {
+ auto objType = reinterpret_cast<SbkObjectType *>(type);
return Shiboken::ObjectType::getOriginalName(objType);
}
// Translate python types to Qt names
- PyTypeObject* objType = reinterpret_cast<PyTypeObject*>(type);
+ auto objType = reinterpret_cast<PyTypeObject *>(type);
if (Shiboken::String::checkType(objType))
return QByteArrayLiteral("QString");
if (objType == &PyInt_Type)
@@ -662,7 +662,7 @@ QByteArray buildSignature(const QByteArray &name, const QByteArray &signature)
return QMetaObject::normalizedSignature(name + '(' + signature + ')');
}
-QByteArray parseSignature(PyObject* args)
+QByteArray parseSignature(PyObject *args)
{
if (args && (Shiboken::String::check(args) || !PySequence_Check(args)))
return getTypeName(args);
@@ -680,25 +680,25 @@ QByteArray parseSignature(PyObject* args)
return signature;
}
-void appendSignature(PySideSignal* self, const SignalSignature &signature)
+void appendSignature(PySideSignal *self, const SignalSignature &signature)
{
self->data->signatures.append({signature.m_parameterTypes, signature.m_attributes});
}
-PySideSignalInstance* initialize(PySideSignal* self, PyObject* name, PyObject* object)
+PySideSignalInstance *initialize(PySideSignal *self, PyObject *name, PyObject *object)
{
- PySideSignalInstance* instance = PyObject_New(PySideSignalInstance, PySideSignalInstanceTypeF());
- SbkObject* sbkObj = reinterpret_cast<SbkObject*>(object);
+ PySideSignalInstance *instance = PyObject_New(PySideSignalInstance, PySideSignalInstanceTypeF());
+ auto sbkObj = reinterpret_cast<SbkObject *>(object);
if (!Shiboken::Object::wasCreatedByPython(sbkObj))
Py_INCREF(object); // PYSIDE-79: this flag was crucial for a wrapper call.
instanceInitialize(instance, name, self, object, 0);
return instance;
}
-void instanceInitialize(PySideSignalInstance* self, PyObject* name, PySideSignal* data, PyObject* source, int index)
+void instanceInitialize(PySideSignalInstance *self, PyObject *name, PySideSignal *data, PyObject *source, int index)
{
self->d = new PySideSignalInstancePrivate;
- PySideSignalInstancePrivate* selfPvt = self->d;
+ PySideSignalInstancePrivate *selfPvt = self->d;
selfPvt->next = nullptr;
if (data->data->signalName.isEmpty())
data->data->signalName = Shiboken::String::toCString(name);
@@ -721,7 +721,7 @@ void instanceInitialize(PySideSignalInstance* self, PyObject* name, PySideSignal
}
}
-bool connect(PyObject* source, const char* signal, PyObject* callback)
+bool connect(PyObject *source, const char *signal, PyObject *callback)
{
Shiboken::AutoDecRef pyMethod(PyObject_GetAttrString(source, "connect"));
if (pyMethod.isNull())
@@ -729,7 +729,7 @@ bool connect(PyObject* source, const char* signal, PyObject* callback)
Shiboken::AutoDecRef pySignature(Shiboken::String::fromCString(signal));
Shiboken::AutoDecRef pyArgs(PyTuple_Pack(3, source, pySignature.object(), callback));
- PyObject* result = PyObject_CallObject(pyMethod, pyArgs);
+ PyObject *result = PyObject_CallObject(pyMethod, pyArgs);
if (result == Py_False) {
PyErr_Format(PyExc_RuntimeError, "Failed to connect signal %s, to python callable object.", signal);
Py_DECREF(result);
@@ -738,12 +738,12 @@ bool connect(PyObject* source, const char* signal, PyObject* callback)
return result;
}
-PySideSignalInstance* newObjectFromMethod(PyObject* source, const QList<QMetaMethod>& methodList)
+PySideSignalInstance *newObjectFromMethod(PyObject *source, const QList<QMetaMethod>& methodList)
{
- PySideSignalInstance* root = 0;
- PySideSignalInstance* previous = 0;
+ PySideSignalInstance *root = nullptr;
+ PySideSignalInstance *previous = nullptr;
for (const QMetaMethod &m : methodList) {
- PySideSignalInstance* item = PyObject_New(PySideSignalInstance, PySideSignalInstanceTypeF());
+ PySideSignalInstance *item = PyObject_New(PySideSignalInstance, PySideSignalInstanceTypeF());
if (!root)
root = item;
@@ -751,7 +751,7 @@ PySideSignalInstance* newObjectFromMethod(PyObject* source, const QList<QMetaMet
previous->d->next = item;
item->d = new PySideSignalInstancePrivate;
- PySideSignalInstancePrivate* selfPvt = item->d;
+ PySideSignalInstancePrivate *selfPvt = item->d;
selfPvt->source = source;
Py_INCREF(selfPvt->source); // PYSIDE-79: an INCREF is missing.
QByteArray cppName(m.methodSignature());
@@ -766,17 +766,17 @@ PySideSignalInstance* newObjectFromMethod(PyObject* source, const QList<QMetaMet
return root;
}
-PySideSignal* newObject(const char* name, ...)
+PySideSignal *newObject(const char *name, ...)
{
va_list listSignatures;
- char* sig = 0;
- PySideSignal* self = PyObject_New(PySideSignal, PySideSignalTypeF());
+ char *sig = nullptr;
+ PySideSignal *self = PyObject_New(PySideSignal, PySideSignalTypeF());
self->data = new PySideSignalData;
self->data->signalName = name;
self->homonymousMethod = 0;
va_start(listSignatures, name);
- sig = va_arg(listSignatures, char*);
+ sig = va_arg(listSignatures, char *);
while (sig != NULL) {
if (strcmp(sig, "void") == 0)
@@ -784,7 +784,7 @@ PySideSignal* newObject(const char* name, ...)
else
appendSignature(self, SignalSignature(sig));
- sig = va_arg(listSignatures, char*);
+ sig = va_arg(listSignatures, char *);
}
va_end(listSignatures);
@@ -793,7 +793,7 @@ PySideSignal* newObject(const char* name, ...)
}
template<typename T>
-static typename T::value_type join(T t, const char* sep)
+static typename T::value_type join(T t, const char *sep)
{
typename T::value_type res;
if (t.isEmpty())
@@ -812,15 +812,15 @@ static typename T::value_type join(T t, const char* sep)
return res;
}
-static void _addSignalToWrapper(SbkObjectType* wrapperType, const char* signalName, PySideSignal* signal)
+static void _addSignalToWrapper(SbkObjectType *wrapperType, const char *signalName, PySideSignal *signal)
{
- PyObject* typeDict = reinterpret_cast<PyTypeObject *>(wrapperType)->tp_dict;
- PyObject* homonymousMethod;
+ auto typeDict = reinterpret_cast<PyTypeObject *>(wrapperType)->tp_dict;
+ PyObject *homonymousMethod;
if ((homonymousMethod = PyDict_GetItemString(typeDict, signalName))) {
Py_INCREF(homonymousMethod);
signal->homonymousMethod = homonymousMethod;
}
- PyDict_SetItemString(typeDict, signalName, reinterpret_cast<PyObject*>(signal));
+ PyDict_SetItemString(typeDict, signalName, reinterpret_cast<PyObject *>(signal));
}
// This function is used by qStableSort to promote empty signatures
@@ -829,7 +829,7 @@ static bool compareSignals(const SignalSignature &sig1, const SignalSignature &)
return sig1.m_parameterTypes.isEmpty();
}
-void registerSignals(SbkObjectType* pyObj, const QMetaObject* metaObject)
+void registerSignals(SbkObjectType *pyObj, const QMetaObject *metaObject)
{
typedef QHash<QByteArray, QList<SignalSignature> > SignalSigMap;
SignalSigMap signalsFound;
@@ -850,7 +850,7 @@ void registerSignals(SbkObjectType* pyObj, const QMetaObject* metaObject)
SignalSigMap::Iterator it = signalsFound.begin();
SignalSigMap::Iterator end = signalsFound.end();
for (; it != end; ++it) {
- PySideSignal* self = PyObject_New(PySideSignal, PySideSignalTypeF());
+ PySideSignal *self = PyObject_New(PySideSignal, PySideSignalTypeF());
self->data = new PySideSignalData;
self->data->signalName = it.key();
self->homonymousMethod = 0;
@@ -869,28 +869,28 @@ void registerSignals(SbkObjectType* pyObj, const QMetaObject* metaObject)
}
}
-PyObject* buildQtCompatible(const QByteArray &signature)
+PyObject *buildQtCompatible(const QByteArray &signature)
{
const auto ba = QT_SIGNAL_SENTINEL + signature;
return Shiboken::String::fromStringAndSize(ba, ba.size());
}
-void addSignalToWrapper(SbkObjectType* wrapperType, const char* signalName, PySideSignal* signal)
+void addSignalToWrapper(SbkObjectType *wrapperType, const char *signalName, PySideSignal *signal)
{
_addSignalToWrapper(wrapperType, signalName, signal);
}
-PyObject* getObject(PySideSignalInstance* signal)
+PyObject *getObject(PySideSignalInstance *signal)
{
return signal->d->source;
}
-const char* getSignature(PySideSignalInstance* signal)
+const char *getSignature(PySideSignalInstance *signal)
{
return signal->d->signature;
}
-QStringList getArgsFromSignature(const char* signature, bool* isShortCircuit)
+QStringList getArgsFromSignature(const char *signature, bool *isShortCircuit)
{
const QString qsignature = QLatin1String(signature);
QStringList result;
@@ -910,7 +910,7 @@ QStringList getArgsFromSignature(const char* signature, bool* isShortCircuit)
return result;
}
-QString getCallbackSignature(const char* signal, QObject* receiver, PyObject* callback, bool encodeName)
+QString getCallbackSignature(const char *signal, QObject *receiver, PyObject *callback, bool encodeName)
{
QByteArray functionName;
int numArgs = -1;
@@ -919,8 +919,8 @@ QString getCallbackSignature(const char* signal, QObject* receiver, PyObject* ca
bool isFunction = PyFunction_Check(callback);
if (isMethod || isFunction) {
- PyObject* function = isMethod ? PyMethod_GET_FUNCTION(callback) : callback;
- PyCodeObject* objCode = reinterpret_cast<PyCodeObject*>(PyFunction_GET_CODE(function));
+ PyObject *function = isMethod ? PyMethod_GET_FUNCTION(callback) : callback;
+ auto objCode = reinterpret_cast<PyCodeObject *>(PyFunction_GET_CODE(function));
functionName = Shiboken::String::toCString(PepFunction_GetName(function));
useSelf = isMethod;
numArgs = PepCode_GET_FLAGS(objCode) & CO_VARARGS ? -1 : PepCode_GET_ARGCOUNT(objCode);
@@ -932,7 +932,7 @@ QString getCallbackSignature(const char* signal, QObject* receiver, PyObject* ca
if (receiver) {
//Search for signature on metaobject
- const QMetaObject* mo = receiver->metaObject();
+ const QMetaObject *mo = receiver->metaObject();
QByteArray prefix(functionName);
prefix += '(';
for (int i = 0; i < mo->methodCount(); i++) {
@@ -976,12 +976,12 @@ QString getCallbackSignature(const char* signal, QObject* receiver, PyObject* ca
return signature;
}
-bool isQtSignal(const char* signal)
+bool isQtSignal(const char *signal)
{
return (signal && signal[0] == QT_SIGNAL_SENTINEL);
}
-bool checkQtSignal(const char* signal)
+bool checkQtSignal(const char *signal)
{
if (!isQtSignal(signal)) {
PyErr_SetString(PyExc_TypeError, "Use the function PySide2.QtCore.SIGNAL on signals");
@@ -990,11 +990,11 @@ bool checkQtSignal(const char* signal)
return true;
}
-QString codeCallbackName(PyObject* callback, const QString& funcName)
+QString codeCallbackName(PyObject *callback, const QString &funcName)
{
if (PyMethod_Check(callback)) {
- PyObject* self = PyMethod_GET_SELF(callback);
- PyObject* func = PyMethod_GET_FUNCTION(callback);
+ PyObject *self = PyMethod_GET_SELF(callback);
+ PyObject *func = PyMethod_GET_FUNCTION(callback);
return funcName + QString::number(quint64(self), 16) + QString::number(quint64(func), 16);
}
return funcName + QString::number(quint64(callback), 16);
diff --git a/sources/pyside2/libpyside/pysideslot.cpp b/sources/pyside2/libpyside/pysideslot.cpp
index 4104c090d..2cdf32626 100644
--- a/sources/pyside2/libpyside/pysideslot.cpp
+++ b/sources/pyside2/libpyside/pysideslot.cpp
@@ -64,8 +64,8 @@ typedef struct
extern "C"
{
-static int slotTpInit(PyObject*, PyObject*, PyObject*);
-static PyObject* slotCall(PyObject*, PyObject*, PyObject*);
+static int slotTpInit(PyObject *, PyObject *, PyObject *);
+static PyObject *slotCall(PyObject *, PyObject *, PyObject *);
// Class Definition -----------------------------------------------
static PyType_Slot PySideSlotType_slots[] = {
@@ -94,20 +94,20 @@ static PyTypeObject *PySideSlotTypeF(void)
int slotTpInit(PyObject *self, PyObject *args, PyObject *kw)
{
- static PyObject *emptyTuple = 0;
- static const char *kwlist[] = {"name", "result", 0};
- char* argName = 0;
- PyObject* argResult = 0;
+ static PyObject *emptyTuple = nullptr;
+ static const char *kwlist[] = {"name", "result", nullptr};
+ char *argName = nullptr;
+ PyObject *argResult = nullptr;
if (emptyTuple == 0)
emptyTuple = PyTuple_New(0);
if (!PyArg_ParseTupleAndKeywords(emptyTuple, kw, "|sO:QtCore." SLOT_DEC_NAME,
- const_cast<char**>(kwlist), &argName, &argResult)) {
+ const_cast<char **>(kwlist), &argName, &argResult)) {
return 0;
}
- PySideSlot *data = reinterpret_cast<PySideSlot*>(self);
+ PySideSlot *data = reinterpret_cast<PySideSlot *>(self);
if (!data->slotData)
data->slotData = new SlotData;
for(Py_ssize_t i = 0, i_max = PyTuple_Size(args); i < i_max; i++) {
@@ -133,13 +133,13 @@ int slotTpInit(PyObject *self, PyObject *args, PyObject *kw)
PyObject *slotCall(PyObject *self, PyObject *args, PyObject * /* kw */)
{
- static PyObject* pySlotName = 0;
- PyObject* callback;
+ static PyObject *pySlotName = nullptr;
+ PyObject *callback;
callback = PyTuple_GetItem(args, 0);
Py_INCREF(callback);
if (PyFunction_Check(callback)) {
- PySideSlot *data = reinterpret_cast<PySideSlot*>(self);
+ PySideSlot *data = reinterpret_cast<PySideSlot *>(self);
if (!data->slotData)
data->slotData = new SlotData;
@@ -179,7 +179,7 @@ PyObject *slotCall(PyObject *self, PyObject *args, PyObject * /* kw */)
namespace PySide { namespace Slot {
-void init(PyObject* module)
+void init(PyObject *module)
{
if (PyType_Ready(PySideSlotTypeF()) < 0)
return;
diff --git a/sources/pyside2/libpyside/pysideweakref.cpp b/sources/pyside2/libpyside/pysideweakref.cpp
index 6b5073db8..2b27f9545 100644
--- a/sources/pyside2/libpyside/pysideweakref.cpp
+++ b/sources/pyside2/libpyside/pysideweakref.cpp
@@ -46,10 +46,10 @@ typedef struct {
PyObject_HEAD
/* Type-specific fields go here. */
PySideWeakRefFunction weakref_func;
- void* user_data;
+ void *user_data;
} PySideCallableObject;
-static PyObject* CallableObject_call(PyObject* callable_object, PyObject* args, PyObject* kw);
+static PyObject *CallableObject_call(PyObject *callable_object, PyObject *args, PyObject *kw);
static PyType_Slot PySideCallableObjectType_slots[] = {
{Py_tp_call, (void *)CallableObject_call},
@@ -57,7 +57,7 @@ static PyType_Slot PySideCallableObjectType_slots[] = {
{0, 0}
};
static PyType_Spec PySideCallableObjectType_spec = {
- const_cast<char*>("PySide.Callable"),
+ const_cast<char *>("PySide.Callable"),
sizeof(PySideCallableObject),
0,
Py_TPFLAGS_DEFAULT,
@@ -74,7 +74,7 @@ static PyTypeObject *PySideCallableObjectTypeF()
static PyObject *CallableObject_call(PyObject *callable_object, PyObject *args, PyObject * /* kw */)
{
- PySideCallableObject* obj = reinterpret_cast<PySideCallableObject *>(callable_object);
+ PySideCallableObject *obj = reinterpret_cast<PySideCallableObject *>(callable_object);
obj->weakref_func(obj->user_data);
Py_XDECREF(PyTuple_GET_ITEM(args, 0)); //kill weak ref object
@@ -83,7 +83,7 @@ static PyObject *CallableObject_call(PyObject *callable_object, PyObject *args,
namespace PySide { namespace WeakRef {
-PyObject* create(PyObject* obj, PySideWeakRefFunction func, void* userData)
+PyObject *create(PyObject *obj, PySideWeakRefFunction func, void *userData)
{
if (obj == Py_None)
return 0;
@@ -94,11 +94,11 @@ PyObject* create(PyObject* obj, PySideWeakRefFunction func, void* userData)
PyType_Ready(PySideCallableObjectTypeF());
}
- PySideCallableObject* callable = PyObject_New(PySideCallableObject, PySideCallableObjectTypeF());
+ PySideCallableObject *callable = PyObject_New(PySideCallableObject, PySideCallableObjectTypeF());
if (!callable || PyErr_Occurred())
return 0;
- PyObject* weak = PyWeakref_NewRef(obj, reinterpret_cast<PyObject *>(callable));
+ PyObject *weak = PyWeakref_NewRef(obj, reinterpret_cast<PyObject *>(callable));
if (!weak || PyErr_Occurred())
return 0;
diff --git a/sources/pyside2/libpyside/signalmanager.cpp b/sources/pyside2/libpyside/signalmanager.cpp
index 8925ffd35..0895cc682 100644
--- a/sources/pyside2/libpyside/signalmanager.cpp
+++ b/sources/pyside2/libpyside/signalmanager.cpp
@@ -82,26 +82,26 @@
namespace {
static PyObject *metaObjectAttr = 0;
- static int callMethod(QObject* object, int id, void** args);
- static PyObject* parseArguments(const QList< QByteArray >& paramTypes, void** args);
- static bool emitShortCircuitSignal(QObject* source, int signalIndex, PyObject* args);
+ static int callMethod(QObject *object, int id, void **args);
+ static PyObject *parseArguments(const QList< QByteArray >& paramTypes, void **args);
+ static bool emitShortCircuitSignal(QObject *source, int signalIndex, PyObject *args);
#ifdef IS_PY3K
- static void destroyMetaObject(PyObject* obj)
+ static void destroyMetaObject(PyObject *obj)
{
- void* ptr = PyCapsule_GetPointer(obj, 0);
- auto meta = reinterpret_cast<PySide::MetaObjectBuilder*>(ptr);
- SbkObject* wrapper = Shiboken::BindingManager::instance().retrieveWrapper(meta);
+ void *ptr = PyCapsule_GetPointer(obj, 0);
+ auto meta = reinterpret_cast<PySide::MetaObjectBuilder *>(ptr);
+ SbkObject *wrapper = Shiboken::BindingManager::instance().retrieveWrapper(meta);
if (wrapper)
Shiboken::BindingManager::instance().releaseWrapper(wrapper);
delete meta;
}
#else
- static void destroyMetaObject(void* obj)
+ static void destroyMetaObject(void *obj)
{
- auto meta = reinterpret_cast<PySide::MetaObjectBuilder*>(obj);
- SbkObject* wrapper = Shiboken::BindingManager::instance().retrieveWrapper(meta);
+ auto meta = reinterpret_cast<PySide::MetaObjectBuilder *>(obj);
+ SbkObject *wrapper = Shiboken::BindingManager::instance().retrieveWrapper(meta);
if (wrapper)
Shiboken::BindingManager::instance().releaseWrapper(wrapper);
delete meta;
@@ -118,7 +118,7 @@ PyObjectWrapper::PyObjectWrapper()
Py_XINCREF(m_me);
}
-PyObjectWrapper::PyObjectWrapper(PyObject* me)
+PyObjectWrapper::PyObjectWrapper(PyObject *me)
: m_me(me)
{
Py_XINCREF(m_me);
@@ -148,18 +148,18 @@ void PyObjectWrapper::reset(PyObject *o)
m_me = o;
}
-PyObjectWrapper& PyObjectWrapper::operator=(const PySide::PyObjectWrapper& other)
+PyObjectWrapper &PyObjectWrapper::operator=(const PySide::PyObjectWrapper &other)
{
reset(other.m_me);
return *this;
}
-PyObjectWrapper::operator PyObject*() const
+PyObjectWrapper::operator PyObject *() const
{
return m_me;
}
-QDataStream &operator<<(QDataStream& out, const PyObjectWrapper& myObj)
+QDataStream &operator<<(QDataStream &out, const PyObjectWrapper &myObj)
{
if (Py_IsInitialized() == 0) {
qWarning() << "Stream operator for PyObject called without python interpreter.";
@@ -173,9 +173,9 @@ QDataStream &operator<<(QDataStream& out, const PyObjectWrapper& myObj)
Shiboken::AutoDecRef pickleModule(PyImport_ImportModule("pickle"));
reduce_func = PyObject_GetAttrString(pickleModule, "dumps");
}
- Shiboken::AutoDecRef repr(PyObject_CallFunctionObjArgs(reduce_func, (PyObject*)myObj, NULL));
+ Shiboken::AutoDecRef repr(PyObject_CallFunctionObjArgs(reduce_func, (PyObject *)myObj, NULL));
if (repr.object()) {
- const char* buff = 0;
+ const char *buff = nullptr;
Py_ssize_t size = 0;
if (PyBytes_Check(repr.object())) {
buff = PyBytes_AS_STRING(repr.object());
@@ -190,7 +190,7 @@ QDataStream &operator<<(QDataStream& out, const PyObjectWrapper& myObj)
return out;
}
-QDataStream &operator>>(QDataStream& in, PyObjectWrapper& myObj)
+QDataStream &operator>>(QDataStream &in, PyObjectWrapper &myObj)
{
if (Py_IsInitialized() == 0) {
qWarning() << "Stream operator for PyObject called without python interpreter.";
@@ -225,7 +225,7 @@ struct SignalManager::SignalManagerPrivate
SignalManagerPrivate()
{
- m_globalReceivers = SharedMap( new QMap<QByteArray, GlobalReceiverV2*>() );
+ m_globalReceivers = SharedMap( new QMap<QByteArray, GlobalReceiverV2 *>() );
}
~SignalManagerPrivate()
@@ -246,17 +246,17 @@ static void clearSignalManager()
PySide::SignalManager::instance().clear();
}
-static void PyObject_PythonToCpp_PyObject_PTR(PyObject* pyIn, void* cppOut)
+static void PyObject_PythonToCpp_PyObject_PTR(PyObject *pyIn, void *cppOut)
{
- *((PyObject**)cppOut) = pyIn;
+ *reinterpret_cast<PyObject **>(cppOut) = pyIn;
}
-static PythonToCppFunc is_PyObject_PythonToCpp_PyObject_PTR_Convertible(PyObject* pyIn)
+static PythonToCppFunc is_PyObject_PythonToCpp_PyObject_PTR_Convertible(PyObject *pyIn)
{
return PyObject_PythonToCpp_PyObject_PTR;
}
-static PyObject* PyObject_PTR_CppToPython_PyObject(const void* cppIn)
+static PyObject *PyObject_PTR_CppToPython_PyObject(const void *cppIn)
{
- PyObject* pyOut = (PyObject*)cppIn;
+ auto pyOut = reinterpret_cast<PyObject *>(const_cast<void *>(cppIn));
if (pyOut)
Py_INCREF(pyOut);
return pyOut;
@@ -273,7 +273,7 @@ SignalManager::SignalManager() : m_d(new SignalManagerPrivate)
qRegisterMetaTypeStreamOperators<PyObjectWrapper>("PyObjectWrapper");
qRegisterMetaTypeStreamOperators<PyObjectWrapper>("PySide::PyObjectWrapper");
- SbkConverter* converter = Shiboken::Conversions::createConverter(&PyBaseObject_Type, 0);
+ SbkConverter *converter = Shiboken::Conversions::createConverter(&PyBaseObject_Type, nullptr);
Shiboken::Conversions::setCppPointerToPythonFunction(converter, PyObject_PTR_CppToPython_PyObject);
Shiboken::Conversions::setPythonToCppPointerFunctions(converter, PyObject_PythonToCpp_PyObject_PTR, is_PyObject_PythonToCpp_PyObject_PTR_Convertible);
Shiboken::Conversions::registerConverterName(converter, PYTHON_TYPE);
@@ -298,17 +298,17 @@ SignalManager::~SignalManager()
delete m_d;
}
-SignalManager& SignalManager::instance()
+SignalManager &SignalManager::instance()
{
static SignalManager me;
return me;
}
-QObject* SignalManager::globalReceiver(QObject *sender, PyObject *callback)
+QObject *SignalManager::globalReceiver(QObject *sender, PyObject *callback)
{
SharedMap globalReceivers = m_d->m_globalReceivers;
QByteArray hash = GlobalReceiverV2::hash(callback);
- GlobalReceiverV2* gr = 0;
+ GlobalReceiverV2 *gr = nullptr;
auto it = globalReceivers->find(hash);
if (it == globalReceivers->end()) {
gr = new GlobalReceiverV2(callback, globalReceivers);
@@ -323,7 +323,7 @@ QObject* SignalManager::globalReceiver(QObject *sender, PyObject *callback)
gr->incRef(sender);
}
- return reinterpret_cast<QObject*>(gr);
+ return reinterpret_cast<QObject *>(gr);
}
int SignalManager::countConnectionsWith(const QObject *object)
@@ -336,23 +336,23 @@ int SignalManager::countConnectionsWith(const QObject *object)
return count;
}
-void SignalManager::notifyGlobalReceiver(QObject* receiver)
+void SignalManager::notifyGlobalReceiver(QObject *receiver)
{
- reinterpret_cast<GlobalReceiverV2*>(receiver)->notify();
+ reinterpret_cast<GlobalReceiverV2 *>(receiver)->notify();
}
-void SignalManager::releaseGlobalReceiver(const QObject* source, QObject* receiver)
+void SignalManager::releaseGlobalReceiver(const QObject *source, QObject *receiver)
{
- GlobalReceiverV2* gr = reinterpret_cast<GlobalReceiverV2*>(receiver);
+ auto gr = reinterpret_cast<GlobalReceiverV2 *>(receiver);
gr->decRef(source);
}
-int SignalManager::globalReceiverSlotIndex(QObject* receiver, const char* signature) const
+int SignalManager::globalReceiverSlotIndex(QObject *receiver, const char *signature) const
{
- return reinterpret_cast<GlobalReceiverV2*>(receiver)->addSlot(signature);
+ return reinterpret_cast<GlobalReceiverV2 *>(receiver)->addSlot(signature);
}
-bool SignalManager::emitSignal(QObject* source, const char* signal, PyObject* args)
+bool SignalManager::emitSignal(QObject *source, const char *signal, PyObject *args)
{
if (!Signal::checkQtSignal(signal))
return false;
@@ -372,13 +372,13 @@ bool SignalManager::emitSignal(QObject* source, const char* signal, PyObject* ar
return false;
}
-int SignalManager::qt_metacall(QObject* object, QMetaObject::Call call, int id, void** args)
+int SignalManager::qt_metacall(QObject *object, QMetaObject::Call call, int id, void **args)
{
- const QMetaObject* metaObject = object->metaObject();
- PySideProperty* pp = 0;
- PyObject* pp_name = 0;
+ const QMetaObject *metaObject = object->metaObject();
+ PySideProperty *pp = nullptr;
+ PyObject *pp_name = nullptr;
QMetaProperty mp;
- PyObject* pySelf = 0;
+ PyObject *pySelf = nullptr;
int methodCount = metaObject->methodCount();
int propertyCount = metaObject->propertyCount();
@@ -389,7 +389,7 @@ int SignalManager::qt_metacall(QObject* object, QMetaObject::Call call, int id,
}
Shiboken::GilState gil;
- pySelf = (PyObject*)Shiboken::BindingManager::instance().retrieveWrapper(object);
+ pySelf = reinterpret_cast<PyObject *>(Shiboken::BindingManager::instance().retrieveWrapper(object));
Q_ASSERT(pySelf);
pp_name = Shiboken::String::fromCString(mp.name());
pp = Property::getObject(pySelf, pp_name);
@@ -504,22 +504,22 @@ int SignalManager::qt_metacall(QObject* object, QMetaObject::Call call, int id,
return id;
}
-int SignalManager::callPythonMetaMethod(const QMetaMethod& method, void** args, PyObject* pyMethod, bool isShortCuit)
+int SignalManager::callPythonMetaMethod(const QMetaMethod &method, void **args, PyObject *pyMethod, bool isShortCuit)
{
Q_ASSERT(pyMethod);
Shiboken::GilState gil;
- PyObject* pyArguments = 0;
+ PyObject *pyArguments = nullptr;
if (isShortCuit){
- pyArguments = reinterpret_cast<PyObject*>(args[1]);
+ pyArguments = reinterpret_cast<PyObject *>(args[1]);
} else {
pyArguments = parseArguments(method.parameterTypes(), args);
}
if (pyArguments) {
- Shiboken::Conversions::SpecificConverter* retConverter = NULL;
- const char* returnType = method.typeName();
+ Shiboken::Conversions::SpecificConverter *retConverter = nullptr;
+ const char *returnType = method.typeName();
if (returnType && std::strcmp("", returnType) && std::strcmp("void", returnType)) {
retConverter = new Shiboken::Conversions::SpecificConverter(returnType);
if (!retConverter || !*retConverter) {
@@ -543,13 +543,13 @@ int SignalManager::callPythonMetaMethod(const QMetaMethod& method, void** args,
return -1;
}
-bool SignalManager::registerMetaMethod(QObject* source, const char* signature, QMetaMethod::MethodType type)
+bool SignalManager::registerMetaMethod(QObject *source, const char *signature, QMetaMethod::MethodType type)
{
int ret = registerMetaMethodGetIndex(source, signature, type);
return (ret != -1);
}
-static MetaObjectBuilder *metaBuilderFromDict(PyObject* dict)
+static MetaObjectBuilder *metaBuilderFromDict(PyObject *dict)
{
if (!dict || !PyDict_Contains(dict, metaObjectAttr))
return nullptr;
@@ -562,33 +562,33 @@ static MetaObjectBuilder *metaBuilderFromDict(PyObject* dict)
#endif
}
-int SignalManager::registerMetaMethodGetIndex(QObject* source, const char* signature, QMetaMethod::MethodType type)
+int SignalManager::registerMetaMethodGetIndex(QObject *source, const char *signature, QMetaMethod::MethodType type)
{
if (!source) {
qWarning("SignalManager::registerMetaMethodGetIndex(\"%s\") called with source=nullptr.",
signature);
return -1;
}
- const QMetaObject* metaObject = source->metaObject();
+ const QMetaObject *metaObject = source->metaObject();
int methodIndex = metaObject->indexOfMethod(signature);
// Create the dynamic signal is needed
if (methodIndex == -1) {
- SbkObject* self = Shiboken::BindingManager::instance().retrieveWrapper(source);
+ SbkObject *self = Shiboken::BindingManager::instance().retrieveWrapper(source);
if (!Shiboken::Object::hasCppWrapper(self)) {
qWarning() << "Invalid Signal signature:" << signature;
return -1;
} else {
- PyObject *pySelf = reinterpret_cast<PyObject*>(self);
- PyObject* dict = self->ob_dict;
+ auto pySelf = reinterpret_cast<PyObject *>(self);
+ PyObject *dict = self->ob_dict;
MetaObjectBuilder *dmo = metaBuilderFromDict(dict);
// Create a instance meta object
if (!dmo) {
dmo = new MetaObjectBuilder(Py_TYPE(pySelf), metaObject);
#ifdef IS_PY3K
- PyObject* pyDmo = PyCapsule_New(dmo, 0, destroyMetaObject);
+ PyObject *pyDmo = PyCapsule_New(dmo, 0, destroyMetaObject);
#else
- PyObject* pyDmo = PyCObject_FromVoidPtr(dmo, destroyMetaObject);
+ PyObject *pyDmo = PyCObject_FromVoidPtr(dmo, destroyMetaObject);
#endif
PyObject_SetAttr(pySelf, metaObjectAttr, pyDmo);
@@ -604,12 +604,12 @@ int SignalManager::registerMetaMethodGetIndex(QObject* source, const char* signa
return methodIndex;
}
-const QMetaObject* SignalManager::retrieveMetaObject(PyObject *self)
+const QMetaObject *SignalManager::retrieveMetaObject(PyObject *self)
{
Shiboken::GilState gil;
Q_ASSERT(self);
- MetaObjectBuilder *builder = metaBuilderFromDict(reinterpret_cast<SbkObject*>(self)->ob_dict);
+ MetaObjectBuilder *builder = metaBuilderFromDict(reinterpret_cast<SbkObject *>(self)->ob_dict);
if (!builder)
builder = &(retrieveTypeUserData(self)->mo);
@@ -618,9 +618,9 @@ const QMetaObject* SignalManager::retrieveMetaObject(PyObject *self)
namespace {
-static int callMethod(QObject* object, int id, void** args)
+static int callMethod(QObject *object, int id, void **args)
{
- const QMetaObject* metaObject = object->metaObject();
+ const QMetaObject *metaObject = object->metaObject();
QMetaMethod method = metaObject->method(id);
if (method.methodType() == QMetaMethod::Signal) {
@@ -628,7 +628,7 @@ static int callMethod(QObject* object, int id, void** args)
QMetaObject::activate(object, id, args);
} else {
Shiboken::GilState gil;
- PyObject* self = (PyObject*)Shiboken::BindingManager::instance().retrieveWrapper(object);
+ auto self = reinterpret_cast<PyObject *>(Shiboken::BindingManager::instance().retrieveWrapper(object));
QByteArray methodName = method.methodSignature();
methodName.truncate(methodName.indexOf('('));
Shiboken::AutoDecRef pyMethod(PyObject_GetAttrString(self, methodName));
@@ -638,14 +638,14 @@ static int callMethod(QObject* object, int id, void** args)
}
-static PyObject* parseArguments(const QList<QByteArray>& paramTypes, void** args)
+static PyObject *parseArguments(const QList<QByteArray>& paramTypes, void **args)
{
int argsSize = paramTypes.count();
- PyObject* preparedArgs = PyTuple_New(argsSize);
+ PyObject *preparedArgs = PyTuple_New(argsSize);
for (int i = 0, max = argsSize; i < max; ++i) {
- void* data = args[i+1];
- const char* dataType = paramTypes[i].constData();
+ void *data = args[i+1];
+ const char *dataType = paramTypes[i].constData();
Shiboken::Conversions::SpecificConverter converter(dataType);
if (converter) {
PyTuple_SET_ITEM(preparedArgs, i, converter.toPython(data));
@@ -658,9 +658,9 @@ static PyObject* parseArguments(const QList<QByteArray>& paramTypes, void** args
return preparedArgs;
}
-static bool emitShortCircuitSignal(QObject* source, int signalIndex, PyObject* args)
+static bool emitShortCircuitSignal(QObject *source, int signalIndex, PyObject *args)
{
- void* signalArgs[2] = {0, args};
+ void *signalArgs[2] = {nullptr, args};
source->qt_metacall(QMetaObject::InvokeMetaMethod, signalIndex, signalArgs);
return true;
}
diff --git a/sources/pyside2/plugins/customwidget.cpp b/sources/pyside2/plugins/customwidget.cpp
index f3ce09b62..6a6d7a3be 100644
--- a/sources/pyside2/plugins/customwidget.cpp
+++ b/sources/pyside2/plugins/customwidget.cpp
@@ -43,11 +43,11 @@
struct PyCustomWidgetPrivate
{
- PyObject* pyObject;
+ PyObject *pyObject;
bool initialized;
};
-PyCustomWidget::PyCustomWidget(PyObject* objectType)
+PyCustomWidget::PyCustomWidget(PyObject *objectType)
: m_data(new PyCustomWidgetPrivate())
{
m_data->pyObject = objectType;
@@ -104,13 +104,13 @@ QString PyCustomWidget::whatsThis() const
return QString();
}
-QWidget* PyCustomWidget::createWidget(QWidget* parent)
+QWidget *PyCustomWidget::createWidget(QWidget *parent)
{
//Create a python instance and return cpp object
- PyObject* pyParent;
+ PyObject *pyParent;
bool unkowParent = false;
if (parent) {
- pyParent = reinterpret_cast<PyObject*>(Shiboken::BindingManager::instance().retrieveWrapper(parent));
+ pyParent = reinterpret_cast<PyObject *>(Shiboken::BindingManager::instance().retrieveWrapper(parent));
if (pyParent) {
Py_INCREF(pyParent);
} else {
@@ -127,22 +127,22 @@ QWidget* PyCustomWidget::createWidget(QWidget* parent)
PyTuple_SET_ITEM(pyArgs, 0, pyParent); //tuple will keep pyParent reference
//Call python constructor
- SbkObject* result = reinterpret_cast<SbkObject*>(PyObject_CallObject(m_data->pyObject, pyArgs));
+ auto result = reinterpret_cast<SbkObject *>(PyObject_CallObject(m_data->pyObject, pyArgs));
- QWidget* widget = 0;
+ QWidget *widget = nullptr;
if (result) {
if (unkowParent) //if parent does not exists in python, transfer the ownership to cpp
Shiboken::Object::releaseOwnership(result);
else
- Shiboken::Object::setParent(pyParent, reinterpret_cast<PyObject*>(result));
+ Shiboken::Object::setParent(pyParent, reinterpret_cast<PyObject *>(result));
- widget = reinterpret_cast<QWidget*>(Shiboken::Object::cppPointer(result, Py_TYPE(result)));
+ widget = reinterpret_cast<QWidget *>(Shiboken::Object::cppPointer(result, Py_TYPE(result)));
}
return widget;
}
-void PyCustomWidget::initialize(QDesignerFormEditorInterface* core)
+void PyCustomWidget::initialize(QDesignerFormEditorInterface *core)
{
m_data->initialized = true;
}
diff --git a/sources/pyside2/plugins/customwidgets.cpp b/sources/pyside2/plugins/customwidgets.cpp
index 58d2a518c..e78dde206 100644
--- a/sources/pyside2/plugins/customwidgets.cpp
+++ b/sources/pyside2/plugins/customwidgets.cpp
@@ -43,21 +43,20 @@
struct PyCustomWidgetPrivate
{
- PyObject* pyObject;
+ PyObject *pyObject;
bool initialized;
};
struct PyCustomWidgetsPrivate
{
- QList<QDesignerCustomWidgetInterface*> widgets;
+ QList<QDesignerCustomWidgetInterface *> widgets;
~PyCustomWidgetsPrivate();
};
PyCustomWidgetsPrivate::~PyCustomWidgetsPrivate()
{
- foreach(QDesignerCustomWidgetInterface* iface, widgets)
- delete iface;
+ qDeleteAll(widgets);
widgets.clear();
}
@@ -71,12 +70,12 @@ PyCustomWidgets::~PyCustomWidgets()
delete m_data;
}
-void PyCustomWidgets::registerWidgetType(PyObject* widget)
+void PyCustomWidgets::registerWidgetType(PyObject *widget)
{
m_data->widgets.append(new PyCustomWidget(widget));
}
-QList<QDesignerCustomWidgetInterface*> PyCustomWidgets::customWidgets() const
+QList<QDesignerCustomWidgetInterface *> PyCustomWidgets::customWidgets() const
{
return m_data->widgets;
}
diff --git a/sources/pyside2/tests/QtCore/qmetaobject_test.py b/sources/pyside2/tests/QtCore/qmetaobject_test.py
index 73ab81c7c..81a3e7015 100644
--- a/sources/pyside2/tests/QtCore/qmetaobject_test.py
+++ b/sources/pyside2/tests/QtCore/qmetaobject_test.py
@@ -60,7 +60,7 @@ class qmetaobject_test(unittest.TestCase):
f = QFile()
fm = f.metaObject()
self.assertEqual(m.methodCount(), fm.methodCount())
- """
+ """
def test_DynamicSlotSignal(self):
o = DynObject()
diff --git a/sources/pyside2/tests/QtCore/qobject_connect_notify_test.py b/sources/pyside2/tests/QtCore/qobject_connect_notify_test.py
index 68f79161d..fdd71957b 100644
--- a/sources/pyside2/tests/QtCore/qobject_connect_notify_test.py
+++ b/sources/pyside2/tests/QtCore/qobject_connect_notify_test.py
@@ -59,7 +59,7 @@ class TestQObjectConnectNotify(UsesQCoreApplication):
'''Test case for QObject::connectNotify'''
def setUp(self):
UsesQCoreApplication.setUp(self)
- self.called = False
+ self.called = False
def tearDown(self):
UsesQCoreApplication.tearDown(self)
diff --git a/sources/pyside2/tests/QtCore/qslot_object_test.py b/sources/pyside2/tests/QtCore/qslot_object_test.py
index cfb9e7883..b8d5513ff 100644
--- a/sources/pyside2/tests/QtCore/qslot_object_test.py
+++ b/sources/pyside2/tests/QtCore/qslot_object_test.py
@@ -42,7 +42,7 @@ class objTest(QtCore.QObject):
def slot(self):
global qApp
-
+
self.ok = True
qApp.quit()
@@ -51,8 +51,8 @@ class objTest(QtCore.QObject):
class slotTest(unittest.TestCase):
def quit_app(self):
global qApp
-
- qApp.quit()
+
+ qApp.quit()
def testBasic(self):
global qApp
diff --git a/sources/pyside2/tests/QtGui/qregion_test.py b/sources/pyside2/tests/QtGui/qregion_test.py
index 3d5c17c36..72cec4bd5 100644
--- a/sources/pyside2/tests/QtGui/qregion_test.py
+++ b/sources/pyside2/tests/QtGui/qregion_test.py
@@ -38,7 +38,7 @@ class QRegionTest(UsesQApplication):
def testFunctionUnit(self):
r = QRegion(0, 0, 10, 10)
r2 = QRegion(5, 5, 10, 10)
-
+
ru = r.united(r2)
self.assertTrue(ru.contains(QPoint(0,0)))
self.assertTrue(ru.contains(QPoint(5,5)))
diff --git a/sources/pyside2/tests/QtGui/timed_app_test.py b/sources/pyside2/tests/QtGui/timed_app_test.py
index d35e595eb..dc0e7c4b0 100644
--- a/sources/pyside2/tests/QtGui/timed_app_test.py
+++ b/sources/pyside2/tests/QtGui/timed_app_test.py
@@ -28,7 +28,7 @@
import unittest
-from helper import TimedQApplication
+from helper import TimedQApplication
class TestTimedApp(TimedQApplication):
'''Simple test case for TimedQApplication'''
diff --git a/sources/pyside2/tests/QtQml/bug_726.py b/sources/pyside2/tests/QtQml/bug_726.py
index 310153421..20fa4d196 100755
--- a/sources/pyside2/tests/QtQml/bug_726.py
+++ b/sources/pyside2/tests/QtQml/bug_726.py
@@ -50,7 +50,7 @@ class ProxyObject(QtCore.QObject):
@QtCore.Slot(str)
def receivedObject(self, name):
self._receivedName = name
-
+
class TestConnectionWithInvalidSignature(TimedQApplication):
diff --git a/sources/pyside2/tests/QtQml/bug_997.qml b/sources/pyside2/tests/QtQml/bug_997.qml
index 7d2b7fcc0..f36a7e8f8 100755
--- a/sources/pyside2/tests/QtQml/bug_997.qml
+++ b/sources/pyside2/tests/QtQml/bug_997.qml
@@ -29,6 +29,6 @@
import QtQuick 2.0
Text {
- text: owner.name + " " + owner.phone
+ text: owner.name + " " + owner.phone
Component.onCompleted: { owner.newName = owner.name }
}
diff --git a/sources/pyside2/tests/QtScript/bug_1022.py b/sources/pyside2/tests/QtScript/bug_1022.py
index d076b23aa..63866ec3c 100644
--- a/sources/pyside2/tests/QtScript/bug_1022.py
+++ b/sources/pyside2/tests/QtScript/bug_1022.py
@@ -32,7 +32,7 @@ from PySide2.QtCore import *
from PySide2.QtScript import *
class QScriptValueTest(unittest.TestCase):
- def testQScriptValue(self):
+ def testQScriptValue(self):
app = QCoreApplication([])
engine = QScriptEngine()
repr(engine.evaluate('1 + 1'))
diff --git a/sources/pyside2/tests/QtSvg/tiger.svg b/sources/pyside2/tests/QtSvg/tiger.svg
index 983e57026..681fbd209 100644
--- a/sources/pyside2/tests/QtSvg/tiger.svg
+++ b/sources/pyside2/tests/QtSvg/tiger.svg
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
diff --git a/sources/pyside2/tests/QtWidgets/bug_307.py b/sources/pyside2/tests/QtWidgets/bug_307.py
index 4e5ecab45..0a0e9faa5 100644
--- a/sources/pyside2/tests/QtWidgets/bug_307.py
+++ b/sources/pyside2/tests/QtWidgets/bug_307.py
@@ -37,9 +37,9 @@ class Test (QApplication) :
def __init__(self, argv) :
super(Test, self).__init__(argv)
self._called = False
-
+
def called(self):
- self._called = True
+ self._called = True
class QApplicationSignalsTest(unittest.TestCase):
@@ -49,6 +49,6 @@ class QApplicationSignalsTest(unittest.TestCase):
app.connect(button, SIGNAL("clicked()"), app.called)
button.click()
self.assertTrue(app._called)
-
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside2/tests/QtWidgets/bug_338.py b/sources/pyside2/tests/QtWidgets/bug_338.py
index 27957a032..e51cb1523 100644
--- a/sources/pyside2/tests/QtWidgets/bug_338.py
+++ b/sources/pyside2/tests/QtWidgets/bug_338.py
@@ -47,9 +47,9 @@ class BugTest(unittest.TestCase):
scene = QtWidgets.QGraphicsScene()
item = DiagramItem()
item2 = DiagramItem()
- #this cause segfault
+ #this cause segfault
scene.addItem(item)
scene.addItem(item2)
-
+
if __name__ == "__main__":
- unittest.main() \ No newline at end of file
+ unittest.main()
diff --git a/sources/pyside2/tests/QtWidgets/bug_688.py b/sources/pyside2/tests/QtWidgets/bug_688.py
index 716d88df3..2bab2050a 100644
--- a/sources/pyside2/tests/QtWidgets/bug_688.py
+++ b/sources/pyside2/tests/QtWidgets/bug_688.py
@@ -38,20 +38,20 @@ class BugTest(UsesQApplication):
editor = QTextEdit()
cursor = QTextCursor(editor.textCursor())
cursor.movePosition(QTextCursor.Start)
-
+
mainFrame = cursor.currentFrame()
-
+
plainCharFormat = QTextCharFormat()
boldCharFormat = QTextCharFormat()
boldCharFormat.setFontWeight(QFont.Bold);
cursor.insertText("""
- Text documents are represented by the
- QTextDocument class, rather than by QString objects.
- Each QTextDocument object contains information about
- the document's internal representation, its structure,
- and keeps track of modifications to provide undo/redo
- facilities. This approach allows features such as the
- layout management to be delegated to specialized
+ Text documents are represented by the
+ QTextDocument class, rather than by QString objects.
+ Each QTextDocument object contains information about
+ the document's internal representation, its structure,
+ and keeps track of modifications to provide undo/redo
+ facilities. This approach allows features such as the
+ layout management to be delegated to specialized
classes, but also provides a focus for the framework.""",
plainCharFormat)
@@ -62,28 +62,28 @@ class BugTest(UsesQApplication):
cursor.insertFrame(frameFormat)
cursor.insertText("""
- Documents are either converted from external sources
- or created from scratch using Qt. The creation process
- can done by an editor widget, such as QTextEdit, or by
+ Documents are either converted from external sources
+ or created from scratch using Qt. The creation process
+ can done by an editor widget, such as QTextEdit, or by
explicit calls to the Scribe API.""",
boldCharFormat)
cursor = mainFrame.lastCursorPosition()
cursor.insertText("""
- There are two complementary ways to visualize the
- contents of a document: as a linear buffer that is
- used by editors to modify the contents, and as an
- object hierarchy containing structural information
- that is useful to layout engines. In the hierarchical
- model, the objects generally correspond to visual
- elements such as frames, tables, and lists. At a lower
- level, these elements describe properties such as the
- style of text used and its alignment. The linear
- representation of the document is used for editing and
+ There are two complementary ways to visualize the
+ contents of a document: as a linear buffer that is
+ used by editors to modify the contents, and as an
+ object hierarchy containing structural information
+ that is useful to layout engines. In the hierarchical
+ model, the objects generally correspond to visual
+ elements such as frames, tables, and lists. At a lower
+ level, these elements describe properties such as the
+ style of text used and its alignment. The linear
+ representation of the document is used for editing and
manipulation of the document's contents.""",
plainCharFormat)
-
+
frame = cursor.currentFrame()
items = []
@@ -110,7 +110,7 @@ class BugTest(UsesQApplication):
b.__isub__(1)
i -= 1
-
+
if __name__ == '__main__':
unittest.main()
diff --git a/sources/pyside2/tests/QtWidgets/qfontdialog_test.py b/sources/pyside2/tests/QtWidgets/qfontdialog_test.py
index dd9980c90..09e9b7173 100644
--- a/sources/pyside2/tests/QtWidgets/qfontdialog_test.py
+++ b/sources/pyside2/tests/QtWidgets/qfontdialog_test.py
@@ -42,7 +42,7 @@ class TestFontDialog(TimedQApplication):
def testGetFontQDialog(self):
QtWidgets.QFontDialog.getFont(QtGui.QFont("FreeSans",10))
-
+
def testGetFontQDialogQString(self):
QtWidgets.QFontDialog.getFont(QtGui.QFont("FreeSans",10), None, "Select font")
diff --git a/sources/pyside2/tests/QtWidgets/qgraphicsitem_isblocked_test.py b/sources/pyside2/tests/QtWidgets/qgraphicsitem_isblocked_test.py
index 7565fd99a..345ea7c45 100644
--- a/sources/pyside2/tests/QtWidgets/qgraphicsitem_isblocked_test.py
+++ b/sources/pyside2/tests/QtWidgets/qgraphicsitem_isblocked_test.py
@@ -36,13 +36,13 @@ from PySide2 import QtWidgets
from helper import UsesQApplication
class Item(QtWidgets.QGraphicsItem):
-
+
def __init__(self):
QtWidgets.QGraphicsItem.__init__(self)
def boundingRect(self):
return QtCore.QRectF(0, 0, 100, 100)
-
+
def paint(self, painter, option, widget):
painter.setBrush(QtGui.QColor(255, 255, 255))
painter.drawRect(0, 0, 100, 100)
diff --git a/sources/pyside2/tests/QtWidgets/reference_count_test.py b/sources/pyside2/tests/QtWidgets/reference_count_test.py
index 836020ad9..c2a0ec979 100644
--- a/sources/pyside2/tests/QtWidgets/reference_count_test.py
+++ b/sources/pyside2/tests/QtWidgets/reference_count_test.py
@@ -75,7 +75,7 @@ class ReferenceCount(UsesQApplication):
global destroyedPol
self.beforeTest()
-
+
rect = self.scene.addRect(10.0, 10.0, 10.0, 10.0)
self.assertTrue(isinstance(rect, QGraphicsRectItem))
diff --git a/sources/pyside2/tests/pysidetest/curr_errors.txt b/sources/pyside2/tests/pysidetest/curr_errors.txt
index 83b6e6212..a02da203d 100644
--- a/sources/pyside2/tests/pysidetest/curr_errors.txt
+++ b/sources/pyside2/tests/pysidetest/curr_errors.txt
@@ -6,7 +6,7 @@ Fixing class inheritance... [OK]
Detecting inconsistencies in class model... [OK]
[OK]
type 'QPyTextObject' is specified in typesystem, but not defined. This could potentially lead to compilation errors.
-
+
Done, 1 warnings (1051 known issues)
diff --git a/sources/pyside2/tests/pysidetest/hiddenobject.cpp b/sources/pyside2/tests/pysidetest/hiddenobject.cpp
index 24ef290ea..70692a8ec 100644
--- a/sources/pyside2/tests/pysidetest/hiddenobject.cpp
+++ b/sources/pyside2/tests/pysidetest/hiddenobject.cpp
@@ -38,7 +38,7 @@ bool HiddenObject::wasCalled()
return m_called;
}
-QObject* getHiddenObject()
+QObject *getHiddenObject()
{
return new HiddenObject();
}
diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
index c4f51737c..c91ac4dd4 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
+++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
@@ -62,7 +62,7 @@ static QString stripTemplateArgs(const QString &name)
return pos < 0 ? name : name.left(pos);
}
-static QStringList parseTemplateType(const QString& name) {
+static QStringList parseTemplateType(const QString &name) {
int n = name.indexOf(QLatin1Char('<'));
if (n <= 0) {
// If name starts with '<' or contains an unmatched (i.e. any) '>', we
@@ -112,8 +112,7 @@ static QStringList parseTemplateType(const QString& name) {
}
AbstractMetaBuilderPrivate::AbstractMetaBuilderPrivate() :
- m_logDirectory(QLatin1String(".") + QDir::separator()),
- m_skipDeprecated(false)
+ m_logDirectory(QLatin1String(".") + QDir::separator())
{
}
@@ -164,7 +163,7 @@ AbstractMetaEnumList AbstractMetaBuilder::globalEnums() const
AbstractMetaEnum *AbstractMetaBuilder::findEnum(const TypeEntry *typeEntry) const
{
if (typeEntry && typeEntry->isFlags())
- typeEntry = static_cast<const FlagsTypeEntry*>(typeEntry)->originator();
+ typeEntry = static_cast<const FlagsTypeEntry *>(typeEntry)->originator();
return d->m_enums.value(typeEntry);
}
@@ -179,7 +178,7 @@ void AbstractMetaBuilderPrivate::checkFunctionModifications()
if (!entry->isComplex() || entry->codeGeneration() == TypeEntry::GenerateNothing)
continue;
- const ComplexTypeEntry* centry = static_cast<const ComplexTypeEntry*>(entry);
+ auto centry = static_cast<const ComplexTypeEntry *>(entry);
if (!(centry->codeGeneration() & TypeEntry::GenerateTargetLang))
continue;
@@ -226,7 +225,7 @@ void AbstractMetaBuilderPrivate::checkFunctionModifications()
AbstractMetaClass *AbstractMetaBuilderPrivate::argumentToClass(const ArgumentModelItem &argument,
AbstractMetaClass *currentClass)
{
- AbstractMetaClass* returned = 0;
+ AbstractMetaClass *returned = nullptr;
AbstractMetaType *type = translateType(argument->type(), currentClass);
if (type && type->typeEntry() && type->typeEntry()->isComplex()) {
const TypeEntry *entry = type->typeEntry();
@@ -306,7 +305,7 @@ void AbstractMetaBuilderPrivate::traverseOperatorFunction(const FunctionModelIte
// Strip away first argument, since that is the containing object
AbstractMetaArgumentList arguments = metaFunction->arguments();
if (firstArgumentIsSelf || unaryOperator) {
- AbstractMetaArgument* first = arguments.takeFirst();
+ AbstractMetaArgument *first = arguments.takeFirst();
if (!unaryOperator && first->type()->indirections())
metaFunction->setPointerOperator(true);
delete first;
@@ -317,7 +316,7 @@ void AbstractMetaBuilderPrivate::traverseOperatorFunction(const FunctionModelIte
// must be an reverse operator (e.g. CLASS::operator(TYPE, CLASS)).
// All operator overloads that operate over a class are already
// being added as member functions of that class by the API Extractor.
- AbstractMetaArgument* last = arguments.takeLast();
+ AbstractMetaArgument *last = arguments.takeLast();
if (last->type()->indirections())
metaFunction->setPointerOperator(true);
delete last;
@@ -442,7 +441,7 @@ void AbstractMetaBuilderPrivate::traverseDom(const FileModelItem &dom)
ReportHandler::startProgress("Generating enum model ("
+ QByteArray::number(enums.size()) + ")...");
for (const EnumModelItem &item : enums) {
- AbstractMetaEnum *metaEnum = traverseEnum(item, 0, QSet<QString>());
+ AbstractMetaEnum *metaEnum = traverseEnum(item, nullptr, QSet<QString>());
if (metaEnum) {
if (metaEnum->typeEntry()->generateCode())
m_globalEnums << metaEnum;
@@ -479,11 +478,11 @@ void AbstractMetaBuilderPrivate::traverseDom(const FileModelItem &dom)
if (func->accessPolicy() != CodeModel::Public || func->name().startsWith(QLatin1String("operator")))
continue;
- FunctionTypeEntry* funcEntry = types->findFunctionType(func->name());
+ FunctionTypeEntry *funcEntry = types->findFunctionType(func->name());
if (!funcEntry || !funcEntry->generateCode())
continue;
- AbstractMetaFunction* metaFunc = traverseFunction(func, nullptr);
+ AbstractMetaFunction *metaFunc = traverseFunction(func, nullptr);
if (!metaFunc)
continue;
@@ -551,11 +550,11 @@ void AbstractMetaBuilderPrivate::traverseDom(const FileModelItem &dom)
<< QStringLiteral("type '%1' is specified in typesystem, but not defined. This could potentially lead to compilation errors.")
.arg(entry->qualifiedCppName());
} else if (entry->generateCode() && entry->type() == TypeEntry::FunctionType) {
- const FunctionTypeEntry* fte = static_cast<const FunctionTypeEntry*>(entry);
+ auto fte = static_cast<const FunctionTypeEntry *>(entry);
const QStringList &signatures = fte->signatures();
for (const QString &signature : signatures) {
bool ok = false;
- for (AbstractMetaFunction* func : qAsConst(m_globalFunctions)) {
+ for (AbstractMetaFunction *func : qAsConst(m_globalFunctions)) {
if (signature == func->minimalSignature()) {
ok = true;
break;
@@ -642,7 +641,7 @@ void AbstractMetaBuilderPrivate::traverseDom(const FileModelItem &dom)
// sort all classes topologically
m_metaClasses = classesTopologicalSorted(m_metaClasses);
- for (AbstractMetaClass* cls : qAsConst(m_metaClasses)) {
+ for (AbstractMetaClass *cls : qAsConst(m_metaClasses)) {
// setupEquals(cls);
// setupComparable(cls);
setupClonable(cls);
@@ -662,7 +661,7 @@ void AbstractMetaBuilderPrivate::traverseDom(const FileModelItem &dom)
// Functions added to the module on the type system.
const AddedFunctionList &globalUserFunctions = types->globalUserFunctions();
for (const AddedFunctionPtr &addedFunc : globalUserFunctions) {
- AbstractMetaFunction* metaFunc = traverseFunction(addedFunc);
+ AbstractMetaFunction *metaFunc = traverseFunction(addedFunc);
if (Q_UNLIKELY(!metaFunc)) {
qFatal("Unable to traverse added global function \"%s\".",
qPrintable(addedFunc->name()));
@@ -706,7 +705,7 @@ bool AbstractMetaBuilder::build(const QByteArrayList &arguments,
return true;
}
-void AbstractMetaBuilder::setLogDirectory(const QString& logDir)
+void AbstractMetaBuilder::setLogDirectory(const QString &logDir)
{
d->m_logDirectory = logDir;
if (!d->m_logDirectory.endsWith(QDir::separator()))
@@ -725,7 +724,7 @@ void AbstractMetaBuilderPrivate::addAbstractMetaClass(AbstractMetaClass *cls,
} else {
m_metaClasses << cls;
if (cls->typeEntry()->designatedInterface()) {
- AbstractMetaClass* interface = cls->extractInterface();
+ AbstractMetaClass *interface = cls->extractInterface();
m_metaClasses << interface;
if (ReportHandler::isDebug(ReportHandler::SparseDebug))
qCDebug(lcShiboken) << QStringLiteral(" -> interface '%1'").arg(interface->name());
@@ -743,14 +742,14 @@ AbstractMetaClass *AbstractMetaBuilderPrivate::traverseNamespace(const FileModel
if (TypeDatabase::instance()->isClassRejected(namespaceName)) {
m_rejectedClasses.insert(namespaceName, AbstractMetaBuilder::GenerationDisabled);
- return 0;
+ return nullptr;
}
auto type = TypeDatabase::instance()->findNamespaceType(namespaceName, namespaceItem->fileName());
if (!type) {
qCWarning(lcShiboken).noquote().nospace()
<< QStringLiteral("namespace '%1' does not have a type entry").arg(namespaceName);
- return 0;
+ return nullptr;
}
// Continue populating namespace?
@@ -784,7 +783,7 @@ AbstractMetaClass *AbstractMetaBuilderPrivate::traverseNamespace(const FileModel
const ClassList &classes = namespaceItem->classes();
for (const ClassModelItem &cls : classes) {
- AbstractMetaClass* mjc = traverseClass(dom, cls, metaClass);
+ AbstractMetaClass *mjc = traverseClass(dom, cls, metaClass);
if (mjc) {
metaClass->addInnerClass(mjc);
mjc->setEnclosingClass(metaClass);
@@ -806,7 +805,7 @@ AbstractMetaClass *AbstractMetaBuilderPrivate::traverseNamespace(const FileModel
// Traverse namespaces recursively
for (const NamespaceModelItem &ni : namespaceItem->namespaces()) {
- AbstractMetaClass* mjc = traverseNamespace(dom, ni);
+ AbstractMetaClass *mjc = traverseNamespace(dom, ni);
if (mjc) {
metaClass->addInnerClass(mjc);
mjc->setEnclosingClass(metaClass);
@@ -827,7 +826,7 @@ AbstractMetaEnum *AbstractMetaBuilderPrivate::traverseEnum(const EnumModelItem &
{
QString qualifiedName = enumItem->qualifiedName().join(colonColon());
- TypeEntry* typeEntry = 0;
+ TypeEntry *typeEntry = nullptr;
if (enumItem->accessPolicy() == CodeModel::Private) {
QStringList names = enumItem->qualifiedName();
const QString &enumName = names.constLast();
@@ -841,7 +840,7 @@ AbstractMetaEnum *AbstractMetaBuilderPrivate::traverseEnum(const EnumModelItem &
} else {
QStringList tmpQualifiedName = enumItem->qualifiedName();
const EnumeratorList &enums = enumItem->enumerators();
- for (const EnumeratorModelItem& enumValue : enums) {
+ for (const EnumeratorModelItem &enumValue : enums) {
tmpQualifiedName.removeLast();
tmpQualifiedName << enumValue->name();
qualifiedName = tmpQualifiedName.join(colonColon());
@@ -862,7 +861,7 @@ AbstractMetaEnum *AbstractMetaBuilderPrivate::traverseEnum(const EnumModelItem &
if (typeEntry)
typeEntry->setCodeGeneration(TypeEntry::GenerateNothing);
m_rejectedEnums.insert(qualifiedName + rejectReason, AbstractMetaBuilder::GenerationDisabled);
- return 0;
+ return nullptr;
}
const bool rejectionWarning = !enclosing
@@ -884,7 +883,7 @@ AbstractMetaEnum *AbstractMetaBuilderPrivate::traverseEnum(const EnumModelItem &
return nullptr;
}
- AbstractMetaEnum *metaEnum = new AbstractMetaEnum;
+ auto *metaEnum = new AbstractMetaEnum;
metaEnum->setEnumKind(enumItem->enumKind());
metaEnum->setSigned(enumItem->isSigned());
if (enumsDeclarations.contains(qualifiedName)
@@ -892,7 +891,7 @@ AbstractMetaEnum *AbstractMetaBuilderPrivate::traverseEnum(const EnumModelItem &
metaEnum->setHasQEnumsDeclaration(true);
}
- EnumTypeEntry *enumTypeEntry = static_cast<EnumTypeEntry *>(typeEntry);
+ auto *enumTypeEntry = static_cast<EnumTypeEntry *>(typeEntry);
metaEnum->setTypeEntry(enumTypeEntry);
switch (enumItem->accessPolicy()) {
case CodeModel::Public:
@@ -915,7 +914,7 @@ AbstractMetaEnum *AbstractMetaBuilderPrivate::traverseEnum(const EnumModelItem &
const EnumeratorList &enums = enumItem->enumerators();
for (const EnumeratorModelItem &value : enums) {
- AbstractMetaEnumValue *metaEnumValue = new AbstractMetaEnumValue;
+ auto *metaEnumValue = new AbstractMetaEnumValue;
metaEnumValue->setName(value->name());
// Deciding the enum value...
@@ -964,11 +963,11 @@ AbstractMetaEnum *AbstractMetaBuilderPrivate::traverseEnum(const EnumModelItem &
return metaEnum;
}
-AbstractMetaClass* AbstractMetaBuilderPrivate::traverseTypeDef(const FileModelItem &dom,
+AbstractMetaClass *AbstractMetaBuilderPrivate::traverseTypeDef(const FileModelItem &,
const TypeDefModelItem &typeDef,
AbstractMetaClass *currentClass)
{
- TypeDatabase* types = TypeDatabase::instance();
+ TypeDatabase *types = TypeDatabase::instance();
QString className = stripTemplateArgs(typeDef->name());
QString fullClassName = className;
@@ -981,20 +980,20 @@ AbstractMetaClass* AbstractMetaBuilderPrivate::traverseTypeDef(const FileModelIt
// If this is the alias for a primitive type
// we store the aliased type on the alias
// TypeEntry
- PrimitiveTypeEntry* ptype = types->findPrimitiveType(className);
+ PrimitiveTypeEntry *ptype = types->findPrimitiveType(className);
if (ptype) {
QString typeDefName = typeDef->type().qualifiedName()[0];
ptype->setReferencedTypeEntry(types->findPrimitiveType(typeDefName));
- return 0;
+ return nullptr;
}
// If we haven't specified anything for the typedef, then we don't care
- ComplexTypeEntry* type = types->findComplexType(fullClassName);
+ ComplexTypeEntry *type = types->findComplexType(fullClassName);
if (!type)
- return 0;
+ return nullptr;
- AbstractMetaClass *metaClass = new AbstractMetaClass;
+ auto *metaClass = new AbstractMetaClass;
metaClass->setTypeDef(true);
metaClass->setTypeEntry(type);
metaClass->setBaseClassNames(QStringList(typeDef->type().toString()));
@@ -1015,7 +1014,7 @@ void AbstractMetaBuilderPrivate::traverseTypesystemTypedefs()
const auto &entries = TypeDatabase::instance()->typedefEntries();
for (auto it = entries.begin(), end = entries.end(); it != end; ++it) {
TypedefEntry *te = it.value();
- AbstractMetaClass *metaClass = new AbstractMetaClass;
+ auto *metaClass = new AbstractMetaClass;
metaClass->setTypeDef(true);
metaClass->setTypeEntry(te->target());
metaClass->setBaseClassNames(QStringList(te->sourceType()));
@@ -1038,7 +1037,7 @@ AbstractMetaClass *AbstractMetaBuilderPrivate::traverseClass(const FileModelItem
+ colonColon() + fullClassName;
}
- ComplexTypeEntry* type = TypeDatabase::instance()->findComplexType(fullClassName);
+ ComplexTypeEntry *type = TypeDatabase::instance()->findComplexType(fullClassName);
AbstractMetaBuilder::RejectReason reason = AbstractMetaBuilder::NoReason;
if (TypeDatabase::instance()->isClassRejected(fullClassName)) {
@@ -1054,10 +1053,10 @@ AbstractMetaClass *AbstractMetaBuilderPrivate::traverseClass(const FileModelItem
}
if (reason != AbstractMetaBuilder::NoReason) {
m_rejectedClasses.insert(fullClassName, reason);
- return 0;
+ return nullptr;
}
- AbstractMetaClass *metaClass = new AbstractMetaClass;
+ auto *metaClass = new AbstractMetaClass;
metaClass->setTypeEntry(type);
if (classItem->isFinal())
@@ -1129,7 +1128,7 @@ AbstractMetaClass *AbstractMetaBuilderPrivate::traverseClass(const FileModelItem
return metaClass;
}
-void AbstractMetaBuilderPrivate::traverseScopeMembers(ScopeModelItem item,
+void AbstractMetaBuilderPrivate::traverseScopeMembers(const ScopeModelItem &item,
AbstractMetaClass *metaClass)
{
// Classes/Namespace members
@@ -1138,13 +1137,13 @@ void AbstractMetaBuilderPrivate::traverseScopeMembers(ScopeModelItem item,
// Inner classes
const ClassList &innerClasses = item->classes();
- for (const ClassModelItem& ci : innerClasses)
+ for (const ClassModelItem &ci : innerClasses)
traverseClassMembers(ci);
}
-void AbstractMetaBuilderPrivate::traverseClassMembers(ClassModelItem item)
+void AbstractMetaBuilderPrivate::traverseClassMembers(const ClassModelItem &item)
{
- AbstractMetaClass* metaClass = m_itemToClass.value(item.data());
+ AbstractMetaClass *metaClass = m_itemToClass.value(item.data());
if (!metaClass)
return;
@@ -1152,9 +1151,9 @@ void AbstractMetaBuilderPrivate::traverseClassMembers(ClassModelItem item)
traverseScopeMembers(item, metaClass);
}
-void AbstractMetaBuilderPrivate::traverseNamespaceMembers(NamespaceModelItem item)
+void AbstractMetaBuilderPrivate::traverseNamespaceMembers(const NamespaceModelItem &item)
{
- AbstractMetaClass* metaClass = m_itemToClass.value(item.data());
+ AbstractMetaClass *metaClass = m_itemToClass.value(item.data());
if (!metaClass)
return;
@@ -1186,20 +1185,20 @@ AbstractMetaField *AbstractMetaBuilderPrivate::traverseField(const VariableModel
// Ignore friend decl.
if (field->isFriend())
- return 0;
+ return nullptr;
if (field->accessPolicy() == CodeModel::Private)
- return 0;
+ return nullptr;
QString rejectReason;
if (TypeDatabase::instance()->isFieldRejected(className, fieldName, &rejectReason)) {
m_rejectedFields.insert(qualifiedFieldSignatureWithType(className, field) + rejectReason,
AbstractMetaBuilder::GenerationDisabled);
- return 0;
+ return nullptr;
}
- AbstractMetaField *metaField = new AbstractMetaField;
+ auto *metaField = new AbstractMetaField;
metaField->setName(fieldName);
metaField->setEnclosingClass(cls);
@@ -1214,12 +1213,12 @@ AbstractMetaField *AbstractMetaBuilderPrivate::traverseField(const VariableModel
.arg(cls->name(), fieldName, type);
}
delete metaField;
- return 0;
+ return nullptr;
}
metaField->setType(metaType);
- AbstractMetaAttributes::Attributes attr = 0;
+ AbstractMetaAttributes::Attributes attr = nullptr;
if (field->isStatic())
attr |= AbstractMetaAttributes::Static;
@@ -1240,7 +1239,7 @@ void AbstractMetaBuilderPrivate::traverseFields(const ScopeModelItem &scope_item
{
const VariableList &variables = scope_item->variables();
for (const VariableModelItem &field : variables) {
- AbstractMetaField* metaField = traverseField(field, metaClass);
+ AbstractMetaField *metaField = traverseField(field, metaClass);
if (metaField && !metaField->isModifiedRemoved()) {
metaField->setOriginalAttributes(metaField->attributes());
@@ -1269,7 +1268,7 @@ void AbstractMetaBuilderPrivate::fixReturnTypeOfConversionOperator(AbstractMetaF
if (!metaFunction->isConversionOperator())
return;
- TypeDatabase* types = TypeDatabase::instance();
+ TypeDatabase *types = TypeDatabase::instance();
static const QRegularExpression operatorRegExp(QStringLiteral("^operator "));
Q_ASSERT(operatorRegExp.isValid());
QString castTo = metaFunction->name().remove(operatorRegExp).trimmed();
@@ -1279,22 +1278,22 @@ void AbstractMetaBuilderPrivate::fixReturnTypeOfConversionOperator(AbstractMetaF
if (castTo.startsWith(QLatin1String("const ")))
castTo.remove(0, 6);
- TypeEntry* retType = types->findType(castTo);
+ TypeEntry *retType = types->findType(castTo);
if (!retType)
return;
- AbstractMetaType* metaType = new AbstractMetaType;
+ auto *metaType = new AbstractMetaType;
metaType->setTypeEntry(retType);
metaFunction->replaceType(metaType);
}
-static bool _compareAbstractMetaTypes(const AbstractMetaType* type, const AbstractMetaType* other)
+static bool _compareAbstractMetaTypes(const AbstractMetaType *type, const AbstractMetaType *other)
{
return (type != nullptr) == (other != nullptr)
&& (type == nullptr || *type == *other);
}
-static bool _compareAbstractMetaFunctions(const AbstractMetaFunction* func, const AbstractMetaFunction* other)
+static bool _compareAbstractMetaFunctions(const AbstractMetaFunction *func, const AbstractMetaFunction *other)
{
if (!func && !other)
return true;
@@ -1317,7 +1316,7 @@ AbstractMetaFunctionList AbstractMetaBuilderPrivate::classFunctionList(const Sco
AbstractMetaClass::Attributes *constructorAttributes,
AbstractMetaClass *currentClass)
{
- *constructorAttributes = 0;
+ *constructorAttributes = nullptr;
AbstractMetaFunctionList result;
const FunctionList &scopeFunctionList = scopeItem->functions();
result.reserve(scopeFunctionList.size());
@@ -1370,21 +1369,22 @@ void AbstractMetaBuilderPrivate::traverseFunctions(ScopeModelItem scopeItem,
if (metaClass->isNamespace())
*metaFunction += AbstractMetaAttributes::Static;
- QPropertySpec *read = 0;
+ QPropertySpec *read = nullptr;
if (!metaFunction->isSignal() && (read = metaClass->propertySpecForRead(metaFunction->name()))) {
// Property reader must be in the form "<type> name()"
- if (metaFunction->type() && (read->type() == metaFunction->type()->typeEntry()) && (metaFunction->arguments().size() == 0)) {
+ if (metaFunction->type() && (read->type() == metaFunction->type()->typeEntry())
+ && metaFunction->arguments().isEmpty()) {
*metaFunction += AbstractMetaAttributes::PropertyReader;
metaFunction->setPropertySpec(read);
}
- } else if (QPropertySpec* write = metaClass->propertySpecForWrite(metaFunction->name())) {
+ } else if (QPropertySpec *write = metaClass->propertySpecForWrite(metaFunction->name())) {
// Property setter must be in the form "void name(<type>)"
// make sure the function was created with all aguments, some argument can be missing during the pareser because of errors on typesystem
if ((!metaFunction->type()) && (metaFunction->arguments().size() == 1) && (write->type() == metaFunction->arguments().at(0)->type()->typeEntry())) {
*metaFunction += AbstractMetaAttributes::PropertyWriter;
metaFunction->setPropertySpec(write);
}
- } else if (QPropertySpec* reset = metaClass->propertySpecForReset(metaFunction->name())) {
+ } else if (QPropertySpec *reset = metaClass->propertySpecForReset(metaFunction->name())) {
// Property resetter must be in the form "void name()"
if ((!metaFunction->type()) && metaFunction->arguments().isEmpty()) {
*metaFunction += AbstractMetaAttributes::PropertyResetter;
@@ -1435,7 +1435,7 @@ void AbstractMetaBuilderPrivate::traverseFunctions(ScopeModelItem scopeItem,
}
if (!metaFunction->ownerClass()) {
delete metaFunction;
- metaFunction = 0;
+ metaFunction = nullptr;
}
}
@@ -1606,13 +1606,13 @@ void AbstractMetaBuilderPrivate::traverseEnums(const ScopeModelItem &scopeItem,
AbstractMetaFunction* AbstractMetaBuilderPrivate::traverseFunction(const AddedFunctionPtr &addedFunc)
{
- return traverseFunction(addedFunc, 0);
+ return traverseFunction(addedFunc, nullptr);
}
AbstractMetaFunction* AbstractMetaBuilderPrivate::traverseFunction(const AddedFunctionPtr &addedFunc,
AbstractMetaClass *metaClass)
{
- AbstractMetaFunction *metaFunction = new AbstractMetaFunction(addedFunc);
+ auto *metaFunction = new AbstractMetaFunction(addedFunc);
metaFunction->setType(translateType(addedFunc->returnType()));
@@ -1621,7 +1621,7 @@ AbstractMetaFunction* AbstractMetaBuilderPrivate::traverseFunction(const AddedFu
for (int i = 0; i < args.count(); ++i) {
const AddedFunction::TypeInfo& typeInfo = args.at(i).typeInfo;
- AbstractMetaArgument *metaArg = new AbstractMetaArgument;
+ auto *metaArg = new AbstractMetaArgument;
AbstractMetaType *type = translateType(typeInfo);
if (Q_UNLIKELY(!type)) {
qCWarning(lcShiboken,
@@ -1835,7 +1835,7 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(const Functio
return nullptr;
if (functionItem->isFriend())
- return 0;
+ return nullptr;
const bool deprecated = functionItem->isDeprecated();
if (deprecated && m_skipDeprecated) {
@@ -1844,7 +1844,7 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(const Functio
return nullptr;
}
- AbstractMetaFunction *metaFunction = new AbstractMetaFunction;
+ auto *metaFunction = new AbstractMetaFunction;
if (deprecated)
*metaFunction += AbstractMetaAttributes::Deprecated;
@@ -1959,7 +1959,7 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(const Functio
}
break;
}
- Q_ASSERT(metaType == 0);
+ Q_ASSERT(metaType == nullptr);
const QString reason = msgUnmatchedParameterType(arg, i, errorMessage);
qCWarning(lcShiboken, "%s",
qPrintable(msgSkippingFunction(functionItem, originalQualifiedSignatureWithReturn, reason)));
@@ -1970,7 +1970,7 @@ AbstractMetaFunction *AbstractMetaBuilderPrivate::traverseFunction(const Functio
return nullptr;
}
- AbstractMetaArgument *metaArgument = new AbstractMetaArgument;
+ auto *metaArgument = new AbstractMetaArgument;
metaArgument->setType(metaType);
metaArgument->setName(arg->name());
@@ -2075,7 +2075,7 @@ AbstractMetaType *AbstractMetaBuilderPrivate::translateType(const AddedFunction:
QString typeName = typeInfo.name;
if (typeName == QLatin1String("void"))
- return 0;
+ return nullptr;
type = typeDb->findType(typeName);
@@ -2117,7 +2117,7 @@ AbstractMetaType *AbstractMetaBuilderPrivate::translateType(const AddedFunction:
qFatal("%s", qPrintable(msg));
}
- AbstractMetaType *metaType = new AbstractMetaType;
+ auto *metaType = new AbstractMetaType;
metaType->setTypeEntry(type);
metaType->setIndirections(typeInfo.indirections);
if (typeInfo.isReference)
@@ -2136,7 +2136,7 @@ AbstractMetaType *AbstractMetaBuilderPrivate::translateType(const AddedFunction:
static const TypeEntry* findTypeEntryUsingContext(const AbstractMetaClass* metaClass, const QString& qualifiedName)
{
- const TypeEntry* type = 0;
+ const TypeEntry* type = nullptr;
QStringList context = metaClass->qualifiedCppName().split(colonColon());
while (!type && !context.isEmpty()) {
type = TypeDatabase::instance()->findType(context.join(colonColon()) + colonColon() + qualifiedName);
@@ -2231,7 +2231,7 @@ AbstractMetaType *AbstractMetaBuilderPrivate::translateTypeStatic(const TypeInfo
}
for (int i = typeInfo.arrayElements().size() - 1; i >= 0; --i) {
- AbstractMetaType *arrayType = new AbstractMetaType;
+ auto *arrayType = new AbstractMetaType;
arrayType->setArrayElementType(elementType);
const QString &arrayElement = typeInfo.arrayElements().at(i);
if (!arrayElement.isEmpty()) {
@@ -2270,7 +2270,7 @@ AbstractMetaType *AbstractMetaBuilderPrivate::translateTypeStatic(const TypeInfo
typeInfo.clearInstantiations();
}
- const TypeEntry *type = 0;
+ const TypeEntry *type = nullptr;
// 5. Try to find the type
// 5.1 - Try first using the current scope
@@ -2321,7 +2321,7 @@ AbstractMetaType *AbstractMetaBuilderPrivate::translateTypeStatic(const TypeInfo
// These are only implicit and should not appear in code...
Q_ASSERT(!type->isInterface());
- AbstractMetaType *metaType = new AbstractMetaType;
+ auto *metaType = new AbstractMetaType;
metaType->setTypeEntry(type);
metaType->setIndirectionsV(typeInfo.indirectionsV());
metaType->setReferenceType(typeInfo.referenceType());
@@ -2539,7 +2539,7 @@ AbstractMetaClass* AbstractMetaBuilderPrivate::findTemplateClass(const QString &
if (info)
*info = parsed;
- AbstractMetaClass* templ = 0;
+ AbstractMetaClass *templ = nullptr;
for (AbstractMetaClass *c : qAsConst(m_templates)) {
if (c->typeEntry()->name() == qualifiedName) {
templ = c;
@@ -2557,7 +2557,7 @@ AbstractMetaClass* AbstractMetaBuilderPrivate::findTemplateClass(const QString &
*baseContainerType = types->findContainerType(qualifiedName);
}
- return 0;
+ return nullptr;
}
AbstractMetaClassList AbstractMetaBuilderPrivate::getBaseClasses(const AbstractMetaClass *metaClass) const
@@ -2565,7 +2565,7 @@ AbstractMetaClassList AbstractMetaBuilderPrivate::getBaseClasses(const AbstractM
AbstractMetaClassList baseClasses;
const QStringList &baseClassNames = metaClass->baseClassNames();
for (const QString& parent : baseClassNames) {
- AbstractMetaClass* cls = 0;
+ AbstractMetaClass *cls = nullptr;
if (parent.contains(QLatin1Char('<')))
cls = findTemplateClass(parent, metaClass);
else
@@ -2603,7 +2603,7 @@ AbstractMetaType *
returned->setOriginalTemplateType(metaType);
if (returned->typeEntry()->isTemplateArgument()) {
- const TemplateArgumentEntry* tae = static_cast<const TemplateArgumentEntry*>(returned->typeEntry());
+ const auto *tae = static_cast<const TemplateArgumentEntry*>(returned->typeEntry());
// If the template is intantiated with void we special case this as rejecting the functions that use this
// parameter from the instantiation.
@@ -2685,7 +2685,7 @@ bool AbstractMetaBuilderPrivate::inheritTemplate(AbstractMetaClass *subclass,
}
if (t) {
- AbstractMetaType *temporaryType = new AbstractMetaType;
+ auto *temporaryType = new AbstractMetaType;
temporaryType->setTypeEntry(t);
temporaryType->setConstant(i.isConstant());
temporaryType->setReferenceType(i.referenceType());
@@ -2837,7 +2837,7 @@ void AbstractMetaBuilderPrivate::parseQ_Property(AbstractMetaClass *metaClass,
continue;
}
- QPropertySpec* spec = new QPropertySpec(type->typeEntry());
+ auto *spec = new QPropertySpec(type->typeEntry());
spec->setName(propertyTokens.at(1).toString());
spec->setIndex(i);
@@ -2867,7 +2867,7 @@ static AbstractMetaFunction* findCopyCtor(AbstractMetaClass* cls)
if (t == AbstractMetaFunction::CopyConstructorFunction || t == AbstractMetaFunction::AssignmentOperatorFunction)
return f;
}
- return 0;
+ return nullptr;
}
void AbstractMetaBuilderPrivate::setupClonable(AbstractMetaClass *cls)
@@ -3200,13 +3200,12 @@ template <class Container>
static void debugFormatSequence(QDebug &d, const char *key, const Container& c,
const char *separator = ", ")
{
- typedef typename Container::const_iterator ConstIt;
if (c.isEmpty())
return;
- const ConstIt begin = c.begin();
- const ConstIt end = c.end();
+ const auto begin = c.begin();
+ const auto end = c.end();
d << "\n " << key << '[' << c.size() << "]=(";
- for (ConstIt it = begin; it != end; ++it) {
+ for (auto it = begin; it != end; ++it) {
if (it != begin)
d << separator;
d << *it;
diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h b/sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h
index 1fd5f3c34..fec2eddb9 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h
+++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder_p.h
@@ -43,6 +43,8 @@ class TypeDatabase;
class AbstractMetaBuilderPrivate
{
public:
+ Q_DISABLE_COPY(AbstractMetaBuilderPrivate)
+
AbstractMetaBuilderPrivate();
~AbstractMetaBuilderPrivate();
@@ -71,9 +73,9 @@ public:
AbstractMetaClass *traverseClass(const FileModelItem &dom,
const ClassModelItem &item,
AbstractMetaClass *currentClass);
- void traverseScopeMembers(ScopeModelItem item, AbstractMetaClass *metaClass);
- void traverseClassMembers(ClassModelItem scopeItem);
- void traverseNamespaceMembers(NamespaceModelItem scopeItem);
+ void traverseScopeMembers(const ScopeModelItem &item, AbstractMetaClass *metaClass);
+ void traverseClassMembers(const ClassModelItem &scopeItem);
+ void traverseNamespaceMembers(const NamespaceModelItem &scopeItem);
bool setupInheritance(AbstractMetaClass *metaClass);
AbstractMetaClass *traverseNamespace(const FileModelItem &dom,
const NamespaceModelItem &item);
@@ -173,7 +175,7 @@ public:
AbstractMetaFunctionList m_globalFunctions;
AbstractMetaEnumList m_globalEnums;
- typedef QMap<QString, AbstractMetaBuilder::RejectReason> RejectMap;
+ using RejectMap = QMap<QString, AbstractMetaBuilder::RejectReason>;
RejectMap m_rejectedClasses;
RejectMap m_rejectedEnums;
@@ -190,7 +192,7 @@ public:
QFileInfo m_globalHeader;
QStringList m_headerPaths;
mutable QHash<QString, Include> m_resolveIncludeHash;
- bool m_skipDeprecated;
+ bool m_skipDeprecated = false;
};
#endif // ABSTRACTMETBUILDER_P_H
diff --git a/sources/shiboken2/ApiExtractor/abstractmetalang.cpp b/sources/shiboken2/ApiExtractor/abstractmetalang.cpp
index 512efef58..455140e59 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetalang.cpp
+++ b/sources/shiboken2/ApiExtractor/abstractmetalang.cpp
@@ -188,7 +188,7 @@ QString AbstractMetaType::fullName() const
AbstractMetaType *AbstractMetaType::copy() const
{
- AbstractMetaType *cpy = new AbstractMetaType;
+ auto *cpy = new AbstractMetaType;
cpy->setTypeUsagePattern(typeUsagePattern());
cpy->setConstant(isConstant());
@@ -198,9 +198,9 @@ AbstractMetaType *AbstractMetaType::copy() const
cpy->setInstantiations(instantiations());
cpy->setArrayElementCount(arrayElementCount());
cpy->setOriginalTypeDescription(originalTypeDescription());
- cpy->setOriginalTemplateType(originalTemplateType() ? originalTemplateType()->copy() : 0);
+ cpy->setOriginalTemplateType(originalTemplateType() ? originalTemplateType()->copy() : nullptr);
- cpy->setArrayElementType(arrayElementType() ? arrayElementType()->copy() : 0);
+ cpy->setArrayElementType(arrayElementType() ? arrayElementType()->copy() : nullptr);
cpy->setTypeEntry(typeEntry());
@@ -427,7 +427,7 @@ void AbstractMetaArgument::assignMetaArgument(const AbstractMetaArgument &other)
AbstractMetaArgument *AbstractMetaArgument::copy() const
{
- AbstractMetaArgument *copy = new AbstractMetaArgument;
+ auto *copy = new AbstractMetaArgument;
copy->assignMetaArgument(*this);
return copy;
}
@@ -519,7 +519,7 @@ bool AbstractMetaFunction::operator<(const AbstractMetaFunction &other) const
*/
AbstractMetaFunction::CompareResult AbstractMetaFunction::compareTo(const AbstractMetaFunction *other) const
{
- CompareResult result = 0;
+ CompareResult result = nullptr;
// Enclosing class...
if (ownerClass() == other->ownerClass())
@@ -587,7 +587,7 @@ AbstractMetaFunction::CompareResult AbstractMetaFunction::compareTo(const Abstra
AbstractMetaFunction *AbstractMetaFunction::copy() const
{
- AbstractMetaFunction *cpy = new AbstractMetaFunction;
+ auto *cpy = new AbstractMetaFunction;
cpy->assignMetaAttributes(*this);
cpy->setName(name());
cpy->setOriginalName(originalName());
@@ -963,7 +963,7 @@ QString AbstractMetaFunction::debugSignature() const
return result;
}
-FunctionModificationList AbstractMetaFunction::modifications(const AbstractMetaClass* implementor) const
+FunctionModificationList AbstractMetaFunction::modifications(const AbstractMetaClass *implementor) const
{
if (!m_addedFunction.isNull())
return m_addedFunction->modifications;
@@ -1042,7 +1042,7 @@ bool AbstractMetaFunction::hasSignatureModifications() const
return false;
}
-bool AbstractMetaFunction::isConversionOperator(const QString& funcName)
+bool AbstractMetaFunction::isConversionOperator(const QString &funcName)
{
static const QRegularExpression opRegEx(QStringLiteral("^operator(?:\\s+(?:const|volatile))?\\s+(\\w+\\s*)&?$"));
Q_ASSERT(opRegEx.isValid());
@@ -1107,7 +1107,7 @@ bool AbstractMetaFunction::generateExceptionHandling() const
return result;
}
-bool AbstractMetaFunction::isOperatorOverload(const QString& funcName)
+bool AbstractMetaFunction::isOperatorOverload(const QString &funcName)
{
if (isConversionOperator(funcName))
return true;
@@ -1406,9 +1406,9 @@ AbstractMetaClass *AbstractMetaClass::extractInterface()
Q_ASSERT(typeEntry()->designatedInterface());
if (!m_extractedInterface) {
- AbstractMetaClass *iface = new AbstractMetaClass;
+ auto *iface = new AbstractMetaClass;
iface->setAttributes(attributes());
- iface->setBaseClass(0);
+ iface->setBaseClass(nullptr);
iface->setTypeEntry(typeEntry()->designatedInterface());
@@ -1679,7 +1679,7 @@ bool AbstractMetaClass::hasFunction(const QString &str) const
return findFunction(str);
}
-const AbstractMetaFunction* AbstractMetaClass::findFunction(const QString& functionName) const
+const AbstractMetaFunction *AbstractMetaClass::findFunction(const QString &functionName) const
{
return AbstractMetaFunction::find(m_functions, functionName);
}
@@ -1709,30 +1709,32 @@ bool AbstractMetaClass::hasProtectedMembers() const
QPropertySpec *AbstractMetaClass::propertySpecForRead(const QString &name) const
{
- for (int i = 0; i < m_propertySpecs.size(); ++i)
- if (name == m_propertySpecs.at(i)->read())
- return m_propertySpecs.at(i);
- return 0;
+ for (const auto &propertySpec : m_propertySpecs) {
+ if (name == propertySpec->read())
+ return propertySpec;
+ }
+ return nullptr;
}
QPropertySpec *AbstractMetaClass::propertySpecForWrite(const QString &name) const
{
- for (int i = 0; i < m_propertySpecs.size(); ++i)
- if (name == m_propertySpecs.at(i)->write())
- return m_propertySpecs.at(i);
- return 0;
+ for (const auto &propertySpec : m_propertySpecs) {
+ if (name == propertySpec->write())
+ return propertySpec;
+ }
+ return nullptr;
}
QPropertySpec *AbstractMetaClass::propertySpecForReset(const QString &name) const
{
- for (int i = 0; i < m_propertySpecs.size(); ++i) {
- if (name == m_propertySpecs.at(i)->reset())
- return m_propertySpecs.at(i);
+ for (const auto &propertySpec : m_propertySpecs) {
+ if (name == propertySpec->reset())
+ return propertySpec;
}
- return 0;
+ return nullptr;
}
-typedef QHash<const AbstractMetaClass*, AbstractMetaTypeList> AbstractMetaClassBaseTemplateInstantiationsMap;
+using AbstractMetaClassBaseTemplateInstantiationsMap = QHash<const AbstractMetaClass *, AbstractMetaTypeList>;
Q_GLOBAL_STATIC(AbstractMetaClassBaseTemplateInstantiationsMap, metaClassBaseTemplateInstantiations);
bool AbstractMetaClass::hasTemplateBaseClassInstantiations() const
@@ -1749,7 +1751,7 @@ AbstractMetaTypeList AbstractMetaClass::templateBaseClassInstantiations() const
return metaClassBaseTemplateInstantiations()->value(this);
}
-void AbstractMetaClass::setTemplateBaseClassInstantiations(AbstractMetaTypeList& instantiations)
+void AbstractMetaClass::setTemplateBaseClassInstantiations(AbstractMetaTypeList &instantiations)
{
if (!templateBaseClass())
return;
@@ -1782,7 +1784,7 @@ AbstractMetaField::~AbstractMetaField()
AbstractMetaField *AbstractMetaField::copy() const
{
- AbstractMetaField *returned = new AbstractMetaField;
+ auto *returned = new AbstractMetaField;
returned->assignMetaVariable(*this);
returned->assignMetaAttributes(*this);
returned->setEnclosingClass(nullptr);
@@ -1822,7 +1824,7 @@ static QString upCaseFirst(const QString &str)
static AbstractMetaFunction *createXetter(const AbstractMetaField *g, const QString &name,
AbstractMetaAttributes::Attributes type)
{
- AbstractMetaFunction *f = new AbstractMetaFunction;
+ auto *f = new AbstractMetaFunction;
f->setName(name);
f->setOriginalName(name);
@@ -1880,7 +1882,7 @@ const AbstractMetaFunction *AbstractMetaField::setter() const
QLatin1String("set") + upCaseFirst(name()),
AbstractMetaAttributes::SetterFunction);
AbstractMetaArgumentList arguments;
- AbstractMetaArgument *argument = new AbstractMetaArgument;
+ auto *argument = new AbstractMetaArgument;
argument->setType(type()->copy());
argument->setName(name());
arguments.append(argument);
@@ -2000,7 +2002,7 @@ bool AbstractMetaClass::hasPrivateCopyConstructor() const
void AbstractMetaClass::addDefaultConstructor()
{
- AbstractMetaFunction *f = new AbstractMetaFunction;
+ auto *f = new AbstractMetaFunction;
f->setOriginalName(name());
f->setName(name());
f->setOwnerClass(this);
@@ -2018,20 +2020,20 @@ void AbstractMetaClass::addDefaultConstructor()
void AbstractMetaClass::addDefaultCopyConstructor(bool isPrivate)
{
- AbstractMetaFunction* f = new AbstractMetaFunction;
+ auto f = new AbstractMetaFunction;
f->setOriginalName(name());
f->setName(name());
f->setOwnerClass(this);
f->setFunctionType(AbstractMetaFunction::CopyConstructorFunction);
f->setDeclaringClass(this);
- AbstractMetaType* argType = new AbstractMetaType;
+ auto argType = new AbstractMetaType;
argType->setTypeEntry(typeEntry());
argType->setReferenceType(LValueReference);
argType->setConstant(true);
argType->setTypeUsagePattern(AbstractMetaType::ValuePattern);
- AbstractMetaArgument* arg = new AbstractMetaArgument;
+ auto arg = new AbstractMetaArgument;
arg->setType(argType);
arg->setName(name());
f->addArgument(arg);
@@ -2263,9 +2265,9 @@ static void addExtraIncludeForType(AbstractMetaClass *metaClass, const AbstractM
return;
Q_ASSERT(metaClass);
- const TypeEntry *entry = (type ? type->typeEntry() : 0);
+ const TypeEntry *entry = (type ? type->typeEntry() : nullptr);
if (entry && entry->isComplex()) {
- const ComplexTypeEntry *centry = static_cast<const ComplexTypeEntry *>(entry);
+ const auto *centry = static_cast<const ComplexTypeEntry *>(entry);
ComplexTypeEntry *class_entry = metaClass->typeEntry();
if (class_entry && centry->include().isValid())
class_entry->addExtraInclude(centry->include());
@@ -2324,9 +2326,7 @@ void AbstractMetaClass::fixFunctions()
}
QSet<AbstractMetaFunction *> funcsToAdd;
- for (int sfi = 0; sfi < superFuncs.size(); ++sfi) {
- AbstractMetaFunction *sf = superFuncs.at(sfi);
-
+ for (auto sf : qAsConst(superFuncs)) {
if (sf->isRemovedFromAllLanguages(sf->implementingClass()))
continue;
@@ -2589,7 +2589,7 @@ AbstractMetaEnum *AbstractMetaClass::findEnum(const AbstractMetaClassList &class
qCWarning(lcShiboken).noquote().nospace()
<< QStringLiteral("AbstractMeta::findEnum(), unknown class '%1' in '%2'")
.arg(className, entry->qualifiedCppName());
- return 0;
+ return nullptr;
}
return metaClass->findEnum(enumName);
@@ -2601,8 +2601,8 @@ AbstractMetaEnumValue *AbstractMetaClass::findEnumValue(const AbstractMetaClassL
const QVector<QStringRef> lst = name.splitRef(QLatin1String("::"));
if (lst.size() > 1) {
- const QStringRef prefixName = lst.at(0);
- const QStringRef enumName = lst.at(1);
+ const QStringRef &prefixName = lst.at(0);
+ const QStringRef &enumName = lst.at(1);
if (AbstractMetaClass *cl = findClass(classes, prefixName.toString()))
return cl->findEnumValue(enumName.toString());
}
@@ -2626,7 +2626,7 @@ AbstractMetaClass *AbstractMetaClass::findClass(const AbstractMetaClassList &cla
const QString &name)
{
if (name.isEmpty())
- return 0;
+ return nullptr;
for (AbstractMetaClass *c : classes) {
if (c->qualifiedCppName() == name)
@@ -2643,17 +2643,17 @@ AbstractMetaClass *AbstractMetaClass::findClass(const AbstractMetaClassList &cla
return c;
}
- return 0;
+ return nullptr;
}
AbstractMetaClass *AbstractMetaClass::findClass(const AbstractMetaClassList &classes,
- const TypeEntry* typeEntry)
+ const TypeEntry *typeEntry)
{
- for (AbstractMetaClass* c : classes) {
+ for (AbstractMetaClass *c : classes) {
if (c->typeEntry() == typeEntry)
return c;
}
- return 0;
+ return nullptr;
}
#ifndef QT_NO_DEBUG_STREAM
diff --git a/sources/shiboken2/ApiExtractor/abstractmetalang.h b/sources/shiboken2/ApiExtractor/abstractmetalang.h
index e8ec21f48..afb4e5fbd 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetalang.h
+++ b/sources/shiboken2/ApiExtractor/abstractmetalang.h
@@ -72,7 +72,7 @@ public:
Target
};
- Documentation() {}
+ Documentation() = default;
Documentation(const QString& value, Format fmt = Documentation::Native)
: m_data(value.trimmed()), m_format(fmt) {}
@@ -105,9 +105,10 @@ private:
class AbstractMetaAttributes
{
- Q_DISABLE_COPY(AbstractMetaAttributes)
Q_GADGET
public:
+ Q_DISABLE_COPY(AbstractMetaAttributes)
+
AbstractMetaAttributes();
virtual ~AbstractMetaAttributes();
@@ -292,7 +293,7 @@ class AbstractMetaType
{
Q_GADGET
public:
- typedef QVector<Indirection> Indirections;
+ using Indirections = QVector<Indirection>;
enum TypeUsagePattern {
InvalidPattern,
@@ -587,13 +588,12 @@ public:
}
void setType(AbstractMetaType *type)
{
- Q_ASSERT(m_type == 0);
+ Q_ASSERT(m_type == nullptr);
m_type = type;
}
void replaceType(AbstractMetaType *type)
{
- if (m_type)
- delete m_type;
+ delete m_type;
m_type = type;
}
@@ -896,14 +896,13 @@ public:
}
void setType(AbstractMetaType *type)
{
- Q_ASSERT(m_type == 0);
+ Q_ASSERT(m_type == nullptr);
m_type = type;
}
void replaceType(AbstractMetaType *type)
{
- if (m_type)
- delete m_type;
+ delete m_type;
m_type = type;
}
@@ -1053,12 +1052,12 @@ public:
* \return true if there is some modification to function signature
*/
bool hasSignatureModifications() const;
- FunctionModificationList modifications(const AbstractMetaClass* implementor = 0) const;
+ FunctionModificationList modifications(const AbstractMetaClass* implementor = nullptr) const;
/**
* Return the argument name if there is a modification the renamed value will be returned
*/
- QString argumentName(int index, bool create = true, const AbstractMetaClass *cl = 0) const;
+ QString argumentName(int index, bool create = true, const AbstractMetaClass *cl = nullptr) const;
void setPropertySpec(QPropertySpec *spec)
{
@@ -1132,7 +1131,7 @@ QDebug operator<<(QDebug d, const AbstractMetaFunction *af);
class AbstractMetaEnumValue
{
public:
- AbstractMetaEnumValue() {}
+ AbstractMetaEnumValue() = default;
EnumValue value() const
{
@@ -1507,7 +1506,7 @@ public:
m_innerClasses << cl;
}
- void setInnerClasses(AbstractMetaClassList innerClasses)
+ void setInnerClasses(const AbstractMetaClassList &innerClasses)
{
m_innerClasses = innerClasses;
}
diff --git a/sources/shiboken2/ApiExtractor/abstractmetalang_typedefs.h b/sources/shiboken2/ApiExtractor/abstractmetalang_typedefs.h
index 9ff11d44e..617ebcf4f 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetalang_typedefs.h
+++ b/sources/shiboken2/ApiExtractor/abstractmetalang_typedefs.h
@@ -39,13 +39,13 @@ class AbstractMetaEnumValue;
class AbstractMetaFunction;
class AbstractMetaType;
-typedef QVector<AbstractMetaArgument *> AbstractMetaArgumentList;
-typedef QVector<AbstractMetaClass *> AbstractMetaClassList;
-typedef QVector<AbstractMetaEnum *> AbstractMetaEnumList;
-typedef QVector<AbstractMetaEnumValue *> AbstractMetaEnumValueList;
-typedef QVector<AbstractMetaField *> AbstractMetaFieldList;
-typedef QVector<AbstractMetaFunction *> AbstractMetaFunctionList;
-typedef QVector<AbstractMetaType *> AbstractMetaTypeList;
-typedef QVector<const AbstractMetaType *> AbstractMetaTypeCList;
+using AbstractMetaArgumentList = QVector<AbstractMetaArgument *>;
+using AbstractMetaClassList = QVector<AbstractMetaClass *>;
+using AbstractMetaEnumList = QVector<AbstractMetaEnum *>;
+using AbstractMetaEnumValueList = QVector<AbstractMetaEnumValue *>;
+using AbstractMetaFieldList = QVector<AbstractMetaField *>;
+using AbstractMetaFunctionList = QVector<AbstractMetaFunction *>;
+using AbstractMetaTypeList = QVector<AbstractMetaType *>;
+using AbstractMetaTypeCList = QVector<const AbstractMetaType *>;
#endif // ABSTRACTMETALANG_TYPEDEFS_H
diff --git a/sources/shiboken2/ApiExtractor/apiextractor.cpp b/sources/shiboken2/ApiExtractor/apiextractor.cpp
index fbe7664e9..78fa9e313 100644
--- a/sources/shiboken2/ApiExtractor/apiextractor.cpp
+++ b/sources/shiboken2/ApiExtractor/apiextractor.cpp
@@ -43,7 +43,7 @@
#include "typedatabase.h"
#include "typesystem.h"
-ApiExtractor::ApiExtractor() : m_builder(0)
+ApiExtractor::ApiExtractor()
{
// Environment TYPESYSTEMPATH
QString envTypesystemPaths = QFile::decodeName(qgetenv("TYPESYSTEMPATH"));
@@ -116,7 +116,7 @@ void ApiExtractor::setSilent ( bool value )
bool ApiExtractor::setApiVersion(const QString& package, const QString &version)
{
- return TypeDatabase::instance()->setApiVersion(package, version);
+ return TypeDatabase::setApiVersion(package, version);
}
void ApiExtractor::setDropTypeEntries(QString dropEntries)
@@ -168,7 +168,7 @@ ContainerTypeEntryList ApiExtractor::containerTypes() const
static const AbstractMetaEnum* findEnumOnClasses(AbstractMetaClassList metaClasses, const EnumTypeEntry* typeEntry)
{
- const AbstractMetaEnum* result = 0;
+ const AbstractMetaEnum *result = nullptr;
for (const AbstractMetaClass* metaClass : qAsConst(metaClasses)) {
const AbstractMetaEnumList &enums = metaClass->enums();
for (const AbstractMetaEnum *metaEnum : enums) {
@@ -247,7 +247,7 @@ LanguageLevel ApiExtractor::languageLevel() const
return m_languageLevel;
}
-void ApiExtractor::setLanguageLevel(const LanguageLevel languageLevel)
+void ApiExtractor::setLanguageLevel(LanguageLevel languageLevel)
{
m_languageLevel = languageLevel;
}
@@ -256,13 +256,11 @@ void ApiExtractor::setLanguageLevel(const LanguageLevel languageLevel)
template <class Container>
static void debugFormatSequence(QDebug &d, const char *key, const Container& c)
{
- typedef typename Container::const_iterator ConstIt;
if (c.isEmpty())
return;
- const ConstIt begin = c.begin();
- const ConstIt end = c.end();
+ const auto begin = c.begin();
d << "\n " << key << '[' << c.size() << "]=(";
- for (ConstIt it = begin; it != end; ++it) {
+ for (auto it = begin, end = c.end(); it != end; ++it) {
if (it != begin)
d << ", ";
d << *it;
diff --git a/sources/shiboken2/ApiExtractor/apiextractor.h b/sources/shiboken2/ApiExtractor/apiextractor.h
index 3eb90e748..c8f50f2a5 100644
--- a/sources/shiboken2/ApiExtractor/apiextractor.h
+++ b/sources/shiboken2/ApiExtractor/apiextractor.h
@@ -58,6 +58,8 @@ QT_END_NAMESPACE
class ApiExtractor
{
public:
+ Q_DISABLE_COPY(ApiExtractor)
+
ApiExtractor();
~ApiExtractor();
@@ -78,7 +80,7 @@ public:
bool setApiVersion(const QString& package, const QString& version);
void setDropTypeEntries(QString dropEntries);
LanguageLevel languageLevel() const;
- void setLanguageLevel(const LanguageLevel languageLevel);
+ void setLanguageLevel(LanguageLevel languageLevel);
AbstractMetaEnumList globalEnums() const;
AbstractMetaFunctionList globalFunctions() const;
@@ -97,17 +99,15 @@ private:
QString m_typeSystemFileName;
QString m_cppFileName;
HeaderPaths m_includePaths;
- AbstractMetaBuilder* m_builder;
+ AbstractMetaBuilder* m_builder = nullptr;
QString m_logDirectory;
LanguageLevel m_languageLevel = LanguageLevel::Default;
bool m_skipDeprecated = false;
- // disable copy
- ApiExtractor(const ApiExtractor&);
- ApiExtractor& operator=(const ApiExtractor&);
#ifndef QT_NO_DEBUG_STREAM
friend QDebug operator<<(QDebug d, const ApiExtractor &ae);
#endif
};
#endif // APIEXTRACTOR_H
+
diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp
index 3ced0e06c..8d1b4debf 100644
--- a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp
+++ b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp
@@ -144,9 +144,9 @@ static bool isSigned(CXTypeKind kind)
class BuilderPrivate {
public:
- typedef QHash<CXCursor, ClassModelItem> CursorClassHash;
- typedef QHash<CXCursor, TypeDefModelItem> CursorTypedefHash;
- typedef QHash<CXType, TypeInfo> TypeInfoHash;
+ using CursorClassHash = QHash<CXCursor, ClassModelItem>;
+ using CursorTypedefHash = QHash<CXCursor, TypeDefModelItem>;
+ using TypeInfoHash = QHash<CXType, TypeInfo>;
explicit BuilderPrivate(BaseVisitor *bv) : m_baseVisitor(bv), m_model(new CodeModel)
{
@@ -645,11 +645,9 @@ static inline CXCursor definitionFromTypeRef(const CXCursor &typeRefCursor)
template <class Item> // ArgumentModelItem, VariableModelItem
void BuilderPrivate::qualifyTypeDef(const CXCursor &typeRefCursor, const QSharedPointer<Item> &item) const
{
- typedef typename CursorTypedefHash::const_iterator ConstIt;
-
TypeInfo type = item->type();
if (type.qualifiedName().size() == 1) { // item's type is unqualified.
- const ConstIt it = m_cursorTypedefHash.constFind(definitionFromTypeRef(typeRefCursor));
+ const auto it = m_cursorTypedefHash.constFind(definitionFromTypeRef(typeRefCursor));
if (it != m_cursorTypedefHash.constEnd() && !it.value()->scope().isEmpty()) {
type.setQualifiedName(it.value()->scope() + type.qualifiedName());
item->setType(type);
diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.h b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.h
index 2c4dd0e03..fa79acb2a 100644
--- a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.h
+++ b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.h
@@ -39,6 +39,8 @@ class BuilderPrivate;
class Builder : public BaseVisitor {
public:
+ Q_DISABLE_COPY(Builder)
+
Builder();
~Builder();
diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangparser.cpp b/sources/shiboken2/ApiExtractor/clangparser/clangparser.cpp
index e116f8b83..6303d09e5 100644
--- a/sources/shiboken2/ApiExtractor/clangparser/clangparser.cpp
+++ b/sources/shiboken2/ApiExtractor/clangparser/clangparser.cpp
@@ -119,7 +119,7 @@ QString BaseVisitor::getCodeSnippetString(const CXCursor &cursor)
static CXChildVisitResult
visitorCallback(CXCursor cursor, CXCursor /* parent */, CXClientData clientData)
{
- BaseVisitor *bv = reinterpret_cast<BaseVisitor *>(clientData);
+ auto *bv = reinterpret_cast<BaseVisitor *>(clientData);
const CXSourceLocation location = clang_getCursorLocation(cursor);
if (!bv->visitLocation(location))
diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangparser.h b/sources/shiboken2/ApiExtractor/clangparser/clangparser.h
index 36b9e0bd1..4248be853 100644
--- a/sources/shiboken2/ApiExtractor/clangparser/clangparser.h
+++ b/sources/shiboken2/ApiExtractor/clangparser/clangparser.h
@@ -43,12 +43,12 @@ struct Diagnostic;
class SourceFileCache {
public:
- typedef QPair<const char *, const char *> Snippet;
+ using Snippet = QPair<const char *, const char *>;
Snippet getCodeSnippet(const CXCursor &cursor);
private:
- typedef QHash<QString, QByteArray> FileBufferCache;
+ using FileBufferCache = QHash<QString, QByteArray>;
FileBufferCache m_fileBufferCache;
};
@@ -56,8 +56,8 @@ private:
class BaseVisitor {
Q_DISABLE_COPY(BaseVisitor)
public:
- typedef QVector<Diagnostic> Diagnostics;
- typedef SourceFileCache::Snippet CodeSnippet;
+ using Diagnostics = QVector<Diagnostic>;
+ using CodeSnippet = SourceFileCache::Snippet;
enum StartTokenResult { Error, Skip, Recurse };
diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangutils.h b/sources/shiboken2/ApiExtractor/clangparser/clangutils.h
index db2db6267..738b51bb4 100644
--- a/sources/shiboken2/ApiExtractor/clangparser/clangutils.h
+++ b/sources/shiboken2/ApiExtractor/clangparser/clangutils.h
@@ -73,7 +73,7 @@ struct SourceLocation
SourceLocation getExpansionLocation(const CXSourceLocation &location);
-typedef QPair<SourceLocation, SourceLocation> SourceRange;
+using SourceRange =QPair<SourceLocation, SourceLocation>;
SourceLocation getCursorLocation(const CXCursor &cursor);
CXString getFileNameFromLocation(const CXSourceLocation &location);
@@ -82,7 +82,7 @@ SourceRange getCursorRange(const CXCursor &cursor);
struct Diagnostic {
enum Source { Clang, Other };
- Diagnostic() : source(Clang) {}
+ Diagnostic() = default;
// Clang
static Diagnostic fromCXDiagnostic(CXDiagnostic cd);
// Other
@@ -91,8 +91,8 @@ struct Diagnostic {
QString message;
QStringList childMessages;
SourceLocation location;
- Source source;
- CXDiagnosticSeverity severity;
+ Source source = Clang;
+ CXDiagnosticSeverity severity = CXDiagnostic_Warning;
};
QVector<Diagnostic> getDiagnostics(CXTranslationUnit tu);
@@ -100,7 +100,7 @@ CXDiagnosticSeverity maxSeverity(const QVector<Diagnostic> &ds);
// Parse a template argument list "a<b<c,d>,e>" and invoke a handler
// with each match (level and string). Return begin and end of the list.
-typedef std::function<void(int /*level*/, const QStringRef &)> TemplateArgumentHandler;
+using TemplateArgumentHandler = std::function<void (int, const QStringRef &)>;
QPair<int, int> parseTemplateArgumentList(const QString &l,
const TemplateArgumentHandler &handler,
diff --git a/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp b/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp
index 3196c824e..f301733fe 100644
--- a/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp
+++ b/sources/shiboken2/ApiExtractor/clangparser/compilersupport.cpp
@@ -291,10 +291,11 @@ static QString findClangBuiltInIncludesDir()
#if defined(Q_CC_CLANG) || defined(Q_CC_GNU)
static QString compilerFromCMake(const QString &defaultCompiler)
{
-# ifdef CMAKE_CXX_COMPILER
+// Added !defined(Q_OS_DARWIN) due to PYSIDE-1032
+# if defined(CMAKE_CXX_COMPILER) && !defined(Q_OS_DARWIN)
Q_UNUSED(defaultCompiler)
return QString::fromLocal8Bit(CMAKE_CXX_COMPILER);
-#else
+# else
return defaultCompiler;
# endif
}
diff --git a/sources/shiboken2/ApiExtractor/dependency.h b/sources/shiboken2/ApiExtractor/dependency.h
index d563e9094..7168ea3bc 100644
--- a/sources/shiboken2/ApiExtractor/dependency.h
+++ b/sources/shiboken2/ApiExtractor/dependency.h
@@ -42,6 +42,6 @@ struct Dependency {
AbstractMetaClass *child;
};
-typedef QVector<Dependency> Dependencies;
+using Dependencies = QVector<Dependency>;
#endif // DEPENDENCY_H
diff --git a/sources/shiboken2/ApiExtractor/docparser.h b/sources/shiboken2/ApiExtractor/docparser.h
index 53507b0f5..1dccae4d6 100644
--- a/sources/shiboken2/ApiExtractor/docparser.h
+++ b/sources/shiboken2/ApiExtractor/docparser.h
@@ -43,6 +43,8 @@ class XQuery;
class DocParser
{
public:
+ Q_DISABLE_COPY(DocParser)
+
using XQueryPtr = QSharedPointer<XQuery>;
DocParser();
diff --git a/sources/shiboken2/ApiExtractor/doxygenparser.h b/sources/shiboken2/ApiExtractor/doxygenparser.h
index ed3a7bf0d..ada64ac18 100644
--- a/sources/shiboken2/ApiExtractor/doxygenparser.h
+++ b/sources/shiboken2/ApiExtractor/doxygenparser.h
@@ -34,7 +34,7 @@
class DoxygenParser : public DocParser
{
public:
- DoxygenParser() {}
+ DoxygenParser() = default;
void fillDocumentation(AbstractMetaClass *metaClass) override;
Documentation retrieveModuleDocumentation() override;
Documentation retrieveModuleDocumentation(const QString& name) override;
diff --git a/sources/shiboken2/ApiExtractor/fileout.h b/sources/shiboken2/ApiExtractor/fileout.h
index aace70131..b1011c4d6 100644
--- a/sources/shiboken2/ApiExtractor/fileout.h
+++ b/sources/shiboken2/ApiExtractor/fileout.h
@@ -41,6 +41,8 @@ private:
QString name;
public:
+ Q_DISABLE_COPY(FileOut)
+
enum State { Failure, Unchanged, Success };
explicit FileOut(QString name);
diff --git a/sources/shiboken2/ApiExtractor/graph.cpp b/sources/shiboken2/ApiExtractor/graph.cpp
index c2ac81e6c..95a80197e 100644
--- a/sources/shiboken2/ApiExtractor/graph.cpp
+++ b/sources/shiboken2/ApiExtractor/graph.cpp
@@ -38,8 +38,7 @@
struct Graph::GraphPrivate
{
enum Color { WHITE, GRAY, BLACK };
- typedef QVector<QSet<int> > Edges;
- typedef QSet<int>::const_iterator EdgeIterator;
+ using Edges = QVector<QSet<int> >;
Edges edges;
@@ -50,11 +49,10 @@ struct Graph::GraphPrivate
void dfsVisit(int node, Graph::Indexes &result, QVector<Color> &colors) const
{
colors[node] = GRAY;
- EdgeIterator it = edges[node].begin();
- for (; it != edges[node].end(); ++it) {
- if (colors[*it] == WHITE)
- dfsVisit(*it, result, colors);
- else if (colors[*it] == GRAY) // This is not a DAG!
+ for (const auto &c : edges.at(node)) {
+ if (colors[c] == WHITE)
+ dfsVisit(c, result, colors);
+ else if (colors[c] == GRAY) // This is not a DAG!
return;
}
colors[node] = BLACK;
diff --git a/sources/shiboken2/ApiExtractor/graph.h b/sources/shiboken2/ApiExtractor/graph.h
index 043a182b5..5dc8e21ea 100644
--- a/sources/shiboken2/ApiExtractor/graph.h
+++ b/sources/shiboken2/ApiExtractor/graph.h
@@ -37,6 +37,8 @@
class Graph
{
public:
+ Q_DISABLE_COPY(Graph)
+
using Indexes = QVector<int>;
/// Create a new graph with \p numNodes nodes.
diff --git a/sources/shiboken2/ApiExtractor/header_paths.h b/sources/shiboken2/ApiExtractor/header_paths.h
index 01d830921..0c25702ef 100644
--- a/sources/shiboken2/ApiExtractor/header_paths.h
+++ b/sources/shiboken2/ApiExtractor/header_paths.h
@@ -67,6 +67,6 @@ public:
}
};
-typedef QList<HeaderPath> HeaderPaths;
+using HeaderPaths = QList<HeaderPath>;
#endif // HEADER_PATHS_H
diff --git a/sources/shiboken2/ApiExtractor/include.h b/sources/shiboken2/ApiExtractor/include.h
index 4890eea2c..f7dfea5a7 100644
--- a/sources/shiboken2/ApiExtractor/include.h
+++ b/sources/shiboken2/ApiExtractor/include.h
@@ -46,7 +46,7 @@ public:
InvalidInclude
};
- Include() : m_type(IncludePath) {}
+ Include() = default;
Include(IncludeType t, const QString &nam) : m_type(t), m_name(nam) {};
bool isValid() const
@@ -78,7 +78,7 @@ public:
friend uint qHash(const Include&);
private:
- IncludeType m_type;
+ IncludeType m_type = IncludePath;
QString m_name;
};
@@ -88,6 +88,6 @@ QTextStream& operator<<(QTextStream& out, const Include& include);
QDebug operator<<(QDebug d, const Include &i);
#endif
-typedef QVector<Include> IncludeList;
+using IncludeList = QVector<Include>;
#endif
diff --git a/sources/shiboken2/ApiExtractor/merge.xsl b/sources/shiboken2/ApiExtractor/merge.xsl
index d0b7eafa5..c6cab5a42 100644
--- a/sources/shiboken2/ApiExtractor/merge.xsl
+++ b/sources/shiboken2/ApiExtractor/merge.xsl
@@ -2,11 +2,11 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml" indent="yes"/>
- <xsl:param name="lang" />
- <xsl:param name="source" />
+ <xsl:param name="lang" />
+ <xsl:param name="source" />
<xsl:template match="processing-instruction()" />
-
+
<xsl:template match="/typesystem">
<xsl:copy>
<xsl:for-each select="@*">
@@ -20,8 +20,8 @@
<xsl:value-of select="." />
</xsl:copy>
</xsl:for-each>
-
- <xsl:variable name="other" select="document($source)/typesystem/*[not(self::object-type | self::value-type | self::interface-type | self::namespace-type)]" />
+
+ <xsl:variable name="other" select="document($source)/typesystem/*[not(self::object-type | self::value-type | self::interface-type | self::namespace-type)]" />
<xsl:if test="$other">
<xsl:choose>
<xsl:when test="$lang != ''">
@@ -37,7 +37,7 @@
</xsl:if>
<xsl:apply-templates select="node()" />
-
+
</xsl:copy>
</xsl:template>
@@ -53,14 +53,14 @@
</xsl:for-each>
<xsl:apply-templates select="node()" />
-
+
<xsl:variable name="other" select="document($source)/typesystem/*[name() = $name][@name = current()/@name]" />
<xsl:if test="$other">
<xsl:choose>
<xsl:when test="$lang != ''">
<xsl:element name="language">
<xsl:attribute name="name" ><xsl:value-of select="$lang" /></xsl:attribute>
- <xsl:copy-of select="$other/node()" />
+ <xsl:copy-of select="$other/node()" />
</xsl:element>
</xsl:when>
<xsl:otherwise>
diff --git a/sources/shiboken2/ApiExtractor/parser/codemodel.cpp b/sources/shiboken2/ApiExtractor/parser/codemodel.cpp
index 7bb7e0a83..099ab8860 100644
--- a/sources/shiboken2/ApiExtractor/parser/codemodel.cpp
+++ b/sources/shiboken2/ApiExtractor/parser/codemodel.cpp
@@ -53,9 +53,8 @@ private:
template <class T>
static QSharedPointer<T> findModelItem(const QVector<QSharedPointer<T> > &list, const QString &name)
{
- typedef typename QVector<QSharedPointer<T> >::const_iterator It;
- const It it = std::find_if(list.begin(), list.end(), ModelItemNamePredicate<T>(name));
- return it != list.end() ? *it : QSharedPointer<T>();
+ const auto it = std::find_if(list.cbegin(), list.cend(), ModelItemNamePredicate<T>(name));
+ return it != list.cend() ? *it : QSharedPointer<T>();
}
// ---------------------------------------------------------------------------
@@ -64,16 +63,14 @@ CodeModel::CodeModel() : m_globalNamespace(new _NamespaceModelItem(this))
{
}
-CodeModel::~CodeModel()
-{
-}
+CodeModel::~CodeModel() = default;
NamespaceModelItem CodeModel::globalNamespace() const
{
return m_globalNamespace;
}
-void CodeModel::addFile(FileModelItem item)
+void CodeModel::addFile(const FileModelItem &item)
{
m_files.append(item);
}
@@ -161,7 +158,7 @@ bool TypeInfo::isVoid() const
TypeInfo TypeInfo::resolveType(TypeInfo const &__type, const ScopeModelItem &__scope)
{
CodeModel *__model = __scope->model();
- Q_ASSERT(__model != 0);
+ Q_ASSERT(__model != nullptr);
return TypeInfo::resolveType(__model->findItem(__type.qualifiedName(), __scope), __type, __scope);
}
@@ -724,7 +721,7 @@ static void formatModelItemList(QDebug &d, const char *prefix, const List &l,
void _ClassModelItem::formatDebug(QDebug &d) const
{
- _CodeModelItem::formatDebug(d);
+ _ScopeModelItem::formatDebug(d);
if (!m_baseClasses.isEmpty()) {
if (m_final)
d << " [final]";
@@ -742,7 +739,7 @@ void _ClassModelItem::formatDebug(QDebug &d) const
#endif // !QT_NO_DEBUG_STREAM
// ---------------------------------------------------------------------------
-FunctionModelItem _ScopeModelItem::declaredFunction(FunctionModelItem item)
+FunctionModelItem _ScopeModelItem::declaredFunction(const FunctionModelItem &item)
{
for (const FunctionModelItem &fun : qAsConst(m_functions)) {
if (fun->name() == item->name() && fun->isSimilar(item))
@@ -759,27 +756,27 @@ void _ScopeModelItem::addEnumsDeclaration(const QString &enumsDeclaration)
m_enumsDeclarations << enumsDeclaration;
}
-void _ScopeModelItem::addClass(ClassModelItem item)
+void _ScopeModelItem::addClass(const ClassModelItem &item)
{
m_classes.append(item);
}
-void _ScopeModelItem::addFunction(FunctionModelItem item)
+void _ScopeModelItem::addFunction(const FunctionModelItem &item)
{
m_functions.append(item);
}
-void _ScopeModelItem::addVariable(VariableModelItem item)
+void _ScopeModelItem::addVariable(const VariableModelItem &item)
{
m_variables.append(item);
}
-void _ScopeModelItem::addTypeDef(TypeDefModelItem item)
+void _ScopeModelItem::addTypeDef(const TypeDefModelItem &item)
{
m_typeDefs.append(item);
}
-void _ScopeModelItem::addEnum(EnumModelItem item)
+void _ScopeModelItem::addEnum(const EnumModelItem &item)
{
m_enums.append(item);
}
@@ -800,12 +797,10 @@ static void formatScopeHash(QDebug &d, const char *prefix, const Hash &h,
const char *separator = ", ",
bool trailingNewLine = false)
{
- typedef typename Hash::ConstIterator HashIterator;
if (!h.isEmpty()) {
d << prefix << '[' << h.size() << "](";
- const HashIterator begin = h.begin();
- const HashIterator end = h.end();
- for (HashIterator it = begin; it != end; ++it) { // Omit the names as they are repeated
+ const auto begin = h.cbegin();
+ for (auto it = begin, end = h.cend(); it != end; ++it) { // Omit the names as they are repeated
if (it != begin)
d << separator;
d << it.value().data();
@@ -916,9 +911,7 @@ NamespaceModelItem _NamespaceModelItem::findNamespace(const QString &name) const
return findModelItem(m_namespaces, name);
}
-_FileModelItem::~_FileModelItem()
-{
-}
+_FileModelItem::~_FileModelItem() = default;
void _NamespaceModelItem::appendNamespace(const _NamespaceModelItem &other)
{
@@ -1188,9 +1181,7 @@ CodeModel::AccessPolicy _EnumModelItem::accessPolicy() const
return m_accessPolicy;
}
-_EnumModelItem::~_EnumModelItem()
-{
-}
+_EnumModelItem::~_EnumModelItem() = default;
void _EnumModelItem::setAccessPolicy(CodeModel::AccessPolicy accessPolicy)
{
@@ -1202,7 +1193,7 @@ EnumeratorList _EnumModelItem::enumerators() const
return m_enumerators;
}
-void _EnumModelItem::addEnumerator(EnumeratorModelItem item)
+void _EnumModelItem::addEnumerator(const EnumeratorModelItem &item)
{
m_enumerators.append(item);
}
diff --git a/sources/shiboken2/ApiExtractor/parser/codemodel.h b/sources/shiboken2/ApiExtractor/parser/codemodel.h
index 6f3c17613..777b2d103 100644
--- a/sources/shiboken2/ApiExtractor/parser/codemodel.h
+++ b/sources/shiboken2/ApiExtractor/parser/codemodel.h
@@ -50,6 +50,8 @@ QT_FORWARD_DECLARE_CLASS(QDebug)
class CodeModel
{
public:
+ Q_DISABLE_COPY(CodeModel)
+
enum AccessPolicy {
Public,
Protected,
@@ -79,7 +81,7 @@ public:
FileList files() const { return m_files; }
NamespaceModelItem globalNamespace() const;
- void addFile(FileModelItem item);
+ void addFile(const FileModelItem &item);
FileModelItem findFile(const QString &name) const;
CodeModelItem findItem(const QStringList &qualifiedName, const ScopeModelItem &scope) const;
@@ -87,10 +89,6 @@ public:
private:
FileList m_files;
NamespaceModelItem m_globalNamespace;
-
-private:
- CodeModel(const CodeModel &other);
- void operator = (const CodeModel &other);
};
#ifndef QT_NO_DEBUG_STREAM
@@ -101,7 +99,7 @@ class TypeInfo
{
friend class TypeParser;
public:
- typedef QVector<Indirection> Indirections;
+ using Indirections = QVector<Indirection>;
TypeInfo() : flags(0), m_referenceType(NoReference) {}
@@ -334,11 +332,11 @@ public:
TypeDefList typeDefs() const { return m_typeDefs; }
VariableList variables() const { return m_variables; }
- void addClass(ClassModelItem item);
- void addEnum(EnumModelItem item);
- void addFunction(FunctionModelItem item);
- void addTypeDef(TypeDefModelItem item);
- void addVariable(VariableModelItem item);
+ void addClass(const ClassModelItem &item);
+ void addEnum(const EnumModelItem &item);
+ void addFunction(const FunctionModelItem &item);
+ void addTypeDef(const TypeDefModelItem &item);
+ void addVariable(const VariableModelItem &item);
ClassModelItem findClass(const QString &name) const;
EnumModelItem findEnum(const QString &name) const;
@@ -349,7 +347,7 @@ public:
void addEnumsDeclaration(const QString &enumsDeclaration);
QStringList enumsDeclarations() const { return m_enumsDeclarations; }
- FunctionModelItem declaredFunction(FunctionModelItem item);
+ FunctionModelItem declaredFunction(const FunctionModelItem &item);
#ifndef QT_NO_DEBUG_STREAM
void formatDebug(QDebug &d) const override;
@@ -692,7 +690,7 @@ public:
bool hasValues() const { return !m_enumerators.isEmpty(); }
EnumeratorList enumerators() const;
- void addEnumerator(EnumeratorModelItem item);
+ void addEnumerator(const EnumeratorModelItem &item);
EnumKind enumKind() const { return m_enumKind; }
void setEnumKind(EnumKind kind) { m_enumKind = kind; }
diff --git a/sources/shiboken2/ApiExtractor/parser/codemodel_fwd.h b/sources/shiboken2/ApiExtractor/parser/codemodel_fwd.h
index f67c64221..54dbe78dc 100644
--- a/sources/shiboken2/ApiExtractor/parser/codemodel_fwd.h
+++ b/sources/shiboken2/ApiExtractor/parser/codemodel_fwd.h
@@ -51,32 +51,32 @@ class _VariableModelItem;
class _MemberModelItem;
class TypeInfo;
-typedef QSharedPointer<_ArgumentModelItem> ArgumentModelItem;
-typedef QSharedPointer<_ClassModelItem> ClassModelItem;
-typedef QSharedPointer<_CodeModelItem> CodeModelItem;
-typedef QSharedPointer<_EnumModelItem> EnumModelItem;
-typedef QSharedPointer<_EnumeratorModelItem> EnumeratorModelItem;
-typedef QSharedPointer<_FileModelItem> FileModelItem;
-typedef QSharedPointer<_FunctionModelItem> FunctionModelItem;
-typedef QSharedPointer<_NamespaceModelItem> NamespaceModelItem;
-typedef QSharedPointer<_ScopeModelItem> ScopeModelItem;
-typedef QSharedPointer<_TemplateParameterModelItem> TemplateParameterModelItem;
-typedef QSharedPointer<_TypeDefModelItem> TypeDefModelItem;
-typedef QSharedPointer<_VariableModelItem> VariableModelItem;
-typedef QSharedPointer<_MemberModelItem> MemberModelItem;
+using ArgumentModelItem = QSharedPointer<_ArgumentModelItem>;
+using ClassModelItem = QSharedPointer<_ClassModelItem>;
+using CodeModelItem = QSharedPointer<_CodeModelItem>;
+using EnumModelItem = QSharedPointer<_EnumModelItem>;
+using EnumeratorModelItem = QSharedPointer<_EnumeratorModelItem>;
+using FileModelItem = QSharedPointer<_FileModelItem>;
+using FunctionModelItem = QSharedPointer<_FunctionModelItem>;
+using NamespaceModelItem = QSharedPointer<_NamespaceModelItem>;
+using ScopeModelItem = QSharedPointer<_ScopeModelItem>;
+using TemplateParameterModelItem = QSharedPointer<_TemplateParameterModelItem>;
+using TypeDefModelItem = QSharedPointer<_TypeDefModelItem>;
+using VariableModelItem = QSharedPointer<_VariableModelItem>;
+using MemberModelItem = QSharedPointer<_MemberModelItem>;
-typedef QVector<ArgumentModelItem> ArgumentList;
-typedef QVector<ClassModelItem> ClassList;
-typedef QVector<CodeModelItem> ItemList;
-typedef QVector<EnumModelItem> EnumList;
-typedef QVector<EnumeratorModelItem> EnumeratorList;
-typedef QVector<FileModelItem> FileList;
-typedef QVector<FunctionModelItem> FunctionList;
-typedef QVector<NamespaceModelItem> NamespaceList;
-typedef QVector<ScopeModelItem> ScopeList;
-typedef QVector<TemplateParameterModelItem> TemplateParameterList;
-typedef QVector<TypeDefModelItem> TypeDefList;
-typedef QVector<VariableModelItem> VariableList;
-typedef QVector<MemberModelItem> MemberList;
+using ArgumentList = QVector<ArgumentModelItem>;
+using ClassList = QVector<ClassModelItem>;
+using ItemList = QVector<CodeModelItem>;
+using EnumList = QVector<EnumModelItem>;
+using EnumeratorList = QVector<EnumeratorModelItem>;
+using FileList = QVector<FileModelItem>;
+using FunctionList = QVector<FunctionModelItem>;
+using NamespaceList = QVector<NamespaceModelItem>;
+using ScopeList = QVector<ScopeModelItem>;
+using TemplateParameterList = QVector<TemplateParameterModelItem>;
+using TypeDefList = QVector<TypeDefModelItem>;
+using VariableList = QVector<VariableModelItem>;
+using MemberList = QVector<MemberModelItem>;
#endif // CODEMODEL_FWD_H
diff --git a/sources/shiboken2/ApiExtractor/qtdocparser.cpp b/sources/shiboken2/ApiExtractor/qtdocparser.cpp
index c5ee1743d..2e50470e4 100644
--- a/sources/shiboken2/ApiExtractor/qtdocparser.cpp
+++ b/sources/shiboken2/ApiExtractor/qtdocparser.cpp
@@ -54,7 +54,7 @@ static void formatFunctionArgTypeQuery(QTextStream &str, const AbstractMetaArgum
case AbstractMetaType::FlagsPattern: {
// Modify qualified name "QFlags<Qt::AlignmentFlag>" with name "Alignment"
// to "Qt::Alignment" as seen by qdoc.
- const FlagsTypeEntry *flagsEntry = static_cast<const FlagsTypeEntry *>(metaType->typeEntry());
+ const auto *flagsEntry = static_cast<const FlagsTypeEntry *>(metaType->typeEntry());
QString name = flagsEntry->qualifiedCppName();
if (name.endsWith(QLatin1Char('>')) && name.startsWith(QLatin1String("QFlags<"))) {
const int lastColon = name.lastIndexOf(QLatin1Char(':'));
@@ -212,7 +212,7 @@ void QtDocParser::fillDocumentation(AbstractMetaClass* metaClass)
const AbstractMetaClass* context = metaClass->enclosingClass();
while(context) {
- if (context->enclosingClass() == 0)
+ if (context->enclosingClass() == nullptr)
break;
context = context->enclosingClass();
}
diff --git a/sources/shiboken2/ApiExtractor/qtdocparser.h b/sources/shiboken2/ApiExtractor/qtdocparser.h
index c4333e820..b01139de6 100644
--- a/sources/shiboken2/ApiExtractor/qtdocparser.h
+++ b/sources/shiboken2/ApiExtractor/qtdocparser.h
@@ -34,7 +34,7 @@
class QtDocParser : public DocParser
{
public:
- QtDocParser() {}
+ QtDocParser() = default;
void fillDocumentation(AbstractMetaClass* metaClass) override;
Documentation retrieveModuleDocumentation() override;
Documentation retrieveModuleDocumentation(const QString& name) override;
diff --git a/sources/shiboken2/ApiExtractor/tests/testabstractmetaclass.cpp b/sources/shiboken2/ApiExtractor/tests/testabstractmetaclass.cpp
index 8a6b59285..98b493c67 100644
--- a/sources/shiboken2/ApiExtractor/tests/testabstractmetaclass.cpp
+++ b/sources/shiboken2/ApiExtractor/tests/testabstractmetaclass.cpp
@@ -134,7 +134,7 @@ public:
const AbstractMetaClass *f = AbstractMetaClass::findClass(classes, QLatin1String("F"));
QVERIFY(f);
- AbstractMetaClass* no_class = 0;
+ AbstractMetaClass* no_class = nullptr;
QCOMPARE(a->baseClass(), no_class);
QCOMPARE(b->baseClass(), a);
diff --git a/sources/shiboken2/ApiExtractor/tests/testconversionoperator.cpp b/sources/shiboken2/ApiExtractor/tests/testconversionoperator.cpp
index 67865d3aa..142c783a4 100644
--- a/sources/shiboken2/ApiExtractor/tests/testconversionoperator.cpp
+++ b/sources/shiboken2/ApiExtractor/tests/testconversionoperator.cpp
@@ -64,7 +64,7 @@ void TestConversionOperator::testConversionOperator()
QCOMPARE(classC->functions().count(), 3);
QCOMPARE(classA->externalConversionOperators().count(), 2);
- AbstractMetaFunction* convOp = 0;
+ AbstractMetaFunction *convOp = nullptr;
for (AbstractMetaFunction *func : classB->functions()) {
if (func->isConversionOperator()) {
convOp = func;
diff --git a/sources/shiboken2/ApiExtractor/tests/testconversionruletag.cpp b/sources/shiboken2/ApiExtractor/tests/testconversionruletag.cpp
index 8c662d76b..aa2bec5d6 100644
--- a/sources/shiboken2/ApiExtractor/tests/testconversionruletag.cpp
+++ b/sources/shiboken2/ApiExtractor/tests/testconversionruletag.cpp
@@ -119,7 +119,7 @@ void TestConversionRuleTag::testConversionRuleTagReplace()
QVERIFY(toNative);
QCOMPARE(toNative->sourceTypeName(), QLatin1String("TargetNone"));
QVERIFY(toNative->isCustomType());
- QCOMPARE(toNative->sourceType(), (const TypeEntry*)0);
+ QCOMPARE(toNative->sourceType(), nullptr);
QCOMPARE(toNative->sourceTypeCheck(), QLatin1String("%IN == Target_None"));
QCOMPARE(toNative->conversion().simplified(),
QLatin1String("DoThat(); DoSomething(); %OUT = A();"));
@@ -138,7 +138,7 @@ void TestConversionRuleTag::testConversionRuleTagReplace()
QVERIFY(toNative);
QCOMPARE(toNative->sourceTypeName(), QLatin1String("String"));
QVERIFY(toNative->isCustomType());
- QCOMPARE(toNative->sourceType(), (const TypeEntry*)0);
+ QCOMPARE(toNative->sourceType(), nullptr);
QCOMPARE(toNative->sourceTypeCheck(), QLatin1String("String_Check(%IN)"));
QCOMPARE(toNative->conversion().trimmed(), QLatin1String("%OUT = new A(String_AsString(%IN), String_GetSize(%IN));"));
}
@@ -183,7 +183,7 @@ if (!TargetDateTimeAPI) TargetDateTime_IMPORT;\n\
QVERIFY(toNative);
QCOMPARE(toNative->sourceTypeName(), QLatin1String("TargetDate"));
QVERIFY(toNative->isCustomType());
- QCOMPARE(toNative->sourceType(), (const TypeEntry*)0);
+ QCOMPARE(toNative->sourceType(), nullptr);
QCOMPARE(toNative->sourceTypeCheck(), QLatin1String("TargetDate_Check(%IN)"));
QCOMPARE(toNative->conversion().trimmed(),
QLatin1String("if (!TargetDateTimeAPI) TargetDateTime_IMPORT;\n%OUT = new Date(TargetDate_Day(%IN), TargetDate_Month(%IN), TargetDate_Year(%IN));"));
diff --git a/sources/shiboken2/ApiExtractor/tests/testimplicitconversions.cpp b/sources/shiboken2/ApiExtractor/tests/testimplicitconversions.cpp
index 7b3616daa..26fb148d5 100644
--- a/sources/shiboken2/ApiExtractor/tests/testimplicitconversions.cpp
+++ b/sources/shiboken2/ApiExtractor/tests/testimplicitconversions.cpp
@@ -151,7 +151,7 @@ void TestImplicitConversions::testWithExternalConversionOperator()
AbstractMetaFunctionList externalConvOps = classA->externalConversionOperators();
QCOMPARE(externalConvOps.count(), 1);
- const AbstractMetaFunction* convOp = 0;
+ const AbstractMetaFunction *convOp = nullptr;
for (const AbstractMetaFunction *func : classB->functions()) {
if (func->isConversionOperator())
convOp = func;
diff --git a/sources/shiboken2/ApiExtractor/tests/testreverseoperators.cpp b/sources/shiboken2/ApiExtractor/tests/testreverseoperators.cpp
index 2ea95595e..dc4801e18 100644
--- a/sources/shiboken2/ApiExtractor/tests/testreverseoperators.cpp
+++ b/sources/shiboken2/ApiExtractor/tests/testreverseoperators.cpp
@@ -51,7 +51,7 @@ void TestReverseOperators::testReverseSum()
QVERIFY(classA);
QCOMPARE(classA->functions().count(), 4);
- const AbstractMetaFunction* reverseOp = 0;
+ const AbstractMetaFunction* reverseOp = nullptr;
const AbstractMetaFunction* normalOp = 0;
for (const AbstractMetaFunction *func : classA->functions()) {
if (func->name() == QLatin1String("operator+")) {
@@ -100,8 +100,8 @@ void TestReverseOperators::testReverseSumWithAmbiguity()
QVERIFY(classB);
QCOMPARE(classB->functions().count(), 4);
- const AbstractMetaFunction* reverseOp = 0;
- const AbstractMetaFunction* normalOp = 0;
+ const AbstractMetaFunction *reverseOp = nullptr;
+ const AbstractMetaFunction *normalOp = nullptr;
for (const AbstractMetaFunction *func : classB->functions()) {
if (func->name() == QLatin1String("operator+")) {
if (func->isReverseOperator())
diff --git a/sources/shiboken2/ApiExtractor/tests/testutil.h b/sources/shiboken2/ApiExtractor/tests/testutil.h
index c6ad19d7e..9a2faad5c 100644
--- a/sources/shiboken2/ApiExtractor/tests/testutil.h
+++ b/sources/shiboken2/ApiExtractor/tests/testutil.h
@@ -47,7 +47,7 @@ namespace TestUtil
TypeDatabase* td = TypeDatabase::instance(true);
if (apiVersion.isEmpty())
TypeDatabase::clearApiVersions();
- else if (!td->setApiVersion(QLatin1String("*"), apiVersion))
+ else if (!TypeDatabase::setApiVersion(QLatin1String("*"), apiVersion))
return nullptr;
td->setDropTypeEntries(dropTypeEntries);
QBuffer buffer;
@@ -69,7 +69,7 @@ namespace TestUtil
arguments.append(QFile::encodeName(tempSource.fileName()));
tempSource.write(cppCode, qint64(strlen(cppCode)));
tempSource.close();
- AbstractMetaBuilder *builder = new AbstractMetaBuilder;
+ auto *builder = new AbstractMetaBuilder;
if (!builder->build(arguments)) {
delete builder;
return Q_NULLPTR;
diff --git a/sources/shiboken2/ApiExtractor/typedatabase.cpp b/sources/shiboken2/ApiExtractor/typedatabase.cpp
index 930f85d30..144795c6a 100644
--- a/sources/shiboken2/ApiExtractor/typedatabase.cpp
+++ b/sources/shiboken2/ApiExtractor/typedatabase.cpp
@@ -51,27 +51,24 @@ static QString wildcardToRegExp(QString w)
return w;
}
-typedef QPair<QRegularExpression, QVersionNumber> ApiVersion;
-typedef QVector<ApiVersion> ApiVersions;
+using ApiVersion =QPair<QRegularExpression, QVersionNumber>;
+using ApiVersions = QVector<ApiVersion>;
Q_GLOBAL_STATIC(ApiVersions, apiVersions)
-TypeDatabase::TypeDatabase() : m_suppressWarnings(true)
+TypeDatabase::TypeDatabase()
{
addType(new VoidTypeEntry());
addType(new VarargsTypeEntry());
}
-TypeDatabase::~TypeDatabase()
-{
-}
+TypeDatabase::~TypeDatabase() = default;
TypeDatabase* TypeDatabase::instance(bool newInstance)
{
- static TypeDatabase* db = 0;
+ static TypeDatabase *db = nullptr;
if (!db || newInstance) {
- if (db)
- delete db;
+ delete db;
db = new TypeDatabase;
}
return db;
@@ -85,7 +82,7 @@ struct IntTypeNormalizationEntry
QString replacement;
};
-typedef QVector<IntTypeNormalizationEntry> IntTypeNormalizationEntries;
+using IntTypeNormalizationEntries = QVector<IntTypeNormalizationEntry>;
static const IntTypeNormalizationEntries &intTypeNormalizationEntries()
{
@@ -93,10 +90,8 @@ static const IntTypeNormalizationEntries &intTypeNormalizationEntries()
static bool firstTime = true;
if (firstTime) {
firstTime = false;
- static const char *intTypes[] = {"char", "short", "int", "long"};
- const size_t size = sizeof(intTypes) / sizeof(intTypes[0]);
- for (size_t i = 0; i < size; ++i) {
- const QString intType = QLatin1String(intTypes[i]);
+ for (auto t : {"char", "short", "int", "long"}) {
+ const QString intType = QLatin1String(t);
if (!TypeDatabase::instance()->findType(QLatin1Char('u') + intType)) {
IntTypeNormalizationEntry entry;
entry.replacement = QStringLiteral("unsigned ") + intType;
@@ -115,8 +110,8 @@ QString TypeDatabase::normalizedSignature(const QString &signature)
if (instance() && signature.contains(QLatin1String("unsigned"))) {
const IntTypeNormalizationEntries &entries = intTypeNormalizationEntries();
- for (int i = 0, size = entries.size(); i < size; ++i)
- normalized.replace(entries.at(i).regex, entries.at(i).replacement);
+ for (const auto &entry : entries)
+ normalized.replace(entry.regex, entry.replacement);
}
return normalized;
@@ -146,10 +141,7 @@ void TypeDatabase::addTypesystemPath(const QString& typesystem_paths)
IncludeList TypeDatabase::extraIncludes(const QString& className) const
{
ComplexTypeEntry* typeEntry = findComplexType(className);
- if (typeEntry)
- return typeEntry->extraIncludes();
- else
- return IncludeList();
+ return typeEntry ? typeEntry->extraIncludes() : IncludeList();
}
ContainerTypeEntry* TypeDatabase::findContainerType(const QString &name) const
@@ -163,7 +155,7 @@ ContainerTypeEntry* TypeDatabase::findContainerType(const QString &name) const
TypeEntry* type_entry = findType(template_name);
if (type_entry && type_entry->isContainer())
return static_cast<ContainerTypeEntry*>(type_entry);
- return 0;
+ return nullptr;
}
static bool inline useType(const TypeEntry *t)
@@ -179,7 +171,7 @@ FunctionTypeEntry* TypeDatabase::findFunctionType(const QString& name) const
if (entry->type() == TypeEntry::FunctionType && useType(entry))
return static_cast<FunctionTypeEntry*>(entry);
}
- return 0;
+ return nullptr;
}
void TypeDatabase::addTypeSystemType(const TypeSystemTypeEntry *e)
@@ -351,7 +343,7 @@ TypeEntry *TypeDatabase::resolveTypeDefEntry(TypedefEntry *typedefEntry,
return nullptr;
}
- ComplexTypeEntry *result = static_cast<ComplexTypeEntry *>(source->clone());
+ auto *result = static_cast<ComplexTypeEntry *>(source->clone());
result->useAsTypedef(typedefEntry);
typedefEntry->setSource(source);
typedefEntry->setTarget(result);
@@ -592,13 +584,13 @@ PrimitiveTypeEntry *TypeDatabase::findPrimitiveType(const QString& name) const
const auto entries = findTypes(name);
for (TypeEntry *entry : entries) {
if (entry->isPrimitive()) {
- PrimitiveTypeEntry *pe = static_cast<PrimitiveTypeEntry *>(entry);
+ auto *pe = static_cast<PrimitiveTypeEntry *>(entry);
if (pe->preferredTargetLangType())
return pe;
}
}
- return 0;
+ return nullptr;
}
ComplexTypeEntry* TypeDatabase::findComplexType(const QString& name) const
@@ -608,7 +600,7 @@ ComplexTypeEntry* TypeDatabase::findComplexType(const QString& name) const
if (entry->isComplex() && useType(entry))
return static_cast<ComplexTypeEntry*>(entry);
}
- return 0;
+ return nullptr;
}
ObjectTypeEntry* TypeDatabase::findObjectType(const QString& name) const
@@ -618,7 +610,7 @@ ObjectTypeEntry* TypeDatabase::findObjectType(const QString& name) const
if (entry && entry->isObject() && useType(entry))
return static_cast<ObjectTypeEntry*>(entry);
}
- return 0;
+ return nullptr;
}
NamespaceTypeEntryList TypeDatabase::findNamespaceTypes(const QString& name) const
diff --git a/sources/shiboken2/ApiExtractor/typedatabase.h b/sources/shiboken2/ApiExtractor/typedatabase.h
index 7f1b2a3fc..334e88a14 100644
--- a/sources/shiboken2/ApiExtractor/typedatabase.h
+++ b/sources/shiboken2/ApiExtractor/typedatabase.h
@@ -72,30 +72,30 @@ public:
* \param newInstance This parameter is useful just for unit testing, because singletons causes
* too many side effects on unit testing.
*/
- static TypeDatabase* instance(bool newInstance = false);
+ static TypeDatabase *instance(bool newInstance = false);
static QString normalizedSignature(const QString &signature);
QStringList requiredTargetImports() const;
- void addRequiredTargetImport(const QString& moduleName);
+ void addRequiredTargetImport(const QString &moduleName);
- void addTypesystemPath(const QString& typesystem_paths);
+ void addTypesystemPath(const QString &typesystem_paths);
- IncludeList extraIncludes(const QString& className) const;
+ IncludeList extraIncludes(const QString &className) const;
- PrimitiveTypeEntry* findPrimitiveType(const QString& name) const;
- ComplexTypeEntry* findComplexType(const QString& name) const;
- ObjectTypeEntry* findObjectType(const QString& name) const;
- NamespaceTypeEntryList findNamespaceTypes(const QString& name) const;
- NamespaceTypeEntry *findNamespaceType(const QString& name, const QString &fileName = QString()) const;
- ContainerTypeEntry* findContainerType(const QString& name) const;
- FunctionTypeEntry* findFunctionType(const QString& name) const;
+ PrimitiveTypeEntry *findPrimitiveType(const QString &name) const;
+ ComplexTypeEntry *findComplexType(const QString &name) const;
+ ObjectTypeEntry *findObjectType(const QString &name) const;
+ NamespaceTypeEntryList findNamespaceTypes(const QString &name) const;
+ NamespaceTypeEntry *findNamespaceType(const QString &name, const QString &fileName = QString()) const;
+ ContainerTypeEntry *findContainerType(const QString &name) const;
+ FunctionTypeEntry *findFunctionType(const QString &name) const;
const TypeSystemTypeEntry *findTypeSystemType(const QString &name) const;
const TypeSystemTypeEntry *defaultTypeSystemType() const;
QString defaultPackageName() const;
- TypeEntry* findType(const QString& name) const;
+ TypeEntry *findType(const QString &name) const;
const TypeEntryMultiMap &entries() const { return m_entries; }
const TypedefEntryMap &typedefEntries() const { return m_typedefEntries; }
@@ -105,59 +105,59 @@ public:
ContainerTypeEntryList containerTypes() const;
void addRejection(const TypeRejection &);
- bool isClassRejected(const QString& className, QString *reason = nullptr) const;
- bool isFunctionRejected(const QString& className, const QString& functionName,
+ bool isClassRejected(const QString &className, QString *reason = nullptr) const;
+ bool isFunctionRejected(const QString &className, const QString &functionName,
QString *reason = nullptr) const;
- bool isFieldRejected(const QString& className, const QString& fieldName,
+ bool isFieldRejected(const QString &className, const QString &fieldName,
QString *reason = nullptr) const;
- bool isEnumRejected(const QString& className, const QString& enumName,
+ bool isEnumRejected(const QString &className, const QString &enumName,
QString *reason = nullptr) const;
- bool isArgumentTypeRejected(const QString& className, const QString& typeName,
+ bool isArgumentTypeRejected(const QString &className, const QString &typeName,
QString *reason = nullptr) const;
- bool isReturnTypeRejected(const QString& className, const QString& typeName,
+ bool isReturnTypeRejected(const QString &className, const QString &typeName,
QString *reason = nullptr) const;
- bool addType(TypeEntry* e, QString *errorMessage = nullptr);
+ bool addType(TypeEntry *e, QString *errorMessage = nullptr);
void addTypeSystemType(const TypeSystemTypeEntry *e);
- FlagsTypeEntry* findFlagsType(const QString& name) const;
- void addFlagsType(FlagsTypeEntry* fte);
+ FlagsTypeEntry *findFlagsType(const QString &name) const;
+ void addFlagsType(FlagsTypeEntry *fte);
- TemplateEntry *findTemplate(const QString& name) const { return m_templates[name]; }
+ TemplateEntry *findTemplate(const QString &name) const { return m_templates[name]; }
- void addTemplate(TemplateEntry* t);
+ void addTemplate(TemplateEntry *t);
AddedFunctionList globalUserFunctions() const { return m_globalUserFunctions; }
void addGlobalUserFunctions(const AddedFunctionList &functions);
- AddedFunctionList findGlobalUserFunctions(const QString& name) const;
+ AddedFunctionList findGlobalUserFunctions(const QString &name) const;
void addGlobalUserFunctionModifications(const FunctionModificationList &functionModifications);
- FunctionModificationList functionModifications(const QString& signature) const;
+ FunctionModificationList functionModifications(const QString &signature) const;
void setSuppressWarnings(bool on) { m_suppressWarnings = on; }
bool addSuppressedWarning(const QString &warning, QString *errorMessage);
- bool isSuppressedWarning(const QString& s) const;
+ bool isSuppressedWarning(const QString &s) const;
static QString globalNamespaceClassName(const TypeEntry *te);
bool parseFile(const QString &filename, bool generate = true);
bool parseFile(const QString &filename, const QString &currentPath, bool generate);
- bool parseFile(QIODevice* device, bool generate = true);
+ bool parseFile(QIODevice *device, bool generate = true);
- static bool setApiVersion(const QString& package, const QString& version);
+ static bool setApiVersion(const QString &package, const QString &version);
static void clearApiVersions();
static bool checkApiVersion(const QString &package, const QVersionNumber &version);
bool hasDroppedTypeEntries() const { return !m_dropTypeEntries.isEmpty(); }
- bool shouldDropTypeEntry(const QString& fullTypeName) const;
+ bool shouldDropTypeEntry(const QString &fullTypeName) const;
void setDropTypeEntries(QStringList dropTypeEntries);
@@ -170,7 +170,7 @@ private:
TypeEntryMultiMapConstIteratorRange findTypes(const QString &name) const;
TypeEntry *resolveTypeDefEntry(TypedefEntry *typedefEntry, QString *errorMessage);
- bool m_suppressWarnings;
+ bool m_suppressWarnings = true;
TypeEntryMultiMap m_entries;
TypeEntryMap m_flagsEntries;
TypedefEntryMap m_typedefEntries;
diff --git a/sources/shiboken2/ApiExtractor/typedatabase_typedefs.h b/sources/shiboken2/ApiExtractor/typedatabase_typedefs.h
index f9591609e..0bb5cde1d 100644
--- a/sources/shiboken2/ApiExtractor/typedatabase_typedefs.h
+++ b/sources/shiboken2/ApiExtractor/typedatabase_typedefs.h
@@ -40,8 +40,8 @@ class TemplateEntry;
class TypeEntry;
class TypedefEntry;
-typedef QVector<TypeEntry *> TypeEntryList;
-typedef QMap<QString, TemplateEntry *> TemplateEntryMap;
+using TypeEntryList = QVector<TypeEntry *>;
+using TemplateEntryMap =QMap<QString, TemplateEntry *>;
template <class Key, class Value>
struct QMultiMapConstIteratorRange // A range of iterator for a range-based for loop
@@ -55,14 +55,14 @@ struct QMultiMapConstIteratorRange // A range of iterator for a range-based for
ConstIterator m_end;
};
-typedef QMultiMap<QString, TypeEntry *> TypeEntryMultiMap;
-typedef QMultiMapConstIteratorRange<QString, TypeEntry *> TypeEntryMultiMapConstIteratorRange;
+using TypeEntryMultiMap = QMultiMap<QString, TypeEntry *>;
+using TypeEntryMultiMapConstIteratorRange = QMultiMapConstIteratorRange<QString, TypeEntry *>;
-typedef QMap<QString, TypeEntry *> TypeEntryMap;
-typedef QMap<QString, TypedefEntry *> TypedefEntryMap;
+using TypeEntryMap = QMap<QString, TypeEntry *>;
+using TypedefEntryMap = QMap<QString, TypedefEntry *>;
-typedef QVector<const ContainerTypeEntry *> ContainerTypeEntryList;
+using ContainerTypeEntryList = QVector<const ContainerTypeEntry *>;
using NamespaceTypeEntryList = QVector<NamespaceTypeEntry *>;
-typedef QVector<const PrimitiveTypeEntry *> PrimitiveTypeEntryList;
+using PrimitiveTypeEntryList = QVector<const PrimitiveTypeEntry *>;
#endif // TYPEDATABASE_TYPEDEFS_H
diff --git a/sources/shiboken2/ApiExtractor/typesystem.cpp b/sources/shiboken2/ApiExtractor/typesystem.cpp
index 344313e87..65e3443da 100644
--- a/sources/shiboken2/ApiExtractor/typesystem.cpp
+++ b/sources/shiboken2/ApiExtractor/typesystem.cpp
@@ -510,7 +510,7 @@ Handler::~Handler() = default;
static QString readerFileName(const QXmlStreamReader &reader)
{
- const QFile *file = qobject_cast<const QFile *>(reader.device());
+ const auto *file = qobject_cast<const QFile *>(reader.device());
return file != nullptr ? file->fileName() : QString();
}
@@ -698,7 +698,7 @@ bool Handler::endElement(const QStringRef &localName)
if (m_currentDroppedEntryDepth == 1) {
m_current = m_currentDroppedEntry->parent;
delete m_currentDroppedEntry;
- m_currentDroppedEntry = 0;
+ m_currentDroppedEntry = nullptr;
m_currentDroppedEntryDepth = 0;
} else {
--m_currentDroppedEntryDepth;
@@ -728,7 +728,7 @@ bool Handler::endElement(const QStringRef &localName)
case StackElement::ValueTypeEntry:
case StackElement::InterfaceTypeEntry:
case StackElement::NamespaceTypeEntry: {
- ComplexTypeEntry *centry = static_cast<ComplexTypeEntry *>(m_current->entry);
+ auto *centry = static_cast<ComplexTypeEntry *>(m_current->entry);
centry->setAddedFunctions(m_contextStack.top()->addedFunctions);
centry->setFunctionModifications(m_contextStack.top()->functionMods);
centry->setFieldModifications(m_contextStack.top()->fieldMods);
@@ -785,7 +785,7 @@ bool Handler::endElement(const QStringRef &localName)
case StackElement::EnumTypeEntry:
m_current->entry->setDocModification(m_contextStack.top()->docModifications);
m_contextStack.top()->docModifications = DocModificationList();
- m_currentEnum = 0;
+ m_currentEnum = nullptr;
break;
case StackElement::Template:
m_database->addTemplate(m_current->value.templateEntry);
@@ -1148,8 +1148,7 @@ SmartPointerTypeEntry *
return nullptr;
}
- SmartPointerTypeEntry *type =
- new SmartPointerTypeEntry(name, getter, smartPointerType, refCountMethodName, since);
+ auto *type = new SmartPointerTypeEntry(name, getter, smartPointerType, refCountMethodName, since);
applyCommonAttributes(type, attributes);
return type;
}
@@ -1159,7 +1158,7 @@ PrimitiveTypeEntry *
const QString &name, const QVersionNumber &since,
QXmlStreamAttributes *attributes)
{
- PrimitiveTypeEntry *type = new PrimitiveTypeEntry(name, since);
+ auto *type = new PrimitiveTypeEntry(name, since);
applyCommonAttributes(type, attributes);
for (int i = attributes->size() - 1; i >= 0; --i) {
const QStringRef name = attributes->at(i).qualifiedName();
@@ -1203,7 +1202,7 @@ ContainerTypeEntry *
m_error = QLatin1String("there is no container of type ") + typeName.toString();
return nullptr;
}
- ContainerTypeEntry *type = new ContainerTypeEntry(name, containerType, since);
+ auto *type = new ContainerTypeEntry(name, containerType, since);
applyCommonAttributes(type, attributes);
return type;
}
@@ -1220,7 +1219,7 @@ EnumTypeEntry *
scope = fullName.left(sep);
name = fullName.right(fullName.size() - sep - 2);
}
- EnumTypeEntry *entry = new EnumTypeEntry(scope, name, since);
+ auto *entry = new EnumTypeEntry(scope, name, since);
applyCommonAttributes(entry, attributes);
entry->setTargetLangPackage(m_defaultPackage);
@@ -1258,7 +1257,7 @@ ObjectTypeEntry *
const QString &name, const QVersionNumber &since,
QXmlStreamAttributes *attributes)
{
- ObjectTypeEntry *otype = new ObjectTypeEntry(name, since);
+ auto *otype = new ObjectTypeEntry(name, since);
applyCommonAttributes(otype, attributes);
QString targetLangName = name;
bool generate = true;
@@ -1331,7 +1330,7 @@ ValueTypeEntry *
const QString &name, const QVersionNumber &since,
QXmlStreamAttributes *attributes)
{
- ValueTypeEntry *typeEntry = new ValueTypeEntry(name, since);
+ auto *typeEntry = new ValueTypeEntry(name, since);
applyCommonAttributes(typeEntry, attributes);
const int defaultCtIndex =
indexOfAttribute(*attributes, QStringViewLiteral("default-constructor"));
@@ -1356,7 +1355,7 @@ FunctionTypeEntry *
TypeEntry *existingType = m_database->findType(name);
if (!existingType) {
- FunctionTypeEntry *result = new FunctionTypeEntry(name, signature, since);
+ auto *result = new FunctionTypeEntry(name, signature, since);
applyCommonAttributes(result, attributes);
return result;
}
@@ -1367,7 +1366,7 @@ FunctionTypeEntry *
return nullptr;
}
- FunctionTypeEntry *result = reinterpret_cast<FunctionTypeEntry *>(existingType);
+ auto *result = reinterpret_cast<FunctionTypeEntry *>(existingType);
result->addSignature(signature);
return result;
}
@@ -1626,7 +1625,7 @@ TypeSystemTypeEntry *Handler::parseRootElement(const QXmlStreamReader &,
}
}
- TypeSystemTypeEntry *moduleEntry =
+ auto *moduleEntry =
const_cast<TypeSystemTypeEntry *>(m_database->findTypeSystemType(m_defaultPackage));
const bool add = moduleEntry == nullptr;
if (add)
@@ -1651,8 +1650,8 @@ bool Handler::loadTypesystem(const QXmlStreamReader &,
const QStringRef name = attributes->at(i).qualifiedName();
if (name == nameAttribute())
typeSystemName = attributes->takeAt(i).value().toString();
- else if (name == generateAttribute())
- generateChild = convertBoolean(attributes->takeAt(i).value(), generateAttribute(), true);
+ else if (name == generateAttribute())
+ generateChild = convertBoolean(attributes->takeAt(i).value(), generateAttribute(), true);
}
if (typeSystemName.isEmpty()) {
m_error = QLatin1String("No typesystem name specified");
@@ -1768,7 +1767,7 @@ bool Handler::parseCustomConversion(const QXmlStreamReader &,
}
}
- CustomConversion* customConversion = new CustomConversion(m_current->entry);
+ auto *customConversion = new CustomConversion(m_current->entry);
customConversionsForReview.append(customConversion);
return true;
}
@@ -1805,8 +1804,8 @@ bool Handler::parseAddConversion(const QXmlStreamReader &,
const QStringRef name = attributes->at(i).qualifiedName();
if (name == QLatin1String("type"))
sourceTypeName = attributes->takeAt(i).value().toString();
- else if (name == QLatin1String("check"))
- typeCheck = attributes->takeAt(i).value().toString();
+ else if (name == QLatin1String("check"))
+ typeCheck = attributes->takeAt(i).value().toString();
}
if (sourceTypeName.isEmpty()) {
m_error = QLatin1String("Target to Native conversions must specify the input type with the 'type' attribute.");
@@ -2305,7 +2304,7 @@ CustomFunction *
else if (name == QLatin1String("param-name"))
paramName = attributes->takeAt(i).value().toString();
}
- CustomFunction *func = new CustomFunction(functionName);
+ auto *func = new CustomFunction(functionName);
func->paramName = paramName;
return func;
}
@@ -2604,7 +2603,7 @@ bool Handler::startElement(const QXmlStreamReader &reader)
return true;
}
- StackElement* element = new StackElement(m_current);
+ auto *element = new StackElement(m_current);
element->type = elementType;
if (element->type == StackElement::Root && m_generate == TypeEntry::GenerateAll)
@@ -2807,7 +2806,7 @@ bool Handler::startElement(const QXmlStreamReader &reader)
return false;
}
- StackElement topElement = !m_current ? StackElement(0) : *m_current;
+ StackElement topElement = !m_current ? StackElement(nullptr) : *m_current;
element->entry = topElement.entry;
switch (element->type) {
@@ -3003,7 +3002,7 @@ QString PrimitiveTypeEntry::targetLangApiName() const
PrimitiveTypeEntry *PrimitiveTypeEntry::basicReferencedTypeEntry() const
{
if (!m_referencedTypeEntry)
- return 0;
+ return nullptr;
PrimitiveTypeEntry *baseReferencedTypeEntry = m_referencedTypeEntry->basicReferencedTypeEntry();
return baseReferencedTypeEntry ? baseReferencedTypeEntry : m_referencedTypeEntry;
@@ -3043,9 +3042,10 @@ FunctionModificationList ComplexTypeEntry::functionModifications(const QString &
FieldModification ComplexTypeEntry::fieldModification(const QString &name) const
{
- for (int i = 0; i < m_fieldMods.size(); ++i)
- if (m_fieldMods.at(i).name == name)
- return m_fieldMods.at(i);
+ for (const auto &fieldMod : m_fieldMods) {
+ if (fieldMod.name == name)
+ return fieldMod;
+ }
FieldModification mod;
mod.name = name;
mod.modifiers = FieldModification::Readable | FieldModification::Writable;
@@ -3384,7 +3384,7 @@ AddedFunction::AddedFunction(QString signature, const QString &returnType) :
if (!arg.name.isEmpty())
m_arguments.append({argumentName, arg});
// end of parameters...
- if (signature[endPos] == QLatin1Char(')'))
+ if (endPos >= signatureLength || signature[endPos] == QLatin1Char(')'))
break;
}
// is const?
@@ -3926,7 +3926,7 @@ struct CustomConversion::CustomConversionPrivate
struct CustomConversion::TargetToNativeConversion::TargetToNativeConversionPrivate
{
TargetToNativeConversionPrivate()
- : sourceType(0)
+ : sourceType(nullptr)
{
}
const TypeEntry* sourceType;
diff --git a/sources/shiboken2/ApiExtractor/typesystem.h b/sources/shiboken2/ApiExtractor/typesystem.h
index 82a698107..6a88ecd4d 100644
--- a/sources/shiboken2/ApiExtractor/typesystem.h
+++ b/sources/shiboken2/ApiExtractor/typesystem.h
@@ -55,7 +55,7 @@ QT_END_NAMESPACE
class EnumTypeEntry;
class FlagsTypeEntry;
-typedef QMap<int, QString> ArgumentMap;
+using ArgumentMap = QMap<int, QString>;
class TemplateInstance;
@@ -186,9 +186,9 @@ public:
struct ArgumentModification
{
ArgumentModification() : removedDefaultExpression(false), removed(false),
- noNullPointers(false), array(false) {}
+ noNullPointers(false), resetAfterUse(false), array(false) {}
explicit ArgumentModification(int idx) : index(idx), removedDefaultExpression(false), removed(false),
- noNullPointers(false), array(false) {}
+ noNullPointers(false), resetAfterUse(false), array(false) {}
// Should the default expression be removed?
@@ -548,6 +548,10 @@ class TypeEntry
{
Q_GADGET
public:
+ TypeEntry &operator=(const TypeEntry &) = delete;
+ TypeEntry &operator=(TypeEntry &&) = delete;
+ TypeEntry(TypeEntry &&) = delete;
+
enum Type {
PrimitiveType,
VoidType,
@@ -770,7 +774,7 @@ public:
virtual InterfaceTypeEntry *designatedInterface() const
{
- return 0;
+ return nullptr;
}
void setCustomConstructor(const CustomFunction &func)
@@ -901,10 +905,6 @@ protected:
TypeEntry(const TypeEntry &);
private:
- TypeEntry &operator=(const TypeEntry &) = delete;
- TypeEntry &operator=(TypeEntry &&) = delete;
- TypeEntry(TypeEntry &&) = delete;
-
QString m_name;
QString m_targetLangPackage;
Type m_type;
@@ -1225,7 +1225,7 @@ public:
enum TypeFlag {
Deprecated = 0x4
};
- typedef QFlags<TypeFlag> TypeFlags;
+ Q_DECLARE_FLAGS(TypeFlags, TypeFlag)
enum CopyableFlag {
CopyableSet,
@@ -1366,7 +1366,7 @@ public:
{
return m_hashFunction;
}
- void setHashFunction(QString hashFunction)
+ void setHashFunction(const QString &hashFunction)
{
m_hashFunction = hashFunction;
}
@@ -1427,6 +1427,8 @@ private:
TypeSystem::AllowThread m_allowThread = TypeSystem::AllowThread::Unspecified;
};
+Q_DECLARE_OPERATORS_FOR_FLAGS(ComplexTypeEntry::TypeFlags)
+
class TypedefEntry : public ComplexTypeEntry
{
public:
@@ -1446,7 +1448,7 @@ public:
void setTarget(ComplexTypeEntry *target) { m_target = target; }
#ifndef QT_NO_DEBUG_STREAM
- virtual void formatDebug(QDebug &d) const override;
+ void formatDebug(QDebug &d) const override;
#endif
protected:
TypedefEntry(const TypedefEntry &);
@@ -1605,7 +1607,7 @@ protected:
InterfaceTypeEntry(const InterfaceTypeEntry &);
private:
- ObjectTypeEntry *m_origin;
+ ObjectTypeEntry *m_origin = nullptr;
};
@@ -1675,7 +1677,7 @@ struct TypeRejection
QRegularExpression className;
QRegularExpression pattern;
- MatchType matchType;
+ MatchType matchType = Invalid;
};
#ifndef QT_NO_DEBUG_STREAM
@@ -1722,7 +1724,7 @@ public:
bool replaceOriginalTargetToNativeConversions() const;
void setReplaceOriginalTargetToNativeConversions(bool replaceOriginalTargetToNativeConversions);
- typedef QVector<TargetToNativeConversion*> TargetToNativeConversions;
+ using TargetToNativeConversions = QVector<TargetToNativeConversion *>;
bool hasTargetToNativeConversions() const;
TargetToNativeConversions& targetToNativeConversions();
const TargetToNativeConversions& targetToNativeConversions() const;
diff --git a/sources/shiboken2/ApiExtractor/typesystem_p.h b/sources/shiboken2/ApiExtractor/typesystem_p.h
index 8a8fcb359..5b8b93cee 100644
--- a/sources/shiboken2/ApiExtractor/typesystem_p.h
+++ b/sources/shiboken2/ApiExtractor/typesystem_p.h
@@ -114,7 +114,7 @@ class StackElement
ArgumentModifiers = 0xff000000
};
- StackElement(StackElement *p) : entry(0), type(None), parent(p) { }
+ StackElement(StackElement *p) : entry(nullptr), type(None), parent(p) { }
TypeEntry* entry;
ElementType type;
diff --git a/sources/shiboken2/ApiExtractor/typesystem_typedefs.h b/sources/shiboken2/ApiExtractor/typesystem_typedefs.h
index 5cea587ed..fd702793e 100644
--- a/sources/shiboken2/ApiExtractor/typesystem_typedefs.h
+++ b/sources/shiboken2/ApiExtractor/typesystem_typedefs.h
@@ -43,9 +43,9 @@ struct FunctionModification;
using AddedFunctionPtr = QSharedPointer<AddedFunction>;
using AddedFunctionList = QVector<AddedFunctionPtr>;
-typedef QVector<CodeSnip> CodeSnipList;
-typedef QVector<DocModification> DocModificationList;
-typedef QVector<FieldModification> FieldModificationList;
-typedef QVector<FunctionModification> FunctionModificationList;
+using CodeSnipList = QVector<CodeSnip>;
+using DocModificationList = QVector<DocModification>;
+using FieldModificationList = QVector<FieldModification>;
+using FunctionModificationList = QVector<FunctionModification>;
#endif // TYPESYSTEM_TYPEDEFS_H
diff --git a/sources/shiboken2/generator/generator.cpp b/sources/shiboken2/generator/generator.cpp
index 49064a6a5..6da9fd933 100644
--- a/sources/shiboken2/generator/generator.cpp
+++ b/sources/shiboken2/generator/generator.cpp
@@ -153,7 +153,7 @@ QString DefaultValue::constructorParameter() const
struct Generator::GeneratorPrivate
{
- const ApiExtractor* apiextractor = nullptr;
+ const ApiExtractor *apiextractor = nullptr;
QString outDir;
// License comment
QString licenseComment;
@@ -174,7 +174,7 @@ Generator::~Generator()
delete m_d;
}
-bool Generator::setup(const ApiExtractor& extractor)
+bool Generator::setup(const ApiExtractor &extractor)
{
m_d->apiextractor = &extractor;
const auto moduleEntry = TypeDatabase::instance()->defaultTypeSystemType();
@@ -188,7 +188,7 @@ bool Generator::setup(const ApiExtractor& extractor)
return doSetup();
}
-QString Generator::getSimplifiedContainerTypeName(const AbstractMetaType* type)
+QString Generator::getSimplifiedContainerTypeName(const AbstractMetaType *type)
{
const QString signature = type->cppSignature();
if (!type->typeEntry()->isContainer() && !type->typeEntry()->isSmartPointer())
@@ -217,7 +217,7 @@ void Generator::addInstantiatedContainersAndSmartPointers(const AbstractMetaType
if (!type)
return;
const AbstractMetaTypeList &instantiations = type->instantiations();
- for (const AbstractMetaType* t : instantiations)
+ for (const AbstractMetaType *t : instantiations)
addInstantiatedContainersAndSmartPointers(t, context);
const auto typeEntry = type->typeEntry();
const bool isContainer = typeEntry->isContainer();
@@ -298,7 +298,7 @@ QVector<const AbstractMetaType *> Generator::instantiatedContainers() const
return m_d->instantiatedContainers;
}
-QVector<const AbstractMetaType*> Generator::instantiatedSmartPointers() const
+QVector<const AbstractMetaType *> Generator::instantiatedSmartPointers() const
{
return m_d->instantiatedSmartPointers;
}
@@ -343,12 +343,12 @@ ContainerTypeEntryList Generator::containerTypes() const
return m_d->apiextractor->containerTypes();
}
-const AbstractMetaEnum* Generator::findAbstractMetaEnum(const TypeEntry* typeEntry) const
+const AbstractMetaEnum *Generator::findAbstractMetaEnum(const TypeEntry *typeEntry) const
{
return m_d->apiextractor->findAbstractMetaEnum(typeEntry);
}
-const AbstractMetaEnum* Generator::findAbstractMetaEnum(const AbstractMetaType* metaType) const
+const AbstractMetaEnum *Generator::findAbstractMetaEnum(const AbstractMetaType *metaType) const
{
return m_d->apiextractor->findAbstractMetaEnum(metaType->typeEntry());
}
@@ -358,7 +358,7 @@ QString Generator::licenseComment() const
return m_d->licenseComment;
}
-void Generator::setLicenseComment(const QString& licenseComment)
+void Generator::setLicenseComment(const QString &licenseComment)
{
m_d->licenseComment = licenseComment;
}
@@ -440,12 +440,12 @@ bool Generator::generate()
return finishGeneration();
}
-bool Generator::shouldGenerateTypeEntry(const TypeEntry* type) const
+bool Generator::shouldGenerateTypeEntry(const TypeEntry *type) const
{
return type->codeGeneration() & TypeEntry::GenerateTargetLang;
}
-bool Generator::shouldGenerate(const AbstractMetaClass* metaClass) const
+bool Generator::shouldGenerate(const AbstractMetaClass *metaClass) const
{
return shouldGenerateTypeEntry(metaClass->typeEntry());
}
@@ -490,7 +490,7 @@ void Generator::replaceTemplateVariables(QString &code, const AbstractMetaFuncti
}
}
-QTextStream& formatCode(QTextStream &s, const QString& code, Indentor &indentor)
+QTextStream &formatCode(QTextStream &s, const QString &code, Indentor &indentor)
{
// detect number of spaces before the first character
const QStringList lst(code.split(QLatin1Char('\n')));
@@ -527,7 +527,7 @@ QTextStream& formatCode(QTextStream &s, const QString& code, Indentor &indentor)
return s;
}
-AbstractMetaFunctionList Generator::implicitConversions(const TypeEntry* type) const
+AbstractMetaFunctionList Generator::implicitConversions(const TypeEntry *type) const
{
if (type->isValue()) {
if (const AbstractMetaClass *metaClass = AbstractMetaClass::findClass(classes(), type))
@@ -536,52 +536,52 @@ AbstractMetaFunctionList Generator::implicitConversions(const TypeEntry* type) c
return AbstractMetaFunctionList();
}
-AbstractMetaFunctionList Generator::implicitConversions(const AbstractMetaType* metaType) const
+AbstractMetaFunctionList Generator::implicitConversions(const AbstractMetaType *metaType) const
{
return implicitConversions(metaType->typeEntry());
}
-bool Generator::isObjectType(const TypeEntry* type)
+bool Generator::isObjectType(const TypeEntry *type)
{
if (type->isComplex())
return Generator::isObjectType(static_cast<const ComplexTypeEntry *>(type));
return type->isObject();
}
-bool Generator::isObjectType(const ComplexTypeEntry* type)
+bool Generator::isObjectType(const ComplexTypeEntry *type)
{
return type->isObject();
}
-bool Generator::isObjectType(const AbstractMetaClass* metaClass)
+bool Generator::isObjectType(const AbstractMetaClass *metaClass)
{
return Generator::isObjectType(metaClass->typeEntry());
}
-bool Generator::isObjectType(const AbstractMetaType* metaType)
+bool Generator::isObjectType(const AbstractMetaType *metaType)
{
return isObjectType(metaType->typeEntry());
}
-bool Generator::isPointer(const AbstractMetaType* type)
+bool Generator::isPointer(const AbstractMetaType *type)
{
return type->indirections() > 0
|| type->isNativePointer()
|| type->isValuePointer();
}
-bool Generator::isCString(const AbstractMetaType* type)
+bool Generator::isCString(const AbstractMetaType *type)
{
return type->isNativePointer()
&& type->indirections() == 1
&& type->name() == QLatin1String("char");
}
-bool Generator::isVoidPointer(const AbstractMetaType* type)
+bool Generator::isVoidPointer(const AbstractMetaType *type)
{
return type->isNativePointer()
&& type->indirections() == 1
&& type->name() == QLatin1String("void");
}
-QString Generator::getFullTypeName(const TypeEntry* type) const
+QString Generator::getFullTypeName(const TypeEntry *type) const
{
QString result = type->qualifiedCppName();
if (type->isArray())
@@ -591,7 +591,7 @@ QString Generator::getFullTypeName(const TypeEntry* type) const
return result;
}
-QString Generator::getFullTypeName(const AbstractMetaType* type) const
+QString Generator::getFullTypeName(const AbstractMetaType *type) const
{
if (isCString(type))
return QLatin1String("const char*");
@@ -607,12 +607,12 @@ QString Generator::getFullTypeName(const AbstractMetaType* type) const
return typeName + QString::fromLatin1("*").repeated(type->indirections());
}
-QString Generator::getFullTypeName(const AbstractMetaClass* metaClass) const
+QString Generator::getFullTypeName(const AbstractMetaClass *metaClass) const
{
return QLatin1String("::") + metaClass->qualifiedCppName();
}
-QString Generator::getFullTypeNameWithoutModifiers(const AbstractMetaType* type) const
+QString Generator::getFullTypeNameWithoutModifiers(const AbstractMetaType *type) const
{
if (isCString(type))
return QLatin1String("const char*");
@@ -638,7 +638,7 @@ QString Generator::getFullTypeNameWithoutModifiers(const AbstractMetaType* type)
return QLatin1String("::") + typeName;
}
-DefaultValue Generator::minimalConstructor(const AbstractMetaType* type) const
+DefaultValue Generator::minimalConstructor(const AbstractMetaType *type) const
{
if (!type || (type->referenceType() == LValueReference && Generator::isObjectType(type)))
return DefaultValue(DefaultValue::Error);
@@ -664,7 +664,7 @@ DefaultValue Generator::minimalConstructor(const AbstractMetaType* type) const
return DefaultValue(DefaultValue::Pointer, QLatin1String("::") + type->typeEntry()->qualifiedCppName());
if (type->typeEntry()->isComplex()) {
- const ComplexTypeEntry* cType = static_cast<const ComplexTypeEntry*>(type->typeEntry());
+ auto cType = static_cast<const ComplexTypeEntry *>(type->typeEntry());
if (cType->hasDefaultConstructor())
return DefaultValue(DefaultValue::Custom, cType->defaultConstructor());
auto ctor = minimalConstructor(AbstractMetaClass::findClass(classes(), cType));
@@ -679,7 +679,7 @@ DefaultValue Generator::minimalConstructor(const AbstractMetaType* type) const
return minimalConstructor(type->typeEntry());
}
-DefaultValue Generator::minimalConstructor(const TypeEntry* type) const
+DefaultValue Generator::minimalConstructor(const TypeEntry *type) const
{
if (!type)
return DefaultValue(DefaultValue::Error);
@@ -706,7 +706,7 @@ DefaultValue Generator::minimalConstructor(const TypeEntry* type) const
}
if (type->isPrimitive()) {
- QString ctor = static_cast<const PrimitiveTypeEntry*>(type)->defaultConstructor();
+ QString ctor = static_cast<const PrimitiveTypeEntry *>(type)->defaultConstructor();
// If a non-C++ (i.e. defined by the user) primitive type does not have
// a default constructor defined by the user, the empty constructor is
// heuristically returned. If this is wrong the build of the generated
@@ -729,12 +729,12 @@ static QString constructorCall(const QString &qualifiedCppName, const QStringLis
+ args.join(QLatin1String(", ")) + QLatin1Char(')');
}
-DefaultValue Generator::minimalConstructor(const AbstractMetaClass* metaClass) const
+DefaultValue Generator::minimalConstructor(const AbstractMetaClass *metaClass) const
{
if (!metaClass)
return DefaultValue(DefaultValue::Error);
- const ComplexTypeEntry* cType = static_cast<const ComplexTypeEntry*>(metaClass->typeEntry());
+ auto cType = static_cast<const ComplexTypeEntry *>(metaClass->typeEntry());
if (cType->hasDefaultConstructor())
return DefaultValue(DefaultValue::Custom, cType->defaultConstructor());
@@ -845,7 +845,7 @@ QString Generator::translateType(const AbstractMetaType *cType,
s = s.remove(index, constLen);
}
} else if (options & Generator::ExcludeConst || options & Generator::ExcludeReference) {
- AbstractMetaType* copyType = cType->copy();
+ AbstractMetaType *copyType = cType->copy();
if (options & Generator::ExcludeConst)
copyType->setConstant(false);
@@ -866,7 +866,7 @@ QString Generator::translateType(const AbstractMetaType *cType,
}
-QString Generator::subDirectoryForClass(const AbstractMetaClass* clazz) const
+QString Generator::subDirectoryForClass(const AbstractMetaClass *clazz) const
{
return subDirectoryForPackage(clazz->package());
}
@@ -880,10 +880,10 @@ QString Generator::subDirectoryForPackage(QString packageNameIn) const
}
template<typename T>
-static QString getClassTargetFullName_(const T* t, bool includePackageName)
+static QString getClassTargetFullName_(const T *t, bool includePackageName)
{
QString name = t->name();
- const AbstractMetaClass* context = t->enclosingClass();
+ const AbstractMetaClass *context = t->enclosingClass();
while (context) {
name.prepend(QLatin1Char('.'));
name.prepend(context->name());
@@ -896,12 +896,12 @@ static QString getClassTargetFullName_(const T* t, bool includePackageName)
return name;
}
-QString getClassTargetFullName(const AbstractMetaClass* metaClass, bool includePackageName)
+QString getClassTargetFullName(const AbstractMetaClass *metaClass, bool includePackageName)
{
return getClassTargetFullName_(metaClass, includePackageName);
}
-QString getClassTargetFullName(const AbstractMetaEnum* metaEnum, bool includePackageName)
+QString getClassTargetFullName(const AbstractMetaEnum *metaEnum, bool includePackageName)
{
return getClassTargetFullName_(metaEnum, includePackageName);
}
diff --git a/sources/shiboken2/generator/generator.h b/sources/shiboken2/generator/generator.h
index 04840427f..dde281f0e 100644
--- a/sources/shiboken2/generator/generator.h
+++ b/sources/shiboken2/generator/generator.h
@@ -56,11 +56,11 @@ QT_END_NAMESPACE
class PrimitiveTypeEntry;
class ContainerTypeEntry;
-QTextStream& formatCode(QTextStream &s, const QString& code, Indentor &indentor);
+QTextStream &formatCode(QTextStream &s, const QString &code, Indentor &indentor);
void verifyDirectoryFor(const QString &file);
-QString getClassTargetFullName(const AbstractMetaClass* metaClass, bool includePackageName = true);
-QString getClassTargetFullName(const AbstractMetaEnum* metaEnum, bool includePackageName = true);
+QString getClassTargetFullName(const AbstractMetaClass *metaClass, bool includePackageName = true);
+QString getClassTargetFullName(const AbstractMetaEnum *metaEnum, bool includePackageName = true);
QString getClassTargetFullName(const AbstractMetaType *metaType, bool includePackageName = true);
QString getFilteredCppSignatureString(QString signature);
@@ -147,9 +147,9 @@ private:
*/
class GeneratorContext {
public:
- GeneratorContext() : m_metaClass(0), m_preciseClassType(0), m_forSmartPointer(false) {}
+ GeneratorContext() = default;
GeneratorContext(AbstractMetaClass *metaClass,
- const AbstractMetaType *preciseType = 0,
+ const AbstractMetaType *preciseType = nullptr,
bool forSmartPointer = false)
: m_metaClass(metaClass),
m_preciseClassType(preciseType),
@@ -161,9 +161,9 @@ public:
const AbstractMetaType *preciseType() const { return m_preciseClassType; }
private:
- AbstractMetaClass *m_metaClass;
- const AbstractMetaType *m_preciseClassType;
- bool m_forSmartPointer;
+ AbstractMetaClass *m_metaClass = nullptr;
+ const AbstractMetaType *m_preciseClassType = nullptr;
+ bool m_forSmartPointer = false;
};
/**
@@ -173,8 +173,8 @@ private:
class Generator
{
public:
- typedef QPair<QString, QString> OptionDescription;
- typedef QVector<OptionDescription> OptionDescriptions;
+ using OptionDescription = QPair<QString, QString>;
+ using OptionDescriptions = QVector<OptionDescription>;
/// Optiosn used around the generator code
enum Option {
@@ -202,7 +202,7 @@ public:
Generator();
virtual ~Generator();
- bool setup(const ApiExtractor& extractor);
+ bool setup(const ApiExtractor &extractor);
virtual OptionDescriptions options() const;
virtual bool handleOption(const QString &key, const QString &value);
@@ -231,7 +231,7 @@ public:
void setLicenseComment(const QString &licenseComment);
/// Returns the generator's name. Used for cosmetic purposes.
- virtual const char* name() const = 0;
+ virtual const char *name() const = 0;
/**
* Retrieves the name of the currently processed module.
@@ -250,24 +250,24 @@ public:
* \param type a TypeEntry that is expected to be a value-type
* \return a list of constructors that could be used as implicit converters
*/
- AbstractMetaFunctionList implicitConversions(const TypeEntry* type) const;
+ AbstractMetaFunctionList implicitConversions(const TypeEntry *type) const;
- /// Convenience function for implicitConversions(const TypeEntry* type).
- AbstractMetaFunctionList implicitConversions(const AbstractMetaType* metaType) const;
+ /// Convenience function for implicitConversions(const TypeEntry *type).
+ AbstractMetaFunctionList implicitConversions(const AbstractMetaType *metaType) const;
/// Check if type is a pointer.
- static bool isPointer(const AbstractMetaType* type);
+ static bool isPointer(const AbstractMetaType *type);
/// Tells if the type or class is an Object (or QObject) Type.
- static bool isObjectType(const TypeEntry* type);
- static bool isObjectType(const ComplexTypeEntry* type);
- static bool isObjectType(const AbstractMetaType* metaType);
- static bool isObjectType(const AbstractMetaClass* metaClass);
+ static bool isObjectType(const TypeEntry *type);
+ static bool isObjectType(const ComplexTypeEntry *type);
+ static bool isObjectType(const AbstractMetaType *metaType);
+ static bool isObjectType(const AbstractMetaClass *metaClass);
- /// Returns true if the type is a C string (const char*).
- static bool isCString(const AbstractMetaType* type);
+ /// Returns true if the type is a C string (const char *).
+ static bool isCString(const AbstractMetaType *type);
/// Returns true if the type is a void pointer.
- static bool isVoidPointer(const AbstractMetaType* type);
+ static bool isVoidPointer(const AbstractMetaType *type);
protected:
/// Returns the classes, topologically ordered, used to generate the binding code.
@@ -289,10 +289,10 @@ protected:
ContainerTypeEntryList containerTypes() const;
/// Returns an AbstractMetaEnum for a given TypeEntry that is an EnumTypeEntry, or nullptr if not found.
- const AbstractMetaEnum* findAbstractMetaEnum(const TypeEntry* typeEntry) const;
+ const AbstractMetaEnum *findAbstractMetaEnum(const TypeEntry *typeEntry) const;
/// Returns an AbstractMetaEnum for a given AbstractMetaType that holds an EnumTypeEntry, or nullptr if not found.
- const AbstractMetaEnum* findAbstractMetaEnum(const AbstractMetaType* metaType) const;
+ const AbstractMetaEnum *findAbstractMetaEnum(const AbstractMetaType *metaType) const;
/// Generates a file for given AbstractMetaClass or AbstractMetaType (smart pointer case).
bool generateFileForContext(GeneratorContext &context);
@@ -302,13 +302,13 @@ protected:
const AbstractMetaClass *smartPointerClass) const;
/// Returns true if the generator should generate any code for the TypeEntry.
- bool shouldGenerateTypeEntry(const TypeEntry*) const;
+ bool shouldGenerateTypeEntry(const TypeEntry *) const;
/// Returns true if the generator should generate any code for the AbstractMetaClass.
virtual bool shouldGenerate(const AbstractMetaClass *) const;
/// Returns the subdirectory used to write the binding code of an AbstractMetaClass.
- virtual QString subDirectoryForClass(const AbstractMetaClass* clazz) const;
+ virtual QString subDirectoryForClass(const AbstractMetaClass *clazz) const;
/**
* Translate metatypes to binding source format.
@@ -344,25 +344,25 @@ protected:
QString packageName() const;
// Returns the full name of the type.
- QString getFullTypeName(const TypeEntry* type) const;
- QString getFullTypeName(const AbstractMetaType* type) const;
- QString getFullTypeName(const AbstractMetaClass* metaClass) const;
+ QString getFullTypeName(const TypeEntry *type) const;
+ QString getFullTypeName(const AbstractMetaType *type) const;
+ QString getFullTypeName(const AbstractMetaClass *metaClass) const;
/**
* Returns the full qualified C++ name for an AbstractMetaType, but removing modifiers
* as 'const', '&', and '*' (except if the class is not derived from a template).
* This is useful for instantiated templates.
*/
- QString getFullTypeNameWithoutModifiers(const AbstractMetaType* type) const;
+ QString getFullTypeNameWithoutModifiers(const AbstractMetaType *type) const;
/**
* Tries to build a minimal constructor for the type.
* It will check first for a user defined default constructor.
* Returns a null string if it fails.
*/
- DefaultValue minimalConstructor(const TypeEntry* type) const;
- DefaultValue minimalConstructor(const AbstractMetaType* type) const;
- DefaultValue minimalConstructor(const AbstractMetaClass* metaClass) const;
+ DefaultValue minimalConstructor(const TypeEntry *type) const;
+ DefaultValue minimalConstructor(const AbstractMetaType *type) const;
+ DefaultValue minimalConstructor(const AbstractMetaClass *metaClass) const;
/**
* Returns the file name used to write the binding code of an AbstractMetaClass/Type.
@@ -382,7 +382,7 @@ protected:
* \param s text stream to write the generated output
* \param metaClass the class that should be generated
*/
- virtual void generateClass(QTextStream& s, GeneratorContext &classContext) = 0;
+ virtual void generateClass(QTextStream &s, GeneratorContext &classContext) = 0;
virtual bool finishGeneration() = 0;
/**
@@ -396,8 +396,8 @@ protected:
*/
virtual QString subDirectoryForPackage(QString packageName = QString()) const;
- QVector<const AbstractMetaType*> instantiatedContainers() const;
- QVector<const AbstractMetaType*> instantiatedSmartPointers() const;
+ QVector<const AbstractMetaType *> instantiatedContainers() const;
+ QVector<const AbstractMetaType *> instantiatedSmartPointers() const;
static QString getSimplifiedContainerTypeName(const AbstractMetaType *type);
void addInstantiatedContainersAndSmartPointers(const AbstractMetaType *type,
@@ -407,15 +407,15 @@ private:
bool useEnumAsIntForProtectedHack(const AbstractMetaType *cType) const;
struct GeneratorPrivate;
- GeneratorPrivate* m_d;
- void collectInstantiatedContainersAndSmartPointers(const AbstractMetaFunction* func);
+ GeneratorPrivate *m_d;
+ void collectInstantiatedContainersAndSmartPointers(const AbstractMetaFunction *func);
void collectInstantiatedContainersAndSmartPointers(const AbstractMetaClass *metaClass);
void collectInstantiatedContainersAndSmartPointers();
};
Q_DECLARE_OPERATORS_FOR_FLAGS(Generator::Options)
-typedef QSharedPointer<Generator> GeneratorPtr;
-typedef QVector<GeneratorPtr> Generators;
+using GeneratorPtr = QSharedPointer<Generator>;
+using Generators = QVector<GeneratorPtr>;
#endif // GENERATOR_H
diff --git a/sources/shiboken2/generator/main.cpp b/sources/shiboken2/generator/main.cpp
index ac576d657..25daea99e 100644
--- a/sources/shiboken2/generator/main.cpp
+++ b/sources/shiboken2/generator/main.cpp
@@ -59,11 +59,11 @@ static inline QString skipDeprecatedOption() { return QStringLiteral("skip-depre
static const char helpHint[] = "Note: use --help or -h for more information.\n";
-typedef QMap<QString, QString> CommandArgumentMap;
+using CommandArgumentMap = QMap<QString, QString>;
-typedef Generator::OptionDescriptions OptionDescriptions;
+using OptionDescriptions = Generator::OptionDescriptions;
-static void printOptions(QTextStream& s, const OptionDescriptions& options)
+static void printOptions(QTextStream &s, const OptionDescriptions &options)
{
s.setFieldAlignment(QTextStream::AlignLeft);
for (const auto &od : options) {
@@ -82,7 +82,7 @@ static void printOptions(QTextStream& s, const OptionDescriptions& options)
}
}
-static bool processProjectFile(QFile& projectFile, QMap<QString, QString>& args)
+static bool processProjectFile(QFile &projectFile, QMap<QString, QString> &args)
{
QByteArray line = projectFile.readLine().trimmed();
if (line.isEmpty() || line != "[generator-project]")
@@ -355,7 +355,7 @@ static inline void printVerAndBanner()
std::cout << "Copyright (C) 2016 The Qt Company Ltd." << std::endl;
}
-static inline void errorPrint(const QString& s)
+static inline void errorPrint(const QString &s)
{
QStringList arguments = QCoreApplication::arguments();
arguments.pop_front();
diff --git a/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp b/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp
index 6abfde7c9..9cad400f3 100644
--- a/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp
+++ b/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp
@@ -387,7 +387,7 @@ QtXmlToSphinx::QtXmlToSphinx(QtDocGenerator* generator, const QString& doc, cons
void QtXmlToSphinx::pushOutputBuffer()
{
- QString* buffer = new QString();
+ auto *buffer = new QString();
m_buffers << buffer;
m_output.setString(buffer);
}
@@ -427,7 +427,7 @@ QString QtXmlToSphinx::resolveContextForMethod(const QString& methodName) const
{
const QStringRef currentClass = m_context.splitRef(QLatin1Char('.')).constLast();
- const AbstractMetaClass* metaClass = 0;
+ const AbstractMetaClass *metaClass = nullptr;
const AbstractMetaClassList &classes = m_generator->classes();
for (const AbstractMetaClass *cls : classes) {
if (cls->name() == currentClass) {
@@ -444,7 +444,7 @@ QString QtXmlToSphinx::resolveContextForMethod(const QString& methodName) const
funcList.append(func);
}
- const AbstractMetaClass* implementingClass = 0;
+ const AbstractMetaClass *implementingClass = nullptr;
for (const AbstractMetaFunction *func : qAsConst(funcList)) {
implementingClass = func->implementingClass();
if (implementingClass->name() == currentClass)
@@ -528,7 +528,6 @@ static QString resolveFile(const QStringList &locations, const QString &path)
QString QtXmlToSphinx::readFromLocations(const QStringList &locations, const QString &path,
const QString &identifier, QString *errorMessage)
{
- QString result;
QString resolvedPath;
if (path.endsWith(QLatin1String(".cpp"))) {
const QString pySnippet = path.left(path.size() - 3) + QLatin1String("py");
@@ -919,7 +918,8 @@ void QtXmlToSphinx::handleListTag(QXmlStreamReader& reader)
if (token == QXmlStreamReader::StartElement) {
listType = webXmlListType(reader.attributes().value(QLatin1String("type")));
if (listType == EnumeratedList) {
- m_currentTable << (TableRow() << "Constant" << "Description");
+ m_currentTable << TableRow{TableCell(QLatin1String("Constant")),
+ TableCell(QLatin1String("Description"))};
m_tableHasHeader = true;
}
INDENT.indent--;
@@ -981,7 +981,7 @@ QtXmlToSphinx::LinkContext *QtXmlToSphinx::handleLinkStart(const QString &type,
{
ref.replace(QLatin1String("::"), QLatin1String("."));
ref.remove(QLatin1String("()"));
- LinkContext *result = new LinkContext(ref);
+ auto *result = new LinkContext(ref);
if (m_insideBold)
result->flags |= LinkContext::InsideBold;
@@ -1503,7 +1503,7 @@ static QString getFuncName(const AbstractMetaFunction* cppFunc) {
return result;
}
-QtDocGenerator::QtDocGenerator() : m_docParser(0)
+QtDocGenerator::QtDocGenerator() : m_docParser(nullptr)
{
}
@@ -1656,8 +1656,8 @@ void QtDocGenerator::generateClass(QTextStream &s, GeneratorContext &classContex
"--------------------\n\n"
<< ".. _More:\n";
- writeInjectDocumentation(s, TypeSystem::DocModificationPrepend, metaClass, 0);
- if (!writeInjectDocumentation(s, TypeSystem::DocModificationReplace, metaClass, 0))
+ writeInjectDocumentation(s, TypeSystem::DocModificationPrepend, metaClass, nullptr);
+ if (!writeInjectDocumentation(s, TypeSystem::DocModificationReplace, metaClass, nullptr))
writeFormattedText(s, documentation, metaClass);
if (!metaClass->isNamespace())
@@ -1679,7 +1679,7 @@ void QtDocGenerator::generateClass(QTextStream &s, GeneratorContext &classContex
writeFunction(s, metaClass, func);
}
- writeInjectDocumentation(s, TypeSystem::DocModificationAppend, metaClass, 0);
+ writeInjectDocumentation(s, TypeSystem::DocModificationAppend, metaClass, nullptr);
}
void QtDocGenerator::writeFunctionList(QTextStream& s, const AbstractMetaClass* cppClass)
@@ -1910,7 +1910,7 @@ void QtDocGenerator::writeDocSnips(QTextStream &s,
QString codeBlock = code.mid(startBlock, endBlock - startBlock);
const QStringList rows = codeBlock.split(QLatin1Char('\n'));
- int currenRow = 0;
+ int currentRow = 0;
int offset = 0;
for (QString row : rows) {
@@ -1918,25 +1918,24 @@ void QtDocGenerator::writeDocSnips(QTextStream &s,
row.remove(invalidString);
if (row.trimmed().size() == 0) {
- if (currenRow == 0)
+ if (currentRow == 0)
continue;
s << endl;
}
- if (currenRow == 0) {
+ if (currentRow == 0) {
//find offset
- for (int i=0, i_max = row.size(); i < i_max; i++) {
- if (row[i] == QLatin1Char(' '))
+ for (auto c : row) {
+ if (c == QLatin1Char(' '))
offset++;
- else if (row[i] == QLatin1Char('\n'))
+ else if (c == QLatin1Char('\n'))
offset = 0;
else
break;
}
}
- row = row.mid(offset);
- s << row << endl;
- currenRow++;
+ s << row.midRef(offset) << endl;
+ currentRow++;
}
code = code.mid(endBlock+endMarkup.size());
@@ -2110,7 +2109,7 @@ void QtDocGenerator::writeFunction(QTextStream& s, const AbstractMetaClass* cppC
static void writeFancyToc(QTextStream& s, const QStringList& items, int cols = 4)
{
- typedef QMap<QChar, QStringList> TocMap;
+ using TocMap = QMap<QChar, QStringList>;
TocMap tocMap;
QChar Q = QLatin1Char('Q');
QChar idx;
diff --git a/sources/shiboken2/generator/qtdoc/qtdocgenerator.h b/sources/shiboken2/generator/qtdoc/qtdocgenerator.h
index 21afd0f49..53e292d22 100644
--- a/sources/shiboken2/generator/qtdoc/qtdocgenerator.h
+++ b/sources/shiboken2/generator/qtdoc/qtdocgenerator.h
@@ -59,21 +59,19 @@ public:
struct TableCell
{
- short rowSpan;
- short colSpan;
+ short rowSpan = 0;
+ short colSpan = 0;
QString data;
- TableCell(const QString& text = QString()) : rowSpan(0), colSpan(0), data(text) {}
- TableCell(const char* text) : rowSpan(0), colSpan(0), data(QLatin1String(text)) {}
+ TableCell(const QString& text = QString()) : data(text) {}
+ TableCell(const char* text) : data(QLatin1String(text)) {}
};
- typedef QList<TableCell> TableRow;
+ using TableRow = QList<TableCell>;
class Table : public QList<TableRow>
{
public:
- Table() : m_hasHeader(false), m_normalized(false)
- {
- }
+ Table() = default;
void enableHeader(bool enable)
{
@@ -98,8 +96,8 @@ public:
}
private:
- bool m_hasHeader;
- bool m_normalized;
+ bool m_hasHeader = false;
+ bool m_normalized = false;
};
QtXmlToSphinx(QtDocGenerator* generator, const QString& doc, const QString& context = QString());
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
index 95f93fd42..104b0a420 100644
--- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
@@ -81,7 +81,7 @@ static const char *typeNameOf(const T &t)
)CPP";
// utility functions
-inline AbstractMetaType* getTypeWithoutContainer(AbstractMetaType* arg)
+inline AbstractMetaType *getTypeWithoutContainer(AbstractMetaType *arg)
{
if (arg && arg->typeEntry()->isContainer()) {
AbstractMetaTypeList lst = arg->instantiations();
@@ -144,25 +144,25 @@ CppGenerator::CppGenerator()
// sequence protocol functions
m_sequenceProtocol.insert(QLatin1String("__len__"),
- {QLatin1String("PyObject* self"),
+ {QLatin1String("PyObject *self"),
QLatin1String("Py_ssize_t")});
m_sequenceProtocol.insert(QLatin1String("__getitem__"),
- {QLatin1String("PyObject* self, Py_ssize_t _i"),
+ {QLatin1String("PyObject *self, Py_ssize_t _i"),
QLatin1String("PyObject*")});
m_sequenceProtocol.insert(QLatin1String("__setitem__"),
- {QLatin1String("PyObject* self, Py_ssize_t _i, PyObject* _value"),
+ {QLatin1String("PyObject *self, Py_ssize_t _i, PyObject *_value"),
QLatin1String("int")});
m_sequenceProtocol.insert(QLatin1String("__getslice__"),
- {QLatin1String("PyObject* self, Py_ssize_t _i1, Py_ssize_t _i2"),
+ {QLatin1String("PyObject *self, Py_ssize_t _i1, Py_ssize_t _i2"),
QLatin1String("PyObject*")});
m_sequenceProtocol.insert(QLatin1String("__setslice__"),
- {QLatin1String("PyObject* self, Py_ssize_t _i1, Py_ssize_t _i2, PyObject* _value"),
+ {QLatin1String("PyObject *self, Py_ssize_t _i1, Py_ssize_t _i2, PyObject *_value"),
QLatin1String("int")});
m_sequenceProtocol.insert(QLatin1String("__contains__"),
- {QLatin1String("PyObject* self, PyObject* _value"),
+ {QLatin1String("PyObject *self, PyObject *_value"),
QLatin1String("int")});
m_sequenceProtocol.insert(QLatin1String("__concat__"),
- {QLatin1String("PyObject* self, PyObject* _other"),
+ {QLatin1String("PyObject *self, PyObject *_other"),
QLatin1String("PyObject*")});
// Sequence protocol structure members names
@@ -176,13 +176,13 @@ CppGenerator::CppGenerator()
// mapping protocol function
m_mappingProtocol.insert(QLatin1String("__mlen__"),
- {QLatin1String("PyObject* self"),
+ {QLatin1String("PyObject *self"),
QLatin1String("Py_ssize_t")});
m_mappingProtocol.insert(QLatin1String("__mgetitem__"),
- {QLatin1String("PyObject* self, PyObject* _key"),
+ {QLatin1String("PyObject *self, PyObject *_key"),
QLatin1String("PyObject*")});
m_mappingProtocol.insert(QLatin1String("__msetitem__"),
- {QLatin1String("PyObject* self, PyObject* _key, PyObject* _value"),
+ {QLatin1String("PyObject *self, PyObject *_key, PyObject *_value"),
QLatin1String("int")});
// Sequence protocol structure members names
@@ -203,19 +203,17 @@ QString CppGenerator::fileNameForContext(GeneratorContext &context) const
QString fileNameBase = metaClass->qualifiedCppName().toLower();
fileNameBase.replace(QLatin1String("::"), QLatin1String("_"));
return fileNameBase + fileNameSuffix();
- } else {
- const AbstractMetaType *smartPointerType = context.preciseType();
- QString fileNameBase = getFileNameBaseForSmartPointer(smartPointerType, metaClass);
- return fileNameBase + fileNameSuffix();
}
+ const AbstractMetaType *smartPointerType = context.preciseType();
+ QString fileNameBase = getFileNameBaseForSmartPointer(smartPointerType, metaClass);
+ return fileNameBase + fileNameSuffix();
}
-QVector<AbstractMetaFunctionList> CppGenerator::filterGroupedOperatorFunctions(const AbstractMetaClass* metaClass,
- uint queryIn)
+QVector<AbstractMetaFunctionList> CppGenerator::filterGroupedOperatorFunctions(const AbstractMetaClass *metaClass,
+ uint queryIn)
{
// ( func_name, num_args ) => func_list
- typedef QMap<QPair<QString, int >, AbstractMetaFunctionList> ResultMap;
- ResultMap results;
+ QMap<QPair<QString, int>, AbstractMetaFunctionList> results;
const AbstractMetaClass::OperatorQueryOptions query(queryIn);
const AbstractMetaFunctionList &funcs = metaClass->operatorOverloads(query);
for (AbstractMetaFunction *func : funcs) {
@@ -237,28 +235,27 @@ QVector<AbstractMetaFunctionList> CppGenerator::filterGroupedOperatorFunctions(c
}
QVector<AbstractMetaFunctionList> result;
result.reserve(results.size());
- for (ResultMap::const_iterator it = results.cbegin(), end = results.cend(); it != end; ++it)
+ for (auto it = results.cbegin(), end = results.cend(); it != end; ++it)
result.append(it.value());
return result;
}
-const AbstractMetaFunction *CppGenerator::boolCast(const AbstractMetaClass* metaClass) const
+const AbstractMetaFunction *CppGenerator::boolCast(const AbstractMetaClass *metaClass) const
{
if (!useIsNullAsNbNonZero())
return nullptr;
// TODO: This could be configurable someday
- const AbstractMetaFunction* func = metaClass->findFunction(QLatin1String("isNull"));
+ const AbstractMetaFunction *func = metaClass->findFunction(QLatin1String("isNull"));
if (!func || !func->type() || !func->type()->typeEntry()->isPrimitive() || !func->isPublic())
return nullptr;
- const PrimitiveTypeEntry* pte = static_cast<const PrimitiveTypeEntry*>(func->type()->typeEntry());
+ auto pte = static_cast<const PrimitiveTypeEntry *>(func->type()->typeEntry());
while (pte->referencedTypeEntry())
pte = pte->referencedTypeEntry();
return func && func->isConstant() && pte->name() == QLatin1String("bool")
&& func->arguments().isEmpty() ? func : nullptr;
}
-typedef QMap<QString, AbstractMetaFunctionList> FunctionGroupMap;
-typedef FunctionGroupMap::const_iterator FunctionGroupMapIt;
+using FunctionGroupMap = QMap<QString, AbstractMetaFunctionList>;
// Prevent ELF symbol qt_version_tag from being generated into the source
static const char includeQDebug[] =
@@ -390,7 +387,7 @@ void CppGenerator::generateClass(QTextStream &s, GeneratorContext &classContext)
// Create string literal for smart pointer getter method.
if (classContext.forSmartPointer()) {
- const SmartPointerTypeEntry *typeEntry =
+ const auto *typeEntry =
static_cast<const SmartPointerTypeEntry *>(classContext.preciseType()
->typeEntry());
QString rawGetter = typeEntry->getter();
@@ -489,7 +486,7 @@ void CppGenerator::generateClass(QTextStream &s, GeneratorContext &classContext)
if (overloads.isEmpty())
continue;
- const AbstractMetaFunction* rfunc = overloads.constFirst();
+ const AbstractMetaFunction *rfunc = overloads.constFirst();
if (m_sequenceProtocol.contains(rfunc->name()) || m_mappingProtocol.contains(rfunc->name()))
continue;
@@ -509,7 +506,7 @@ void CppGenerator::generateClass(QTextStream &s, GeneratorContext &classContext)
else if (!rfunc->isOperatorOverload()) {
if (classContext.forSmartPointer()) {
- const SmartPointerTypeEntry *smartPointerTypeEntry =
+ const auto *smartPointerTypeEntry =
static_cast<const SmartPointerTypeEntry *>(
classContext.preciseType()->typeEntry());
@@ -587,7 +584,7 @@ void CppGenerator::generateClass(QTextStream &s, GeneratorContext &classContext)
if (const AbstractMetaFunction *f = boolCast(metaClass)) {
ErrorCode errorCode(-1);
- s << "static int " << cpythonBaseName(metaClass) << "___nb_bool(PyObject* self)" << endl;
+ s << "static int " << cpythonBaseName(metaClass) << "___nb_bool(PyObject *self)" << endl;
s << '{' << endl;
writeCppSelfDefinition(s, classContext);
if (f->allowThread()) {
@@ -656,7 +653,7 @@ void CppGenerator::generateClass(QTextStream &s, GeneratorContext &classContext)
if (metaField->isStatic())
continue;
- s << INDENT << "{const_cast<char*>(\"" << metaField->name() << "\"), ";
+ s << INDENT << "{const_cast<char *>(\"" << metaField->name() << "\"), ";
s << cpythonGetterFunctionName(metaField) << ", ";
if (canGenerateFieldSetter(metaField))
s << cpythonSetterFunctionName(metaField);
@@ -707,7 +704,7 @@ void CppGenerator::generateClass(QTextStream &s, GeneratorContext &classContext)
}
}
-void CppGenerator::writeConstructorNative(QTextStream& s, const AbstractMetaFunction* func)
+void CppGenerator::writeConstructorNative(QTextStream &s, const AbstractMetaFunction *func)
{
Indentation indentation(INDENT);
s << functionSignature(func, wrapperName(func->ownerClass()) + QLatin1String("::"), QString(),
@@ -715,7 +712,7 @@ void CppGenerator::writeConstructorNative(QTextStream& s, const AbstractMetaFunc
s << " : ";
writeFunctionCall(s, func);
s << endl << "{" << endl;
- const AbstractMetaArgument* lastArg = func->arguments().isEmpty() ? 0 : func->arguments().constLast();
+ const AbstractMetaArgument *lastArg = func->arguments().isEmpty() ? nullptr : func->arguments().constLast();
writeCodeSnips(s, func->injectedCodeSnips(), TypeSystem::CodeSnipPositionBeginning, TypeSystem::NativeCode, func, lastArg);
s << INDENT << "// ... middle" << endl;
writeCodeSnips(s, func->injectedCodeSnips(), TypeSystem::CodeSnipPositionEnd, TypeSystem::NativeCode, func, lastArg);
@@ -727,12 +724,12 @@ void CppGenerator::writeDestructorNative(QTextStream &s, const AbstractMetaClass
Indentation indentation(INDENT);
s << wrapperName(metaClass) << "::~" << wrapperName(metaClass) << "()" << endl << '{' << endl;
// kill pyobject
- s << INDENT << "SbkObject* wrapper = Shiboken::BindingManager::instance().retrieveWrapper(this);" << endl;
+ s << INDENT << "SbkObject *wrapper = Shiboken::BindingManager::instance().retrieveWrapper(this);" << endl;
s << INDENT << "Shiboken::Object::destroy(wrapper, this);" << endl;
s << '}' << endl;
}
-static bool allArgumentsRemoved(const AbstractMetaFunction* func)
+static bool allArgumentsRemoved(const AbstractMetaFunction *func)
{
if (func->arguments().isEmpty())
return false;
@@ -744,7 +741,7 @@ static bool allArgumentsRemoved(const AbstractMetaFunction* func)
return true;
}
-QString CppGenerator::getVirtualFunctionReturnTypeName(const AbstractMetaFunction* func)
+QString CppGenerator::getVirtualFunctionReturnTypeName(const AbstractMetaFunction *func)
{
if (!func->type())
return QLatin1String("\"\"");
@@ -755,12 +752,12 @@ QString CppGenerator::getVirtualFunctionReturnTypeName(const AbstractMetaFunctio
// SbkType would return null when the type is a container.
if (func->type()->typeEntry()->isContainer()) {
return QLatin1Char('"')
- + reinterpret_cast<const ContainerTypeEntry*>(func->type()->typeEntry())->typeName()
+ + reinterpret_cast<const ContainerTypeEntry *>(func->type()->typeEntry())->typeName()
+ QLatin1Char('"');
}
if (avoidProtectedHack()) {
- const AbstractMetaEnum* metaEnum = findAbstractMetaEnum(func->type());
+ const AbstractMetaEnum *metaEnum = findAbstractMetaEnum(func->type());
if (metaEnum && metaEnum->isProtected())
return QLatin1Char('"') + protectedEnumSurrogateName(metaEnum) + QLatin1Char('"');
}
@@ -771,14 +768,14 @@ QString CppGenerator::getVirtualFunctionReturnTypeName(const AbstractMetaFunctio
return QString::fromLatin1("reinterpret_cast<PyTypeObject *>(Shiboken::SbkType< %1 >())->tp_name").arg(func->type()->typeEntry()->qualifiedCppName());
}
-void CppGenerator::writeVirtualMethodNative(QTextStream&s, const AbstractMetaFunction* func)
+void CppGenerator::writeVirtualMethodNative(QTextStream &s, const AbstractMetaFunction *func)
{
//skip metaObject function, this will be written manually ahead
if (usePySideExtensions() && func->ownerClass() && func->ownerClass()->isQObject() &&
((func->name() == QLatin1String("metaObject")) || (func->name() == QLatin1String("qt_metacall"))))
return;
- const TypeEntry* retType = func->type() ? func->type()->typeEntry() : 0;
+ const TypeEntry *retType = func->type() ? func->type()->typeEntry() : nullptr;
const QString funcName = func->isOperatorOverload() ? pythonOperatorFunctionName(func) : func->name();
QString prefix = wrapperName(func->ownerClass()) + QLatin1String("::");
@@ -841,7 +838,7 @@ void CppGenerator::writeVirtualMethodNative(QTextStream&s, const AbstractMetaFun
//Write declaration/native injected code
if (func->hasInjectedCode()) {
CodeSnipList snips = func->injectedCodeSnips();
- const AbstractMetaArgument* lastArg = func->arguments().isEmpty() ? 0 : func->arguments().constLast();
+ const AbstractMetaArgument *lastArg = func->arguments().isEmpty() ? nullptr : func->arguments().constLast();
writeCodeSnips(s, snips, TypeSystem::CodeSnipPositionDeclaration, TypeSystem::NativeCode, func, lastArg);
s << endl;
}
@@ -864,7 +861,7 @@ void CppGenerator::writeVirtualMethodNative(QTextStream&s, const AbstractMetaFun
CodeSnipList snips;
if (func->hasInjectedCode()) {
snips = func->injectedCodeSnips();
- const AbstractMetaArgument* lastArg = func->arguments().isEmpty() ? 0 : func->arguments().constLast();
+ const AbstractMetaArgument *lastArg = func->arguments().isEmpty() ? nullptr : func->arguments().constLast();
writeCodeSnips(s, snips, TypeSystem::CodeSnipPositionBeginning, TypeSystem::ShellCode, func, lastArg);
s << endl;
}
@@ -905,7 +902,7 @@ void CppGenerator::writeVirtualMethodNative(QTextStream&s, const AbstractMetaFun
QString argConv;
QTextStream ac(&argConv);
- const PrimitiveTypeEntry* argType = (const PrimitiveTypeEntry*) arg->type()->typeEntry();
+ auto argType = static_cast<const PrimitiveTypeEntry *>(arg->type()->typeEntry());
bool convert = argType->isObject()
|| argType->isValue()
|| arg->type()->isValuePointer()
@@ -963,9 +960,9 @@ void CppGenerator::writeVirtualMethodNative(QTextStream&s, const AbstractMetaFun
snips = func->injectedCodeSnips();
if (injectedCodeUsesPySelf(func))
- s << INDENT << "PyObject* pySelf = BindingManager::instance().retrieveWrapper(this);" << endl;
+ s << INDENT << "PyObject *pySelf = BindingManager::instance().retrieveWrapper(this);" << endl;
- const AbstractMetaArgument* lastArg = func->arguments().isEmpty() ? 0 : func->arguments().constLast();
+ const AbstractMetaArgument *lastArg = func->arguments().isEmpty() ? nullptr : func->arguments().constLast();
writeCodeSnips(s, snips, TypeSystem::CodeSnipPositionBeginning, TypeSystem::NativeCode, func, lastArg);
s << endl;
}
@@ -1067,14 +1064,14 @@ void CppGenerator::writeVirtualMethodNative(QTextStream&s, const AbstractMetaFun
if (func->hasInjectedCode()) {
s << endl;
- const AbstractMetaArgument* lastArg = func->arguments().isEmpty() ? 0 : func->arguments().constLast();
+ const AbstractMetaArgument *lastArg = func->arguments().isEmpty() ? nullptr : func->arguments().constLast();
writeCodeSnips(s, snips, TypeSystem::CodeSnipPositionEnd, TypeSystem::NativeCode, func, lastArg);
}
if (retType) {
s << INDENT << "return ";
if (avoidProtectedHack() && retType->isEnum()) {
- const AbstractMetaEnum* metaEnum = findAbstractMetaEnum(retType);
+ const AbstractMetaEnum *metaEnum = findAbstractMetaEnum(retType);
bool isProtectedEnum = metaEnum && metaEnum->isProtected();
if (isProtectedEnum) {
QString typeCast;
@@ -1085,29 +1082,29 @@ void CppGenerator::writeVirtualMethodNative(QTextStream&s, const AbstractMetaFun
}
}
if (func->type()->referenceType() == LValueReference && !isPointer(func->type()))
- s << '*';
+ s << " *";
s << CPP_RETURN_VAR << ';' << endl;
}
s << '}' << endl << endl;
}
-void CppGenerator::writeMetaObjectMethod(QTextStream& s, const AbstractMetaClass* metaClass)
+void CppGenerator::writeMetaObjectMethod(QTextStream &s, const AbstractMetaClass *metaClass)
{
Indentation indentation(INDENT);
QString wrapperClassName = wrapperName(metaClass);
- s << "const QMetaObject* " << wrapperClassName << "::metaObject() const" << endl;
+ s << "const QMetaObject *" << wrapperClassName << "::metaObject() const" << endl;
s << '{' << endl;
s << INDENT << "if (QObject::d_ptr->metaObject)" << endl
<< INDENT << INDENT << "return QObject::d_ptr->dynamicMetaObject();" << endl;
- s << INDENT << "SbkObject* pySelf = Shiboken::BindingManager::instance().retrieveWrapper(this);" << endl;
+ s << INDENT << "SbkObject *pySelf = Shiboken::BindingManager::instance().retrieveWrapper(this);" << endl;
s << INDENT << "if (pySelf == nullptr)" << endl;
s << INDENT << INDENT << "return " << metaClass->qualifiedCppName() << "::metaObject();" << endl;
- s << INDENT << "return PySide::SignalManager::retrieveMetaObject(reinterpret_cast<PyObject*>(pySelf));" << endl;
+ s << INDENT << "return PySide::SignalManager::retrieveMetaObject(reinterpret_cast<PyObject *>(pySelf));" << endl;
s << '}' << endl << endl;
// qt_metacall function
- s << "int " << wrapperClassName << "::qt_metacall(QMetaObject::Call call, int id, void** args)" << endl;
+ s << "int " << wrapperClassName << "::qt_metacall(QMetaObject::Call call, int id, void **args)" << endl;
s << "{" << endl;
AbstractMetaFunction *func = nullptr;
@@ -1132,28 +1129,28 @@ void CppGenerator::writeMetaObjectMethod(QTextStream& s, const AbstractMetaClass
writeMetaCast(s, metaClass);
}
-void CppGenerator::writeMetaCast(QTextStream& s, const AbstractMetaClass* metaClass)
+void CppGenerator::writeMetaCast(QTextStream &s, const AbstractMetaClass *metaClass)
{
Indentation indentation(INDENT);
QString wrapperClassName = wrapperName(metaClass);
- s << "void* " << wrapperClassName << "::qt_metacast(const char* _clname)" << endl;
+ s << "void *" << wrapperClassName << "::qt_metacast(const char *_clname)" << endl;
s << '{' << endl;
s << INDENT << "if (!_clname) return {};" << endl;
- s << INDENT << "SbkObject* pySelf = Shiboken::BindingManager::instance().retrieveWrapper(this);" << endl;
+ s << INDENT << "SbkObject *pySelf = Shiboken::BindingManager::instance().retrieveWrapper(this);" << endl;
s << INDENT << "if (pySelf && PySide::inherits(Py_TYPE(pySelf), _clname))" << endl;
- s << INDENT << INDENT << "return static_cast<void*>(const_cast< " << wrapperClassName << "* >(this));" << endl;
+ s << INDENT << INDENT << "return static_cast<void *>(const_cast< " << wrapperClassName << " *>(this));" << endl;
s << INDENT << "return " << metaClass->qualifiedCppName() << "::qt_metacast(_clname);" << endl;
s << "}" << endl << endl;
}
-void CppGenerator::writeEnumConverterFunctions(QTextStream& s, const AbstractMetaEnum* metaEnum)
+void CppGenerator::writeEnumConverterFunctions(QTextStream &s, const AbstractMetaEnum *metaEnum)
{
if (metaEnum->isPrivate() || metaEnum->isAnonymous())
return;
writeEnumConverterFunctions(s, metaEnum->typeEntry());
}
-void CppGenerator::writeEnumConverterFunctions(QTextStream& s, const TypeEntry* enumType)
+void CppGenerator::writeEnumConverterFunctions(QTextStream &s, const TypeEntry *enumType)
{
if (!enumType)
return;
@@ -1161,16 +1158,16 @@ void CppGenerator::writeEnumConverterFunctions(QTextStream& s, const TypeEntry*
QString enumPythonType = cpythonTypeNameExt(enumType);
QString cppTypeName = getFullTypeName(enumType).trimmed();
if (avoidProtectedHack()) {
- const AbstractMetaEnum* metaEnum = findAbstractMetaEnum(enumType);
+ const AbstractMetaEnum *metaEnum = findAbstractMetaEnum(enumType);
if (metaEnum && metaEnum->isProtected())
cppTypeName = protectedEnumSurrogateName(metaEnum);
}
QString code;
QTextStream c(&code);
- c << INDENT << "*reinterpret_cast<" << cppTypeName << "*>(cppOut) =\n"
+ c << INDENT << "*reinterpret_cast<" << cppTypeName << " *>(cppOut) =\n"
<< INDENT << " ";
if (enumType->isFlags())
- c << cppTypeName << "(QFlag(int(PySide::QFlags::getValue(reinterpret_cast<PySideQFlagsObject*>(pyIn)))))";
+ c << cppTypeName << "(QFlag(int(PySide::QFlags::getValue(reinterpret_cast<PySideQFlagsObject *>(pyIn)))))";
else
c << "static_cast<" << cppTypeName << ">(Shiboken::Enum::getValue(pyIn))";
c << ';' << endl;
@@ -1186,7 +1183,7 @@ void CppGenerator::writeEnumConverterFunctions(QTextStream& s, const TypeEntry*
c << INDENT;
c << "return ";
if (enumType->isFlags()) {
- c << "reinterpret_cast<PyObject*>(PySide::QFlags::newObject(castCppIn, "
+ c << "reinterpret_cast<PyObject *>(PySide::QFlags::newObject(castCppIn, "
<< enumPythonType << "))";
} else {
c << "Shiboken::Enum::newItem(" << enumPythonType << ", castCppIn)";
@@ -1198,7 +1195,7 @@ void CppGenerator::writeEnumConverterFunctions(QTextStream& s, const TypeEntry*
if (enumType->isFlags())
return;
- const FlagsTypeEntry* flags = reinterpret_cast<const EnumTypeEntry*>(enumType)->flags();
+ auto flags = reinterpret_cast<const EnumTypeEntry *>(enumType)->flags();
if (!flags)
return;
@@ -1208,7 +1205,7 @@ void CppGenerator::writeEnumConverterFunctions(QTextStream& s, const TypeEntry*
code.clear();
cppTypeName = getFullTypeName(flags).trimmed();
- c << INDENT << "*reinterpret_cast<" << cppTypeName << "*>(cppOut) =\n"
+ c << INDENT << "*reinterpret_cast<" << cppTypeName << " *>(cppOut) =\n"
<< INDENT << " " << cppTypeName
<< "(QFlag(int(Shiboken::Enum::getValue(pyIn))));" << endl;
@@ -1218,7 +1215,7 @@ void CppGenerator::writeEnumConverterFunctions(QTextStream& s, const TypeEntry*
code.clear();
c << INDENT << "Shiboken::AutoDecRef pyLong(PyNumber_Long(pyIn));" << endl;
- c << INDENT << "*reinterpret_cast<" << cppTypeName << "*>(cppOut) =\n"
+ c << INDENT << "*reinterpret_cast<" << cppTypeName << " *>(cppOut) =\n"
<< INDENT << " " << cppTypeName
<< "(QFlag(int(PyLong_AsLong(pyLong.object()))));" << endl;
// PYSIDE-898: Include an additional condition to detect if the type of the
@@ -1270,7 +1267,7 @@ void CppGenerator::writeConverterFunctions(QTextStream &s, const AbstractMetaCla
writePythonToCppFunction(s, code, sourceTypeName, targetTypeName);
// "Is convertible" function for the Python object to C++ pointer conversion.
- const QString pyTypeCheck = QLatin1String("PyObject_TypeCheck(pyIn, reinterpret_cast<PyTypeObject*>(")
+ const QString pyTypeCheck = QLatin1String("PyObject_TypeCheck(pyIn, reinterpret_cast<PyTypeObject *>(")
+ cpythonType + QLatin1String("))");
writeIsPythonConvertibleToCppFunction(s, sourceTypeName, targetTypeName, pyTypeCheck, QString(), true);
s << endl;
@@ -1281,9 +1278,9 @@ void CppGenerator::writeConverterFunctions(QTextStream &s, const AbstractMetaCla
if (usePySideExtensions() && metaClass->isQObject())
{
c << INDENT << "return PySide::getWrapperForQObject(reinterpret_cast<"
- << typeName << "*>(const_cast<void*>(cppIn)), " << cpythonType << ");" << endl;
+ << typeName << " *>(const_cast<void *>(cppIn)), " << cpythonType << ");" << endl;
} else {
- c << INDENT << "auto pyOut = reinterpret_cast<PyObject*>(Shiboken::BindingManager::instance().retrieveWrapper(cppIn));" << endl;
+ c << INDENT << "auto pyOut = reinterpret_cast<PyObject *>(Shiboken::BindingManager::instance().retrieveWrapper(cppIn));" << endl;
c << INDENT << "if (pyOut) {" << endl;
{
Indentation indent(INDENT);
@@ -1300,7 +1297,7 @@ void CppGenerator::writeConverterFunctions(QTextStream &s, const AbstractMetaCla
<< INDENT << " changedTypeName = true;\n"
<< INDENT << " }\n"
<< INDENT << "PyObject *result = Shiboken::Object::newObject(" << cpythonType
- << ", const_cast<void*>(cppIn), false, /* exactType */ changedTypeName, typeName);\n"
+ << ", const_cast<void *>(cppIn), false, /* exactType */ changedTypeName, typeName);\n"
<< INDENT << "if (changedTypeName)\n"
<< INDENT << " delete [] typeName;\n"
<< INDENT << "return result;";
@@ -1333,7 +1330,7 @@ void CppGenerator::writeConverterFunctions(QTextStream &s, const AbstractMetaCla
c << INDENT << "return Shiboken::Object::newObject(" << cpythonType
<< ", new ::" << computedWrapperName << "(*reinterpret_cast<const "
- << typeName << "*>(cppIn)), true, true);";
+ << typeName << " *>(cppIn)), true, true);";
writeCppToPythonFunction(s, code, sourceTypeName, targetTypeName);
s << endl;
@@ -1354,7 +1351,7 @@ void CppGenerator::writeConverterFunctions(QTextStream &s, const AbstractMetaCla
else
wrappedCPtrExpression = cpythonWrapperCPtr(classContext.preciseType(), pyInVariable);
- c << INDENT << "*reinterpret_cast<" << typeName << "*>(cppOut) = *"
+ c << INDENT << "*reinterpret_cast<" << typeName << " *>(cppOut) = *"
<< wrappedCPtrExpression << ';';
writePythonToCppFunction(s, code, sourceTypeName, targetTypeName);
@@ -1363,7 +1360,7 @@ void CppGenerator::writeConverterFunctions(QTextStream &s, const AbstractMetaCla
s << endl;
// User provided implicit conversions.
- CustomConversion* customConversion = metaClass->typeEntry()->customConversion();
+ CustomConversion *customConversion = metaClass->typeEntry()->customConversion();
// Implicit conversions.
AbstractMetaFunctionList implicitConvs;
@@ -1378,8 +1375,8 @@ void CppGenerator::writeConverterFunctions(QTextStream &s, const AbstractMetaCla
if (!implicitConvs.isEmpty())
s << "// Implicit conversions." << endl;
- AbstractMetaType* targetType = buildAbstractMetaTypeFromAbstractMetaClass(metaClass);
- for (const AbstractMetaFunction* conv : qAsConst(implicitConvs)) {
+ AbstractMetaType *targetType = buildAbstractMetaTypeFromAbstractMetaClass(metaClass);
+ for (const AbstractMetaFunction *conv : qAsConst(implicitConvs)) {
if (conv->isModifiedRemoved())
continue;
@@ -1387,14 +1384,14 @@ void CppGenerator::writeConverterFunctions(QTextStream &s, const AbstractMetaCla
QString toCppConv;
QString toCppPreConv;
if (conv->isConversionOperator()) {
- const AbstractMetaClass* sourceClass = conv->ownerClass();
+ const AbstractMetaClass *sourceClass = conv->ownerClass();
typeCheck = QStringLiteral("PyObject_TypeCheck(pyIn, %1)").arg(cpythonTypeNameExt(sourceClass->typeEntry()));
toCppConv = QLatin1Char('*') + cpythonWrapperCPtr(sourceClass->typeEntry(), QLatin1String("pyIn"));
} else {
// Constructor that does implicit conversion.
if (!conv->typeReplaced(1).isEmpty() || conv->isModifiedToArray(1))
continue;
- const AbstractMetaType* sourceType = conv->arguments().constFirst()->type();
+ const AbstractMetaType *sourceType = conv->arguments().constFirst()->type();
typeCheck = cpythonCheckFunction(sourceType);
bool isUserPrimitiveWithoutTargetLangName = isUserPrimitive(sourceType)
&& sourceType->typeEntry()->targetLangApiName() == sourceType->typeEntry()->name();
@@ -1408,7 +1405,7 @@ void CppGenerator::writeConverterFunctions(QTextStream &s, const AbstractMetaCla
if (isWrapperType(sourceType)) {
typeCheck += QLatin1String("pyIn)");
toCppConv = (sourceType->referenceType() == LValueReference || !isPointerToWrapperType(sourceType))
- ? QLatin1String("*") : QString();
+ ? QLatin1String(" *") : QString();
toCppConv += cpythonWrapperCPtr(sourceType->typeEntry(), QLatin1String("pyIn"));
} else if (typeCheck.contains(QLatin1String("%in"))) {
typeCheck.replace(QLatin1String("%in"), QLatin1String("pyIn"));
@@ -1426,7 +1423,7 @@ void CppGenerator::writeConverterFunctions(QTextStream &s, const AbstractMetaCla
pc << INDENT << getFullTypeNameWithoutModifiers(sourceType) << " cppIn";
writeMinimalConstructorExpression(pc, sourceType);
pc << ';' << endl;
- writeToCppConversion(pc, sourceType, 0, QLatin1String("pyIn"), QLatin1String("cppIn"));
+ writeToCppConversion(pc, sourceType, nullptr, QLatin1String("pyIn"), QLatin1String("cppIn"));
pc << ';';
toCppConv.append(QLatin1String("cppIn"));
} else if (!isWrapperType(sourceType)) {
@@ -1436,7 +1433,7 @@ void CppGenerator::writeConverterFunctions(QTextStream &s, const AbstractMetaCla
}
- const AbstractMetaType* sourceType = conv->isConversionOperator()
+ const AbstractMetaType *sourceType = conv->isConversionOperator()
? buildAbstractMetaTypeFromAbstractMetaClass(conv->ownerClass())
: conv->arguments().constFirst()->type();
writePythonToCppConversionFunctions(s, sourceType, targetType, typeCheck, toCppConv, toCppPreConv);
@@ -1445,11 +1442,11 @@ void CppGenerator::writeConverterFunctions(QTextStream &s, const AbstractMetaCla
writeCustomConverterFunctions(s, customConversion);
}
-void CppGenerator::writeCustomConverterFunctions(QTextStream& s, const CustomConversion* customConversion)
+void CppGenerator::writeCustomConverterFunctions(QTextStream &s, const CustomConversion *customConversion)
{
if (!customConversion)
return;
- const CustomConversion::TargetToNativeConversions& toCppConversions = customConversion->targetToNativeConversions();
+ const CustomConversion::TargetToNativeConversions &toCppConversions = customConversion->targetToNativeConversions();
if (toCppConversions.isEmpty())
return;
s << "// Python to C++ conversions for type '" << customConversion->ownerType()->qualifiedCppName() << "'." << endl;
@@ -1464,7 +1461,7 @@ void CppGenerator::writeConverterRegister(QTextStream &s, const AbstractMetaClas
if (metaClass->isNamespace())
return;
s << INDENT << "// Register Converter" << endl;
- s << INDENT << "SbkConverter* converter = Shiboken::Conversions::createConverter(";
+ s << INDENT << "SbkConverter *converter = Shiboken::Conversions::createConverter(";
s << cpythonTypeName(metaClass) << ',' << endl;
{
Indentation indent(INDENT);
@@ -1528,7 +1525,7 @@ void CppGenerator::writeConverterRegister(QTextStream &s, const AbstractMetaClas
writeAddPythonToCppConversion(s, QLatin1String("converter"), toCpp, isConv);
// User provided implicit conversions.
- CustomConversion* customConversion = metaClass->typeEntry()->customConversion();
+ CustomConversion *customConversion = metaClass->typeEntry()->customConversion();
// Add implicit conversions.
AbstractMetaFunctionList implicitConvs;
@@ -1543,11 +1540,11 @@ void CppGenerator::writeConverterRegister(QTextStream &s, const AbstractMetaClas
if (!implicitConvs.isEmpty())
s << INDENT << "// Add implicit conversions to type converter." << endl;
- AbstractMetaType* targetType = buildAbstractMetaTypeFromAbstractMetaClass(metaClass);
+ AbstractMetaType *targetType = buildAbstractMetaTypeFromAbstractMetaClass(metaClass);
for (const AbstractMetaFunction *conv : qAsConst(implicitConvs)) {
if (conv->isModifiedRemoved())
continue;
- const AbstractMetaType* sourceType;
+ const AbstractMetaType *sourceType;
if (conv->isConversionOperator()) {
sourceType = buildAbstractMetaTypeFromAbstractMetaClass(conv->ownerClass());
} else {
@@ -1564,11 +1561,11 @@ void CppGenerator::writeConverterRegister(QTextStream &s, const AbstractMetaClas
writeCustomConverterRegister(s, customConversion, QLatin1String("converter"));
}
-void CppGenerator::writeCustomConverterRegister(QTextStream& s, const CustomConversion* customConversion, const QString& converterVar)
+void CppGenerator::writeCustomConverterRegister(QTextStream &s, const CustomConversion *customConversion, const QString &converterVar)
{
if (!customConversion)
return;
- const CustomConversion::TargetToNativeConversions& toCppConversions = customConversion->targetToNativeConversions();
+ const CustomConversion::TargetToNativeConversions &toCppConversions = customConversion->targetToNativeConversions();
if (toCppConversions.isEmpty())
return;
s << INDENT << "// Add user defined implicit conversions to type converter." << endl;
@@ -1579,7 +1576,7 @@ void CppGenerator::writeCustomConverterRegister(QTextStream& s, const CustomConv
}
}
-void CppGenerator::writeContainerConverterFunctions(QTextStream& s, const AbstractMetaType* containerType)
+void CppGenerator::writeContainerConverterFunctions(QTextStream &s, const AbstractMetaType *containerType)
{
writeCppToPythonFunction(s, containerType);
writePythonToCppConversionFunctions(s, containerType);
@@ -1588,8 +1585,8 @@ void CppGenerator::writeContainerConverterFunctions(QTextStream& s, const Abstra
void CppGenerator::writeMethodWrapperPreamble(QTextStream &s, OverloadData &overloadData,
GeneratorContext &context)
{
- const AbstractMetaFunction* rfunc = overloadData.referenceFunction();
- const AbstractMetaClass* ownerClass = rfunc->ownerClass();
+ const AbstractMetaFunction *rfunc = overloadData.referenceFunction();
+ const AbstractMetaClass *ownerClass = rfunc->ownerClass();
int minArgs = overloadData.minArgs();
int maxArgs = overloadData.maxArgs();
bool initPythonArguments;
@@ -1619,7 +1616,7 @@ void CppGenerator::writeMethodWrapperPreamble(QTextStream &s, OverloadData &over
} else {
s << context.preciseType()->cppSignature();
}
- s << "* cptr{};" << endl;
+ s << " *cptr{};" << endl;
initPythonArguments = maxArgs > 0;
usesNamedArguments = !ownerClass->isQObject() && overloadData.hasArgumentWithDefaultValue();
@@ -1630,7 +1627,7 @@ void CppGenerator::writeMethodWrapperPreamble(QTextStream &s, OverloadData &over
writeCppSelfDefinition(s, rfunc, context, overloadData.hasStaticFunction());
}
if (!rfunc->isInplaceOperator() && overloadData.hasNonVoidReturnType())
- s << INDENT << "PyObject* " << PYTHON_RETURN_VAR << "{};" << endl;
+ s << INDENT << "PyObject *" << PYTHON_RETURN_VAR << "{};" << endl;
initPythonArguments = minArgs != maxArgs || maxArgs > 1;
usesNamedArguments = rfunc->isCallOperator() || overloadData.hasArgumentWithDefaultValue();
@@ -1662,17 +1659,17 @@ void CppGenerator::writeMethodWrapperPreamble(QTextStream &s, OverloadData &over
}
}
-void CppGenerator::writeConstructorWrapper(QTextStream &s, const AbstractMetaFunctionList overloads,
+void CppGenerator::writeConstructorWrapper(QTextStream &s, const AbstractMetaFunctionList &overloads,
GeneratorContext &classContext)
{
ErrorCode errorCode(-1);
OverloadData overloadData(overloads, this);
- const AbstractMetaFunction* rfunc = overloadData.referenceFunction();
- const AbstractMetaClass* metaClass = rfunc->ownerClass();
+ const AbstractMetaFunction *rfunc = overloadData.referenceFunction();
+ const AbstractMetaClass *metaClass = rfunc->ownerClass();
s << "static int" << endl;
- s << cpythonFunctionName(rfunc) << "(PyObject* self, PyObject* args, PyObject* kwds)" << endl;
+ s << cpythonFunctionName(rfunc) << "(PyObject *self, PyObject *args, PyObject *kwds)" << endl;
s << '{' << endl;
QSet<QString> argNamesSet;
@@ -1690,19 +1687,19 @@ void CppGenerator::writeConstructorWrapper(QTextStream &s, const AbstractMetaFun
QStringList argNamesList = argNamesSet.values();
std::sort(argNamesList.begin(), argNamesList.end());
if (argNamesList.isEmpty()) {
- s << INDENT << "const char** argNames{};" << endl;
+ s << INDENT << "const char **argNames{};" << endl;
} else {
- s << INDENT << "const char* argNames[] = {\""
+ s << INDENT << "const char *argNames[] = {\""
<< argNamesList.join(QLatin1String("\", \"")) << "\"};" << endl;
}
- s << INDENT << "const QMetaObject* metaObject;" << endl;
+ s << INDENT << "const QMetaObject *metaObject;" << endl;
}
- s << INDENT << "SbkObject* sbkSelf = reinterpret_cast<SbkObject*>(self);" << endl;
+ s << INDENT << "SbkObject *sbkSelf = reinterpret_cast<SbkObject *>(self);" << endl;
if (metaClass->isAbstract() || metaClass->baseClassNames().size() > 1) {
- s << INDENT << "SbkObjectType* type = reinterpret_cast<SbkObjectType*>(self->ob_type);" << endl;
- s << INDENT << "SbkObjectType* myType = reinterpret_cast<SbkObjectType*>(" << cpythonTypeNameExt(metaClass->typeEntry()) << ");" << endl;
+ s << INDENT << "SbkObjectType *type = reinterpret_cast<SbkObjectType *>(self->ob_type);" << endl;
+ s << INDENT << "SbkObjectType *myType = reinterpret_cast<SbkObjectType *>(" << cpythonTypeNameExt(metaClass->typeEntry()) << ");" << endl;
}
if (metaClass->isAbstract()) {
@@ -1823,20 +1820,20 @@ void CppGenerator::writeConstructorWrapper(QTextStream &s, const AbstractMetaFun
s << '}' << endl << endl;
}
-void CppGenerator::writeMethodWrapper(QTextStream &s, const AbstractMetaFunctionList overloads,
+void CppGenerator::writeMethodWrapper(QTextStream &s, const AbstractMetaFunctionList &overloads,
GeneratorContext &classContext)
{
OverloadData overloadData(overloads, this);
- const AbstractMetaFunction* rfunc = overloadData.referenceFunction();
+ const AbstractMetaFunction *rfunc = overloadData.referenceFunction();
int maxArgs = overloadData.maxArgs();
- s << "static PyObject* ";
- s << cpythonFunctionName(rfunc) << "(PyObject* self";
+ s << "static PyObject *";
+ s << cpythonFunctionName(rfunc) << "(PyObject *self";
if (maxArgs > 0) {
- s << ", PyObject* " << (pythonFunctionWrapperUsesListOfArguments(overloadData) ? "args" : PYTHON_ARG);
+ s << ", PyObject *" << (pythonFunctionWrapperUsesListOfArguments(overloadData) ? "args" : PYTHON_ARG);
if (overloadData.hasArgumentWithDefaultValue() || rfunc->isCallOperator())
- s << ", PyObject* kwds";
+ s << ", PyObject *kwds";
}
s << ')' << endl << '{' << endl;
@@ -1868,17 +1865,17 @@ void CppGenerator::writeMethodWrapper(QTextStream &s, const AbstractMetaFunction
Indentation indent(INDENT);
s << INDENT << "&& Shiboken::Object::checkType(" << PYTHON_ARG << ")" << endl;
s << INDENT << "&& !PyObject_TypeCheck(" << PYTHON_ARG << ", self->ob_type)" << endl;
- s << INDENT << "&& PyObject_HasAttrString(" << PYTHON_ARG << ", const_cast<char*>(\"" << revOpName << "\"))) {" << endl;
+ s << INDENT << "&& PyObject_HasAttrString(" << PYTHON_ARG << ", const_cast<char *>(\"" << revOpName << "\"))) {" << endl;
// This PyObject_CallMethod call will emit lots of warnings like
// "deprecated conversion from string constant to char *" during compilation
- // due to the method name argument being declared as "char*" instead of "const char*"
+ // due to the method name argument being declared as "char *" instead of "const char *"
// issue 6952 http://bugs.python.org/issue6952
- s << INDENT << "PyObject* revOpMethod = PyObject_GetAttrString(" << PYTHON_ARG << ", const_cast<char*>(\"" << revOpName << "\"));" << endl;
+ s << INDENT << "PyObject *revOpMethod = PyObject_GetAttrString(" << PYTHON_ARG << ", const_cast<char *>(\"" << revOpName << "\"));" << endl;
s << INDENT << "if (revOpMethod && PyCallable_Check(revOpMethod)) {" << endl;
{
Indentation indent(INDENT);
- s << INDENT << PYTHON_RETURN_VAR << " = PyObject_CallFunction(revOpMethod, const_cast<char*>(\"O\"), self);" << endl;
+ s << INDENT << PYTHON_RETURN_VAR << " = PyObject_CallFunction(revOpMethod, const_cast<char *>(\"O\"), self);" << endl;
s << INDENT << "if (PyErr_Occurred() && (PyErr_ExceptionMatches(PyExc_NotImplementedError)";
s << " || PyErr_ExceptionMatches(PyExc_AttributeError))) {" << endl;
{
@@ -1927,16 +1924,16 @@ void CppGenerator::writeMethodWrapper(QTextStream &s, const AbstractMetaFunction
s << '}' << endl << endl;
}
-void CppGenerator::writeArgumentsInitializer(QTextStream& s, OverloadData& overloadData)
+void CppGenerator::writeArgumentsInitializer(QTextStream &s, OverloadData &overloadData)
{
- const AbstractMetaFunction* rfunc = overloadData.referenceFunction();
+ const AbstractMetaFunction *rfunc = overloadData.referenceFunction();
s << "PyTuple_GET_SIZE(args);" << endl;
writeUnusedVariableCast(s, QLatin1String("numArgs"));
int minArgs = overloadData.minArgs();
int maxArgs = overloadData.maxArgs();
- s << INDENT << "PyObject* ";
+ s << INDENT << "PyObject *";
s << PYTHON_ARGS << "[] = {"
<< QString(maxArgs, QLatin1Char('0')).split(QLatin1String(""), QString::SkipEmptyParts).join(QLatin1String(", "))
<< "};" << endl;
@@ -1947,7 +1944,7 @@ void CppGenerator::writeArgumentsInitializer(QTextStream& s, OverloadData& overl
if (minArgs > maxArgs)
minArgs = maxArgs;
- s << INDENT << "PyObject* nonvarargs = PyTuple_GetSlice(args, 0, " << maxArgs << ");" << endl;
+ s << INDENT << "PyObject *nonvarargs = PyTuple_GetSlice(args, 0, " << maxArgs << ");" << endl;
s << INDENT << "Shiboken::AutoDecRef auto_nonvarargs(nonvarargs);" << endl;
s << INDENT << PYTHON_ARGS << '[' << maxArgs << "] = PyTuple_GetSlice(args, " << maxArgs << ", numArgs);" << endl;
s << INDENT << "Shiboken::AutoDecRef auto_varargs(" << PYTHON_ARGS << "[" << maxArgs << "]);" << endl;
@@ -2025,10 +2022,10 @@ void CppGenerator::writeCppSelfAssigment(QTextStream &s, const GeneratorContext
{
static const QString pythonSelfVar = QLatin1String("self");
if (cppSelfAsReference)
- s << className << "& ";
+ s << className << " &";
s << CPP_SELF_VAR << " = ";
if (cppSelfAsReference)
- s << '*';
+ s << " *";
if (useWrapperClass)
s << "static_cast<" << className << " *>(";
if (!context.forSmartPointer())
@@ -2056,7 +2053,7 @@ void CppGenerator::writeCppSelfDefinition(QTextStream &s,
}
if (!cppSelfAsReference) {
- s << INDENT << className << "* " << CPP_SELF_VAR << " = nullptr;" << endl;
+ s << INDENT << className << " *" << CPP_SELF_VAR << " = nullptr;" << endl;
writeUnusedVariableCast(s, QLatin1String(CPP_SELF_VAR));
}
@@ -2103,9 +2100,9 @@ void CppGenerator::writeCppSelfDefinition(QTextStream &s,
writeCppSelfDefinition(s, context, hasStaticOverload);
}
-void CppGenerator::writeErrorSection(QTextStream& s, OverloadData& overloadData)
+void CppGenerator::writeErrorSection(QTextStream &s, OverloadData &overloadData)
{
- const AbstractMetaFunction* rfunc = overloadData.referenceFunction();
+ const AbstractMetaFunction *rfunc = overloadData.referenceFunction();
s << endl << INDENT << cpythonFunctionName(rfunc) << "_TypeError:" << endl;
Indentation indentation(INDENT);
QString funcName = fullPythonFunctionName(rfunc);
@@ -2116,7 +2113,7 @@ void CppGenerator::writeErrorSection(QTextStream& s, OverloadData& overloadData)
s << INDENT << "return " << m_currentErrorCode << ';' << endl;
}
-void CppGenerator::writeFunctionReturnErrorCheckSection(QTextStream& s, bool hasReturnValue)
+void CppGenerator::writeFunctionReturnErrorCheckSection(QTextStream &s, bool hasReturnValue)
{
s << INDENT << "if (PyErr_Occurred()";
if (hasReturnValue)
@@ -2131,14 +2128,14 @@ void CppGenerator::writeFunctionReturnErrorCheckSection(QTextStream& s, bool has
s << INDENT << '}' << endl;
}
-void CppGenerator::writeInvalidPyObjectCheck(QTextStream& s, const QString& pyObj)
+void CppGenerator::writeInvalidPyObjectCheck(QTextStream &s, const QString &pyObj)
{
s << INDENT << "if (!Shiboken::Object::isValid(" << pyObj << "))" << endl;
Indentation indent(INDENT);
s << INDENT << returnStatement(m_currentErrorCode) << endl;
}
-static QString pythonToCppConverterForArgumentName(const QString& argumentName)
+static QString pythonToCppConverterForArgumentName(const QString &argumentName)
{
static const QRegularExpression pyArgsRegex(QLatin1String(PYTHON_ARGS)
+ QLatin1String(R"((\[\d+[-]?\d*\]))"));
@@ -2150,11 +2147,13 @@ static QString pythonToCppConverterForArgumentName(const QString& argumentName)
return result;
}
-void CppGenerator::writeTypeCheck(QTextStream& s, const AbstractMetaType* argType, QString argumentName, bool isNumber, QString customType, bool rejectNull)
+void CppGenerator::writeTypeCheck(QTextStream &s, const AbstractMetaType *argType,
+ const QString &argumentName, bool isNumber,
+ const QString &customType, bool rejectNull)
{
QString customCheck;
if (!customType.isEmpty()) {
- AbstractMetaType* metaType;
+ AbstractMetaType *metaType;
customCheck = guessCPythonCheckFunction(customType, &metaType);
if (metaType)
argType = metaType;
@@ -2182,7 +2181,7 @@ void CppGenerator::writeTypeCheck(QTextStream& s, const AbstractMetaType* argTyp
s << typeCheck;
}
-static void checkTypeViability(const AbstractMetaFunction* func, const AbstractMetaType* type, int argIdx)
+static void checkTypeViability(const AbstractMetaFunction *func, const AbstractMetaType *type, int argIdx)
{
if (!type
|| !type->typeEntry()->isPrimitive()
@@ -2209,25 +2208,25 @@ static void checkTypeViability(const AbstractMetaFunction* func, const AbstractM
qCWarning(lcShiboken).noquote().nospace() << message;
}
-static void checkTypeViability(const AbstractMetaFunction* func)
+static void checkTypeViability(const AbstractMetaFunction *func)
{
if (func->isUserAdded())
return;
- const AbstractMetaType* type = func->type();
+ const AbstractMetaType *type = func->type();
checkTypeViability(func, type, 0);
for (int i = 0; i < func->arguments().count(); ++i)
checkTypeViability(func, func->arguments().at(i)->type(), i + 1);
}
-void CppGenerator::writeTypeCheck(QTextStream& s, const OverloadData* overloadData, QString argumentName)
+void CppGenerator::writeTypeCheck(QTextStream &s, const OverloadData *overloadData, QString argumentName)
{
- QSet<const TypeEntry*> numericTypes;
+ QSet<const TypeEntry *> numericTypes;
const OverloadDataList &overloads = overloadData->previousOverloadData()->nextOverloadData();
for (OverloadData *od : overloads) {
const OverloadData::MetaFunctionList &odOverloads = od->overloads();
for (const AbstractMetaFunction *func : odOverloads) {
checkTypeViability(func);
- const AbstractMetaType* argType = od->argument(func)->type();
+ const AbstractMetaType *argType = od->argument(func)->type();
if (!argType->isPrimitive())
continue;
if (ShibokenGenerator::isNumber(argType->typeEntry()))
@@ -2237,18 +2236,18 @@ void CppGenerator::writeTypeCheck(QTextStream& s, const OverloadData* overloadDa
// This condition trusts that the OverloadData object will arrange for
// PyInt type to come after the more precise numeric types (e.g. float and bool)
- const AbstractMetaType* argType = overloadData->argType();
+ const AbstractMetaType *argType = overloadData->argType();
bool numberType = numericTypes.count() == 1 || ShibokenGenerator::isPyInt(argType);
QString customType = (overloadData->hasArgumentTypeReplace() ? overloadData->argumentTypeReplaced() : QString());
bool rejectNull = shouldRejectNullPointerArgument(overloadData->referenceFunction(), overloadData->argPos());
writeTypeCheck(s, argType, argumentName, numberType, customType, rejectNull);
}
-void CppGenerator::writeArgumentConversion(QTextStream& s,
- const AbstractMetaType* argType,
- const QString& argName, const QString& pyArgName,
- const AbstractMetaClass* context,
- const QString& defaultValue,
+void CppGenerator::writeArgumentConversion(QTextStream &s,
+ const AbstractMetaType *argType,
+ const QString &argName, const QString &pyArgName,
+ const AbstractMetaClass *context,
+ const QString &defaultValue,
bool castArgumentAsUnused)
{
if (argType->typeEntry()->isCustom() || argType->typeEntry()->isVarargs())
@@ -2260,15 +2259,15 @@ void CppGenerator::writeArgumentConversion(QTextStream& s,
writeUnusedVariableCast(s, argName);
}
-const AbstractMetaType* CppGenerator::getArgumentType(const AbstractMetaFunction* func, int argPos)
+const AbstractMetaType *CppGenerator::getArgumentType(const AbstractMetaFunction *func, int argPos)
{
if (argPos < 0 || argPos > func->arguments().size()) {
qCWarning(lcShiboken).noquote().nospace()
<< QStringLiteral("Argument index for function '%1' out of range.").arg(func->signature());
- return 0;
+ return nullptr;
}
- const AbstractMetaType* argType = 0;
+ const AbstractMetaType *argType = nullptr;
QString typeReplaced = func->typeReplaced(argPos);
if (typeReplaced.isEmpty())
argType = (argPos == 0) ? func->type() : func->arguments().at(argPos-1)->type();
@@ -2300,14 +2299,14 @@ static inline QString arrayHandleType(const AbstractMetaTypeCList &nestedArrayTy
return QString();
}
-void CppGenerator::writePythonToCppTypeConversion(QTextStream& s,
- const AbstractMetaType* type,
- const QString& pyIn,
- const QString& cppOut,
- const AbstractMetaClass* /* context */,
- const QString& defaultValue)
+void CppGenerator::writePythonToCppTypeConversion(QTextStream &s,
+ const AbstractMetaType *type,
+ const QString &pyIn,
+ const QString &cppOut,
+ const AbstractMetaClass * /* context */,
+ const QString &defaultValue)
{
- const TypeEntry* typeEntry = type->typeEntry();
+ const TypeEntry *typeEntry = type->typeEntry();
if (typeEntry->isCustom() || typeEntry->isVarargs())
return;
@@ -2336,7 +2335,7 @@ void CppGenerator::writePythonToCppTypeConversion(QTextStream& s,
writeMinimalConstructorExpression(s, type, defaultValue);
s << ';' << endl;
} else if (avoidProtectedHack() && type->typeEntry()->isEnum()) {
- const AbstractMetaEnum* metaEnum = findAbstractMetaEnum(type);
+ const AbstractMetaEnum *metaEnum = findAbstractMetaEnum(type);
if (metaEnum && metaEnum->isProtected()) {
typeName = QLatin1String("long");
isProtectedEnum = true;
@@ -2347,11 +2346,11 @@ void CppGenerator::writePythonToCppTypeConversion(QTextStream& s,
if (isCppPrimitiveArray) {
s << ' ' << cppOut;
} else if (treatAsPointer || isPointerOrObjectType) {
- s << "* " << cppOut;
+ s << " *" << cppOut;
if (!defaultValue.isEmpty())
s << " = " << defaultValue;
} else if (type->referenceType() == LValueReference && !typeEntry->isPrimitive() && isNotContainerEnumOrFlags) {
- s << "* " << cppOut << " = &" << cppOutAux;
+ s << " *" << cppOut << " = &" << cppOutAux;
} else {
s << ' ' << cppOut;
if (isProtectedEnum && avoidProtectedHack()) {
@@ -2400,11 +2399,11 @@ void CppGenerator::writePythonToCppTypeConversion(QTextStream& s,
s << endl;
}
-static void addConversionRuleCodeSnippet(CodeSnipList& snippetList, QString& rule,
+static void addConversionRuleCodeSnippet(CodeSnipList &snippetList, QString &rule,
TypeSystem::Language /* conversionLanguage */,
TypeSystem::Language snippetLanguage,
- QString outputName = QString(),
- QString inputName = QString())
+ const QString &outputName = QString(),
+ const QString &inputName = QString())
{
if (rule.isEmpty())
return;
@@ -2420,7 +2419,7 @@ static void addConversionRuleCodeSnippet(CodeSnipList& snippetList, QString& rul
snippetList << snip;
}
-void CppGenerator::writeConversionRule(QTextStream& s, const AbstractMetaFunction* func, TypeSystem::Language language)
+void CppGenerator::writeConversionRule(QTextStream &s, const AbstractMetaFunction *func, TypeSystem::Language language)
{
CodeSnipList snippets;
const AbstractMetaArgumentList &arguments = func->arguments();
@@ -2432,7 +2431,7 @@ void CppGenerator::writeConversionRule(QTextStream& s, const AbstractMetaFunctio
writeCodeSnips(s, snippets, TypeSystem::CodeSnipPositionBeginning, TypeSystem::TargetLangCode, func);
}
-void CppGenerator::writeConversionRule(QTextStream& s, const AbstractMetaFunction* func, TypeSystem::Language language, const QString& outputVar)
+void CppGenerator::writeConversionRule(QTextStream &s, const AbstractMetaFunction *func, TypeSystem::Language language, const QString &outputVar)
{
CodeSnipList snippets;
QString rule = func->conversionRule(language, 0);
@@ -2440,7 +2439,7 @@ void CppGenerator::writeConversionRule(QTextStream& s, const AbstractMetaFunctio
writeCodeSnips(s, snippets, TypeSystem::CodeSnipPositionAny, language, func);
}
-void CppGenerator::writeNoneReturn(QTextStream& s, const AbstractMetaFunction* func, bool thereIsReturnValue)
+void CppGenerator::writeNoneReturn(QTextStream &s, const AbstractMetaFunction *func, bool thereIsReturnValue)
{
if (thereIsReturnValue && (!func->type() || func->argumentRemoved(0)) && !injectedCodeHasReturnValueAttribution(func)) {
s << INDENT << PYTHON_RETURN_VAR << " = Py_None;" << endl;
@@ -2448,10 +2447,10 @@ void CppGenerator::writeNoneReturn(QTextStream& s, const AbstractMetaFunction* f
}
}
-void CppGenerator::writeOverloadedFunctionDecisor(QTextStream& s, const OverloadData& overloadData)
+void CppGenerator::writeOverloadedFunctionDecisor(QTextStream &s, const OverloadData &overloadData)
{
s << INDENT << "// Overloaded function decisor" << endl;
- const AbstractMetaFunction* rfunc = overloadData.referenceFunction();
+ const AbstractMetaFunction *rfunc = overloadData.referenceFunction();
const OverloadData::MetaFunctionList &functionOverloads = overloadData.overloadsWithoutRepetition();
for (int i = 0; i < functionOverloads.count(); i++) {
const auto func = functionOverloads.at(i);
@@ -2482,10 +2481,10 @@ void CppGenerator::writeOverloadedFunctionDecisor(QTextStream& s, const Overload
s << endl;
}
-void CppGenerator::writeOverloadedFunctionDecisorEngine(QTextStream& s, const OverloadData* parentOverloadData)
+void CppGenerator::writeOverloadedFunctionDecisorEngine(QTextStream &s, const OverloadData *parentOverloadData)
{
bool hasDefaultCall = parentOverloadData->nextArgumentHasDefaultValue();
- const AbstractMetaFunction* referenceFunction = parentOverloadData->referenceFunction();
+ const AbstractMetaFunction *referenceFunction = parentOverloadData->referenceFunction();
// If the next argument has not an argument with a default value, it is still possible
// that one of the overloads for the current overload data has its final occurrence here.
@@ -2513,17 +2512,18 @@ void CppGenerator::writeOverloadedFunctionDecisorEngine(QTextStream& s, const Ov
s << "; // " << referenceFunction->minimalSignature() << endl;
return;
+ }
// To decide if a method call is possible at this point the current overload
// data object cannot be the head, since it is just an entry point, or a root,
// for the tree of arguments and it does not represent a valid method call.
- } else if (!parentOverloadData->isHeadOverloadData()) {
+ if (!parentOverloadData->isHeadOverloadData()) {
bool isLastArgument = parentOverloadData->nextOverloadData().isEmpty();
bool signatureFound = parentOverloadData->overloads().size() == 1;
// The current overload data describes the last argument of a signature,
// so the method can be identified right now.
if (isLastArgument || (signatureFound && !hasDefaultCall)) {
- const AbstractMetaFunction* func = parentOverloadData->referenceFunction();
+ const AbstractMetaFunction *func = parentOverloadData->referenceFunction();
s << INDENT << "overloadId = " << parentOverloadData->headOverloadData()->overloads().indexOf(func);
s << "; // " << func->minimalSignature() << endl;
return;
@@ -2542,9 +2542,9 @@ void CppGenerator::writeOverloadedFunctionDecisorEngine(QTextStream& s, const Ov
s << INDENT << "if (numArgs == " << numArgs << ") {" << endl;
{
Indentation indent(INDENT);
- const AbstractMetaFunction* func = referenceFunction;
+ const AbstractMetaFunction *func = referenceFunction;
for (OverloadData *overloadData : overloads) {
- const AbstractMetaFunction* defValFunc = overloadData->getFunctionWithDefaultValue();
+ const AbstractMetaFunction *defValFunc = overloadData->getFunctionWithDefaultValue();
if (defValFunc) {
func = defValFunc;
break;
@@ -2561,14 +2561,14 @@ void CppGenerator::writeOverloadedFunctionDecisorEngine(QTextStream& s, const Ov
&& !overloadData->getFunctionWithDefaultValue()
&& !overloadData->findNextArgWithDefault();
- const AbstractMetaFunction* refFunc = overloadData->referenceFunction();
+ const AbstractMetaFunction *refFunc = overloadData->referenceFunction();
QStringList typeChecks;
QString pyArgName = (usePyArgs && maxArgs > 1)
? pythonArgsAt(overloadData->argPos())
: QLatin1String(PYTHON_ARG);
- OverloadData* od = overloadData;
+ OverloadData *od = overloadData;
int startArg = od->argPos();
int sequenceArgCount = 0;
while (od && !od->argType()->isVarargs()) {
@@ -2578,11 +2578,11 @@ void CppGenerator::writeOverloadedFunctionDecisorEngine(QTextStream& s, const Ov
pyArgName = pythonArgsAt(od->argPos());
QString typeCheck;
QTextStream tck(&typeCheck);
- const AbstractMetaFunction* func = od->referenceFunction();
+ const AbstractMetaFunction *func = od->referenceFunction();
if (func->isConstructor() && func->arguments().count() == 1) {
- const AbstractMetaClass* ownerClass = func->ownerClass();
- const ComplexTypeEntry* baseContainerType = ownerClass->typeEntry()->baseContainerType();
+ const AbstractMetaClass *ownerClass = func->ownerClass();
+ const ComplexTypeEntry *baseContainerType = ownerClass->typeEntry()->baseContainerType();
if (baseContainerType && baseContainerType == func->arguments().constFirst()->type()->typeEntry() && isCopyable(ownerClass)) {
tck << '!' << cpythonCheckFunction(ownerClass->typeEntry()) << pyArgName << ')' << endl;
Indentation indent(INDENT);
@@ -2600,7 +2600,7 @@ void CppGenerator::writeOverloadedFunctionDecisorEngine(QTextStream& s, const Ov
|| od->nextOverloadData().size() != 1
|| od->overloads().size() != od->nextOverloadData().constFirst()->overloads().size()) {
overloadData = od;
- od = 0;
+ od = nullptr;
} else {
od = od->nextOverloadData().constFirst();
}
@@ -2655,7 +2655,7 @@ void CppGenerator::writeFunctionCalls(QTextStream &s, const OverloadData &overlo
writeSingleFunctionCall(s, overloadData, overloads.constFirst(), context);
} else {
for (int i = 0; i < overloads.count(); i++) {
- const AbstractMetaFunction* func = overloads.at(i);
+ const AbstractMetaFunction *func = overloads.at(i);
s << INDENT << "case " << i << ": // " << func->signature() << endl;
s << INDENT << '{' << endl;
{
@@ -2705,7 +2705,7 @@ void CppGenerator::writeSingleFunctionCall(QTextStream &s,
int removedArgs = 0;
for (int argIdx = 0; argIdx < func->arguments().count(); ++argIdx) {
bool hasConversionRule = !func->conversionRule(TypeSystem::NativeCode, argIdx + 1).isEmpty();
- const AbstractMetaArgument* arg = func->arguments().at(argIdx);
+ const AbstractMetaArgument *arg = func->arguments().at(argIdx);
if (func->argumentRemoved(argIdx + 1)) {
if (!arg->defaultValueExpression().isEmpty()) {
const QString cppArgRemoved = QLatin1String(CPP_ARG_REMOVED)
@@ -2724,7 +2724,7 @@ void CppGenerator::writeSingleFunctionCall(QTextStream &s,
}
if (hasConversionRule)
continue;
- const AbstractMetaType* argType = getArgumentType(func, argIdx + 1);
+ const AbstractMetaType *argType = getArgumentType(func, argIdx + 1);
if (!argType || (mayHaveUnunsedArguments && !injectedCodeUsesArgument(func, argIdx)))
continue;
int argPos = argIdx - removedArgs;
@@ -2748,72 +2748,72 @@ void CppGenerator::writeSingleFunctionCall(QTextStream &s,
s << INDENT << '}' << endl;
}
-QString CppGenerator::cppToPythonFunctionName(const QString& sourceTypeName, QString targetTypeName)
+QString CppGenerator::cppToPythonFunctionName(const QString &sourceTypeName, QString targetTypeName)
{
if (targetTypeName.isEmpty())
targetTypeName = sourceTypeName;
return QString::fromLatin1("%1_CppToPython_%2").arg(sourceTypeName, targetTypeName);
}
-QString CppGenerator::pythonToCppFunctionName(const QString& sourceTypeName, const QString& targetTypeName)
+QString CppGenerator::pythonToCppFunctionName(const QString &sourceTypeName, const QString &targetTypeName)
{
return QString::fromLatin1("%1_PythonToCpp_%2").arg(sourceTypeName, targetTypeName);
}
-QString CppGenerator::pythonToCppFunctionName(const AbstractMetaType* sourceType, const AbstractMetaType* targetType)
+QString CppGenerator::pythonToCppFunctionName(const AbstractMetaType *sourceType, const AbstractMetaType *targetType)
{
return pythonToCppFunctionName(fixedCppTypeName(sourceType), fixedCppTypeName(targetType));
}
-QString CppGenerator::pythonToCppFunctionName(const CustomConversion::TargetToNativeConversion* toNative,
- const TypeEntry* targetType)
+QString CppGenerator::pythonToCppFunctionName(const CustomConversion::TargetToNativeConversion *toNative,
+ const TypeEntry *targetType)
{
return pythonToCppFunctionName(fixedCppTypeName(toNative), fixedCppTypeName(targetType));
}
-QString CppGenerator::convertibleToCppFunctionName(const QString& sourceTypeName, const QString& targetTypeName)
+QString CppGenerator::convertibleToCppFunctionName(const QString &sourceTypeName, const QString &targetTypeName)
{
return QString::fromLatin1("is_%1_PythonToCpp_%2_Convertible").arg(sourceTypeName, targetTypeName);
}
-QString CppGenerator::convertibleToCppFunctionName(const AbstractMetaType* sourceType, const AbstractMetaType* targetType)
+QString CppGenerator::convertibleToCppFunctionName(const AbstractMetaType *sourceType, const AbstractMetaType *targetType)
{
return convertibleToCppFunctionName(fixedCppTypeName(sourceType), fixedCppTypeName(targetType));
}
-QString CppGenerator::convertibleToCppFunctionName(const CustomConversion::TargetToNativeConversion* toNative,
- const TypeEntry* targetType)
+QString CppGenerator::convertibleToCppFunctionName(const CustomConversion::TargetToNativeConversion *toNative,
+ const TypeEntry *targetType)
{
return convertibleToCppFunctionName(fixedCppTypeName(toNative), fixedCppTypeName(targetType));
}
-void CppGenerator::writeCppToPythonFunction(QTextStream& s, const QString& code, const QString& sourceTypeName, QString targetTypeName)
+void CppGenerator::writeCppToPythonFunction(QTextStream &s, const QString &code, const QString &sourceTypeName, QString targetTypeName)
{
QString prettyCode;
QTextStream c(&prettyCode);
formatCode(c, code, INDENT);
processCodeSnip(prettyCode);
- s << "static PyObject* " << cppToPythonFunctionName(sourceTypeName, targetTypeName);
- s << "(const void* cppIn) {" << endl;
+ s << "static PyObject *" << cppToPythonFunctionName(sourceTypeName, targetTypeName);
+ s << "(const void *cppIn) {" << endl;
s << prettyCode;
s << '}' << endl;
}
-static void replaceCppToPythonVariables(QString& code, const QString& typeName)
+static void replaceCppToPythonVariables(QString &code, const QString &typeName)
{
code.prepend(QLatin1String("auto &cppInRef = *reinterpret_cast<")
- + typeName + QLatin1String("*>(const_cast<void *>(cppIn));\n"));
+ + typeName + QLatin1String(" *>(const_cast<void *>(cppIn));\n"));
code.replace(QLatin1String("%INTYPE"), typeName);
- code.replace(QLatin1String("%OUTTYPE"), QLatin1String("PyObject*"));
+ code.replace(QLatin1String("%OUTTYPE"), QLatin1String("PyObject *"));
code.replace(QLatin1String("%in"), QLatin1String("cppInRef"));
code.replace(QLatin1String("%out"), QLatin1String("pyOut"));
}
-void CppGenerator::writeCppToPythonFunction(QTextStream& s, const CustomConversion* customConversion)
+void CppGenerator::writeCppToPythonFunction(QTextStream &s, const CustomConversion *customConversion)
{
QString code = customConversion->nativeToTargetConversion();
replaceCppToPythonVariables(code, getFullTypeName(customConversion->ownerType()));
writeCppToPythonFunction(s, code, fixedCppTypeName(customConversion->ownerType()));
}
-void CppGenerator::writeCppToPythonFunction(QTextStream& s, const AbstractMetaType* containerType)
+void CppGenerator::writeCppToPythonFunction(QTextStream &s, const AbstractMetaType *containerType)
{
- const CustomConversion* customConversion = containerType->typeEntry()->customConversion();
+ const CustomConversion *customConversion = containerType->typeEntry()->customConversion();
if (!customConversion) {
qFatal("Can't write the C++ to Python conversion function for container type '%s' - "\
"no conversion rule was defined for it in the type system.",
@@ -2825,7 +2825,7 @@ void CppGenerator::writeCppToPythonFunction(QTextStream& s, const AbstractMetaTy
}
QString code = customConversion->nativeToTargetConversion();
for (int i = 0; i < containerType->instantiations().count(); ++i) {
- AbstractMetaType* type = containerType->instantiations().at(i);
+ AbstractMetaType *type = containerType->instantiations().at(i);
QString typeName = getFullTypeName(type);
if (type->isConstant())
typeName = QLatin1String("const ") + typeName;
@@ -2836,22 +2836,22 @@ void CppGenerator::writeCppToPythonFunction(QTextStream& s, const AbstractMetaTy
writeCppToPythonFunction(s, code, fixedCppTypeName(containerType));
}
-void CppGenerator::writePythonToCppFunction(QTextStream& s, const QString& code, const QString& sourceTypeName, const QString& targetTypeName)
+void CppGenerator::writePythonToCppFunction(QTextStream &s, const QString &code, const QString &sourceTypeName, const QString &targetTypeName)
{
QString prettyCode;
QTextStream c(&prettyCode);
formatCode(c, code, INDENT);
processCodeSnip(prettyCode);
s << "static void " << pythonToCppFunctionName(sourceTypeName, targetTypeName);
- s << "(PyObject* pyIn, void* cppOut) {" << endl;
+ s << "(PyObject *pyIn, void *cppOut) {" << endl;
s << prettyCode;
s << '}' << endl;
}
-void CppGenerator::writeIsPythonConvertibleToCppFunction(QTextStream& s,
- const QString& sourceTypeName,
- const QString& targetTypeName,
- const QString& condition,
+void CppGenerator::writeIsPythonConvertibleToCppFunction(QTextStream &s,
+ const QString &sourceTypeName,
+ const QString &targetTypeName,
+ const QString &condition,
QString pythonToCppFuncName,
bool acceptNoneAsCppNull)
{
@@ -2859,7 +2859,7 @@ void CppGenerator::writeIsPythonConvertibleToCppFunction(QTextStream& s,
pythonToCppFuncName = pythonToCppFunctionName(sourceTypeName, targetTypeName);
s << "static PythonToCppFunc " << convertibleToCppFunctionName(sourceTypeName, targetTypeName);
- s << "(PyObject* pyIn) {" << endl;
+ s << "(PyObject *pyIn) {" << endl;
if (acceptNoneAsCppNull) {
s << INDENT << "if (pyIn == Py_None)" << endl;
Indentation indent(INDENT);
@@ -2874,12 +2874,12 @@ void CppGenerator::writeIsPythonConvertibleToCppFunction(QTextStream& s,
s << '}' << endl;
}
-void CppGenerator::writePythonToCppConversionFunctions(QTextStream& s,
- const AbstractMetaType* sourceType,
- const AbstractMetaType* targetType,
+void CppGenerator::writePythonToCppConversionFunctions(QTextStream &s,
+ const AbstractMetaType *sourceType,
+ const AbstractMetaType *targetType,
QString typeCheck,
QString conversion,
- QString preConversion)
+ const QString &preConversion)
{
QString sourcePyType = cpythonTypeNameExt(sourceType);
@@ -2891,7 +2891,7 @@ void CppGenerator::writePythonToCppConversionFunctions(QTextStream& s,
if (!preConversion.isEmpty())
c << INDENT << preConversion << endl;
const QString fullTypeName = getFullTypeName(targetType->typeEntry());
- c << INDENT << "*reinterpret_cast<" << fullTypeName << "*>(cppOut) = "
+ c << INDENT << "*reinterpret_cast<" << fullTypeName << " *>(cppOut) = "
<< fullTypeName << '(' << conversion << ");";
QString sourceTypeName = fixedCppTypeName(sourceType);
QString targetTypeName = fixedCppTypeName(targetType);
@@ -2904,9 +2904,9 @@ void CppGenerator::writePythonToCppConversionFunctions(QTextStream& s,
s << endl;
}
-void CppGenerator::writePythonToCppConversionFunctions(QTextStream& s,
- const CustomConversion::TargetToNativeConversion* toNative,
- const TypeEntry* targetType)
+void CppGenerator::writePythonToCppConversionFunctions(QTextStream &s,
+ const CustomConversion::TargetToNativeConversion *toNative,
+ const TypeEntry *targetType)
{
// Python to C++ conversion function.
QString code = toNative->conversion();
@@ -2919,7 +2919,7 @@ void CppGenerator::writePythonToCppConversionFunctions(QTextStream& s,
code.replace(QLatin1String("%OUTTYPE"), targetType->qualifiedCppName());
code.replace(QLatin1String("%in"), QLatin1String("pyIn"));
code.replace(QLatin1String("%out"),
- QLatin1String("*reinterpret_cast<") + getFullTypeName(targetType) + QLatin1String("*>(cppOut)"));
+ QLatin1String("*reinterpret_cast<") + getFullTypeName(targetType) + QLatin1String(" *>(cppOut)"));
QString sourceTypeName = fixedCppTypeName(toNative);
QString targetTypeName = fixedCppTypeName(targetType);
@@ -2956,14 +2956,14 @@ void CppGenerator::writePythonToCppConversionFunctions(QTextStream& s,
writeIsPythonConvertibleToCppFunction(s, sourceTypeName, targetTypeName, typeCheck);
}
-void CppGenerator::writePythonToCppConversionFunctions(QTextStream& s, const AbstractMetaType* containerType)
+void CppGenerator::writePythonToCppConversionFunctions(QTextStream &s, const AbstractMetaType *containerType)
{
- const CustomConversion* customConversion = containerType->typeEntry()->customConversion();
+ const CustomConversion *customConversion = containerType->typeEntry()->customConversion();
if (!customConversion) {
//qFatal
return;
}
- const CustomConversion::TargetToNativeConversions& toCppConversions = customConversion->targetToNativeConversions();
+ const CustomConversion::TargetToNativeConversions &toCppConversions = customConversion->targetToNativeConversions();
if (toCppConversions.isEmpty()) {
//qFatal
return;
@@ -2973,10 +2973,10 @@ void CppGenerator::writePythonToCppConversionFunctions(QTextStream& s, const Abs
QString code;
QTextStream c(&code);
c << INDENT << "auto &cppOutRef = *reinterpret_cast<"
- << cppTypeName << "*>(cppOut);\n";
+ << cppTypeName << " *>(cppOut);\n";
code.append(toCppConversions.constFirst()->conversion());
for (int i = 0; i < containerType->instantiations().count(); ++i) {
- const AbstractMetaType* type = containerType->instantiations().at(i);
+ const AbstractMetaType *type = containerType->instantiations().at(i);
QString typeName = getFullTypeName(type);
if (type->isValue() && isValueTypeWithCopyConstructorOnly(type)) {
for (int pos = 0; ; ) {
@@ -2989,7 +2989,7 @@ void CppGenerator::writePythonToCppConversionFunctions(QTextStream& s, const Abs
rightCode.replace(varName, QLatin1Char('*') + varName);
code.replace(pos, code.size() - pos, rightCode);
}
- typeName.append(QLatin1Char('*'));
+ typeName.append(QLatin1String(" *"));
}
code.replace(QString::fromLatin1("%OUTTYPE_%1").arg(i), typeName);
}
@@ -3009,7 +3009,7 @@ void CppGenerator::writePythonToCppConversionFunctions(QTextStream& s, const Abs
s << endl;
}
-void CppGenerator::writeAddPythonToCppConversion(QTextStream& s, const QString& converterVar, const QString& pythonToCppFunc, const QString& isConvertibleFunc)
+void CppGenerator::writeAddPythonToCppConversion(QTextStream &s, const QString &converterVar, const QString &pythonToCppFunc, const QString &isConvertibleFunc)
{
s << INDENT << "Shiboken::Conversions::addPythonToCppValueConversion(" << converterVar << ',' << endl;
{
@@ -3020,7 +3020,7 @@ void CppGenerator::writeAddPythonToCppConversion(QTextStream& s, const QString&
s << ");" << endl;
}
-void CppGenerator::writeNamedArgumentResolution(QTextStream& s, const AbstractMetaFunction* func, bool usePyArgs)
+void CppGenerator::writeNamedArgumentResolution(QTextStream &s, const AbstractMetaFunction *func, bool usePyArgs)
{
const AbstractMetaArgumentList &args = OverloadData::getArgumentsWithDefaultValues(func);
if (args.isEmpty())
@@ -3032,7 +3032,7 @@ void CppGenerator::writeNamedArgumentResolution(QTextStream& s, const AbstractMe
s << INDENT << "if (kwds) {" << endl;
{
Indentation indent(INDENT);
- s << INDENT << "PyObject* ";
+ s << INDENT << "PyObject *";
for (const AbstractMetaArgument *arg : args) {
int pyArgIndex = arg->argumentIndex() - OverloadData::numberOfRemovedArguments(func, arg->argumentIndex());
QString pyArgName = usePyArgs ? pythonArgsAt(pyArgIndex) : QLatin1String(PYTHON_ARG);
@@ -3063,9 +3063,9 @@ void CppGenerator::writeNamedArgumentResolution(QTextStream& s, const AbstractMe
s << INDENT << '}' << endl;
}
-QString CppGenerator::argumentNameFromIndex(const AbstractMetaFunction* func, int argIndex, const AbstractMetaClass** wrappedClass)
+QString CppGenerator::argumentNameFromIndex(const AbstractMetaFunction *func, int argIndex, const AbstractMetaClass **wrappedClass)
{
- *wrappedClass = 0;
+ *wrappedClass = nullptr;
QString pyArgName;
if (argIndex == -1) {
pyArgName = QLatin1String("self");
@@ -3086,7 +3086,7 @@ QString CppGenerator::argumentNameFromIndex(const AbstractMetaFunction* func, in
}
} else {
int realIndex = argIndex - 1 - OverloadData::numberOfRemovedArguments(func, argIndex - 1);
- AbstractMetaType* argType = getTypeWithoutContainer(func->arguments().at(realIndex)->type());
+ AbstractMetaType *argType = getTypeWithoutContainer(func->arguments().at(realIndex)->type());
if (argType) {
*wrappedClass = AbstractMetaClass::findClass(classes(), argType->typeEntry());
@@ -3120,14 +3120,14 @@ void CppGenerator::writeMethodCall(QTextStream &s, const AbstractMetaFunction *f
const CodeSnipList &snips = func->injectedCodeSnips();
for (const CodeSnip &cs : snips) {
if (cs.position == TypeSystem::CodeSnipPositionEnd) {
- s << INDENT << "overloadId = " << func->ownerClass()->functions().indexOf(const_cast<AbstractMetaFunction* const>(func)) << ';' << endl;
+ s << INDENT << "overloadId = " << func->ownerClass()->functions().indexOf(const_cast<AbstractMetaFunction *const>(func)) << ';' << endl;
break;
}
}
}
if (func->isAbstract()) {
- s << INDENT << "if (Shiboken::Object::hasCppWrapper(reinterpret_cast<SbkObject*>(self))) {\n";
+ s << INDENT << "if (Shiboken::Object::hasCppWrapper(reinterpret_cast<SbkObject *>(self))) {\n";
{
Indentation indent(INDENT);
s << INDENT << "PyErr_SetString(PyExc_NotImplementedError, \"pure virtual method '";
@@ -3138,7 +3138,7 @@ void CppGenerator::writeMethodCall(QTextStream &s, const AbstractMetaFunction *f
}
// Used to provide contextual information to custom code writer function.
- const AbstractMetaArgument* lastArg = 0;
+ const AbstractMetaArgument *lastArg = nullptr;
CodeSnipList snips;
if (func->hasInjectedCode()) {
@@ -3169,7 +3169,7 @@ void CppGenerator::writeMethodCall(QTextStream &s, const AbstractMetaFunction *f
if (func->functionType() != AbstractMetaFunction::CopyConstructorFunction) {
int removedArgs = 0;
for (int i = 0; i < maxArgs + removedArgs; i++) {
- const AbstractMetaArgument* arg = func->arguments().at(i);
+ const AbstractMetaArgument *arg = func->arguments().at(i);
bool hasConversionRule = !func->conversionRule(TypeSystem::NativeCode, arg->argumentIndex() + 1).isEmpty();
if (func->argumentRemoved(i + 1)) {
// If some argument with default value is removed from a
@@ -3207,7 +3207,7 @@ void CppGenerator::writeMethodCall(QTextStream &s, const AbstractMetaFunction *f
bool otherArgsModified = false;
bool argsClear = true;
for (int i = func->arguments().size() - 1; i >= maxArgs + removedArgs; i--) {
- const AbstractMetaArgument* arg = func->arguments().at(i);
+ const AbstractMetaArgument *arg = func->arguments().at(i);
const bool defValModified = arg->hasModifiedDefaultValueExpression();
bool hasConversionRule = !func->conversionRule(TypeSystem::NativeCode, arg->argumentIndex() + 1).isEmpty();
if (argsClear && !defValModified && !hasConversionRule)
@@ -3269,7 +3269,7 @@ void CppGenerator::writeMethodCall(QTextStream &s, const AbstractMetaFunction *f
} else {
QString ctorCall = className + QLatin1Char('(') + userArgs.join(QLatin1String(", ")) + QLatin1Char(')');
if (usePySideExtensions() && func->ownerClass()->isQObject()) {
- s << INDENT << "void* addr = PySide::nextQObjectMemoryAddr();" << endl;
+ s << INDENT << "void *addr = PySide::nextQObjectMemoryAddr();" << endl;
uva << "if (addr) {" << endl;
{
Indentation indent(INDENT);
@@ -3318,15 +3318,15 @@ void CppGenerator::writeMethodCall(QTextStream &s, const AbstractMetaFunction *f
: QLatin1String("reinterpret_cast<") + wrapperName(func->ownerClass())
+ QLatin1String(" *>(") + QLatin1String(CPP_SELF_VAR) + QLatin1Char(')');
mc << wrapperName(func->ownerClass());
- mc << "*>(" << selfWrapCast << ")->";
+ mc << " *>(" << selfWrapCast << ")->";
}
else {
mc << methodCallClassName;
- mc << "*>(" << selfVarCast << ")->";
+ mc << " *>(" << selfVarCast << ")->";
}
} else {
mc << "const_cast<const ::" << methodCallClassName;
- mc << "*>(" << selfVarCast << ")->";
+ mc << " *>(" << selfVarCast << ")->";
}
} else {
mc << selfVarCast << "->";
@@ -3342,7 +3342,7 @@ void CppGenerator::writeMethodCall(QTextStream &s, const AbstractMetaFunction *f
const auto *owner = func->ownerClass();
const bool directInheritance = context.metaClass() == owner;
mc << (directInheritance ? "static_cast" : "reinterpret_cast")
- << "<::" << wrapperName(owner) << "*>(" << CPP_SELF_VAR << ")->";
+ << "<::" << wrapperName(owner) << " *>(" << CPP_SELF_VAR << ")->";
}
if (!func->isAbstract())
@@ -3364,7 +3364,7 @@ void CppGenerator::writeMethodCall(QTextStream &s, const AbstractMetaFunction *f
methodCallClassName);
normalCall.remove(QLatin1String("::%CLASS_NAME::"));
methodCall.clear();
- mc << "Shiboken::Object::hasCppWrapper(reinterpret_cast<SbkObject*>(self)) ? ";
+ mc << "Shiboken::Object::hasCppWrapper(reinterpret_cast<SbkObject *>(self)) ? ";
mc << virtualCall << " : " << normalCall;
}
}
@@ -3391,7 +3391,7 @@ void CppGenerator::writeMethodCall(QTextStream &s, const AbstractMetaFunction *f
} else if (func->type() && !func->isInplaceOperator()) {
bool writeReturnType = true;
if (avoidProtectedHack()) {
- const AbstractMetaEnum* metaEnum = findAbstractMetaEnum(func->type());
+ const AbstractMetaEnum *metaEnum = findAbstractMetaEnum(func->type());
if (metaEnum) {
QString enumName;
if (metaEnum->isProtected())
@@ -3475,7 +3475,7 @@ void CppGenerator::writeMethodCall(QTextStream &s, const AbstractMetaFunction *f
if (!ownership_mods.isEmpty()) {
s << endl << INDENT << "// Ownership transferences." << endl;
for (const ArgumentModification &arg_mod : qAsConst(ownership_mods)) {
- const AbstractMetaClass* wrappedClass = 0;
+ const AbstractMetaClass *wrappedClass = nullptr;
QString pyArgName = argumentNameFromIndex(func, arg_mod.index, &wrappedClass);
if (!wrappedClass) {
s << "#error Invalid ownership modification for argument " << arg_mod.index << '(' << pyArgName << ')' << endl << endl;
@@ -3513,7 +3513,7 @@ void CppGenerator::writeMethodCall(QTextStream &s, const AbstractMetaFunction *f
qCWarning(lcShiboken) << "\"set\", \"add\" and \"remove\" are the only values supported by Shiboken for action attribute of reference-count tag.";
continue;
}
- const AbstractMetaClass* wrappedClass = 0;
+ const AbstractMetaClass *wrappedClass = nullptr;
QString pyArgName;
if (refCount.action == ReferenceCount::Remove) {
@@ -3531,7 +3531,7 @@ void CppGenerator::writeMethodCall(QTextStream &s, const AbstractMetaFunction *f
else
s << INDENT << "Shiboken::Object::removeReference(";
- s << "reinterpret_cast<SbkObject*>(self), \"";
+ s << "reinterpret_cast<SbkObject *>(self), \"";
QString varName = arg_mod.referenceCounts.constFirst().varName;
if (varName.isEmpty())
varName = func->minimalSignature() + QString::number(arg_mod.index);
@@ -3547,7 +3547,7 @@ void CppGenerator::writeMethodCall(QTextStream &s, const AbstractMetaFunction *f
writeParentChildManagement(s, func, !hasReturnPolicy);
}
-QStringList CppGenerator::getAncestorMultipleInheritance(const AbstractMetaClass* metaClass)
+QStringList CppGenerator::getAncestorMultipleInheritance(const AbstractMetaClass *metaClass)
{
QStringList result;
const AbstractMetaClassList &baseClases = getBaseClasses(metaClass);
@@ -3555,13 +3555,13 @@ QStringList CppGenerator::getAncestorMultipleInheritance(const AbstractMetaClass
for (const AbstractMetaClass *baseClass : baseClases) {
QString offset;
QTextStream(&offset) << "reinterpret_cast<uintptr_t>(static_cast<const "
- << baseClass->qualifiedCppName() << "*>(class_ptr)) - base";
+ << baseClass->qualifiedCppName() << " *>(class_ptr)) - base";
result.append(offset);
offset.clear();
QTextStream(&offset) << "reinterpret_cast<uintptr_t>(static_cast<const "
- << baseClass->qualifiedCppName() << "*>(static_cast<const "
+ << baseClass->qualifiedCppName() << " *>(static_cast<const "
<< metaClass->qualifiedCppName()
- << "*>(static_cast<const void*>(class_ptr)))) - base";
+ << " *>(static_cast<const void *>(class_ptr)))) - base";
result.append(offset);
}
@@ -3571,7 +3571,7 @@ QStringList CppGenerator::getAncestorMultipleInheritance(const AbstractMetaClass
return result;
}
-void CppGenerator::writeMultipleInheritanceInitializerFunction(QTextStream& s, const AbstractMetaClass* metaClass)
+void CppGenerator::writeMultipleInheritanceInitializerFunction(QTextStream &s, const AbstractMetaClass *metaClass)
{
QString className = metaClass->qualifiedCppName();
const QStringList ancestors = getAncestorMultipleInheritance(metaClass);
@@ -3579,14 +3579,14 @@ void CppGenerator::writeMultipleInheritanceInitializerFunction(QTextStream& s, c
for (int i = 0; i < ancestors.size(); i++)
s << "-1, ";
s << "-1 };" << endl;
- s << "int*" << endl;
- s << multipleInheritanceInitializerFunctionName(metaClass) << "(const void* cptr)" << endl;
+ s << "int *" << endl;
+ s << multipleInheritanceInitializerFunctionName(metaClass) << "(const void *cptr)" << endl;
s << '{' << endl;
s << INDENT << "if (mi_offsets[0] == -1) {" << endl;
{
Indentation indent(INDENT);
s << INDENT << "std::set<int> offsets;" << endl;
- s << INDENT << "const auto* class_ptr = reinterpret_cast<const " << className << "*>(cptr);" << endl;
+ s << INDENT << "const auto *class_ptr = reinterpret_cast<const " << className << " *>(cptr);" << endl;
s << INDENT << "const auto base = reinterpret_cast<uintptr_t>(class_ptr);" << endl;
for (const QString &ancestor : ancestors)
@@ -3603,27 +3603,27 @@ void CppGenerator::writeMultipleInheritanceInitializerFunction(QTextStream& s, c
s << '}' << endl;
}
-void CppGenerator::writeSpecialCastFunction(QTextStream& s, const AbstractMetaClass* metaClass)
+void CppGenerator::writeSpecialCastFunction(QTextStream &s, const AbstractMetaClass *metaClass)
{
QString className = metaClass->qualifiedCppName();
- s << "static void* " << cpythonSpecialCastFunctionName(metaClass) << "(void* obj, SbkObjectType* desiredType)\n";
+ s << "static void * " << cpythonSpecialCastFunctionName(metaClass) << "(void *obj, SbkObjectType *desiredType)\n";
s << "{\n";
- s << INDENT << className << "* me = reinterpret_cast< ::" << className << "*>(obj);\n";
+ s << INDENT << "auto me = reinterpret_cast< ::" << className << " *>(obj);\n";
bool firstClass = true;
const AbstractMetaClassList &allAncestors = getAllAncestors(metaClass);
for (const AbstractMetaClass *baseClass : allAncestors) {
- s << INDENT << (!firstClass ? "else " : "") << "if (desiredType == reinterpret_cast<SbkObjectType*>(" << cpythonTypeNameExt(baseClass->typeEntry()) << "))\n";
+ s << INDENT << (!firstClass ? "else " : "") << "if (desiredType == reinterpret_cast<SbkObjectType *>(" << cpythonTypeNameExt(baseClass->typeEntry()) << "))\n";
Indentation indent(INDENT);
- s << INDENT << "return static_cast< ::" << baseClass->qualifiedCppName() << "*>(me);\n";
+ s << INDENT << "return static_cast< ::" << baseClass->qualifiedCppName() << " *>(me);\n";
firstClass = false;
}
s << INDENT << "return me;\n";
s << "}\n\n";
}
-void CppGenerator::writePrimitiveConverterInitialization(QTextStream& s, const CustomConversion* customConversion)
+void CppGenerator::writePrimitiveConverterInitialization(QTextStream &s, const CustomConversion *customConversion)
{
- const TypeEntry* type = customConversion->ownerType();
+ const TypeEntry *type = customConversion->ownerType();
QString converter = converterObject(type);
s << INDENT << "// Register converter for type '" << type->qualifiedTargetLangName() << "'." << endl;
s << INDENT << converter << " = Shiboken::Conversions::createConverter(";
@@ -3639,30 +3639,30 @@ void CppGenerator::writePrimitiveConverterInitialization(QTextStream& s, const C
writeCustomConverterRegister(s, customConversion, converter);
}
-void CppGenerator::writeEnumConverterInitialization(QTextStream& s, const AbstractMetaEnum* metaEnum)
+void CppGenerator::writeEnumConverterInitialization(QTextStream &s, const AbstractMetaEnum *metaEnum)
{
if (metaEnum->isPrivate() || metaEnum->isAnonymous())
return;
writeEnumConverterInitialization(s, metaEnum->typeEntry());
}
-void CppGenerator::writeEnumConverterInitialization(QTextStream& s, const TypeEntry* enumType)
+void CppGenerator::writeEnumConverterInitialization(QTextStream &s, const TypeEntry *enumType)
{
if (!enumType)
return;
QString enumFlagName = enumType->isFlags() ? QLatin1String("flag") : QLatin1String("enum");
QString enumPythonType = cpythonTypeNameExt(enumType);
- const FlagsTypeEntry* flags = 0;
+ const FlagsTypeEntry *flags = nullptr;
if (enumType->isFlags())
- flags = static_cast<const FlagsTypeEntry*>(enumType);
+ flags = static_cast<const FlagsTypeEntry *>(enumType);
s << INDENT << "// Register converter for " << enumFlagName << " '" << enumType->qualifiedCppName() << "'." << endl;
s << INDENT << '{' << endl;
{
Indentation indent(INDENT);
QString typeName = fixedCppTypeName(enumType);
- s << INDENT << "SbkConverter* converter = Shiboken::Conversions::createConverter(" << enumPythonType << ',' << endl;
+ s << INDENT << "SbkConverter *converter = Shiboken::Conversions::createConverter(" << enumPythonType << ',' << endl;
{
Indentation indent(INDENT);
s << INDENT << cppToPythonFunctionName(typeName, typeName) << ");" << endl;
@@ -3714,10 +3714,10 @@ void CppGenerator::writeEnumConverterInitialization(QTextStream& s, const TypeEn
s << INDENT << '}' << endl;
if (!flags)
- writeEnumConverterInitialization(s, static_cast<const EnumTypeEntry*>(enumType)->flags());
+ writeEnumConverterInitialization(s, static_cast<const EnumTypeEntry *>(enumType)->flags());
}
-void CppGenerator::writeContainerConverterInitialization(QTextStream& s, const AbstractMetaType* type)
+void CppGenerator::writeContainerConverterInitialization(QTextStream &s, const AbstractMetaType *type)
{
QByteArray cppSignature = QMetaObject::normalizedSignature(type->cppSignature().toUtf8());
s << INDENT << "// Register converter for type '" << cppSignature << "'." << endl;
@@ -3744,8 +3744,8 @@ void CppGenerator::writeContainerConverterInitialization(QTextStream& s, const A
writeAddPythonToCppConversion(s, converterObject(type), toCpp, isConv);
}
-void CppGenerator::writeExtendedConverterInitialization(QTextStream& s, const TypeEntry* externalType,
- const QVector<const AbstractMetaClass*>& conversions)
+void CppGenerator::writeExtendedConverterInitialization(QTextStream &s, const TypeEntry *externalType,
+ const QVector<const AbstractMetaClass *>& conversions)
{
s << INDENT << "// Extended implicit conversions for " << externalType->qualifiedTargetLangName() << '.' << endl;
for (const AbstractMetaClass *sourceClass : conversions) {
@@ -3760,16 +3760,14 @@ void CppGenerator::writeExtendedConverterInitialization(QTextStream& s, const Ty
}
}
-QString CppGenerator::multipleInheritanceInitializerFunctionName(const AbstractMetaClass* metaClass)
+QString CppGenerator::multipleInheritanceInitializerFunctionName(const AbstractMetaClass *metaClass)
{
return cpythonBaseName(metaClass->typeEntry()) + QLatin1String("_mi_init");
}
-typedef QHash<QString, QPair<QString, QString> >::const_iterator ProtocolIt;
-
-bool CppGenerator::supportsMappingProtocol(const AbstractMetaClass* metaClass)
+bool CppGenerator::supportsMappingProtocol(const AbstractMetaClass *metaClass)
{
- for (ProtocolIt it = m_mappingProtocol.cbegin(), end = m_mappingProtocol.cend(); it != end; ++it) {
+ for (auto it = m_mappingProtocol.cbegin(), end = m_mappingProtocol.cend(); it != end; ++it) {
if (metaClass->hasFunction(it.key()))
return true;
}
@@ -3777,7 +3775,7 @@ bool CppGenerator::supportsMappingProtocol(const AbstractMetaClass* metaClass)
return false;
}
-bool CppGenerator::supportsNumberProtocol(const AbstractMetaClass* metaClass)
+bool CppGenerator::supportsNumberProtocol(const AbstractMetaClass *metaClass)
{
return metaClass->hasArithmeticOperatorOverload()
|| metaClass->hasLogicalOperatorOverload()
@@ -3785,18 +3783,18 @@ bool CppGenerator::supportsNumberProtocol(const AbstractMetaClass* metaClass)
|| hasBoolCast(metaClass);
}
-bool CppGenerator::supportsSequenceProtocol(const AbstractMetaClass* metaClass)
+bool CppGenerator::supportsSequenceProtocol(const AbstractMetaClass *metaClass)
{
- for (ProtocolIt it = m_sequenceProtocol.cbegin(), end = m_sequenceProtocol.cend(); it != end; ++it) {
+ for (auto it = m_sequenceProtocol.cbegin(), end = m_sequenceProtocol.cend(); it != end; ++it) {
if (metaClass->hasFunction(it.key()))
return true;
}
- const ComplexTypeEntry* baseType = metaClass->typeEntry()->baseContainerType();
+ const ComplexTypeEntry *baseType = metaClass->typeEntry()->baseContainerType();
return baseType && baseType->isContainer();
}
-bool CppGenerator::shouldGenerateGetSetList(const AbstractMetaClass* metaClass)
+bool CppGenerator::shouldGenerateGetSetList(const AbstractMetaClass *metaClass)
{
const AbstractMetaFieldList &fields = metaClass->fields();
for (const AbstractMetaField *f : fields) {
@@ -3824,7 +3822,7 @@ QTextStream &operator<<(QTextStream &str, const pyTypeSlotEntry &e)
if (e.m_function.isEmpty())
str << NULL_PTR;
else
- str << "reinterpret_cast<void*>(" << e.m_function << ')';
+ str << "reinterpret_cast<void *>(" << e.m_function << ')';
str << "},\n";
return str;
}
@@ -3850,7 +3848,7 @@ void CppGenerator::writeClassDefinition(QTextStream &s,
}
if (!metaClass->baseClass())
- baseClassName = QLatin1String("reinterpret_cast<PyTypeObject*>(SbkObject_TypeF())");
+ baseClassName = QLatin1String("reinterpret_cast<PyTypeObject *>(SbkObject_TypeF())");
bool onlyPrivCtor = !metaClass->hasNonPrivateConstructor();
@@ -3937,7 +3935,7 @@ void CppGenerator::writeClassDefinition(QTextStream &s,
}
// class or some ancestor has multiple inheritance
- const AbstractMetaClass* miClass = getMultipleInheritingClass(metaClass);
+ const AbstractMetaClass *miClass = getMultipleInheritingClass(metaClass);
if (miClass) {
if (metaClass == miClass)
writeMultipleInheritanceInitializerFunction(s, metaClass);
@@ -3951,7 +3949,7 @@ void CppGenerator::writeClassDefinition(QTextStream &s,
if (!metaClass->typeEntry()->hashFunction().isEmpty())
tp_hash = QLatin1Char('&') + cpythonBaseName(metaClass) + QLatin1String("_HashFunc");
- const AbstractMetaFunction* callOp = metaClass->findFunction(QLatin1String("operator()"));
+ const AbstractMetaFunction *callOp = metaClass->findFunction(QLatin1String("operator()"));
if (callOp && !callOp->isModifiedRemoved())
tp_call = QLatin1Char('&') + cpythonFunctionName(callOp);
@@ -3963,7 +3961,7 @@ void CppGenerator::writeClassDefinition(QTextStream &s,
QString suffix;
if (isObjectType(metaClass))
- suffix = QLatin1String("*");
+ suffix = QLatin1String(" *");
const QString typePtr = QLatin1String("_") + className
+ QLatin1String("_Type");
s << "static SbkObjectType *" << typePtr << " = nullptr;" << endl;
@@ -4021,7 +4019,7 @@ void CppGenerator::writeMappingMethods(QTextStream &s,
GeneratorContext &context)
{
for (auto it = m_mappingProtocol.cbegin(), end = m_mappingProtocol.cend(); it != end; ++it) {
- const AbstractMetaFunction* func = metaClass->findFunction(it.key());
+ const AbstractMetaFunction *func = metaClass->findFunction(it.key());
if (!func)
continue;
QString funcName = cpythonFunctionName(func);
@@ -4034,7 +4032,7 @@ void CppGenerator::writeMappingMethods(QTextStream &s,
writeCppSelfDefinition(s, func, context);
- const AbstractMetaArgument* lastArg = func->arguments().isEmpty() ? 0 : func->arguments().constLast();
+ const AbstractMetaArgument *lastArg = func->arguments().isEmpty() ? nullptr : func->arguments().constLast();
writeCodeSnips(s, snips, TypeSystem::CodeSnipPositionAny, TypeSystem::TargetLangCode, func, lastArg);
s << '}' << endl << endl;
}
@@ -4047,7 +4045,7 @@ void CppGenerator::writeSequenceMethods(QTextStream &s,
bool injectedCode = false;
for (auto it = m_sequenceProtocol.cbegin(), end = m_sequenceProtocol.cend(); it != end; ++it) {
- const AbstractMetaFunction* func = metaClass->findFunction(it.key());
+ const AbstractMetaFunction *func = metaClass->findFunction(it.key());
if (!func)
continue;
injectedCode = true;
@@ -4061,7 +4059,7 @@ void CppGenerator::writeSequenceMethods(QTextStream &s,
writeCppSelfDefinition(s, func, context);
- const AbstractMetaArgument* lastArg = func->arguments().isEmpty() ? 0 : func->arguments().constLast();
+ const AbstractMetaArgument *lastArg = func->arguments().isEmpty() ? 0 : func->arguments().constLast();
writeCodeSnips(s, snips,TypeSystem::CodeSnipPositionAny, TypeSystem::TargetLangCode, func, lastArg);
s << '}' << endl << endl;
}
@@ -4070,13 +4068,13 @@ void CppGenerator::writeSequenceMethods(QTextStream &s,
writeStdListWrapperMethods(s, context);
}
-void CppGenerator::writeTypeAsSequenceDefinition(QTextStream& s, const AbstractMetaClass* metaClass)
+void CppGenerator::writeTypeAsSequenceDefinition(QTextStream &s, const AbstractMetaClass *metaClass)
{
bool hasFunctions = false;
QMap<QString, QString> funcs;
- for (ProtocolIt it = m_sequenceProtocol.cbegin(), end = m_sequenceProtocol.cend(); it != end; ++it) {
+ for (auto it = m_sequenceProtocol.cbegin(), end = m_sequenceProtocol.cend(); it != end; ++it) {
const QString &funcName = it.key();
- const AbstractMetaFunction* func = metaClass->findFunction(funcName);
+ const AbstractMetaFunction *func = metaClass->findFunction(funcName);
funcs[funcName] = func ? cpythonFunctionName(func).prepend(QLatin1Char('&')) : QString();
if (!hasFunctions && func)
hasFunctions = true;
@@ -4092,7 +4090,7 @@ void CppGenerator::writeTypeAsSequenceDefinition(QTextStream& s, const AbstractM
}
for (QHash<QString, QString>::const_iterator it = m_sqFuncs.cbegin(), end = m_sqFuncs.cend(); it != end; ++it) {
- const QString& sqName = it.key();
+ const QString &sqName = it.key();
if (funcs[sqName].isEmpty())
continue;
if (it.value() == QLatin1String("sq_slice"))
@@ -4103,13 +4101,13 @@ void CppGenerator::writeTypeAsSequenceDefinition(QTextStream& s, const AbstractM
}
}
-void CppGenerator::writeTypeAsMappingDefinition(QTextStream& s, const AbstractMetaClass* metaClass)
+void CppGenerator::writeTypeAsMappingDefinition(QTextStream &s, const AbstractMetaClass *metaClass)
{
bool hasFunctions = false;
QMap<QString, QString> funcs;
- for (ProtocolIt it = m_mappingProtocol.cbegin(), end = m_mappingProtocol.cend(); it != end; ++it) {
+ for (auto it = m_mappingProtocol.cbegin(), end = m_mappingProtocol.cend(); it != end; ++it) {
const QString &funcName = it.key();
- const AbstractMetaFunction* func = metaClass->findFunction(funcName);
+ const AbstractMetaFunction *func = metaClass->findFunction(funcName);
funcs[funcName] = func ? cpythonFunctionName(func).prepend(QLatin1Char('&')) : QLatin1String("0");
if (!hasFunctions && func)
hasFunctions = true;
@@ -4130,7 +4128,7 @@ void CppGenerator::writeTypeAsMappingDefinition(QTextStream& s, const AbstractMe
}
}
-void CppGenerator::writeTypeAsNumberDefinition(QTextStream& s, const AbstractMetaClass* metaClass)
+void CppGenerator::writeTypeAsNumberDefinition(QTextStream &s, const AbstractMetaClass *metaClass)
{
QMap<QString, QString> nb;
@@ -4165,7 +4163,7 @@ void CppGenerator::writeTypeAsNumberDefinition(QTextStream& s, const AbstractMet
| AbstractMetaClass::BitwiseOp);
for (const AbstractMetaFunctionList &opOverload : opOverloads) {
- const AbstractMetaFunction* rfunc = opOverload[0];
+ const AbstractMetaFunction *rfunc = opOverload.at(0);
QString opName = ShibokenGenerator::pythonOperatorFunctionName(rfunc);
nb[opName] = cpythonFunctionName(rfunc);
}
@@ -4208,21 +4206,21 @@ void CppGenerator::writeTypeAsNumberDefinition(QTextStream& s, const AbstractMet
}
}
-void CppGenerator::writeTpTraverseFunction(QTextStream& s, const AbstractMetaClass* metaClass)
+void CppGenerator::writeTpTraverseFunction(QTextStream &s, const AbstractMetaClass *metaClass)
{
QString baseName = cpythonBaseName(metaClass);
s << "static int ";
- s << baseName << "_traverse(PyObject* self, visitproc visit, void* arg)" << endl;
+ s << baseName << "_traverse(PyObject *self, visitproc visit, void *arg)" << endl;
s << '{' << endl;
s << INDENT << "return reinterpret_cast<PyTypeObject *>(SbkObject_TypeF())->tp_traverse(self, visit, arg);" << endl;
s << '}' << endl;
}
-void CppGenerator::writeTpClearFunction(QTextStream& s, const AbstractMetaClass* metaClass)
+void CppGenerator::writeTpClearFunction(QTextStream &s, const AbstractMetaClass *metaClass)
{
QString baseName = cpythonBaseName(metaClass);
s << "static int ";
- s << baseName << "_clear(PyObject* self)" << endl;
+ s << baseName << "_clear(PyObject *self)" << endl;
s << '{' << endl;
s << INDENT << "return reinterpret_cast<PyTypeObject *>(SbkObject_TypeF())->tp_clear(self);" << endl;
s << '}' << endl;
@@ -4232,7 +4230,7 @@ void CppGenerator::writeCopyFunction(QTextStream &s, GeneratorContext &context)
{
const AbstractMetaClass *metaClass = context.metaClass();
const QString className = chopType(cpythonTypeName(metaClass));
- s << "static PyObject* " << className << "___copy__(PyObject* self)" << endl;
+ s << "static PyObject *" << className << "___copy__(PyObject *self)" << endl;
s << "{" << endl;
writeCppSelfDefinition(s, context, false, true);
QString conversionCode;
@@ -4241,7 +4239,7 @@ void CppGenerator::writeCopyFunction(QTextStream &s, GeneratorContext &context)
else
conversionCode = cpythonToPythonConversionFunction(context.preciseType());
- s << INDENT << "PyObject* " << PYTHON_RETURN_VAR << " = " << conversionCode;
+ s << INDENT << "PyObject *" << PYTHON_RETURN_VAR << " = " << conversionCode;
s << CPP_SELF_VAR << ");" << endl;
writeFunctionReturnErrorCheckSection(s);
s << INDENT << "return " << PYTHON_RETURN_VAR << ";" << endl;
@@ -4254,19 +4252,19 @@ void CppGenerator::writeGetterFunction(QTextStream &s,
GeneratorContext &context)
{
ErrorCode errorCode(QString::fromLatin1(NULL_PTR));
- s << "static PyObject* " << cpythonGetterFunctionName(metaField) << "(PyObject* self, void*)" << endl;
+ s << "static PyObject *" << cpythonGetterFunctionName(metaField) << "(PyObject *self, void *)" << endl;
s << '{' << endl;
writeCppSelfDefinition(s, context);
- AbstractMetaType* fieldType = metaField->type();
+ AbstractMetaType *fieldType = metaField->type();
// Force use of pointer to return internal variable memory
bool newWrapperSameObject = !fieldType->isConstant() && isWrapperType(fieldType) && !isPointer(fieldType);
QString cppField;
if (avoidProtectedHack() && metaField->isProtected()) {
QTextStream(&cppField) << "static_cast<"
- << wrapperName(metaField->enclosingClass()) << "*>("
+ << wrapperName(metaField->enclosingClass()) << " *>("
<< CPP_SELF_VAR << ")->" << protectedFieldGetterName(metaField) << "()";
} else {
cppField = QLatin1String(CPP_SELF_VAR) + QLatin1String("->") + metaField->name();
@@ -4281,16 +4279,16 @@ void CppGenerator::writeGetterFunction(QTextStream &s,
} else if (avoidProtectedHack() && metaField->isProtected()) {
s << INDENT << getFullTypeNameWithoutModifiers(fieldType);
if (fieldType->isContainer() || fieldType->isFlags() || fieldType->isSmartPointer()) {
- s << '&';
+ s << " &";
cppField.prepend(QLatin1Char('*'));
} else if ((!fieldType->isConstant() && !fieldType->isEnum() && !fieldType->isPrimitive()) || fieldType->indirections() == 1) {
- s << '*';
+ s << " *";
}
s << " fieldValue = " << cppField << ';' << endl;
cppField = QLatin1String("fieldValue");
}
- s << INDENT << "PyObject* pyOut = {};\n";
+ s << INDENT << "PyObject *pyOut = {};\n";
if (newWrapperSameObject) {
// Special case colocated field with same address (first field in a struct)
s << INDENT << "if (reinterpret_cast<void *>("
@@ -4310,7 +4308,7 @@ void CppGenerator::writeGetterFunction(QTextStream &s,
s << INDENT << "else if (Shiboken::BindingManager::instance().hasWrapper(" << cppField << ")) {" << "\n";
{
Indentation indent(INDENT);
- s << INDENT << "pyOut = reinterpret_cast<PyObject*>(Shiboken::BindingManager::instance().retrieveWrapper("
+ s << INDENT << "pyOut = reinterpret_cast<PyObject *>(Shiboken::BindingManager::instance().retrieveWrapper("
<< cppField << "));" << "\n";
s << INDENT << "Py_IncRef(pyOut);" << "\n";
s << INDENT << "return pyOut;" << "\n";
@@ -4336,7 +4334,7 @@ void CppGenerator::writeSetterFunction(QTextStream &s,
GeneratorContext &context)
{
ErrorCode errorCode(0);
- s << "static int " << cpythonSetterFunctionName(metaField) << "(PyObject* self, PyObject* pyIn, void*)" << endl;
+ s << "static int " << cpythonSetterFunctionName(metaField) << "(PyObject *self, PyObject *pyIn, void *)" << endl;
s << '{' << endl;
writeCppSelfDefinition(s, context);
@@ -4350,7 +4348,7 @@ void CppGenerator::writeSetterFunction(QTextStream &s,
}
s << INDENT << '}' << endl;
- AbstractMetaType* fieldType = metaField->type();
+ AbstractMetaType *fieldType = metaField->type();
s << INDENT << "PythonToCppFunc " << PYTHON_TO_CPP_VAR << "{nullptr};" << endl;
s << INDENT << "if (!";
@@ -4368,10 +4366,10 @@ void CppGenerator::writeSetterFunction(QTextStream &s,
s << INDENT;
if (avoidProtectedHack() && metaField->isProtected()) {
s << getFullTypeNameWithoutModifiers(fieldType);
- s << (fieldType->indirections() == 1 ? "*" : "") << " cppOut;" << endl;
+ s << (fieldType->indirections() == 1 ? " *" : "") << " cppOut;" << endl;
s << INDENT << PYTHON_TO_CPP_VAR << "(pyIn, &cppOut);" << endl;
s << INDENT << "static_cast<" << wrapperName(metaField->enclosingClass())
- << "*>(" << CPP_SELF_VAR << ")->" << protectedFieldSetterName(metaField)
+ << " *>(" << CPP_SELF_VAR << ")->" << protectedFieldSetterName(metaField)
<< "(cppOut)";
} else if (isCppIntegralPrimitive(fieldType) || fieldType->typeEntry()->isEnum() || fieldType->typeEntry()->isFlags()) {
s << getFullTypeNameWithoutModifiers(fieldType) << " cppOut_local = " << cppField << ';' << endl;
@@ -4381,14 +4379,14 @@ void CppGenerator::writeSetterFunction(QTextStream &s,
if (isPointerToConst(fieldType))
s << "const ";
s << getFullTypeNameWithoutModifiers(fieldType);
- s << QString::fromLatin1("*").repeated(fieldType->indirections()) << "& cppOut_ptr = ";
+ s << QString::fromLatin1(" *").repeated(fieldType->indirections()) << "& cppOut_ptr = ";
s << cppField << ';' << endl;
s << INDENT << PYTHON_TO_CPP_VAR << "(pyIn, &cppOut_ptr)";
}
s << ';' << endl << endl;
if (isPointerToWrapperType(fieldType)) {
- s << INDENT << "Shiboken::Object::keepReference(reinterpret_cast<SbkObject*>(self), \"";
+ s << INDENT << "Shiboken::Object::keepReference(reinterpret_cast<SbkObject *>(self), \"";
s << metaField->name() << "\", pyIn);" << endl;
}
@@ -4400,12 +4398,12 @@ void CppGenerator::writeRichCompareFunction(QTextStream &s, GeneratorContext &co
{
const AbstractMetaClass *metaClass = context.metaClass();
QString baseName = cpythonBaseName(metaClass);
- s << "static PyObject* ";
- s << baseName << "_richcompare(PyObject* self, PyObject* " << PYTHON_ARG << ", int op)" << endl;
+ s << "static PyObject * ";
+ s << baseName << "_richcompare(PyObject *self, PyObject *" << PYTHON_ARG << ", int op)" << endl;
s << '{' << endl;
writeCppSelfDefinition(s, context, false, true);
writeUnusedVariableCast(s, QLatin1String(CPP_SELF_VAR));
- s << INDENT << "PyObject* " << PYTHON_RETURN_VAR << "{};" << endl;
+ s << INDENT << "PyObject *" << PYTHON_RETURN_VAR << "{};" << endl;
s << INDENT << "PythonToCppFunc " << PYTHON_TO_CPP_VAR << ';' << endl;
writeUnusedVariableCast(s, QLatin1String(PYTHON_TO_CPP_VAR));
s << endl;
@@ -4415,7 +4413,7 @@ void CppGenerator::writeRichCompareFunction(QTextStream &s, GeneratorContext &co
Indentation indent(INDENT);
const QVector<AbstractMetaFunctionList> &groupedFuncs = filterGroupedOperatorFunctions(metaClass, AbstractMetaClass::ComparisonOp);
for (const AbstractMetaFunctionList &overloads : groupedFuncs) {
- const AbstractMetaFunction* rfunc = overloads[0];
+ const AbstractMetaFunction *rfunc = overloads[0];
QString operatorId = ShibokenGenerator::pythonRichCompareOperatorId(rfunc);
s << INDENT << "case " << operatorId << ':' << endl;
@@ -4436,10 +4434,10 @@ void CppGenerator::writeRichCompareFunction(QTextStream &s, GeneratorContext &co
OverloadData overloadData(overloads, this);
const OverloadDataList &nextOverloads = overloadData.nextOverloadData();
for (OverloadData *od : nextOverloads) {
- const AbstractMetaFunction* func = od->referenceFunction();
+ const AbstractMetaFunction *func = od->referenceFunction();
if (func->isStatic())
continue;
- const AbstractMetaType* argType = getArgumentType(func, 1);
+ const AbstractMetaType *argType = getArgumentType(func, 1);
if (!argType)
continue;
if (!first) {
@@ -4517,12 +4515,12 @@ void CppGenerator::writeRichCompareFunction(QTextStream &s, GeneratorContext &co
s << '}' << endl << endl;
}
-void CppGenerator::writeMethodDefinitionEntry(QTextStream& s, const AbstractMetaFunctionList &overloads)
+void CppGenerator::writeMethodDefinitionEntry(QTextStream &s, const AbstractMetaFunctionList &overloads)
{
Q_ASSERT(!overloads.isEmpty());
OverloadData overloadData(overloads, this);
bool usePyArgs = pythonFunctionWrapperUsesListOfArguments(overloadData);
- const AbstractMetaFunction* func = overloadData.referenceFunction();
+ const AbstractMetaFunction *func = overloadData.referenceFunction();
int min = overloadData.minArgs();
int max = overloadData.maxArgs();
@@ -4542,10 +4540,10 @@ void CppGenerator::writeMethodDefinitionEntry(QTextStream& s, const AbstractMeta
s << "|METH_STATIC";
}
-void CppGenerator::writeMethodDefinition(QTextStream& s, const AbstractMetaFunctionList &overloads)
+void CppGenerator::writeMethodDefinition(QTextStream &s, const AbstractMetaFunctionList &overloads)
{
Q_ASSERT(!overloads.isEmpty());
- const AbstractMetaFunction* func = overloads.constFirst();
+ const AbstractMetaFunction *func = overloads.constFirst();
if (m_tpFuncs.contains(func->name()))
return;
@@ -4566,7 +4564,7 @@ static QString resolveRetOrArgType(const AbstractMetaType *someType)
if (CppGenerator::isCString(someType)) {
strRetArg = QLatin1String("str");
} else if (someType->isPrimitive()) {
- const PrimitiveTypeEntry* ptp = static_cast<const PrimitiveTypeEntry*>(someType->typeEntry());
+ auto ptp = static_cast<const PrimitiveTypeEntry *>(someType->typeEntry());
while (ptp->referencedTypeEntry())
ptp = ptp->referencedTypeEntry();
strRetArg = ptp->name();
@@ -4580,7 +4578,7 @@ static QString resolveRetOrArgType(const AbstractMetaType *someType)
void CppGenerator::writeSignatureInfo(QTextStream &s, const AbstractMetaFunctionList &overloads)
{
OverloadData overloadData(overloads, this);
- const AbstractMetaFunction* rfunc = overloadData.referenceFunction();
+ const AbstractMetaFunction *rfunc = overloadData.referenceFunction();
QString funcName = fullPythonFunctionName(rfunc);
int idx = overloads.length() - 1;
@@ -4619,7 +4617,7 @@ void CppGenerator::writeSignatureInfo(QTextStream &s, const AbstractMetaFunction
}
}
-void CppGenerator::writeEnumsInitialization(QTextStream& s, AbstractMetaEnumList& enums)
+void CppGenerator::writeEnumsInitialization(QTextStream &s, AbstractMetaEnumList &enums)
{
if (enums.isEmpty())
return;
@@ -4631,10 +4629,10 @@ void CppGenerator::writeEnumsInitialization(QTextStream& s, AbstractMetaEnumList
}
}
-void CppGenerator::writeEnumInitialization(QTextStream& s, const AbstractMetaEnum* cppEnum)
+void CppGenerator::writeEnumInitialization(QTextStream &s, const AbstractMetaEnum *cppEnum)
{
- const AbstractMetaClass* enclosingClass = getProperEnclosingClassForEnum(cppEnum);
- const AbstractMetaClass* upper = enclosingClass ? enclosingClass->enclosingClass() : 0;
+ const AbstractMetaClass *enclosingClass = getProperEnclosingClassForEnum(cppEnum);
+ const AbstractMetaClass *upper = enclosingClass ? enclosingClass->enclosingClass() : nullptr;
bool hasUpperEnclosingClass = upper && upper->typeEntry()->codeGeneration() != TypeEntry::GenerateForSubclass;
const EnumTypeEntry *enumTypeEntry = cppEnum->typeEntry();
QString enclosingObjectVariable;
@@ -4651,7 +4649,7 @@ void CppGenerator::writeEnumInitialization(QTextStream& s, const AbstractMetaEnu
QString enumVarTypeObj;
if (!cppEnum->isAnonymous()) {
- FlagsTypeEntry* flags = enumTypeEntry->flags();
+ FlagsTypeEntry *flags = enumTypeEntry->flags();
if (flags) {
// The following could probably be made nicer:
// We need 'flags->flagsName()' with the full module/class path.
@@ -4708,7 +4706,7 @@ void CppGenerator::writeEnumInitialization(QTextStream& s, const AbstractMetaEnu
s << INDENT << '{' << endl;
{
Indentation indent(INDENT);
- s << INDENT << "PyObject* anonEnumItem = PyInt_FromLong(" << enumValueText << ");" << endl;
+ s << INDENT << "PyObject *anonEnumItem = PyInt_FromLong(" << enumValueText << ");" << endl;
s << INDENT << "if (PyDict_SetItemString(reinterpret_cast<PyTypeObject *>(reinterpret_cast<SbkObjectType *>(" << enclosingObjectVariable
<< "))->tp_dict, \"" << enumValue->name() << "\", anonEnumItem) < 0)" << endl;
{
@@ -4757,7 +4755,7 @@ void CppGenerator::writeEnumInitialization(QTextStream& s, const AbstractMetaEnu
s << '.' << endl << endl;
}
-void CppGenerator::writeSignalInitialization(QTextStream& s, const AbstractMetaClass* metaClass)
+void CppGenerator::writeSignalInitialization(QTextStream &s, const AbstractMetaClass *metaClass)
{
// Try to check something and print some warnings
const AbstractMetaFunctionList &signalFuncs = metaClass->cppSignalFunctions();
@@ -4766,7 +4764,7 @@ void CppGenerator::writeSignalInitialization(QTextStream& s, const AbstractMetaC
continue;
const AbstractMetaArgumentList &arguments = cppSignal->arguments();
for (AbstractMetaArgument *arg : arguments) {
- AbstractMetaType* metaType = arg->type();
+ AbstractMetaType *metaType = arg->type();
const QByteArray origType =
QMetaObject::normalizedType(qPrintable(metaType->originalTypeDescription()));
const QByteArray cppSig =
@@ -4783,36 +4781,36 @@ void CppGenerator::writeSignalInitialization(QTextStream& s, const AbstractMetaC
<< metaClass->qualifiedCppName() << "::staticMetaObject);" << endl;
}
-void CppGenerator::writeFlagsToLong(QTextStream& s, const AbstractMetaEnum* cppEnum)
+void CppGenerator::writeFlagsToLong(QTextStream &s, const AbstractMetaEnum *cppEnum)
{
- FlagsTypeEntry* flagsEntry = cppEnum->typeEntry()->flags();
+ FlagsTypeEntry *flagsEntry = cppEnum->typeEntry()->flags();
if (!flagsEntry)
return;
- s << "static PyObject* " << cpythonEnumName(cppEnum) << "_long(PyObject* self)" << endl;
+ s << "static PyObject *" << cpythonEnumName(cppEnum) << "_long(PyObject *self)" << endl;
s << "{" << endl;
s << INDENT << "int val;" << endl;
- AbstractMetaType* flagsType = buildAbstractMetaTypeFromTypeEntry(flagsEntry);
+ AbstractMetaType *flagsType = buildAbstractMetaTypeFromTypeEntry(flagsEntry);
s << INDENT << cpythonToCppConversionFunction(flagsType) << "self, &val);" << endl;
s << INDENT << "return Shiboken::Conversions::copyToPython(Shiboken::Conversions::PrimitiveTypeConverter<int>(), &val);" << endl;
s << "}" << endl;
}
-void CppGenerator::writeFlagsNonZero(QTextStream& s, const AbstractMetaEnum* cppEnum)
+void CppGenerator::writeFlagsNonZero(QTextStream &s, const AbstractMetaEnum *cppEnum)
{
- FlagsTypeEntry* flagsEntry = cppEnum->typeEntry()->flags();
+ FlagsTypeEntry *flagsEntry = cppEnum->typeEntry()->flags();
if (!flagsEntry)
return;
- s << "static int " << cpythonEnumName(cppEnum) << "__nonzero(PyObject* self)" << endl;
+ s << "static int " << cpythonEnumName(cppEnum) << "__nonzero(PyObject *self)" << endl;
s << "{" << endl;
s << INDENT << "int val;" << endl;
- AbstractMetaType* flagsType = buildAbstractMetaTypeFromTypeEntry(flagsEntry);
+ AbstractMetaType *flagsType = buildAbstractMetaTypeFromTypeEntry(flagsEntry);
s << INDENT << cpythonToCppConversionFunction(flagsType) << "self, &val);" << endl;
s << INDENT << "return val != 0;" << endl;
s << "}" << endl;
}
-void CppGenerator::writeFlagsMethods(QTextStream& s, const AbstractMetaEnum* cppEnum)
+void CppGenerator::writeFlagsMethods(QTextStream &s, const AbstractMetaEnum *cppEnum)
{
writeFlagsBinaryOperator(s, cppEnum, QLatin1String("and"), QLatin1String("&"));
writeFlagsBinaryOperator(s, cppEnum, QLatin1String("or"), QLatin1String("|"));
@@ -4825,7 +4823,7 @@ void CppGenerator::writeFlagsMethods(QTextStream& s, const AbstractMetaEnum* cpp
s << endl;
}
-void CppGenerator::writeFlagsNumberMethodsDefinition(QTextStream& s, const AbstractMetaEnum* cppEnum)
+void CppGenerator::writeFlagsNumberMethodsDefinition(QTextStream &s, const AbstractMetaEnum *cppEnum)
{
QString cpythonName = cpythonEnumName(cppEnum);
@@ -4848,16 +4846,16 @@ void CppGenerator::writeFlagsNumberMethodsDefinition(QTextStream& s, const Abstr
s << "};" << endl << endl;
}
-void CppGenerator::writeFlagsBinaryOperator(QTextStream& s, const AbstractMetaEnum* cppEnum,
+void CppGenerator::writeFlagsBinaryOperator(QTextStream &s, const AbstractMetaEnum *cppEnum,
const QString &pyOpName, const QString &cppOpName)
{
- FlagsTypeEntry* flagsEntry = cppEnum->typeEntry()->flags();
+ FlagsTypeEntry *flagsEntry = cppEnum->typeEntry()->flags();
Q_ASSERT(flagsEntry);
- s << "PyObject* " << cpythonEnumName(cppEnum) << "___" << pyOpName << "__(PyObject* self, PyObject* " << PYTHON_ARG << ")" << endl;
+ s << "PyObject * " << cpythonEnumName(cppEnum) << "___" << pyOpName << "__(PyObject *self, PyObject *" << PYTHON_ARG << ")" << endl;
s << '{' << endl;
- AbstractMetaType* flagsType = buildAbstractMetaTypeFromTypeEntry(flagsEntry);
+ AbstractMetaType *flagsType = buildAbstractMetaTypeFromTypeEntry(flagsEntry);
s << INDENT << "::" << flagsEntry->originalName() << " cppResult, " << CPP_SELF_VAR << ", cppArg;" << endl;
s << "#ifdef IS_PY3K" << endl;
s << INDENT << CPP_SELF_VAR << " = static_cast<::" << flagsEntry->originalName()
@@ -4872,22 +4870,22 @@ void CppGenerator::writeFlagsBinaryOperator(QTextStream& s, const AbstractMetaEn
s << "#endif" << endl << endl;
s << INDENT << "cppResult = " << CPP_SELF_VAR << " " << cppOpName << " cppArg;" << endl;
s << INDENT << "return ";
- writeToPythonConversion(s, flagsType, 0, QLatin1String("cppResult"));
+ writeToPythonConversion(s, flagsType, nullptr, QLatin1String("cppResult"));
s << ';' << endl;
s << '}' << endl << endl;
}
-void CppGenerator::writeFlagsUnaryOperator(QTextStream& s, const AbstractMetaEnum* cppEnum,
+void CppGenerator::writeFlagsUnaryOperator(QTextStream &s, const AbstractMetaEnum *cppEnum,
const QString &pyOpName,
const QString &cppOpName, bool boolResult)
{
- FlagsTypeEntry* flagsEntry = cppEnum->typeEntry()->flags();
+ FlagsTypeEntry *flagsEntry = cppEnum->typeEntry()->flags();
Q_ASSERT(flagsEntry);
- s << "PyObject* " << cpythonEnumName(cppEnum) << "___" << pyOpName << "__(PyObject* self, PyObject* " << PYTHON_ARG << ")" << endl;
+ s << "PyObject *" << cpythonEnumName(cppEnum) << "___" << pyOpName << "__(PyObject *self, PyObject *" << PYTHON_ARG << ")" << endl;
s << '{' << endl;
- AbstractMetaType* flagsType = buildAbstractMetaTypeFromTypeEntry(flagsEntry);
+ AbstractMetaType *flagsType = buildAbstractMetaTypeFromTypeEntry(flagsEntry);
s << INDENT << "::" << flagsEntry->originalName() << " " << CPP_SELF_VAR << ";" << endl;
s << INDENT << cpythonToCppConversionFunction(flagsType) << "self, &" << CPP_SELF_VAR << ");" << endl;
s << INDENT;
@@ -4900,7 +4898,7 @@ void CppGenerator::writeFlagsUnaryOperator(QTextStream& s, const AbstractMetaEnu
if (boolResult)
s << "PyBool_FromLong(cppResult)";
else
- writeToPythonConversion(s, flagsType, 0, QLatin1String("cppResult"));
+ writeToPythonConversion(s, flagsType, nullptr, QLatin1String("cppResult"));
s << ';' << endl;
s << '}' << endl << endl;
}
@@ -4928,9 +4926,9 @@ void CppGenerator::writeClassRegister(QTextStream &s,
GeneratorContext &classContext,
QTextStream &signatureStream)
{
- const ComplexTypeEntry* classTypeEntry = metaClass->typeEntry();
+ const ComplexTypeEntry *classTypeEntry = metaClass->typeEntry();
- const AbstractMetaClass* enc = metaClass->enclosingClass();
+ const AbstractMetaClass *enc = metaClass->enclosingClass();
bool hasEnclosingClass = enc && enc->typeEntry()->codeGeneration() != TypeEntry::GenerateForSubclass;
QString enclosingObjectVariable = hasEnclosingClass ? QLatin1String("enclosingClass") : QLatin1String("module");
@@ -4946,20 +4944,20 @@ void CppGenerator::writeClassRegister(QTextStream &s,
s << INDENT << '"' << line << "\"," << endl;
s << INDENT << NULL_PTR << "}; // Sentinel" << endl << endl;
s << "void init_" << initFunctionName;
- s << "(PyObject* " << enclosingObjectVariable << ")" << endl;
+ s << "(PyObject *" << enclosingObjectVariable << ")" << endl;
s << '{' << endl;
// Multiple inheritance
QString pyTypeBasesVariable = chopType(pyTypeName) + QLatin1String("_Type_bases");
const AbstractMetaClassList baseClasses = getBaseClasses(metaClass);
if (metaClass->baseClassNames().size() > 1) {
- s << INDENT << "PyObject* " << pyTypeBasesVariable
+ s << INDENT << "PyObject *" << pyTypeBasesVariable
<< " = PyTuple_Pack(" << baseClasses.size() << ',' << endl;
Indentation indent(INDENT);
for (int i = 0, size = baseClasses.size(); i < size; ++i) {
if (i)
s << "," << endl;
- s << INDENT << "reinterpret_cast<PyObject*>("
+ s << INDENT << "reinterpret_cast<PyObject *>("
<< cpythonTypeNameExt(baseClasses.at(i)->typeEntry()) << ')';
}
s << ");" << endl << endl;
@@ -5048,7 +5046,7 @@ void CppGenerator::writeClassRegister(QTextStream &s,
s << INDENT << cpythonTypeNameExt(classTypeEntry) << endl;
else
s << INDENT << cpythonTypeNameExt(classContext.preciseType()) << endl;
- s << INDENT << " = reinterpret_cast<PyTypeObject*>(" << pyTypeName << ");" << endl;
+ s << INDENT << " = reinterpret_cast<PyTypeObject *>(" << pyTypeName << ");" << endl;
s << endl;
// Register conversions for the type.
@@ -5062,13 +5060,13 @@ void CppGenerator::writeClassRegister(QTextStream &s,
}
// Fill multiple inheritance data, if needed.
- const AbstractMetaClass* miClass = getMultipleInheritingClass(metaClass);
+ const AbstractMetaClass *miClass = getMultipleInheritingClass(metaClass);
if (miClass) {
s << INDENT << "MultipleInheritanceInitFunction func = ";
if (miClass == metaClass) {
s << multipleInheritanceInitializerFunctionName(miClass) << ";" << endl;
} else {
- s << "Shiboken::ObjectType::getMultipleInheritanceFunction(reinterpret_cast<SbkObjectType*>(";
+ s << "Shiboken::ObjectType::getMultipleInheritanceFunction(reinterpret_cast<SbkObjectType *>(";
s << cpythonTypeNameExt(miClass->typeEntry()) << "));" << endl;
}
s << INDENT << "Shiboken::ObjectType::setMultipleInheritanceFunction(";
@@ -5130,7 +5128,7 @@ void CppGenerator::writeClassRegister(QTextStream &s,
void CppGenerator::writeInitQtMetaTypeFunctionBody(QTextStream &s, GeneratorContext &context) const
{
- const AbstractMetaClass* metaClass = context.metaClass();
+ const AbstractMetaClass *metaClass = context.metaClass();
// Gets all class name variants used on different possible scopes
QStringList nameVariants;
if (!context.forSmartPointer())
@@ -5138,7 +5136,7 @@ void CppGenerator::writeInitQtMetaTypeFunctionBody(QTextStream &s, GeneratorCont
else
nameVariants << context.preciseType()->cppSignature();
- const AbstractMetaClass* enclosingClass = metaClass->enclosingClass();
+ const AbstractMetaClass *enclosingClass = metaClass->enclosingClass();
while (enclosingClass) {
if (enclosingClass->typeEntry()->generateCode())
nameVariants << (enclosingClass->name() + QLatin1String("::") + nameVariants.constLast());
@@ -5194,17 +5192,17 @@ void CppGenerator::writeInitQtMetaTypeFunctionBody(QTextStream &s, GeneratorCont
}
}
-void CppGenerator::writeTypeDiscoveryFunction(QTextStream& s, const AbstractMetaClass* metaClass)
+void CppGenerator::writeTypeDiscoveryFunction(QTextStream &s, const AbstractMetaClass *metaClass)
{
QString polymorphicExpr = metaClass->typeEntry()->polymorphicIdValue();
- s << "static void* " << cpythonBaseName(metaClass) << "_typeDiscovery(void* cptr, SbkObjectType* instanceType)\n{" << endl;
+ s << "static void *" << cpythonBaseName(metaClass) << "_typeDiscovery(void *cptr, SbkObjectType *instanceType)\n{" << endl;
if (!polymorphicExpr.isEmpty()) {
polymorphicExpr = polymorphicExpr.replace(QLatin1String("%1"),
QLatin1String(" reinterpret_cast< ::")
+ metaClass->qualifiedCppName()
- + QLatin1String("*>(cptr)"));
+ + QLatin1String(" *>(cptr)"));
s << INDENT << " if (" << polymorphicExpr << ")" << endl;
{
Indentation indent(INDENT);
@@ -5216,11 +5214,11 @@ void CppGenerator::writeTypeDiscoveryFunction(QTextStream& s, const AbstractMeta
if (ancestor->baseClass())
continue;
if (ancestor->isPolymorphic()) {
- s << INDENT << "if (instanceType == reinterpret_cast<SbkObjectType*>(Shiboken::SbkType< ::"
+ s << INDENT << "if (instanceType == reinterpret_cast<SbkObjectType *>(Shiboken::SbkType< ::"
<< ancestor->qualifiedCppName() << " >()))" << endl;
Indentation indent(INDENT);
s << INDENT << "return dynamic_cast< ::" << metaClass->qualifiedCppName()
- << "*>(reinterpret_cast< ::"<< ancestor->qualifiedCppName() << "*>(cptr));" << endl;
+ << " *>(reinterpret_cast< ::"<< ancestor->qualifiedCppName() << " *>(cptr));" << endl;
} else {
qCWarning(lcShiboken).noquote().nospace()
<< metaClass->qualifiedCppName() << " inherits from a non polymorphic type ("
@@ -5242,14 +5240,14 @@ QString CppGenerator::writeSmartPointerGetterCast()
void CppGenerator::writeSetattroFunction(QTextStream &s, GeneratorContext &context)
{
- const AbstractMetaClass* metaClass = context.metaClass();
- s << "static int " << cpythonSetattroFunctionName(metaClass) << "(PyObject* self, PyObject* name, PyObject* value)" << endl;
+ const AbstractMetaClass *metaClass = context.metaClass();
+ s << "static int " << cpythonSetattroFunctionName(metaClass) << "(PyObject *self, PyObject *name, PyObject *value)" << endl;
s << '{' << endl;
if (usePySideExtensions()) {
- s << INDENT << "Shiboken::AutoDecRef pp(reinterpret_cast<PyObject*>(PySide::Property::getObject(self, name)));" << endl;
+ s << INDENT << "Shiboken::AutoDecRef pp(reinterpret_cast<PyObject *>(PySide::Property::getObject(self, name)));" << endl;
s << INDENT << "if (!pp.isNull())" << endl;
Indentation indent(INDENT);
- s << INDENT << "return PySide::Property::setValue(reinterpret_cast<PySideProperty*>(pp.object()), self, value);" << endl;
+ s << INDENT << "return PySide::Property::setValue(reinterpret_cast<PySideProperty *>(pp.object()), self, value);" << endl;
}
if (context.forSmartPointer()) {
@@ -5279,10 +5277,10 @@ void CppGenerator::writeSetattroFunction(QTextStream &s, GeneratorContext &conte
static inline QString qObjectClassName() { return QStringLiteral("QObject"); }
static inline QString qMetaObjectClassName() { return QStringLiteral("QMetaObject"); }
-void CppGenerator::writeGetattroFunction(QTextStream& s, GeneratorContext &context)
+void CppGenerator::writeGetattroFunction(QTextStream &s, GeneratorContext &context)
{
- const AbstractMetaClass* metaClass = context.metaClass();
- s << "static PyObject* " << cpythonGetattroFunctionName(metaClass) << "(PyObject* self, PyObject* name)" << endl;
+ const AbstractMetaClass *metaClass = context.metaClass();
+ s << "static PyObject *" << cpythonGetattroFunctionName(metaClass) << "(PyObject *self, PyObject *name)" << endl;
s << '{' << endl;
QString getattrFunc;
@@ -5301,10 +5299,10 @@ void CppGenerator::writeGetattroFunction(QTextStream& s, GeneratorContext &conte
{
Indentation indent(INDENT);
s << INDENT << "// Search the method in the instance dict" << endl;
- s << INDENT << "if (reinterpret_cast<SbkObject*>(self)->ob_dict) {" << endl;
+ s << INDENT << "if (reinterpret_cast<SbkObject *>(self)->ob_dict) {" << endl;
{
Indentation indent(INDENT);
- s << INDENT << "PyObject* meth = PyDict_GetItem(reinterpret_cast<SbkObject*>(self)->ob_dict, name);" << endl;
+ s << INDENT << "PyObject *meth = PyDict_GetItem(reinterpret_cast<SbkObject *>(self)->ob_dict, name);" << endl;
s << INDENT << "if (meth) {" << endl;
{
Indentation indent(INDENT);
@@ -5463,7 +5461,7 @@ bool CppGenerator::finishGeneration()
const QString initFunctionName = QLatin1String("init_") + getSimpleClassInitFunctionName(cls);
- s_classInitDecl << "void " << initFunctionName << "(PyObject* module);" << endl;
+ s_classInitDecl << "void " << initFunctionName << "(PyObject *module);" << endl;
s_classPythonDefines << INDENT << initFunctionName;
if (cls->enclosingClass()
@@ -5479,9 +5477,9 @@ bool CppGenerator::finishGeneration()
// Initialize smart pointer types.
const QVector<const AbstractMetaType *> &smartPtrs = instantiatedSmartPointers();
for (const AbstractMetaType *metaType : smartPtrs) {
- GeneratorContext context(0, metaType, true);
+ GeneratorContext context(nullptr, metaType, true);
QString initFunctionName = getInitFunctionName(context);
- s_classInitDecl << "void init_" << initFunctionName << "(PyObject* module);" << endl;
+ s_classInitDecl << "void init_" << initFunctionName << "(PyObject *module);" << endl;
QString defineStr = QLatin1String("init_") + initFunctionName;
defineStr += QLatin1String("(module);");
s_classPythonDefines << INDENT << defineStr << endl;
@@ -5518,13 +5516,13 @@ bool CppGenerator::finishGeneration()
AbstractMetaEnumList globalEnums = this->globalEnums();
const AbstractMetaClassList &classList = classes();
for (const AbstractMetaClass *metaClass : classList) {
- const AbstractMetaClass* encClass = metaClass->enclosingClass();
+ const AbstractMetaClass *encClass = metaClass->enclosingClass();
if (encClass && encClass->typeEntry()->codeGeneration() != TypeEntry::GenerateForSubclass)
continue;
lookForEnumsInClassesNotToBeGenerated(globalEnums, metaClass);
}
- TypeDatabase* typeDb = TypeDatabase::instance();
+ TypeDatabase *typeDb = TypeDatabase::instance();
const TypeSystemTypeEntry *moduleEntry = typeDb->defaultTypeSystemType();
Q_ASSERT(moduleEntry);
@@ -5539,13 +5537,13 @@ bool CppGenerator::finishGeneration()
s << endl;
s << "// Current module's type array." << endl;
- s << "PyTypeObject** " << cppApiVariableName() << " = nullptr;" << endl;
+ s << "PyTypeObject **" << cppApiVariableName() << " = nullptr;" << endl;
s << "// Current module's PyObject pointer." << endl;
- s << "PyObject* " << pythonModuleObjectName() << " = nullptr;" << endl;
+ s << "PyObject *" << pythonModuleObjectName() << " = nullptr;" << endl;
s << "// Current module's converter array." << endl;
- s << "SbkConverter** " << convertersVariableName() << " = nullptr;" << endl;
+ s << "SbkConverter **" << convertersVariableName() << " = nullptr;" << endl;
const CodeSnipList snips = moduleEntry->codeSnips();
@@ -5563,7 +5561,7 @@ bool CppGenerator::finishGeneration()
s << INDENT << "for (int i = 0, imax = SBK_" << moduleName() << "_IDX_COUNT; i < imax; i++) {" << endl;
{
Indentation indentation(INDENT);
- s << INDENT << "PyObject *pyType = reinterpret_cast<PyObject*>(" << cppApiVariableName() << "[i]);" << endl;
+ s << INDENT << "PyObject *pyType = reinterpret_cast<PyObject *>(" << cppApiVariableName() << "[i]);" << endl;
s << INDENT << "if (pyType && PyObject_HasAttrString(pyType, \"staticMetaObject\"))"<< endl;
{
Indentation indentation(INDENT);
@@ -5612,8 +5610,8 @@ bool CppGenerator::finishGeneration()
if (!requiredModules.isEmpty())
s << "// Required modules' type and converter arrays." << endl;
for (const QString &requiredModule : requiredModules) {
- s << "PyTypeObject** " << cppApiVariableName(requiredModule) << ';' << endl;
- s << "SbkConverter** " << convertersVariableName(requiredModule) << ';' << endl;
+ s << "PyTypeObject **" << cppApiVariableName(requiredModule) << ';' << endl;
+ s << "SbkConverter **" << convertersVariableName(requiredModule) << ';' << endl;
}
s << endl;
@@ -5626,8 +5624,8 @@ bool CppGenerator::finishGeneration()
const TypeEntry *externalType = it.key();
s << "// Extended implicit conversions for " << externalType->qualifiedTargetLangName() << '.' << endl;
for (const AbstractMetaClass *sourceClass : it.value()) {
- AbstractMetaType* sourceType = buildAbstractMetaTypeFromAbstractMetaClass(sourceClass);
- AbstractMetaType* targetType = buildAbstractMetaTypeFromTypeEntry(externalType);
+ AbstractMetaType *sourceType = buildAbstractMetaTypeFromAbstractMetaClass(sourceClass);
+ AbstractMetaType *targetType = buildAbstractMetaTypeFromTypeEntry(externalType);
writePythonToCppConversionFunctions(s, sourceType, targetType);
}
}
@@ -5694,7 +5692,7 @@ bool CppGenerator::finishGeneration()
s << endl;
}
- for (const QString& requiredModule : requiredModules) {
+ for (const QString &requiredModule : requiredModules) {
s << INDENT << "{" << endl;
{
Indentation indentation(INDENT);
@@ -5713,18 +5711,18 @@ bool CppGenerator::finishGeneration()
int maxTypeIndex = getMaxTypeIndex() + instantiatedSmartPointers().size();
if (maxTypeIndex) {
s << INDENT << "// Create an array of wrapper types for the current module." << endl;
- s << INDENT << "static PyTypeObject* cppApi[SBK_" << moduleName() << "_IDX_COUNT];" << endl;
+ s << INDENT << "static PyTypeObject *cppApi[SBK_" << moduleName() << "_IDX_COUNT];" << endl;
s << INDENT << cppApiVariableName() << " = cppApi;" << endl << endl;
}
s << INDENT << "// Create an array of primitive type converters for the current module." << endl;
- s << INDENT << "static SbkConverter* sbkConverters[SBK_" << moduleName() << "_CONVERTERS_IDX_COUNT" << "];" << endl;
+ s << INDENT << "static SbkConverter *sbkConverters[SBK_" << moduleName() << "_CONVERTERS_IDX_COUNT" << "];" << endl;
s << INDENT << convertersVariableName() << " = sbkConverters;" << endl << endl;
s << "#ifdef IS_PY3K" << endl;
- s << INDENT << "PyObject* module = Shiboken::Module::create(\"" << moduleName() << "\", &moduledef);" << endl;
+ s << INDENT << "PyObject *module = Shiboken::Module::create(\"" << moduleName() << "\", &moduledef);" << endl;
s << "#else" << endl;
- s << INDENT << "PyObject* module = Shiboken::Module::create(\"" << moduleName() << "\", ";
+ s << INDENT << "PyObject *module = Shiboken::Module::create(\"" << moduleName() << "\", ";
s << moduleName() << "_methods);" << endl;
s << "#endif" << endl << endl;
@@ -5829,7 +5827,7 @@ bool CppGenerator::finishGeneration()
return file.done() != FileOut::Failure;
}
-static ArgumentOwner getArgumentOwner(const AbstractMetaFunction* func, int argIndex)
+static ArgumentOwner getArgumentOwner(const AbstractMetaFunction *func, int argIndex)
{
ArgumentOwner argOwner = func->argumentOwner(func->ownerClass(), argIndex);
if (argOwner.index == ArgumentOwner::InvalidIndex)
@@ -5837,7 +5835,7 @@ static ArgumentOwner getArgumentOwner(const AbstractMetaFunction* func, int argI
return argOwner;
}
-bool CppGenerator::writeParentChildManagement(QTextStream& s, const AbstractMetaFunction* func, int argIndex, bool useHeuristicPolicy)
+bool CppGenerator::writeParentChildManagement(QTextStream &s, const AbstractMetaFunction *func, int argIndex, bool useHeuristicPolicy)
{
const int numArgs = func->arguments().count();
bool ctorHeuristicEnabled = func->isConstructor() && useCtorHeuristic() && useHeuristicPolicy;
@@ -5852,7 +5850,7 @@ bool CppGenerator::writeParentChildManagement(QTextStream& s, const AbstractMeta
int parentIndex = argOwner.index;
int childIndex = argIndex;
if (ctorHeuristicEnabled && argIndex > 0 && numArgs) {
- AbstractMetaArgument* arg = func->arguments().at(argIndex-1);
+ AbstractMetaArgument *arg = func->arguments().at(argIndex-1);
if (arg->name() == QLatin1String("parent") && isObjectType(arg->type())) {
action = ArgumentOwner::Add;
parentIndex = argIndex;
@@ -5896,7 +5894,7 @@ bool CppGenerator::writeParentChildManagement(QTextStream& s, const AbstractMeta
return false;
}
-void CppGenerator::writeParentChildManagement(QTextStream& s, const AbstractMetaFunction* func, bool useHeuristicForReturn)
+void CppGenerator::writeParentChildManagement(QTextStream &s, const AbstractMetaFunction *func, bool useHeuristicForReturn)
{
const int numArgs = func->arguments().count();
@@ -5910,7 +5908,7 @@ void CppGenerator::writeParentChildManagement(QTextStream& s, const AbstractMeta
writeReturnValueHeuristics(s, func);
}
-void CppGenerator::writeReturnValueHeuristics(QTextStream& s, const AbstractMetaFunction* func, const QString& self)
+void CppGenerator::writeReturnValueHeuristics(QTextStream &s, const AbstractMetaFunction *func, const QString &self)
{
AbstractMetaType *type = func->type();
if (!useReturnValueHeuristic()
@@ -5932,7 +5930,7 @@ void CppGenerator::writeReturnValueHeuristics(QTextStream& s, const AbstractMeta
void CppGenerator::writeHashFunction(QTextStream &s, GeneratorContext &context)
{
const AbstractMetaClass *metaClass = context.metaClass();
- s << "static Py_hash_t " << cpythonBaseName(metaClass) << "_HashFunc(PyObject* self) {" << endl;
+ s << "static Py_hash_t " << cpythonBaseName(metaClass) << "_HashFunc(PyObject *self) {" << endl;
writeCppSelfDefinition(s, context);
s << INDENT << "return " << metaClass->typeEntry()->hashFunction() << '(';
s << (isObjectType(metaClass) ? "" : "*") << CPP_SELF_VAR << ");" << endl;
@@ -5945,14 +5943,14 @@ void CppGenerator::writeStdListWrapperMethods(QTextStream &s, GeneratorContext &
ErrorCode errorCode(0);
// __len__
- s << "Py_ssize_t " << cpythonBaseName(metaClass->typeEntry()) << "__len__(PyObject* self)" << endl;
+ s << "Py_ssize_t " << cpythonBaseName(metaClass->typeEntry()) << "__len__(PyObject *self)" << endl;
s << '{' << endl;
writeCppSelfDefinition(s, context);
s << INDENT << "return " << CPP_SELF_VAR << "->size();" << endl;
s << '}' << endl;
// __getitem__
- s << "PyObject* " << cpythonBaseName(metaClass->typeEntry()) << "__getitem__(PyObject* self, Py_ssize_t _i)" << endl;
+ s << "PyObject *" << cpythonBaseName(metaClass->typeEntry()) << "__getitem__(PyObject *self, Py_ssize_t _i)" << endl;
s << '{' << endl;
writeCppSelfDefinition(s, context);
writeIndexError(s, QLatin1String("index out of bounds"));
@@ -5960,7 +5958,7 @@ void CppGenerator::writeStdListWrapperMethods(QTextStream &s, GeneratorContext &
s << INDENT << metaClass->qualifiedCppName() << "::iterator _item = " << CPP_SELF_VAR << "->begin();" << endl;
s << INDENT << "for (Py_ssize_t pos = 0; pos < _i; pos++) _item++;" << endl;
- const AbstractMetaType* itemType = metaClass->templateBaseClassInstantiations().constFirst();
+ const AbstractMetaType *itemType = metaClass->templateBaseClassInstantiations().constFirst();
s << INDENT << "return ";
writeToPythonConversion(s, itemType, metaClass, QLatin1String("*_item"));
@@ -5969,7 +5967,7 @@ void CppGenerator::writeStdListWrapperMethods(QTextStream &s, GeneratorContext &
// __setitem__
ErrorCode errorCode2(-1);
- s << "int " << cpythonBaseName(metaClass->typeEntry()) << "__setitem__(PyObject* self, Py_ssize_t _i, PyObject* pyArg)" << endl;
+ s << "int " << cpythonBaseName(metaClass->typeEntry()) << "__setitem__(PyObject *self, Py_ssize_t _i, PyObject *pyArg)" << endl;
s << '{' << endl;
writeCppSelfDefinition(s, context);
writeIndexError(s, QLatin1String("list assignment index out of range"));
@@ -5993,7 +5991,7 @@ void CppGenerator::writeStdListWrapperMethods(QTextStream &s, GeneratorContext &
s << INDENT << "return {};" << endl;
s << '}' << endl;
}
-void CppGenerator::writeIndexError(QTextStream& s, const QString& errorMsg)
+void CppGenerator::writeIndexError(QTextStream &s, const QString &errorMsg)
{
s << INDENT << "if (_i < 0 || _i >= (Py_ssize_t) " << CPP_SELF_VAR << "->size()) {" << endl;
{
@@ -6010,7 +6008,7 @@ QString CppGenerator::writeReprFunction(QTextStream &s, GeneratorContext &contex
QString funcName = cpythonBaseName(metaClass) + QLatin1String("__repr__");
s << "extern \"C\"" << endl;
s << '{' << endl;
- s << "static PyObject* " << funcName << "(PyObject* self)" << endl;
+ s << "static PyObject *" << funcName << "(PyObject *self)" << endl;
s << '{' << endl;
writeCppSelfDefinition(s, context);
s << INDENT << "QBuffer buffer;" << endl;
@@ -6028,7 +6026,7 @@ QString CppGenerator::writeReprFunction(QTextStream &s, GeneratorContext &contex
Indentation indent(INDENT);
s << INDENT << "str.replace(0, idx, Py_TYPE(self)->tp_name);" << endl;
}
- s << INDENT << "PyObject* mod = PyDict_GetItemString(Py_TYPE(self)->tp_dict, \"__module__\");" << endl;
+ s << INDENT << "PyObject *mod = PyDict_GetItemString(Py_TYPE(self)->tp_dict, \"__module__\");" << endl;
// PYSIDE-595: The introduction of heap types has the side effect that the module name
// is always prepended to the type name. Therefore the strchr check:
s << INDENT << "if (mod && !strchr(str, '.'))" << endl;
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.h b/sources/shiboken2/generator/shiboken2/cppgenerator.h
index 519e12b7b..ae6da9582 100644
--- a/sources/shiboken2/generator/shiboken2/cppgenerator.h
+++ b/sources/shiboken2/generator/shiboken2/cppgenerator.h
@@ -44,38 +44,39 @@ public:
protected:
QString fileNameSuffix() const override;
QString fileNameForContext(GeneratorContext &context) const override;
- QVector<AbstractMetaFunctionList> filterGroupedOperatorFunctions(const AbstractMetaClass* metaClass,
+ QVector<AbstractMetaFunctionList> filterGroupedOperatorFunctions(const AbstractMetaClass *metaClass,
uint query);
- void generateClass(QTextStream& s, GeneratorContext &classContext) override;
+ void generateClass(QTextStream &s, GeneratorContext &classContext) override;
bool finishGeneration() override;
private:
- void writeConstructorNative(QTextStream& s, const AbstractMetaFunction* func);
- void writeDestructorNative(QTextStream& s, const AbstractMetaClass* metaClass);
+ void writeConstructorNative(QTextStream &s, const AbstractMetaFunction *func);
+ void writeDestructorNative(QTextStream &s, const AbstractMetaClass *metaClass);
- QString getVirtualFunctionReturnTypeName(const AbstractMetaFunction* func);
- void writeVirtualMethodNative(QTextStream& s, const AbstractMetaFunction* func);
+ QString getVirtualFunctionReturnTypeName(const AbstractMetaFunction *func);
+ void writeVirtualMethodNative(QTextStream &s, const AbstractMetaFunction *func);
- void writeMetaObjectMethod(QTextStream& s, const AbstractMetaClass* metaClass);
- void writeMetaCast(QTextStream& s, const AbstractMetaClass* metaClass);
+ void writeMetaObjectMethod(QTextStream &s, const AbstractMetaClass *metaClass);
+ void writeMetaCast(QTextStream &s, const AbstractMetaClass *metaClass);
- void writeEnumConverterFunctions(QTextStream& s, const TypeEntry* enumType);
- void writeEnumConverterFunctions(QTextStream& s, const AbstractMetaEnum* metaEnum);
+ void writeEnumConverterFunctions(QTextStream &s, const TypeEntry *enumType);
+ void writeEnumConverterFunctions(QTextStream &s, const AbstractMetaEnum *metaEnum);
void writeConverterFunctions(QTextStream &s, const AbstractMetaClass *metaClass,
GeneratorContext &classContext);
- void writeCustomConverterFunctions(QTextStream& s, const CustomConversion* customConversion);
+ void writeCustomConverterFunctions(QTextStream &s, const CustomConversion *customConversion);
void writeConverterRegister(QTextStream &s, const AbstractMetaClass *metaClass,
GeneratorContext &classContext);
- void writeCustomConverterRegister(QTextStream& s, const CustomConversion* customConversion, const QString& converterVar);
+ void writeCustomConverterRegister(QTextStream &s, const CustomConversion *customConversion, const QString &converterVar);
- void writeContainerConverterFunctions(QTextStream& s, const AbstractMetaType* containerType);
+ void writeContainerConverterFunctions(QTextStream &s, const AbstractMetaType *containerType);
void writeMethodWrapperPreamble(QTextStream &s, OverloadData &overloadData,
GeneratorContext &context);
- void writeConstructorWrapper(QTextStream &s, const AbstractMetaFunctionList overloads, GeneratorContext &classContext);
- void writeMethodWrapper(QTextStream &s, const AbstractMetaFunctionList overloads,
+ void writeConstructorWrapper(QTextStream &s, const AbstractMetaFunctionList &overloads,
+ GeneratorContext &classContext);
+ void writeMethodWrapper(QTextStream &s, const AbstractMetaFunctionList &overloads,
GeneratorContext &classContext);
- void writeArgumentsInitializer(QTextStream& s, OverloadData& overloadData);
+ void writeArgumentsInitializer(QTextStream &s, OverloadData &overloadData);
void writeCppSelfAssigment(QTextStream &s, const GeneratorContext &context,
const QString &className, bool cppSelfAsReference,
bool useWrapperClass);
@@ -88,16 +89,18 @@ private:
bool hasStaticOverload = false,
bool cppSelfAsReference = false);
- void writeErrorSection(QTextStream& s, OverloadData& overloadData);
- void writeFunctionReturnErrorCheckSection(QTextStream& s, bool hasReturnValue = true);
+ void writeErrorSection(QTextStream &s, OverloadData &overloadData);
+ void writeFunctionReturnErrorCheckSection(QTextStream &s, bool hasReturnValue = true);
/// Writes the check section for the validity of wrapped C++ objects.
- void writeInvalidPyObjectCheck(QTextStream& s, const QString& pyObj);
+ void writeInvalidPyObjectCheck(QTextStream &s, const QString &pyObj);
- void writeTypeCheck(QTextStream& s, const AbstractMetaType* argType, QString argumentName, bool isNumber = false, QString customType = QString(), bool rejectNull = false);
- void writeTypeCheck(QTextStream& s, const OverloadData* overloadData, QString argumentName);
+ void writeTypeCheck(QTextStream &s, const AbstractMetaType *argType, const QString &argumentName,
+ bool isNumber = false, const QString &customType = QString(),
+ bool rejectNull = false);
+ void writeTypeCheck(QTextStream& s, const OverloadData *overloadData, QString argumentName);
- void writeTypeDiscoveryFunction(QTextStream& s, const AbstractMetaClass* metaClass);
+ void writeTypeDiscoveryFunction(QTextStream &s, const AbstractMetaClass *metaClass);
void writeSetattroFunction(QTextStream &s, GeneratorContext &context);
void writeGetattroFunction(QTextStream &s, GeneratorContext &context);
@@ -115,10 +118,10 @@ private:
* \param defaultValue an optional default value to be used instead of the conversion result
* \param castArgumentAsUnused if true the converted argument is cast as unused to avoid compiler warnings
*/
- void writeArgumentConversion(QTextStream& s, const AbstractMetaType* argType,
- const QString& argName, const QString& pyArgName,
- const AbstractMetaClass* context = 0,
- const QString& defaultValue = QString(),
+ void writeArgumentConversion(QTextStream &s, const AbstractMetaType *argType,
+ const QString &argName, const QString &pyArgName,
+ const AbstractMetaClass *context = nullptr,
+ const QString &defaultValue = QString(),
bool castArgumentAsUnused = false);
/**
@@ -132,19 +135,19 @@ private:
* \param newType It is set to true if the type returned is a new object that must be deallocated.
* \return The type of the argument indicated by \p argPos.
*/
- const AbstractMetaType* getArgumentType(const AbstractMetaFunction* func, int argPos);
+ const AbstractMetaType *getArgumentType(const AbstractMetaFunction *func, int argPos);
- void writePythonToCppTypeConversion(QTextStream& s,
- const AbstractMetaType* type,
- const QString& pyIn,
- const QString& cppOut,
- const AbstractMetaClass* context = 0,
- const QString& defaultValue = QString());
+ void writePythonToCppTypeConversion(QTextStream &s,
+ const AbstractMetaType *type,
+ const QString &pyIn,
+ const QString &cppOut,
+ const AbstractMetaClass *context = nullptr,
+ const QString &defaultValue = QString());
/// Writes the conversion rule for arguments of regular and virtual methods.
- void writeConversionRule(QTextStream& s, const AbstractMetaFunction* func, TypeSystem::Language language);
+ void writeConversionRule(QTextStream &s, const AbstractMetaFunction *func, TypeSystem::Language language);
/// Writes the conversion rule for the return value of a method.
- void writeConversionRule(QTextStream& s, const AbstractMetaFunction* func, TypeSystem::Language language, const QString& outputVar);
+ void writeConversionRule(QTextStream &s, const AbstractMetaFunction *func, TypeSystem::Language language, const QString &outputVar);
/**
* Set the Python method wrapper return value variable to Py_None if
@@ -155,7 +158,7 @@ private:
* \param thereIsReturnValue indicates if the return type of any of the other overloads
* for this function is different from 'void'
*/
- void writeNoneReturn(QTextStream& s, const AbstractMetaFunction* func, bool thereIsReturnValue);
+ void writeNoneReturn(QTextStream &s, const AbstractMetaFunction *func, bool thereIsReturnValue);
/**
* Writes the Python function wrapper overload decisor that selects which C++
@@ -163,9 +166,9 @@ private:
* \param s text stream to write
* \param overloadData the overload data describing all the possible overloads for the function/method
*/
- void writeOverloadedFunctionDecisor(QTextStream& s, const OverloadData& overloadData);
+ void writeOverloadedFunctionDecisor(QTextStream &s, const OverloadData &overloadData);
/// Recursive auxiliar method to the other writeOverloadedFunctionDecisor.
- void writeOverloadedFunctionDecisorEngine(QTextStream& s, const OverloadData* parentOverloadData);
+ void writeOverloadedFunctionDecisorEngine(QTextStream &s, const OverloadData *parentOverloadData);
/// Writes calls to all the possible method/function overloads.
void writeFunctionCalls(QTextStream &s,
@@ -179,55 +182,55 @@ private:
GeneratorContext &context);
/// Returns the name of a C++ to Python conversion function.
- static QString cppToPythonFunctionName(const QString& sourceTypeName, QString targetTypeName = QString());
+ static QString cppToPythonFunctionName(const QString &sourceTypeName, QString targetTypeName = QString());
/// Returns the name of a Python to C++ conversion function.
- static QString pythonToCppFunctionName(const QString& sourceTypeName, const QString& targetTypeName);
- static QString pythonToCppFunctionName(const AbstractMetaType* sourceType, const AbstractMetaType* targetType);
- static QString pythonToCppFunctionName(const CustomConversion::TargetToNativeConversion* toNative, const TypeEntry* targetType);
+ static QString pythonToCppFunctionName(const QString &sourceTypeName, const QString &targetTypeName);
+ static QString pythonToCppFunctionName(const AbstractMetaType *sourceType, const AbstractMetaType *targetType);
+ static QString pythonToCppFunctionName(const CustomConversion::TargetToNativeConversion *toNative, const TypeEntry *targetType);
/// Returns the name of a Python to C++ convertible check function.
- static QString convertibleToCppFunctionName(const QString& sourceTypeName, const QString& targetTypeName);
- static QString convertibleToCppFunctionName(const AbstractMetaType* sourceType, const AbstractMetaType* targetType);
- static QString convertibleToCppFunctionName(const CustomConversion::TargetToNativeConversion* toNative, const TypeEntry* targetType);
+ static QString convertibleToCppFunctionName(const QString &sourceTypeName, const QString &targetTypeName);
+ static QString convertibleToCppFunctionName(const AbstractMetaType *sourceType, const AbstractMetaType *targetType);
+ static QString convertibleToCppFunctionName(const CustomConversion::TargetToNativeConversion *toNative, const TypeEntry *targetType);
/// Writes a C++ to Python conversion function.
- void writeCppToPythonFunction(QTextStream& s, const QString& code, const QString& sourceTypeName, QString targetTypeName = QString());
- void writeCppToPythonFunction(QTextStream& s, const CustomConversion* customConversion);
- void writeCppToPythonFunction(QTextStream& s, const AbstractMetaType* containerType);
+ void writeCppToPythonFunction(QTextStream &s, const QString &code, const QString &sourceTypeName, QString targetTypeName = QString());
+ void writeCppToPythonFunction(QTextStream &s, const CustomConversion *customConversion);
+ void writeCppToPythonFunction(QTextStream &s, const AbstractMetaType *containerType);
/// Writes a Python to C++ conversion function.
- void writePythonToCppFunction(QTextStream& s, const QString& code, const QString& sourceTypeName, const QString& targetTypeName);
+ void writePythonToCppFunction(QTextStream &s, const QString &code, const QString &sourceTypeName, const QString &targetTypeName);
/// Writes a Python to C++ convertible check function.
- void writeIsPythonConvertibleToCppFunction(QTextStream& s,
- const QString& sourceTypeName,
- const QString& targetTypeName,
- const QString& condition,
+ void writeIsPythonConvertibleToCppFunction(QTextStream &s,
+ const QString &sourceTypeName,
+ const QString &targetTypeName,
+ const QString &condition,
QString pythonToCppFuncName = QString(),
bool acceptNoneAsCppNull = false);
/// Writes a pair of Python to C++ conversion and check functions.
- void writePythonToCppConversionFunctions(QTextStream& s,
- const AbstractMetaType* sourceType,
- const AbstractMetaType* targetType,
+ void writePythonToCppConversionFunctions(QTextStream &s,
+ const AbstractMetaType *sourceType,
+ const AbstractMetaType *targetType,
QString typeCheck = QString(),
QString conversion = QString(),
- QString preConversion = QString());
+ const QString &preConversion = QString());
/// Writes a pair of Python to C++ conversion and check functions for implicit conversions.
- void writePythonToCppConversionFunctions(QTextStream& s,
- const CustomConversion::TargetToNativeConversion* toNative,
- const TypeEntry* targetType);
+ void writePythonToCppConversionFunctions(QTextStream &s,
+ const CustomConversion::TargetToNativeConversion *toNative,
+ const TypeEntry *targetType);
/// Writes a pair of Python to C++ conversion and check functions for instantiated container types.
- void writePythonToCppConversionFunctions(QTextStream& s, const AbstractMetaType* containerType);
+ void writePythonToCppConversionFunctions(QTextStream &s, const AbstractMetaType *containerType);
- void writeAddPythonToCppConversion(QTextStream& s, const QString& converterVar, const QString& pythonToCppFunc, const QString& isConvertibleFunc);
+ void writeAddPythonToCppConversion(QTextStream &s, const QString &converterVar, const QString &pythonToCppFunc, const QString &isConvertibleFunc);
- void writeNamedArgumentResolution(QTextStream& s, const AbstractMetaFunction* func, bool usePyArgs);
+ void writeNamedArgumentResolution(QTextStream &s, const AbstractMetaFunction *func, bool usePyArgs);
/// Returns a string containing the name of an argument for the given function and argument index.
- QString argumentNameFromIndex(const AbstractMetaFunction* func, int argIndex, const AbstractMetaClass** wrappedClass);
+ QString argumentNameFromIndex(const AbstractMetaFunction *func, int argIndex, const AbstractMetaClass **wrappedClass);
void writeMethodCall(QTextStream &s, const AbstractMetaFunction *func,
GeneratorContext &context, int maxArgs = 0);
@@ -241,25 +244,25 @@ private:
void writeClassDefinition(QTextStream &s,
const AbstractMetaClass *metaClass,
GeneratorContext &classContext);
- void writeMethodDefinitionEntry(QTextStream& s, const AbstractMetaFunctionList &overloads);
- void writeMethodDefinition(QTextStream& s, const AbstractMetaFunctionList &overloads);
+ void writeMethodDefinitionEntry(QTextStream &s, const AbstractMetaFunctionList &overloads);
+ void writeMethodDefinition(QTextStream &s, const AbstractMetaFunctionList &overloads);
void writeSignatureInfo(QTextStream &s, const AbstractMetaFunctionList &overloads);
/// Writes the implementation of all methods part of python sequence protocol
void writeSequenceMethods(QTextStream &s,
const AbstractMetaClass *metaClass,
GeneratorContext &context);
- void writeTypeAsSequenceDefinition(QTextStream& s, const AbstractMetaClass* metaClass);
+ void writeTypeAsSequenceDefinition(QTextStream &s, const AbstractMetaClass *metaClass);
/// Writes the PyMappingMethods structure for types that supports the python mapping protocol.
- void writeTypeAsMappingDefinition(QTextStream& s, const AbstractMetaClass* metaClass);
+ void writeTypeAsMappingDefinition(QTextStream &s, const AbstractMetaClass *metaClass);
void writeMappingMethods(QTextStream &s,
const AbstractMetaClass *metaClass,
GeneratorContext &context);
- void writeTypeAsNumberDefinition(QTextStream& s, const AbstractMetaClass* metaClass);
+ void writeTypeAsNumberDefinition(QTextStream &s, const AbstractMetaClass *metaClass);
- void writeTpTraverseFunction(QTextStream& s, const AbstractMetaClass* metaClass);
- void writeTpClearFunction(QTextStream& s, const AbstractMetaClass* metaClass);
+ void writeTpTraverseFunction(QTextStream &s, const AbstractMetaClass *metaClass);
+ void writeTpClearFunction(QTextStream &s, const AbstractMetaClass *metaClass);
void writeCopyFunction(QTextStream &s, GeneratorContext &context);
@@ -272,35 +275,35 @@ private:
void writeRichCompareFunction(QTextStream &s, GeneratorContext &context);
- void writeEnumsInitialization(QTextStream& s, AbstractMetaEnumList& enums);
- void writeEnumInitialization(QTextStream& s, const AbstractMetaEnum* metaEnum);
+ void writeEnumsInitialization(QTextStream &s, AbstractMetaEnumList &enums);
+ void writeEnumInitialization(QTextStream &s, const AbstractMetaEnum *metaEnum);
- void writeSignalInitialization(QTextStream& s, const AbstractMetaClass* metaClass);
+ void writeSignalInitialization(QTextStream &s, const AbstractMetaClass *metaClass);
- void writeFlagsMethods(QTextStream& s, const AbstractMetaEnum* cppEnum);
- void writeFlagsToLong(QTextStream& s, const AbstractMetaEnum* cppEnum);
- void writeFlagsNonZero(QTextStream& s, const AbstractMetaEnum* cppEnum);
- void writeFlagsNumberMethodsDefinition(QTextStream& s, const AbstractMetaEnum* cppEnum);
- void writeFlagsBinaryOperator(QTextStream& s, const AbstractMetaEnum* cppEnum,
+ void writeFlagsMethods(QTextStream &s, const AbstractMetaEnum *cppEnum);
+ void writeFlagsToLong(QTextStream &s, const AbstractMetaEnum *cppEnum);
+ void writeFlagsNonZero(QTextStream &s, const AbstractMetaEnum *cppEnum);
+ void writeFlagsNumberMethodsDefinition(QTextStream &s, const AbstractMetaEnum *cppEnum);
+ void writeFlagsBinaryOperator(QTextStream &s, const AbstractMetaEnum *cppEnum,
const QString &pyOpName, const QString &cppOpName);
- void writeFlagsUnaryOperator(QTextStream& s, const AbstractMetaEnum* cppEnum,
+ void writeFlagsUnaryOperator(QTextStream &s, const AbstractMetaEnum *cppEnum,
const QString &pyOpName, const QString &cppOpName,
bool boolResult = false);
/// Writes the function that registers the multiple inheritance information for the classes that need it.
- void writeMultipleInheritanceInitializerFunction(QTextStream& s, const AbstractMetaClass* metaClass);
+ void writeMultipleInheritanceInitializerFunction(QTextStream &s, const AbstractMetaClass *metaClass);
/// Writes the implementation of special cast functions, used when we need to cast a class with multiple inheritance.
- void writeSpecialCastFunction(QTextStream& s, const AbstractMetaClass* metaClass);
+ void writeSpecialCastFunction(QTextStream &s, const AbstractMetaClass *metaClass);
- void writePrimitiveConverterInitialization(QTextStream& s, const CustomConversion* customConversion);
- void writeEnumConverterInitialization(QTextStream& s, const TypeEntry* enumType);
- void writeEnumConverterInitialization(QTextStream& s, const AbstractMetaEnum* metaEnum);
- void writeContainerConverterInitialization(QTextStream& s, const AbstractMetaType* type);
- void writeExtendedConverterInitialization(QTextStream& s, const TypeEntry* externalType, const QVector<const AbstractMetaClass*>& conversions);
+ void writePrimitiveConverterInitialization(QTextStream &s, const CustomConversion *customConversion);
+ void writeEnumConverterInitialization(QTextStream &s, const TypeEntry *enumType);
+ void writeEnumConverterInitialization(QTextStream &s, const AbstractMetaEnum *metaEnum);
+ void writeContainerConverterInitialization(QTextStream &s, const AbstractMetaType *type);
+ void writeExtendedConverterInitialization(QTextStream &s, const TypeEntry *externalType, const QVector<const AbstractMetaClass *>& conversions);
- void writeParentChildManagement(QTextStream& s, const AbstractMetaFunction* func, bool userHeuristicForReturn);
- bool writeParentChildManagement(QTextStream& s, const AbstractMetaFunction* func, int argIndex, bool userHeuristicPolicy);
- void writeReturnValueHeuristics(QTextStream& s, const AbstractMetaFunction* func, const QString& self = QLatin1String("self"));
+ void writeParentChildManagement(QTextStream &s, const AbstractMetaFunction *func, bool userHeuristicForReturn);
+ bool writeParentChildManagement(QTextStream &s, const AbstractMetaFunction *func, int argIndex, bool userHeuristicPolicy);
+ void writeReturnValueHeuristics(QTextStream &s, const AbstractMetaFunction *func, const QString &self = QLatin1String("self"));
void writeInitQtMetaTypeFunctionBody(QTextStream &s, GeneratorContext &context) const;
/**
@@ -309,34 +312,34 @@ private:
* \return name of the multiple inheritance information initializer function or
* an empty string if there is no multiple inheritance in its ancestry.
*/
- QString multipleInheritanceInitializerFunctionName(const AbstractMetaClass* metaClass);
+ QString multipleInheritanceInitializerFunctionName(const AbstractMetaClass *metaClass);
/// Returns a list of all classes to which the given class could be cast.
- QStringList getAncestorMultipleInheritance(const AbstractMetaClass* metaClass);
+ QStringList getAncestorMultipleInheritance(const AbstractMetaClass *metaClass);
/// Returns true if the given class supports the python number protocol
- bool supportsNumberProtocol(const AbstractMetaClass* metaClass);
+ bool supportsNumberProtocol(const AbstractMetaClass *metaClass);
/// Returns true if the given class supports the python sequence protocol
- bool supportsSequenceProtocol(const AbstractMetaClass* metaClass);
+ bool supportsSequenceProtocol(const AbstractMetaClass *metaClass);
/// Returns true if the given class supports the python mapping protocol
- bool supportsMappingProtocol(const AbstractMetaClass* metaClass);
+ bool supportsMappingProtocol(const AbstractMetaClass *metaClass);
/// Returns true if generator should produce getters and setters for the given class.
- bool shouldGenerateGetSetList(const AbstractMetaClass* metaClass);
+ bool shouldGenerateGetSetList(const AbstractMetaClass *metaClass);
void writeHashFunction(QTextStream &s, GeneratorContext &context);
/// Write default implementations for sequence protocol
void writeStdListWrapperMethods(QTextStream &s, GeneratorContext &context);
/// Helper function for writeStdListWrapperMethods.
- void writeIndexError(QTextStream& s, const QString& errorMsg);
+ void writeIndexError(QTextStream &s, const QString &errorMsg);
QString writeReprFunction(QTextStream &s, GeneratorContext &context);
- const AbstractMetaFunction *boolCast(const AbstractMetaClass* metaClass) const;
- bool hasBoolCast(const AbstractMetaClass* metaClass) const
+ const AbstractMetaFunction *boolCast(const AbstractMetaClass *metaClass) const;
+ bool hasBoolCast(const AbstractMetaClass *metaClass) const
{ return boolCast(metaClass) != nullptr; }
// Number protocol structure members names.
diff --git a/sources/shiboken2/generator/shiboken2/headergenerator.cpp b/sources/shiboken2/generator/shiboken2/headergenerator.cpp
index a55539d7c..8a2c56232 100644
--- a/sources/shiboken2/generator/shiboken2/headergenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/headergenerator.cpp
@@ -58,7 +58,7 @@ QString HeaderGenerator::fileNameForContext(GeneratorContext &context) const
return fileNameBase + fileNameSuffix();
}
-void HeaderGenerator::writeCopyCtor(QTextStream& s, const AbstractMetaClass* metaClass) const
+void HeaderGenerator::writeCopyCtor(QTextStream &s, const AbstractMetaClass *metaClass) const
{
s << INDENT << wrapperName(metaClass) << "(const " << metaClass->qualifiedCppName() << "& self)";
s << " : " << metaClass->qualifiedCppName() << "(self)" << endl;
@@ -66,7 +66,7 @@ void HeaderGenerator::writeCopyCtor(QTextStream& s, const AbstractMetaClass* met
s << INDENT << "}" << endl << endl;
}
-void HeaderGenerator::writeProtectedFieldAccessors(QTextStream& s, const AbstractMetaField* field) const
+void HeaderGenerator::writeProtectedFieldAccessors(QTextStream &s, const AbstractMetaField *field) const
{
AbstractMetaType *metaType = field->type();
QString fieldType = metaType->cppSignature();
@@ -81,10 +81,10 @@ void HeaderGenerator::writeProtectedFieldAccessors(QTextStream& s, const Abstrac
// Get function
s << INDENT << "inline " << fieldType
- << (useReference ? '*' : ' ')
+ << (useReference ? " *" : " ")
<< ' ' << protectedFieldGetterName(field) << "()"
<< " { return "
- << (useReference ? '&' : ' ') << "this->" << fieldName << "; }" << endl;
+ << (useReference ? " &" : " ") << "this->" << fieldName << "; }" << endl;
// Set function
s << INDENT << "inline void " << protectedFieldSetterName(field) << '(' << fieldType << " value)"
@@ -169,8 +169,8 @@ void HeaderGenerator::generateClass(QTextStream &s, GeneratorContext &classConte
if ((!avoidProtectedHack() || !metaClass->hasPrivateDestructor())
&& usePySideExtensions() && metaClass->isQObject()) {
s << "public:\n";
- s << INDENT << "int qt_metacall(QMetaObject::Call call, int id, void** args) override;" << endl;
- s << INDENT << "void* qt_metacast(const char* _clname) override;" << endl;
+ s << INDENT << "int qt_metacall(QMetaObject::Call call, int id, void **args) override;" << endl;
+ s << INDENT << "void *qt_metacast(const char *_clname) override;" << endl;
}
if (!m_inheritedOverloads.isEmpty()) {
@@ -205,7 +205,7 @@ void HeaderGenerator::generateClass(QTextStream &s, GeneratorContext &classConte
s << "#endif // SBK_" << outerHeaderGuard << "_H" << endl << endl;
}
-void HeaderGenerator::writeFunction(QTextStream& s, const AbstractMetaFunction* func)
+void HeaderGenerator::writeFunction(QTextStream &s, const AbstractMetaFunction *func)
{
// do not write copy ctors here.
@@ -228,9 +228,9 @@ void HeaderGenerator::writeFunction(QTextStream& s, const AbstractMetaFunction*
const AbstractMetaArgumentList &arguments = func->arguments();
for (const AbstractMetaArgument *arg : arguments) {
QString argName = arg->name();
- const TypeEntry* enumTypeEntry = 0;
+ const TypeEntry *enumTypeEntry = nullptr;
if (arg->type()->isFlags())
- enumTypeEntry = static_cast<const FlagsTypeEntry*>(arg->type()->typeEntry())->originator();
+ enumTypeEntry = static_cast<const FlagsTypeEntry *>(arg->type()->typeEntry())->originator();
else if (arg->type()->isEnum())
enumTypeEntry = arg->type()->typeEntry();
if (enumTypeEntry)
@@ -284,7 +284,7 @@ void HeaderGenerator::writeFunction(QTextStream& s, const AbstractMetaFunction*
}
}
-static void _writeTypeIndexValue(QTextStream& s, const QString& variableName,
+static void _writeTypeIndexValue(QTextStream &s, const QString &variableName,
int typeIndex)
{
s << " ";
@@ -294,15 +294,15 @@ static void _writeTypeIndexValue(QTextStream& s, const QString& variableName,
s << " = " << typeIndex;
}
-static inline void _writeTypeIndexValueLine(QTextStream& s,
- const QString& variableName,
+static inline void _writeTypeIndexValueLine(QTextStream &s,
+ const QString &variableName,
int typeIndex)
{
_writeTypeIndexValue(s, variableName, typeIndex);
s << ",\n";
}
-void HeaderGenerator::writeTypeIndexValueLine(QTextStream& s, const TypeEntry* typeEntry)
+void HeaderGenerator::writeTypeIndexValueLine(QTextStream &s, const TypeEntry *typeEntry)
{
if (!typeEntry || !typeEntry->generateCode())
return;
@@ -310,7 +310,7 @@ void HeaderGenerator::writeTypeIndexValueLine(QTextStream& s, const TypeEntry* t
const int typeIndex = typeEntry->sbkIndex();
_writeTypeIndexValueLine(s, getTypeIndexVariableName(typeEntry), typeIndex);
if (typeEntry->isComplex()) {
- const ComplexTypeEntry* cType = static_cast<const ComplexTypeEntry*>(typeEntry);
+ const auto *cType = static_cast<const ComplexTypeEntry *>(typeEntry);
if (cType->baseContainerType()) {
const AbstractMetaClass *metaClass = AbstractMetaClass::findClass(classes(), cType);
if (metaClass->templateBaseClass())
@@ -318,13 +318,13 @@ void HeaderGenerator::writeTypeIndexValueLine(QTextStream& s, const TypeEntry* t
}
}
if (typeEntry->isEnum()) {
- const EnumTypeEntry* ete = static_cast<const EnumTypeEntry*>(typeEntry);
+ auto ete = static_cast<const EnumTypeEntry *>(typeEntry);
if (ete->flags())
writeTypeIndexValueLine(s, ete->flags());
}
}
-void HeaderGenerator::writeTypeIndexValueLines(QTextStream& s, const AbstractMetaClass* metaClass)
+void HeaderGenerator::writeTypeIndexValueLines(QTextStream &s, const AbstractMetaClass *metaClass)
{
if (!metaClass->typeEntry()->generateCode())
return;
@@ -383,7 +383,7 @@ bool HeaderGenerator::finishGeneration()
AbstractMetaEnumList globalEnums = this->globalEnums();
AbstractMetaClassList classList = classes();
- std::sort(classList.begin(), classList.end(), [](AbstractMetaClass *a, AbstractMetaClass* b) {
+ std::sort(classList.begin(), classList.end(), [](AbstractMetaClass *a, AbstractMetaClass *b) {
return a->typeEntry()->sbkIndex() < b->typeEntry()->sbkIndex();
});
@@ -413,11 +413,11 @@ bool HeaderGenerator::finishGeneration()
macrosStream << "\n};\n";
macrosStream << "// This variable stores all Python types exported by this module." << endl;
- macrosStream << "extern PyTypeObject** " << cppApiVariableName() << ';' << endl << endl;
+ macrosStream << "extern PyTypeObject **" << cppApiVariableName() << ';' << endl << endl;
macrosStream << "// This variable stores the Python module object exported by this module." << endl;
- macrosStream << "extern PyObject* " << pythonModuleObjectName() << ';' << endl << endl;
+ macrosStream << "extern PyObject *" << pythonModuleObjectName() << ';' << endl << endl;
macrosStream << "// This variable stores all type converters exported by this module." << endl;
- macrosStream << "extern SbkConverter** " << convertersVariableName() << ';' << endl << endl;
+ macrosStream << "extern SbkConverter **" << convertersVariableName() << ';' << endl << endl;
// TODO-CONVERTER ------------------------------------------------------------------------------
// Using a counter would not do, a fix must be made to APIExtractor's getTypeIndex().
@@ -467,14 +467,14 @@ bool HeaderGenerator::finishGeneration()
continue;
//Includes
- const TypeEntry* classType = metaClass->typeEntry();
+ const TypeEntry *classType = metaClass->typeEntry();
includes << classType->include();
const AbstractMetaEnumList &enums = metaClass->enums();
for (const AbstractMetaEnum *cppEnum : enums) {
if (cppEnum->isAnonymous() || cppEnum->isPrivate())
continue;
- EnumTypeEntry* enumType = cppEnum->typeEntry();
+ EnumTypeEntry *enumType = cppEnum->typeEntry();
includes << enumType->include();
writeProtectedEnumSurrogate(protEnumsSurrogates, cppEnum);
writeSbkTypeFunction(typeFunctions, cppEnum);
@@ -497,7 +497,7 @@ bool HeaderGenerator::finishGeneration()
QString includeShield(QLatin1String("SBK_") + moduleName().toUpper() + QLatin1String("_PYTHON_H"));
FileOut file(moduleHeaderFileName);
- QTextStream& s = file.stream;
+ QTextStream &s = file.stream;
// write license comment
s << licenseComment() << endl << endl;
@@ -558,13 +558,13 @@ bool HeaderGenerator::finishGeneration()
return file.done() != FileOut::Failure;
}
-void HeaderGenerator::writeProtectedEnumSurrogate(QTextStream& s, const AbstractMetaEnum* cppEnum)
+void HeaderGenerator::writeProtectedEnumSurrogate(QTextStream &s, const AbstractMetaEnum *cppEnum)
{
if (avoidProtectedHack() && cppEnum->isProtected())
s << "enum " << protectedEnumSurrogateName(cppEnum) << " {};" << endl;
}
-void HeaderGenerator::writeSbkTypeFunction(QTextStream& s, const AbstractMetaEnum* cppEnum)
+void HeaderGenerator::writeSbkTypeFunction(QTextStream &s, const AbstractMetaEnum *cppEnum)
{
QString enumName;
if (avoidProtectedHack() && cppEnum->isProtected()) {
@@ -575,29 +575,29 @@ void HeaderGenerator::writeSbkTypeFunction(QTextStream& s, const AbstractMetaEnu
enumName = cppEnum->enclosingClass()->qualifiedCppName() + QLatin1String("::") + enumName;
}
- s << "template<> inline PyTypeObject* SbkType< ::" << enumName << " >() ";
+ s << "template<> inline PyTypeObject *SbkType< ::" << enumName << " >() ";
s << "{ return " << cpythonTypeNameExt(cppEnum->typeEntry()) << "; }\n";
- FlagsTypeEntry* flag = cppEnum->typeEntry()->flags();
+ FlagsTypeEntry *flag = cppEnum->typeEntry()->flags();
if (flag) {
- s << "template<> inline PyTypeObject* SbkType< ::" << flag->name() << " >() "
+ s << "template<> inline PyTypeObject *SbkType< ::" << flag->name() << " >() "
<< "{ return " << cpythonTypeNameExt(flag) << "; }\n";
}
}
-void HeaderGenerator::writeSbkTypeFunction(QTextStream& s, const AbstractMetaClass* cppClass)
+void HeaderGenerator::writeSbkTypeFunction(QTextStream &s, const AbstractMetaClass *cppClass)
{
- s << "template<> inline PyTypeObject* SbkType< ::" << cppClass->qualifiedCppName() << " >() "
- << "{ return reinterpret_cast<PyTypeObject*>(" << cpythonTypeNameExt(cppClass->typeEntry()) << "); }\n";
+ s << "template<> inline PyTypeObject *SbkType< ::" << cppClass->qualifiedCppName() << " >() "
+ << "{ return reinterpret_cast<PyTypeObject *>(" << cpythonTypeNameExt(cppClass->typeEntry()) << "); }\n";
}
void HeaderGenerator::writeSbkTypeFunction(QTextStream &s, const AbstractMetaType *metaType)
{
- s << "template<> inline PyTypeObject* SbkType< ::" << metaType->cppSignature() << " >() "
- << "{ return reinterpret_cast<PyTypeObject*>(" << cpythonTypeNameExt(metaType) << "); }\n";
+ s << "template<> inline PyTypeObject *SbkType< ::" << metaType->cppSignature() << " >() "
+ << "{ return reinterpret_cast<PyTypeObject *>(" << cpythonTypeNameExt(metaType) << "); }\n";
}
-void HeaderGenerator::writeInheritedOverloads(QTextStream& s)
+void HeaderGenerator::writeInheritedOverloads(QTextStream &s)
{
for (const AbstractMetaFunction *func : qAsConst(m_inheritedOverloads)) {
s << INDENT << "inline ";
@@ -608,9 +608,9 @@ void HeaderGenerator::writeInheritedOverloads(QTextStream& s)
const AbstractMetaArgumentList &arguments = func->arguments();
for (const AbstractMetaArgument *arg : arguments) {
QString argName = arg->name();
- const TypeEntry* enumTypeEntry = 0;
+ const TypeEntry *enumTypeEntry = nullptr;
if (arg->type()->isFlags())
- enumTypeEntry = static_cast<const FlagsTypeEntry*>(arg->type()->typeEntry())->originator();
+ enumTypeEntry = static_cast<const FlagsTypeEntry *>(arg->type()->typeEntry())->originator();
else if (arg->type()->isEnum())
enumTypeEntry = arg->type()->typeEntry();
if (enumTypeEntry)
diff --git a/sources/shiboken2/generator/shiboken2/headergenerator.h b/sources/shiboken2/generator/shiboken2/headergenerator.h
index f59e0fd9a..5f59dd13a 100644
--- a/sources/shiboken2/generator/shiboken2/headergenerator.h
+++ b/sources/shiboken2/generator/shiboken2/headergenerator.h
@@ -48,22 +48,22 @@ public:
protected:
QString fileNameSuffix() const override;
QString fileNameForContext(GeneratorContext &context) const override;
- void generateClass(QTextStream& s, GeneratorContext &classContext) override;
+ void generateClass(QTextStream &s, GeneratorContext &classContext) override;
bool finishGeneration() override;
private:
- void writeCopyCtor(QTextStream &s, const AbstractMetaClass* metaClass) const;
- void writeProtectedFieldAccessors(QTextStream& s, const AbstractMetaField* field) const;
- void writeFunction(QTextStream& s, const AbstractMetaFunction* func);
- void writeSbkTypeFunction(QTextStream& s, const AbstractMetaEnum* cppEnum);
- void writeSbkTypeFunction(QTextStream& s, const AbstractMetaClass* cppClass);
+ void writeCopyCtor(QTextStream &s, const AbstractMetaClass *metaClass) const;
+ void writeProtectedFieldAccessors(QTextStream &s, const AbstractMetaField *field) const;
+ void writeFunction(QTextStream &s, const AbstractMetaFunction *func);
+ void writeSbkTypeFunction(QTextStream &s, const AbstractMetaEnum *cppEnum);
+ void writeSbkTypeFunction(QTextStream &s, const AbstractMetaClass *cppClass);
void writeSbkTypeFunction(QTextStream &s, const AbstractMetaType *metaType);
- void writeTypeIndexValueLine(QTextStream& s, const TypeEntry* typeEntry);
- void writeTypeIndexValueLines(QTextStream& s, const AbstractMetaClass* metaClass);
- void writeProtectedEnumSurrogate(QTextStream& s, const AbstractMetaEnum* cppEnum);
- void writeInheritedOverloads(QTextStream& s);
+ void writeTypeIndexValueLine(QTextStream &s, const TypeEntry *typeEntry);
+ void writeTypeIndexValueLines(QTextStream &s, const AbstractMetaClass *metaClass);
+ void writeProtectedEnumSurrogate(QTextStream &s, const AbstractMetaEnum *cppEnum);
+ void writeInheritedOverloads(QTextStream &s);
- QSet<const AbstractMetaFunction*> m_inheritedOverloads;
+ QSet<const AbstractMetaFunction *> m_inheritedOverloads;
};
#endif // HEADERGENERATOR_H
diff --git a/sources/shiboken2/generator/shiboken2/overloaddata.cpp b/sources/shiboken2/generator/shiboken2/overloaddata.cpp
index bbcdd6d5f..4aa5e5c02 100644
--- a/sources/shiboken2/generator/shiboken2/overloaddata.cpp
+++ b/sources/shiboken2/generator/shiboken2/overloaddata.cpp
@@ -40,7 +40,7 @@
static const TypeEntry *getReferencedTypeEntry(const TypeEntry *typeEntry)
{
if (typeEntry->isPrimitive()) {
- const PrimitiveTypeEntry* pte = dynamic_cast<const PrimitiveTypeEntry*>(typeEntry);
+ auto pte = dynamic_cast<const PrimitiveTypeEntry *>(typeEntry);
while (pte->referencedTypeEntry())
pte = pte->referencedTypeEntry();
typeEntry = pte;
@@ -48,9 +48,9 @@ static const TypeEntry *getReferencedTypeEntry(const TypeEntry *typeEntry)
return typeEntry;
}
-static QString getTypeName(const AbstractMetaType* type)
+static QString getTypeName(const AbstractMetaType *type)
{
- const TypeEntry* typeEntry = getReferencedTypeEntry(type->typeEntry());
+ const TypeEntry *typeEntry = getReferencedTypeEntry(type->typeEntry());
QString typeName = typeEntry->name();
if (typeEntry->isContainer()) {
QStringList types;
@@ -64,12 +64,12 @@ static QString getTypeName(const AbstractMetaType* type)
return typeName;
}
-static QString getTypeName(const OverloadData* ov)
+static QString getTypeName(const OverloadData *ov)
{
return ov->hasArgumentTypeReplace() ? ov->argumentTypeReplaced() : getTypeName(ov->argType());
}
-static bool typesAreEqual(const AbstractMetaType* typeA, const AbstractMetaType* typeB)
+static bool typesAreEqual(const AbstractMetaType *typeA, const AbstractMetaType *typeB)
{
if (typeA->typeEntry() == typeB->typeEntry()) {
if (typeA->isContainer() || typeA->isSmartPointer()) {
@@ -100,7 +100,7 @@ struct OverloadSortData
* a OverloadData. This is done to express type dependencies that could
* or could not appear in overloaded signatures not processed yet.
*/
- void mapType(const QString& typeName)
+ void mapType(const QString &typeName)
{
if (map.contains(typeName))
return;
@@ -110,7 +110,7 @@ struct OverloadSortData
counter++;
}
- void mapType(OverloadData* overloadData)
+ void mapType(OverloadData *overloadData)
{
QString typeName = getTypeName(overloadData);
map[typeName] = counter;
@@ -122,7 +122,7 @@ struct OverloadSortData
int counter = 0;
QHash<QString, int> map; // typeName -> id
- QHash<int, OverloadData*> reverseMap; // id -> OverloadData;
+ QHash<int, OverloadData *> reverseMap; // id -> OverloadData;
};
/**
@@ -130,10 +130,10 @@ struct OverloadSortData
* an instantiation taken either from an implicit conversion expressed by the function argument,
* or from the string argument implicitConvTypeName.
*/
-static QString getImplicitConversionTypeName(const AbstractMetaType* containerType,
- const AbstractMetaType* instantiation,
- const AbstractMetaFunction* function,
- const QString& implicitConvTypeName = QString())
+static QString getImplicitConversionTypeName(const AbstractMetaType *containerType,
+ const AbstractMetaType *instantiation,
+ const AbstractMetaFunction *function,
+ const QString &implicitConvTypeName = QString())
{
QString impConv;
if (!implicitConvTypeName.isEmpty())
@@ -254,7 +254,7 @@ void OverloadData::sortNextOverloads()
// be called. In the case of primitive types, list<double> must come before list<int>.
if (instantiation->isPrimitive() && (signedIntegerPrimitives.contains(instantiation->name()))) {
for (const QString &primitive : qAsConst(nonIntegerPrimitives))
- sortData.mapType(getImplicitConversionTypeName(ov->argType(), instantiation, 0, primitive));
+ sortData.mapType(getImplicitConversionTypeName(ov->argType(), instantiation, nullptr, primitive));
} else {
const AbstractMetaFunctionList &funcs = m_generator->implicitConversions(instantiation);
for (const AbstractMetaFunction *function : funcs)
@@ -267,7 +267,7 @@ void OverloadData::sortNextOverloads()
// Create the graph of type dependencies based on implicit conversions.
Graph graph(sortData.reverseMap.count());
// All C++ primitive types, add any forgotten type AT THE END OF THIS LIST!
- const char* primitiveTypes[] = {"int",
+ const char *primitiveTypes[] = {"int",
"unsigned int",
"long",
"unsigned long",
@@ -280,7 +280,7 @@ void OverloadData::sortNextOverloads()
"double",
"const char*"
};
- const int numPrimitives = sizeof(primitiveTypes)/sizeof(const char*);
+ const int numPrimitives = sizeof(primitiveTypes)/sizeof(const char *);
bool hasPrimitive[numPrimitives];
for (int i = 0; i < numPrimitives; ++i)
hasPrimitive[i] = sortData.map.contains(QLatin1String(primitiveTypes[i]));
@@ -293,7 +293,7 @@ void OverloadData::sortNextOverloads()
MetaFunctionList involvedConversions;
for (OverloadData *ov : qAsConst(m_nextOverloadData)) {
- const AbstractMetaType* targetType = ov->argType();
+ const AbstractMetaType *targetType = ov->argType();
const QString targetTypeEntryName(getTypeName(ov));
int targetTypeId = sortData.map[targetTypeEntryName];
@@ -346,7 +346,7 @@ void OverloadData::sortNextOverloads()
if (instantiation->isPrimitive() && (signedIntegerPrimitives.contains(instantiation->name()))) {
for (const QString &primitive : qAsConst(nonIntegerPrimitives)) {
- QString convertibleTypeName = getImplicitConversionTypeName(ov->argType(), instantiation, 0, primitive);
+ QString convertibleTypeName = getImplicitConversionTypeName(ov->argType(), instantiation, nullptr, primitive);
if (!graph.containsEdge(targetTypeId, sortData.map[convertibleTypeName])) // Avoid cyclic dependency.
graph.addEdge(sortData.map[convertibleTypeName], targetTypeId);
}
@@ -404,7 +404,7 @@ void OverloadData::sortNextOverloads()
graph.addEdge(sortData.map[QLatin1String("QString")], sortData.map[QLatin1String("QByteArray")]);
for (OverloadData *ov : qAsConst(m_nextOverloadData)) {
- const AbstractMetaType* targetType = ov->argType();
+ const AbstractMetaType *targetType = ov->argType();
if (!targetType->isEnum())
continue;
@@ -462,13 +462,13 @@ void OverloadData::sortNextOverloads()
*
* Given these two overloads, there will be the following graph:
*
- * addStuff - double - PyObject*
+ * addStuff - double - PyObject *
* \- int
*
*/
-OverloadData::OverloadData(const AbstractMetaFunctionList& overloads, const ShibokenGenerator* generator)
- : m_minArgs(256), m_maxArgs(0), m_argPos(-1), m_argType(0),
- m_headOverloadData(this), m_previousOverloadData(0), m_generator(generator)
+OverloadData::OverloadData(const AbstractMetaFunctionList &overloads, const ShibokenGenerator *generator)
+ : m_minArgs(256), m_maxArgs(0), m_argPos(-1), m_argType(nullptr),
+ m_headOverloadData(this), m_previousOverloadData(nullptr), m_generator(generator)
{
for (const AbstractMetaFunction *func : overloads) {
m_overloads.append(func);
@@ -477,7 +477,7 @@ OverloadData::OverloadData(const AbstractMetaFunctionList& overloads, const Shib
m_minArgs = argSize;
else if (m_maxArgs < argSize)
m_maxArgs = argSize;
- OverloadData* currentOverloadData = this;
+ OverloadData *currentOverloadData = this;
const AbstractMetaArgumentList &arguments = func->arguments();
for (const AbstractMetaArgument *arg : arguments) {
if (func->argumentRemoved(arg->argumentIndex() + 1))
@@ -495,8 +495,8 @@ OverloadData::OverloadData(const AbstractMetaFunctionList& overloads, const Shib
m_headOverloadData->m_minArgs = maxArgs();
}
-OverloadData::OverloadData(OverloadData* headOverloadData, const AbstractMetaFunction* func,
- const AbstractMetaType* argType, int argPos)
+OverloadData::OverloadData(OverloadData *headOverloadData, const AbstractMetaFunction *func,
+ const AbstractMetaType *argType, int argPos)
: m_minArgs(256), m_maxArgs(0), m_argPos(argPos), m_argType(argType),
m_headOverloadData(headOverloadData), m_previousOverloadData(nullptr),
m_generator(nullptr)
@@ -505,7 +505,7 @@ OverloadData::OverloadData(OverloadData* headOverloadData, const AbstractMetaFun
this->addOverload(func);
}
-void OverloadData::addOverload(const AbstractMetaFunction* func)
+void OverloadData::addOverload(const AbstractMetaFunction *func)
{
int origNumArgs = func->arguments().size();
int removed = numberOfRemovedArguments(func);
@@ -530,11 +530,11 @@ void OverloadData::addOverload(const AbstractMetaFunction* func)
m_overloads.append(func);
}
-OverloadData* OverloadData::addOverloadData(const AbstractMetaFunction* func,
- const AbstractMetaArgument* arg)
+OverloadData *OverloadData::addOverloadData(const AbstractMetaFunction *func,
+ const AbstractMetaArgument *arg)
{
- const AbstractMetaType* argType = arg->type();
- OverloadData* overloadData = 0;
+ const AbstractMetaType *argType = arg->type();
+ OverloadData *overloadData = nullptr;
if (!func->isOperatorOverload()) {
for (OverloadData *tmp : qAsConst(m_nextOverloadData)) {
// TODO: 'const char *', 'char *' and 'char' will have the same TypeEntry?
@@ -604,7 +604,7 @@ bool OverloadData::hasAllowThread() const
return false;
}
-bool OverloadData::hasStaticFunction(const AbstractMetaFunctionList& overloads)
+bool OverloadData::hasStaticFunction(const AbstractMetaFunctionList &overloads)
{
for (const AbstractMetaFunction *func : qAsConst(overloads)) {
if (func->isStatic())
@@ -622,7 +622,7 @@ bool OverloadData::hasStaticFunction() const
return false;
}
-bool OverloadData::hasInstanceFunction(const AbstractMetaFunctionList& overloads)
+bool OverloadData::hasInstanceFunction(const AbstractMetaFunctionList &overloads)
{
for (const AbstractMetaFunction *func : qAsConst(overloads)) {
if (!func->isStatic())
@@ -640,7 +640,7 @@ bool OverloadData::hasInstanceFunction() const
return false;
}
-bool OverloadData::hasStaticAndInstanceFunctions(const AbstractMetaFunctionList& overloads)
+bool OverloadData::hasStaticAndInstanceFunctions(const AbstractMetaFunctionList &overloads)
{
return OverloadData::hasStaticFunction(overloads) && OverloadData::hasInstanceFunction(overloads);
}
@@ -650,15 +650,15 @@ bool OverloadData::hasStaticAndInstanceFunctions() const
return OverloadData::hasStaticFunction() && OverloadData::hasInstanceFunction();
}
-const AbstractMetaFunction* OverloadData::referenceFunction() const
+const AbstractMetaFunction *OverloadData::referenceFunction() const
{
return m_overloads.constFirst();
}
-const AbstractMetaArgument* OverloadData::argument(const AbstractMetaFunction* func) const
+const AbstractMetaArgument *OverloadData::argument(const AbstractMetaFunction *func) const
{
if (isHeadOverloadData() || !m_overloads.contains(func))
- return 0;
+ return nullptr;
int argPos = 0;
int removed = 0;
@@ -672,7 +672,7 @@ const AbstractMetaArgument* OverloadData::argument(const AbstractMetaFunction* f
return func->arguments().at(m_argPos + removed);
}
-OverloadDataList OverloadData::overloadDataOnPosition(OverloadData* overloadData, int argPos) const
+OverloadDataList OverloadData::overloadDataOnPosition(OverloadData *overloadData, int argPos) const
{
OverloadDataList overloadDataList;
if (overloadData->argPos() == argPos) {
@@ -701,27 +701,27 @@ bool OverloadData::nextArgumentHasDefaultValue() const
return false;
}
-static OverloadData* _findNextArgWithDefault(OverloadData* overloadData)
+static OverloadData *_findNextArgWithDefault(OverloadData *overloadData)
{
if (overloadData->getFunctionWithDefaultValue())
return overloadData;
- OverloadData* result = 0;
+ OverloadData *result = nullptr;
const OverloadDataList &data = overloadData->nextOverloadData();
for (OverloadData *odata : data) {
- OverloadData* tmp = _findNextArgWithDefault(odata);
+ OverloadData *tmp = _findNextArgWithDefault(odata);
if (!result || (tmp && result->argPos() > tmp->argPos()))
result = tmp;
}
return result;
}
-OverloadData* OverloadData::findNextArgWithDefault()
+OverloadData *OverloadData::findNextArgWithDefault()
{
return _findNextArgWithDefault(this);
}
-bool OverloadData::isFinalOccurrence(const AbstractMetaFunction* func) const
+bool OverloadData::isFinalOccurrence(const AbstractMetaFunction *func) const
{
for (const OverloadData *pd : m_nextOverloadData) {
if (pd->overloads().contains(func))
@@ -746,7 +746,7 @@ OverloadData::MetaFunctionList OverloadData::overloadsWithoutRepetition() const
return overloads;
}
-const AbstractMetaFunction* OverloadData::getFunctionWithDefaultValue() const
+const AbstractMetaFunction *OverloadData::getFunctionWithDefaultValue() const
{
for (const AbstractMetaFunction *func : m_overloads) {
int removedArgs = 0;
@@ -757,7 +757,7 @@ const AbstractMetaFunction* OverloadData::getFunctionWithDefaultValue() const
if (!ShibokenGenerator::getDefaultValue(func, func->arguments().at(m_argPos + removedArgs)).isEmpty())
return func;
}
- return 0;
+ return nullptr;
}
QVector<int> OverloadData::invalidArgumentLengths() const
@@ -787,7 +787,7 @@ QVector<int> OverloadData::invalidArgumentLengths() const
return invalidArgLengths;
}
-int OverloadData::numberOfRemovedArguments(const AbstractMetaFunction* func, int finalArgPos)
+int OverloadData::numberOfRemovedArguments(const AbstractMetaFunction *func, int finalArgPos)
{
int removed = 0;
if (finalArgPos < 0) {
@@ -804,7 +804,7 @@ int OverloadData::numberOfRemovedArguments(const AbstractMetaFunction* func, int
return removed;
}
-QPair<int, int> OverloadData::getMinMaxArguments(const AbstractMetaFunctionList& overloads)
+QPair<int, int> OverloadData::getMinMaxArguments(const AbstractMetaFunctionList &overloads)
{
int minArgs = 10000;
int maxArgs = 0;
@@ -827,7 +827,7 @@ QPair<int, int> OverloadData::getMinMaxArguments(const AbstractMetaFunctionList&
return {minArgs, maxArgs};
}
-bool OverloadData::isSingleArgument(const AbstractMetaFunctionList& overloads)
+bool OverloadData::isSingleArgument(const AbstractMetaFunctionList &overloads)
{
bool singleArgument = true;
for (const AbstractMetaFunction *func : overloads) {
@@ -863,7 +863,7 @@ QString OverloadData::dumpGraph() const
QString result;
QTextStream s(&result);
if (m_argPos == -1) {
- const AbstractMetaFunction* rfunc = referenceFunction();
+ const AbstractMetaFunction *rfunc = referenceFunction();
s << "digraph OverloadedFunction {" << endl;
s << INDENT << "graph [fontsize=12 fontname=freemono labelloc=t splines=true overlap=false rankdir=LR];" << endl;
@@ -964,7 +964,7 @@ QString OverloadData::dumpGraph() const
// Show default values (original and modified) for various functions
for (const AbstractMetaFunction *func : m_overloads) {
- const AbstractMetaArgument* arg = argument(func);
+ const AbstractMetaArgument *arg = argument(func);
if (!arg)
continue;
QString argDefault = ShibokenGenerator::getDefaultValue(func, arg);
@@ -989,7 +989,7 @@ QString OverloadData::dumpGraph() const
return result;
}
-int OverloadData::functionNumber(const AbstractMetaFunction* func) const
+int OverloadData::functionNumber(const AbstractMetaFunction *func) const
{
return m_headOverloadData->m_overloads.indexOf(func);
}
@@ -1010,7 +1010,7 @@ QString OverloadData::argumentTypeReplaced() const
return m_argTypeReplaced;
}
-bool OverloadData::hasArgumentWithDefaultValue(const AbstractMetaFunctionList& overloads)
+bool OverloadData::hasArgumentWithDefaultValue(const AbstractMetaFunctionList &overloads)
{
if (OverloadData::getMinMaxArguments(overloads).second == 0)
return false;
@@ -1032,7 +1032,7 @@ bool OverloadData::hasArgumentWithDefaultValue() const
return false;
}
-bool OverloadData::hasArgumentWithDefaultValue(const AbstractMetaFunction* func)
+bool OverloadData::hasArgumentWithDefaultValue(const AbstractMetaFunction *func)
{
const AbstractMetaArgumentList &arguments = func->arguments();
for (const AbstractMetaArgument *arg : arguments) {
@@ -1044,7 +1044,7 @@ bool OverloadData::hasArgumentWithDefaultValue(const AbstractMetaFunction* func)
return false;
}
-AbstractMetaArgumentList OverloadData::getArgumentsWithDefaultValues(const AbstractMetaFunction* func)
+AbstractMetaArgumentList OverloadData::getArgumentsWithDefaultValues(const AbstractMetaFunction *func)
{
AbstractMetaArgumentList args;
const AbstractMetaArgumentList &arguments = func->arguments();
diff --git a/sources/shiboken2/generator/shiboken2/overloaddata.h b/sources/shiboken2/generator/shiboken2/overloaddata.h
index 4759ca9c3..4fd4199e5 100644
--- a/sources/shiboken2/generator/shiboken2/overloaddata.h
+++ b/sources/shiboken2/generator/shiboken2/overloaddata.h
@@ -38,21 +38,21 @@ QT_FORWARD_DECLARE_CLASS(QDebug)
class ShibokenGenerator;
class OverloadData;
-typedef QVector<OverloadData *> OverloadDataList;
+using OverloadDataList = QVector<OverloadData *>;
class OverloadData
{
public:
- typedef QVector<const AbstractMetaFunction *> MetaFunctionList;
+ using MetaFunctionList = QVector<const AbstractMetaFunction *>;
- OverloadData(const AbstractMetaFunctionList& overloads, const ShibokenGenerator* generator);
+ OverloadData(const AbstractMetaFunctionList &overloads, const ShibokenGenerator *generator);
~OverloadData();
int minArgs() const { return m_headOverloadData->m_minArgs; }
int maxArgs() const { return m_headOverloadData->m_maxArgs; }
int argPos() const { return m_argPos; }
- const AbstractMetaType* argType() const { return m_argType; }
+ const AbstractMetaType *argType() const { return m_argType; }
/// Returns a string list containing all the possible return types (including void) for the current OverloadData.
QStringList returnTypes() const;
@@ -70,49 +70,49 @@ public:
bool hasStaticFunction() const;
/// Returns true if any of the overloads passed as argument is static.
- static bool hasStaticFunction(const AbstractMetaFunctionList& overloads);
+ static bool hasStaticFunction(const AbstractMetaFunctionList &overloads);
/// Returns true if any of the overloads for the current OverloadData is not static.
bool hasInstanceFunction() const;
/// Returns true if any of the overloads passed as argument is not static.
- static bool hasInstanceFunction(const AbstractMetaFunctionList& overloads);
+ static bool hasInstanceFunction(const AbstractMetaFunctionList &overloads);
/// Returns true if among the overloads for the current OverloadData there are static and non-static methods altogether.
bool hasStaticAndInstanceFunctions() const;
/// Returns true if among the overloads passed as argument there are static and non-static methods altogether.
- static bool hasStaticAndInstanceFunctions(const AbstractMetaFunctionList& overloads);
+ static bool hasStaticAndInstanceFunctions(const AbstractMetaFunctionList &overloads);
- const AbstractMetaFunction* referenceFunction() const;
- const AbstractMetaArgument* argument(const AbstractMetaFunction* func) const;
+ const AbstractMetaFunction *referenceFunction() const;
+ const AbstractMetaArgument *argument(const AbstractMetaFunction *func) const;
OverloadDataList overloadDataOnPosition(int argPos) const;
bool isHeadOverloadData() const { return this == m_headOverloadData; }
/// Returns the root OverloadData object that represents all the overloads.
- OverloadData* headOverloadData() const { return m_headOverloadData; }
+ OverloadData *headOverloadData() const { return m_headOverloadData; }
/// Returns the function that has a default value at the current OverloadData argument position, otherwise returns null.
- const AbstractMetaFunction* getFunctionWithDefaultValue() const;
+ const AbstractMetaFunction *getFunctionWithDefaultValue() const;
bool nextArgumentHasDefaultValue() const;
/// Returns the nearest occurrence, including this instance, of an argument with a default value.
- OverloadData* findNextArgWithDefault();
- bool isFinalOccurrence(const AbstractMetaFunction* func) const;
+ OverloadData *findNextArgWithDefault();
+ bool isFinalOccurrence(const AbstractMetaFunction *func) const;
/// Returns the list of overloads removing repeated constant functions (ex.: "foo()" and "foo()const", the second is removed).
MetaFunctionList overloadsWithoutRepetition() const;
- const MetaFunctionList& overloads() const { return m_overloads; }
+ const MetaFunctionList &overloads() const { return m_overloads; }
OverloadDataList nextOverloadData() const { return m_nextOverloadData; }
- OverloadData* previousOverloadData() const { return m_previousOverloadData; }
+ OverloadData *previousOverloadData() const { return m_previousOverloadData; }
QVector<int> invalidArgumentLengths() const;
- static int numberOfRemovedArguments(const AbstractMetaFunction* func, int finalArgPos = -1);
- static QPair<int, int> getMinMaxArguments(const AbstractMetaFunctionList& overloads);
+ static int numberOfRemovedArguments(const AbstractMetaFunction *func, int finalArgPos = -1);
+ static QPair<int, int> getMinMaxArguments(const AbstractMetaFunctionList &overloads);
/// Returns true if all overloads have no more than one argument.
- static bool isSingleArgument(const AbstractMetaFunctionList& overloads);
+ static bool isSingleArgument(const AbstractMetaFunctionList &overloads);
void dumpGraph(const QString &filename) const;
QString dumpGraph() const;
@@ -121,39 +121,39 @@ public:
QString argumentTypeReplaced() const;
bool hasArgumentWithDefaultValue() const;
- static bool hasArgumentWithDefaultValue(const AbstractMetaFunctionList& overloads);
- static bool hasArgumentWithDefaultValue(const AbstractMetaFunction* func);
+ static bool hasArgumentWithDefaultValue(const AbstractMetaFunctionList &overloads);
+ static bool hasArgumentWithDefaultValue(const AbstractMetaFunction *func);
/// Returns a list of function arguments which have default values and were not removed.
- static AbstractMetaArgumentList getArgumentsWithDefaultValues(const AbstractMetaFunction* func);
+ static AbstractMetaArgumentList getArgumentsWithDefaultValues(const AbstractMetaFunction *func);
#ifndef QT_NO_DEBUG_STREAM
void formatDebug(QDebug &) const;
#endif
private:
- OverloadData(OverloadData* headOverloadData, const AbstractMetaFunction* func,
- const AbstractMetaType* argType, int argPos);
+ OverloadData(OverloadData *headOverloadData, const AbstractMetaFunction *func,
+ const AbstractMetaType *argType, int argPos);
- void addOverload(const AbstractMetaFunction* func);
- OverloadData* addOverloadData(const AbstractMetaFunction* func, const AbstractMetaArgument* arg);
+ void addOverload(const AbstractMetaFunction *func);
+ OverloadData *addOverloadData(const AbstractMetaFunction *func, const AbstractMetaArgument *arg);
void sortNextOverloads();
- int functionNumber(const AbstractMetaFunction* func) const;
- OverloadDataList overloadDataOnPosition(OverloadData* overloadData, int argPos) const;
+ int functionNumber(const AbstractMetaFunction *func) const;
+ OverloadDataList overloadDataOnPosition(OverloadData *overloadData, int argPos) const;
int m_minArgs;
int m_maxArgs;
int m_argPos;
- const AbstractMetaType* m_argType;
+ const AbstractMetaType *m_argType;
QString m_argTypeReplaced;
MetaFunctionList m_overloads;
- OverloadData* m_headOverloadData;
+ OverloadData *m_headOverloadData;
OverloadDataList m_nextOverloadData;
- OverloadData* m_previousOverloadData;
- const ShibokenGenerator* m_generator;
+ OverloadData *m_previousOverloadData;
+ const ShibokenGenerator *m_generator;
};
#ifndef QT_NO_DEBUG_STREAM
diff --git a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
index 2b3b20c75..8e27777d6 100644
--- a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
@@ -62,7 +62,7 @@ const char *SMART_POINTER_GETTER = "kSmartPointerGetter";
const char *CONV_RULE_OUT_VAR_SUFFIX = "_out";
const char *BEGIN_ALLOW_THREADS =
- "PyThreadState* _save = PyEval_SaveThread(); // Py_BEGIN_ALLOW_THREADS";
+ "PyThreadState *_save = PyEval_SaveThread(); // Py_BEGIN_ALLOW_THREADS";
const char *END_ALLOW_THREADS = "PyEval_RestoreThread(_save); // Py_END_ALLOW_THREADS";
//static void dumpFunction(AbstractMetaFunctionList lst);
@@ -277,15 +277,15 @@ void ShibokenGenerator::initKnownPythonTypes()
<< QLatin1String("PyObject*") << QLatin1String("PyObject *") << QLatin1String("PyTupleObject*");
}
-QString ShibokenGenerator::translateTypeForWrapperMethod(const AbstractMetaType* cType,
- const AbstractMetaClass* context,
+QString ShibokenGenerator::translateTypeForWrapperMethod(const AbstractMetaType *cType,
+ const AbstractMetaClass *context,
Options options) const
{
if (cType->isArray())
return translateTypeForWrapperMethod(cType->arrayElementType(), context, options) + QLatin1String("[]");
if (avoidProtectedHack() && cType->isEnum()) {
- const AbstractMetaEnum* metaEnum = findAbstractMetaEnum(cType);
+ const AbstractMetaEnum *metaEnum = findAbstractMetaEnum(cType);
if (metaEnum && metaEnum->isProtected())
return protectedEnumSurrogateName(metaEnum);
}
@@ -293,7 +293,7 @@ QString ShibokenGenerator::translateTypeForWrapperMethod(const AbstractMetaType*
return translateType(cType, context, options);
}
-bool ShibokenGenerator::shouldGenerateCppWrapper(const AbstractMetaClass* metaClass) const
+bool ShibokenGenerator::shouldGenerateCppWrapper(const AbstractMetaClass *metaClass) const
{
if (metaClass->isNamespace() || (metaClass->attributes() & AbstractMetaAttributes::FinalCppClass))
return false;
@@ -320,7 +320,7 @@ bool ShibokenGenerator::shouldGenerateCppWrapper(const AbstractMetaClass* metaCl
return result;
}
-void ShibokenGenerator::lookForEnumsInClassesNotToBeGenerated(AbstractMetaEnumList& enumList, const AbstractMetaClass* metaClass)
+void ShibokenGenerator::lookForEnumsInClassesNotToBeGenerated(AbstractMetaEnumList &enumList, const AbstractMetaClass *metaClass)
{
if (!metaClass)
return;
@@ -330,17 +330,17 @@ void ShibokenGenerator::lookForEnumsInClassesNotToBeGenerated(AbstractMetaEnumLi
for (const AbstractMetaEnum *metaEnum : enums) {
if (metaEnum->isPrivate() || metaEnum->typeEntry()->codeGeneration() == TypeEntry::GenerateForSubclass)
continue;
- if (!enumList.contains(const_cast<AbstractMetaEnum*>(metaEnum)))
- enumList.append(const_cast<AbstractMetaEnum*>(metaEnum));
+ if (!enumList.contains(const_cast<AbstractMetaEnum *>(metaEnum)))
+ enumList.append(const_cast<AbstractMetaEnum *>(metaEnum));
}
lookForEnumsInClassesNotToBeGenerated(enumList, metaClass->enclosingClass());
}
}
-static const AbstractMetaClass* getProperEnclosingClass(const AbstractMetaClass* metaClass)
+static const AbstractMetaClass *getProperEnclosingClass(const AbstractMetaClass *metaClass)
{
if (!metaClass)
- return 0;
+ return nullptr;
if (metaClass->typeEntry()->codeGeneration() != TypeEntry::GenerateForSubclass)
return metaClass;
@@ -348,12 +348,12 @@ static const AbstractMetaClass* getProperEnclosingClass(const AbstractMetaClass*
return getProperEnclosingClass(metaClass->enclosingClass());
}
-const AbstractMetaClass* ShibokenGenerator::getProperEnclosingClassForEnum(const AbstractMetaEnum* metaEnum)
+const AbstractMetaClass *ShibokenGenerator::getProperEnclosingClassForEnum(const AbstractMetaEnum *metaEnum)
{
return getProperEnclosingClass(metaEnum->enclosingClass());
}
-QString ShibokenGenerator::wrapperName(const AbstractMetaClass* metaClass) const
+QString ShibokenGenerator::wrapperName(const AbstractMetaClass *metaClass) const
{
if (shouldGenerateCppWrapper(metaClass)) {
QString result = metaClass->name();
@@ -403,22 +403,22 @@ QString ShibokenGenerator::fullPythonFunctionName(const AbstractMetaFunction *fu
return funcName;
}
-QString ShibokenGenerator::protectedEnumSurrogateName(const AbstractMetaEnum* metaEnum)
+QString ShibokenGenerator::protectedEnumSurrogateName(const AbstractMetaEnum *metaEnum)
{
return metaEnum->fullName().replace(QLatin1Char('.'), QLatin1Char('_')).replace(QLatin1String("::"), QLatin1String("_")) + QLatin1String("_Surrogate");
}
-QString ShibokenGenerator::protectedFieldGetterName(const AbstractMetaField* field)
+QString ShibokenGenerator::protectedFieldGetterName(const AbstractMetaField *field)
{
return QStringLiteral("protected_%1_getter").arg(field->name());
}
-QString ShibokenGenerator::protectedFieldSetterName(const AbstractMetaField* field)
+QString ShibokenGenerator::protectedFieldSetterName(const AbstractMetaField *field)
{
return QStringLiteral("protected_%1_setter").arg(field->name());
}
-QString ShibokenGenerator::cpythonFunctionName(const AbstractMetaFunction* func)
+QString ShibokenGenerator::cpythonFunctionName(const AbstractMetaFunction *func)
{
QString result;
@@ -442,35 +442,35 @@ QString ShibokenGenerator::cpythonFunctionName(const AbstractMetaFunction* func)
return result;
}
-QString ShibokenGenerator::cpythonMethodDefinitionName(const AbstractMetaFunction* func)
+QString ShibokenGenerator::cpythonMethodDefinitionName(const AbstractMetaFunction *func)
{
if (!func->ownerClass())
return QString();
return QStringLiteral("%1Method_%2").arg(cpythonBaseName(func->ownerClass()->typeEntry()), func->name());
}
-QString ShibokenGenerator::cpythonGettersSettersDefinitionName(const AbstractMetaClass* metaClass)
+QString ShibokenGenerator::cpythonGettersSettersDefinitionName(const AbstractMetaClass *metaClass)
{
return cpythonBaseName(metaClass) + QLatin1String("_getsetlist");
}
-QString ShibokenGenerator::cpythonSetattroFunctionName(const AbstractMetaClass* metaClass)
+QString ShibokenGenerator::cpythonSetattroFunctionName(const AbstractMetaClass *metaClass)
{
return cpythonBaseName(metaClass) + QLatin1String("_setattro");
}
-QString ShibokenGenerator::cpythonGetattroFunctionName(const AbstractMetaClass* metaClass)
+QString ShibokenGenerator::cpythonGetattroFunctionName(const AbstractMetaClass *metaClass)
{
return cpythonBaseName(metaClass) + QLatin1String("_getattro");
}
-QString ShibokenGenerator::cpythonGetterFunctionName(const AbstractMetaField* metaField)
+QString ShibokenGenerator::cpythonGetterFunctionName(const AbstractMetaField *metaField)
{
return QStringLiteral("%1_get_%2").arg(cpythonBaseName(metaField->enclosingClass()), metaField->name());
}
-QString ShibokenGenerator::cpythonSetterFunctionName(const AbstractMetaField* metaField)
+QString ShibokenGenerator::cpythonSetterFunctionName(const AbstractMetaField *metaField)
{
return QStringLiteral("%1_set_%2").arg(cpythonBaseName(metaField->enclosingClass()), metaField->name());
}
@@ -484,7 +484,7 @@ static QString cpythonEnumFlagsName(const QString &moduleName,
}
// Return the scope for fully qualifying the enumeration including trailing "::".
-static QString searchForEnumScope(const AbstractMetaClass* metaClass, const QString& value)
+static QString searchForEnumScope(const AbstractMetaClass *metaClass, const QString &value)
{
if (!metaClass)
return QString();
@@ -587,7 +587,7 @@ QString ShibokenGenerator::guessScopeForDefaultValue(const AbstractMetaFunction
QString prefix;
if (arg->type()->isEnum()) {
- if (const AbstractMetaEnum* metaEnum = findAbstractMetaEnum(arg->type()))
+ if (const AbstractMetaEnum *metaEnum = findAbstractMetaEnum(arg->type()))
prefix = resolveScopePrefix(metaEnum, value);
} else if (arg->type()->isFlags()) {
value = guessScopeForDefaultFlagsValue(func, arg, value);
@@ -626,7 +626,7 @@ QString ShibokenGenerator::guessScopeForDefaultValue(const AbstractMetaFunction
return value;
}
-QString ShibokenGenerator::cpythonEnumName(const EnumTypeEntry* enumEntry)
+QString ShibokenGenerator::cpythonEnumName(const EnumTypeEntry *enumEntry)
{
QString p = enumEntry->targetLangPackage();
p.replace(QLatin1Char('.'), QLatin1Char('_'));
@@ -638,7 +638,7 @@ QString ShibokenGenerator::cpythonEnumName(const AbstractMetaEnum *metaEnum)
return cpythonEnumName(metaEnum->typeEntry());
}
-QString ShibokenGenerator::cpythonFlagsName(const FlagsTypeEntry* flagsEntry)
+QString ShibokenGenerator::cpythonFlagsName(const FlagsTypeEntry *flagsEntry)
{
QString p = flagsEntry->targetLangPackage();
p.replace(QLatin1Char('.'), QLatin1Char('_'));
@@ -653,12 +653,12 @@ QString ShibokenGenerator::cpythonFlagsName(const AbstractMetaEnum *metaEnum)
return cpythonFlagsName(flags);
}
-QString ShibokenGenerator::cpythonSpecialCastFunctionName(const AbstractMetaClass* metaClass)
+QString ShibokenGenerator::cpythonSpecialCastFunctionName(const AbstractMetaClass *metaClass)
{
return cpythonBaseName(metaClass->typeEntry()) + QLatin1String("SpecialCastFunction");
}
-QString ShibokenGenerator::cpythonWrapperCPtr(const AbstractMetaClass* metaClass,
+QString ShibokenGenerator::cpythonWrapperCPtr(const AbstractMetaClass *metaClass,
const QString &argName)
{
return cpythonWrapperCPtr(metaClass->typeEntry(), argName);
@@ -674,7 +674,7 @@ QString ShibokenGenerator::cpythonWrapperCPtr(const AbstractMetaType *metaType,
+ QLatin1String(", reinterpret_cast<SbkObject *>(") + argName + QLatin1String(")))");
}
-QString ShibokenGenerator::cpythonWrapperCPtr(const TypeEntry* type,
+QString ShibokenGenerator::cpythonWrapperCPtr(const TypeEntry *type,
const QString &argName)
{
if (!ShibokenGenerator::isWrapperType(type))
@@ -684,31 +684,31 @@ QString ShibokenGenerator::cpythonWrapperCPtr(const TypeEntry* type,
+ QLatin1String(", reinterpret_cast<SbkObject *>(") + argName + QLatin1String(")))");
}
-void ShibokenGenerator::writeToPythonConversion(QTextStream & s, const AbstractMetaType* type,
+void ShibokenGenerator::writeToPythonConversion(QTextStream & s, const AbstractMetaType *type,
const AbstractMetaClass * /* context */,
- const QString& argumentName)
+ const QString &argumentName)
{
s << cpythonToPythonConversionFunction(type) << argumentName << ')';
}
-void ShibokenGenerator::writeToCppConversion(QTextStream& s, const AbstractMetaClass* metaClass,
- const QString& inArgName, const QString& outArgName)
+void ShibokenGenerator::writeToCppConversion(QTextStream &s, const AbstractMetaClass *metaClass,
+ const QString &inArgName, const QString &outArgName)
{
s << cpythonToCppConversionFunction(metaClass) << inArgName << ", &" << outArgName << ')';
}
-void ShibokenGenerator::writeToCppConversion(QTextStream& s, const AbstractMetaType* type, const AbstractMetaClass* context,
- const QString& inArgName, const QString& outArgName)
+void ShibokenGenerator::writeToCppConversion(QTextStream &s, const AbstractMetaType *type, const AbstractMetaClass *context,
+ const QString &inArgName, const QString &outArgName)
{
s << cpythonToCppConversionFunction(type, context) << inArgName << ", &" << outArgName << ')';
}
-bool ShibokenGenerator::shouldRejectNullPointerArgument(const AbstractMetaFunction* func, int argIndex)
+bool ShibokenGenerator::shouldRejectNullPointerArgument(const AbstractMetaFunction *func, int argIndex)
{
if (argIndex < 0 || argIndex >= func->arguments().count())
return false;
- const AbstractMetaArgument* arg = func->arguments().at(argIndex);
+ const AbstractMetaArgument *arg = func->arguments().at(argIndex);
if (isValueTypeWithCopyConstructorOnly(arg->type()))
return true;
@@ -728,7 +728,7 @@ bool ShibokenGenerator::shouldRejectNullPointerArgument(const AbstractMetaFuncti
return false;
}
-QString ShibokenGenerator::getFormatUnitString(const AbstractMetaFunction* func, bool incRef) const
+QString ShibokenGenerator::getFormatUnitString(const AbstractMetaFunction *func, bool incRef) const
{
QString result;
const char objType = (incRef ? 'O' : 'N');
@@ -750,7 +750,7 @@ QString ShibokenGenerator::getFormatUnitString(const AbstractMetaFunction* func,
|| arg->type()->referenceType() == LValueReference) {
result += QLatin1Char(objType);
} else if (arg->type()->isPrimitive()) {
- const PrimitiveTypeEntry *ptype =
+ const auto *ptype =
static_cast<const PrimitiveTypeEntry *>(arg->type()->typeEntry());
if (ptype->basicReferencedTypeEntry())
ptype = ptype->basicReferencedTypeEntry();
@@ -772,25 +772,25 @@ QString ShibokenGenerator::getFormatUnitString(const AbstractMetaFunction* func,
return result;
}
-QString ShibokenGenerator::cpythonBaseName(const AbstractMetaType* type)
+QString ShibokenGenerator::cpythonBaseName(const AbstractMetaType *type)
{
if (isCString(type))
return QLatin1String("PyString");
return cpythonBaseName(type->typeEntry());
}
-QString ShibokenGenerator::cpythonBaseName(const AbstractMetaClass* metaClass)
+QString ShibokenGenerator::cpythonBaseName(const AbstractMetaClass *metaClass)
{
return cpythonBaseName(metaClass->typeEntry());
}
-QString ShibokenGenerator::cpythonBaseName(const TypeEntry* type)
+QString ShibokenGenerator::cpythonBaseName(const TypeEntry *type)
{
QString baseName;
if (ShibokenGenerator::isWrapperType(type) || type->isNamespace()) { // && type->referenceType() == NoReference) {
baseName = QLatin1String("Sbk_") + type->name();
} else if (type->isPrimitive()) {
- const PrimitiveTypeEntry *ptype = static_cast<const PrimitiveTypeEntry *>(type);
+ const auto *ptype = static_cast<const PrimitiveTypeEntry *>(type);
while (ptype->basicReferencedTypeEntry())
ptype = ptype->basicReferencedTypeEntry();
if (ptype->targetLangApiName() == ptype->name())
@@ -802,7 +802,7 @@ QString ShibokenGenerator::cpythonBaseName(const TypeEntry* type)
} else if (type->isFlags()) {
baseName = cpythonFlagsName(static_cast<const FlagsTypeEntry *>(type));
} else if (type->isContainer()) {
- const ContainerTypeEntry *ctype = static_cast<const ContainerTypeEntry *>(type);
+ const auto *ctype = static_cast<const ContainerTypeEntry *>(type);
switch (ctype->type()) {
case ContainerTypeEntry::ListContainer:
case ContainerTypeEntry::StringListContainer:
@@ -834,28 +834,28 @@ QString ShibokenGenerator::cpythonBaseName(const TypeEntry* type)
return baseName.replace(QLatin1String("::"), QLatin1String("_"));
}
-QString ShibokenGenerator::cpythonTypeName(const AbstractMetaClass* metaClass)
+QString ShibokenGenerator::cpythonTypeName(const AbstractMetaClass *metaClass)
{
return cpythonTypeName(metaClass->typeEntry());
}
-QString ShibokenGenerator::cpythonTypeName(const TypeEntry* type)
+QString ShibokenGenerator::cpythonTypeName(const TypeEntry *type)
{
return cpythonBaseName(type) + QLatin1String("_TypeF()");
}
-QString ShibokenGenerator::cpythonTypeNameExt(const TypeEntry* type)
+QString ShibokenGenerator::cpythonTypeNameExt(const TypeEntry *type)
{
return cppApiVariableName(type->targetLangPackage()) + QLatin1Char('[')
+ getTypeIndexVariableName(type) + QLatin1Char(']');
}
-QString ShibokenGenerator::converterObject(const AbstractMetaType* type)
+QString ShibokenGenerator::converterObject(const AbstractMetaType *type)
{
if (isCString(type))
- return QLatin1String("Shiboken::Conversions::PrimitiveTypeConverter<const char*>()");
+ return QLatin1String("Shiboken::Conversions::PrimitiveTypeConverter<const char *>()");
if (isVoidPointer(type))
- return QLatin1String("Shiboken::Conversions::PrimitiveTypeConverter<void*>()");
+ return QLatin1String("Shiboken::Conversions::PrimitiveTypeConverter<void *>()");
const AbstractMetaTypeCList nestedArrayTypes = type->nestedArrayTypes();
if (!nestedArrayTypes.isEmpty() && nestedArrayTypes.constLast()->isCppPrimitive()) {
return QStringLiteral("Shiboken::Conversions::ArrayTypeConverter<")
@@ -870,7 +870,7 @@ QString ShibokenGenerator::converterObject(const AbstractMetaType* type)
return converterObject(type->typeEntry());
}
-QString ShibokenGenerator::converterObject(const TypeEntry* type)
+QString ShibokenGenerator::converterObject(const TypeEntry *type)
{
if (isCppPrimitive(type))
return QString::fromLatin1("Shiboken::Conversions::PrimitiveTypeConverter<%1>()").arg(type->qualifiedCppName());
@@ -883,7 +883,7 @@ QString ShibokenGenerator::converterObject(const TypeEntry* type)
}
/* the typedef'd primitive types case */
- const PrimitiveTypeEntry* pte = dynamic_cast<const PrimitiveTypeEntry*>(type);
+ const auto *pte = dynamic_cast<const PrimitiveTypeEntry *>(type);
if (!pte) {
qDebug() << "Warning: the Qt5 primitive type is unknown" << type->qualifiedCppName();
return QString();
@@ -897,7 +897,7 @@ QString ShibokenGenerator::converterObject(const TypeEntry* type)
+ QLatin1Char('[') + getTypeIndexVariableName(type) + QLatin1Char(']');
}
-QString ShibokenGenerator::cpythonTypeNameExt(const AbstractMetaType* type)
+QString ShibokenGenerator::cpythonTypeNameExt(const AbstractMetaType *type)
{
return cppApiVariableName(type->typeEntry()->targetLangPackage()) + QLatin1Char('[')
+ getTypeIndexVariableName(type) + QLatin1Char(']');
@@ -905,13 +905,13 @@ QString ShibokenGenerator::cpythonTypeNameExt(const AbstractMetaType* type)
static inline QString unknownOperator() { return QStringLiteral("__UNKNOWN_OPERATOR__"); }
-QString ShibokenGenerator::fixedCppTypeName(const CustomConversion::TargetToNativeConversion* toNative)
+QString ShibokenGenerator::fixedCppTypeName(const CustomConversion::TargetToNativeConversion *toNative)
{
if (toNative->sourceType())
return fixedCppTypeName(toNative->sourceType());
return toNative->sourceTypeName();
}
-QString ShibokenGenerator::fixedCppTypeName(const AbstractMetaType* type)
+QString ShibokenGenerator::fixedCppTypeName(const AbstractMetaType *type)
{
return fixedCppTypeName(type->typeEntry(), type->cppSignature());
}
@@ -928,7 +928,7 @@ static QString _fixedCppTypeName(QString typeName)
typeName.replace(QLatin1String("&"), QLatin1String("REF"));
return typeName;
}
-QString ShibokenGenerator::fixedCppTypeName(const TypeEntry* type, QString typeName)
+QString ShibokenGenerator::fixedCppTypeName(const TypeEntry *type, QString typeName)
{
if (typeName.isEmpty())
typeName = type->qualifiedCppName();
@@ -939,7 +939,7 @@ QString ShibokenGenerator::fixedCppTypeName(const TypeEntry* type, QString typeN
return _fixedCppTypeName(typeName);
}
-QString ShibokenGenerator::pythonPrimitiveTypeName(const QString& cppTypeName)
+QString ShibokenGenerator::pythonPrimitiveTypeName(const QString &cppTypeName)
{
QString rv = ShibokenGenerator::m_pythonPrimitiveTypeName.value(cppTypeName, QString());
if (rv.isEmpty()) {
@@ -955,7 +955,7 @@ QString ShibokenGenerator::pythonPrimitiveTypeName(const QString& cppTypeName)
return rv;
}
-QString ShibokenGenerator::pythonPrimitiveTypeName(const PrimitiveTypeEntry* type)
+QString ShibokenGenerator::pythonPrimitiveTypeName(const PrimitiveTypeEntry *type)
{
while (type->basicReferencedTypeEntry())
type = type->basicReferencedTypeEntry();
@@ -972,7 +972,7 @@ QString ShibokenGenerator::pythonOperatorFunctionName(const QString &cppOpFuncNa
return value;
}
-QString ShibokenGenerator::pythonOperatorFunctionName(const AbstractMetaFunction* func)
+QString ShibokenGenerator::pythonOperatorFunctionName(const AbstractMetaFunction *func)
{
QString op = pythonOperatorFunctionName(func->originalName());
if (op == unknownOperator())
@@ -995,7 +995,7 @@ QString ShibokenGenerator::pythonRichCompareOperatorId(const QString &cppOpFuncN
return QLatin1String("Py_") + m_pythonOperators.value(cppOpFuncName).toUpper();
}
-QString ShibokenGenerator::pythonRichCompareOperatorId(const AbstractMetaFunction* func)
+QString ShibokenGenerator::pythonRichCompareOperatorId(const AbstractMetaFunction *func)
{
return pythonRichCompareOperatorId(func->originalName());
}
@@ -1008,19 +1008,19 @@ bool ShibokenGenerator::isNumber(const QString &cpythonApiName)
|| cpythonApiName == QLatin1String("PyBool");
}
-bool ShibokenGenerator::isNumber(const TypeEntry* type)
+bool ShibokenGenerator::isNumber(const TypeEntry *type)
{
if (!type->isPrimitive())
return false;
return isNumber(pythonPrimitiveTypeName(static_cast<const PrimitiveTypeEntry *>(type)));
}
-bool ShibokenGenerator::isNumber(const AbstractMetaType* type)
+bool ShibokenGenerator::isNumber(const AbstractMetaType *type)
{
return isNumber(type->typeEntry());
}
-bool ShibokenGenerator::isPyInt(const TypeEntry* type)
+bool ShibokenGenerator::isPyInt(const TypeEntry *type)
{
if (!type->isPrimitive())
return false;
@@ -1028,39 +1028,39 @@ bool ShibokenGenerator::isPyInt(const TypeEntry* type)
== QLatin1String("PyInt");
}
-bool ShibokenGenerator::isPyInt(const AbstractMetaType* type)
+bool ShibokenGenerator::isPyInt(const AbstractMetaType *type)
{
return isPyInt(type->typeEntry());
}
-bool ShibokenGenerator::isWrapperType(const TypeEntry* type)
+bool ShibokenGenerator::isWrapperType(const TypeEntry *type)
{
if (type->isComplex())
return ShibokenGenerator::isWrapperType(static_cast<const ComplexTypeEntry *>(type));
return type->isObject() || type->isValue() || type->isSmartPointer();
}
-bool ShibokenGenerator::isWrapperType(const ComplexTypeEntry* type)
+bool ShibokenGenerator::isWrapperType(const ComplexTypeEntry *type)
{
return isObjectType(type) || type->isValue() || type->isSmartPointer();
}
-bool ShibokenGenerator::isWrapperType(const AbstractMetaType* metaType)
+bool ShibokenGenerator::isWrapperType(const AbstractMetaType *metaType)
{
return isObjectType(metaType)
|| metaType->typeEntry()->isValue()
|| metaType->typeEntry()->isSmartPointer();
}
-bool ShibokenGenerator::isPointerToWrapperType(const AbstractMetaType* type)
+bool ShibokenGenerator::isPointerToWrapperType(const AbstractMetaType *type)
{
return (isObjectType(type) && type->indirections() == 1) || type->isValuePointer();
}
-bool ShibokenGenerator::isObjectTypeUsedAsValueType(const AbstractMetaType* type)
+bool ShibokenGenerator::isObjectTypeUsedAsValueType(const AbstractMetaType *type)
{
return type->typeEntry()->isObject() && type->referenceType() == NoReference && type->indirections() == 0;
}
-bool ShibokenGenerator::isValueTypeWithCopyConstructorOnly(const AbstractMetaClass* metaClass)
+bool ShibokenGenerator::isValueTypeWithCopyConstructorOnly(const AbstractMetaClass *metaClass)
{
if (!metaClass || !metaClass->typeEntry()->isValue())
return false;
@@ -1086,51 +1086,51 @@ bool ShibokenGenerator::isValueTypeWithCopyConstructorOnly(const AbstractMetaCla
return copyConstructorFound;
}
-bool ShibokenGenerator::isValueTypeWithCopyConstructorOnly(const TypeEntry* type) const
+bool ShibokenGenerator::isValueTypeWithCopyConstructorOnly(const TypeEntry *type) const
{
if (!type || !type->isValue())
return false;
return isValueTypeWithCopyConstructorOnly(AbstractMetaClass::findClass(classes(), type));
}
-bool ShibokenGenerator::isValueTypeWithCopyConstructorOnly(const AbstractMetaType* type) const
+bool ShibokenGenerator::isValueTypeWithCopyConstructorOnly(const AbstractMetaType *type) const
{
if (!type || !type->typeEntry()->isValue())
return false;
return isValueTypeWithCopyConstructorOnly(type->typeEntry());
}
-bool ShibokenGenerator::isUserPrimitive(const TypeEntry* type)
+bool ShibokenGenerator::isUserPrimitive(const TypeEntry *type)
{
if (!type->isPrimitive())
return false;
- const PrimitiveTypeEntry *trueType = static_cast<const PrimitiveTypeEntry *>(type);
+ const auto *trueType = static_cast<const PrimitiveTypeEntry *>(type);
if (trueType->basicReferencedTypeEntry())
trueType = trueType->basicReferencedTypeEntry();
return trueType->isPrimitive() && !trueType->isCppPrimitive()
&& trueType->qualifiedCppName() != QLatin1String("std::string");
}
-bool ShibokenGenerator::isUserPrimitive(const AbstractMetaType* type)
+bool ShibokenGenerator::isUserPrimitive(const AbstractMetaType *type)
{
if (type->indirections() != 0)
return false;
return isUserPrimitive(type->typeEntry());
}
-bool ShibokenGenerator::isCppPrimitive(const TypeEntry* type)
+bool ShibokenGenerator::isCppPrimitive(const TypeEntry *type)
{
if (type->isCppPrimitive())
return true;
if (!type->isPrimitive())
return false;
- const PrimitiveTypeEntry *trueType = static_cast<const PrimitiveTypeEntry *>(type);
+ const auto *trueType = static_cast<const PrimitiveTypeEntry *>(type);
if (trueType->basicReferencedTypeEntry())
trueType = trueType->basicReferencedTypeEntry();
return trueType->qualifiedCppName() == QLatin1String("std::string");
}
-bool ShibokenGenerator::isCppPrimitive(const AbstractMetaType* type)
+bool ShibokenGenerator::isCppPrimitive(const AbstractMetaType *type)
{
if (isCString(type) || isVoidPointer(type))
return true;
@@ -1139,17 +1139,17 @@ bool ShibokenGenerator::isCppPrimitive(const AbstractMetaType* type)
return isCppPrimitive(type->typeEntry());
}
-bool ShibokenGenerator::shouldDereferenceArgumentPointer(const AbstractMetaArgument* arg)
+bool ShibokenGenerator::shouldDereferenceArgumentPointer(const AbstractMetaArgument *arg)
{
return shouldDereferenceAbstractMetaTypePointer(arg->type());
}
-bool ShibokenGenerator::shouldDereferenceAbstractMetaTypePointer(const AbstractMetaType* metaType)
+bool ShibokenGenerator::shouldDereferenceAbstractMetaTypePointer(const AbstractMetaType *metaType)
{
return metaType->referenceType() == LValueReference && isWrapperType(metaType) && !isPointer(metaType);
}
-bool ShibokenGenerator::visibilityModifiedToPrivate(const AbstractMetaFunction* func)
+bool ShibokenGenerator::visibilityModifiedToPrivate(const AbstractMetaFunction *func)
{
const FunctionModificationList &mods = func->modifications();
for (const FunctionModification &mod : mods) {
@@ -1159,11 +1159,11 @@ bool ShibokenGenerator::visibilityModifiedToPrivate(const AbstractMetaFunction*
return false;
}
-QString ShibokenGenerator::cpythonCheckFunction(const AbstractMetaType* metaType, bool genericNumberType)
+QString ShibokenGenerator::cpythonCheckFunction(const AbstractMetaType *metaType, bool genericNumberType)
{
QString customCheck;
if (metaType->typeEntry()->isCustom()) {
- AbstractMetaType* type;
+ AbstractMetaType *type;
customCheck = guessCPythonCheckFunction(metaType->typeEntry()->name(), &type);
if (type)
metaType = type;
@@ -1189,7 +1189,7 @@ QString ShibokenGenerator::cpythonCheckFunction(const AbstractMetaType* metaType
|| type == ContainerTypeEntry::StackContainer
|| type == ContainerTypeEntry::SetContainer
|| type == ContainerTypeEntry::QueueContainer) {
- const AbstractMetaType* type = metaType->instantiations().constFirst();
+ const AbstractMetaType *type = metaType->instantiations().constFirst();
if (isPointerToWrapperType(type)) {
typeCheck += QString::fromLatin1("checkSequenceTypes(%1, ").arg(cpythonTypeNameExt(type));
} else if (isWrapperType(type)) {
@@ -1205,8 +1205,8 @@ QString ShibokenGenerator::cpythonCheckFunction(const AbstractMetaType* metaType
|| type == ContainerTypeEntry::MultiHashContainer
|| type == ContainerTypeEntry::PairContainer) {
QString pyType = (type == ContainerTypeEntry::PairContainer) ? QLatin1String("Pair") : QLatin1String("Dict");
- const AbstractMetaType* firstType = metaType->instantiations().constFirst();
- const AbstractMetaType* secondType = metaType->instantiations().constLast();
+ const AbstractMetaType *firstType = metaType->instantiations().constFirst();
+ const AbstractMetaType *secondType = metaType->instantiations().constLast();
if (isPointerToWrapperType(firstType) && isPointerToWrapperType(secondType)) {
typeCheck += QString::fromLatin1("check%1Types(%2, %3, ")
.arg(pyType, cpythonTypeNameExt(firstType), cpythonTypeNameExt(secondType));
@@ -1223,11 +1223,11 @@ QString ShibokenGenerator::cpythonCheckFunction(const AbstractMetaType* metaType
return cpythonCheckFunction(metaType->typeEntry(), genericNumberType);
}
-QString ShibokenGenerator::cpythonCheckFunction(const TypeEntry* type, bool genericNumberType)
+QString ShibokenGenerator::cpythonCheckFunction(const TypeEntry *type, bool genericNumberType)
{
QString customCheck;
if (type->isCustom()) {
- AbstractMetaType* metaType;
+ AbstractMetaType *metaType;
customCheck = guessCPythonCheckFunction(type->name(), &metaType);
if (metaType)
return cpythonCheckFunction(metaType, genericNumberType);
@@ -1250,9 +1250,9 @@ QString ShibokenGenerator::cpythonCheckFunction(const TypeEntry* type, bool gene
return typeCheck;
}
-QString ShibokenGenerator::guessCPythonCheckFunction(const QString& type, AbstractMetaType** metaType)
+QString ShibokenGenerator::guessCPythonCheckFunction(const QString &type, AbstractMetaType **metaType)
{
- *metaType = 0;
+ *metaType = nullptr;
if (type == QLatin1String("PyTypeObject"))
return QLatin1String("PyType_Check");
@@ -1269,7 +1269,7 @@ QString ShibokenGenerator::guessCPythonCheckFunction(const QString& type, Abstra
return type + QLatin1String("_Check");
}
-QString ShibokenGenerator::cpythonIsConvertibleFunction(const TypeEntry* type,
+QString ShibokenGenerator::cpythonIsConvertibleFunction(const TypeEntry *type,
bool /* genericNumberType */,
bool /* checkExact */)
{
@@ -1285,12 +1285,12 @@ QString ShibokenGenerator::cpythonIsConvertibleFunction(const TypeEntry* type,
return QString::fromLatin1("Shiboken::Conversions::isPythonToCppConvertible(%1, ")
.arg(converterObject(type));
}
-QString ShibokenGenerator::cpythonIsConvertibleFunction(const AbstractMetaType* metaType,
+QString ShibokenGenerator::cpythonIsConvertibleFunction(const AbstractMetaType *metaType,
bool /* genericNumberType */)
{
QString customCheck;
if (metaType->typeEntry()->isCustom()) {
- AbstractMetaType* type;
+ AbstractMetaType *type;
customCheck = guessCPythonCheckFunction(metaType->typeEntry()->name(), &type);
if (type)
metaType = type;
@@ -1329,7 +1329,7 @@ QString ShibokenGenerator::cpythonIsConvertibleFunction(const AbstractMetaArgume
return cpythonIsConvertibleFunction(metaArg->type(), genericNumberType);
}
-QString ShibokenGenerator::cpythonToCppConversionFunction(const AbstractMetaClass* metaClass)
+QString ShibokenGenerator::cpythonToCppConversionFunction(const AbstractMetaClass *metaClass)
{
return QLatin1String("Shiboken::Conversions::pythonToCppPointer(reinterpret_cast<SbkObjectType *>(")
+ cpythonTypeNameExt(metaClass->typeEntry()) + QLatin1String("), ");
@@ -1371,12 +1371,12 @@ QString ShibokenGenerator::cpythonToPythonConversionFunction(const AbstractMetaT
(isCString(type) || isVoidPointer(type)) ? QString() : QLatin1String("&"));
}
-QString ShibokenGenerator::cpythonToPythonConversionFunction(const AbstractMetaClass* metaClass)
+QString ShibokenGenerator::cpythonToPythonConversionFunction(const AbstractMetaClass *metaClass)
{
return cpythonToPythonConversionFunction(metaClass->typeEntry());
}
-QString ShibokenGenerator::cpythonToPythonConversionFunction(const TypeEntry* type)
+QString ShibokenGenerator::cpythonToPythonConversionFunction(const TypeEntry *type)
{
if (isWrapperType(type)) {
const QString conversion = type->isValue() ? QLatin1String("copy") : QLatin1String("pointer");
@@ -1463,7 +1463,7 @@ void ShibokenGenerator::writeFunctionArguments(QTextStream &s,
}
}
-QString ShibokenGenerator::functionReturnType(const AbstractMetaFunction* func, Options options) const
+QString ShibokenGenerator::functionReturnType(const AbstractMetaFunction *func, Options options) const
{
QString modifiedReturnType = QString(func->typeReplaced(0));
if (!modifiedReturnType.isEmpty() && !(options & OriginalTypeDescription))
@@ -1510,18 +1510,18 @@ void ShibokenGenerator::writeArgumentNames(QTextStream &s,
const AbstractMetaFunction *func,
Options options) const
{
- AbstractMetaArgumentList arguments = func->arguments();
+ const AbstractMetaArgumentList arguments = func->arguments();
int argCount = 0;
- for (int j = 0, max = arguments.size(); j < max; j++) {
-
- if ((options & Generator::SkipRemovedArguments) && (func->argumentRemoved(arguments.at(j)->argumentIndex()+1)))
+ for (auto argument : arguments) {
+ const int index = argument->argumentIndex() + 1;
+ if ((options & Generator::SkipRemovedArguments) && (func->argumentRemoved(index)))
continue;
- s << ((argCount > 0) ? ", " : "") << arguments.at(j)->name();
+ s << ((argCount > 0) ? ", " : "") << argument->name();
if (((options & Generator::VirtualCall) == 0)
- && (!func->conversionRule(TypeSystem::NativeCode, arguments.at(j)->argumentIndex() + 1).isEmpty()
- || !func->conversionRule(TypeSystem::TargetLangCode, arguments.at(j)->argumentIndex() + 1).isEmpty())
+ && (!func->conversionRule(TypeSystem::NativeCode, index).isEmpty()
+ || !func->conversionRule(TypeSystem::TargetLangCode, index).isEmpty())
&& !func->isConstructor()) {
s << CONV_RULE_OUT_VAR_SUFFIX;
}
@@ -1530,8 +1530,8 @@ void ShibokenGenerator::writeArgumentNames(QTextStream &s,
}
}
-void ShibokenGenerator::writeFunctionCall(QTextStream& s,
- const AbstractMetaFunction* func,
+void ShibokenGenerator::writeFunctionCall(QTextStream &s,
+ const AbstractMetaFunction *func,
Options options) const
{
if (!(options & Generator::SkipName))
@@ -1541,12 +1541,12 @@ void ShibokenGenerator::writeFunctionCall(QTextStream& s,
s << ')';
}
-void ShibokenGenerator::writeUnusedVariableCast(QTextStream& s, const QString& variableName)
+void ShibokenGenerator::writeUnusedVariableCast(QTextStream &s, const QString &variableName)
{
s << INDENT << "SBK_UNUSED(" << variableName<< ')' << endl;
}
-AbstractMetaFunctionList ShibokenGenerator::filterFunctions(const AbstractMetaClass* metaClass)
+AbstractMetaFunctionList ShibokenGenerator::filterFunctions(const AbstractMetaClass *metaClass)
{
AbstractMetaFunctionList result;
const AbstractMetaFunctionList &funcs = metaClass->functions();
@@ -1572,7 +1572,7 @@ ShibokenGenerator::ExtendedConverterData ShibokenGenerator::getExtendedConverter
for (AbstractMetaFunction *convOp : overloads) {
// Get only the conversion operators that return a type from another module,
// that are value-types and were not removed in the type system.
- const TypeEntry* convType = convOp->type()->typeEntry();
+ const TypeEntry *convType = convOp->type()->typeEntry();
if ((convType->codeGeneration() & TypeEntry::GenerateTargetLang)
|| !convType->isValue()
|| convOp->isModifiedRemoved())
@@ -1585,7 +1585,7 @@ ShibokenGenerator::ExtendedConverterData ShibokenGenerator::getExtendedConverter
QVector<const CustomConversion *> ShibokenGenerator::getPrimitiveCustomConversions()
{
- QVector<const CustomConversion*> conversions;
+ QVector<const CustomConversion *> conversions;
const PrimitiveTypeEntryList &primitiveTypeList = primitiveTypes();
for (const PrimitiveTypeEntry *type : primitiveTypeList) {
if (!shouldGenerateTypeEntry(type) || !isUserPrimitive(type) || !type->customConversion())
@@ -1596,7 +1596,7 @@ QVector<const CustomConversion *> ShibokenGenerator::getPrimitiveCustomConversio
return conversions;
}
-static QString getArgumentsFromMethodCall(const QString& str)
+static QString getArgumentsFromMethodCall(const QString &str)
{
// It would be way nicer to be able to use a Perl like
// regular expression that accepts temporary variables
@@ -1624,7 +1624,7 @@ static QString getArgumentsFromMethodCall(const QString& str)
return str.mid(begin, pos-begin-1);
}
-QString ShibokenGenerator::getCodeSnippets(const CodeSnipList& codeSnips,
+QString ShibokenGenerator::getCodeSnippets(const CodeSnipList &codeSnips,
TypeSystem::CodeSnipPosition position,
TypeSystem::Language language)
{
@@ -1640,7 +1640,7 @@ QString ShibokenGenerator::getCodeSnippets(const CodeSnipList& codeSnips,
}
return code;
}
-void ShibokenGenerator::processCodeSnip(QString& code, const AbstractMetaClass* context)
+void ShibokenGenerator::processCodeSnip(QString &code, const AbstractMetaClass *context)
{
if (context) {
// Replace template variable by the Python Type object
@@ -1664,16 +1664,16 @@ void ShibokenGenerator::processCodeSnip(QString& code, const AbstractMetaClass*
replaceTypeCheckTypeSystemVariable(code);
}
-ShibokenGenerator::ArgumentVarReplacementList ShibokenGenerator::getArgumentReplacement(const AbstractMetaFunction* func,
+ShibokenGenerator::ArgumentVarReplacementList ShibokenGenerator::getArgumentReplacement(const AbstractMetaFunction *func,
bool usePyArgs, TypeSystem::Language language,
- const AbstractMetaArgument* lastArg)
+ const AbstractMetaArgument *lastArg)
{
ArgumentVarReplacementList argReplacements;
TypeSystem::Language convLang = (language == TypeSystem::TargetLangCode)
? TypeSystem::NativeCode : TypeSystem::TargetLangCode;
int removed = 0;
for (int i = 0; i < func->arguments().size(); ++i) {
- const AbstractMetaArgument* arg = func->arguments().at(i);
+ const AbstractMetaArgument *arg = func->arguments().at(i);
QString argValue;
if (language == TypeSystem::TargetLangCode) {
bool hasConversionRule = !func->conversionRule(convLang, i+1).isEmpty();
@@ -1686,10 +1686,10 @@ ShibokenGenerator::ArgumentVarReplacementList ShibokenGenerator::getArgumentRepl
argValue = QLatin1String(CPP_ARG_REMOVED) + QString::number(i);
if (!argRemoved && argValue.isEmpty()) {
int argPos = i - removed;
- const AbstractMetaType* type = arg->type();
+ const AbstractMetaType *type = arg->type();
QString typeReplaced = func->typeReplaced(arg->argumentIndex() + 1);
if (!typeReplaced.isEmpty()) {
- AbstractMetaType* builtType = buildAbstractMetaTypeFromString(typeReplaced);
+ AbstractMetaType *builtType = buildAbstractMetaTypeFromString(typeReplaced);
if (builtType)
type = builtType;
}
@@ -1716,11 +1716,11 @@ ShibokenGenerator::ArgumentVarReplacementList ShibokenGenerator::getArgumentRepl
return argReplacements;
}
-void ShibokenGenerator::writeCodeSnips(QTextStream& s,
- const CodeSnipList& codeSnips,
+void ShibokenGenerator::writeCodeSnips(QTextStream &s,
+ const CodeSnipList &codeSnips,
TypeSystem::CodeSnipPosition position,
TypeSystem::Language language,
- const AbstractMetaClass* context)
+ const AbstractMetaClass *context)
{
QString code = getCodeSnippets(codeSnips, position, language);
if (code.isEmpty())
@@ -1731,12 +1731,12 @@ void ShibokenGenerator::writeCodeSnips(QTextStream& s,
s << INDENT << "// End of code injection" << endl;
}
-void ShibokenGenerator::writeCodeSnips(QTextStream& s,
- const CodeSnipList& codeSnips,
+void ShibokenGenerator::writeCodeSnips(QTextStream &s,
+ const CodeSnipList &codeSnips,
TypeSystem::CodeSnipPosition position,
TypeSystem::Language language,
- const AbstractMetaFunction* func,
- const AbstractMetaArgument* lastArg)
+ const AbstractMetaFunction *func,
+ const AbstractMetaArgument *lastArg)
{
QString code = getCodeSnippets(codeSnips, position, language);
if (code.isEmpty())
@@ -1842,14 +1842,14 @@ void ShibokenGenerator::writeCodeSnips(QTextStream& s,
QString wrapperClassName = wrapperName(func->ownerClass());
QString cppSelfVar = avoidProtectedHack()
? QLatin1String("%CPPSELF")
- : QStringLiteral("reinterpret_cast<%1*>(%CPPSELF)").arg(wrapperClassName);
+ : QStringLiteral("reinterpret_cast<%1 *>(%CPPSELF)").arg(wrapperClassName);
code.replace(pattern,
- QString::fromLatin1("(Shiboken::Object::hasCppWrapper(reinterpret_cast<SbkObject*>(%1))"
+ QString::fromLatin1("(Shiboken::Object::hasCppWrapper(reinterpret_cast<SbkObject *>(%1))"
" ? %2->::%3::%FUNCTION_NAME(%4)"
" : %CPPSELF.%FUNCTION_NAME(%4))").arg(pySelf, cppSelfVar, wrapperClassName, methodCallArgs));
} else {
code.replace(pattern,
- QString::fromLatin1("(Shiboken::Object::hasCppWrapper(reinterpret_cast<SbkObject*>(%1))"
+ QString::fromLatin1("(Shiboken::Object::hasCppWrapper(reinterpret_cast<SbkObject *>(%1))"
" ? %CPPSELF->::%TYPE::%FUNCTION_NAME(%2)"
" : %CPPSELF.%FUNCTION_NAME(%2))").arg(pySelf, methodCallArgs));
}
@@ -1892,12 +1892,12 @@ void ShibokenGenerator::writeCodeSnips(QTextStream& s,
code.replace(QLatin1String("%ARGUMENT_NAMES"), args.join(QLatin1String(", ")));
for (const ArgumentVarReplacementPair &pair : argReplacements) {
- const AbstractMetaArgument* arg = pair.first;
+ const AbstractMetaArgument *arg = pair.first;
int idx = arg->argumentIndex() + 1;
- AbstractMetaType* type = arg->type();
+ AbstractMetaType *type = arg->type();
QString typeReplaced = func->typeReplaced(arg->argumentIndex() + 1);
if (!typeReplaced.isEmpty()) {
- AbstractMetaType* builtType = buildAbstractMetaTypeFromString(typeReplaced);
+ AbstractMetaType *builtType = buildAbstractMetaTypeFromString(typeReplaced);
if (builtType)
type = builtType;
}
@@ -1960,7 +1960,7 @@ void ShibokenGenerator::writeCodeSnips(QTextStream& s,
// Returns true if the string is an expression,
// and false if it is a variable.
-static bool isVariable(const QString& code)
+static bool isVariable(const QString &code)
{
static const QRegularExpression expr(QStringLiteral("^\\s*\\*?\\s*[A-Za-z_][A-Za-z_0-9.]*\\s*(?:\\[[^\\[]+\\])*$"));
Q_ASSERT(expr.isValid());
@@ -1970,7 +1970,7 @@ static bool isVariable(const QString& code)
// A miniature normalizer that puts a type string into a format
// suitable for comparison with AbstractMetaType::cppSignature()
// result.
-static QString miniNormalizer(const QString& varType)
+static QString miniNormalizer(const QString &varType)
{
QString normalized = varType.trimmed();
if (normalized.isEmpty())
@@ -1989,7 +1989,7 @@ static QString miniNormalizer(const QString& varType)
// The position must indicate the first character after the opening '('.
// ATTENTION: do not modify this function to trim any resulting string!
// This must be done elsewhere.
-static QString getConverterTypeSystemVariableArgument(const QString& code, int pos)
+static QString getConverterTypeSystemVariableArgument(const QString &code, int pos)
{
QString arg;
int parenthesisDepth = 0;
@@ -2011,9 +2011,9 @@ static QString getConverterTypeSystemVariableArgument(const QString& code, int p
qFatal("Unbalanced parenthesis on type system converter variable call.");
return arg;
}
-typedef QPair<QString, QString> StringPair;
+using StringPair = QPair<QString, QString>;
-void ShibokenGenerator::replaceConverterTypeSystemVariable(TypeSystemConverterVariable converterVariable, QString& code)
+void ShibokenGenerator::replaceConverterTypeSystemVariable(TypeSystemConverterVariable converterVariable, QString &code)
{
QVector<StringPair> replacements;
QRegularExpressionMatchIterator rit = m_typeSystemConvRegEx[converterVariable].globalMatch(code);
@@ -2105,7 +2105,7 @@ void ShibokenGenerator::replaceConverterTypeSystemVariable(TypeSystemConverterVa
code.replace(rep.first, rep.second);
}
-bool ShibokenGenerator::injectedCodeUsesPySelf(const AbstractMetaFunction* func)
+bool ShibokenGenerator::injectedCodeUsesPySelf(const AbstractMetaFunction *func)
{
CodeSnipList snips = func->injectedCodeSnips(TypeSystem::CodeSnipPositionAny, TypeSystem::NativeCode);
for (const CodeSnip &snip : qAsConst(snips)) {
@@ -2115,7 +2115,7 @@ bool ShibokenGenerator::injectedCodeUsesPySelf(const AbstractMetaFunction* func)
return false;
}
-bool ShibokenGenerator::injectedCodeCallsCppFunction(const AbstractMetaFunction* func)
+bool ShibokenGenerator::injectedCodeCallsCppFunction(const AbstractMetaFunction *func)
{
QString funcCall = func->originalName() + QLatin1Char('(');
QString wrappedCtorCall;
@@ -2135,7 +2135,7 @@ bool ShibokenGenerator::injectedCodeCallsCppFunction(const AbstractMetaFunction*
return false;
}
-bool ShibokenGenerator::injectedCodeCallsPythonOverride(const AbstractMetaFunction* func)
+bool ShibokenGenerator::injectedCodeCallsPythonOverride(const AbstractMetaFunction *func)
{
static const QRegularExpression overrideCallRegexCheck(QStringLiteral("PyObject_Call\\s*\\(\\s*%PYTHON_METHOD_OVERRIDE\\s*,"));
Q_ASSERT(overrideCallRegexCheck.isValid());
@@ -2147,7 +2147,7 @@ bool ShibokenGenerator::injectedCodeCallsPythonOverride(const AbstractMetaFuncti
return false;
}
-bool ShibokenGenerator::injectedCodeHasReturnValueAttribution(const AbstractMetaFunction* func, TypeSystem::Language language)
+bool ShibokenGenerator::injectedCodeHasReturnValueAttribution(const AbstractMetaFunction *func, TypeSystem::Language language)
{
static const QRegularExpression retValAttributionRegexCheck_native(QStringLiteral("%0\\s*=[^=]\\s*.+"));
Q_ASSERT(retValAttributionRegexCheck_native.isValid());
@@ -2166,7 +2166,7 @@ bool ShibokenGenerator::injectedCodeHasReturnValueAttribution(const AbstractMeta
return false;
}
-bool ShibokenGenerator::injectedCodeUsesArgument(const AbstractMetaFunction* func, int argumentIndex)
+bool ShibokenGenerator::injectedCodeUsesArgument(const AbstractMetaFunction *func, int argumentIndex)
{
CodeSnipList snips = func->injectedCodeSnips(TypeSystem::CodeSnipPositionAny);
const QRegularExpression argRegEx = placeHolderRegex(argumentIndex + 1);
@@ -2178,12 +2178,12 @@ bool ShibokenGenerator::injectedCodeUsesArgument(const AbstractMetaFunction* fun
return false;
}
-bool ShibokenGenerator::classNeedsGetattroFunction(const AbstractMetaClass* metaClass)
+bool ShibokenGenerator::classNeedsGetattroFunction(const AbstractMetaClass *metaClass)
{
return getGeneratorClassInfo(metaClass).needsGetattroFunction;
}
-bool ShibokenGenerator::classNeedsGetattroFunctionImpl(const AbstractMetaClass* metaClass)
+bool ShibokenGenerator::classNeedsGetattroFunctionImpl(const AbstractMetaClass *metaClass)
{
if (!metaClass)
return false;
@@ -2214,7 +2214,7 @@ bool ShibokenGenerator::classNeedsSetattroFunction(const AbstractMetaClass *meta
return metaClass->typeEntry()->isSmartPointer();
}
-AbstractMetaFunctionList ShibokenGenerator::getMethodsWithBothStaticAndNonStaticMethods(const AbstractMetaClass* metaClass)
+AbstractMetaFunctionList ShibokenGenerator::getMethodsWithBothStaticAndNonStaticMethods(const AbstractMetaClass *metaClass)
{
AbstractMetaFunctionList methods;
if (metaClass) {
@@ -2237,7 +2237,7 @@ AbstractMetaFunctionList ShibokenGenerator::getMethodsWithBothStaticAndNonStatic
return methods;
}
-AbstractMetaClassList ShibokenGenerator::getBaseClasses(const AbstractMetaClass* metaClass) const
+AbstractMetaClassList ShibokenGenerator::getBaseClasses(const AbstractMetaClass *metaClass) const
{
AbstractMetaClassList baseClasses;
if (metaClass) {
@@ -2257,7 +2257,7 @@ AbstractMetaClassList ShibokenGenerator::getBaseClasses(const AbstractMetaClass*
return baseClasses;
}
-const AbstractMetaClass* ShibokenGenerator::getMultipleInheritingClass(const AbstractMetaClass* metaClass)
+const AbstractMetaClass *ShibokenGenerator::getMultipleInheritingClass(const AbstractMetaClass *metaClass)
{
if (!metaClass || metaClass->baseClassNames().isEmpty())
return nullptr;
@@ -2266,7 +2266,7 @@ const AbstractMetaClass* ShibokenGenerator::getMultipleInheritingClass(const Abs
return getMultipleInheritingClass(metaClass->baseClass());
}
-AbstractMetaClassList ShibokenGenerator::getAllAncestors(const AbstractMetaClass* metaClass) const
+AbstractMetaClassList ShibokenGenerator::getAllAncestors(const AbstractMetaClass *metaClass) const
{
AbstractMetaClassList result;
if (metaClass) {
@@ -2279,7 +2279,7 @@ AbstractMetaClassList ShibokenGenerator::getAllAncestors(const AbstractMetaClass
return result;
}
-QString ShibokenGenerator::getModuleHeaderFileName(const QString& moduleName) const
+QString ShibokenGenerator::getModuleHeaderFileName(const QString &moduleName) const
{
return moduleCppPrefix(moduleName).toLower() + QLatin1String("_python.h");
}
@@ -2316,14 +2316,14 @@ AbstractMetaType *ShibokenGenerator::buildAbstractMetaTypeFromString(QString typ
return it.value();
}
-AbstractMetaType* ShibokenGenerator::buildAbstractMetaTypeFromTypeEntry(const TypeEntry* typeEntry)
+AbstractMetaType *ShibokenGenerator::buildAbstractMetaTypeFromTypeEntry(const TypeEntry *typeEntry)
{
QString typeName = typeEntry->qualifiedCppName();
if (typeName.startsWith(QLatin1String("::")))
typeName.remove(0, 2);
if (m_metaTypeFromStringCache.contains(typeName))
return m_metaTypeFromStringCache.value(typeName);
- AbstractMetaType* metaType = new AbstractMetaType;
+ auto *metaType = new AbstractMetaType;
metaType->setTypeEntry(typeEntry);
metaType->clearIndirections();
metaType->setReferenceType(NoReference);
@@ -2332,7 +2332,7 @@ AbstractMetaType* ShibokenGenerator::buildAbstractMetaTypeFromTypeEntry(const Ty
m_metaTypeFromStringCache.insert(typeName, metaType);
return metaType;
}
-AbstractMetaType* ShibokenGenerator::buildAbstractMetaTypeFromAbstractMetaClass(const AbstractMetaClass* metaClass)
+AbstractMetaType *ShibokenGenerator::buildAbstractMetaTypeFromAbstractMetaClass(const AbstractMetaClass *metaClass)
{
return ShibokenGenerator::buildAbstractMetaTypeFromTypeEntry(metaClass->typeEntry());
}
@@ -2354,7 +2354,7 @@ static void dumpFunction(AbstractMetaFunctionList lst)
}
*/
-static bool isGroupable(const AbstractMetaFunction* func)
+static bool isGroupable(const AbstractMetaFunction *func)
{
if (func->isSignal() || func->isDestructor() || (func->isModifiedRemoved() && !func->isAbstract()))
return false;
@@ -2422,13 +2422,13 @@ ShibokenGenerator::FunctionGroups ShibokenGenerator::getFunctionGroupsImpl(const
AbstractMetaFunctionList ShibokenGenerator::getInheritedOverloads(const AbstractMetaFunction *func, QSet<QString> *seen)
{
AbstractMetaFunctionList results;
- AbstractMetaClass* basis;
+ AbstractMetaClass *basis;
if (func->ownerClass() && (basis = func->ownerClass()->baseClass())) {
for (; basis; basis = basis->baseClass()) {
- const AbstractMetaFunction* inFunc = basis->findFunction(func->name());
+ const AbstractMetaFunction *inFunc = basis->findFunction(func->name());
if (inFunc && !seen->contains(inFunc->minimalSignature())) {
seen->insert(inFunc->minimalSignature());
- AbstractMetaFunction* newFunc = inFunc->copy();
+ AbstractMetaFunction *newFunc = inFunc->copy();
newFunc->setImplementingClass(func->implementingClass());
results << newFunc;
}
@@ -2445,7 +2445,7 @@ AbstractMetaFunctionList ShibokenGenerator::getFunctionAndInheritedOverloads(con
return results;
}
-AbstractMetaFunctionList ShibokenGenerator::getFunctionOverloads(const AbstractMetaClass* scope, const QString& functionName)
+AbstractMetaFunctionList ShibokenGenerator::getFunctionOverloads(const AbstractMetaClass *scope, const QString &functionName)
{
AbstractMetaFunctionList lst = scope ? scope->functions() : globalFunctions();
@@ -2500,24 +2500,24 @@ bool ShibokenGenerator::handleOption(const QString &key, const QString & /* valu
return false;
}
-static void getCode(QStringList& code, const CodeSnipList& codeSnips)
+static void getCode(QStringList &code, const CodeSnipList &codeSnips)
{
for (const CodeSnip &snip : qAsConst(codeSnips))
code.append(snip.code());
}
-static void getCode(QStringList& code, const TypeEntry* type)
+static void getCode(QStringList &code, const TypeEntry *type)
{
getCode(code, type->codeSnips());
- CustomConversion* customConversion = type->customConversion();
+ CustomConversion *customConversion = type->customConversion();
if (!customConversion)
return;
if (!customConversion->nativeToTargetConversion().isEmpty())
code.append(customConversion->nativeToTargetConversion());
- const CustomConversion::TargetToNativeConversions& toCppConversions = customConversion->targetToNativeConversions();
+ const CustomConversion::TargetToNativeConversions &toCppConversions = customConversion->targetToNativeConversions();
if (toCppConversions.isEmpty())
return;
@@ -2556,7 +2556,7 @@ bool ShibokenGenerator::doSetup()
return true;
}
-void ShibokenGenerator::collectContainerTypesFromConverterMacros(const QString& code, bool toPythonMacro)
+void ShibokenGenerator::collectContainerTypesFromConverterMacros(const QString &code, bool toPythonMacro)
{
QString convMacro = toPythonMacro ? QLatin1String("%CONVERTTOPYTHON[") : QLatin1String("%CONVERTTOCPP[");
int offset = toPythonMacro ? sizeof("%CONVERTTOPYTHON") : sizeof("%CONVERTTOCPP");
@@ -2566,7 +2566,7 @@ void ShibokenGenerator::collectContainerTypesFromConverterMacros(const QString&
start += offset;
if (code.at(start) != QLatin1Char('%')) {
QString typeString = code.mid(start, end - start);
- AbstractMetaType* type = buildAbstractMetaTypeFromString(typeString);
+ AbstractMetaType *type = buildAbstractMetaTypeFromString(typeString);
addInstantiatedContainersAndSmartPointers(type, type->originalTypeDescription());
}
start = end;
@@ -2598,26 +2598,26 @@ bool ShibokenGenerator::avoidProtectedHack() const
return m_avoidProtectedHack;
}
-QString ShibokenGenerator::moduleCppPrefix(const QString& moduleName) const
+QString ShibokenGenerator::moduleCppPrefix(const QString &moduleName) const
{
QString result = moduleName.isEmpty() ? packageName() : moduleName;
result.replace(QLatin1Char('.'), QLatin1Char('_'));
return result;
}
-QString ShibokenGenerator::cppApiVariableName(const QString& moduleName) const
+QString ShibokenGenerator::cppApiVariableName(const QString &moduleName) const
{
return QLatin1String("Sbk") + moduleCppPrefix(moduleName)
+ QLatin1String("Types");
}
-QString ShibokenGenerator::pythonModuleObjectName(const QString& moduleName) const
+QString ShibokenGenerator::pythonModuleObjectName(const QString &moduleName) const
{
return QLatin1String("Sbk") + moduleCppPrefix(moduleName)
+ QLatin1String("ModuleObject");
}
-QString ShibokenGenerator::convertersVariableName(const QString& moduleName) const
+QString ShibokenGenerator::convertersVariableName(const QString &moduleName) const
{
QString result = cppApiVariableName(moduleName);
result.chop(1);
@@ -2625,7 +2625,7 @@ QString ShibokenGenerator::convertersVariableName(const QString& moduleName) con
return result;
}
-static QString processInstantiationsVariableName(const AbstractMetaType* type)
+static QString processInstantiationsVariableName(const AbstractMetaType *type)
{
QString res = QLatin1Char('_') + _fixedCppTypeName(type->typeEntry()->qualifiedCppName()).toUpper();
const AbstractMetaTypeList &instantiations = type->instantiations();
@@ -2644,10 +2644,10 @@ static void appendIndexSuffix(QString *s)
s->append(QStringLiteral("IDX"));
}
-QString ShibokenGenerator::getTypeIndexVariableName(const AbstractMetaClass* metaClass, bool alternativeTemplateName)
+QString ShibokenGenerator::getTypeIndexVariableName(const AbstractMetaClass *metaClass, bool alternativeTemplateName)
{
if (alternativeTemplateName) {
- const AbstractMetaClass* templateBaseClass = metaClass->templateBaseClass();
+ const AbstractMetaClass *templateBaseClass = metaClass->templateBaseClass();
if (!templateBaseClass)
return QString();
QString result = QLatin1String("SBK_")
@@ -2660,10 +2660,10 @@ QString ShibokenGenerator::getTypeIndexVariableName(const AbstractMetaClass* met
}
return getTypeIndexVariableName(metaClass->typeEntry());
}
-QString ShibokenGenerator::getTypeIndexVariableName(const TypeEntry* type)
+QString ShibokenGenerator::getTypeIndexVariableName(const TypeEntry *type)
{
if (type->isCppPrimitive()) {
- const PrimitiveTypeEntry *trueType = static_cast<const PrimitiveTypeEntry*>(type);
+ const auto *trueType = static_cast<const PrimitiveTypeEntry *>(type);
if (trueType->basicReferencedTypeEntry())
type = trueType->basicReferencedTypeEntry();
}
@@ -2678,7 +2678,7 @@ QString ShibokenGenerator::getTypeIndexVariableName(const TypeEntry* type)
appendIndexSuffix(&result);
return result;
}
-QString ShibokenGenerator::getTypeIndexVariableName(const AbstractMetaType* type)
+QString ShibokenGenerator::getTypeIndexVariableName(const AbstractMetaType *type)
{
QString result = QLatin1String("SBK");
if (type->typeEntry()->isContainer())
@@ -2693,7 +2693,7 @@ bool ShibokenGenerator::verboseErrorMessagesDisabled() const
return m_verboseErrorMessagesDisabled;
}
-bool ShibokenGenerator::pythonFunctionWrapperUsesListOfArguments(const OverloadData& overloadData)
+bool ShibokenGenerator::pythonFunctionWrapperUsesListOfArguments(const OverloadData &overloadData)
{
if (overloadData.referenceFunction()->isCallOperator())
return true;
@@ -2707,7 +2707,7 @@ bool ShibokenGenerator::pythonFunctionWrapperUsesListOfArguments(const OverloadD
|| overloadData.hasArgumentWithDefaultValue();
}
-QString ShibokenGenerator::getDefaultValue(const AbstractMetaFunction* func, const AbstractMetaArgument* arg)
+QString ShibokenGenerator::getDefaultValue(const AbstractMetaFunction *func, const AbstractMetaArgument *arg)
{
if (!arg->defaultValueExpression().isEmpty())
return arg->defaultValueExpression();
@@ -2723,7 +2723,7 @@ QString ShibokenGenerator::getDefaultValue(const AbstractMetaFunction* func, co
return QString();
}
-void ShibokenGenerator::writeMinimalConstructorExpression(QTextStream& s, const AbstractMetaType* type, const QString& defaultCtor)
+void ShibokenGenerator::writeMinimalConstructorExpression(QTextStream &s, const AbstractMetaType *type, const QString &defaultCtor)
{
if (!defaultCtor.isEmpty()) {
s << " = " << defaultCtor;
@@ -2741,7 +2741,7 @@ void ShibokenGenerator::writeMinimalConstructorExpression(QTextStream& s, const
}
}
-void ShibokenGenerator::writeMinimalConstructorExpression(QTextStream& s, const TypeEntry* type, const QString& defaultCtor)
+void ShibokenGenerator::writeMinimalConstructorExpression(QTextStream &s, const TypeEntry *type, const QString &defaultCtor)
{
if (!defaultCtor.isEmpty()) {
s << " = " << defaultCtor;
@@ -2759,11 +2759,11 @@ void ShibokenGenerator::writeMinimalConstructorExpression(QTextStream& s, const
}
}
-bool ShibokenGenerator::isCppIntegralPrimitive(const TypeEntry* type)
+bool ShibokenGenerator::isCppIntegralPrimitive(const TypeEntry *type)
{
if (!type->isCppPrimitive())
return false;
- const PrimitiveTypeEntry *trueType = static_cast<const PrimitiveTypeEntry *>(type);
+ const auto *trueType = static_cast<const PrimitiveTypeEntry *>(type);
if (trueType->basicReferencedTypeEntry())
trueType = trueType->basicReferencedTypeEntry();
QString typeName = trueType->qualifiedCppName();
@@ -2771,7 +2771,7 @@ bool ShibokenGenerator::isCppIntegralPrimitive(const TypeEntry* type)
&& !typeName.contains(QLatin1String("float"))
&& !typeName.contains(QLatin1String("wchar"));
}
-bool ShibokenGenerator::isCppIntegralPrimitive(const AbstractMetaType* type)
+bool ShibokenGenerator::isCppIntegralPrimitive(const AbstractMetaType *type)
{
return isCppIntegralPrimitive(type->typeEntry());
}
diff --git a/sources/shiboken2/generator/shiboken2/shibokengenerator.h b/sources/shiboken2/generator/shiboken2/shibokengenerator.h
index f5f291526..84b3137b8 100644
--- a/sources/shiboken2/generator/shiboken2/shibokengenerator.h
+++ b/sources/shiboken2/generator/shiboken2/shibokengenerator.h
@@ -74,16 +74,16 @@ public:
/**
* Helper function to find for argument default value
*/
- static QString getDefaultValue(const AbstractMetaFunction* func, const AbstractMetaArgument* arg);
+ static QString getDefaultValue(const AbstractMetaFunction *func, const AbstractMetaArgument *arg);
/// Returns a list of all ancestor classes for the given class.
- AbstractMetaClassList getAllAncestors(const AbstractMetaClass* metaClass) const;
+ AbstractMetaClassList getAllAncestors(const AbstractMetaClass *metaClass) const;
protected:
bool doSetup() override;
void writeArgumentNames(QTextStream &s,
- const AbstractMetaFunction* func,
+ const AbstractMetaFunction *func,
Options options = NoOption) const override;
/**
@@ -94,7 +94,7 @@ protected:
* \param options some extra options used during the parser
*/
void writeFunctionArguments(QTextStream &s,
- const AbstractMetaFunction* func,
+ const AbstractMetaFunction *func,
Options options = NoOption) const override;
/**
@@ -114,21 +114,21 @@ protected:
AbstractMetaFunctionList getFunctionAndInheritedOverloads(const AbstractMetaFunction *func, QSet<QString> *seen);
/// Write user's custom code snippets at class or module level.
- void writeCodeSnips(QTextStream& s,
+ void writeCodeSnips(QTextStream &s,
const QVector<CodeSnip> & codeSnips,
TypeSystem::CodeSnipPosition position,
TypeSystem::Language language,
- const AbstractMetaClass* context = 0);
+ const AbstractMetaClass *context = nullptr);
/// Write user's custom code snippets at function level.
- void writeCodeSnips(QTextStream& s,
+ void writeCodeSnips(QTextStream &s,
const QVector<CodeSnip> & codeSnips,
TypeSystem::CodeSnipPosition position,
TypeSystem::Language language,
- const AbstractMetaFunction* func,
- const AbstractMetaArgument* lastArg = 0);
+ const AbstractMetaFunction *func,
+ const AbstractMetaArgument *lastArg = nullptr);
/// Replaces variables for the user's custom code at global or class level.
- void processCodeSnip(QString& code, const AbstractMetaClass* context = 0);
+ void processCodeSnip(QString &code, const AbstractMetaClass *context = nullptr);
/**
* Verifies if any of the function's code injections of the "native"
@@ -136,7 +136,7 @@ protected:
* \param func the function to check
* \return true if the function's native code snippets use "%PYSELF"
*/
- bool injectedCodeUsesPySelf(const AbstractMetaFunction* func);
+ bool injectedCodeUsesPySelf(const AbstractMetaFunction *func);
/**
* Verifies if any of the function's code injections makes a call
@@ -145,7 +145,7 @@ protected:
* \param func the function to check
* \return true if the function's code snippets call the wrapped C++ function
*/
- bool injectedCodeCallsCppFunction(const AbstractMetaFunction* func);
+ bool injectedCodeCallsCppFunction(const AbstractMetaFunction *func);
/**
* Verifies if any of the function's code injections of the "native" class makes a
@@ -154,7 +154,7 @@ protected:
* \param func the function to check
* \return true if the function's code snippets call the Python override for a C++ virtual method
*/
- bool injectedCodeCallsPythonOverride(const AbstractMetaFunction* func);
+ bool injectedCodeCallsPythonOverride(const AbstractMetaFunction *func);
/**
* Verifies if any of the function's code injections attributes values to
@@ -163,13 +163,13 @@ protected:
* \param language the kind of code snip
* \return true if the function's code attributes values to "%0" or "%PYARG_0"
*/
- bool injectedCodeHasReturnValueAttribution(const AbstractMetaFunction* func, TypeSystem::Language language = TypeSystem::TargetLangCode);
+ bool injectedCodeHasReturnValueAttribution(const AbstractMetaFunction *func, TypeSystem::Language language = TypeSystem::TargetLangCode);
/**
* Verifies if any of the function's code injections uses the type system variable
* for function arguments of a given index.
*/
- bool injectedCodeUsesArgument(const AbstractMetaFunction* func, int argumentIndex);
+ bool injectedCodeUsesArgument(const AbstractMetaFunction *func, int argumentIndex);
/**
* Function which parse the metafunction information
@@ -177,125 +177,125 @@ protected:
* \param option some extra options
* \param arg_count the number of function arguments
*/
- QString functionSignature(const AbstractMetaFunction* func,
+ QString functionSignature(const AbstractMetaFunction *func,
const QString &prepend = QString(),
const QString &append = QString(),
Options options = NoOption,
int arg_count = -1) const;
/// Returns the top-most class that has multiple inheritance in the ancestry.
- static const AbstractMetaClass *getMultipleInheritingClass(const AbstractMetaClass* metaClass);
+ static const AbstractMetaClass *getMultipleInheritingClass(const AbstractMetaClass *metaClass);
/// Returns true if the class needs to have a getattro function.
- bool classNeedsGetattroFunction(const AbstractMetaClass* metaClass);
+ bool classNeedsGetattroFunction(const AbstractMetaClass *metaClass);
/// Returns true if the class needs to have a setattro function.
bool classNeedsSetattroFunction(const AbstractMetaClass *metaClass);
/// Returns a list of methods of the given class where each one is part of a different overload with both static and non-static method.
- AbstractMetaFunctionList getMethodsWithBothStaticAndNonStaticMethods(const AbstractMetaClass* metaClass);
+ AbstractMetaFunctionList getMethodsWithBothStaticAndNonStaticMethods(const AbstractMetaClass *metaClass);
/// Returns a list of parent classes for a given class.
- AbstractMetaClassList getBaseClasses(const AbstractMetaClass* metaClass) const;
+ AbstractMetaClassList getBaseClasses(const AbstractMetaClass *metaClass) const;
- void writeToPythonConversion(QTextStream& s, const AbstractMetaType* type,
- const AbstractMetaClass* context, const QString& argumentName);
- void writeToCppConversion(QTextStream& s, const AbstractMetaType* type, const AbstractMetaClass* context, const QString& inArgName, const QString& outArgName);
- void writeToCppConversion(QTextStream& s, const AbstractMetaClass* metaClass, const QString& inArgName, const QString& outArgName);
+ void writeToPythonConversion(QTextStream &s, const AbstractMetaType *type,
+ const AbstractMetaClass *context, const QString &argumentName);
+ void writeToCppConversion(QTextStream &s, const AbstractMetaType *type, const AbstractMetaClass *context, const QString &inArgName, const QString &outArgName);
+ void writeToCppConversion(QTextStream &s, const AbstractMetaClass *metaClass, const QString &inArgName, const QString &outArgName);
/// Returns true if the argument is a pointer that rejects nullptr values.
- bool shouldRejectNullPointerArgument(const AbstractMetaFunction* func, int argIndex);
+ bool shouldRejectNullPointerArgument(const AbstractMetaFunction *func, int argIndex);
/// Verifies if the class should have a C++ wrapper generated for it, instead of only a Python wrapper.
- bool shouldGenerateCppWrapper(const AbstractMetaClass* metaClass) const;
+ bool shouldGenerateCppWrapper(const AbstractMetaClass *metaClass) const;
/// Adds enums eligible for generation from classes/namespaces marked not to be generated.
- static void lookForEnumsInClassesNotToBeGenerated(AbstractMetaEnumList& enumList, const AbstractMetaClass* metaClass);
+ static void lookForEnumsInClassesNotToBeGenerated(AbstractMetaEnumList &enumList, const AbstractMetaClass *metaClass);
/// Returns the enclosing class for an enum, or nullptr if it should be global.
- const AbstractMetaClass* getProperEnclosingClassForEnum(const AbstractMetaEnum* metaEnum);
+ const AbstractMetaClass *getProperEnclosingClassForEnum(const AbstractMetaEnum *metaEnum);
- QString wrapperName(const AbstractMetaClass* metaClass) const;
+ QString wrapperName(const AbstractMetaClass *metaClass) const;
QString wrapperName(const AbstractMetaType *metaType) const;
QString fullPythonClassName(const AbstractMetaClass *metaClass);
QString fullPythonFunctionName(const AbstractMetaFunction *func);
- static QString protectedEnumSurrogateName(const AbstractMetaEnum* metaEnum);
- static QString protectedFieldGetterName(const AbstractMetaField* field);
- static QString protectedFieldSetterName(const AbstractMetaField* field);
+ static QString protectedEnumSurrogateName(const AbstractMetaEnum *metaEnum);
+ static QString protectedFieldGetterName(const AbstractMetaField *field);
+ static QString protectedFieldSetterName(const AbstractMetaField *field);
- static QString pythonPrimitiveTypeName(const QString& cppTypeName);
- static QString pythonPrimitiveTypeName(const PrimitiveTypeEntry* type);
+ static QString pythonPrimitiveTypeName(const QString &cppTypeName);
+ static QString pythonPrimitiveTypeName(const PrimitiveTypeEntry *type);
static QString pythonOperatorFunctionName(const QString &cppOpFuncName);
- static QString pythonOperatorFunctionName(const AbstractMetaFunction* func);
+ static QString pythonOperatorFunctionName(const AbstractMetaFunction *func);
static QString pythonRichCompareOperatorId(const QString &cppOpFuncName);
- static QString pythonRichCompareOperatorId(const AbstractMetaFunction* func);
+ static QString pythonRichCompareOperatorId(const AbstractMetaFunction *func);
- static QString fixedCppTypeName(const CustomConversion::TargetToNativeConversion* toNative);
- static QString fixedCppTypeName(const AbstractMetaType* type);
- static QString fixedCppTypeName(const TypeEntry* type, QString typeName = QString());
+ static QString fixedCppTypeName(const CustomConversion::TargetToNativeConversion *toNative);
+ static QString fixedCppTypeName(const AbstractMetaType *type);
+ static QString fixedCppTypeName(const TypeEntry *type, QString typeName = QString());
static bool isNumber(const QString &cpythonApiName);
- static bool isNumber(const TypeEntry* type);
- static bool isNumber(const AbstractMetaType* type);
- static bool isPyInt(const TypeEntry* type);
- static bool isPyInt(const AbstractMetaType* type);
+ static bool isNumber(const TypeEntry *type);
+ static bool isNumber(const AbstractMetaType *type);
+ static bool isPyInt(const TypeEntry *type);
+ static bool isPyInt(const AbstractMetaType *type);
/**
* Returns true if the type passed has a Python wrapper for it.
* Although namespace has a Python wrapper, it's not considered a type.
*/
- static bool isWrapperType(const TypeEntry* type);
- static bool isWrapperType(const ComplexTypeEntry* type);
- static bool isWrapperType(const AbstractMetaType* metaType);
+ static bool isWrapperType(const TypeEntry *type);
+ static bool isWrapperType(const ComplexTypeEntry *type);
+ static bool isWrapperType(const AbstractMetaType *metaType);
/**
* Checks if the type is an Object/QObject or pointer to Value Type.
* In other words, tells if the type is "T*" and T has a Python wrapper.
*/
- static bool isPointerToWrapperType(const AbstractMetaType* type);
+ static bool isPointerToWrapperType(const AbstractMetaType *type);
/**
* Returns true if \p type is an Object Type used as a value.
*/
- static bool isObjectTypeUsedAsValueType(const AbstractMetaType* type);
+ static bool isObjectTypeUsedAsValueType(const AbstractMetaType *type);
- static bool isValueTypeWithCopyConstructorOnly(const AbstractMetaClass* metaClass);
- bool isValueTypeWithCopyConstructorOnly(const TypeEntry* type) const;
- bool isValueTypeWithCopyConstructorOnly(const AbstractMetaType* type) const;
+ static bool isValueTypeWithCopyConstructorOnly(const AbstractMetaClass *metaClass);
+ bool isValueTypeWithCopyConstructorOnly(const TypeEntry *type) const;
+ bool isValueTypeWithCopyConstructorOnly(const AbstractMetaType *type) const;
/// Returns true if the type is a primitive but not a C++ primitive.
- static bool isUserPrimitive(const TypeEntry* type);
- static bool isUserPrimitive(const AbstractMetaType* type);
+ static bool isUserPrimitive(const TypeEntry *type);
+ static bool isUserPrimitive(const AbstractMetaType *type);
/// Returns true if the type is a C++ primitive, a void*, a const char*, or a std::string.
- static bool isCppPrimitive(const TypeEntry* type);
- static bool isCppPrimitive(const AbstractMetaType* type);
+ static bool isCppPrimitive(const TypeEntry *type);
+ static bool isCppPrimitive(const AbstractMetaType *type);
/// Returns true if the type is a C++ integral primitive, i.e. bool, char, int, long, and their unsigned counterparts.
- static bool isCppIntegralPrimitive(const TypeEntry* type);
- static bool isCppIntegralPrimitive(const AbstractMetaType* type);
+ static bool isCppIntegralPrimitive(const TypeEntry *type);
+ static bool isCppIntegralPrimitive(const AbstractMetaType *type);
/// Checks if an argument type should be dereferenced by the Python method wrapper before calling the C++ method.
- static bool shouldDereferenceArgumentPointer(const AbstractMetaArgument* arg);
+ static bool shouldDereferenceArgumentPointer(const AbstractMetaArgument *arg);
/// Checks if a meta type should be dereferenced by the Python method wrapper passing it to C++.
- static bool shouldDereferenceAbstractMetaTypePointer(const AbstractMetaType* metaType);
-
- static bool visibilityModifiedToPrivate(const AbstractMetaFunction* func);
-
- QString converterObject(const AbstractMetaType* type);
- QString converterObject(const TypeEntry* type);
-
- QString cpythonBaseName(const AbstractMetaClass* metaClass);
- QString cpythonBaseName(const TypeEntry* type);
- QString cpythonBaseName(const AbstractMetaType* type);
- QString cpythonTypeName(const AbstractMetaClass* metaClass);
- QString cpythonTypeName(const TypeEntry* type);
- QString cpythonTypeNameExt(const TypeEntry* type);
- QString cpythonTypeNameExt(const AbstractMetaType* type);
- QString cpythonCheckFunction(const TypeEntry* type, bool genericNumberType = false);
- QString cpythonCheckFunction(const AbstractMetaType* metaType, bool genericNumberType = false);
+ static bool shouldDereferenceAbstractMetaTypePointer(const AbstractMetaType *metaType);
+
+ static bool visibilityModifiedToPrivate(const AbstractMetaFunction *func);
+
+ QString converterObject(const AbstractMetaType *type);
+ QString converterObject(const TypeEntry *type);
+
+ QString cpythonBaseName(const AbstractMetaClass *metaClass);
+ QString cpythonBaseName(const TypeEntry *type);
+ QString cpythonBaseName(const AbstractMetaType *type);
+ QString cpythonTypeName(const AbstractMetaClass *metaClass);
+ QString cpythonTypeName(const TypeEntry *type);
+ QString cpythonTypeNameExt(const TypeEntry *type);
+ QString cpythonTypeNameExt(const AbstractMetaType *type);
+ QString cpythonCheckFunction(const TypeEntry *type, bool genericNumberType = false);
+ QString cpythonCheckFunction(const AbstractMetaType *metaType, bool genericNumberType = false);
/**
* Receives the argument \p type and tries to find the appropriate AbstractMetaType for it
* or a custom type check.
@@ -306,28 +306,28 @@ protected:
* \return A custom check if \p type is a custom type, or an empty string if \p metaType
* receives an existing type object.
*/
- QString guessCPythonCheckFunction(const QString& type, AbstractMetaType** metaType);
- QString cpythonIsConvertibleFunction(const TypeEntry* type, bool genericNumberType = false, bool checkExact = false);
- QString cpythonIsConvertibleFunction(const AbstractMetaType* metaType, bool genericNumberType = false);
- QString cpythonIsConvertibleFunction(const AbstractMetaArgument* metaArg, bool genericNumberType = false);
-
- QString cpythonToCppConversionFunction(const AbstractMetaClass* metaClass);
- QString cpythonToCppConversionFunction(const AbstractMetaType* type, const AbstractMetaClass* context = 0);
- QString cpythonToPythonConversionFunction(const AbstractMetaType* type, const AbstractMetaClass* context = 0);
- QString cpythonToPythonConversionFunction(const AbstractMetaClass* metaClass);
- QString cpythonToPythonConversionFunction(const TypeEntry* type);
-
- QString cpythonFunctionName(const AbstractMetaFunction* func);
- QString cpythonMethodDefinitionName(const AbstractMetaFunction* func);
- QString cpythonGettersSettersDefinitionName(const AbstractMetaClass* metaClass);
- QString cpythonGetattroFunctionName(const AbstractMetaClass* metaClass);
- QString cpythonSetattroFunctionName(const AbstractMetaClass* metaClass);
- QString cpythonGetterFunctionName(const AbstractMetaField* metaField);
- QString cpythonSetterFunctionName(const AbstractMetaField* metaField);
- QString cpythonWrapperCPtr(const AbstractMetaClass* metaClass,
+ QString guessCPythonCheckFunction(const QString &type, AbstractMetaType **metaType);
+ QString cpythonIsConvertibleFunction(const TypeEntry *type, bool genericNumberType = false, bool checkExact = false);
+ QString cpythonIsConvertibleFunction(const AbstractMetaType *metaType, bool genericNumberType = false);
+ QString cpythonIsConvertibleFunction(const AbstractMetaArgument *metaArg, bool genericNumberType = false);
+
+ QString cpythonToCppConversionFunction(const AbstractMetaClass *metaClass);
+ QString cpythonToCppConversionFunction(const AbstractMetaType *type, const AbstractMetaClass *context = nullptr);
+ QString cpythonToPythonConversionFunction(const AbstractMetaType *type, const AbstractMetaClass *context = nullptr);
+ QString cpythonToPythonConversionFunction(const AbstractMetaClass *metaClass);
+ QString cpythonToPythonConversionFunction(const TypeEntry *type);
+
+ QString cpythonFunctionName(const AbstractMetaFunction *func);
+ QString cpythonMethodDefinitionName(const AbstractMetaFunction *func);
+ QString cpythonGettersSettersDefinitionName(const AbstractMetaClass *metaClass);
+ QString cpythonGetattroFunctionName(const AbstractMetaClass *metaClass);
+ QString cpythonSetattroFunctionName(const AbstractMetaClass *metaClass);
+ QString cpythonGetterFunctionName(const AbstractMetaField *metaField);
+ QString cpythonSetterFunctionName(const AbstractMetaField *metaField);
+ QString cpythonWrapperCPtr(const AbstractMetaClass *metaClass,
const QString &argName = QLatin1String("self"));
QString cpythonWrapperCPtr(const AbstractMetaType *metaType, const QString &argName);
- QString cpythonWrapperCPtr(const TypeEntry* type, const QString &argName);
+ QString cpythonWrapperCPtr(const TypeEntry *type, const QString &argName);
/// Guesses the scope to where belongs an argument's default value.
QString guessScopeForDefaultValue(const AbstractMetaFunction *func,
@@ -336,18 +336,18 @@ protected:
const AbstractMetaArgument *arg,
const QString &value) const;
- QString cpythonEnumName(const EnumTypeEntry* enumEntry);
- QString cpythonEnumName(const AbstractMetaEnum* metaEnum);
+ QString cpythonEnumName(const EnumTypeEntry *enumEntry);
+ QString cpythonEnumName(const AbstractMetaEnum *metaEnum);
- QString cpythonFlagsName(const FlagsTypeEntry* flagsEntry);
- QString cpythonFlagsName(const AbstractMetaEnum* metaEnum);
+ QString cpythonFlagsName(const FlagsTypeEntry *flagsEntry);
+ QString cpythonFlagsName(const AbstractMetaEnum *metaEnum);
/// Returns the special cast function name, the function used to proper cast class with multiple inheritance.
- QString cpythonSpecialCastFunctionName(const AbstractMetaClass* metaClass);
+ QString cpythonSpecialCastFunctionName(const AbstractMetaClass *metaClass);
- QString getFormatUnitString(const AbstractMetaFunction* func, bool incRef = false) const;
+ QString getFormatUnitString(const AbstractMetaFunction *func, bool incRef = false) const;
/// Returns the file name for the module global header. If no module name is provided the current will be used.
- QString getModuleHeaderFileName(const QString& moduleName = QString()) const;
+ QString getModuleHeaderFileName(const QString &moduleName = QString()) const;
OptionDescriptions options() const override;
bool handleOption(const QString &key, const QString &value) override;
@@ -362,18 +362,18 @@ protected:
bool useIsNullAsNbNonZero() const;
/// Returns true if the generated code should use the "#define protected public" hack.
bool avoidProtectedHack() const;
- QString cppApiVariableName(const QString& moduleName = QString()) const;
- QString pythonModuleObjectName(const QString& moduleName = QString()) const;
- QString convertersVariableName(const QString& moduleName = QString()) const;
+ QString cppApiVariableName(const QString &moduleName = QString()) const;
+ QString pythonModuleObjectName(const QString &moduleName = QString()) const;
+ QString convertersVariableName(const QString &moduleName = QString()) const;
/**
* Returns the type index variable name for a given class. If \p alternativeTemplateName is true
* and the class is a typedef for a template class instantiation, it will return an alternative name
* made of the template class and the instantiation values, or an empty string if the class isn't
* derived from a template class at all.
*/
- QString getTypeIndexVariableName(const AbstractMetaClass* metaClass, bool alternativeTemplateName = false);
- QString getTypeIndexVariableName(const TypeEntry* type);
- QString getTypeIndexVariableName(const AbstractMetaType* type);
+ QString getTypeIndexVariableName(const AbstractMetaClass *metaClass, bool alternativeTemplateName = false);
+ QString getTypeIndexVariableName(const TypeEntry *type);
+ QString getTypeIndexVariableName(const AbstractMetaType *type);
/// Returns true if the user don't want verbose error messages on the generated bindings.
bool verboseErrorMessagesDisabled() const;
@@ -389,16 +389,16 @@ protected:
QString *errorMessage = nullptr);
/// Creates an AbstractMetaType object from a TypeEntry.
- AbstractMetaType* buildAbstractMetaTypeFromTypeEntry(const TypeEntry* typeEntry);
+ AbstractMetaType *buildAbstractMetaTypeFromTypeEntry(const TypeEntry *typeEntry);
/// Creates an AbstractMetaType object from an AbstractMetaClass.
- AbstractMetaType* buildAbstractMetaTypeFromAbstractMetaClass(const AbstractMetaClass* metaClass);
+ AbstractMetaType *buildAbstractMetaTypeFromAbstractMetaClass(const AbstractMetaClass *metaClass);
- void writeMinimalConstructorExpression(QTextStream& s, const AbstractMetaType* type, const QString& defaultCtor = QString());
- void writeMinimalConstructorExpression(QTextStream& s, const TypeEntry* type, const QString& defaultCtor = QString());
+ void writeMinimalConstructorExpression(QTextStream &s, const AbstractMetaType *type, const QString &defaultCtor = QString());
+ void writeMinimalConstructorExpression(QTextStream &s, const TypeEntry *type, const QString &defaultCtor = QString());
- void collectContainerTypesFromConverterMacros(const QString& code, bool toPythonMacro);
+ void collectContainerTypesFromConverterMacros(const QString &code, bool toPythonMacro);
// verify whether the class is copyable
- bool isCopyable(const AbstractMetaClass* metaClass);
+ bool isCopyable(const AbstractMetaClass *metaClass);
void clearTpFuncs();
@@ -408,17 +408,17 @@ protected:
/// Initializes a list of Python known type names.
static void initKnownPythonTypes();
- void writeFunctionCall(QTextStream& s,
- const AbstractMetaFunction* metaFunc,
+ void writeFunctionCall(QTextStream &s,
+ const AbstractMetaFunction *metaFunc,
Options options = NoOption) const;
- void writeUnusedVariableCast(QTextStream& s, const QString& variableName);
+ void writeUnusedVariableCast(QTextStream &s, const QString &variableName);
- AbstractMetaFunctionList filterFunctions(const AbstractMetaClass* metaClass);
+ AbstractMetaFunctionList filterFunctions(const AbstractMetaClass *metaClass);
// All data about extended converters: the type entries of the target type, and a
// list of AbstractMetaClasses accepted as argument for the conversion.
- typedef QHash<const TypeEntry *, QVector<const AbstractMetaClass *> > ExtendedConverterData;
+ using ExtendedConverterData = QHash<const TypeEntry *, QVector<const AbstractMetaClass *> >;
/// Returns all extended conversions for the current module.
ExtendedConverterData getExtendedConverters() const;
@@ -426,7 +426,7 @@ protected:
QVector<const CustomConversion *> getPrimitiveCustomConversions();
/// Returns true if the Python wrapper for the received OverloadData must accept a list of arguments.
- static bool pythonFunctionWrapperUsesListOfArguments(const OverloadData& overloadData);
+ static bool pythonFunctionWrapperUsesListOfArguments(const OverloadData &overloadData);
Indentor INDENT;
@@ -446,8 +446,8 @@ private:
static FunctionGroups getFunctionGroupsImpl(const AbstractMetaClass *scope);
static bool classNeedsGetattroFunctionImpl(const AbstractMetaClass *metaClass);
- QString translateTypeForWrapperMethod(const AbstractMetaType* cType,
- const AbstractMetaClass* context,
+ QString translateTypeForWrapperMethod(const AbstractMetaType *cType,
+ const AbstractMetaClass *context,
Options opt = NoOption) const;
/**
@@ -464,8 +464,8 @@ private:
* \param scope scope used to search for overloads.
* \param functionName the function name.
*/
- AbstractMetaFunctionList getFunctionOverloads(const AbstractMetaClass* scope,
- const QString& functionName);
+ AbstractMetaFunctionList getFunctionOverloads(const AbstractMetaClass *scope,
+ const QString &functionName);
/**
* Write a function argument in the C++ in the text stream \p s.
* This function just call \code s << argumentString(); \endcode
@@ -475,8 +475,8 @@ private:
* \param options some extra options.
*/
void writeArgument(QTextStream &s,
- const AbstractMetaFunction* func,
- const AbstractMetaArgument* argument,
+ const AbstractMetaFunction *func,
+ const AbstractMetaArgument *argument,
Options options = NoOption) const;
/**
* Create a QString in the C++ format to an function argument.
@@ -484,18 +484,18 @@ private:
* \param argument metaargument information to be parsed.
* \param options some extra options.
*/
- QString argumentString(const AbstractMetaFunction* func,
- const AbstractMetaArgument* argument,
+ QString argumentString(const AbstractMetaFunction *func,
+ const AbstractMetaArgument *argument,
Options options = NoOption) const;
- QString functionReturnType(const AbstractMetaFunction* func, Options options = NoOption) const;
+ QString functionReturnType(const AbstractMetaFunction *func, Options options = NoOption) const;
/// Utility function for writeCodeSnips.
- typedef QPair<const AbstractMetaArgument*, QString> ArgumentVarReplacementPair;
- typedef QVector<ArgumentVarReplacementPair> ArgumentVarReplacementList;
+ using ArgumentVarReplacementPair = QPair<const AbstractMetaArgument *, QString>;
+ using ArgumentVarReplacementList = QVector<ArgumentVarReplacementPair>;
ArgumentVarReplacementList getArgumentReplacement(const AbstractMetaFunction* func,
bool usePyArgs, TypeSystem::Language language,
- const AbstractMetaArgument* lastArg);
+ const AbstractMetaArgument *lastArg);
/// Returns a string with the user's custom code snippets that comply with \p position and \p language.
QString getCodeSnippets(const QVector<CodeSnip> & codeSnips,
@@ -509,31 +509,31 @@ private:
TypeSystemToPythonFunction,
TypeSystemConverterVariables
};
- void replaceConverterTypeSystemVariable(TypeSystemConverterVariable converterVariable, QString& code);
+ void replaceConverterTypeSystemVariable(TypeSystemConverterVariable converterVariable, QString &code);
/// Replaces the %CONVERTTOPYTHON type system variable.
- inline void replaceConvertToPythonTypeSystemVariable(QString& code)
+ inline void replaceConvertToPythonTypeSystemVariable(QString &code)
{
replaceConverterTypeSystemVariable(TypeSystemToPythonFunction, code);
}
/// Replaces the %CONVERTTOCPP type system variable.
- inline void replaceConvertToCppTypeSystemVariable(QString& code)
+ inline void replaceConvertToCppTypeSystemVariable(QString &code)
{
replaceConverterTypeSystemVariable(TypeSystemToCppFunction, code);
}
/// Replaces the %ISCONVERTIBLE type system variable.
- inline void replaceIsConvertibleToCppTypeSystemVariable(QString& code)
+ inline void replaceIsConvertibleToCppTypeSystemVariable(QString &code)
{
replaceConverterTypeSystemVariable(TypeSystemIsConvertibleFunction, code);
}
/// Replaces the %CHECKTYPE type system variable.
- inline void replaceTypeCheckTypeSystemVariable(QString& code)
+ inline void replaceTypeCheckTypeSystemVariable(QString &code)
{
replaceConverterTypeSystemVariable(TypeSystemCheckFunction, code);
}
/// Return a prefix with '_' suitable for names in C++
- QString moduleCppPrefix(const QString& moduleName = QString()) const;
+ QString moduleCppPrefix(const QString &moduleName = QString()) const;
bool m_useCtorHeuristic = false;
bool m_userReturnValueHeuristic = false;
@@ -542,7 +542,7 @@ private:
bool m_useIsNullAsNbNonZero = false;
bool m_avoidProtectedHack = false;
- typedef QHash<QString, AbstractMetaType*> AbstractMetaTypeCache;
+ using AbstractMetaTypeCache = QHash<QString, AbstractMetaType *>;
AbstractMetaTypeCache m_metaTypeFromStringCache;
/// Type system converter variable replacement names and regular expressions.
diff --git a/sources/shiboken2/libshiboken/autodecref.h b/sources/shiboken2/libshiboken/autodecref.h
index 72fd236de..d3353b1e4 100644
--- a/sources/shiboken2/libshiboken/autodecref.h
+++ b/sources/shiboken2/libshiboken/autodecref.h
@@ -53,21 +53,21 @@ namespace Shiboken
struct LIBSHIBOKEN_API AutoDecRef
{
public:
- AutoDecRef(const AutoDecRef&) = delete;
- AutoDecRef(AutoDecRef&&) = delete;
- AutoDecRef& operator=(const AutoDecRef&) = delete;
- AutoDecRef& operator=(AutoDecRef&&) = delete;
+ AutoDecRef(const AutoDecRef &) = delete;
+ AutoDecRef(AutoDecRef &&) = delete;
+ AutoDecRef &operator=(const AutoDecRef &) = delete;
+ AutoDecRef &operator=(AutoDecRef &&) = delete;
/**
* AutoDecRef constructor.
* \param pyobj A borrowed reference to a Python object
*/
- explicit AutoDecRef(PyObject* pyObj) : m_pyObj(pyObj) {}
+ explicit AutoDecRef(PyObject *pyObj) : m_pyObj(pyObj) {}
/**
* AutoDecRef constructor.
* \param pyobj A borrowed reference to a Python object
*/
- explicit AutoDecRef(SbkObject* pyObj) : m_pyObj(reinterpret_cast<PyObject*>(pyObj)) {}
+ explicit AutoDecRef(SbkObject *pyObj) : m_pyObj(reinterpret_cast<PyObject *>(pyObj)) {}
/// Decref the borrowed python reference
~AutoDecRef()
@@ -75,15 +75,15 @@ public:
Py_XDECREF(m_pyObj);
}
- inline bool isNull() const { return m_pyObj == 0; }
+ inline bool isNull() const { return m_pyObj == nullptr; }
/// Returns the pointer of the Python object being held.
- inline PyObject* object() { return m_pyObj; }
- inline operator PyObject*() { return m_pyObj; }
+ inline PyObject *object() { return m_pyObj; }
+ inline operator PyObject *() { return m_pyObj; }
#ifndef Py_LIMITED_API
- inline operator PyTupleObject*() { return reinterpret_cast<PyTupleObject*>(m_pyObj); }
+ inline operator PyTupleObject *() { return reinterpret_cast<PyTupleObject *>(m_pyObj); }
#endif
- inline operator bool() const { return m_pyObj != 0; }
- inline PyObject* operator->() { return m_pyObj; }
+ inline operator bool() const { return m_pyObj != nullptr; }
+ inline PyObject *operator->() { return m_pyObj; }
template<typename T>
T cast()
@@ -94,13 +94,13 @@ public:
/**
* Decref the current borrowed python reference and borrow \p other.
*/
- void reset(PyObject* other)
+ void reset(PyObject *other)
{
Py_XDECREF(m_pyObj);
m_pyObj = other;
}
private:
- PyObject* m_pyObj;
+ PyObject *m_pyObj;
};
} // namespace Shiboken
diff --git a/sources/shiboken2/libshiboken/basewrapper.cpp b/sources/shiboken2/libshiboken/basewrapper.cpp
index f38b55b56..b9f6735d8 100644
--- a/sources/shiboken2/libshiboken/basewrapper.cpp
+++ b/sources/shiboken2/libshiboken/basewrapper.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt for Python.
@@ -58,7 +58,7 @@
#include "voidptr.h"
namespace {
- void _destroyParentInfo(SbkObject* obj, bool keepReference);
+ void _destroyParentInfo(SbkObject *obj, bool keepReference);
}
static void callDestructor(const Shiboken::DtorAccumulatorVisitor::DestructorEntries &dts)
@@ -73,27 +73,26 @@ static void callDestructor(const Shiboken::DtorAccumulatorVisitor::DestructorEnt
extern "C"
{
-static void SbkObjectTypeDealloc(PyObject* pyObj);
-static PyObject* SbkObjectTypeTpNew(PyTypeObject* metatype, PyObject* args, PyObject* kwds);
+static void SbkObjectTypeDealloc(PyObject *pyObj);
+static PyObject *SbkObjectTypeTpNew(PyTypeObject *metatype, PyObject *args, PyObject *kwds);
// PYSIDE-908: The function PyType_Modified does not work in PySide, so we need to
// explicitly pass __doc__. For __signature__ it _did_ actually work, because
// it was not existing before. We add them both for clarity.
static PyGetSetDef SbkObjectType_Type_getsetlist[] = {
- {const_cast<char*>("__signature__"), (getter)Sbk_TypeGet___signature__},
- {const_cast<char*>("__doc__"), (getter)Sbk_TypeGet___doc__},
+ {const_cast<char *>("__signature__"), (getter)Sbk_TypeGet___signature__},
+ {const_cast<char *>("__doc__"), (getter)Sbk_TypeGet___doc__},
{nullptr} // Sentinel
};
static PyType_Slot SbkObjectType_Type_slots[] = {
- {Py_tp_dealloc, (void *)SbkObjectTypeDealloc},
- {Py_tp_setattro, (void *)PyObject_GenericSetAttr},
- {Py_tp_base, (void *)&PyType_Type},
- {Py_tp_alloc, (void *)PyType_GenericAlloc},
- {Py_tp_getset, (void *)SbkObjectType_Type_getsetlist},
- {Py_tp_new, (void *)SbkObjectTypeTpNew},
- {Py_tp_free, (void *)PyObject_GC_Del},
- {0, 0}
+ {Py_tp_dealloc, reinterpret_cast<void *>(SbkObjectTypeDealloc)},
+ {Py_tp_setattro, reinterpret_cast<void *>(PyObject_GenericSetAttr)},
+ {Py_tp_base, static_cast<void *>(&PyType_Type)},
+ {Py_tp_alloc, reinterpret_cast<void *>(PyType_GenericAlloc)},
+ {Py_tp_new, reinterpret_cast<void *>(SbkObjectTypeTpNew)},
+ {Py_tp_free, reinterpret_cast<void *>(PyObject_GC_Del)},
+ {0, nullptr}
};
static PyType_Spec SbkObjectType_Type_spec = {
"Shiboken.ObjectType",
@@ -205,35 +204,35 @@ PyTypeObject *SbkObjectType_TypeF(void)
return type;
}
-static PyObject *SbkObjectGetDict(PyObject* pObj, void *)
+static PyObject *SbkObjectGetDict(PyObject *pObj, void *)
{
- SbkObject *obj = reinterpret_cast<SbkObject *>(pObj);
+ auto *obj = reinterpret_cast<SbkObject *>(pObj);
if (!obj->ob_dict)
obj->ob_dict = PyDict_New();
if (!obj->ob_dict)
- return 0;
+ return nullptr;
Py_INCREF(obj->ob_dict);
return obj->ob_dict;
}
static PyGetSetDef SbkObjectGetSetList[] = {
- {const_cast<char*>("__dict__"), SbkObjectGetDict, 0, 0, 0},
- {0, 0, 0, 0, 0} // Sentinel
+ {const_cast<char *>("__dict__"), SbkObjectGetDict, nullptr, nullptr, nullptr},
+ {nullptr, nullptr, nullptr, nullptr, nullptr} // Sentinel
};
-static int SbkObject_traverse(PyObject* self, visitproc visit, void* arg)
+static int SbkObject_traverse(PyObject *self, visitproc visit, void *arg)
{
- SbkObject* sbkSelf = reinterpret_cast<SbkObject*>(self);
+ auto *sbkSelf = reinterpret_cast<SbkObject *>(self);
//Visit children
- Shiboken::ParentInfo* pInfo = sbkSelf->d->parentInfo;
+ Shiboken::ParentInfo *pInfo = sbkSelf->d->parentInfo;
if (pInfo) {
for (SbkObject *c : pInfo->children)
Py_VISIT(c);
}
//Visit refs
- Shiboken::RefCountMap* rInfo = sbkSelf->d->referredObjects;
+ Shiboken::RefCountMap *rInfo = sbkSelf->d->referredObjects;
if (rInfo) {
for (auto it = rInfo->begin(), end = rInfo->end(); it != end; ++it)
Py_VISIT(it->second);
@@ -244,9 +243,9 @@ static int SbkObject_traverse(PyObject* self, visitproc visit, void* arg)
return 0;
}
-static int SbkObject_clear(PyObject* self)
+static int SbkObject_clear(PyObject *self)
{
- SbkObject* sbkSelf = reinterpret_cast<SbkObject*>(self);
+ auto *sbkSelf = reinterpret_cast<SbkObject *>(self);
Shiboken::Object::removeParent(sbkSelf);
@@ -261,13 +260,13 @@ static int SbkObject_clear(PyObject* self)
}
static PyType_Slot SbkObject_Type_slots[] = {
- {Py_tp_dealloc, (void *)SbkDeallocWrapperWithPrivateDtor},
- {Py_tp_traverse, (void *)SbkObject_traverse},
- {Py_tp_clear, (void *)SbkObject_clear},
+ {Py_tp_dealloc, reinterpret_cast<void *>(SbkDeallocWrapperWithPrivateDtor)},
+ {Py_tp_traverse, reinterpret_cast<void *>(SbkObject_traverse)},
+ {Py_tp_clear, reinterpret_cast<void *>(SbkObject_clear)},
// unsupported: {Py_tp_weaklistoffset, (void *)offsetof(SbkObject, weakreflist)},
- {Py_tp_getset, (void *)SbkObjectGetSetList},
+ {Py_tp_getset, reinterpret_cast<void *>(SbkObjectGetSetList)},
// unsupported: {Py_tp_dictoffset, (void *)offsetof(SbkObject, ob_dict)},
- {0, 0}
+ {0, nullptr}
};
static PyType_Spec SbkObject_Type_spec = {
"Shiboken.Object",
@@ -298,10 +297,10 @@ static int mainThreadDeletionHandler(void *)
return 0;
}
-static void SbkDeallocWrapperCommon(PyObject* pyObj, bool canDelete)
+static void SbkDeallocWrapperCommon(PyObject *pyObj, bool canDelete)
{
- SbkObject* sbkObj = reinterpret_cast<SbkObject*>(pyObj);
- PyTypeObject* pyType = Py_TYPE(pyObj);
+ auto *sbkObj = reinterpret_cast<SbkObject *>(pyObj);
+ PyTypeObject *pyType = Py_TYPE(pyObj);
// Need to decref the type if this is the dealloc func; if type
// is subclassed, that dealloc func will decref (see subtype_dealloc
@@ -352,7 +351,7 @@ static void SbkDeallocWrapperCommon(PyObject* pyObj, bool canDelete)
Shiboken::Object::deallocData(sbkObj, true);
callDestructor(visitor.entries());
} else {
- void* cptr = sbkObj->d->cptr[0];
+ void *cptr = sbkObj->d->cptr[0];
Shiboken::Object::deallocData(sbkObj, true);
Shiboken::ThreadStateSaver threadSaver;
@@ -368,27 +367,27 @@ static void SbkDeallocWrapperCommon(PyObject* pyObj, bool canDelete)
Py_DECREF(pyType);
}
-void SbkDeallocWrapper(PyObject* pyObj)
+void SbkDeallocWrapper(PyObject *pyObj)
{
SbkDeallocWrapperCommon(pyObj, true);
}
-void SbkDeallocQAppWrapper(PyObject* pyObj)
+void SbkDeallocQAppWrapper(PyObject *pyObj)
{
SbkDeallocWrapper(pyObj);
// PYSIDE-571: make sure to create a singleton deleted qApp.
- MakeSingletonQAppWrapper(NULL);
+ MakeSingletonQAppWrapper(nullptr);
}
-void SbkDeallocWrapperWithPrivateDtor(PyObject* self)
+void SbkDeallocWrapperWithPrivateDtor(PyObject *self)
{
SbkDeallocWrapperCommon(self, false);
}
-void SbkObjectTypeDealloc(PyObject* pyObj)
+void SbkObjectTypeDealloc(PyObject *pyObj)
{
SbkObjectTypePrivate *sotp = PepType_SOTP(pyObj);
- PyTypeObject *type = reinterpret_cast<PyTypeObject*>(pyObj);
+ auto type = reinterpret_cast<PyTypeObject *>(pyObj);
PyObject_GC_UnTrack(pyObj);
#ifndef Py_LIMITED_API
@@ -411,7 +410,7 @@ void SbkObjectTypeDealloc(PyObject* pyObj)
#endif
}
-PyObject* SbkObjectTypeTpNew(PyTypeObject* metatype, PyObject* args, PyObject* kwds)
+PyObject *SbkObjectTypeTpNew(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
{
// Check if all bases are new style before calling type.tp_new
// Was causing gc assert errors in test_bug704.py when
@@ -422,19 +421,19 @@ PyObject* SbkObjectTypeTpNew(PyTypeObject* metatype, PyObject* args, PyObject* k
// Before we changed to heap types, it was sufficient to remove the
// Py_TPFLAGS_BASETYPE flag. That does not work, because PySide does
// not respect this flag itself!
- PyObject* name;
- PyObject* pyBases;
- PyObject* dict;
- static const char* kwlist[] = { "name", "bases", "dict", 0};
+ PyObject *name;
+ PyObject *pyBases;
+ PyObject *dict;
+ static const char *kwlist[] = { "name", "bases", "dict", nullptr};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "sO!O!:sbktype", (char**)kwlist,
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "sO!O!:sbktype", const_cast<char **>(kwlist),
&name,
&PyTuple_Type, &pyBases,
&PyDict_Type, &dict))
- return NULL;
+ return nullptr;
for (int i=0, i_max=PyTuple_GET_SIZE(pyBases); i < i_max; i++) {
- PyObject* baseType = PyTuple_GET_ITEM(pyBases, i);
+ PyObject *baseType = PyTuple_GET_ITEM(pyBases, i);
#ifndef IS_PY3K
if (PyClass_Check(baseType)) {
PyErr_Format(PyExc_TypeError, "Invalid base class used in type %s. "
@@ -449,15 +448,15 @@ PyObject* SbkObjectTypeTpNew(PyTypeObject* metatype, PyObject* args, PyObject* k
}
// The meta type creates a new type when the Python programmer extends a wrapped C++ class.
- newfunc type_new = reinterpret_cast<newfunc>(PyType_Type.tp_new);
- SbkObjectType *newType = reinterpret_cast<SbkObjectType*>(type_new(metatype, args, kwds));
+ auto type_new = reinterpret_cast<newfunc>(PyType_Type.tp_new);
+ auto *newType = reinterpret_cast<SbkObjectType *>(type_new(metatype, args, kwds));
if (!newType)
- return 0;
+ return nullptr;
Shiboken::ObjectType::initPrivateData(newType);
SbkObjectTypePrivate *sotp = PepType_SOTP(newType);
- const auto bases = Shiboken::getCppBaseClasses(reinterpret_cast<PyTypeObject*>(newType));
+ const auto bases = Shiboken::getCppBaseClasses(reinterpret_cast<PyTypeObject *>(newType));
if (bases.size() == 1) {
SbkObjectTypePrivate *parentType = PepType_SOTP(bases.front());
sotp->mi_offsets = parentType->mi_offsets;
@@ -489,19 +488,19 @@ PyObject* SbkObjectTypeTpNew(PyTypeObject* metatype, PyObject* args, PyObject* k
PepType_SOTP(base)->subtype_init(newType, args, kwds);
}
- return reinterpret_cast<PyObject*>(newType);
+ return reinterpret_cast<PyObject *>(newType);
}
static PyObject *_setupNew(SbkObject *self, PyTypeObject *subtype)
{
- Py_INCREF(reinterpret_cast<PyObject*>(subtype));
- SbkObjectPrivate* d = new SbkObjectPrivate;
+ Py_INCREF(reinterpret_cast<PyObject *>(subtype));
+ auto d = new SbkObjectPrivate;
- SbkObjectTypePrivate * sotp = PepType_SOTP(subtype);
+ SbkObjectTypePrivate *sotp = PepType_SOTP(subtype);
int numBases = ((sotp && sotp->is_multicpp) ?
Shiboken::getNumberOfCppBaseClasses(subtype) : 1);
- d->cptr = new void*[numBases];
- std::memset(d->cptr, 0, sizeof(void*) * size_t(numBases));
+ d->cptr = new void *[numBases];
+ std::memset(d->cptr, 0, sizeof(void *) *size_t(numBases));
d->hasOwnership = 1;
d->containsCppWrapper = 0;
d->validCppObject = 0;
@@ -511,18 +510,18 @@ static PyObject *_setupNew(SbkObject *self, PyTypeObject *subtype)
self->ob_dict = nullptr;
self->weakreflist = nullptr;
self->d = d;
- return reinterpret_cast<PyObject*>(self);
+ return reinterpret_cast<PyObject *>(self);
}
-PyObject* SbkObjectTpNew(PyTypeObject *subtype, PyObject *, PyObject *)
+PyObject *SbkObjectTpNew(PyTypeObject *subtype, PyObject *, PyObject *)
{
SbkObject *self = PyObject_GC_New(SbkObject, subtype);
PyObject *res = _setupNew(self, subtype);
- PyObject_GC_Track(reinterpret_cast<PyObject*>(self));
+ PyObject_GC_Track(reinterpret_cast<PyObject *>(self));
return res;
}
-PyObject* SbkQAppTpNew(PyTypeObject* subtype, PyObject *, PyObject *)
+PyObject *SbkQAppTpNew(PyTypeObject *subtype, PyObject *, PyObject *)
{
// PYSIDE-571:
// For qApp, we need to create a singleton Python object.
@@ -542,8 +541,8 @@ PyObject* SbkQAppTpNew(PyTypeObject* subtype, PyObject *, PyObject *)
subtype->tp_free = PyObject_Del;
}
#endif
- SbkObject* self = reinterpret_cast<SbkObject*>(MakeSingletonQAppWrapper(subtype));
- return self == 0 ? 0 : _setupNew(self, subtype);
+ auto self = reinterpret_cast<SbkObject *>(MakeSingletonQAppWrapper(subtype));
+ return self == nullptr ? nullptr : _setupNew(self, subtype);
}
void
@@ -553,7 +552,7 @@ object_dealloc(PyObject *self)
}
PyObject *
-SbkDummyNew(PyTypeObject *type, PyObject*, PyObject*)
+SbkDummyNew(PyTypeObject *type, PyObject *, PyObject *)
{
// PYSIDE-595: Give the same error as type_call does when tp_new is NULL.
PyErr_Format(PyExc_TypeError,
@@ -568,12 +567,12 @@ SbkDummyNew(PyTypeObject *type, PyObject*, PyObject*)
namespace
{
-void _destroyParentInfo(SbkObject* obj, bool keepReference)
+void _destroyParentInfo(SbkObject *obj, bool keepReference)
{
- Shiboken::ParentInfo* pInfo = obj->d->parentInfo;
+ Shiboken::ParentInfo *pInfo = obj->d->parentInfo;
if (pInfo) {
while(!pInfo->children.empty()) {
- SbkObject* first = *pInfo->children.begin();
+ SbkObject *first = *pInfo->children.begin();
// Mark child as invalid
Shiboken::Object::invalidate(first);
Shiboken::Object::removeParent(first, false, keepReference);
@@ -588,13 +587,13 @@ namespace Shiboken
{
bool walkThroughClassHierarchy(PyTypeObject *currentType, HierarchyVisitor *visitor)
{
- PyObject* bases = currentType->tp_bases;
+ PyObject *bases = currentType->tp_bases;
Py_ssize_t numBases = PyTuple_GET_SIZE(bases);
bool result = false;
for (int i = 0; !result && i < numBases; ++i) {
- PyTypeObject* type = reinterpret_cast<PyTypeObject*>(PyTuple_GET_ITEM(bases, i));
- if (PyType_IsSubtype(type, reinterpret_cast<PyTypeObject*>(SbkObject_TypeF()))) {
- SbkObjectType* sbkType = reinterpret_cast<SbkObjectType*>(type);
+ auto type = reinterpret_cast<PyTypeObject *>(PyTuple_GET_ITEM(bases, i));
+ if (PyType_IsSubtype(type, reinterpret_cast<PyTypeObject *>(SbkObject_TypeF()))) {
+ auto sbkType = reinterpret_cast<SbkObjectType *>(type);
result = PepType_SOTP(sbkType)->is_user_type
? walkThroughClassHierarchy(type, visitor) : visitor->visit(sbkType);
}
@@ -602,10 +601,10 @@ bool walkThroughClassHierarchy(PyTypeObject *currentType, HierarchyVisitor *visi
return result;
}
-bool importModule(const char* moduleName, PyTypeObject*** cppApiPtr)
+bool importModule(const char *moduleName, PyTypeObject *** cppApiPtr)
{
- PyObject* sysModules = PyImport_GetModuleDict();
- PyObject* module = PyDict_GetItemString(sysModules, moduleName);
+ PyObject *sysModules = PyImport_GetModuleDict();
+ PyObject *module = PyDict_GetItemString(sysModules, moduleName);
if (!module) {
module = PyImport_ImportModule(moduleName);
if (!module)
@@ -622,11 +621,11 @@ bool importModule(const char* moduleName, PyTypeObject*** cppApiPtr)
#ifdef IS_PY3K
if (PyCapsule_CheckExact(cppApi))
- *cppApiPtr = reinterpret_cast<PyTypeObject**>(PyCapsule_GetPointer(cppApi, 0));
+ *cppApiPtr = reinterpret_cast<PyTypeObject **>(PyCapsule_GetPointer(cppApi, nullptr));
#else
// Python 2.6 doesn't have PyCapsule API, so let's keep usign PyCObject on all Python 2.x
if (PyCObject_Check(cppApi))
- *cppApiPtr = reinterpret_cast<PyTypeObject**>(PyCObject_AsVoidPtr(cppApi));
+ *cppApiPtr = reinterpret_cast<PyTypeObject **>(PyCObject_AsVoidPtr(cppApi));
#endif
return true;
}
@@ -651,7 +650,7 @@ bool BaseAccumulatorVisitor::visit(SbkObjectType *node)
bool GetIndexVisitor::visit(SbkObjectType *node)
{
m_index++;
- return PyType_IsSubtype(reinterpret_cast<PyTypeObject*>(node), m_desiredType);
+ return PyType_IsSubtype(reinterpret_cast<PyTypeObject *>(node), m_desiredType);
}
bool DtorAccumulatorVisitor::visit(SbkObjectType *node)
@@ -709,27 +708,27 @@ public:
bool visit(SbkObjectType *node) override
{
- return reinterpret_cast<PyTypeObject*>(node) == m_typeToFind;
+ return reinterpret_cast<PyTypeObject *>(node) == m_typeToFind;
}
private:
PyTypeObject *m_typeToFind;
};
-std::vector<SbkObject *> splitPyObject(PyObject* pyObj)
+std::vector<SbkObject *> splitPyObject(PyObject *pyObj)
{
std::vector<SbkObject *> result;
if (PySequence_Check(pyObj)) {
AutoDecRef lst(PySequence_Fast(pyObj, "Invalid keep reference object."));
if (!lst.isNull()) {
for (Py_ssize_t i = 0, i_max = PySequence_Fast_GET_SIZE(lst.object()); i < i_max; ++i) {
- PyObject* item = PySequence_Fast_GET_ITEM(lst.object(), i);
+ PyObject *item = PySequence_Fast_GET_ITEM(lst.object(), i);
if (Object::checkType(item))
- result.push_back(reinterpret_cast<SbkObject*>(item));
+ result.push_back(reinterpret_cast<SbkObject *>(item));
}
}
} else {
- result.push_back(reinterpret_cast<SbkObject*>(pyObj));
+ result.push_back(reinterpret_cast<SbkObject *>(pyObj));
}
return result;
}
@@ -744,17 +743,17 @@ inline void decRefPyObjectList(Iterator i1, Iterator i2)
namespace ObjectType
{
-bool checkType(PyTypeObject* type)
+bool checkType(PyTypeObject *type)
{
- return PyType_IsSubtype(type, reinterpret_cast<PyTypeObject*>(SbkObject_TypeF())) != 0;
+ return PyType_IsSubtype(type, reinterpret_cast<PyTypeObject *>(SbkObject_TypeF())) != 0;
}
-bool isUserType(PyTypeObject* type)
+bool isUserType(PyTypeObject *type)
{
return checkType(type) && PepType_SOTP(type)->is_user_type;
}
-bool canCallConstructor(PyTypeObject* myType, PyTypeObject* ctorType)
+bool canCallConstructor(PyTypeObject *myType, PyTypeObject *ctorType)
{
FindBaseTypeVisitor visitor(ctorType);
if (!walkThroughClassHierarchy(myType, &visitor)) {
@@ -764,23 +763,23 @@ bool canCallConstructor(PyTypeObject* myType, PyTypeObject* ctorType)
return true;
}
-bool hasCast(SbkObjectType* type)
+bool hasCast(SbkObjectType *type)
{
- return PepType_SOTP(type)->mi_specialcast != 0;
+ return PepType_SOTP(type)->mi_specialcast != nullptr;
}
-void* cast(SbkObjectType* sourceType, SbkObject* obj, PyTypeObject* targetType)
+void *cast(SbkObjectType *sourceType, SbkObject *obj, PyTypeObject *targetType)
{
return PepType_SOTP(sourceType)->mi_specialcast(Object::cppPointer(obj, targetType),
- reinterpret_cast<SbkObjectType*>(targetType));
+ reinterpret_cast<SbkObjectType *>(targetType));
}
-void setCastFunction(SbkObjectType* type, SpecialCastFunction func)
+void setCastFunction(SbkObjectType *type, SpecialCastFunction func)
{
PepType_SOTP(type)->mi_specialcast = func;
}
-void setOriginalName(SbkObjectType* type, const char* name)
+void setOriginalName(SbkObjectType *type, const char *name)
{
SbkObjectTypePrivate *sotp = PepType_SOTP(type);
if (sotp->original_name)
@@ -788,12 +787,12 @@ void setOriginalName(SbkObjectType* type, const char* name)
sotp->original_name = strdup(name);
}
-const char* getOriginalName(SbkObjectType* type)
+const char *getOriginalName(SbkObjectType *type)
{
return PepType_SOTP(type)->original_name;
}
-void setTypeDiscoveryFunctionV2(SbkObjectType* type, TypeDiscoveryFuncV2 func)
+void setTypeDiscoveryFunctionV2(SbkObjectType *type, TypeDiscoveryFuncV2 func)
{
PepType_SOTP(type)->type_discovery = func;
}
@@ -805,7 +804,7 @@ void copyMultipleInheritance(SbkObjectType *type, SbkObjectType *other)
PepType_SOTP(type)->mi_specialcast = PepType_SOTP(other)->mi_specialcast;
}
-void setMultipleInheritanceFunction(SbkObjectType* type, MultipleInheritanceInitFunction function)
+void setMultipleInheritanceFunction(SbkObjectType *type, MultipleInheritanceInitFunction function)
{
PepType_SOTP(type)->mi_init = function;
}
@@ -815,12 +814,12 @@ MultipleInheritanceInitFunction getMultipleInheritanceFunction(SbkObjectType *ty
return PepType_SOTP(type)->mi_init;
}
-void setDestructorFunction(SbkObjectType* type, ObjectDestructor func)
+void setDestructorFunction(SbkObjectType *type, ObjectDestructor func)
{
PepType_SOTP(type)->cpp_dtor = func;
}
-void initPrivateData(SbkObjectType* type)
+void initPrivateData(SbkObjectType *type)
{
PepType_SOTP(type) = new SbkObjectTypePrivate;
memset(PepType_SOTP(type), 0, sizeof(SbkObjectTypePrivate));
@@ -842,7 +841,7 @@ introduceWrapperType(PyObject *enclosingObject,
PyObject *heaptype = PyType_FromSpecWithBases(typeSpec, baseTypes);
Py_TYPE(heaptype) = SbkObjectType_TypeF();
Py_INCREF(Py_TYPE(heaptype));
- SbkObjectType *type = reinterpret_cast<SbkObjectType *>(heaptype);
+ auto *type = reinterpret_cast<SbkObjectType *>(heaptype);
if (baseType) {
if (baseTypes) {
for (int i = 0; i < PySequence_Fast_GET_SIZE(baseTypes); ++i)
@@ -862,7 +861,7 @@ introduceWrapperType(PyObject *enclosingObject,
setOriginalName(type, originalName);
setDestructorFunction(type, cppObjDtor);
- PyObject *ob_type = reinterpret_cast<PyObject *>(type);
+ auto *ob_type = reinterpret_cast<PyObject *>(type);
if (wrapperFlags & InnerClass)
return PyDict_SetItemString(enclosingObject, typeName, ob_type) == 0 ? type : nullptr;
@@ -872,17 +871,17 @@ introduceWrapperType(PyObject *enclosingObject,
return PyModule_AddObject(enclosingObject, typeName, ob_type) == 0 ? type : nullptr;
}
-void setSubTypeInitHook(SbkObjectType* type, SubTypeInitHook func)
+void setSubTypeInitHook(SbkObjectType *type, SubTypeInitHook func)
{
PepType_SOTP(type)->subtype_init = func;
}
-void* getTypeUserData(SbkObjectType* type)
+void *getTypeUserData(SbkObjectType *type)
{
return PepType_SOTP(type)->user_data;
}
-void setTypeUserData(SbkObjectType* type, void* userData, DeleteUserDataFunc d_func)
+void setTypeUserData(SbkObjectType *type, void *userData, DeleteUserDataFunc d_func)
{
SbkObjectTypePrivate *sotp = PepType_SOTP(type);
sotp->user_data = userData;
@@ -895,7 +894,7 @@ SbkObjectType *typeForTypeName(const char *typeName)
SbkObjectType *result{};
if (typeName) {
if (PyTypeObject *pyType = Shiboken::Conversions::getPythonTypeObject(typeName))
- result = reinterpret_cast<SbkObjectType*>(pyType);
+ result = reinterpret_cast<SbkObjectType *>(pyType);
}
return result;
}
@@ -912,25 +911,25 @@ bool hasSpecialCastFunction(SbkObjectType *sbkType)
namespace Object
{
-static void recursive_invalidate(SbkObject* self, std::set<SbkObject*>& seen);
+static void recursive_invalidate(SbkObject *self, std::set<SbkObject *>& seen);
-bool checkType(PyObject* pyObj)
+bool checkType(PyObject *pyObj)
{
return ObjectType::checkType(Py_TYPE(pyObj));
}
-bool isUserType(PyObject* pyObj)
+bool isUserType(PyObject *pyObj)
{
return ObjectType::isUserType(Py_TYPE(pyObj));
}
-Py_hash_t hash(PyObject* pyObj)
+Py_hash_t hash(PyObject *pyObj)
{
assert(Shiboken::Object::checkType(pyObj));
return reinterpret_cast<Py_hash_t>(pyObj);
}
-static void setSequenceOwnership(PyObject* pyObj, bool owner)
+static void setSequenceOwnership(PyObject *pyObj, bool owner)
{
bool has_length = true;
@@ -957,36 +956,36 @@ static void setSequenceOwnership(PyObject* pyObj, bool owner)
}
} else if (Object::checkType(pyObj)) {
if (owner)
- getOwnership(reinterpret_cast<SbkObject*>(pyObj));
+ getOwnership(reinterpret_cast<SbkObject *>(pyObj));
else
- releaseOwnership(reinterpret_cast<SbkObject*>(pyObj));
+ releaseOwnership(reinterpret_cast<SbkObject *>(pyObj));
}
}
-void setValidCpp(SbkObject* pyObj, bool value)
+void setValidCpp(SbkObject *pyObj, bool value)
{
pyObj->d->validCppObject = value;
}
-void setHasCppWrapper(SbkObject* pyObj, bool value)
+void setHasCppWrapper(SbkObject *pyObj, bool value)
{
pyObj->d->containsCppWrapper = value;
}
-bool hasCppWrapper(SbkObject* pyObj)
+bool hasCppWrapper(SbkObject *pyObj)
{
return pyObj->d->containsCppWrapper;
}
-bool wasCreatedByPython(SbkObject* pyObj)
+bool wasCreatedByPython(SbkObject *pyObj)
{
return pyObj->d->cppObjectCreated;
}
-void callCppDestructors(SbkObject* pyObj)
+void callCppDestructors(SbkObject *pyObj)
{
PyTypeObject *type = Py_TYPE(pyObj);
- SbkObjectTypePrivate * sotp = PepType_SOTP(type);
+ SbkObjectTypePrivate *sotp = PepType_SOTP(type);
if (sotp->is_multicpp) {
Shiboken::DtorAccumulatorVisitor visitor(pyObj);
Shiboken::walkThroughClassHierarchy(type, &visitor);
@@ -1007,16 +1006,16 @@ void callCppDestructors(SbkObject* pyObj)
}
delete[] pyObj->d->cptr;
- pyObj->d->cptr = 0;
+ pyObj->d->cptr = nullptr;
pyObj->d->validCppObject = false;
}
-bool hasOwnership(SbkObject* pyObj)
+bool hasOwnership(SbkObject *pyObj)
{
return pyObj->d->hasOwnership;
}
-void getOwnership(SbkObject* self)
+void getOwnership(SbkObject *self)
{
// skip if already have the ownership
if (self->d->hasOwnership)
@@ -1035,16 +1034,16 @@ void getOwnership(SbkObject* self)
makeValid(self); // Make the object valid again
}
-void getOwnership(PyObject* pyObj)
+void getOwnership(PyObject *pyObj)
{
if (pyObj)
setSequenceOwnership(pyObj, true);
}
-void releaseOwnership(SbkObject* self)
+void releaseOwnership(SbkObject *self)
{
// skip if the ownership have already moved to c++
- SbkObjectType* selfType = reinterpret_cast<SbkObjectType*>(Py_TYPE(self));
+ auto *selfType = reinterpret_cast<SbkObjectType *>(Py_TYPE(self));
if (!self->d->hasOwnership || Shiboken::Conversions::pythonTypeIsValueType(PepType_SOTP(selfType)->converter))
return;
@@ -1058,35 +1057,35 @@ void releaseOwnership(SbkObject* self)
invalidate(self); // If I do not know when this object will die We need to invalidate this to avoid use after
}
-void releaseOwnership(PyObject* self)
+void releaseOwnership(PyObject *self)
{
setSequenceOwnership(self, false);
}
/* Needed forward declarations */
-static void recursive_invalidate(PyObject* pyobj, std::set<SbkObject*>& seen);
-static void recursive_invalidate(SbkObject* self, std::set<SbkObject*>& seen);
+static void recursive_invalidate(PyObject *pyobj, std::set<SbkObject *>& seen);
+static void recursive_invalidate(SbkObject *self, std::set<SbkObject *> &seen);
-void invalidate(PyObject* pyobj)
+void invalidate(PyObject *pyobj)
{
- std::set<SbkObject*> seen;
+ std::set<SbkObject *> seen;
recursive_invalidate(pyobj, seen);
}
-void invalidate(SbkObject* self)
+void invalidate(SbkObject *self)
{
- std::set<SbkObject*> seen;
+ std::set<SbkObject *> seen;
recursive_invalidate(self, seen);
}
-static void recursive_invalidate(PyObject* pyobj, std::set<SbkObject*>& seen)
+static void recursive_invalidate(PyObject *pyobj, std::set<SbkObject *> &seen)
{
const auto objs = splitPyObject(pyobj);
for (SbkObject *o : objs)
recursive_invalidate(o, seen);
}
-static void recursive_invalidate(SbkObject* self, std::set<SbkObject*>& seen)
+static void recursive_invalidate(SbkObject *self, std::set<SbkObject *> &seen)
{
// Skip if this object not is a valid object or if it's already been seen
if (!self || reinterpret_cast<PyObject *>(self) == Py_None || seen.find(self) != seen.end())
@@ -1115,13 +1114,13 @@ static void recursive_invalidate(SbkObject* self, std::set<SbkObject*>& seen)
// If has ref to other objects invalidate all
if (self->d->referredObjects) {
- RefCountMap& refCountMap = *(self->d->referredObjects);
+ RefCountMap &refCountMap = *(self->d->referredObjects);
for (auto it = refCountMap.begin(), end = refCountMap.end(); it != end; ++it)
recursive_invalidate(it->second, seen);
}
}
-void makeValid(SbkObject* self)
+void makeValid(SbkObject *self)
{
// Skip if this object not is a valid object
if (!self || reinterpret_cast<PyObject *>(self) == Py_None || self->d->validCppObject)
@@ -1138,7 +1137,7 @@ void makeValid(SbkObject* self)
// If has ref to other objects make all valid again
if (self->d->referredObjects) {
- RefCountMap& refCountMap = *(self->d->referredObjects);
+ RefCountMap &refCountMap = *(self->d->referredObjects);
RefCountMap::iterator iter;
for (auto it = refCountMap.begin(), end = refCountMap.end(); it != end; ++it) {
if (Shiboken::Object::checkType(it->second))
@@ -1147,35 +1146,35 @@ void makeValid(SbkObject* self)
}
}
-void* cppPointer(SbkObject* pyObj, PyTypeObject* desiredType)
+void *cppPointer(SbkObject *pyObj, PyTypeObject *desiredType)
{
- PyTypeObject* type = Py_TYPE(pyObj);
+ PyTypeObject *type = Py_TYPE(pyObj);
int idx = 0;
- if (PepType_SOTP(reinterpret_cast<SbkObjectType*>(type))->is_multicpp)
+ if (PepType_SOTP(reinterpret_cast<SbkObjectType *>(type))->is_multicpp)
idx = getTypeIndexOnHierarchy(type, desiredType);
if (pyObj->d->cptr)
return pyObj->d->cptr[idx];
- return 0;
+ return nullptr;
}
-std::vector<void*> cppPointers(SbkObject* pyObj)
+std::vector<void *> cppPointers(SbkObject *pyObj)
{
int n = getNumberOfCppBaseClasses(Py_TYPE(pyObj));
- std::vector<void*> ptrs(n);
+ std::vector<void *> ptrs(n);
for (int i = 0; i < n; ++i)
ptrs[i] = pyObj->d->cptr[i];
return ptrs;
}
-bool setCppPointer(SbkObject* sbkObj, PyTypeObject* desiredType, void* cptr)
+bool setCppPointer(SbkObject *sbkObj, PyTypeObject *desiredType, void *cptr)
{
int idx = 0;
PyTypeObject *type = Py_TYPE(sbkObj);
if (PepType_SOTP(type)->is_multicpp)
idx = getTypeIndexOnHierarchy(type, desiredType);
- const bool alreadyInitialized = sbkObj->d->cptr[idx] != 0;
+ const bool alreadyInitialized = sbkObj->d->cptr[idx] != nullptr;
if (alreadyInitialized)
PyErr_SetString(PyExc_RuntimeError, "You can't initialize an object twice!");
else
@@ -1185,14 +1184,14 @@ bool setCppPointer(SbkObject* sbkObj, PyTypeObject* desiredType, void* cptr)
return !alreadyInitialized;
}
-bool isValid(PyObject* pyObj)
+bool isValid(PyObject *pyObj)
{
if (!pyObj || pyObj == Py_None
|| Py_TYPE(Py_TYPE(pyObj)) != SbkObjectType_TypeF()) {
return true;
}
- SbkObjectPrivate* priv = reinterpret_cast<SbkObject*>(pyObj)->d;
+ auto priv = reinterpret_cast<SbkObject *>(pyObj)->d;
if (!priv->cppObjectCreated && isUserType(pyObj)) {
PyErr_Format(PyExc_RuntimeError, "'__init__' method of object's base class (%s) not called.",
@@ -1209,13 +1208,13 @@ bool isValid(PyObject* pyObj)
return true;
}
-bool isValid(SbkObject* pyObj, bool throwPyError)
+bool isValid(SbkObject *pyObj, bool throwPyError)
{
if (!pyObj)
return false;
- SbkObjectPrivate* priv = pyObj->d;
- if (!priv->cppObjectCreated && isUserType(reinterpret_cast<PyObject*>(pyObj))) {
+ SbkObjectPrivate *priv = pyObj->d;
+ if (!priv->cppObjectCreated && isUserType(reinterpret_cast<PyObject *>(pyObj))) {
if (throwPyError)
PyErr_Format(PyExc_RuntimeError, "Base constructor of the object (%s) not called.",
Py_TYPE(pyObj)->tp_name);
@@ -1232,13 +1231,13 @@ bool isValid(SbkObject* pyObj, bool throwPyError)
return true;
}
-bool isValid(PyObject* pyObj, bool throwPyError)
+bool isValid(PyObject *pyObj, bool throwPyError)
{
if (!pyObj || pyObj == Py_None ||
- !PyType_IsSubtype(Py_TYPE(pyObj), reinterpret_cast<PyTypeObject*>(SbkObject_TypeF()))) {
+ !PyType_IsSubtype(Py_TYPE(pyObj), reinterpret_cast<PyTypeObject *>(SbkObject_TypeF()))) {
return true;
}
- return isValid(reinterpret_cast<SbkObject*>(pyObj), throwPyError);
+ return isValid(reinterpret_cast<SbkObject *>(pyObj), throwPyError);
}
SbkObject *findColocatedChild(SbkObject *wrapper,
@@ -1249,32 +1248,30 @@ SbkObject *findColocatedChild(SbkObject *wrapper,
return wrapper;
if (!(wrapper->d && wrapper->d->cptr))
- return 0;
+ return nullptr;
- ParentInfo* pInfo = wrapper->d->parentInfo;
+ ParentInfo *pInfo = wrapper->d->parentInfo;
if (!pInfo)
- return 0;
+ return nullptr;
- ChildrenList& children = pInfo->children;
+ ChildrenList &children = pInfo->children;
for (SbkObject *child : children) {
if (!(child->d && child->d->cptr))
continue;
if (child->d->cptr[0] == wrapper->d->cptr[0]) {
- if (reinterpret_cast<const void *>(Py_TYPE(child)) == reinterpret_cast<const void *>(instanceType))
- return child;
- else
- return findColocatedChild(child, instanceType);
+ return reinterpret_cast<const void *>(Py_TYPE(child)) == reinterpret_cast<const void *>(instanceType)
+ ? child : findColocatedChild(child, instanceType);
}
}
- return 0;
+ return nullptr;
}
-PyObject *newObject(SbkObjectType* instanceType,
- void* cptr,
+PyObject *newObject(SbkObjectType *instanceType,
+ void *cptr,
bool hasOwnership,
bool isExactType,
- const char* typeName)
+ const char *typeName)
{
// Try to find the exact type of cptr.
if (!isExactType) {
@@ -1286,11 +1283,11 @@ PyObject *newObject(SbkObjectType* instanceType,
bool shouldCreate = true;
bool shouldRegister = true;
- SbkObject* self = 0;
+ SbkObject *self = nullptr;
// Some logic to ensure that colocated child field does not overwrite the parent
if (BindingManager::instance().hasWrapper(cptr)) {
- SbkObject* existingWrapper = BindingManager::instance().retrieveWrapper(cptr);
+ SbkObject *existingWrapper = BindingManager::instance().retrieveWrapper(cptr);
self = findColocatedChild(existingWrapper, instanceType);
if (self) {
@@ -1313,7 +1310,7 @@ PyObject *newObject(SbkObjectType* instanceType,
}
if (shouldCreate) {
- self = reinterpret_cast<SbkObject*>(SbkObjectTpNew(reinterpret_cast<PyTypeObject*>(instanceType), 0, 0));
+ self = reinterpret_cast<SbkObject *>(SbkObjectTpNew(reinterpret_cast<PyTypeObject *>(instanceType), nullptr, nullptr));
self->d->cptr[0] = cptr;
self->d->hasOwnership = hasOwnership;
self->d->validCppObject = 1;
@@ -1321,17 +1318,17 @@ PyObject *newObject(SbkObjectType* instanceType,
BindingManager::instance().registerWrapper(self, cptr);
}
} else {
- Py_IncRef(reinterpret_cast<PyObject*>(self));
+ Py_IncRef(reinterpret_cast<PyObject *>(self));
}
- return reinterpret_cast<PyObject*>(self);
+ return reinterpret_cast<PyObject *>(self);
}
-void destroy(SbkObject* self)
+void destroy(SbkObject *self)
{
- destroy(self, 0);
+ destroy(self, nullptr);
}
-void destroy(SbkObject* self, void* cppData)
+void destroy(SbkObject *self, void *cppData)
{
// Skip if this is called with NULL pointer this can happen in derived classes
if (!self)
@@ -1369,15 +1366,15 @@ void destroy(SbkObject* self, void* cppData)
// the cpp object instance was deleted
delete[] self->d->cptr;
- self->d->cptr = 0;
+ self->d->cptr = nullptr;
}
// After this point the object can be death do not use the self pointer bellow
}
-void removeParent(SbkObject* child, bool giveOwnershipBack, bool keepReference)
+void removeParent(SbkObject *child, bool giveOwnershipBack, bool keepReference)
{
- ParentInfo* pInfo = child->d->parentInfo;
+ ParentInfo *pInfo = child->d->parentInfo;
if (!pInfo || !pInfo->parent) {
if (pInfo && pInfo->hasWrapperRef) {
pInfo->hasWrapperRef = false;
@@ -1385,7 +1382,7 @@ void removeParent(SbkObject* child, bool giveOwnershipBack, bool keepReference)
return;
}
- ChildrenList& oldBrothers = pInfo->parent->d->parentInfo->children;
+ ChildrenList &oldBrothers = pInfo->parent->d->parentInfo->children;
// Verify if this child is part of parent list
auto iChild = oldBrothers.find(child);
if (iChild == oldBrothers.end())
@@ -1393,7 +1390,7 @@ void removeParent(SbkObject* child, bool giveOwnershipBack, bool keepReference)
oldBrothers.erase(iChild);
- pInfo->parent = 0;
+ pInfo->parent = nullptr;
// This will keep the wrapper reference, will wait for wrapper destruction to remove that
if (keepReference &&
@@ -1413,29 +1410,29 @@ void removeParent(SbkObject* child, bool giveOwnershipBack, bool keepReference)
Py_DECREF(child);
}
-void setParent(PyObject* parent, PyObject* child)
+void setParent(PyObject *parent, PyObject *child)
{
if (!child || child == Py_None || child == parent)
return;
/*
- * setParent is recursive when the child is a native Python sequence, i.e. objects not binded by Shiboken
- * like tuple and list.
+ * setParent is recursive when the child is a native Python sequence, i.e. objects not binded by Shiboken
+ * like tuple and list.
*
- * This "limitation" exists to fix the following problem: A class multiple inherits QObject and QString,
- * so if you pass this class to someone that takes the ownership, we CAN'T enter in this if, but hey! QString
- * follows the sequence protocol.
+ * This "limitation" exists to fix the following problem: A class multiple inherits QObject and QString,
+ * so if you pass this class to someone that takes the ownership, we CAN'T enter in this if, but hey! QString
+ * follows the sequence protocol.
*/
if (PySequence_Check(child) && !Object::checkType(child)) {
- Shiboken::AutoDecRef seq(PySequence_Fast(child, 0));
+ Shiboken::AutoDecRef seq(PySequence_Fast(child, nullptr));
for (Py_ssize_t i = 0, max = PySequence_Size(seq); i < max; ++i)
setParent(parent, PySequence_Fast_GET_ITEM(seq.object(), i));
return;
}
bool parentIsNull = !parent || parent == Py_None;
- SbkObject* parent_ = reinterpret_cast<SbkObject*>(parent);
- SbkObject* child_ = reinterpret_cast<SbkObject*>(child);
+ auto parent_ = reinterpret_cast<SbkObject *>(parent);
+ auto child_ = reinterpret_cast<SbkObject *>(child);
if (!parentIsNull) {
if (!parent_->d->parentInfo)
@@ -1446,7 +1443,7 @@ void setParent(PyObject* parent, PyObject* child)
return;
}
- ParentInfo* pInfo = child_->d->parentInfo;
+ ParentInfo *pInfo = child_->d->parentInfo;
bool hasAnotherParent = pInfo && pInfo->parent && pInfo->parent != parent_;
//Avoid destroy child during reparent operation
@@ -1476,7 +1473,7 @@ void setParent(PyObject* parent, PyObject* child)
Py_DECREF(child);
}
-void deallocData(SbkObject* self, bool cleanup)
+void deallocData(SbkObject *self, bool cleanup)
{
// Make cleanup if this is not a wrapper otherwise this will be done on wrapper destructor
if(cleanup) {
@@ -1492,18 +1489,18 @@ void deallocData(SbkObject* self, bool cleanup)
// Remove from BindingManager
Shiboken::BindingManager::instance().releaseWrapper(self);
delete[] self->d->cptr;
- self->d->cptr = 0;
+ self->d->cptr = nullptr;
// delete self->d; PYSIDE-205: wrong!
}
delete self->d; // PYSIDE-205: always delete d.
Py_XDECREF(self->ob_dict);
// PYSIDE-571: qApp is no longer allocated.
- if (PyObject_IS_GC(reinterpret_cast<PyObject*>(self)))
+ if (PyObject_IS_GC(reinterpret_cast<PyObject *>(self)))
Py_TYPE(self)->tp_free(self);
}
-void setTypeUserData(SbkObject* wrapper, void* userData, DeleteUserDataFunc d_func)
+void setTypeUserData(SbkObject *wrapper, void *userData, DeleteUserDataFunc d_func)
{
SbkObjectTypePrivate *sotp = PepType_SOTP(Py_TYPE(wrapper));
if (sotp->user_data)
@@ -1513,7 +1510,7 @@ void setTypeUserData(SbkObject* wrapper, void* userData, DeleteUserDataFunc d_fu
sotp->user_data = userData;
}
-void* getTypeUserData(SbkObject* wrapper)
+void *getTypeUserData(SbkObject *wrapper)
{
return PepType_SOTP(Py_TYPE(wrapper))->user_data;
}
@@ -1523,7 +1520,7 @@ static inline bool isNone(const PyObject *o)
return o == nullptr || o == Py_None;
}
-static void removeRefCountKey(SbkObject* self, const char *key)
+static void removeRefCountKey(SbkObject *self, const char *key)
{
if (self->d->referredObjects) {
const auto iterPair = self->d->referredObjects->equal_range(key);
@@ -1534,7 +1531,7 @@ static void removeRefCountKey(SbkObject* self, const char *key)
}
}
-void keepReference(SbkObject* self, const char* key, PyObject* referredObject, bool append)
+void keepReference(SbkObject *self, const char *key, PyObject *referredObject, bool append)
{
if (isNone(referredObject)) {
removeRefCountKey(self, key);
@@ -1548,7 +1545,7 @@ void keepReference(SbkObject* self, const char* key, PyObject* referredObject, b
return;
}
- RefCountMap& refCountMap = *(self->d->referredObjects);
+ RefCountMap &refCountMap = *(self->d->referredObjects);
const auto iterPair = refCountMap.equal_range(key);
if (std::any_of(iterPair.first, iterPair.second,
[referredObject](const RefCountMap::value_type &v) { return v.second == referredObject; })) {
@@ -1564,24 +1561,24 @@ void keepReference(SbkObject* self, const char* key, PyObject* referredObject, b
Py_INCREF(referredObject);
}
-void removeReference(SbkObject* self, const char* key, PyObject* referredObject)
+void removeReference(SbkObject *self, const char *key, PyObject *referredObject)
{
if (!isNone(referredObject))
removeRefCountKey(self, key);
}
-void clearReferences(SbkObject* self)
+void clearReferences(SbkObject *self)
{
if (!self->d->referredObjects)
return;
- RefCountMap& refCountMap = *(self->d->referredObjects);
+ RefCountMap &refCountMap = *(self->d->referredObjects);
for (auto it = refCountMap.begin(), end = refCountMap.end(); it != end; ++it)
Py_DECREF(it->second);
self->d->referredObjects->clear();
}
-std::string info(SbkObject* self)
+std::string info(SbkObject *self)
{
std::ostringstream s;
@@ -1590,7 +1587,7 @@ std::string info(SbkObject* self)
if (ObjectType::isUserType(Py_TYPE(self)))
bases = getCppBaseClasses(Py_TYPE(self));
else
- bases.push_back(reinterpret_cast<SbkObjectType*>(Py_TYPE(self)));
+ bases.push_back(reinterpret_cast<SbkObjectType *>(Py_TYPE(self)));
s << "C++ address....... ";
for (size_t i = 0, size = bases.size(); i < size; ++i) {
@@ -1625,7 +1622,7 @@ std::string info(SbkObject* self)
}
if (self->d->referredObjects && !self->d->referredObjects->empty()) {
- Shiboken::RefCountMap& map = *self->d->referredObjects;
+ Shiboken::RefCountMap &map = *self->d->referredObjects;
s << "referred objects.. ";
std::string lastKey;
for (auto it = map.begin(), end = map.end(); it != end; ++it) {
diff --git a/sources/shiboken2/libshiboken/basewrapper.h b/sources/shiboken2/libshiboken/basewrapper.h
index 55445b026..7faf223bd 100644
--- a/sources/shiboken2/libshiboken/basewrapper.h
+++ b/sources/shiboken2/libshiboken/basewrapper.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt for Python.
@@ -57,41 +57,41 @@ struct LIBSHIBOKEN_API SbkObject
{
PyObject_HEAD
/// Instance dictionary.
- PyObject* ob_dict;
+ PyObject *ob_dict;
/// List of weak references
- PyObject* weakreflist;
- SbkObjectPrivate* d;
+ PyObject *weakreflist;
+ SbkObjectPrivate *d;
};
/// Dealloc the python object \p pyObj and the C++ object represented by it.
-LIBSHIBOKEN_API void SbkDeallocWrapper(PyObject* pyObj);
-LIBSHIBOKEN_API void SbkDeallocQAppWrapper(PyObject* pyObj);
-LIBSHIBOKEN_API void SbkDeallocWrapperWithPrivateDtor(PyObject* self);
+LIBSHIBOKEN_API void SbkDeallocWrapper(PyObject *pyObj);
+LIBSHIBOKEN_API void SbkDeallocQAppWrapper(PyObject *pyObj);
+LIBSHIBOKEN_API void SbkDeallocWrapperWithPrivateDtor(PyObject *self);
struct SbkObjectType;
/// Function signature for the multiple inheritance information initializers that should be provided by classes with multiple inheritance.
-typedef int* (*MultipleInheritanceInitFunction)(const void*);
+typedef int *(*MultipleInheritanceInitFunction)(const void *);
/**
* Special cast function is used to correctly cast an object when it's
* part of a multiple inheritance hierarchy.
* The implementation of this function is auto generated by the generator and you don't need to care about it.
*/
-typedef void* (*SpecialCastFunction)(void*, SbkObjectType*);
-typedef SbkObjectType* (*TypeDiscoveryFunc)(void*, SbkObjectType*);
-typedef void* (*TypeDiscoveryFuncV2)(void*, SbkObjectType*);
+typedef void *(*SpecialCastFunction)(void *, SbkObjectType *);
+typedef SbkObjectType *(*TypeDiscoveryFunc)(void *, SbkObjectType *);
+typedef void *(*TypeDiscoveryFuncV2)(void *, SbkObjectType *);
-typedef void* (*ExtendedToCppFunc)(PyObject*); // DEPRECATED.
-typedef bool (*ExtendedIsConvertibleFunc)(PyObject*); // DEPRECATED.
+typedef void *(*ExtendedToCppFunc)(PyObject *); // DEPRECATED.
+typedef bool (*ExtendedIsConvertibleFunc)(PyObject *); // DEPRECATED.
// Used in userdata dealloc function
-typedef void (*DeleteUserDataFunc)(void*);
+typedef void (*DeleteUserDataFunc)(void *);
-typedef void (*ObjectDestructor)(void*);
+typedef void (*ObjectDestructor)(void *);
-typedef void (*SubTypeInitHook)(SbkObjectType*, PyObject*, PyObject*);
+typedef void (*SubTypeInitHook)(SbkObjectType *, PyObject *, PyObject *);
extern LIBSHIBOKEN_API PyTypeObject *SbkObjectType_TypeF(void);
extern LIBSHIBOKEN_API SbkObjectType *SbkObject_TypeF(void);
@@ -104,9 +104,9 @@ struct LIBSHIBOKEN_API SbkObjectType
PyTypeObject type;
};
-LIBSHIBOKEN_API PyObject* SbkObjectTpNew(PyTypeObject* subtype, PyObject*, PyObject*);
+LIBSHIBOKEN_API PyObject *SbkObjectTpNew(PyTypeObject *subtype, PyObject *, PyObject *);
// the special case of a switchable singleton
-LIBSHIBOKEN_API PyObject* SbkQAppTpNew(PyTypeObject *subtype, PyObject *args, PyObject *kwds);
+LIBSHIBOKEN_API PyObject *SbkQAppTpNew(PyTypeObject *subtype, PyObject *args, PyObject *kwds);
/**
* PYSIDE-832: Use object_dealloc instead of nullptr.
@@ -132,36 +132,36 @@ LIBSHIBOKEN_API void init();
/// Delete the class T allocated on \p cptr.
template<typename T>
-void callCppDestructor(void* cptr)
+void callCppDestructor(void *cptr)
{
- delete reinterpret_cast<T*>(cptr);
+ delete reinterpret_cast<T *>(cptr);
}
/**
* Shiboken::importModule is DEPRECATED. Use Shiboken::Module::import() instead.
*/
-SBK_DEPRECATED(LIBSHIBOKEN_API bool importModule(const char* moduleName, PyTypeObject*** cppApiPtr));
+SBK_DEPRECATED(LIBSHIBOKEN_API bool importModule(const char *moduleName, PyTypeObject *** cppApiPtr));
// setErrorAboutWrongArguments now gets overload info from the signature module.
-LIBSHIBOKEN_API void setErrorAboutWrongArguments(PyObject* args, const char* funcName);
+LIBSHIBOKEN_API void setErrorAboutWrongArguments(PyObject *args, const char *funcName);
namespace ObjectType {
/**
* Returns true if the object is an instance of a type created by the Shiboken generator.
*/
-LIBSHIBOKEN_API bool checkType(PyTypeObject* pyObj);
+LIBSHIBOKEN_API bool checkType(PyTypeObject *pyObj);
/**
* Returns true if this object is an instance of an user defined type derived from an Shiboken type.
*/
-LIBSHIBOKEN_API bool isUserType(PyTypeObject* pyObj);
+LIBSHIBOKEN_API bool isUserType(PyTypeObject *pyObj);
/**
* Returns true if the constructor of \p ctorType can be called for a instance of type \p myType.
* \note This function set a python error when returning false.
*/
-LIBSHIBOKEN_API bool canCallConstructor(PyTypeObject* myType, PyTypeObject* ctorType);
+LIBSHIBOKEN_API bool canCallConstructor(PyTypeObject *myType, PyTypeObject *ctorType);
/**
* Tells if the \p type represents an object of a class with multiple inheritance in C++.
@@ -170,27 +170,27 @@ LIBSHIBOKEN_API bool canCallConstructor(PyTypeObject* myType, PyTypeObjec
* \returns true if a call to ObjectType::cast() is needed to obtain the correct
* C++ pointer for Python objects of type \p type.
*/
-LIBSHIBOKEN_API bool hasCast(SbkObjectType* type);
+LIBSHIBOKEN_API bool hasCast(SbkObjectType *type);
/**
* Cast the C++ pointer held by a Python object \p obj of type \p sourceType,
* to a C++ pointer of a C++ class indicated by type \p targetType.
* \returns The cast C++ pointer.
*/
-LIBSHIBOKEN_API void* cast(SbkObjectType* sourceType, SbkObject* obj, PyTypeObject* targetType);
+LIBSHIBOKEN_API void *cast(SbkObjectType *sourceType, SbkObject *obj, PyTypeObject *targetType);
/// Set the C++ cast function for \p type.
-LIBSHIBOKEN_API void setCastFunction(SbkObjectType* type, SpecialCastFunction func);
+LIBSHIBOKEN_API void setCastFunction(SbkObjectType *type, SpecialCastFunction func);
-LIBSHIBOKEN_API void setOriginalName(SbkObjectType* self, const char* name);
-LIBSHIBOKEN_API const char* getOriginalName(SbkObjectType* self);
+LIBSHIBOKEN_API void setOriginalName(SbkObjectType *self, const char *name);
+LIBSHIBOKEN_API const char *getOriginalName(SbkObjectType *self);
-LIBSHIBOKEN_API void setTypeDiscoveryFunctionV2(SbkObjectType* self, TypeDiscoveryFuncV2 func);
-LIBSHIBOKEN_API void copyMultipleInheritance(SbkObjectType *self, SbkObjectType *other);
-LIBSHIBOKEN_API void setMultipleInheritanceFunction(SbkObjectType* self, MultipleInheritanceInitFunction func);
+LIBSHIBOKEN_API void setTypeDiscoveryFunctionV2(SbkObjectType *self, TypeDiscoveryFuncV2 func);
+LIBSHIBOKEN_API void copyMultipleInheritance(SbkObjectType *self, SbkObjectType *other);
+LIBSHIBOKEN_API void setMultipleInheritanceFunction(SbkObjectType *self, MultipleInheritanceInitFunction func);
LIBSHIBOKEN_API MultipleInheritanceInitFunction getMultipleInheritanceFunction(SbkObjectType *self);
-LIBSHIBOKEN_API void setDestructorFunction(SbkObjectType* self, ObjectDestructor func);
+LIBSHIBOKEN_API void setDestructorFunction(SbkObjectType *self, ObjectDestructor func);
-LIBSHIBOKEN_API void initPrivateData(SbkObjectType* self);
+LIBSHIBOKEN_API void initPrivateData(SbkObjectType *self);
enum WrapperFlags
{
@@ -232,13 +232,13 @@ LIBSHIBOKEN_API SbkObjectType *introduceWrapperType(PyObject *enclosingObject,
* The hook gets 3 params, they are: The new type being created, args and kwds. The last two are the very
* same got from tp_new.
*/
-LIBSHIBOKEN_API void setSubTypeInitHook(SbkObjectType* self, SubTypeInitHook func);
+LIBSHIBOKEN_API void setSubTypeInitHook(SbkObjectType *self, SubTypeInitHook func);
/**
* Get the user data previously set by Shiboken::Object::setTypeUserData
*/
-LIBSHIBOKEN_API void* getTypeUserData(SbkObjectType* self);
-LIBSHIBOKEN_API void setTypeUserData(SbkObjectType* self, void* userData, DeleteUserDataFunc d_func);
+LIBSHIBOKEN_API void *getTypeUserData(SbkObjectType *self);
+LIBSHIBOKEN_API void setTypeUserData(SbkObjectType *self, void *userData, DeleteUserDataFunc d_func);
/**
* Return an instance of SbkObjectType for a C++ type name as determined by
@@ -261,23 +261,23 @@ namespace Object {
/**
* Returns a string with information about the internal state of the instance object, useful for debug purposes.
*/
-LIBSHIBOKEN_API std::string info(SbkObject* self);
+LIBSHIBOKEN_API std::string info(SbkObject *self);
/**
* Returns true if the object is an instance of a type created by the Shiboken generator.
*/
-LIBSHIBOKEN_API bool checkType(PyObject* pyObj);
+LIBSHIBOKEN_API bool checkType(PyObject *pyObj);
/**
* Returns true if this object type is an instance of an user defined type derived from an Shiboken type.
* \see Shiboken::ObjectType::isUserType
*/
-LIBSHIBOKEN_API bool isUserType(PyObject* pyObj);
+LIBSHIBOKEN_API bool isUserType(PyObject *pyObj);
/**
* Generic function used to make ObjectType hashable, the C++ pointer is used as hash value.
*/
-LIBSHIBOKEN_API Py_hash_t hash(PyObject* pyObj);
+LIBSHIBOKEN_API Py_hash_t hash(PyObject *pyObj);
/**
* Find a child of given wrapper having same address having the specified type.
@@ -294,101 +294,101 @@ LIBSHIBOKEN_API SbkObject *findColocatedChild(SbkObject *wrapper,
* and as fallback.
* \param typeName If non-null, this will be used as helper to find the correct Python type for this object.
*/
-LIBSHIBOKEN_API PyObject* newObject(SbkObjectType* instanceType,
- void* cptr,
- bool hasOwnership = true,
- bool isExactType = false,
- const char* typeName = 0);
+LIBSHIBOKEN_API PyObject *newObject(SbkObjectType *instanceType,
+ void *cptr,
+ bool hasOwnership = true,
+ bool isExactType = false,
+ const char *typeName = nullptr);
/**
* Changes the valid flag of a PyObject, invalid objects will raise an exception when someone tries to access it.
*/
-LIBSHIBOKEN_API void setValidCpp(SbkObject* pyObj, bool value);
+LIBSHIBOKEN_API void setValidCpp(SbkObject *pyObj, bool value);
/**
* Tells shiboken the Python object \p pyObj has a C++ wrapper used to intercept virtual method calls.
*/
-LIBSHIBOKEN_API void setHasCppWrapper(SbkObject* pyObj, bool value);
+LIBSHIBOKEN_API void setHasCppWrapper(SbkObject *pyObj, bool value);
/**
* Return true if the Python object \p pyObj has a C++ wrapper used to intercept virtual method calls.
*/
-LIBSHIBOKEN_API bool hasCppWrapper(SbkObject* pyObj);
+LIBSHIBOKEN_API bool hasCppWrapper(SbkObject *pyObj);
/**
* Return true if the Python object was created by Python, false otherwise.
* \note This function was added to libshiboken only to be used by shiboken.wasCreatedByPython()
*/
-LIBSHIBOKEN_API bool wasCreatedByPython(SbkObject* pyObj);
+LIBSHIBOKEN_API bool wasCreatedByPython(SbkObject *pyObj);
/**
* Call the C++ object destructor and invalidates the Python object.
* \note This function was added to libshiboken only to be used by shiboken.delete()
*/
-LIBSHIBOKEN_API void callCppDestructors(SbkObject* pyObj);
+LIBSHIBOKEN_API void callCppDestructors(SbkObject *pyObj);
/**
* Return true if the Python is responsible for deleting the underlying C++ object.
*/
-LIBSHIBOKEN_API bool hasOwnership(SbkObject* pyObj);
+LIBSHIBOKEN_API bool hasOwnership(SbkObject *pyObj);
/**
* Sets python as responsible to delete the underlying C++ object.
* \note You this overload only when the PyObject can be a sequence and you want to
* call this function for every item in the sequence.
- * \see getOwnership(SbkObject*)
+ * \see getOwnership(SbkObject *)
*/
-LIBSHIBOKEN_API void getOwnership(PyObject* pyObj);
+LIBSHIBOKEN_API void getOwnership(PyObject *pyObj);
/**
* Sets python as responsible to delete the underlying C++ object.
*/
-LIBSHIBOKEN_API void getOwnership(SbkObject* pyObj);
+LIBSHIBOKEN_API void getOwnership(SbkObject *pyObj);
/**
* Release the ownership, so Python will not delete the underlying C++ object.
* \note You this overload only when the PyObject can be a sequence and you want to
* call this function for every item in the sequence.
- * \see releaseOwnership(SbkObject*)
+ * \see releaseOwnership(SbkObject *)
*/
-LIBSHIBOKEN_API void releaseOwnership(PyObject* pyObj);
+LIBSHIBOKEN_API void releaseOwnership(PyObject *pyObj);
/**
* Release the ownership, so Python will not delete the underlying C++ object.
*/
-LIBSHIBOKEN_API void releaseOwnership(SbkObject* pyObj);
+LIBSHIBOKEN_API void releaseOwnership(SbkObject *pyObj);
/**
* Get the C++ pointer of type \p desiredType from a Python object.
*/
-LIBSHIBOKEN_API void* cppPointer(SbkObject* pyObj, PyTypeObject* desiredType);
+LIBSHIBOKEN_API void *cppPointer(SbkObject *pyObj, PyTypeObject *desiredType);
/**
* Return a list with all C++ pointers held from a Python object.
* \note This function was added to libshiboken only to be used by shiboken.getCppPointer()
*/
-LIBSHIBOKEN_API std::vector<void*> cppPointers(SbkObject* pyObj);
+LIBSHIBOKEN_API std::vector<void *>cppPointers(SbkObject *pyObj);
/**
* Set the C++ pointer of type \p desiredType of a Python object.
*/
-LIBSHIBOKEN_API bool setCppPointer(SbkObject* sbkObj, PyTypeObject* desiredType, void* cptr);
+LIBSHIBOKEN_API bool setCppPointer(SbkObject *sbkObj, PyTypeObject *desiredType, void *cptr);
/**
* Returns false and sets a Python RuntimeError if the Python wrapper is not marked as valid.
*/
-LIBSHIBOKEN_API bool isValid(PyObject* pyObj);
+LIBSHIBOKEN_API bool isValid(PyObject *pyObj);
/**
* Returns false if the Python wrapper is not marked as valid.
* \param pyObj the object.
* \param throwPyError sets a Python RuntimeError when the object isn't valid.
*/
-LIBSHIBOKEN_API bool isValid(SbkObject* pyObj, bool throwPyError = true);
+LIBSHIBOKEN_API bool isValid(SbkObject *pyObj, bool throwPyError = true);
/**
* Returns false if the Python wrapper is not marked as valid.
* \param pyObj the object.
* \param throwPyError sets a Python RuntimeError when the object isn't valid.
*/
-LIBSHIBOKEN_API bool isValid(PyObject* pyObj, bool throwPyError);
+LIBSHIBOKEN_API bool isValid(PyObject *pyObj, bool throwPyError);
/**
* Set the parent of \p child to \p parent.
@@ -396,36 +396,36 @@ LIBSHIBOKEN_API bool isValid(PyObject* pyObj, bool throwPyError);
* \param parent the parent object, if null, the child will have no parents.
* \param child the child.
*/
-LIBSHIBOKEN_API void setParent(PyObject* parent, PyObject* child);
+LIBSHIBOKEN_API void setParent(PyObject *parent, PyObject *child);
/**
* Remove this child from their parent, if any.
* \param child the child.
*/
-LIBSHIBOKEN_API void removeParent(SbkObject* child, bool giveOwnershipBack = true, bool keepReferenc = false);
+LIBSHIBOKEN_API void removeParent(SbkObject *child, bool giveOwnershipBack = true, bool keepReferenc = false);
/**
* Mark the object as invalid
*/
-LIBSHIBOKEN_API void invalidate(SbkObject* self);
+LIBSHIBOKEN_API void invalidate(SbkObject *self);
/**
* Help function can be used to invalidate a sequence of object
**/
-LIBSHIBOKEN_API void invalidate(PyObject* pyobj);
+LIBSHIBOKEN_API void invalidate(PyObject *pyobj);
/**
* Make the object valid again
*/
-LIBSHIBOKEN_API void makeValid(SbkObject* self);
+LIBSHIBOKEN_API void makeValid(SbkObject *self);
-/// \deprecated Use destroy(SbkObject*, void*)
-SBK_DEPRECATED(LIBSHIBOKEN_API void destroy(SbkObject* self));
+/// \deprecated Use destroy(SbkObject *, void *)
+SBK_DEPRECATED(LIBSHIBOKEN_API void destroy(SbkObject *self));
/**
* Destroy any data in Shiboken structure and c++ pointer if the pyboject has the ownership
*/
-LIBSHIBOKEN_API void destroy(SbkObject* self, void* cppData);
+LIBSHIBOKEN_API void destroy(SbkObject *self, void *cppData);
/**
* Set user data on type of \p wrapper.
@@ -433,11 +433,11 @@ LIBSHIBOKEN_API void destroy(SbkObject* self, void* cppData);
* \param userData the user data
* \param d_func a function used to delete the user data
*/
-LIBSHIBOKEN_API void setTypeUserData(SbkObject* wrapper, void* userData, DeleteUserDataFunc d_func);
+LIBSHIBOKEN_API void setTypeUserData(SbkObject *wrapper, void *userData, DeleteUserDataFunc d_func);
/**
* Get the user data previously set by Shiboken::Object::setTypeUserData
*/
-LIBSHIBOKEN_API void* getTypeUserData(SbkObject* wrapper);
+LIBSHIBOKEN_API void *getTypeUserData(SbkObject *wrapper);
/**
* Increments the reference count of the referred Python object.
@@ -451,7 +451,7 @@ LIBSHIBOKEN_API void* getTypeUserData(SbkObject* wrapper);
* \param key a key that identifies the C++ method signature and argument where the referred Object came from.
* \param referredObject the object whose reference is used by the self object.
*/
-LIBSHIBOKEN_API void keepReference(SbkObject* self, const char* key, PyObject* referredObject, bool append = false);
+LIBSHIBOKEN_API void keepReference(SbkObject *self, const char *key, PyObject *referredObject, bool append = false);
/**
* Removes any reference previously added by keepReference function
@@ -459,7 +459,7 @@ LIBSHIBOKEN_API void keepReference(SbkObject* self, const char* key, PyOb
* \param key a key that identifies the C++ method signature and argument from where the referred Object came.
* \param referredObject the object whose reference is used by the self object.
*/
-LIBSHIBOKEN_API void removeReference(SbkObject* self, const char* key, PyObject* referredObject);
+LIBSHIBOKEN_API void removeReference(SbkObject *self, const char *key, PyObject *referredObject);
} // namespace Object
diff --git a/sources/shiboken2/libshiboken/basewrapper_p.h b/sources/shiboken2/libshiboken/basewrapper_p.h
index f8a381078..56a647b21 100644
--- a/sources/shiboken2/libshiboken/basewrapper_p.h
+++ b/sources/shiboken2/libshiboken/basewrapper_p.h
@@ -58,18 +58,18 @@ namespace Shiboken
* This mapping associates a method and argument of an wrapper object with the wrapper of
* said argument when it needs the binding to help manage its reference count.
*/
-typedef std::unordered_multimap<std::string, PyObject *> RefCountMap;
+using RefCountMap = std::unordered_multimap<std::string, PyObject *> ;
/// Linked list of SbkBaseWrapper pointers
-typedef std::set<SbkObject*> ChildrenList;
+using ChildrenList = std::set<SbkObject *>;
/// Structure used to store information about object parent and children.
struct ParentInfo
{
/// Default ctor.
- ParentInfo() : parent(0), hasWrapperRef(false) {}
+ ParentInfo() : parent(nullptr), hasWrapperRef(false) {}
/// Pointer to parent object.
- SbkObject* parent;
+ SbkObject *parent;
/// List of object children.
ChildrenList children;
/// has internal ref
@@ -88,7 +88,7 @@ extern "C"
struct SbkObjectPrivate
{
/// Pointer to the C++ class.
- void** cptr;
+ void ** cptr;
/// True when Python is responsible for freeing the used memory.
unsigned int hasOwnership : 1;
/// This is true when the C++ class of the wrapped object has a virtual destructor AND was created by Python.
@@ -98,16 +98,16 @@ struct SbkObjectPrivate
/// Marked as true when the object constructor was called
unsigned int cppObjectCreated : 1;
/// Information about the object parents and children, may be null.
- Shiboken::ParentInfo* parentInfo;
+ Shiboken::ParentInfo *parentInfo;
/// Manage reference count of objects that are referred to but not owned from.
- Shiboken::RefCountMap* referredObjects;
+ Shiboken::RefCountMap *referredObjects;
~SbkObjectPrivate()
{
delete parentInfo;
- parentInfo = 0;
+ parentInfo = nullptr;
delete referredObjects;
- referredObjects = 0;
+ referredObjects = nullptr;
}
};
@@ -121,8 +121,8 @@ struct SbkObjectPrivate
struct SbkObjectTypePrivate
{
- SbkConverter* converter;
- int* mi_offsets;
+ SbkConverter *converter;
+ int *mi_offsets;
MultipleInheritanceInitFunction mi_init;
/// Special cast function, null if this class doesn't have multiple inheritance.
@@ -134,16 +134,16 @@ struct SbkObjectTypePrivate
int is_multicpp : 1;
/// True if this type was defined by the user.
int is_user_type : 1;
- /// Tells is the type is a value type or an object-type, see BEHAVIOUR_* constants.
+ /// Tells is the type is a value type or an object-type, see BEHAVIOUR_ *constants.
// TODO-CONVERTERS: to be deprecated/removed
int type_behaviour : 2;
int delete_in_main_thread : 1;
/// C++ name
- char* original_name;
+ char *original_name;
/// Type user data
- void* user_data;
+ void *user_data;
DeleteUserDataFunc d_func;
- void (*subtype_init)(SbkObjectType*, PyObject*, PyObject*);
+ void (*subtype_init)(SbkObjectType *, PyObject *, PyObject *);
};
@@ -165,7 +165,7 @@ struct DestructorEntry
/**
* Utility function used to transform a PyObject that implements sequence protocol into a std::list.
**/
-std::vector<SbkObject *> splitPyObject(PyObject* pyObj);
+std::vector<SbkObject *> splitPyObject(PyObject *pyObj);
/**
* Visitor class used by walkOnClassHierarchy function.
@@ -198,7 +198,7 @@ private:
class BaseAccumulatorVisitor : public HierarchyVisitor
{
public:
- typedef std::vector<SbkObjectType *> Result;
+ using Result = std::vector<SbkObjectType *>;
bool visit(SbkObjectType *node) override;
@@ -211,7 +211,7 @@ private:
class GetIndexVisitor : public HierarchyVisitor
{
public:
- explicit GetIndexVisitor(PyTypeObject* desiredType) : m_desiredType(desiredType) {}
+ explicit GetIndexVisitor(PyTypeObject *desiredType) : m_desiredType(desiredType) {}
bool visit(SbkObjectType *node) override;
@@ -248,21 +248,21 @@ private:
*/
bool walkThroughClassHierarchy(PyTypeObject *currentType, HierarchyVisitor *visitor);
-inline int getTypeIndexOnHierarchy(PyTypeObject* baseType, PyTypeObject* desiredType)
+inline int getTypeIndexOnHierarchy(PyTypeObject *baseType, PyTypeObject *desiredType)
{
GetIndexVisitor visitor(desiredType);
walkThroughClassHierarchy(baseType, &visitor);
return visitor.index();
}
-inline int getNumberOfCppBaseClasses(PyTypeObject* baseType)
+inline int getNumberOfCppBaseClasses(PyTypeObject *baseType)
{
BaseCountVisitor visitor;
walkThroughClassHierarchy(baseType, &visitor);
return visitor.count();
}
-inline std::vector<SbkObjectType *> getCppBaseClasses(PyTypeObject* baseType)
+inline std::vector<SbkObjectType *> getCppBaseClasses(PyTypeObject *baseType)
{
BaseAccumulatorVisitor visitor;
walkThroughClassHierarchy(baseType, &visitor);
@@ -275,12 +275,12 @@ namespace Object
* Decrements the reference counters of every object referred by self.
* \param self the wrapper instance that keeps references to other objects.
*/
-void clearReferences(SbkObject* self);
+void clearReferences(SbkObject *self);
/**
* Destroy internal data
**/
-void deallocData(SbkObject* self, bool doCleanup);
+void deallocData(SbkObject *self, bool doCleanup);
} // namespace Object
diff --git a/sources/shiboken2/libshiboken/bindingmanager.cpp b/sources/shiboken2/libshiboken/bindingmanager.cpp
index 8a9e912fd..725150e87 100644
--- a/sources/shiboken2/libshiboken/bindingmanager.cpp
+++ b/sources/shiboken2/libshiboken/bindingmanager.cpp
@@ -52,19 +52,19 @@
namespace Shiboken
{
-typedef std::unordered_map<const void *, SbkObject *> WrapperMap;
+using WrapperMap = std::unordered_map<const void *, SbkObject *>;
class Graph
{
public:
- typedef std::vector<SbkObjectType *> NodeList;
- typedef std::unordered_map<SbkObjectType *, NodeList> Edges;
+ using NodeList = std::vector<SbkObjectType *>;
+ using Edges = std::unordered_map<SbkObjectType *, NodeList>;
Edges m_edges;
Graph() = default;
- void addEdge(SbkObjectType* from, SbkObjectType* to)
+ void addEdge(SbkObjectType *from, SbkObjectType *to)
{
m_edges[from].push_back(to);
}
@@ -78,7 +78,7 @@ public:
for (auto i = m_edges.begin(), end = m_edges.end(); i != end; ++i) {
auto node1 = reinterpret_cast<const PyTypeObject *>(i->first);
- const NodeList& nodeList = i->second;
+ const NodeList &nodeList = i->second;
for (const SbkObjectType *o : nodeList) {
auto node2 = reinterpret_cast<const PyTypeObject *>(o);
file << '"' << node2->tp_name << "\" -> \""
@@ -89,13 +89,13 @@ public:
}
#endif
- SbkObjectType* identifyType(void** cptr, SbkObjectType* type, SbkObjectType* baseType) const
+ SbkObjectType *identifyType(void **cptr, SbkObjectType *type, SbkObjectType *baseType) const
{
- Edges::const_iterator edgesIt = m_edges.find(type);
+ auto edgesIt = m_edges.find(type);
if (edgesIt != m_edges.end()) {
- const NodeList& adjNodes = m_edges.find(type)->second;
+ const NodeList &adjNodes = m_edges.find(type)->second;
for (SbkObjectType *node : adjNodes) {
- SbkObjectType* newType = identifyType(cptr, node, baseType);
+ SbkObjectType *newType = identifyType(cptr, node, baseType);
if (newType)
return newType;
}
@@ -106,7 +106,7 @@ public:
}
if (typeFound) {
// This "typeFound != type" is needed for backwards compatibility with old modules using a newer version of
- // libshiboken because old versions of type_discovery function used to return a SbkObjectType* instead of
+ // libshiboken because old versions of type_discovery function used to return a SbkObjectType *instead of
// a possible variation of the C++ instance pointer (*cptr).
if (typeFound != type)
*cptr = typeFound;
@@ -118,7 +118,7 @@ public:
#ifndef NDEBUG
-static void showWrapperMap(const WrapperMap& wrapperMap)
+static void showWrapperMap(const WrapperMap &wrapperMap)
{
if (Py_VerboseFlag > 0) {
fprintf(stderr, "-------------------------------\n");
@@ -144,28 +144,28 @@ struct BindingManager::BindingManagerPrivate {
bool destroying;
BindingManagerPrivate() : destroying(false) {}
- bool releaseWrapper(void* cptr, SbkObject* wrapper);
- void assignWrapper(SbkObject* wrapper, const void* cptr);
+ bool releaseWrapper(void *cptr, SbkObject *wrapper);
+ void assignWrapper(SbkObject *wrapper, const void *cptr);
};
-bool BindingManager::BindingManagerPrivate::releaseWrapper(void* cptr, SbkObject* wrapper)
+bool BindingManager::BindingManagerPrivate::releaseWrapper(void *cptr, SbkObject *wrapper)
{
// The wrapper argument is checked to ensure that the correct wrapper is released.
// Returns true if the correct wrapper is found and released.
// If wrapper argument is NULL, no such check is performed.
- WrapperMap::iterator iter = wrapperMapper.find(cptr);
- if (iter != wrapperMapper.end() && (wrapper == 0 || iter->second == wrapper)) {
+ auto iter = wrapperMapper.find(cptr);
+ if (iter != wrapperMapper.end() && (wrapper == nullptr || iter->second == wrapper)) {
wrapperMapper.erase(iter);
return true;
}
return false;
}
-void BindingManager::BindingManagerPrivate::assignWrapper(SbkObject* wrapper, const void* cptr)
+void BindingManager::BindingManagerPrivate::assignWrapper(SbkObject *wrapper, const void *cptr)
{
assert(cptr);
- WrapperMap::iterator iter = wrapperMapper.find(cptr);
+ auto iter = wrapperMapper.find(cptr);
if (iter == wrapperMapper.end())
wrapperMapper.insert(std::make_pair(cptr, wrapper));
}
@@ -192,27 +192,27 @@ BindingManager::~BindingManager()
* shutting down. */
if (Py_IsInitialized()) { // ensure the interpreter is still valid
while (!m_d->wrapperMapper.empty()) {
- Object::destroy(m_d->wrapperMapper.begin()->second, const_cast<void*>(m_d->wrapperMapper.begin()->first));
+ Object::destroy(m_d->wrapperMapper.begin()->second, const_cast<void *>(m_d->wrapperMapper.begin()->first));
}
assert(m_d->wrapperMapper.empty());
}
delete m_d;
}
-BindingManager& BindingManager::instance() {
+BindingManager &BindingManager::instance() {
static BindingManager singleton;
return singleton;
}
-bool BindingManager::hasWrapper(const void* cptr)
+bool BindingManager::hasWrapper(const void *cptr)
{
return m_d->wrapperMapper.find(cptr) != m_d->wrapperMapper.end();
}
-void BindingManager::registerWrapper(SbkObject* pyObj, void* cptr)
+void BindingManager::registerWrapper(SbkObject *pyObj, void *cptr)
{
- SbkObjectType* instanceType = reinterpret_cast<SbkObjectType*>(Py_TYPE(pyObj));
- SbkObjectTypePrivate* d = PepType_SOTP(instanceType);
+ auto instanceType = reinterpret_cast<SbkObjectType *>(Py_TYPE(pyObj));
+ SbkObjectTypePrivate *d = PepType_SOTP(instanceType);
if (!d)
return;
@@ -221,30 +221,30 @@ void BindingManager::registerWrapper(SbkObject* pyObj, void* cptr)
d->mi_offsets = d->mi_init(cptr);
m_d->assignWrapper(pyObj, cptr);
if (d->mi_offsets) {
- int* offset = d->mi_offsets;
+ int *offset = d->mi_offsets;
while (*offset != -1) {
if (*offset > 0)
- m_d->assignWrapper(pyObj, reinterpret_cast<void*>((std::size_t) cptr + (*offset)));
+ m_d->assignWrapper(pyObj, reinterpret_cast<void *>(reinterpret_cast<uintptr_t>(cptr) + *offset));
offset++;
}
}
}
-void BindingManager::releaseWrapper(SbkObject* sbkObj)
+void BindingManager::releaseWrapper(SbkObject *sbkObj)
{
- SbkObjectType* sbkType = reinterpret_cast<SbkObjectType*>(Py_TYPE(sbkObj));
- SbkObjectTypePrivate* d = PepType_SOTP(sbkType);
+ auto sbkType = reinterpret_cast<SbkObjectType *>(Py_TYPE(sbkObj));
+ SbkObjectTypePrivate *d = PepType_SOTP(sbkType);
int numBases = ((d && d->is_multicpp) ? getNumberOfCppBaseClasses(Py_TYPE(sbkObj)) : 1);
- void** cptrs = reinterpret_cast<SbkObject*>(sbkObj)->d->cptr;
+ void ** cptrs = reinterpret_cast<SbkObject *>(sbkObj)->d->cptr;
for (int i = 0; i < numBases; ++i) {
- unsigned char *cptr = reinterpret_cast<unsigned char *>(cptrs[i]);
+ auto *cptr = reinterpret_cast<unsigned char *>(cptrs[i]);
m_d->releaseWrapper(cptr, sbkObj);
if (d && d->mi_offsets) {
- int* offset = d->mi_offsets;
+ int *offset = d->mi_offsets;
while (*offset != -1) {
if (*offset > 0)
- m_d->releaseWrapper(reinterpret_cast<void *>((std::size_t) cptr + (*offset)), sbkObj);
+ m_d->releaseWrapper(reinterpret_cast<void *>(reinterpret_cast<uintptr_t>(cptr) + *offset), sbkObj);
offset++;
}
}
@@ -264,42 +264,42 @@ void BindingManager::addToDeletionInMainThread(const DestructorEntry &e)
m_d->deleteInMainThread.push_back(e);
}
-SbkObject* BindingManager::retrieveWrapper(const void* cptr)
+SbkObject *BindingManager::retrieveWrapper(const void *cptr)
{
- WrapperMap::iterator iter = m_d->wrapperMapper.find(cptr);
+ auto iter = m_d->wrapperMapper.find(cptr);
if (iter == m_d->wrapperMapper.end())
- return 0;
+ return nullptr;
return iter->second;
}
-PyObject* BindingManager::getOverride(const void* cptr, const char* methodName)
+PyObject *BindingManager::getOverride(const void *cptr, const char *methodName)
{
- SbkObject* wrapper = retrieveWrapper(cptr);
+ SbkObject *wrapper = retrieveWrapper(cptr);
// The refcount can be 0 if the object is dieing and someone called
// a virtual method from the destructor
if (!wrapper || reinterpret_cast<const PyObject *>(wrapper)->ob_refcnt == 0)
- return 0;
+ return nullptr;
if (wrapper->ob_dict) {
- PyObject* method = PyDict_GetItemString(wrapper->ob_dict, methodName);
+ PyObject *method = PyDict_GetItemString(wrapper->ob_dict, methodName);
if (method) {
Py_INCREF(reinterpret_cast<PyObject *>(method));
return method;
}
}
- PyObject* pyMethodName = Shiboken::String::fromCString(methodName);
+ PyObject *pyMethodName = Shiboken::String::fromCString(methodName);
PyObject *method = PyObject_GetAttr(reinterpret_cast<PyObject *>(wrapper), pyMethodName);
if (method && PyMethod_Check(method)
- && PyMethod_GET_SELF(method) == reinterpret_cast<PyObject*>(wrapper)) {
- PyObject* defaultMethod;
- PyObject* mro = Py_TYPE(wrapper)->tp_mro;
+ && PyMethod_GET_SELF(method) == reinterpret_cast<PyObject *>(wrapper)) {
+ PyObject *defaultMethod;
+ PyObject *mro = Py_TYPE(wrapper)->tp_mro;
// The first class in the mro (index 0) is the class being checked and it should not be tested.
// The last class in the mro (size - 1) is the base Python object class which should not be tested also.
for (int i = 1; i < PyTuple_GET_SIZE(mro) - 1; i++) {
- PyTypeObject* parent = reinterpret_cast<PyTypeObject*>(PyTuple_GET_ITEM(mro, i));
+ auto *parent = reinterpret_cast<PyTypeObject *>(PyTuple_GET_ITEM(mro, i));
if (parent->tp_dict) {
defaultMethod = PyDict_GetItem(parent->tp_dict, pyMethodName);
if (defaultMethod && PyMethod_GET_FUNCTION(method) != defaultMethod) {
@@ -312,40 +312,40 @@ PyObject* BindingManager::getOverride(const void* cptr, const char* methodName)
Py_XDECREF(method);
Py_DECREF(pyMethodName);
- return 0;
+ return nullptr;
}
-void BindingManager::addClassInheritance(SbkObjectType* parent, SbkObjectType* child)
+void BindingManager::addClassInheritance(SbkObjectType *parent, SbkObjectType *child)
{
m_d->classHierarchy.addEdge(parent, child);
}
-SbkObjectType* BindingManager::resolveType(void* cptr, SbkObjectType* type)
+SbkObjectType *BindingManager::resolveType(void *cptr, SbkObjectType *type)
{
return resolveType(&cptr, type);
}
-SbkObjectType* BindingManager::resolveType(void** cptr, SbkObjectType* type)
+SbkObjectType *BindingManager::resolveType(void **cptr, SbkObjectType *type)
{
- SbkObjectType* identifiedType = m_d->classHierarchy.identifyType(cptr, type, type);
+ SbkObjectType *identifiedType = m_d->classHierarchy.identifyType(cptr, type, type);
return identifiedType ? identifiedType : type;
}
-std::set<PyObject*> BindingManager::getAllPyObjects()
+std::set<PyObject *> BindingManager::getAllPyObjects()
{
- std::set<PyObject*> pyObjects;
- const WrapperMap& wrappersMap = m_d->wrapperMapper;
- WrapperMap::const_iterator it = wrappersMap.begin();
+ std::set<PyObject *> pyObjects;
+ const WrapperMap &wrappersMap = m_d->wrapperMapper;
+ auto it = wrappersMap.begin();
for (; it != wrappersMap.end(); ++it)
- pyObjects.insert(reinterpret_cast<PyObject*>(it->second));
+ pyObjects.insert(reinterpret_cast<PyObject *>(it->second));
return pyObjects;
}
-void BindingManager::visitAllPyObjects(ObjectVisitor visitor, void* data)
+void BindingManager::visitAllPyObjects(ObjectVisitor visitor, void *data)
{
WrapperMap copy = m_d->wrapperMapper;
- for (WrapperMap::iterator it = copy.begin(); it != copy.end(); ++it) {
+ for (auto it = copy.begin(); it != copy.end(); ++it) {
if (hasWrapper(it->first))
visitor(it->second, data);
}
diff --git a/sources/shiboken2/libshiboken/bindingmanager.h b/sources/shiboken2/libshiboken/bindingmanager.h
index d03aa999a..bfcbdc79b 100644
--- a/sources/shiboken2/libshiboken/bindingmanager.h
+++ b/sources/shiboken2/libshiboken/bindingmanager.h
@@ -52,36 +52,36 @@ namespace Shiboken
struct DestructorEntry;
-typedef void (*ObjectVisitor)(SbkObject*, void*);
+typedef void (*ObjectVisitor)(SbkObject *, void *);
class LIBSHIBOKEN_API BindingManager
{
public:
- BindingManager(const BindingManager&) = delete;
- BindingManager(BindingManager&&) = delete;
- BindingManager& operator=(const BindingManager&) = delete;
- BindingManager& operator=(BindingManager&&) = delete;
+ BindingManager(const BindingManager &) = delete;
+ BindingManager(BindingManager &&) = delete;
+ BindingManager &operator=(const BindingManager &) = delete;
+ BindingManager &operator=(BindingManager &&) = delete;
- static BindingManager& instance();
+ static BindingManager &instance();
bool hasWrapper(const void *cptr);
- void registerWrapper(SbkObject* pyObj, void* cptr);
- void releaseWrapper(SbkObject* wrapper);
+ void registerWrapper(SbkObject *pyObj, void *cptr);
+ void releaseWrapper(SbkObject *wrapper);
void runDeletionInMainThread();
void addToDeletionInMainThread(const DestructorEntry &);
- SbkObject* retrieveWrapper(const void* cptr);
- PyObject* getOverride(const void* cptr, const char* methodName);
+ SbkObject *retrieveWrapper(const void *cptr);
+ PyObject *getOverride(const void *cptr, const char *methodName);
- void addClassInheritance(SbkObjectType* parent, SbkObjectType* child);
+ void addClassInheritance(SbkObjectType *parent, SbkObjectType *child);
/**
- * \deprecated Use \fn resolveType(void**, SbkObjectType*), this version is broken when used with multiple inheritance
+ * \deprecated Use \fn resolveType(void **, SbkObjectType *), this version is broken when used with multiple inheritance
* because the \p cptr pointer of the discovered type may be different of the given \p cptr in case
* of multiple inheritance
*/
- SBK_DEPRECATED(SbkObjectType* resolveType(void* cptr, SbkObjectType* type));
+ SBK_DEPRECATED(SbkObjectType *resolveType(void *cptr, SbkObjectType *type));
/**
* Try to find the correct type of *cptr knowing that it's at least of type \p type.
* In case of multiple inheritance this function may change the contents of cptr.
@@ -89,9 +89,9 @@ public:
* \param type type of *cptr
* \warning This function is slow, use it only as last resort.
*/
- SbkObjectType* resolveType(void** cptr, SbkObjectType* type);
+ SbkObjectType *resolveType(void **cptr, SbkObjectType *type);
- std::set<PyObject*> getAllPyObjects();
+ std::set<PyObject *> getAllPyObjects();
/**
* Calls the function \p visitor for each object registered on binding manager.
@@ -100,14 +100,14 @@ public:
* \param visitor function called for each object.
* \param data user data passed as second argument to the visitor function.
*/
- void visitAllPyObjects(ObjectVisitor visitor, void* data);
+ void visitAllPyObjects(ObjectVisitor visitor, void *data);
private:
~BindingManager();
BindingManager();
struct BindingManagerPrivate;
- BindingManagerPrivate* m_d;
+ BindingManagerPrivate *m_d;
};
} // namespace Shiboken
diff --git a/sources/shiboken2/libshiboken/bufferprocs_py37.cpp b/sources/shiboken2/libshiboken/bufferprocs_py37.cpp
index 84d670d21..ddb07390e 100644
--- a/sources/shiboken2/libshiboken/bufferprocs_py37.cpp
+++ b/sources/shiboken2/libshiboken/bufferprocs_py37.cpp
@@ -147,19 +147,18 @@ PyBuffer_IsContiguous(const Pep_buffer *view, char order)
}
-void*
+void *
PyBuffer_GetPointer(Pep_buffer *view, Py_ssize_t *indices)
{
- char* pointer;
int i;
- pointer = (char *)view->buf;
+ auto pointer = reinterpret_cast<char *>(view->buf);
for (i = 0; i < view->ndim; i++) {
pointer += view->strides[i]*indices[i];
if ((view->suboffsets != NULL) && (view->suboffsets[i] >= 0)) {
- pointer = *((char**)pointer) + view->suboffsets[i];
+ pointer = *reinterpret_cast<char **>(pointer) + view->suboffsets[i];
}
}
- return (void*)pointer;
+ return pointer;
}
@@ -221,7 +220,7 @@ PyBuffer_FromContiguous(Pep_buffer *view, void *buf, Py_ssize_t len, char fort)
PyErr_NoMemory();
return -1;
}
- for (k=0; k<view->ndim;k++) {
+ for (k=0; k<view->ndim; k++) {
indices[k] = 0;
}
diff --git a/sources/shiboken2/libshiboken/debugfreehook.cpp b/sources/shiboken2/libshiboken/debugfreehook.cpp
index c66866cf1..3d52d88dc 100644
--- a/sources/shiboken2/libshiboken/debugfreehook.cpp
+++ b/sources/shiboken2/libshiboken/debugfreehook.cpp
@@ -107,8 +107,8 @@ static int DebugAllocHook(int nAllocType, void *pvData,
#endif // _WIN32 && _DEBUG
#ifdef __GLIBC__
-static void (*lastFreeHook)(void* ptr, const void* caller);
-static void DebugFreeHook(void* ptr, const void* caller)
+static void (*lastFreeHook)(void *ptr, const void *caller);
+static void DebugFreeHook(void *ptr, const void *caller)
{
testPointerBeingFreed(ptr);
@@ -150,7 +150,7 @@ void debugInstallFreeHook(void)
#endif
#ifdef __APPLE__
- malloc_zone_t* zone = malloc_default_zone();
+ malloc_zone_t *zone = malloc_default_zone();
assert(zone != NULL);
//remove the write protection from the zone struct
if (zone->version >= 8) {
@@ -176,7 +176,7 @@ void debugRemoveFreeHook(void)
#endif
#ifdef __APPLE__
- malloc_zone_t* zone = malloc_default_zone();
+ malloc_zone_t *zone = malloc_default_zone();
assert(zone != NULL);
//remove the write protection from the zone struct
if (zone->version >= 8) {
diff --git a/sources/shiboken2/libshiboken/gilstate.cpp b/sources/shiboken2/libshiboken/gilstate.cpp
index 64a0b60f3..a59c6f01e 100644
--- a/sources/shiboken2/libshiboken/gilstate.cpp
+++ b/sources/shiboken2/libshiboken/gilstate.cpp
@@ -43,7 +43,6 @@ namespace Shiboken
{
GilState::GilState()
- : m_locked(false)
{
if (Py_IsInitialized()) {
m_gstate = PyGILState_Ensure();
diff --git a/sources/shiboken2/libshiboken/gilstate.h b/sources/shiboken2/libshiboken/gilstate.h
index 9da4871d1..d22f688ba 100644
--- a/sources/shiboken2/libshiboken/gilstate.h
+++ b/sources/shiboken2/libshiboken/gilstate.h
@@ -49,17 +49,17 @@ namespace Shiboken
class LIBSHIBOKEN_API GilState
{
public:
- GilState(const GilState&) = delete;
- GilState(GilState&&) = delete;
- GilState& operator=(const GilState&) = delete;
- GilState& operator=(GilState&&) = delete;
+ GilState(const GilState &) = delete;
+ GilState(GilState &&) = delete;
+ GilState &operator=(const GilState &) = delete;
+ GilState &operator=(GilState &&) = delete;
GilState();
~GilState();
void release();
private:
PyGILState_STATE m_gstate;
- bool m_locked;
+ bool m_locked = false;
};
} // namespace Shiboken
diff --git a/sources/shiboken2/libshiboken/helper.cpp b/sources/shiboken2/libshiboken/helper.cpp
index e42daff07..fac72d56f 100644
--- a/sources/shiboken2/libshiboken/helper.cpp
+++ b/sources/shiboken2/libshiboken/helper.cpp
@@ -51,7 +51,7 @@ namespace Shiboken
{
// PySide-510: Changed from PySequence to PyList, which is correct.
-bool listToArgcArgv(PyObject* argList, int* argc, char*** argv, const char* defaultAppName)
+bool listToArgcArgv(PyObject *argList, int *argc, char ***argv, const char *defaultAppName)
{
if (!PyList_Check(argList))
return false;
@@ -60,10 +60,10 @@ bool listToArgcArgv(PyObject* argList, int* argc, char*** argv, const char* defa
defaultAppName = "PySideApplication";
// Check all items
- Shiboken::AutoDecRef args(PySequence_Fast(argList, 0));
+ Shiboken::AutoDecRef args(PySequence_Fast(argList, nullptr));
int numArgs = int(PySequence_Fast_GET_SIZE(argList));
for (int i = 0; i < numArgs; ++i) {
- PyObject* item = PyList_GET_ITEM(args.object(), i);
+ PyObject *item = PyList_GET_ITEM(args.object(), i);
if (!PyBytes_Check(item) && !PyUnicode_Check(item))
return false;
}
@@ -73,17 +73,17 @@ bool listToArgcArgv(PyObject* argList, int* argc, char*** argv, const char* defa
numArgs = 1;
*argc = numArgs;
- *argv = new char*[*argc];
+ *argv = new char *[*argc];
if (hasEmptyArgList) {
// Try to get the script name
- PyObject* globals = PyEval_GetGlobals();
- PyObject* appName = PyDict_GetItemString(globals, "__file__");
+ PyObject *globals = PyEval_GetGlobals();
+ PyObject *appName = PyDict_GetItemString(globals, "__file__");
(*argv)[0] = strdup(appName ? Shiboken::String::toCString(appName) : defaultAppName);
} else {
for (int i = 0; i < numArgs; ++i) {
- PyObject* item = PyList_GET_ITEM(args.object(), i);
- char* string = 0;
+ PyObject *item = PyList_GET_ITEM(args.object(), i);
+ char *string = nullptr;
if (Shiboken::String::check(item)) {
string = strdup(Shiboken::String::toCString(item));
}
@@ -94,24 +94,23 @@ bool listToArgcArgv(PyObject* argList, int* argc, char*** argv, const char* defa
return true;
}
-int* sequenceToIntArray(PyObject* obj, bool zeroTerminated)
+int *sequenceToIntArray(PyObject *obj, bool zeroTerminated)
{
AutoDecRef seq(PySequence_Fast(obj, "Sequence of ints expected"));
if (seq.isNull())
- return 0;
+ return nullptr;
Py_ssize_t size = PySequence_Fast_GET_SIZE(seq.object());
- int* array = new int[size + (zeroTerminated ? 1 : 0)];
+ int *array = new int[size + (zeroTerminated ? 1 : 0)];
for (int i = 0; i < size; i++) {
- PyObject* item = PySequence_Fast_GET_ITEM(seq.object(), i);
+ PyObject *item = PySequence_Fast_GET_ITEM(seq.object(), i);
if (!PyInt_Check(item)) {
PyErr_SetString(PyExc_TypeError, "Sequence of ints expected");
delete[] array;
- return 0;
- } else {
- array[i] = PyInt_AsLong(item);
+ return nullptr;
}
+ array[i] = PyInt_AsLong(item);
}
if (zeroTerminated)
@@ -121,7 +120,7 @@ int* sequenceToIntArray(PyObject* obj, bool zeroTerminated)
}
-int warning(PyObject* category, int stacklevel, const char* format, ...)
+int warning(PyObject *category, int stacklevel, const char *format, ...)
{
va_list args;
va_start(args, format);
@@ -133,8 +132,8 @@ int warning(PyObject* category, int stacklevel, const char* format, ...)
#endif
// check the necessary memory
- int size = vsnprintf(NULL, 0, format, args) + 1;
- char* message = new char[size];
+ int size = vsnprintf(nullptr, 0, format, args) + 1;
+ auto message = new char[size];
int result = 0;
if (message) {
// format the message
diff --git a/sources/shiboken2/libshiboken/helper.h b/sources/shiboken2/libshiboken/helper.h
index 9b6d8903f..14aae8028 100644
--- a/sources/shiboken2/libshiboken/helper.h
+++ b/sources/shiboken2/libshiboken/helper.h
@@ -44,7 +44,7 @@
#include "shibokenmacros.h"
#include "autodecref.h"
-#define SBK_UNUSED(x) (void)x;
+#define SBK_UNUSED(x) (void)(x);
namespace Shiboken
{
@@ -60,7 +60,7 @@ namespace Shiboken
* \note The argv array is allocated using new operator and each item is allocated using malloc.
* \returns True on sucess, false otherwise.
*/
-LIBSHIBOKEN_API bool listToArgcArgv(PyObject* argList, int* argc, char*** argv, const char* defaultAppName = 0);
+LIBSHIBOKEN_API bool listToArgcArgv(PyObject *argList, int *argc, char ***argv, const char *defaultAppName = nullptr);
/**
* Convert a python sequence into a heap-allocated array of ints.
@@ -68,7 +68,7 @@ LIBSHIBOKEN_API bool listToArgcArgv(PyObject* argList, int* argc, char*** argv,
* \returns The newly allocated array or NULL in case of error or empty sequence. Check with PyErr_Occurred
* if it was successfull.
*/
-LIBSHIBOKEN_API int* sequenceToIntArray(PyObject* obj, bool zeroTerminated = false);
+LIBSHIBOKEN_API int *sequenceToIntArray(PyObject *obj, bool zeroTerminated = false);
/**
* Creates and automatically deallocates C++ arrays.
@@ -77,27 +77,27 @@ template<class T>
class AutoArrayPointer
{
public:
- AutoArrayPointer(const AutoArrayPointer&) = delete;
- AutoArrayPointer(AutoArrayPointer&&) = delete;
- AutoArrayPointer& operator=(const AutoArrayPointer&) = delete;
- AutoArrayPointer& operator=(AutoArrayPointer&&) = delete;
+ AutoArrayPointer(const AutoArrayPointer &) = delete;
+ AutoArrayPointer(AutoArrayPointer &&) = delete;
+ AutoArrayPointer &operator=(const AutoArrayPointer &) = delete;
+ AutoArrayPointer &operator=(AutoArrayPointer &&) = delete;
explicit AutoArrayPointer(int size) { data = new T[size]; }
- T& operator[](int pos) { return data[pos]; }
- operator T*() const { return data; }
+ T &operator[](int pos) { return data[pos]; }
+ operator T *() const { return data; }
~AutoArrayPointer() { delete[] data; }
private:
- T* data;
+ T *data;
};
-typedef unsigned long long ThreadId;
+using ThreadId = unsigned long long;
LIBSHIBOKEN_API ThreadId currentThreadId();
LIBSHIBOKEN_API ThreadId mainThreadId();
/**
* An utility function used to call PyErr_WarnEx with a formatted message.
*/
-LIBSHIBOKEN_API int warning(PyObject* category, int stacklevel, const char* format, ...);
+LIBSHIBOKEN_API int warning(PyObject *category, int stacklevel, const char *format, ...);
} // namespace Shiboken
diff --git a/sources/shiboken2/libshiboken/pep384_issue33738.cpp b/sources/shiboken2/libshiboken/pep384_issue33738.cpp
index ee085438e..c20edeefa 100644
--- a/sources/shiboken2/libshiboken/pep384_issue33738.cpp
+++ b/sources/shiboken2/libshiboken/pep384_issue33738.cpp
@@ -114,7 +114,7 @@ typedef struct _oldtypeobject {
int PyIndex_Check(PyObject *obj)
{
- PyOldTypeObject *type = reinterpret_cast<PyOldTypeObject*>(Py_TYPE(obj));
+ PyOldTypeObject *type = reinterpret_cast<PyOldTypeObject *>(Py_TYPE(obj));
return type->tp_as_number != NULL &&
type->tp_as_number->nb_index != NULL;
}
diff --git a/sources/shiboken2/libshiboken/pep384impl.cpp b/sources/shiboken2/libshiboken/pep384impl.cpp
index 9a52603dc..fe7157d24 100644
--- a/sources/shiboken2/libshiboken/pep384impl.cpp
+++ b/sources/shiboken2/libshiboken/pep384impl.cpp
@@ -59,26 +59,26 @@ extern "C"
* appear at the right offsets.
*/
-#define make_dummy_int(x) (x * sizeof(void*))
-#define make_dummy(x) (reinterpret_cast<void*>(make_dummy_int(x)))
+#define make_dummy_int(x) (x * sizeof(void *))
+#define make_dummy(x) (reinterpret_cast<void *>(make_dummy_int(x)))
#ifdef Py_LIMITED_API
datetime_struc *PyDateTimeAPI = NULL;
#endif
static PyObject *
-dummy_func(PyObject *self, PyObject *args)
+dummy_func(PyObject * /* self */, PyObject * /* args */)
{
Py_RETURN_NONE;
}
static struct PyMethodDef probe_methoddef[] = {
{"dummy", dummy_func, METH_NOARGS},
- {0}
+ {nullptr}
};
static PyGetSetDef probe_getseters[] = {
- {0} /* Sentinel */
+ {nullptr} /* Sentinel */
};
#define probe_tp_call make_dummy(1)
@@ -110,7 +110,7 @@ static PyType_Slot typeprobe_slots[] = {
{Py_tp_new, probe_tp_new},
{Py_tp_free, probe_tp_free},
{Py_tp_is_gc, probe_tp_is_gc},
- {0, 0}
+ {0, nullptr}
};
static PyType_Spec typeprobe_spec = {
probe_tp_name,
@@ -121,15 +121,15 @@ static PyType_Spec typeprobe_spec = {
};
static void
-check_PyTypeObject_valid(void)
+check_PyTypeObject_valid()
{
- PyObject *obtype = reinterpret_cast<PyObject *>(&PyType_Type);
- PyTypeObject *probe_tp_base = reinterpret_cast<PyTypeObject *>(
+ auto *obtype = reinterpret_cast<PyObject *>(&PyType_Type);
+ auto *probe_tp_base = reinterpret_cast<PyTypeObject *>(
PyObject_GetAttrString(obtype, "__base__"));
PyObject *probe_tp_bases = PyObject_GetAttrString(obtype, "__bases__");
- PyTypeObject *check = reinterpret_cast<PyTypeObject *>(
+ auto *check = reinterpret_cast<PyTypeObject *>(
PyType_FromSpecWithBases(&typeprobe_spec, probe_tp_bases));
- PyTypeObject *typetype = reinterpret_cast<PyTypeObject *>(obtype);
+ auto *typetype = reinterpret_cast<PyTypeObject *>(obtype);
PyObject *w = PyObject_GetAttrString(obtype, "__weakrefoffset__");
long probe_tp_weakrefoffset = PyLong_AsLong(w);
PyObject *d = PyObject_GetAttrString(obtype, "__dictoffset__");
diff --git a/sources/shiboken2/libshiboken/python25compat.h b/sources/shiboken2/libshiboken/python25compat.h
index fc25aa3e5..b8a4950d9 100644
--- a/sources/shiboken2/libshiboken/python25compat.h
+++ b/sources/shiboken2/libshiboken/python25compat.h
@@ -48,9 +48,9 @@
*/
#if PY_VERSION_HEX < 0x02060000
-#define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt)
-#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
-#define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size)
+#define Py_REFCNT(ob) (((PyObject *)(ob))->ob_refcnt)
+#define Py_TYPE(ob) (((PyObject *)(ob))->ob_type)
+#define Py_SIZE(ob) (((PyVarObject *)(ob))->ob_size)
#define PyVarObject_HEAD_INIT(type, size) \
PyObject_HEAD_INIT(type) size,
#define PyType_Modified(t)
@@ -90,7 +90,7 @@ typedef struct {
#define PyBytes_Concat PyString_Concat
#define PyBytes_Size PyString_Size
-inline PyObject* PyUnicode_FromString(const char* s)
+inline PyObject *PyUnicode_FromString(const char *s)
{
std::size_t len = std::strlen(s);
return PyUnicode_DecodeUTF8(s, len, 0);
diff --git a/sources/shiboken2/libshiboken/qapp_macro.cpp b/sources/shiboken2/libshiboken/qapp_macro.cpp
index ea9cf0c86..12af9613c 100644
--- a/sources/shiboken2/libshiboken/qapp_macro.cpp
+++ b/sources/shiboken2/libshiboken/qapp_macro.cpp
@@ -87,9 +87,9 @@ static SbkObject _Py_ChameleonQAppWrapper_Struct = {
BRACE_CLOSE
};
-static PyObject *qApp_var = NULL;
-static PyObject *qApp_content = (PyObject *)&_Py_ChameleonQAppWrapper_Struct;
-static PyObject *qApp_moduledicts[5] = {0, 0, 0, 0, 0};
+static PyObject *qApp_var = nullptr;
+static PyObject *qApp_content = reinterpret_cast<PyObject *>(&_Py_ChameleonQAppWrapper_Struct);
+static PyObject *qApp_moduledicts[5] = {nullptr, nullptr, nullptr, nullptr, nullptr};
static int qApp_var_ref = 0;
static int qApp_content_ref = 0;
@@ -120,17 +120,17 @@ reset_qApp_var(void)
PyObject *
MakeSingletonQAppWrapper(PyTypeObject *type)
{
- if (type == NULL)
+ if (type == nullptr)
type = Py_NONE_TYPE;
if (!(type == Py_NONE_TYPE || Py_TYPE(qApp_content) == Py_NONE_TYPE)) {
const char *res_name = PepType_GetNameStr(Py_TYPE(qApp_content));
const char *type_name = PepType_GetNameStr(type);
PyErr_Format(PyExc_RuntimeError, "Please destroy the %s singleton before"
" creating a new %s instance.", res_name, type_name);
- return NULL;
+ return nullptr;
}
if (reset_qApp_var() < 0)
- return NULL;
+ return nullptr;
// always know the max of the refs
if (Py_REFCNT(qApp_var) > qApp_var_ref)
qApp_var_ref = Py_REFCNT(qApp_var);
@@ -201,7 +201,7 @@ setup_qApp_var(PyObject *module)
Py_NONE_TYPE->tp_as_number = &none_as_number;
#endif
qApp_var = Py_BuildValue("s", "qApp");
- if (qApp_var == NULL)
+ if (qApp_var == nullptr)
return -1;
// This is a borrowed reference
qApp_moduledicts[0] = PyEval_GetBuiltins();
@@ -240,11 +240,13 @@ NotifyModuleForQApp(PyObject *module, void *qApp)
* Therefore, the implementation is very simple and just redirects the
* qApp_contents variable and assigns the instance, instead of vice-versa.
*/
- if (qApp != nullptr) {
- Shiboken::AutoDecRef pycore(PyImport_ImportModule("PySide2.QtCore"));
- Shiboken::AutoDecRef coreapp(PyObject_GetAttrString(pycore, "QCoreApplication"));
- qApp_content = PyObject_CallMethod(coreapp, "instance", "");
- reset_qApp_var();
+ PyObject *coreDict = qApp_moduledicts[1];
+ if (qApp != nullptr && coreDict != nullptr) {
+ PyObject *coreApp = PyDict_GetItemString(coreDict, "QCoreApplication");
+ if (coreApp != nullptr) {
+ qApp_content = PyObject_CallMethod(coreApp, "instance", "");
+ reset_qApp_var();
+ }
}
}
diff --git a/sources/shiboken2/libshiboken/sbkarrayconverter.cpp b/sources/shiboken2/libshiboken/sbkarrayconverter.cpp
index 58e0b18a8..fd09efdae 100644
--- a/sources/shiboken2/libshiboken/sbkarrayconverter.cpp
+++ b/sources/shiboken2/libshiboken/sbkarrayconverter.cpp
@@ -83,7 +83,7 @@ inline void convertPySequence(PyObject *pyIn, Converter c, T *out)
// Internal, for usage by numpy
SbkArrayConverter *createArrayConverter(IsArrayConvertibleToCppFunc toCppCheckFunc)
{
- SbkArrayConverter *result = new SbkArrayConverter;
+ auto *result = new SbkArrayConverter;
result->toCppConversions.push_back(toCppCheckFunc);
return result;
}
@@ -115,7 +115,7 @@ static short toShort(PyObject *pyIn) { return short(PyLong_AsLong(pyIn)); }
static void sequenceToCppShortArray(PyObject *pyIn, void *cppOut)
{
- ArrayHandle<short> *handle = reinterpret_cast<ArrayHandle<short> *>(cppOut);
+ auto *handle = reinterpret_cast<ArrayHandle<short> *>(cppOut);
handle->allocate(PySequence_Size(pyIn));
convertPySequence(pyIn, toShort, handle->data());
}
@@ -148,7 +148,7 @@ static short toUnsignedShort(PyObject *pyIn) { return static_cast<unsigned short
static void sequenceToCppUnsignedShortArray(PyObject *pyIn, void *cppOut)
{
- ArrayHandle<unsigned short> *handle = reinterpret_cast<ArrayHandle<unsigned short> *>(cppOut);
+ auto *handle = reinterpret_cast<ArrayHandle<unsigned short> *>(cppOut);
handle->allocate(PySequence_Size(pyIn));
convertPySequence(pyIn, toUnsignedShort, handle->data());
}
@@ -160,7 +160,7 @@ static PythonToCppFunc sequenceToCppUnsignedShortArrayCheck(PyObject *pyIn, int
static void sequenceToCppIntArray(PyObject *pyIn, void *cppOut)
{
- ArrayHandle<int> *handle = reinterpret_cast<ArrayHandle<int> *>(cppOut);
+ auto *handle = reinterpret_cast<ArrayHandle<int> *>(cppOut);
handle->allocate(PySequence_Size(pyIn));
convertPySequence(pyIn, _PepLong_AsInt, handle->data());
}
@@ -172,7 +172,7 @@ static PythonToCppFunc sequenceToCppIntArrayCheck(PyObject *pyIn, int dim1, int
static void sequenceToCppUnsignedArray(PyObject *pyIn, void *cppOut)
{
- ArrayHandle<unsigned> *handle = reinterpret_cast<ArrayHandle<unsigned> *>(cppOut);
+ auto *handle = reinterpret_cast<ArrayHandle<unsigned> *>(cppOut);
handle->allocate(PySequence_Size(pyIn));
convertPySequence(pyIn, PyLong_AsUnsignedLong, handle->data());
}
@@ -184,7 +184,7 @@ static PythonToCppFunc sequenceToCppUnsignedArrayCheck(PyObject *pyIn, int dim1,
static void sequenceToCppLongLongArray(PyObject *pyIn, void *cppOut)
{
- ArrayHandle<long long> *handle = reinterpret_cast<ArrayHandle<long long> *>(cppOut);
+ auto *handle = reinterpret_cast<ArrayHandle<long long> *>(cppOut);
handle->allocate(PySequence_Size(pyIn));
convertPySequence(pyIn, PyLong_AsLongLong, handle->data());
}
@@ -196,7 +196,7 @@ static PythonToCppFunc sequenceToCppLongLongArrayCheck(PyObject *pyIn, int dim1,
static void sequenceToCppUnsignedLongLongArray(PyObject *pyIn, void *cppOut)
{
- ArrayHandle<unsigned long long> *handle = reinterpret_cast<ArrayHandle<unsigned long long> *>(cppOut);
+ auto *handle = reinterpret_cast<ArrayHandle<unsigned long long> *>(cppOut);
handle->allocate(PySequence_Size(pyIn));
convertPySequence(pyIn, PyLong_AsUnsignedLongLong, handle->data());
}
@@ -218,7 +218,7 @@ static inline bool floatArrayCheck(PyObject *pyIn, int expectedSize = -1)
static void sequenceToCppDoubleArray(PyObject *pyIn, void *cppOut)
{
- ArrayHandle<double> *handle = reinterpret_cast<ArrayHandle<double> *>(cppOut);
+ auto *handle = reinterpret_cast<ArrayHandle<double> *>(cppOut);
handle->allocate(PySequence_Size(pyIn));
convertPySequence(pyIn, PyFloat_AsDouble, handle->data());
}
@@ -227,7 +227,7 @@ static inline float pyToFloat(PyObject *pyIn) { return float(PyFloat_AsDouble(py
static void sequenceToCppFloatArray(PyObject *pyIn, void *cppOut)
{
- ArrayHandle<float> *handle = reinterpret_cast<ArrayHandle<float> *>(cppOut);
+ auto *handle = reinterpret_cast<ArrayHandle<float> *>(cppOut);
handle->allocate(PySequence_Size(pyIn));
convertPySequence(pyIn, pyToFloat, handle->data());
}
diff --git a/sources/shiboken2/libshiboken/sbkarrayconverter.h b/sources/shiboken2/libshiboken/sbkarrayconverter.h
index 2b82b25b4..84cb2f57f 100644
--- a/sources/shiboken2/libshiboken/sbkarrayconverter.h
+++ b/sources/shiboken2/libshiboken/sbkarrayconverter.h
@@ -73,10 +73,13 @@ enum : int {
template <class T>
class ArrayHandle
{
+public:
ArrayHandle(const ArrayHandle &) = delete;
ArrayHandle& operator=(const ArrayHandle &) = delete;
-public:
- ArrayHandle() {}
+ ArrayHandle(ArrayHandle &&) = delete;
+ ArrayHandle& operator=(ArrayHandle &&) = delete;
+
+ ArrayHandle() = default;
~ArrayHandle() { destroy(); }
void allocate(Py_ssize_t size);
@@ -84,7 +87,7 @@ public:
size_t size() const { return m_size; }
T *data() const { return m_data; }
- operator T*() const { return m_data; }
+ operator T *() const { return m_data; }
private:
void destroy();
@@ -106,9 +109,9 @@ class Array2Handle
public:
typedef T RowType[columns];
- Array2Handle() {}
+ Array2Handle() = default;
- operator RowType*() const { return m_rows; }
+ operator RowType *() const { return m_rows; }
void setData(RowType *d) { m_rows = d; }
diff --git a/sources/shiboken2/libshiboken/sbkarrayconverter_p.h b/sources/shiboken2/libshiboken/sbkarrayconverter_p.h
index a5e003e9a..a7b46702b 100644
--- a/sources/shiboken2/libshiboken/sbkarrayconverter_p.h
+++ b/sources/shiboken2/libshiboken/sbkarrayconverter_p.h
@@ -46,7 +46,7 @@
extern "C"
{
-typedef PythonToCppFunc (*IsArrayConvertibleToCppFunc)(PyObject*, int dim1, int dim2);
+typedef PythonToCppFunc (*IsArrayConvertibleToCppFunc)(PyObject *, int dim1, int dim2);
/**
* \internal
* Private structure of SbkArrayConverter.
diff --git a/sources/shiboken2/libshiboken/sbkconverter.cpp b/sources/shiboken2/libshiboken/sbkconverter.cpp
index 4f6ebf65f..29eb19715 100644
--- a/sources/shiboken2/libshiboken/sbkconverter.cpp
+++ b/sources/shiboken2/libshiboken/sbkconverter.cpp
@@ -49,9 +49,9 @@
#include <unordered_map>
-static SbkConverter** PrimitiveTypeConverters;
+static SbkConverter **PrimitiveTypeConverters;
-typedef std::unordered_map<std::string, SbkConverter *> ConvertersMap;
+using ConvertersMap = std::unordered_map<std::string, SbkConverter *>;
static ConvertersMap converters;
namespace Shiboken {
@@ -61,11 +61,11 @@ void initArrayConverters();
void init()
{
- static SbkConverter* primitiveTypeConverters[] = {
+ static SbkConverter *primitiveTypeConverters[] = {
Primitive<PY_LONG_LONG>::createConverter(),
Primitive<bool>::createConverter(),
Primitive<char>::createConverter(),
- Primitive<const char*>::createConverter(),
+ Primitive<const char *>::createConverter(),
Primitive<double>::createConverter(),
Primitive<float>::createConverter(),
Primitive<int>::createConverter(),
@@ -112,7 +112,7 @@ SbkConverter *createConverterObject(PyTypeObject *type,
CppToPythonFunc pointerToPythonFunc,
CppToPythonFunc copyToPythonFunc)
{
- SbkConverter* converter = new SbkConverter;
+ auto converter = new SbkConverter;
converter->pythonType = type;
// PYSIDE-595: All types are heaptypes now, so provide reference.
Py_XINCREF(type);
@@ -127,7 +127,7 @@ SbkConverter *createConverterObject(PyTypeObject *type,
return converter;
}
-SbkConverter* createConverter(SbkObjectType* type,
+SbkConverter *createConverter(SbkObjectType *type,
PythonToCppFunc toCppPointerConvFunc,
IsConvertibleToCppFunc toCppPointerCheckFunc,
CppToPythonFunc pointerToPythonFunc,
@@ -141,12 +141,12 @@ SbkConverter* createConverter(SbkObjectType* type,
return converter;
}
-SbkConverter* createConverter(PyTypeObject* type, CppToPythonFunc toPythonFunc)
+SbkConverter *createConverter(PyTypeObject *type, CppToPythonFunc toPythonFunc)
{
- return createConverterObject(type, 0, 0, 0, toPythonFunc);
+ return createConverterObject(type, nullptr, nullptr, nullptr, toPythonFunc);
}
-void deleteConverter(SbkConverter* converter)
+void deleteConverter(SbkConverter *converter)
{
if (converter) {
converter->toCppConversions.clear();
@@ -154,37 +154,37 @@ void deleteConverter(SbkConverter* converter)
}
}
-void setCppPointerToPythonFunction(SbkConverter* converter, CppToPythonFunc pointerToPythonFunc)
+void setCppPointerToPythonFunction(SbkConverter *converter, CppToPythonFunc pointerToPythonFunc)
{
converter->pointerToPython = pointerToPythonFunc;
}
-void setPythonToCppPointerFunctions(SbkConverter* converter,
+void setPythonToCppPointerFunctions(SbkConverter *converter,
PythonToCppFunc toCppPointerConvFunc,
IsConvertibleToCppFunc toCppPointerCheckFunc)
{
converter->toCppPointerConversion = std::make_pair(toCppPointerCheckFunc, toCppPointerConvFunc);
}
-void addPythonToCppValueConversion(SbkConverter* converter,
+void addPythonToCppValueConversion(SbkConverter *converter,
PythonToCppFunc pythonToCppFunc,
IsConvertibleToCppFunc isConvertibleToCppFunc)
{
converter->toCppConversions.push_back(std::make_pair(isConvertibleToCppFunc, pythonToCppFunc));
}
-void addPythonToCppValueConversion(SbkObjectType* type,
+void addPythonToCppValueConversion(SbkObjectType *type,
PythonToCppFunc pythonToCppFunc,
IsConvertibleToCppFunc isConvertibleToCppFunc)
{
addPythonToCppValueConversion(PepType_SOTP(type)->converter, pythonToCppFunc, isConvertibleToCppFunc);
}
-PyObject* pointerToPython(SbkObjectType *type, const void *cppIn)
+PyObject *pointerToPython(SbkObjectType *type, const void *cppIn)
{
return pointerToPython(PepType_SOTP(type)->converter, cppIn);
}
-PyObject* pointerToPython(const SbkConverter *converter, const void *cppIn)
+PyObject *pointerToPython(const SbkConverter *converter, const void *cppIn)
{
assert(converter);
if (!cppIn)
@@ -197,16 +197,16 @@ PyObject* pointerToPython(const SbkConverter *converter, const void *cppIn)
return converter->pointerToPython(cppIn);
}
-PyObject* referenceToPython(SbkObjectType *type, const void *cppIn)
+PyObject *referenceToPython(SbkObjectType *type, const void *cppIn)
{
return referenceToPython(PepType_SOTP(type)->converter, cppIn);
}
-PyObject* referenceToPython(const SbkConverter *converter, const void *cppIn)
+PyObject *referenceToPython(const SbkConverter *converter, const void *cppIn)
{
assert(cppIn);
- PyObject *pyOut = reinterpret_cast<PyObject *>(BindingManager::instance().retrieveWrapper(cppIn));
+ auto *pyOut = reinterpret_cast<PyObject *>(BindingManager::instance().retrieveWrapper(cppIn));
if (pyOut) {
Py_INCREF(pyOut);
return pyOut;
@@ -219,7 +219,7 @@ PyObject* referenceToPython(const SbkConverter *converter, const void *cppIn)
return converter->pointerToPython(cppIn);
}
-static inline PyObject* CopyCppToPython(const SbkConverter *converter, const void *cppIn)
+static inline PyObject *CopyCppToPython(const SbkConverter *converter, const void *cppIn)
{
if (!cppIn)
Py_RETURN_NONE;
@@ -230,11 +230,11 @@ static inline PyObject* CopyCppToPython(const SbkConverter *converter, const voi
}
return converter->copyToPython(cppIn);
}
-PyObject* copyToPython(SbkObjectType *type, const void *cppIn)
+PyObject *copyToPython(SbkObjectType *type, const void *cppIn)
{
return CopyCppToPython(PepType_SOTP(type)->converter, cppIn);
}
-PyObject* copyToPython(const SbkConverter *converter, const void *cppIn)
+PyObject *copyToPython(const SbkConverter *converter, const void *cppIn)
{
return CopyCppToPython(converter, cppIn);
}
@@ -252,7 +252,7 @@ static inline PythonToCppFunc IsPythonToCppConvertible(const SbkConverter *conve
if (PythonToCppFunc toCppFunc = c.first(pyIn))
return toCppFunc;
}
- return 0;
+ return nullptr;
}
PythonToCppFunc isPythonToCppValueConvertible(SbkObjectType *type, PyObject *pyIn)
{
@@ -284,30 +284,30 @@ PythonToCppFunc isPythonToCppReferenceConvertible(SbkObjectType *type, PyObject
return isPythonToCppValueConvertible(type, pyIn);
}
-void nonePythonToCppNullPtr(PyObject*, void* cppOut)
+void nonePythonToCppNullPtr(PyObject *, void *cppOut)
{
assert(cppOut);
- *((void**)cppOut) = 0;
+ *static_cast<void **>(cppOut) = nullptr;
}
-void* cppPointer(PyTypeObject* desiredType, SbkObject* pyIn)
+void *cppPointer(PyTypeObject *desiredType, SbkObject *pyIn)
{
assert(pyIn);
if (!ObjectType::checkType(desiredType))
return pyIn;
- SbkObjectType *inType = reinterpret_cast<SbkObjectType *>(Py_TYPE(pyIn));
+ auto *inType = reinterpret_cast<SbkObjectType *>(Py_TYPE(pyIn));
if (ObjectType::hasCast(inType))
return ObjectType::cast(inType, pyIn, desiredType);
return Object::cppPointer(pyIn, desiredType);
}
-void pythonToCppPointer(SbkObjectType* type, PyObject* pyIn, void* cppOut)
+void pythonToCppPointer(SbkObjectType *type, PyObject *pyIn, void *cppOut)
{
assert(type);
assert(pyIn);
assert(cppOut);
*reinterpret_cast<void **>(cppOut) = pyIn == Py_None
- ? 0
+ ? nullptr
: cppPointer(reinterpret_cast<PyTypeObject *>(type), reinterpret_cast<SbkObject *>(pyIn));
}
@@ -317,7 +317,7 @@ void pythonToCppPointer(const SbkConverter *converter, PyObject *pyIn, void *cpp
assert(pyIn);
assert(cppOut);
*reinterpret_cast<void **>(cppOut) = pyIn == Py_None
- ? 0
+ ? nullptr
: cppPointer(reinterpret_cast<PyTypeObject *>(converter->pythonType), reinterpret_cast<SbkObject *>(pyIn));
}
@@ -365,29 +365,29 @@ bool isImplicitConversion(SbkObjectType *type, PythonToCppFunc toCppFunc)
return toCppFunc != (*conv).second;
}
-void registerConverterName(SbkConverter* converter , const char* typeName)
+void registerConverterName(SbkConverter *converter , const char *typeName)
{
- ConvertersMap::iterator iter = converters.find(typeName);
+ auto iter = converters.find(typeName);
if (iter == converters.end())
converters.insert(std::make_pair(typeName, converter));
}
-SbkConverter* getConverter(const char* typeName)
+SbkConverter *getConverter(const char *typeName)
{
ConvertersMap::const_iterator it = converters.find(typeName);
if (it != converters.end())
return it->second;
if (Py_VerboseFlag > 0)
SbkDbg() << "Can't find type resolver for type '" << typeName << "'.";
- return 0;
+ return nullptr;
}
-SbkConverter* primitiveTypeConverter(int index)
+SbkConverter *primitiveTypeConverter(int index)
{
return PrimitiveTypeConverters[index];
}
-bool checkSequenceTypes(PyTypeObject* type, PyObject* pyIn)
+bool checkSequenceTypes(PyTypeObject *type, PyObject *pyIn)
{
assert(type);
assert(pyIn);
@@ -422,7 +422,7 @@ bool convertibleSequenceTypes(SbkObjectType *type, PyObject *pyIn)
return convertibleSequenceTypes(PepType_SOTP(type)->converter, pyIn);
}
-bool checkPairTypes(PyTypeObject* firstType, PyTypeObject* secondType, PyObject* pyIn)
+bool checkPairTypes(PyTypeObject *firstType, PyTypeObject *secondType, PyObject *pyIn)
{
assert(firstType);
assert(secondType);
@@ -466,7 +466,7 @@ bool convertiblePairTypes(const SbkConverter *firstConverter, bool firstCheckExa
return true;
}
-bool checkDictTypes(PyTypeObject* keyType, PyTypeObject* valueType, PyObject* pyIn)
+bool checkDictTypes(PyTypeObject *keyType, PyTypeObject *valueType, PyObject *pyIn)
{
assert(keyType);
assert(valueType);
@@ -474,8 +474,8 @@ bool checkDictTypes(PyTypeObject* keyType, PyTypeObject* valueType, PyObject* py
if (!PyDict_Check(pyIn))
return false;
- PyObject* key;
- PyObject* value;
+ PyObject *key;
+ PyObject *value;
Py_ssize_t pos = 0;
while (PyDict_Next(pyIn, &pos, &key, &value)) {
if (!PyObject_TypeCheck(key, keyType))
@@ -486,7 +486,7 @@ bool checkDictTypes(PyTypeObject* keyType, PyTypeObject* valueType, PyObject* py
return true;
}
-bool convertibleDictTypes(const SbkConverter * keyConverter, bool keyCheckExact, const SbkConverter *valueConverter,
+bool convertibleDictTypes(const SbkConverter *keyConverter, bool keyCheckExact, const SbkConverter *valueConverter,
bool valueCheckExact, PyObject *pyIn)
{
assert(keyConverter);
@@ -494,8 +494,8 @@ bool convertibleDictTypes(const SbkConverter * keyConverter, bool keyCheckExact,
assert(pyIn);
if (!PyDict_Check(pyIn))
return false;
- PyObject* key;
- PyObject* value;
+ PyObject *key;
+ PyObject *value;
Py_ssize_t pos = 0;
while (PyDict_Next(pyIn, &pos, &key, &value)) {
if (keyCheckExact) {
@@ -514,14 +514,14 @@ bool convertibleDictTypes(const SbkConverter * keyConverter, bool keyCheckExact,
return true;
}
-PyTypeObject* getPythonTypeObject(const SbkConverter *converter)
+PyTypeObject *getPythonTypeObject(const SbkConverter *converter)
{
if (converter)
return converter->pythonType;
- return 0;
+ return nullptr;
}
-PyTypeObject* getPythonTypeObject(const char* typeName)
+PyTypeObject *getPythonTypeObject(const char *typeName)
{
return getPythonTypeObject(getConverter(typeName));
}
@@ -542,10 +542,10 @@ bool pythonTypeIsObjectType(const SbkConverter *converter)
bool pythonTypeIsWrapperType(const SbkConverter *converter)
{
- return converter->pointerToPython != 0;
+ return converter->pointerToPython != nullptr;
}
-SpecificConverter::SpecificConverter(const char* typeName)
+SpecificConverter::SpecificConverter(const char *typeName)
: m_type(InvalidConversion)
{
m_converter = getConverter(typeName);
@@ -562,22 +562,22 @@ SpecificConverter::SpecificConverter(const char* typeName)
}
}
-PyObject* SpecificConverter::toPython(const void* cppIn)
+PyObject *SpecificConverter::toPython(const void *cppIn)
{
switch (m_type) {
case CopyConversion:
return copyToPython(m_converter, cppIn);
case PointerConversion:
- return pointerToPython(m_converter, *((const void**)cppIn));
+ return pointerToPython(m_converter, *static_cast<const void * const *>(cppIn));
case ReferenceConversion:
return referenceToPython(m_converter, cppIn);
default:
PyErr_SetString(PyExc_RuntimeError, "tried to use invalid converter in 'C++ to Python' conversion");
}
- return 0;
+ return nullptr;
}
-void SpecificConverter::toCpp(PyObject* pyIn, void* cppOut)
+void SpecificConverter::toCpp(PyObject *pyIn, void *cppOut)
{
switch (m_type) {
case CopyConversion:
diff --git a/sources/shiboken2/libshiboken/sbkconverter.h b/sources/shiboken2/libshiboken/sbkconverter.h
index 33c33025b..6c7a29300 100644
--- a/sources/shiboken2/libshiboken/sbkconverter.h
+++ b/sources/shiboken2/libshiboken/sbkconverter.h
@@ -77,7 +77,7 @@ struct SbkArrayConverter;
*
* C++ -> Python
*/
-typedef PyObject* (*CppToPythonFunc)(const void*);
+typedef PyObject *(*CppToPythonFunc)(const void *);
/**
* This function converts a Python object to a C++ value, it may be
@@ -90,7 +90,7 @@ typedef PyObject* (*CppToPythonFunc)(const void*);
*
* Python -> C++
*/
-typedef void (*PythonToCppFunc)(PyObject*,void*);
+typedef void (*PythonToCppFunc)(PyObject *,void *);
/**
* Checks if the Python object passed in the argument is convertible to a
@@ -101,7 +101,7 @@ typedef void (*PythonToCppFunc)(PyObject*,void*);
*
* Python -> C++ ?
*/
-typedef PythonToCppFunc (*IsConvertibleToCppFunc)(PyObject*);
+typedef PythonToCppFunc (*IsConvertibleToCppFunc)(PyObject *);
} // extern "C"
@@ -120,20 +120,20 @@ public:
ReferenceConversion
};
- explicit SpecificConverter(const char* typeName);
+ explicit SpecificConverter(const char *typeName);
- inline SbkConverter* converter() { return m_converter; }
- inline operator SbkConverter*() const { return m_converter; }
+ inline SbkConverter *converter() { return m_converter; }
+ inline operator SbkConverter *() const { return m_converter; }
inline bool isValid() { return m_type != InvalidConversion; }
inline operator bool() const { return m_type != InvalidConversion; }
inline Type conversionType() { return m_type; }
- PyObject* toPython(const void* cppIn);
- void toCpp(PyObject* pyIn, void* cppOut);
+ PyObject *toPython(const void *cppIn);
+ void toCpp(PyObject *pyIn, void *cppOut);
private:
- SbkConverter* m_converter;
+ SbkConverter *m_converter;
Type m_type;
};
@@ -147,11 +147,11 @@ private:
* \param copyToPythonFunc Function to convert a C++ object to a Python \p type, copying the object.
* \returns The new converter referred by the wrapper \p type.
*/
-LIBSHIBOKEN_API SbkConverter* createConverter(SbkObjectType* type,
+LIBSHIBOKEN_API SbkConverter *createConverter(SbkObjectType *type,
PythonToCppFunc toCppPointerConvFunc,
IsConvertibleToCppFunc toCppPointerCheckFunc,
CppToPythonFunc pointerToPythonFunc,
- CppToPythonFunc copyToPythonFunc = 0);
+ CppToPythonFunc copyToPythonFunc = nullptr);
/**
* Creates a converter for a non wrapper type (primitive or container type).
@@ -159,15 +159,15 @@ LIBSHIBOKEN_API SbkConverter* createConverter(SbkObjectType* type,
* \param toPythonFunc Function to convert a C++ object to a Python \p type.
* \returns A new type converter.
*/
-LIBSHIBOKEN_API SbkConverter* createConverter(PyTypeObject* type, CppToPythonFunc toPythonFunc);
+LIBSHIBOKEN_API SbkConverter *createConverter(PyTypeObject *type, CppToPythonFunc toPythonFunc);
-LIBSHIBOKEN_API void deleteConverter(SbkConverter* converter);
+LIBSHIBOKEN_API void deleteConverter(SbkConverter *converter);
/// Sets the Python object to C++ pointer conversion function.
-LIBSHIBOKEN_API void setCppPointerToPythonFunction(SbkConverter* converter, CppToPythonFunc pointerToPythonFunc);
+LIBSHIBOKEN_API void setCppPointerToPythonFunction(SbkConverter *converter, CppToPythonFunc pointerToPythonFunc);
/// Sets the C++ pointer to Python object conversion functions.
-LIBSHIBOKEN_API void setPythonToCppPointerFunctions(SbkConverter* converter,
+LIBSHIBOKEN_API void setPythonToCppPointerFunctions(SbkConverter *converter,
PythonToCppFunc toCppPointerConvFunc,
IsConvertibleToCppFunc toCppPointerCheckFunc);
@@ -175,10 +175,10 @@ LIBSHIBOKEN_API void setPythonToCppPointerFunctions(SbkConverter* converter,
* Adds a new conversion of a Python object to a C++ value.
* This is used in copy and implicit conversions.
*/
-LIBSHIBOKEN_API void addPythonToCppValueConversion(SbkConverter* converter,
+LIBSHIBOKEN_API void addPythonToCppValueConversion(SbkConverter *converter,
PythonToCppFunc pythonToCppFunc,
IsConvertibleToCppFunc isConvertibleToCppFunc);
-LIBSHIBOKEN_API void addPythonToCppValueConversion(SbkObjectType* type,
+LIBSHIBOKEN_API void addPythonToCppValueConversion(SbkObjectType *type,
PythonToCppFunc pythonToCppFunc,
IsConvertibleToCppFunc isConvertibleToCppFunc);
@@ -188,11 +188,11 @@ LIBSHIBOKEN_API void addPythonToCppValueConversion(SbkObjectType* type,
* Retrieves the Python wrapper object for the given \p cppIn C++ pointer object.
* This function is used only for Value and Object Types.
* Example usage:
- * TYPE* var;
- * PyObject* pyVar = pointerToPython(SBKTYPE, &var);
+ * TYPE *var;
+ * PyObject *pyVar = pointerToPython(SBKTYPE, &var);
*/
-LIBSHIBOKEN_API PyObject* pointerToPython(SbkObjectType *type, const void *cppIn);
-LIBSHIBOKEN_API PyObject* pointerToPython(const SbkConverter *converter, const void *cppIn);
+LIBSHIBOKEN_API PyObject *pointerToPython(SbkObjectType *type, const void *cppIn);
+LIBSHIBOKEN_API PyObject *pointerToPython(const SbkConverter *converter, const void *cppIn);
/**
* For the given \p cppIn C++ reference it returns the Python wrapper object,
@@ -200,21 +200,21 @@ LIBSHIBOKEN_API PyObject* pointerToPython(const SbkConverter *converter, const v
* for when the latter doesn't have an existing wrapper type, the C++ object
* is copied to Python.
* Example usage:
- * TYPE& var = SOMETHING;
- * PyObject* pyVar = referenceToPython(SBKTYPE, &var);
+ * TYPE &var = SOMETHING;
+ * PyObject *pyVar = referenceToPython(SBKTYPE, &var);
*/
-LIBSHIBOKEN_API PyObject* referenceToPython(SbkObjectType *type, const void *cppIn);
-LIBSHIBOKEN_API PyObject* referenceToPython(const SbkConverter *converter, const void *cppIn);
+LIBSHIBOKEN_API PyObject *referenceToPython(SbkObjectType *type, const void *cppIn);
+LIBSHIBOKEN_API PyObject *referenceToPython(const SbkConverter *converter, const void *cppIn);
/**
* Retrieves the Python wrapper object for the given C++ value pointed by \p cppIn.
* This function is used only for Value Types.
* Example usage:
* TYPE var;
- * PyObject* pyVar = copyToPython(SBKTYPE, &var);
+ * PyObject *pyVar = copyToPython(SBKTYPE, &var);
*/
-LIBSHIBOKEN_API PyObject* copyToPython(SbkObjectType *type, const void *cppIn);
-LIBSHIBOKEN_API PyObject* copyToPython(const SbkConverter *converter, const void *cppIn);
+LIBSHIBOKEN_API PyObject *copyToPython(SbkObjectType *type, const void *cppIn);
+LIBSHIBOKEN_API PyObject *copyToPython(const SbkConverter *converter, const void *cppIn);
// Python -> C++ ---------------------------------------------------------------------------
@@ -250,10 +250,10 @@ LIBSHIBOKEN_API PythonToCppFunc isPythonToCppConvertible(const SbkArrayConverter
* It differs from Shiboken::Object::cppPointer because it casts the pointer to a proper
* memory offset depending on the desired type.
*/
-LIBSHIBOKEN_API void* cppPointer(PyTypeObject* desiredType, SbkObject* pyIn);
+LIBSHIBOKEN_API void *cppPointer(PyTypeObject *desiredType, SbkObject *pyIn);
/// Converts a Python object \p pyIn to C++ and stores the result in the C++ pointer passed in \p cppOut.
-LIBSHIBOKEN_API void pythonToCppPointer(SbkObjectType* type, PyObject* pyIn, void* cppOut);
+LIBSHIBOKEN_API void pythonToCppPointer(SbkObjectType *type, PyObject *pyIn, void *cppOut);
LIBSHIBOKEN_API void pythonToCppPointer(const SbkConverter *converter, PyObject *pyIn, void *cppOut);
/// Converts a Python object \p pyIn to C++, and copies the result in the C++ variable passed in \p cppOut.
@@ -264,7 +264,7 @@ LIBSHIBOKEN_API void pythonToCppCopy(const SbkConverter *converter, PyObject *py
* Helper function returned by generated convertible checking functions
* that returns a C++ NULL when the input Python object is None.
*/
-LIBSHIBOKEN_API void nonePythonToCppNullPtr(PyObject*, void* cppOut);
+LIBSHIBOKEN_API void nonePythonToCppNullPtr(PyObject *, void *cppOut);
/**
* Returns true if the \p toCpp function passed is an implicit conversion of Python \p type.
@@ -274,16 +274,16 @@ LIBSHIBOKEN_API void nonePythonToCppNullPtr(PyObject*, void* cppOut);
LIBSHIBOKEN_API bool isImplicitConversion(SbkObjectType *type, PythonToCppFunc toCpp);
/// Registers a converter with a type name that may be used to retrieve the converter.
-LIBSHIBOKEN_API void registerConverterName(SbkConverter* converter, const char* typeName);
+LIBSHIBOKEN_API void registerConverterName(SbkConverter *converter, const char *typeName);
/// Returns the converter for a given type name, or NULL if it wasn't registered before.
-LIBSHIBOKEN_API SbkConverter* getConverter(const char* typeName);
+LIBSHIBOKEN_API SbkConverter *getConverter(const char *typeName);
/// Returns the converter for a primitive type.
-LIBSHIBOKEN_API SbkConverter* primitiveTypeConverter(int index);
+LIBSHIBOKEN_API SbkConverter *primitiveTypeConverter(int index);
/// Returns true if a Python sequence is comprised of objects of the given \p type.
-LIBSHIBOKEN_API bool checkSequenceTypes(PyTypeObject* type, PyObject* pyIn);
+LIBSHIBOKEN_API bool checkSequenceTypes(PyTypeObject *type, PyObject *pyIn);
/// Returns true if a Python sequence is comprised of objects of a type convertible to the one represented by the given \p converter.
LIBSHIBOKEN_API bool convertibleSequenceTypes(const SbkConverter *converter, PyObject *pyIn);
@@ -292,7 +292,7 @@ LIBSHIBOKEN_API bool convertibleSequenceTypes(const SbkConverter *converter, PyO
LIBSHIBOKEN_API bool convertibleSequenceTypes(SbkObjectType *type, PyObject *pyIn);
/// Returns true if a Python sequence can be converted to a C++ pair.
-LIBSHIBOKEN_API bool checkPairTypes(PyTypeObject* firstType, PyTypeObject* secondType, PyObject* pyIn);
+LIBSHIBOKEN_API bool checkPairTypes(PyTypeObject *firstType, PyTypeObject *secondType, PyObject *pyIn);
/// Returns true if a Python sequence can be converted to a C++ pair.
LIBSHIBOKEN_API bool convertiblePairTypes(const SbkConverter *firstConverter, bool firstCheckExact,
@@ -300,7 +300,7 @@ LIBSHIBOKEN_API bool convertiblePairTypes(const SbkConverter *firstConverter, bo
PyObject *pyIn);
/// Returns true if a Python dictionary can be converted to a C++ hash or map.
-LIBSHIBOKEN_API bool checkDictTypes(PyTypeObject* keyType, PyTypeObject* valueType, PyObject* pyIn);
+LIBSHIBOKEN_API bool checkDictTypes(PyTypeObject *keyType, PyTypeObject *valueType, PyObject *pyIn);
/// Returns true if a Python dictionary can be converted to a C++ hash or map.
LIBSHIBOKEN_API bool convertibleDictTypes(const SbkConverter *keyConverter, bool keyCheckExact,
@@ -308,10 +308,10 @@ LIBSHIBOKEN_API bool convertibleDictTypes(const SbkConverter *keyConverter, bool
PyObject *pyIn);
/// Returns the Python type object associated with the given \p converter.
-LIBSHIBOKEN_API PyTypeObject* getPythonTypeObject(const SbkConverter *converter);
+LIBSHIBOKEN_API PyTypeObject *getPythonTypeObject(const SbkConverter *converter);
/// Returns the Python type object for the given \p typeName.
-LIBSHIBOKEN_API PyTypeObject* getPythonTypeObject(const char* typeName);
+LIBSHIBOKEN_API PyTypeObject *getPythonTypeObject(const char *typeName);
/// Returns true if the Python type associated with the converter is a value type.
LIBSHIBOKEN_API bool pythonTypeIsValueType(const SbkConverter *converter);
@@ -343,25 +343,25 @@ LIBSHIBOKEN_API bool pythonTypeIsWrapperType(const SbkConverter *converter);
#define SBK_VOIDPTR_IDX 16
#define SBK_NULLPTR_T_IDX 17
-template<typename T> SbkConverter* PrimitiveTypeConverter() { return 0; }
-template<> inline SbkConverter* PrimitiveTypeConverter<PY_LONG_LONG>() { return primitiveTypeConverter(SBK_PY_LONG_LONG_IDX); }
-template<> inline SbkConverter* PrimitiveTypeConverter<bool>() { return primitiveTypeConverter(SBK_BOOL_IDX_1); }
-template<> inline SbkConverter* PrimitiveTypeConverter<char>() { return primitiveTypeConverter(SBK_CHAR_IDX); }
-template<> inline SbkConverter* PrimitiveTypeConverter<const char*>() { return primitiveTypeConverter(SBK_CONSTCHARPTR_IDX); }
-template<> inline SbkConverter* PrimitiveTypeConverter<double>() { return primitiveTypeConverter(SBK_DOUBLE_IDX); }
-template<> inline SbkConverter* PrimitiveTypeConverter<float>() { return primitiveTypeConverter(SBK_FLOAT_IDX); }
-template<> inline SbkConverter* PrimitiveTypeConverter<int>() { return primitiveTypeConverter(SBK_INT_IDX); }
-template<> inline SbkConverter* PrimitiveTypeConverter<long>() { return primitiveTypeConverter(SBK_LONG_IDX); }
-template<> inline SbkConverter* PrimitiveTypeConverter<short>() { return primitiveTypeConverter(SBK_SHORT_IDX); }
-template<> inline SbkConverter* PrimitiveTypeConverter<signed char>() { return primitiveTypeConverter(SBK_SIGNEDCHAR_IDX); }
-template<> inline SbkConverter* PrimitiveTypeConverter<std::string>() { return primitiveTypeConverter(SBK_STD_STRING_IDX); }
-template<> inline SbkConverter* PrimitiveTypeConverter<unsigned PY_LONG_LONG>() { return primitiveTypeConverter(SBK_UNSIGNEDPY_LONG_LONG_IDX); }
-template<> inline SbkConverter* PrimitiveTypeConverter<unsigned char>() { return primitiveTypeConverter(SBK_UNSIGNEDCHAR_IDX); }
-template<> inline SbkConverter* PrimitiveTypeConverter<unsigned int>() { return primitiveTypeConverter(SBK_UNSIGNEDINT_IDX); }
-template<> inline SbkConverter* PrimitiveTypeConverter<unsigned long>() { return primitiveTypeConverter(SBK_UNSIGNEDLONG_IDX); }
-template<> inline SbkConverter* PrimitiveTypeConverter<unsigned short>() { return primitiveTypeConverter(SBK_UNSIGNEDSHORT_IDX); }
-template<> inline SbkConverter* PrimitiveTypeConverter<void*>() { return primitiveTypeConverter(SBK_VOIDPTR_IDX); }
-template<> inline SbkConverter* PrimitiveTypeConverter<std::nullptr_t>() { return primitiveTypeConverter(SBK_NULLPTR_T_IDX); }
+template<typename T> SbkConverter *PrimitiveTypeConverter() { return nullptr; }
+template<> inline SbkConverter *PrimitiveTypeConverter<PY_LONG_LONG>() { return primitiveTypeConverter(SBK_PY_LONG_LONG_IDX); }
+template<> inline SbkConverter *PrimitiveTypeConverter<bool>() { return primitiveTypeConverter(SBK_BOOL_IDX_1); }
+template<> inline SbkConverter *PrimitiveTypeConverter<char>() { return primitiveTypeConverter(SBK_CHAR_IDX); }
+template<> inline SbkConverter *PrimitiveTypeConverter<const char *>() { return primitiveTypeConverter(SBK_CONSTCHARPTR_IDX); }
+template<> inline SbkConverter *PrimitiveTypeConverter<double>() { return primitiveTypeConverter(SBK_DOUBLE_IDX); }
+template<> inline SbkConverter *PrimitiveTypeConverter<float>() { return primitiveTypeConverter(SBK_FLOAT_IDX); }
+template<> inline SbkConverter *PrimitiveTypeConverter<int>() { return primitiveTypeConverter(SBK_INT_IDX); }
+template<> inline SbkConverter *PrimitiveTypeConverter<long>() { return primitiveTypeConverter(SBK_LONG_IDX); }
+template<> inline SbkConverter *PrimitiveTypeConverter<short>() { return primitiveTypeConverter(SBK_SHORT_IDX); }
+template<> inline SbkConverter *PrimitiveTypeConverter<signed char>() { return primitiveTypeConverter(SBK_SIGNEDCHAR_IDX); }
+template<> inline SbkConverter *PrimitiveTypeConverter<std::string>() { return primitiveTypeConverter(SBK_STD_STRING_IDX); }
+template<> inline SbkConverter *PrimitiveTypeConverter<unsigned PY_LONG_LONG>() { return primitiveTypeConverter(SBK_UNSIGNEDPY_LONG_LONG_IDX); }
+template<> inline SbkConverter *PrimitiveTypeConverter<unsigned char>() { return primitiveTypeConverter(SBK_UNSIGNEDCHAR_IDX); }
+template<> inline SbkConverter *PrimitiveTypeConverter<unsigned int>() { return primitiveTypeConverter(SBK_UNSIGNEDINT_IDX); }
+template<> inline SbkConverter *PrimitiveTypeConverter<unsigned long>() { return primitiveTypeConverter(SBK_UNSIGNEDLONG_IDX); }
+template<> inline SbkConverter *PrimitiveTypeConverter<unsigned short>() { return primitiveTypeConverter(SBK_UNSIGNEDSHORT_IDX); }
+template<> inline SbkConverter *PrimitiveTypeConverter<void *>() { return primitiveTypeConverter(SBK_VOIDPTR_IDX); }
+template<> inline SbkConverter *PrimitiveTypeConverter<std::nullptr_t>() { return primitiveTypeConverter(SBK_NULLPTR_T_IDX); }
} // namespace Shiboken::Conversions
@@ -371,24 +371,24 @@ template<> inline SbkConverter* PrimitiveTypeConverter<std::nullptr_t>() { retur
* T isn't a C++ primitive type.
* \see SpecialCastFunction
*/
-template<typename T> PyTypeObject* SbkType() { return 0; }
+template<typename T> PyTypeObject *SbkType() { return nullptr; }
// Below are the template specializations for C++ primitive types.
-template<> inline PyTypeObject* SbkType<PY_LONG_LONG>() { return &PyLong_Type; }
-template<> inline PyTypeObject* SbkType<bool>() { return &PyBool_Type; }
-template<> inline PyTypeObject* SbkType<char>() { return &PyInt_Type; }
-template<> inline PyTypeObject* SbkType<double>() { return &PyFloat_Type; }
-template<> inline PyTypeObject* SbkType<float>() { return &PyFloat_Type; }
-template<> inline PyTypeObject* SbkType<int>() { return &PyInt_Type; }
-template<> inline PyTypeObject* SbkType<long>() { return &PyLong_Type; }
-template<> inline PyTypeObject* SbkType<short>() { return &PyInt_Type; }
-template<> inline PyTypeObject* SbkType<signed char>() { return &PyInt_Type; }
-template<> inline PyTypeObject* SbkType<unsigned PY_LONG_LONG>() { return &PyLong_Type; }
-template<> inline PyTypeObject* SbkType<unsigned char>() { return &PyInt_Type; }
-template<> inline PyTypeObject* SbkType<unsigned int>() { return &PyLong_Type; }
-template<> inline PyTypeObject* SbkType<unsigned long>() { return &PyLong_Type; }
-template<> inline PyTypeObject* SbkType<unsigned short>() { return &PyInt_Type; }
-template<> inline PyTypeObject* SbkType<std::nullptr_t>() { return Py_TYPE(&_Py_NoneStruct); }
+template<> inline PyTypeObject *SbkType<PY_LONG_LONG>() { return &PyLong_Type; }
+template<> inline PyTypeObject *SbkType<bool>() { return &PyBool_Type; }
+template<> inline PyTypeObject *SbkType<char>() { return &PyInt_Type; }
+template<> inline PyTypeObject *SbkType<double>() { return &PyFloat_Type; }
+template<> inline PyTypeObject *SbkType<float>() { return &PyFloat_Type; }
+template<> inline PyTypeObject *SbkType<int>() { return &PyInt_Type; }
+template<> inline PyTypeObject *SbkType<long>() { return &PyLong_Type; }
+template<> inline PyTypeObject *SbkType<short>() { return &PyInt_Type; }
+template<> inline PyTypeObject *SbkType<signed char>() { return &PyInt_Type; }
+template<> inline PyTypeObject *SbkType<unsigned PY_LONG_LONG>() { return &PyLong_Type; }
+template<> inline PyTypeObject *SbkType<unsigned char>() { return &PyInt_Type; }
+template<> inline PyTypeObject *SbkType<unsigned int>() { return &PyLong_Type; }
+template<> inline PyTypeObject *SbkType<unsigned long>() { return &PyLong_Type; }
+template<> inline PyTypeObject *SbkType<unsigned short>() { return &PyInt_Type; }
+template<> inline PyTypeObject *SbkType<std::nullptr_t>() { return Py_TYPE(&_Py_NoneStruct); }
} // namespace Shiboken
@@ -398,7 +398,7 @@ template<> inline PyTypeObject* SbkType<std::nullptr_t>() { return Py_TYPE(&_Py_
#define SbkChar_Check(X) (SbkNumber_Check(X) || Shiboken::String::checkChar(X))
struct _SbkGenericTypePrivate {
- SbkConverter** converter;
+ SbkConverter **converter;
};
diff --git a/sources/shiboken2/libshiboken/sbkconverter_p.h b/sources/shiboken2/libshiboken/sbkconverter_p.h
index cb968ed89..d87162071 100644
--- a/sources/shiboken2/libshiboken/sbkconverter_p.h
+++ b/sources/shiboken2/libshiboken/sbkconverter_p.h
@@ -54,8 +54,8 @@
extern "C"
{
-typedef std::pair<IsConvertibleToCppFunc, PythonToCppFunc> ToCppConversion;
-typedef std::vector<ToCppConversion> ToCppConversionVector;
+using ToCppConversion = std::pair<IsConvertibleToCppFunc, PythonToCppFunc>;
+using ToCppConversionVector = std::vector<ToCppConversion>;
/**
* \internal
@@ -69,7 +69,7 @@ struct SbkConverter
* Python type to which the C++ value will be converted (note that the
* C++ type could be produced from various Python types).
*/
- PyTypeObject* pythonType;
+ PyTypeObject *pythonType;
/**
* This function converts a C++ object to a Python object of the type
* indicated in pythonType. The identity of the C++ object is kept,
@@ -77,7 +77,7 @@ struct SbkConverter
* with the C++ instance.
* It is used to convert C++ pointers and references to Python objects.
*/
- CppToPythonFunc pointerToPython;
+ CppToPythonFunc pointerToPython;
/**
* This function converts a C++ object to a Python object of the type
* indicated in pythonType. The identity of the object is not kept,
@@ -86,17 +86,17 @@ struct SbkConverter
* reference can't be traced to an object that already has a Python
* wrapper assigned for it.
*/
- CppToPythonFunc copyToPython;
+ CppToPythonFunc copyToPython;
/**
* This is a special case of a Python to C++ conversion. It returns
* the underlying C++ pointer of a Python wrapper passed as parameter
* or NULL if the Python object is a None value.
* It comes separated from the other toCppConversions because if you
* have a Python object representing a Value Type the type checking
- * for both ValueType and ValueType* would be the same, thus the first
+ * for both ValueType and ValueType *would be the same, thus the first
* check would be true and the second would never be reached.
*/
- ToCppConversion toCppPointerConversion;
+ ToCppConversion toCppPointerConversion;
/**
* This is a list of type checking functions that return the
* proper Python to C++ conversion function, for the given Python
@@ -104,19 +104,19 @@ struct SbkConverter
* For Object Types, that never have implicit conversions, this
* list is always empty.
*/
- ToCppConversionVector toCppConversions;
+ ToCppConversionVector toCppConversions;
};
} // extern "C"
template<typename T, typename MaxLimitType, bool isSigned>
struct OverFlowCheckerBase {
- static void formatOverFlowMessage(const MaxLimitType& value,
- const std::string *valueAsString = 0)
+ static void formatOverFlowMessage(const MaxLimitType &value,
+ const std::string *valueAsString = nullptr)
{
std::ostringstream str;
str << "libshiboken: Overflow: Value ";
- if (valueAsString != 0 && !valueAsString->empty())
+ if (valueAsString != nullptr && !valueAsString->empty())
str << *valueAsString;
else
str << value;
@@ -157,7 +157,7 @@ struct OverFlowChecker;
template<typename T, typename MaxLimitType>
struct OverFlowChecker<T, MaxLimitType, true> :
public OverFlowCheckerBase<T, MaxLimitType, true> {
- static bool check(const MaxLimitType& value, PyObject *pyIn)
+ static bool check(const MaxLimitType &value, PyObject *pyIn)
{
std::string valueAsString;
const bool isOverflow =
@@ -173,7 +173,7 @@ struct OverFlowChecker<T, MaxLimitType, true> :
template<typename T, typename MaxLimitType>
struct OverFlowChecker<T, MaxLimitType, false>
: public OverFlowCheckerBase<T, MaxLimitType, false> {
- static bool check(const MaxLimitType& value, PyObject *pyIn)
+ static bool check(const MaxLimitType &value, PyObject *pyIn)
{
std::string valueAsString;
const bool isOverflow =
@@ -204,7 +204,7 @@ struct OverFlowChecker<double, PY_LONG_LONG, true> {
template<>
struct OverFlowChecker<float, PY_LONG_LONG, true> :
public OverFlowCheckerBase<float, PY_LONG_LONG, true> {
- static bool check(const double& value, PyObject *)
+ static bool check(const double &value, PyObject *)
{
const bool result = value < std::numeric_limits<float>::min()
|| value > std::numeric_limits<float>::max();
@@ -221,12 +221,12 @@ template <typename T> struct Primitive {};
template <typename T>
struct OnePrimitive
{
- static PyObject* toPython(const void*) { return 0; }
- static PythonToCppFunc isConvertible(PyObject*) { return 0; }
- static void toCpp(PyObject*, void*) {}
- static SbkConverter* createConverter()
+ static PyObject *toPython(const void *) { return nullptr; }
+ static PythonToCppFunc isConvertible(PyObject *) { return nullptr; }
+ static void toCpp(PyObject *, void *) {}
+ static SbkConverter *createConverter()
{
- SbkConverter* converter = Shiboken::Conversions::createConverter(Shiboken::SbkType<T>(),
+ SbkConverter *converter = Shiboken::Conversions::createConverter(Shiboken::SbkType<T>(),
Primitive<T>::toPython);
Shiboken::Conversions::addPythonToCppValueConversion(converter,
Primitive<T>::toCpp,
@@ -237,11 +237,11 @@ struct OnePrimitive
template <typename T>
struct TwoPrimitive : OnePrimitive<T>
{
- static PythonToCppFunc isOtherConvertible(PyObject*) { return 0; }
- static void otherToCpp(PyObject*, void*) {}
- static SbkConverter* createConverter()
+ static PythonToCppFunc isOtherConvertible(PyObject *) { return nullptr; }
+ static void otherToCpp(PyObject *, void *) {}
+ static SbkConverter *createConverter()
{
- SbkConverter* converter = OnePrimitive<T>::createConverter();
+ SbkConverter *converter = OnePrimitive<T>::createConverter();
Shiboken::Conversions::addPythonToCppValueConversion(converter, Primitive<T>::otherToCpp, Primitive<T>::isOtherConvertible);
return converter;
}
@@ -252,36 +252,36 @@ struct TwoPrimitive : OnePrimitive<T>
template <typename INT>
struct IntPrimitive : TwoPrimitive<INT>
{
- static PyObject* toPython(const void* cppIn)
+ static PyObject *toPython(const void *cppIn)
{
return PyInt_FromLong(*reinterpret_cast<const INT *>(cppIn));
}
- static void toCpp(PyObject* pyIn, void* cppOut)
+ static void toCpp(PyObject *pyIn, void *cppOut)
{
double result = PyFloat_AS_DOUBLE(pyIn);
// If cast to long directly it could overflow silently.
if (OverFlowChecker<INT>::check(result, pyIn))
- PyErr_SetObject(PyExc_OverflowError, 0);
+ PyErr_SetObject(PyExc_OverflowError, nullptr);
*reinterpret_cast<INT * >(cppOut) = static_cast<INT>(result);
}
- static PythonToCppFunc isConvertible(PyObject* pyIn)
+ static PythonToCppFunc isConvertible(PyObject *pyIn)
{
if (PyFloat_Check(pyIn))
return toCpp;
- return 0;
+ return nullptr;
}
- static void otherToCpp(PyObject* pyIn, void* cppOut)
+ static void otherToCpp(PyObject *pyIn, void *cppOut)
{
PY_LONG_LONG result = PyLong_AsLongLong(pyIn);
if (OverFlowChecker<INT>::check(result, pyIn))
- PyErr_SetObject(PyExc_OverflowError, 0);
+ PyErr_SetObject(PyExc_OverflowError, nullptr);
*reinterpret_cast<INT * >(cppOut) = static_cast<INT>(result);
}
- static PythonToCppFunc isOtherConvertible(PyObject* pyIn)
+ static PythonToCppFunc isOtherConvertible(PyObject *pyIn)
{
if (SbkNumber_Check(pyIn))
return otherToCpp;
- return 0;
+ return nullptr;
}
};
template <> struct Primitive<int> : IntPrimitive<int> {};
@@ -294,7 +294,7 @@ template <> struct Primitive<unsigned short> : IntPrimitive<unsigned short> {};
template <typename LONG>
struct UnsignedLongPrimitive : IntPrimitive<LONG>
{
- static PyObject* toPython(const void* cppIn)
+ static PyObject *toPython(const void *cppIn)
{
return PyLong_FromUnsignedLong(*reinterpret_cast<const LONG *>(cppIn));
}
@@ -307,39 +307,39 @@ template <> struct Primitive<unsigned long> : UnsignedLongPrimitive<unsigned lon
template <>
struct Primitive<PY_LONG_LONG> : OnePrimitive<PY_LONG_LONG>
{
- static PyObject* toPython(const void* cppIn)
+ static PyObject *toPython(const void *cppIn)
{
- return PyLong_FromLongLong(*((PY_LONG_LONG*)cppIn));
+ return PyLong_FromLongLong(*reinterpret_cast<const PY_LONG_LONG *>(cppIn));
}
- static void toCpp(PyObject* pyIn, void* cppOut)
+ static void toCpp(PyObject *pyIn, void *cppOut)
{
PY_LONG_LONG result = PyLong_AsLongLong(pyIn);
if (OverFlowChecker<PY_LONG_LONG>::check(result, pyIn))
PyErr_SetObject(PyExc_OverflowError, 0);
*reinterpret_cast<PY_LONG_LONG * >(cppOut) = result;
}
- static PythonToCppFunc isConvertible(PyObject* pyIn)
+ static PythonToCppFunc isConvertible(PyObject *pyIn)
{
if (SbkNumber_Check(pyIn))
return toCpp;
- return 0;
+ return nullptr;
}
};
template <>
struct Primitive<unsigned PY_LONG_LONG> : OnePrimitive<unsigned PY_LONG_LONG>
{
- static PyObject* toPython(const void* cppIn)
+ static PyObject *toPython(const void *cppIn)
{
- return PyLong_FromUnsignedLongLong(*((unsigned PY_LONG_LONG*)cppIn));
+ return PyLong_FromUnsignedLongLong(*static_cast<const unsigned PY_LONG_LONG *>(cppIn));
}
- static void toCpp(PyObject* pyIn, void* cppOut)
+ static void toCpp(PyObject *pyIn, void *cppOut)
{
#if PY_MAJOR_VERSION >= 3
if (PyLong_Check(pyIn)) {
unsigned PY_LONG_LONG result = PyLong_AsUnsignedLongLong(pyIn);
if (OverFlowChecker<unsigned PY_LONG_LONG, unsigned PY_LONG_LONG>::check(result, pyIn))
- PyErr_SetObject(PyExc_OverflowError, 0);
+ PyErr_SetObject(PyExc_OverflowError, nullptr);
*reinterpret_cast<unsigned PY_LONG_LONG * >(cppOut) = result;
}
else {
@@ -362,11 +362,11 @@ struct Primitive<unsigned PY_LONG_LONG> : OnePrimitive<unsigned PY_LONG_LONG>
}
#endif // Python 2
}
- static PythonToCppFunc isConvertible(PyObject* pyIn)
+ static PythonToCppFunc isConvertible(PyObject *pyIn)
{
if (SbkNumber_Check(pyIn))
return toCpp;
- return 0;
+ return nullptr;
}
};
@@ -375,29 +375,29 @@ struct Primitive<unsigned PY_LONG_LONG> : OnePrimitive<unsigned PY_LONG_LONG>
template <typename FLOAT>
struct FloatPrimitive : TwoPrimitive<FLOAT>
{
- static PyObject* toPython(const void* cppIn)
+ static PyObject *toPython(const void *cppIn)
{
return PyFloat_FromDouble(*reinterpret_cast<const FLOAT *>(cppIn));
}
- static void toCpp(PyObject* pyIn, void* cppOut)
+ static void toCpp(PyObject *pyIn, void *cppOut)
{
*reinterpret_cast<FLOAT *>(cppOut) = FLOAT(PyLong_AsLong(pyIn));
}
- static PythonToCppFunc isConvertible(PyObject* pyIn)
+ static PythonToCppFunc isConvertible(PyObject *pyIn)
{
if (PyInt_Check(pyIn) || PyLong_Check(pyIn))
return toCpp;
- return 0;
+ return nullptr;
}
- static void otherToCpp(PyObject* pyIn, void* cppOut)
+ static void otherToCpp(PyObject *pyIn, void *cppOut)
{
*reinterpret_cast<FLOAT *>(cppOut) = FLOAT(PyFloat_AsDouble(pyIn));
}
- static PythonToCppFunc isOtherConvertible(PyObject* pyIn)
+ static PythonToCppFunc isOtherConvertible(PyObject *pyIn)
{
if (SbkNumber_Check(pyIn))
return otherToCpp;
- return 0;
+ return nullptr;
}
};
template <> struct Primitive<float> : FloatPrimitive<float> {};
@@ -408,17 +408,17 @@ template <> struct Primitive<double> : FloatPrimitive<double> {};
template <>
struct Primitive<bool> : OnePrimitive<bool>
{
- static PyObject* toPython(const void* cppIn)
+ static PyObject *toPython(const void *cppIn)
{
return PyBool_FromLong(*reinterpret_cast<const bool *>(cppIn));
}
- static PythonToCppFunc isConvertible(PyObject* pyIn)
+ static PythonToCppFunc isConvertible(PyObject *pyIn)
{
if (SbkNumber_Check(pyIn))
return toCpp;
- return 0;
+ return nullptr;
}
- static void toCpp(PyObject* pyIn, void* cppOut)
+ static void toCpp(PyObject *pyIn, void *cppOut)
{
*reinterpret_cast<bool *>(cppOut) = PyInt_AS_LONG(pyIn) != 0;
}
@@ -429,32 +429,32 @@ struct Primitive<bool> : OnePrimitive<bool>
template <typename CHAR>
struct CharPrimitive : IntPrimitive<CHAR>
{
- static void toCpp(PyObject* pyIn, void* cppOut)
+ static void toCpp(PyObject *pyIn, void *cppOut)
{
*reinterpret_cast<CHAR *>(cppOut) = CHAR(Shiboken::String::toCString(pyIn)[0]);
}
- static PythonToCppFunc isConvertible(PyObject* pyIn)
+ static PythonToCppFunc isConvertible(PyObject *pyIn)
{
if (Shiboken::String::checkChar(pyIn))
return toCpp;
- return 0;
+ return nullptr;
}
- static void otherToCpp(PyObject* pyIn, void* cppOut)
+ static void otherToCpp(PyObject *pyIn, void *cppOut)
{
PY_LONG_LONG result = PyLong_AsLongLong(pyIn);
if (OverFlowChecker<CHAR>::check(result, pyIn))
- PyErr_SetObject(PyExc_OverflowError, 0);
+ PyErr_SetObject(PyExc_OverflowError, nullptr);
*reinterpret_cast<CHAR *>(cppOut) = CHAR(result);
}
- static PythonToCppFunc isOtherConvertible(PyObject* pyIn)
+ static PythonToCppFunc isOtherConvertible(PyObject *pyIn)
{
if (SbkNumber_Check(pyIn))
return otherToCpp;
- return 0;
+ return nullptr;
}
- static SbkConverter* createConverter()
+ static SbkConverter *createConverter()
{
- SbkConverter* converter = IntPrimitive<CHAR>::createConverter();
+ SbkConverter *converter = IntPrimitive<CHAR>::createConverter();
Shiboken::Conversions::addPythonToCppValueConversion(converter, CharPrimitive<CHAR>::otherToCpp, CharPrimitive<CHAR>::isOtherConvertible);
return converter;
}
@@ -464,8 +464,8 @@ template <> struct Primitive<signed char> : CharPrimitive<signed char> {};
template <> struct Primitive<unsigned char> : CharPrimitive<unsigned char> {};
template <> struct Primitive<char> : CharPrimitive<char> {
using CharPrimitive<char>::toPython;
- static PyObject* toPython(const void* cppIn) {
- return Shiboken::String::fromCString((const char*)cppIn, 1);
+ static PyObject *toPython(const void *cppIn) {
+ return Shiboken::String::fromCString(reinterpret_cast<const char *>(cppIn), 1);
}
};
@@ -474,62 +474,62 @@ template <> struct Primitive<char> : CharPrimitive<char> {
// Strings ---------------------------------------------------------------------------------
template <>
-struct Primitive<const char*> : TwoPrimitive<const char*>
+struct Primitive<const char *> : TwoPrimitive<const char *>
{
- static PyObject* toPython(const void* cppIn)
+ static PyObject *toPython(const void *cppIn)
{
if (!cppIn)
Py_RETURN_NONE;
- return Shiboken::String::fromCString((const char*)cppIn);
+ return Shiboken::String::fromCString(reinterpret_cast<const char *>(cppIn));
}
static void toCpp(PyObject *, void *cppOut)
{
- *((const char**)cppOut) = 0;
+ *((const char **)cppOut) = nullptr;
}
- static PythonToCppFunc isConvertible(PyObject* pyIn)
+ static PythonToCppFunc isConvertible(PyObject *pyIn)
{
if (pyIn == Py_None)
return toCpp;
- return 0;
+ return nullptr;
}
- static void otherToCpp(PyObject* pyIn, void* cppOut)
+ static void otherToCpp(PyObject *pyIn, void *cppOut)
{
- *((const char**)cppOut) = (const char*) Shiboken::String::toCString(pyIn);
+ *reinterpret_cast<const char **>(cppOut) = Shiboken::String::toCString(pyIn);
}
- static PythonToCppFunc isOtherConvertible(PyObject* pyIn)
+ static PythonToCppFunc isOtherConvertible(PyObject *pyIn)
{
if (Shiboken::String::check(pyIn))
return otherToCpp;
- return 0;
+ return nullptr;
}
};
template <>
struct Primitive<std::string> : TwoPrimitive<std::string>
{
- static PyObject* toPython(const void* cppIn)
+ static PyObject *toPython(const void *cppIn)
{
- return Shiboken::String::fromCString(((std::string*)cppIn)->c_str());
+ return Shiboken::String::fromCString(reinterpret_cast<const std::string *>(cppIn)->c_str());
}
static void toCpp(PyObject *, void *cppOut)
{
- *((std::string*)cppOut) = std::string();
+ reinterpret_cast<std::string *>(cppOut)->clear();
}
- static PythonToCppFunc isConvertible(PyObject* pyIn)
+ static PythonToCppFunc isConvertible(PyObject *pyIn)
{
if (pyIn == Py_None)
return toCpp;
- return 0;
+ return nullptr;
}
- static void otherToCpp(PyObject* pyIn, void* cppOut)
+ static void otherToCpp(PyObject *pyIn, void *cppOut)
{
- *((std::string*)cppOut) = Shiboken::String::toCString(pyIn);
+ reinterpret_cast<std::string *>(cppOut)->assign(Shiboken::String::toCString(pyIn));
}
- static PythonToCppFunc isOtherConvertible(PyObject* pyIn)
+ static PythonToCppFunc isOtherConvertible(PyObject *pyIn)
{
if (Shiboken::String::check(pyIn))
return otherToCpp;
- return 0;
+ return nullptr;
}
};
@@ -537,25 +537,25 @@ struct Primitive<std::string> : TwoPrimitive<std::string>
template <>
struct Primitive<std::nullptr_t> : TwoPrimitive<std::nullptr_t>
{
- static PyObject* toPython(const void* cppIn)
+ static PyObject *toPython(const void * /* cppIn */)
{
return Py_None;
}
static void toCpp(PyObject *, void *cppOut)
{
- *reinterpret_cast<std::nullptr_t*>(cppOut) = nullptr;
+ *reinterpret_cast<std::nullptr_t *>(cppOut) = nullptr;
}
- static PythonToCppFunc isConvertible(PyObject* pyIn)
+ static PythonToCppFunc isConvertible(PyObject *pyIn)
{
if (pyIn == Py_None)
return toCpp;
return nullptr;
}
- static void otherToCpp(PyObject* pyIn, void* cppOut)
+ static void otherToCpp(PyObject * /* pyIn */, void *cppOut)
{
- *reinterpret_cast<std::nullptr_t*>(cppOut) = nullptr;
+ *reinterpret_cast<std::nullptr_t *>(cppOut) = nullptr;
}
- static PythonToCppFunc isOtherConvertible(PyObject* pyIn)
+ static PythonToCppFunc isOtherConvertible(PyObject *pyIn)
{
if (pyIn == nullptr)
return otherToCpp;
diff --git a/sources/shiboken2/libshiboken/sbkdbg.h b/sources/shiboken2/libshiboken/sbkdbg.h
index fdaf2a27a..02ea773ac 100644
--- a/sources/shiboken2/libshiboken/sbkdbg.h
+++ b/sources/shiboken2/libshiboken/sbkdbg.h
@@ -63,20 +63,20 @@
class BaseLogger
{
public:
- BaseLogger(const BaseLogger&) = delete;
- BaseLogger(BaseLogger&&) = delete;
- BaseLogger& operator=(const BaseLogger&) = delete;
- BaseLogger& operator=(BaseLogger&&) = delete;
+ BaseLogger(const BaseLogger &) = delete;
+ BaseLogger(BaseLogger &&) = delete;
+ BaseLogger &operator=(const BaseLogger &) = delete;
+ BaseLogger &operator=(BaseLogger &&) = delete;
- BaseLogger(std::ostream& output, const char* function, const char* context)
+ BaseLogger(std::ostream &output, const char *function, const char *context)
: m_stream(output), m_function(function), m_context(context) {}
~BaseLogger()
{
m_stream << std::endl;
}
- std::ostream& operator()() { return m_stream; };
+ std::ostream &operator()() { return m_stream; };
template <typename T>
- std::ostream& operator<<(const T& t)
+ std::ostream &operator<<(const T &t)
{
m_stream << '[';
if (m_context[0])
@@ -84,24 +84,24 @@ public:
return m_stream << COLOR_WHITE << m_function << COLOR_END << "] " << t;
}
private:
- std::ostream& m_stream;
- const char* m_function;
- const char* m_context;
+ std::ostream &m_stream;
+ const char *m_function;
+ const char *m_context;
};
-inline std::ostream& operator<<(std::ostream& out, PyObject* obj)
+inline std::ostream &operator<<(std::ostream &out, PyObject *obj)
{
- PyObject* repr = Shiboken::Object::isValid(obj, false) ? PyObject_Repr(obj) : 0;
+ PyObject *repr = Shiboken::Object::isValid(obj, false) ? PyObject_Repr(obj) : 0;
if (repr) {
#ifdef IS_PY3K
- PyObject* str = PyUnicode_AsUTF8String(repr);
+ PyObject *str = PyUnicode_AsUTF8String(repr);
Py_DECREF(repr);
repr = str;
#endif
out << PyBytes_AS_STRING(repr);
Py_DECREF(repr);
} else {
- out << reinterpret_cast<void*>(obj);
+ out << reinterpret_cast<void *>(obj);
}
return out;
}
@@ -109,7 +109,7 @@ inline std::ostream& operator<<(std::ostream& out, PyObject* obj)
class _SbkDbg : public BaseLogger
{
public:
- _SbkDbg(const char* function, const char* context = "") : BaseLogger(std::cout, function, context) {}
+ _SbkDbg(const char *function, const char *context = "") : BaseLogger(std::cout, function, context) {}
};
#ifdef __GNUG__
@@ -122,7 +122,7 @@ public:
struct SbkDbg {
template <typename T>
- SbkDbg& operator<<(const T&) { return *this; }
+ SbkDbg &operator<<(const T &) { return *this; }
};
#endif
diff --git a/sources/shiboken2/libshiboken/sbkenum.cpp b/sources/shiboken2/libshiboken/sbkenum.cpp
index 26b40c3cb..71fcf5f64 100644
--- a/sources/shiboken2/libshiboken/sbkenum.cpp
+++ b/sources/shiboken2/libshiboken/sbkenum.cpp
@@ -49,18 +49,18 @@
#include <cstring>
#include <vector>
-#define SBK_ENUM(ENUM) reinterpret_cast<SbkEnumObject*>(ENUM)
+#define SBK_ENUM(ENUM) reinterpret_cast<SbkEnumObject *>(ENUM)
#define SBK_TYPE_CHECK(o) (strcmp(Py_TYPE(Py_TYPE(o))->tp_name, "Shiboken.EnumType") == 0)
-typedef PyObject* (*enum_func)(PyObject*, PyObject*);
+typedef PyObject *(*enum_func)(PyObject *, PyObject *);
extern "C"
{
struct SbkEnumTypePrivate
{
- SbkConverter** converterPtr;
- SbkConverter* converter;
- const char* cppName;
+ SbkConverter **converterPtr;
+ SbkConverter *converter;
+ const char *cppName;
};
struct SbkEnumType
@@ -72,10 +72,10 @@ struct SbkEnumObject
{
PyObject_HEAD
long ob_value;
- PyObject* ob_name;
+ PyObject *ob_name;
};
-static PyObject* SbkEnumObject_repr(PyObject* self)
+static PyObject *SbkEnumObject_repr(PyObject *self)
{
const SbkEnumObject *enumObj = SBK_ENUM(self);
if (enumObj->ob_name)
@@ -84,38 +84,38 @@ static PyObject* SbkEnumObject_repr(PyObject* self)
return Shiboken::String::fromFormat("%s(%ld)", (Py_TYPE(self))->tp_name, enumObj->ob_value);
}
-static PyObject* SbkEnumObject_name(PyObject* self, void*)
+static PyObject *SbkEnumObject_name(PyObject *self, void *)
{
- SbkEnumObject *enum_self = SBK_ENUM(self);
+ auto *enum_self = SBK_ENUM(self);
- if (enum_self->ob_name == NULL)
+ if (enum_self->ob_name == nullptr)
Py_RETURN_NONE;
Py_INCREF(enum_self->ob_name);
return enum_self->ob_name;
}
-static PyObject* SbkEnum_tp_new(PyTypeObject *type, PyObject *args, PyObject *)
+static PyObject *SbkEnum_tp_new(PyTypeObject *type, PyObject *args, PyObject *)
{
long itemValue = 0;
if (!PyArg_ParseTuple(args, "|l:__new__", &itemValue))
- return 0;
+ return nullptr;
- SbkEnumObject* self = PyObject_New(SbkEnumObject, type);
+ SbkEnumObject *self = PyObject_New(SbkEnumObject, type);
if (!self)
- return 0;
+ return nullptr;
self->ob_value = itemValue;
- PyObject* item = Shiboken::Enum::getEnumItemFromValue(type, itemValue);
+ PyObject *item = Shiboken::Enum::getEnumItemFromValue(type, itemValue);
if (item) {
- self->ob_name = SbkEnumObject_name(item, 0);
+ self->ob_name = SbkEnumObject_name(item, nullptr);
Py_XDECREF(item);
} else {
- self->ob_name = 0;
+ self->ob_name = nullptr;
}
- return reinterpret_cast<PyObject*>(self);
+ return reinterpret_cast<PyObject *>(self);
}
-static PyObject* enum_op(enum_func f, PyObject *a, PyObject *b) {
+static PyObject *enum_op(enum_func f, PyObject *a, PyObject *b) {
PyObject *valA = a;
PyObject *valB = b;
PyObject *result = nullptr;
@@ -160,54 +160,54 @@ static PyObject* enum_op(enum_func f, PyObject *a, PyObject *b) {
* Thus calling PyInt_FromLong() will result in calling PyLong_FromLong in
* Py3k.
*/
-static PyObject* enum_int(PyObject* v)
+static PyObject *enum_int(PyObject *v)
{
return PyInt_FromLong(SBK_ENUM(v)->ob_value);
}
-static PyObject* enum_and(PyObject* self, PyObject* b)
+static PyObject *enum_and(PyObject *self, PyObject *b)
{
return enum_op(PyNumber_And, self, b);
}
-static PyObject* enum_or(PyObject* self, PyObject* b)
+static PyObject *enum_or(PyObject *self, PyObject *b)
{
return enum_op(PyNumber_Or, self, b);
}
-static PyObject* enum_xor(PyObject* self, PyObject* b)
+static PyObject *enum_xor(PyObject *self, PyObject *b)
{
return enum_op(PyNumber_Xor, self, b);
}
-static int enum_bool(PyObject* v)
+static int enum_bool(PyObject *v)
{
return (SBK_ENUM(v)->ob_value > 0);
}
-static PyObject* enum_add(PyObject* self, PyObject* v)
+static PyObject *enum_add(PyObject *self, PyObject *v)
{
return enum_op(PyNumber_Add, self, v);
}
-static PyObject* enum_subtract(PyObject* self, PyObject* v)
+static PyObject *enum_subtract(PyObject *self, PyObject *v)
{
return enum_op(PyNumber_Subtract, self, v);
}
-static PyObject* enum_multiply(PyObject* self, PyObject* v)
+static PyObject *enum_multiply(PyObject *self, PyObject *v)
{
return enum_op(PyNumber_Multiply, self, v);
}
#ifndef IS_PY3K
-static PyObject* enum_divide(PyObject* self, PyObject* v)
+static PyObject *enum_divide(PyObject *self, PyObject *v)
{
return enum_op(PyNumber_Divide, self, v);
}
#endif
-static PyObject* enum_richcompare(PyObject* self, PyObject* other, int op)
+static PyObject *enum_richcompare(PyObject *self, PyObject *other, int op)
{
PyObject *valA = self;
PyObject *valB = other;
@@ -233,9 +233,8 @@ static PyObject* enum_richcompare(PyObject* self, PyObject* other, int op)
if (!(enumA || enumB)) {
Py_INCREF(Py_NotImplemented);
return Py_NotImplemented;
- } else {
- result = PyObject_RichCompare(valA, valB, op);
}
+ result = PyObject_RichCompare(valA, valB, op);
// Decreasing the reference of the used variables a and b.
if (enumA)
@@ -246,21 +245,21 @@ static PyObject* enum_richcompare(PyObject* self, PyObject* other, int op)
return result;
}
-static Py_hash_t enum_hash(PyObject* pyObj)
+static Py_hash_t enum_hash(PyObject *pyObj)
{
- Py_hash_t val = reinterpret_cast<SbkEnumObject*>(pyObj)->ob_value;
+ Py_hash_t val = reinterpret_cast<SbkEnumObject *>(pyObj)->ob_value;
if (val == -1)
val = -2;
return val;
}
static PyGetSetDef SbkEnumGetSetList[] = {
- {const_cast<char*>("name"), &SbkEnumObject_name, 0, 0, 0},
- {0, 0, 0, 0, 0} // Sentinel
+ {const_cast<char *>("name"), &SbkEnumObject_name, nullptr, nullptr, nullptr},
+ {nullptr, nullptr, nullptr, nullptr, nullptr} // Sentinel
};
-static void SbkEnumTypeDealloc(PyObject* pyObj);
-static PyObject* SbkEnumTypeTpNew(PyTypeObject* metatype, PyObject* args, PyObject* kwds);
+static void SbkEnumTypeDealloc(PyObject *pyObj);
+static PyObject *SbkEnumTypeTpNew(PyTypeObject *metatype, PyObject *args, PyObject *kwds);
static PyType_Slot SbkEnumType_Type_slots[] = {
{Py_tp_dealloc, (void *)SbkEnumTypeDealloc},
@@ -286,7 +285,7 @@ static PyType_Slot SbkEnumType_Type_slots[] = {
{Py_tp_alloc, (void *)PyType_GenericAlloc},
{Py_tp_new, (void *)SbkEnumTypeTpNew},
{Py_tp_free, (void *)PyObject_GC_Del},
- {0, 0}
+ {0, nullptr}
};
static PyType_Spec SbkEnumType_Type_spec = {
"Shiboken.EnumType",
@@ -308,9 +307,9 @@ PyTypeObject *SbkEnumType_TypeF(void)
return type;
}
-void SbkEnumTypeDealloc(PyObject* pyObj)
+void SbkEnumTypeDealloc(PyObject *pyObj)
{
- SbkEnumType* sbkType = reinterpret_cast<SbkEnumType*>(pyObj);
+ auto sbkType = reinterpret_cast<SbkEnumType *>(pyObj);
PyObject_GC_UnTrack(pyObj);
#ifndef Py_LIMITED_API
@@ -324,13 +323,13 @@ void SbkEnumTypeDealloc(PyObject* pyObj)
#endif
}
-PyObject* SbkEnumTypeTpNew(PyTypeObject* metatype, PyObject* args, PyObject* kwds)
+PyObject *SbkEnumTypeTpNew(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
{
- newfunc type_new = reinterpret_cast<newfunc>(PyType_GetSlot(&PyType_Type, Py_tp_new));
- SbkEnumType *newType = reinterpret_cast<SbkEnumType*>(type_new(metatype, args, kwds));
+ auto type_new = reinterpret_cast<newfunc>(PyType_GetSlot(&PyType_Type, Py_tp_new));
+ auto newType = reinterpret_cast<SbkEnumType *>(type_new(metatype, args, kwds));
if (!newType)
- return 0;
- return reinterpret_cast<PyObject*>(newType);
+ return nullptr;
+ return reinterpret_cast<PyObject *>(newType);
}
} // extern "C"
@@ -340,15 +339,15 @@ namespace Shiboken {
class DeclaredEnumTypes
{
public:
- DeclaredEnumTypes(const DeclaredEnumTypes&) = delete;
- DeclaredEnumTypes(DeclaredEnumTypes&&) = delete;
- DeclaredEnumTypes& operator=(const DeclaredEnumTypes&) = delete;
- DeclaredEnumTypes& operator=(DeclaredEnumTypes&&) = delete;
+ DeclaredEnumTypes(const DeclaredEnumTypes &) = delete;
+ DeclaredEnumTypes(DeclaredEnumTypes &&) = delete;
+ DeclaredEnumTypes &operator=(const DeclaredEnumTypes &) = delete;
+ DeclaredEnumTypes &operator=(DeclaredEnumTypes &&) = delete;
DeclaredEnumTypes();
~DeclaredEnumTypes();
- static DeclaredEnumTypes& instance();
- void addEnumType(PyTypeObject* type);
+ static DeclaredEnumTypes &instance();
+ void addEnumType(PyTypeObject *type);
private:
std::vector<PyTypeObject *> m_enumTypes;
@@ -356,51 +355,51 @@ private:
namespace Enum {
-bool check(PyObject* pyObj)
+bool check(PyObject *pyObj)
{
return Py_TYPE(Py_TYPE(pyObj)) == SbkEnumType_TypeF();
}
-PyObject* getEnumItemFromValue(PyTypeObject* enumType, long itemValue)
+PyObject *getEnumItemFromValue(PyTypeObject *enumType, long itemValue)
{
PyObject *key, *value;
Py_ssize_t pos = 0;
- PyObject *values = PyDict_GetItemString(enumType->tp_dict, const_cast<char*>("values"));
+ PyObject *values = PyDict_GetItemString(enumType->tp_dict, const_cast<char *>("values"));
while (PyDict_Next(values, &pos, &key, &value)) {
- SbkEnumObject *obj = reinterpret_cast<SbkEnumObject *>(value);
+ auto *obj = reinterpret_cast<SbkEnumObject *>(value);
if (obj->ob_value == itemValue) {
Py_INCREF(obj);
return value;
}
}
- return 0;
+ return nullptr;
}
-static PyTypeObject* createEnum(const char* fullName, const char* cppName,
- const char* /* shortName */,
- PyTypeObject* flagsType)
+static PyTypeObject *createEnum(const char *fullName, const char *cppName,
+ const char */* shortName */,
+ PyTypeObject *flagsType)
{
- PyTypeObject* enumType = newTypeWithName(fullName, cppName, flagsType);
+ PyTypeObject *enumType = newTypeWithName(fullName, cppName, flagsType);
if (PyType_Ready(enumType) < 0)
- return 0;
+ return nullptr;
return enumType;
}
-PyTypeObject* createGlobalEnum(PyObject* module, const char* name, const char* fullName, const char* cppName, PyTypeObject* flagsType)
+PyTypeObject *createGlobalEnum(PyObject *module, const char *name, const char *fullName, const char *cppName, PyTypeObject *flagsType)
{
- PyTypeObject* enumType = createEnum(fullName, cppName, name, flagsType);
+ PyTypeObject *enumType = createEnum(fullName, cppName, name, flagsType);
if (enumType && PyModule_AddObject(module, name, reinterpret_cast<PyObject *>(enumType)) < 0)
- return 0;
+ return nullptr;
if (flagsType && PyModule_AddObject(module, PepType_GetNameStr(flagsType),
reinterpret_cast<PyObject *>(flagsType)) < 0)
- return 0;
+ return nullptr;
return enumType;
}
-PyTypeObject* createScopedEnum(SbkObjectType* scope, const char* name, const char* fullName, const char* cppName, PyTypeObject* flagsType)
+PyTypeObject *createScopedEnum(SbkObjectType *scope, const char *name, const char *fullName, const char *cppName, PyTypeObject *flagsType)
{
- PyTypeObject* enumType = createEnum(fullName, cppName, name, flagsType);
+ PyTypeObject *enumType = createEnum(fullName, cppName, name, flagsType);
if (enumType && PyDict_SetItemString(reinterpret_cast<PyTypeObject *>(scope)->tp_dict, name,
reinterpret_cast<PyObject *>(enumType)) < 0)
return nullptr;
@@ -411,18 +410,18 @@ PyTypeObject* createScopedEnum(SbkObjectType* scope, const char* name, const cha
return enumType;
}
-static PyObject* createEnumItem(PyTypeObject* enumType, const char* itemName, long itemValue)
+static PyObject *createEnumItem(PyTypeObject *enumType, const char *itemName, long itemValue)
{
- PyObject* enumItem = newItem(enumType, itemValue, itemName);
+ PyObject *enumItem = newItem(enumType, itemValue, itemName);
if (PyDict_SetItemString(enumType->tp_dict, itemName, enumItem) < 0)
- return 0;
+ return nullptr;
Py_DECREF(enumItem);
return enumItem;
}
-bool createGlobalEnumItem(PyTypeObject* enumType, PyObject* module, const char* itemName, long itemValue)
+bool createGlobalEnumItem(PyTypeObject *enumType, PyObject *module, const char *itemName, long itemValue)
{
- PyObject* enumItem = createEnumItem(enumType, itemName, itemValue);
+ PyObject *enumItem = createEnumItem(enumType, itemName, itemValue);
if (enumItem) {
if (PyModule_AddObject(module, itemName, enumItem) < 0)
return false;
@@ -449,7 +448,7 @@ bool createScopedEnumItem(PyTypeObject *enumType, PyTypeObject *scope,
return false;
}
-bool createScopedEnumItem(PyTypeObject* enumType, SbkObjectType* scope, const char* itemName, long itemValue)
+bool createScopedEnumItem(PyTypeObject *enumType, SbkObjectType *scope, const char *itemName, long itemValue)
{
return createScopedEnumItem(enumType, reinterpret_cast<PyTypeObject *>(scope), itemName, itemValue);
}
@@ -458,34 +457,34 @@ PyObject *
newItem(PyTypeObject *enumType, long itemValue, const char *itemName)
{
bool newValue = true;
- SbkEnumObject* enumObj;
+ SbkEnumObject *enumObj;
if (!itemName) {
- enumObj = reinterpret_cast<SbkEnumObject*>(
+ enumObj = reinterpret_cast<SbkEnumObject *>(
getEnumItemFromValue(enumType, itemValue));
if (enumObj)
- return reinterpret_cast<PyObject*>(enumObj);
+ return reinterpret_cast<PyObject *>(enumObj);
newValue = false;
}
enumObj = PyObject_New(SbkEnumObject, enumType);
if (!enumObj)
- return 0;
+ return nullptr;
- enumObj->ob_name = itemName ? PyBytes_FromString(itemName) : 0;
+ enumObj->ob_name = itemName ? PyBytes_FromString(itemName) : nullptr;
enumObj->ob_value = itemValue;
if (newValue) {
- PyObject* values = PyDict_GetItemString(enumType->tp_dict, const_cast<char*>("values"));
+ PyObject *values = PyDict_GetItemString(enumType->tp_dict, const_cast<char *>("values"));
if (!values) {
values = PyDict_New();
- PyDict_SetItemString(enumType->tp_dict, const_cast<char*>("values"), values);
+ PyDict_SetItemString(enumType->tp_dict, const_cast<char *>("values"), values);
Py_DECREF(values); // ^ values still alive, because setitemstring incref it
}
- PyDict_SetItemString(values, itemName, reinterpret_cast<PyObject*>(enumObj));
+ PyDict_SetItemString(values, itemName, reinterpret_cast<PyObject *>(enumObj));
}
- return reinterpret_cast<PyObject*>(enumObj);
+ return reinterpret_cast<PyObject *>(enumObj);
}
static PyType_Slot SbkNewType_slots[] = {
@@ -514,7 +513,7 @@ static PyType_Slot SbkNewType_slots[] = {
{Py_tp_richcompare, (void *)enum_richcompare},
{Py_tp_hash, (void *)enum_hash},
{Py_tp_dealloc, (void *)object_dealloc},
- {0, 0}
+ {0, nullptr}
};
static PyType_Spec SbkNewType_spec = {
"missing Enum name", // to be inserted later
@@ -581,13 +580,13 @@ copyNumberMethods(PyTypeObject *flagsType,
}
PyTypeObject *
-newTypeWithName(const char* name,
- const char* cppName,
+newTypeWithName(const char *name,
+ const char *cppName,
PyTypeObject *numbers_fromFlag)
{
// Careful: PyType_FromSpec does not allocate the string.
PyType_Slot newslots[99] = {}; // enough but not too big for the stack
- PyType_Spec *newspec = new PyType_Spec;
+ auto *newspec = new PyType_Spec;
newspec->name = strdup(name);
newspec->basicsize = SbkNewType_spec.basicsize;
newspec->itemsize = SbkNewType_spec.itemsize;
@@ -602,44 +601,44 @@ newTypeWithName(const char* name,
if (numbers_fromFlag)
copyNumberMethods(numbers_fromFlag, newslots, &idx);
newspec->slots = newslots;
- PyTypeObject *type = reinterpret_cast<PyTypeObject *>(PyType_FromSpec(newspec));
+ auto *type = reinterpret_cast<PyTypeObject *>(PyType_FromSpec(newspec));
Py_TYPE(type) = SbkEnumType_TypeF();
Py_INCREF(Py_TYPE(type));
- SbkEnumType* enumType = reinterpret_cast<SbkEnumType*>(type);
+ auto *enumType = reinterpret_cast<SbkEnumType *>(type);
PepType_SETP(enumType)->cppName = cppName;
PepType_SETP(enumType)->converterPtr = &PepType_SETP(enumType)->converter;
DeclaredEnumTypes::instance().addEnumType(type);
return type;
}
-const char* getCppName(PyTypeObject* enumType)
+const char *getCppName(PyTypeObject *enumType)
{
assert(Py_TYPE(enumType) == SbkEnumType_TypeF());
- return PepType_SETP(reinterpret_cast<SbkEnumType*>(enumType))->cppName;
+ return PepType_SETP(reinterpret_cast<SbkEnumType *>(enumType))->cppName;
}
-long int getValue(PyObject* enumItem)
+long int getValue(PyObject *enumItem)
{
assert(Shiboken::Enum::check(enumItem));
- return reinterpret_cast<SbkEnumObject*>(enumItem)->ob_value;
+ return reinterpret_cast<SbkEnumObject *>(enumItem)->ob_value;
}
-void setTypeConverter(PyTypeObject* enumType, SbkConverter* converter)
+void setTypeConverter(PyTypeObject *enumType, SbkConverter *converter)
{
- //reinterpret_cast<SbkEnumType*>(enumType)->converter = converter;
+ //reinterpret_cast<SbkEnumType *>(enumType)->converter = converter;
*PepType_SGTP(enumType)->converter = converter;
}
-SbkConverter* getTypeConverter(PyTypeObject* enumType)
+SbkConverter *getTypeConverter(PyTypeObject *enumType)
{
- //return reinterpret_cast<SbkEnumType*>(enumType)->converter;
+ //return reinterpret_cast<SbkEnumType *>(enumType)->converter;
return *PepType_SGTP(enumType)->converter;
}
} // namespace Enum
-DeclaredEnumTypes& DeclaredEnumTypes::instance()
+DeclaredEnumTypes &DeclaredEnumTypes::instance()
{
static DeclaredEnumTypes me;
return me;
@@ -662,7 +661,7 @@ DeclaredEnumTypes::~DeclaredEnumTypes()
m_enumTypes.clear();
}
-void DeclaredEnumTypes::addEnumType(PyTypeObject* type)
+void DeclaredEnumTypes::addEnumType(PyTypeObject *type)
{
m_enumTypes.push_back(type);
}
diff --git a/sources/shiboken2/libshiboken/sbkenum.h b/sources/shiboken2/libshiboken/sbkenum.h
index c1ec7c4c1..759d72636 100644
--- a/sources/shiboken2/libshiboken/sbkenum.h
+++ b/sources/shiboken2/libshiboken/sbkenum.h
@@ -57,14 +57,14 @@ struct SbkEnumTypePrivate;
namespace Shiboken
{
-inline bool isShibokenEnum(PyObject* pyObj)
+inline bool isShibokenEnum(PyObject *pyObj)
{
return Py_TYPE(Py_TYPE(pyObj)) == SbkEnumType_TypeF();
}
namespace Enum
{
- LIBSHIBOKEN_API bool check(PyObject* obj);
+ LIBSHIBOKEN_API bool check(PyObject *obj);
/**
* Creates a new enum type (and its flags type, if any is given)
* and registers it to Python and adds it to \p module.
@@ -75,17 +75,17 @@ namespace Enum
* \param flagsType Optional Python type for the flags associated with the enum.
* \return The new enum type or NULL if it fails.
*/
- LIBSHIBOKEN_API PyTypeObject* createGlobalEnum(PyObject* module,
- const char* name,
- const char* fullName,
- const char* cppName,
- PyTypeObject* flagsType = 0);
+ LIBSHIBOKEN_API PyTypeObject *createGlobalEnum(PyObject *module,
+ const char *name,
+ const char *fullName,
+ const char *cppName,
+ PyTypeObject *flagsType = nullptr);
/// This function does the same as createGlobalEnum, but adds the enum to a Shiboken type or namespace.
- LIBSHIBOKEN_API PyTypeObject* createScopedEnum(SbkObjectType* scope,
- const char* name,
- const char* fullName,
- const char* cppName,
- PyTypeObject* flagsType = 0);
+ LIBSHIBOKEN_API PyTypeObject *createScopedEnum(SbkObjectType *scope,
+ const char *name,
+ const char *fullName,
+ const char *cppName,
+ PyTypeObject *flagsType = nullptr);
/**
* Creates a new enum item for a given enum type and adds it to \p module.
@@ -95,25 +95,25 @@ namespace Enum
* \param itemValue Numerical value of the enum item.
* \return true if everything goes fine, false if it fails.
*/
- LIBSHIBOKEN_API bool createGlobalEnumItem(PyTypeObject* enumType, PyObject* module, const char* itemName, long itemValue);
+ LIBSHIBOKEN_API bool createGlobalEnumItem(PyTypeObject *enumType, PyObject *module, const char *itemName, long itemValue);
/// This function does the same as createGlobalEnumItem, but adds the enum to a Shiboken type or namespace.
LIBSHIBOKEN_API bool createScopedEnumItem(PyTypeObject *enumType, PyTypeObject *scope,
const char *itemName, long itemValue);
- LIBSHIBOKEN_API bool createScopedEnumItem(PyTypeObject* enumType, SbkObjectType* scope, const char* itemName, long itemValue);
+ LIBSHIBOKEN_API bool createScopedEnumItem(PyTypeObject *enumType, SbkObjectType *scope, const char *itemName, long itemValue);
- LIBSHIBOKEN_API PyObject* newItem(PyTypeObject* enumType, long itemValue, const char* itemName = 0);
+ LIBSHIBOKEN_API PyObject *newItem(PyTypeObject *enumType, long itemValue, const char *itemName = nullptr);
- LIBSHIBOKEN_API PyTypeObject* newTypeWithName(const char* name, const char* cppName,
+ LIBSHIBOKEN_API PyTypeObject *newTypeWithName(const char *name, const char *cppName,
PyTypeObject *numbers_fromFlag=nullptr);
- LIBSHIBOKEN_API const char* getCppName(PyTypeObject* type);
+ LIBSHIBOKEN_API const char *getCppName(PyTypeObject *type);
- LIBSHIBOKEN_API long getValue(PyObject* enumItem);
- LIBSHIBOKEN_API PyObject* getEnumItemFromValue(PyTypeObject* enumType, long itemValue);
+ LIBSHIBOKEN_API long getValue(PyObject *enumItem);
+ LIBSHIBOKEN_API PyObject *getEnumItemFromValue(PyTypeObject *enumType, long itemValue);
/// Sets the enum's type converter.
- LIBSHIBOKEN_API void setTypeConverter(PyTypeObject* enumType, SbkConverter* converter);
+ LIBSHIBOKEN_API void setTypeConverter(PyTypeObject *enumType, SbkConverter *converter);
/// Returns the converter assigned to the enum \p type.
- LIBSHIBOKEN_API SbkConverter* getTypeConverter(PyTypeObject* enumType);
+ LIBSHIBOKEN_API SbkConverter *getTypeConverter(PyTypeObject *enumType);
}
} // namespace Shiboken
diff --git a/sources/shiboken2/libshiboken/sbkmodule.cpp b/sources/shiboken2/libshiboken/sbkmodule.cpp
index a29ec38c7..9321725d6 100644
--- a/sources/shiboken2/libshiboken/sbkmodule.cpp
+++ b/sources/shiboken2/libshiboken/sbkmodule.cpp
@@ -43,10 +43,10 @@
#include <unordered_map>
/// This hash maps module objects to arrays of Python types.
-typedef std::unordered_map<PyObject *, PyTypeObject **> ModuleTypesMap;
+using ModuleTypesMap = std::unordered_map<PyObject *, PyTypeObject **> ;
/// This hash maps module objects to arrays of converters.
-typedef std::unordered_map<PyObject *, SbkConverter **> ModuleConvertersMap;
+using ModuleConvertersMap = std::unordered_map<PyObject *, SbkConverter **>;
/// All types produced in imported modules are mapped here.
static ModuleTypesMap moduleTypes;
@@ -57,10 +57,10 @@ namespace Shiboken
namespace Module
{
-PyObject* import(const char* moduleName)
+PyObject *import(const char *moduleName)
{
- PyObject* sysModules = PyImport_GetModuleDict();
- PyObject* module = PyDict_GetItemString(sysModules, moduleName);
+ PyObject *sysModules = PyImport_GetModuleDict();
+ PyObject *module = PyDict_GetItemString(sysModules, moduleName);
if (module)
Py_INCREF(module);
else
@@ -72,39 +72,39 @@ PyObject* import(const char* moduleName)
return module;
}
-PyObject* create(const char* moduleName, void* moduleData)
+PyObject *create(const char *moduleName, void *moduleData)
{
Shiboken::init();
#ifndef IS_PY3K
return Py_InitModule(moduleName, reinterpret_cast<PyMethodDef *>(moduleData));
#else
- return PyModule_Create(reinterpret_cast<PyModuleDef*>(moduleData));
+ return PyModule_Create(reinterpret_cast<PyModuleDef *>(moduleData));
#endif
}
-void registerTypes(PyObject* module, PyTypeObject** types)
+void registerTypes(PyObject *module, PyTypeObject **types)
{
- ModuleTypesMap::iterator iter = moduleTypes.find(module);
+ auto iter = moduleTypes.find(module);
if (iter == moduleTypes.end())
moduleTypes.insert(std::make_pair(module, types));
}
-PyTypeObject** getTypes(PyObject* module)
+PyTypeObject **getTypes(PyObject *module)
{
- ModuleTypesMap::iterator iter = moduleTypes.find(module);
+ auto iter = moduleTypes.find(module);
return (iter == moduleTypes.end()) ? 0 : iter->second;
}
-void registerTypeConverters(PyObject* module, SbkConverter** converters)
+void registerTypeConverters(PyObject *module, SbkConverter **converters)
{
- ModuleConvertersMap::iterator iter = moduleConverters.find(module);
+ auto iter = moduleConverters.find(module);
if (iter == moduleConverters.end())
moduleConverters.insert(std::make_pair(module, converters));
}
-SbkConverter** getTypeConverters(PyObject* module)
+SbkConverter **getTypeConverters(PyObject *module)
{
- ModuleConvertersMap::iterator iter = moduleConverters.find(module);
+ auto iter = moduleConverters.find(module);
return (iter == moduleConverters.end()) ? 0 : iter->second;
}
diff --git a/sources/shiboken2/libshiboken/sbkmodule.h b/sources/shiboken2/libshiboken/sbkmodule.h
index 659c41c4d..75eff5a79 100644
--- a/sources/shiboken2/libshiboken/sbkmodule.h
+++ b/sources/shiboken2/libshiboken/sbkmodule.h
@@ -46,7 +46,7 @@
#if PY_MAJOR_VERSION >= 3
#define SBK_MODULE_INIT_ERROR 0
#define SBK_MODULE_INIT_FUNCTION_BEGIN(ModuleName) \
- extern "C" SBK_EXPORT_MODULE PyObject* PyInit_##ModuleName() {
+ extern "C" SBK_EXPORT_MODULE PyObject *PyInit_##ModuleName() {
#define SBK_MODULE_INIT_FUNCTION_END \
return module; }
@@ -72,43 +72,43 @@ namespace Module {
* If the module is already imported, it increments its reference count before returning it.
* \returns the module specified in \p moduleName or NULL if an error occurs.
*/
-LIBSHIBOKEN_API PyObject* import(const char* moduleName);
+LIBSHIBOKEN_API PyObject *import(const char *moduleName);
/**
* Creates a new Python module named \p moduleName using the information passed in \p moduleData.
- * In fact, \p moduleData expects a "PyMethodDef*" object, but that's for Python 2. A void*
+ * In fact, \p moduleData expects a "PyMethodDef *" object, but that's for Python 2. A "void*"
* was preferred to make this work with future Python 3 support.
* \returns a newly created module.
*/
-LIBSHIBOKEN_API PyObject* create(const char* moduleName, void* moduleData);
+LIBSHIBOKEN_API PyObject *create(const char *moduleName, void *moduleData);
/**
* Registers the list of types created by \p module.
* \param module Module where the types were created.
- * \param types Array of PyTypeObject* objects representing the types created on \p module.
+ * \param types Array of PyTypeObject *objects representing the types created on \p module.
*/
-LIBSHIBOKEN_API void registerTypes(PyObject* module, PyTypeObject** types);
+LIBSHIBOKEN_API void registerTypes(PyObject *module, PyTypeObject **types);
/**
* Retrieves the array of types.
* \param module Module where the types were created.
- * \returns A pointer to the PyTypeObject* array of types.
+ * \returns A pointer to the PyTypeObject *array of types.
*/
-LIBSHIBOKEN_API PyTypeObject** getTypes(PyObject* module);
+LIBSHIBOKEN_API PyTypeObject **getTypes(PyObject *module);
/**
* Registers the list of converters created by \p module for non-wrapper types.
* \param module Module where the converters were created.
- * \param converters Array of SbkConverter* objects representing the converters created on \p module.
+ * \param converters Array of SbkConverter *objects representing the converters created on \p module.
*/
-LIBSHIBOKEN_API void registerTypeConverters(PyObject* module, SbkConverter** converters);
+LIBSHIBOKEN_API void registerTypeConverters(PyObject *module, SbkConverter **converters);
/**
* Retrieves the array of converters.
* \param module Module where the converters were created.
- * \returns A pointer to the SbkConverter* array of converters.
+ * \returns A pointer to the SbkConverter *array of converters.
*/
-LIBSHIBOKEN_API SbkConverter** getTypeConverters(PyObject* module);
+LIBSHIBOKEN_API SbkConverter **getTypeConverters(PyObject *module);
} } // namespace Shiboken::Module
diff --git a/sources/shiboken2/libshiboken/sbknumpyarrayconverter.cpp b/sources/shiboken2/libshiboken/sbknumpyarrayconverter.cpp
index 8bc680796..996968fa1 100644
--- a/sources/shiboken2/libshiboken/sbknumpyarrayconverter.cpp
+++ b/sources/shiboken2/libshiboken/sbknumpyarrayconverter.cpp
@@ -138,7 +138,7 @@ static bool isPrimitiveArray(PyObject *pyIn, int expectedNpType)
{
if (!PyArray_Check(pyIn))
return false;
- PyArrayObject *pya = reinterpret_cast<PyArrayObject *>(pyIn);
+ auto *pya = reinterpret_cast<PyArrayObject *>(pyIn);
if (debugNumPy) {
std::cerr << __FUNCTION__ << "(expectedNpType=" << expectedNpType;
if (const char *name = npTypeName(expectedNpType))
@@ -176,7 +176,7 @@ static inline bool primitiveArrayCheck1(PyObject *pyIn, int expectedNpType, int
if (!isPrimitiveArray<1>(pyIn, expectedNpType))
return false;
if (expectedSize >= 0) {
- PyArrayObject *pya = reinterpret_cast<PyArrayObject *>(pyIn);
+ auto *pya = reinterpret_cast<PyArrayObject *>(pyIn);
const int size = int(PyArray_DIMS(pya)[0]);
if (size < expectedSize) {
warning(PyExc_RuntimeWarning, 0, "A numpy array of size %d was passed to a function expects %d.",
@@ -191,8 +191,8 @@ static inline bool primitiveArrayCheck1(PyObject *pyIn, int expectedNpType, int
template <class T>
static void convertArray1(PyObject *pyIn, void *cppOut)
{
- ArrayHandle<T> *handle = reinterpret_cast<ArrayHandle<T> *>(cppOut);
- PyArrayObject *pya = reinterpret_cast<PyArrayObject *>(pyIn);
+ auto *handle = reinterpret_cast<ArrayHandle<T> *>(cppOut);
+ auto *pya = reinterpret_cast<PyArrayObject *>(pyIn);
const npy_intp size = PyArray_DIMS(pya)[0];
if (debugNumPy)
std::cerr << __FUNCTION__ << ' ' << size << '\n';
@@ -204,8 +204,8 @@ template <class T>
static void convertArray2(PyObject *pyIn, void *cppOut)
{
typedef typename Array2Handle<T, 1>::RowType RowType;
- Array2Handle<T, 1> *handle = reinterpret_cast<Array2Handle<T, 1> *>(cppOut);
- PyArrayObject *pya = reinterpret_cast<PyArrayObject *>(pyIn);
+ auto *handle = reinterpret_cast<Array2Handle<T, 1> *>(cppOut);
+ auto *pya = reinterpret_cast<PyArrayObject *>(pyIn);
handle->setData(reinterpret_cast<RowType *>(PyArray_DATA(pya)));
}
@@ -220,7 +220,7 @@ static inline bool primitiveArrayCheck2(PyObject *pyIn, int expectedNpType, int
if (!isPrimitiveArray<2>(pyIn, expectedNpType))
return false;
if (expectedDim2 >= 0) {
- PyArrayObject *pya = reinterpret_cast<PyArrayObject *>(pyIn);
+ auto *pya = reinterpret_cast<PyArrayObject *>(pyIn);
const int dim1 = int(PyArray_DIMS(pya)[0]);
const int dim2 = int(PyArray_DIMS(pya)[1]);
if (dim1 != expectedDim1 || dim2 != expectedDim2) {
diff --git a/sources/shiboken2/libshiboken/sbkstring.cpp b/sources/shiboken2/libshiboken/sbkstring.cpp
index a3ffcdabb..9ba5be281 100644
--- a/sources/shiboken2/libshiboken/sbkstring.cpp
+++ b/sources/shiboken2/libshiboken/sbkstring.cpp
@@ -46,7 +46,7 @@ namespace Shiboken
namespace String
{
-bool checkType(PyTypeObject* type)
+bool checkType(PyTypeObject *type)
{
return type == &PyUnicode_Type
#if PY_MAJOR_VERSION < 3
@@ -55,7 +55,7 @@ bool checkType(PyTypeObject* type)
;
}
-bool check(PyObject* obj)
+bool check(PyObject *obj)
{
return obj == Py_None ||
#if PY_MAJOR_VERSION < 3
@@ -64,17 +64,17 @@ bool check(PyObject* obj)
PyUnicode_Check(obj);
}
-bool checkChar(PyObject* pyobj)
+bool checkChar(PyObject *pyobj)
{
return check(pyobj) && (len(pyobj) == 1);
}
-bool isConvertible(PyObject* obj)
+bool isConvertible(PyObject *obj)
{
return check(obj);
}
-PyObject* fromCString(const char* value)
+PyObject *fromCString(const char *value)
{
#ifdef IS_PY3K
return PyUnicode_FromString(value);
@@ -83,7 +83,7 @@ PyObject* fromCString(const char* value)
#endif
}
-PyObject* fromCString(const char* value, int len)
+PyObject *fromCString(const char *value, int len)
{
#ifdef IS_PY3K
return PyUnicode_FromStringAndSize(value, len);
@@ -92,13 +92,13 @@ PyObject* fromCString(const char* value, int len)
#endif
}
-const char* toCString(PyObject* str, Py_ssize_t* len)
+const char *toCString(PyObject *str, Py_ssize_t *len)
{
if (str == Py_None)
- return NULL;
+ return nullptr;
if (PyUnicode_Check(str)) {
if (len) {
- // We need to encode the unicode string into utf8 to know the size of returned char*.
+ // We need to encode the unicode string into utf8 to know the size of returned char *.
Shiboken::AutoDecRef uniStr(PyUnicode_AsUTF8String(str));
*len = PyBytes_GET_SIZE(uniStr.object());
}
@@ -119,13 +119,13 @@ const char* toCString(PyObject* str, Py_ssize_t* len)
*len = PyBytes_GET_SIZE(str);
return PyBytes_AS_STRING(str);
}
- return 0;
+ return nullptr;
}
-bool concat(PyObject** val1, PyObject* val2)
+bool concat(PyObject **val1, PyObject *val2)
{
if (PyUnicode_Check(*val1) && PyUnicode_Check(val2)) {
- PyObject* result = PyUnicode_Concat(*val1, val2);
+ PyObject *result = PyUnicode_Concat(*val1, val2);
Py_DECREF(*val1);
*val1 = result;
return true;
@@ -145,11 +145,11 @@ bool concat(PyObject** val1, PyObject* val2)
return false;
}
-PyObject* fromFormat(const char* format, ...)
+PyObject *fromFormat(const char *format, ...)
{
va_list argp;
va_start(argp, format);
- PyObject* result = 0;
+ PyObject *result = nullptr;
#ifdef IS_PY3K
result = PyUnicode_FromFormatV(format, argp);
#else
@@ -159,7 +159,7 @@ PyObject* fromFormat(const char* format, ...)
return result;
}
-PyObject* fromStringAndSize(const char* str, Py_ssize_t size)
+PyObject *fromStringAndSize(const char *str, Py_ssize_t size)
{
#ifdef IS_PY3K
return PyUnicode_FromStringAndSize(str, size);
@@ -168,15 +168,15 @@ PyObject* fromStringAndSize(const char* str, Py_ssize_t size)
#endif
}
-int compare(PyObject* val1, const char* val2)
+int compare(PyObject *val1, const char *val2)
{
if (PyUnicode_Check(val1))
#ifdef IS_PY3K
return PyUnicode_CompareWithASCIIString(val1, val2);
#else
{
- PyObject* uVal2 = PyUnicode_FromString(val2);
- bool result = PyUnicode_Compare(val1, uVal2);
+ PyObject *uVal2 = PyUnicode_FromString(val2);
+ bool result = PyUnicode_Compare(val1, uVal2);
Py_XDECREF(uVal2);
return result;
}
@@ -187,7 +187,7 @@ int compare(PyObject* val1, const char* val2)
}
-Py_ssize_t len(PyObject* str)
+Py_ssize_t len(PyObject *str)
{
if (str == Py_None)
return 0;
diff --git a/sources/shiboken2/libshiboken/sbkstring.h b/sources/shiboken2/libshiboken/sbkstring.h
index a6b5fbeed..7f434e1b9 100644
--- a/sources/shiboken2/libshiboken/sbkstring.h
+++ b/sources/shiboken2/libshiboken/sbkstring.h
@@ -53,18 +53,18 @@ namespace Shiboken
{
namespace String
{
- LIBSHIBOKEN_API bool check(PyObject* obj);
- LIBSHIBOKEN_API bool checkType(PyTypeObject* obj);
- LIBSHIBOKEN_API bool checkChar(PyObject* obj);
- LIBSHIBOKEN_API bool isConvertible(PyObject* obj);
- LIBSHIBOKEN_API PyObject* fromCString(const char* value);
- LIBSHIBOKEN_API PyObject* fromCString(const char* value, int len);
- LIBSHIBOKEN_API const char* toCString(PyObject* str, Py_ssize_t* len = 0);
- LIBSHIBOKEN_API bool concat(PyObject** val1, PyObject* val2);
- LIBSHIBOKEN_API PyObject* fromFormat(const char* format, ...);
- LIBSHIBOKEN_API PyObject* fromStringAndSize(const char* str, Py_ssize_t size);
- LIBSHIBOKEN_API int compare(PyObject* val1, const char* val2);
- LIBSHIBOKEN_API Py_ssize_t len(PyObject* str);
+ LIBSHIBOKEN_API bool check(PyObject *obj);
+ LIBSHIBOKEN_API bool checkType(PyTypeObject *obj);
+ LIBSHIBOKEN_API bool checkChar(PyObject *obj);
+ LIBSHIBOKEN_API bool isConvertible(PyObject *obj);
+ LIBSHIBOKEN_API PyObject *fromCString(const char *value);
+ LIBSHIBOKEN_API PyObject *fromCString(const char *value, int len);
+ LIBSHIBOKEN_API const char *toCString(PyObject *str, Py_ssize_t *len = nullptr);
+ LIBSHIBOKEN_API bool concat(PyObject **val1, PyObject *val2);
+ LIBSHIBOKEN_API PyObject *fromFormat(const char *format, ...);
+ LIBSHIBOKEN_API PyObject *fromStringAndSize(const char *str, Py_ssize_t size);
+ LIBSHIBOKEN_API int compare(PyObject *val1, const char *val2);
+ LIBSHIBOKEN_API Py_ssize_t len(PyObject *str);
} // namespace String
} // namespace Shiboken
diff --git a/sources/shiboken2/libshiboken/shibokenbuffer.cpp b/sources/shiboken2/libshiboken/shibokenbuffer.cpp
index a691a31ee..330470183 100644
--- a/sources/shiboken2/libshiboken/shibokenbuffer.cpp
+++ b/sources/shiboken2/libshiboken/shibokenbuffer.cpp
@@ -41,14 +41,14 @@
#include <cstdlib>
#include <cstring>
-bool Shiboken::Buffer::checkType(PyObject* pyObj)
+bool Shiboken::Buffer::checkType(PyObject *pyObj)
{
return PyObject_CheckReadBuffer(pyObj) != 0;
}
-void* Shiboken::Buffer::getPointer(PyObject* pyObj, Py_ssize_t* size)
+void *Shiboken::Buffer::getPointer(PyObject *pyObj, Py_ssize_t *size)
{
- const void* buffer = 0;
+ const void *buffer = nullptr;
#ifdef IS_PY3K
Py_buffer view;
if (PyObject_GetBuffer(pyObj, &view, PyBUF_ND) == 0) {
@@ -67,10 +67,10 @@ void* Shiboken::Buffer::getPointer(PyObject* pyObj, Py_ssize_t* size)
if (size)
*size = bufferSize;
#endif
- return const_cast<void*>(buffer);
+ return const_cast<void *>(buffer);
}
-PyObject* Shiboken::Buffer::newObject(void* memory, Py_ssize_t size, Type type)
+PyObject *Shiboken::Buffer::newObject(void *memory, Py_ssize_t size, Type type)
{
if (size == 0)
Py_RETURN_NONE;
@@ -93,7 +93,7 @@ PyObject* Shiboken::Buffer::newObject(void* memory, Py_ssize_t size, Type type)
#endif
}
-PyObject* Shiboken::Buffer::newObject(const void* memory, Py_ssize_t size)
+PyObject *Shiboken::Buffer::newObject(const void *memory, Py_ssize_t size)
{
- return newObject(const_cast<void*>(memory), size, ReadOnly);
+ return newObject(const_cast<void *>(memory), size, ReadOnly);
}
diff --git a/sources/shiboken2/libshiboken/shibokenbuffer.h b/sources/shiboken2/libshiboken/shibokenbuffer.h
index 04a5b6dd0..dc9f8d89f 100644
--- a/sources/shiboken2/libshiboken/shibokenbuffer.h
+++ b/sources/shiboken2/libshiboken/shibokenbuffer.h
@@ -58,18 +58,18 @@ namespace Buffer
* Creates a new Python buffer pointing to a contiguous memory block at
* \p memory of size \p size.
*/
- LIBSHIBOKEN_API PyObject* newObject(void* memory, Py_ssize_t size, Type type);
+ LIBSHIBOKEN_API PyObject *newObject(void *memory, Py_ssize_t size, Type type);
/**
* Creates a new <b>read only</b> Python buffer pointing to a contiguous memory block at
* \p memory of size \p size.
*/
- LIBSHIBOKEN_API PyObject* newObject(const void* memory, Py_ssize_t size);
+ LIBSHIBOKEN_API PyObject *newObject(const void *memory, Py_ssize_t size);
/**
* Check if is ok to use \p pyObj as argument in all function under Shiboken::Buffer namespace.
*/
- LIBSHIBOKEN_API bool checkType(PyObject* pyObj);
+ LIBSHIBOKEN_API bool checkType(PyObject *pyObj);
/**
* Returns a pointer to the memory pointed by the buffer \p pyObj, \p size is filled with the buffer
@@ -77,7 +77,7 @@ namespace Buffer
*
* If the \p pyObj is a non-contiguous buffer a Python error is set.
*/
- LIBSHIBOKEN_API void* getPointer(PyObject* pyObj, Py_ssize_t* size = 0);
+ LIBSHIBOKEN_API void *getPointer(PyObject *pyObj, Py_ssize_t *size = nullptr);
} // namespace Buffer
} // namespace Shiboken
diff --git a/sources/shiboken2/libshiboken/signature.cpp b/sources/shiboken2/libshiboken/signature.cpp
index 8003f142a..e62f861a2 100644
--- a/sources/shiboken2/libshiboken/signature.cpp
+++ b/sources/shiboken2/libshiboken/signature.cpp
@@ -79,7 +79,7 @@ typedef struct safe_globals_struc {
PyObject *make_helptext_func;
} safe_globals_struc, *safe_globals;
-static safe_globals pyside_globals = 0;
+static safe_globals pyside_globals = nullptr;
static PyObject *GetTypeKey(PyObject *ob);
@@ -234,10 +234,10 @@ compute_name_key(PyObject *ob)
static int
build_name_key_to_func(PyObject *obtype)
{
- PyTypeObject *type = reinterpret_cast<PyTypeObject *>(obtype);
+ auto *type = reinterpret_cast<PyTypeObject *>(obtype);
PyMethodDef *meth = type->tp_methods;
- if (meth == 0)
+ if (meth == nullptr)
return 0;
Shiboken::AutoDecRef type_key(GetTypeKey(obtype));
@@ -457,7 +457,7 @@ static safe_globals_struc *
init_phase_1(void)
{
{
- safe_globals_struc *p = reinterpret_cast<safe_globals_struc *>
+ auto *p = reinterpret_cast<safe_globals_struc *>
(malloc(sizeof(safe_globals_struc)));
if (p == nullptr)
goto error;
@@ -661,11 +661,11 @@ add_more_getsets(PyTypeObject *type, PyGetSetDef *gsp, PyObject **old_descr)
//
// keep the original __doc__ functions
-static PyObject *old_cf_doc_descr = 0;
-static PyObject *old_sm_doc_descr = 0;
-static PyObject *old_md_doc_descr = 0;
-static PyObject *old_tp_doc_descr = 0;
-static PyObject *old_wd_doc_descr = 0;
+static PyObject *old_cf_doc_descr = nullptr;
+static PyObject *old_sm_doc_descr = nullptr;
+static PyObject *old_md_doc_descr = nullptr;
+static PyObject *old_tp_doc_descr = nullptr;
+static PyObject *old_wd_doc_descr = nullptr;
static int handle_doc_in_progress = 0;
@@ -675,7 +675,7 @@ handle_doc(PyObject *ob, PyObject *old_descr)
init_module_1();
init_module_2();
Shiboken::AutoDecRef ob_type(GetClassOfFunc(ob));
- PyTypeObject *type = reinterpret_cast<PyTypeObject *>(ob_type.object());
+ auto *type = reinterpret_cast<PyTypeObject *>(ob_type.object());
if (handle_doc_in_progress || strncmp(type->tp_name, "PySide2.", 8) != 0)
return PyObject_CallMethod(old_descr, const_cast<char *>("__get__"), const_cast<char *>("(O)"), ob);
handle_doc_in_progress++;
@@ -737,35 +737,35 @@ static PyGetSetDef new_PyCFunction_getsets[] = {
{const_cast<char *>("__doc__"), (getter)pyside_cf_get___doc__},
{const_cast<char *>("__signature__"), (getter)pyside_cf_get___signature__,
(setter)pyside_set___signature__},
- {0}
+ {nullptr}
};
static PyGetSetDef new_PyStaticMethod_getsets[] = {
{const_cast<char *>("__doc__"), (getter)pyside_sm_get___doc__},
{const_cast<char *>("__signature__"), (getter)pyside_sm_get___signature__,
(setter)pyside_set___signature__},
- {0}
+ {nullptr}
};
static PyGetSetDef new_PyMethodDescr_getsets[] = {
{const_cast<char *>("__doc__"), (getter)pyside_md_get___doc__},
{const_cast<char *>("__signature__"), (getter)pyside_md_get___signature__,
(setter)pyside_set___signature__},
- {0}
+ {nullptr}
};
static PyGetSetDef new_PyType_getsets[] = {
{const_cast<char *>("__doc__"), (getter)pyside_tp_get___doc__},
{const_cast<char *>("__signature__"), (getter)pyside_tp_get___signature__,
(setter)pyside_set___signature__},
- {0}
+ {nullptr}
};
static PyGetSetDef new_PyWrapperDescr_getsets[] = {
{const_cast<char *>("__doc__"), (getter)pyside_wd_get___doc__},
{const_cast<char *>("__signature__"), (getter)pyside_wd_get___signature__,
(setter)pyside_set___signature__},
- {0}
+ {nullptr}
};
////////////////////////////////////////////////////////////////////////////
@@ -795,7 +795,7 @@ get_signature_intern(PyObject *ob, const char *modifier)
}
static PyObject *
-get_signature(PyObject *self, PyObject *args)
+get_signature(PyObject * /* self */, PyObject *args)
{
PyObject *ob;
const char *modifier = nullptr;
@@ -831,7 +831,7 @@ void handler(int sig) {
void *array[30];
size_t size;
- // get void*'s for all entries on the stack
+ // get void *'s for all entries on the stack
size = backtrace(array, 30);
// print out all the frames to stderr
@@ -1056,11 +1056,11 @@ _build_func_to_type(PyObject *obtype)
* and record the mapping from static method to this type in a dict.
* We also check for hidden methods, see below.
*/
- PyTypeObject *type = reinterpret_cast<PyTypeObject *>(obtype);
+ auto *type = reinterpret_cast<PyTypeObject *>(obtype);
PyObject *dict = type->tp_dict;
PyMethodDef *meth = type->tp_methods;
- if (meth == 0)
+ if (meth == nullptr)
return 0;
for (; meth->ml_name != nullptr; meth++) {
@@ -1089,7 +1089,7 @@ _build_func_to_type(PyObject *obtype)
|| (check_name && PyObject_RichCompareBool(look, given, Py_EQ) != 1)) {
PyErr_Clear();
Shiboken::AutoDecRef cfunc(PyCFunction_NewEx(meth,
- reinterpret_cast<PyObject*>(type), nullptr));
+ reinterpret_cast<PyObject *>(type), nullptr));
if (cfunc.isNull())
return -1;
if (meth->ml_flags & METH_STATIC)
@@ -1123,12 +1123,12 @@ _build_func_to_type(PyObject *obtype)
}
int
-SbkSpecial_Type_Ready(PyObject *module, PyTypeObject *type,
+SbkSpecial_Type_Ready(PyObject * /* module */, PyTypeObject *type,
const char *signatures[])
{
if (PyType_Ready(type) < 0)
return -1;
- PyObject *ob_type = reinterpret_cast<PyObject *>(type);
+ auto *ob_type = reinterpret_cast<PyObject *>(type);
int ret = PySide_BuildSignatureArgs(ob_type, signatures);
if (ret < 0) {
PyErr_Print();
diff --git a/sources/shiboken2/libshiboken/threadstatesaver.cpp b/sources/shiboken2/libshiboken/threadstatesaver.cpp
index 517341617..0d19528f9 100644
--- a/sources/shiboken2/libshiboken/threadstatesaver.cpp
+++ b/sources/shiboken2/libshiboken/threadstatesaver.cpp
@@ -42,9 +42,7 @@
namespace Shiboken
{
-ThreadStateSaver::ThreadStateSaver()
- : m_threadState(0)
- {}
+ThreadStateSaver::ThreadStateSaver() = default;
ThreadStateSaver::~ThreadStateSaver()
{
@@ -61,7 +59,7 @@ void ThreadStateSaver::restore()
{
if (m_threadState) {
PyEval_RestoreThread(m_threadState);
- m_threadState = 0;
+ m_threadState = nullptr;
}
}
diff --git a/sources/shiboken2/libshiboken/threadstatesaver.h b/sources/shiboken2/libshiboken/threadstatesaver.h
index ddad9b67f..ddfbcb93b 100644
--- a/sources/shiboken2/libshiboken/threadstatesaver.h
+++ b/sources/shiboken2/libshiboken/threadstatesaver.h
@@ -49,17 +49,17 @@ namespace Shiboken
class LIBSHIBOKEN_API ThreadStateSaver
{
public:
- ThreadStateSaver(const ThreadStateSaver&) = delete;
- ThreadStateSaver(ThreadStateSaver&&) = delete;
- ThreadStateSaver &operator=(const ThreadStateSaver&) = delete;
- ThreadStateSaver &operator=(ThreadStateSaver&&) = delete;
+ ThreadStateSaver(const ThreadStateSaver &) = delete;
+ ThreadStateSaver(ThreadStateSaver &&) = delete;
+ ThreadStateSaver &operator=(const ThreadStateSaver &) = delete;
+ ThreadStateSaver &operator=(ThreadStateSaver &&) = delete;
ThreadStateSaver();
~ThreadStateSaver();
void save();
void restore();
private:
- PyThreadState* m_threadState;
+ PyThreadState *m_threadState = nullptr;
};
} // namespace Shiboken
diff --git a/sources/shiboken2/libshiboken/tmp-referencetopython/sbkconverter.cpp b/sources/shiboken2/libshiboken/tmp-referencetopython/sbkconverter.cpp
index 8e351cedd..ab205e215 100644
--- a/sources/shiboken2/libshiboken/tmp-referencetopython/sbkconverter.cpp
+++ b/sources/shiboken2/libshiboken/tmp-referencetopython/sbkconverter.cpp
@@ -46,13 +46,13 @@
namespace Shiboken {
namespace Conversions {
-static SbkConverter* createConverterObject(PyTypeObject* type,
+static SbkConverter *createConverterObject(PyTypeObject *type,
PythonToCppFunc toCppPointerConvFunc,
IsConvertibleToCppFunc toCppPointerCheckFunc,
CppToPythonFunc pointerToPythonFunc,
CppToPythonFunc copyToPythonFunc)
{
- SbkConverter* converter = new SbkConverter;
+ SbkConverter *converter = new SbkConverter;
converter->pythonType = type;
converter->pointerToPython = pointerToPythonFunc;
@@ -64,20 +64,20 @@ static SbkConverter* createConverterObject(PyTypeObject* type,
return converter;
}
-SbkConverter* createConverter(SbkObjectType* type,
+SbkConverter *createConverter(SbkObjectType *type,
PythonToCppFunc toCppPointerConvFunc,
IsConvertibleToCppFunc toCppPointerCheckFunc,
CppToPythonFunc pointerToPythonFunc,
CppToPythonFunc copyToPythonFunc)
{
- SbkConverter* converter = createConverterObject((PyTypeObject*)type,
+ SbkConverter *converter = createConverterObject(reinterpret_cast<PyTypeObject *>(type),
toCppPointerConvFunc, toCppPointerCheckFunc,
pointerToPythonFunc, copyToPythonFunc);
type->d->converter = converter;
return converter;
}
-void deleteConverter(SbkConverter* converter)
+void deleteConverter(SbkConverter *converter)
{
if (converter) {
converter->toCppConversions.clear();
@@ -85,44 +85,44 @@ void deleteConverter(SbkConverter* converter)
}
}
-void addPythonToCppValueConversion(SbkConverter* converter,
+void addPythonToCppValueConversion(SbkConverter *converter,
PythonToCppFunc pythonToCppFunc,
IsConvertibleToCppFunc isConvertibleToCppFunc)
{
converter->toCppConversions.push_back(std::make_pair(isConvertibleToCppFunc, pythonToCppFunc));
}
-void addPythonToCppValueConversion(SbkObjectType* type,
+void addPythonToCppValueConversion(SbkObjectType *type,
PythonToCppFunc pythonToCppFunc,
IsConvertibleToCppFunc isConvertibleToCppFunc)
{
addPythonToCppValueConversion(type->d->converter, pythonToCppFunc, isConvertibleToCppFunc);
}
-PyObject* pointerToPython(SbkObjectType* type, const void* cppIn)
+PyObject *pointerToPython(SbkObjectType *type, const void *cppIn)
{
if (!cppIn)
Py_RETURN_NONE;
return type->d->converter->pointerToPython(cppIn);
}
-static inline PyObject* CopyCppToPython(SbkConverter* converter, const void* cppIn)
+static inline PyObject *CopyCppToPython(SbkConverter *converter, const void *cppIn)
{
assert(cppIn);
return converter->copyToPython(cppIn);
}
-PyObject* copyToPython(SbkObjectType* type, const void* cppIn)
+PyObject *copyToPython(SbkObjectType *type, const void *cppIn)
{
return CopyCppToPython(type->d->converter, cppIn);
}
-PyObject* toPython(SbkConverter* converter, const void* cppIn)
+PyObject *toPython(SbkConverter *converter, const void *cppIn)
{
return CopyCppToPython(converter, cppIn);
}
-PyObject* referenceToPython(SbkObjectType* type, const void* cppIn)
+PyObject *referenceToPython(SbkObjectType *type, const void *cppIn)
{
assert(cppIn);
- PyObject* pyOut = (PyObject*)BindingManager::instance().retrieveWrapper(cppIn);
+ PyObject *pyOut = (PyObject *)BindingManager::instance().retrieveWrapper(cppIn);
if (pyOut) {
Py_INCREF(pyOut);
return pyOut;
@@ -134,16 +134,16 @@ PyObject* referenceToPython(SbkObjectType* type, const void* cppIn)
return type->d->converter->pointerToPython(cppIn);
}
-PythonToCppFunc isPythonToCppPointerConvertible(SbkObjectType* type, PyObject* pyIn)
+PythonToCppFunc isPythonToCppPointerConvertible(SbkObjectType *type, PyObject *pyIn)
{
assert(pyIn);
return type->d->converter->toCppPointerConversion.first(pyIn);
}
-static inline PythonToCppFunc IsPythonToCppConvertible(SbkConverter* converter, PyObject* pyIn)
+static inline PythonToCppFunc IsPythonToCppConvertible(SbkConverter *converter, PyObject *pyIn)
{
assert(pyIn);
- ToCppConversionList& convs = converter->toCppConversions;
+ ToCppConversionList &convs = converter->toCppConversions;
for (ToCppConversionList::iterator conv = convs.begin(); conv != convs.end(); ++conv) {
PythonToCppFunc toCppFunc = 0;
if ((toCppFunc = (*conv).first(pyIn)))
@@ -151,16 +151,16 @@ static inline PythonToCppFunc IsPythonToCppConvertible(SbkConverter* converter,
}
return 0;
}
-PythonToCppFunc isPythonToCppValueConvertible(SbkObjectType* type, PyObject* pyIn)
+PythonToCppFunc isPythonToCppValueConvertible(SbkObjectType *type, PyObject *pyIn)
{
return IsPythonToCppConvertible(type->d->converter, pyIn);
}
-PythonToCppFunc isPythonToCppConvertible(SbkConverter* converter, PyObject* pyIn)
+PythonToCppFunc isPythonToCppConvertible(SbkConverter *converter, PyObject *pyIn)
{
return IsPythonToCppConvertible(converter, pyIn);
}
-PythonToCppFunc isPythonToCppReferenceConvertible(SbkObjectType* type, PyObject* pyIn)
+PythonToCppFunc isPythonToCppReferenceConvertible(SbkObjectType *type, PyObject *pyIn)
{
if (pyIn != Py_None) {
PythonToCppFunc toCpp = isPythonToCppPointerConvertible(type, pyIn);
@@ -170,24 +170,27 @@ PythonToCppFunc isPythonToCppReferenceConvertible(SbkObjectType* type, PyObject*
return isPythonToCppValueConvertible(type, pyIn);
}
-void nonePythonToCppNullPtr(PyObject*, void* cppOut)
+void nonePythonToCppNullPtr(PyObject *, void *cppOut)
{
assert(cppOut);
- *((void**)cppOut) = 0;
+ *reinterpret_cast<void **>(cppOut) = nullptr;
}
-void pythonToCppPointer(SbkObjectType* type, PyObject* pyIn, void* cppOut)
+void pythonToCppPointer(SbkObjectType *type, PyObject *pyIn, void *cppOut)
{
assert(pyIn);
assert(cppOut);
- SbkObjectType* inType = (SbkObjectType*)Py_TYPE(pyIn);
- if (ObjectType::hasCast(inType))
- *((void**)cppOut) = ObjectType::cast(inType, (SbkObject*)pyIn, (PyTypeObject*)type);
- else
- *((void**)cppOut) = Object::cppPointer((SbkObject*)pyIn, (PyTypeObject*)type);
+ SbkObjectType *inType = (SbkObjectType *)Py_TYPE(pyIn);
+ if (ObjectType::hasCast(inType)) {
+ *reinterpret_cast<void **>(cppOut) =
+ ObjectType::cast(inType, reinterpret_cast<SbkObject *>(pyIn), reinterpret_cast<PyTypeObject *>(type));
+ } else {
+ *reinterpret_cast<void **>(cppOut) =
+ Object::cppPointer(reinterpret_cast<SbkObject *>(pyIn), reinterpret_cast<PyTypeObject *>(type));
+ }
}
-bool isImplicitConversion(SbkObjectType* type, PythonToCppFunc toCppFunc)
+bool isImplicitConversion(SbkObjectType *type, PythonToCppFunc toCppFunc)
{
// This is the Object Type or Value Type conversion that only
// retrieves the C++ pointer held in the Python wrapper.
diff --git a/sources/shiboken2/libshiboken/tmp-referencetopython/sbkconverter.h b/sources/shiboken2/libshiboken/tmp-referencetopython/sbkconverter.h
index cc9ea7a19..3578e4039 100644
--- a/sources/shiboken2/libshiboken/tmp-referencetopython/sbkconverter.h
+++ b/sources/shiboken2/libshiboken/tmp-referencetopython/sbkconverter.h
@@ -64,7 +64,7 @@ struct SbkConverter;
*
* C++ -> Python
*/
-typedef PyObject* (*CppToPythonFunc)(const void*);
+typedef PyObject *(*CppToPythonFunc)(const void *);
/**
* This function converts a Python object to a C++ value, it may be
@@ -77,7 +77,7 @@ typedef PyObject* (*CppToPythonFunc)(const void*);
*
* Python -> C++
*/
-typedef void (*PythonToCppFunc)(PyObject*,void*);
+typedef void (*PythonToCppFunc)(PyObject *,void *);
/**
* Checks if the Python object passed in the argument is convertible to a
@@ -88,7 +88,7 @@ typedef void (*PythonToCppFunc)(PyObject*,void*);
*
* Python -> C++ ?
*/
-typedef PythonToCppFunc (*IsConvertibleToCppFunc)(PyObject*);
+typedef PythonToCppFunc (*IsConvertibleToCppFunc)(PyObject *);
} // extern "C"
@@ -105,22 +105,22 @@ namespace Conversions {
* \param copyToPythonFunc Function to convert a C++ object to a Python \p type, copying the object.
* \returns The new converter referred by the wrapper \p type.
*/
-LIBSHIBOKEN_API SbkConverter* createConverter(SbkObjectType* type,
+LIBSHIBOKEN_API SbkConverter *createConverter(SbkObjectType *type,
PythonToCppFunc toCppPointerConvFunc,
IsConvertibleToCppFunc toCppPointerCheckFunc,
CppToPythonFunc pointerToPythonFunc,
CppToPythonFunc copyToPythonFunc = 0);
-LIBSHIBOKEN_API void deleteConverter(SbkConverter* converter);
+LIBSHIBOKEN_API void deleteConverter(SbkConverter *converter);
/**
* Adds a new conversion of a Python object to a C++ value.
* This is used in copy and implicit conversions.
*/
-LIBSHIBOKEN_API void addPythonToCppValueConversion(SbkConverter* converter,
+LIBSHIBOKEN_API void addPythonToCppValueConversion(SbkConverter *converter,
PythonToCppFunc pythonToCppFunc,
IsConvertibleToCppFunc isConvertibleToCppFunc);
-LIBSHIBOKEN_API void addPythonToCppValueConversion(SbkObjectType* type,
+LIBSHIBOKEN_API void addPythonToCppValueConversion(SbkObjectType *type,
PythonToCppFunc pythonToCppFunc,
IsConvertibleToCppFunc isConvertibleToCppFunc);
@@ -130,19 +130,19 @@ LIBSHIBOKEN_API void addPythonToCppValueConversion(SbkObjectType* type,
* Retrieves the Python wrapper object for the given \p cppIn C++ pointer object.
* This function is used only for Value and Object Types.
* Example usage:
- * TYPE* var;
- * PyObject* pyVar = pointerToPython(SBKTYPE, &var);
+ * TYPE *var;
+ * PyObject *pyVar = pointerToPython(SBKTYPE, &var);
*/
-LIBSHIBOKEN_API PyObject* pointerToPython(SbkObjectType* type, const void* cppIn);
+LIBSHIBOKEN_API PyObject *pointerToPython(SbkObjectType *type, const void *cppIn);
/**
* Retrieves the Python wrapper object for the given C++ value pointed by \p cppIn.
* This function is used only for Value Types.
* Example usage:
* TYPE var;
- * PyObject* pyVar = copyToPython(SBKTYPE, &var);
+ * PyObject *pyVar = copyToPython(SBKTYPE, &var);
*/
-LIBSHIBOKEN_API PyObject* copyToPython(SbkObjectType* type, const void* cppIn);
+LIBSHIBOKEN_API PyObject *copyToPython(SbkObjectType *type, const void *cppIn);
// TODO:WRITEDOCSTRING - used only for Value Types - cppIn must point to a value
/**
@@ -150,41 +150,41 @@ LIBSHIBOKEN_API PyObject* copyToPython(SbkObjectType* type, const void* cppIn);
* This function is used only for Value and Object Types.
* It differs from pointerToPython() for not checking for a NULL pointer.
* Example usage:
- * TYPE& var = SOMETHING;
- * PyObject* pyVar = copyToPython(SBKTYPE, &var);
+ * TYPE &var = SOMETHING;
+ * PyObject *pyVar = copyToPython(SBKTYPE, &var);
*/
-LIBSHIBOKEN_API PyObject* referenceToPython(SbkObjectType* type, const void* cppIn);
+LIBSHIBOKEN_API PyObject *referenceToPython(SbkObjectType *type, const void *cppIn);
// TODO:WRITEDOCSTRING - used only for Primitives and Containers (and Value Types) - cppIn must point to a primitive, container or value type
/// This is the same as copyToPython function.
-LIBSHIBOKEN_API PyObject* toPython(SbkConverter* converter, const void* cppIn);
+LIBSHIBOKEN_API PyObject *toPython(SbkConverter *converter, const void *cppIn);
// Python -> C++ convertibility checks -----------------------------------------------------
// TODO:WRITEDOCSTRING
-LIBSHIBOKEN_API PythonToCppFunc isPythonToCppPointerConvertible(SbkObjectType* type, PyObject* pyIn);
+LIBSHIBOKEN_API PythonToCppFunc isPythonToCppPointerConvertible(SbkObjectType *type, PyObject *pyIn);
// TODO:WRITEDOCSTRING- Returns a Python to C++ conversion function if true, or NULL if false.
-LIBSHIBOKEN_API PythonToCppFunc isPythonToCppValueConvertible(SbkObjectType* type, PyObject* pyIn);
+LIBSHIBOKEN_API PythonToCppFunc isPythonToCppValueConvertible(SbkObjectType *type, PyObject *pyIn);
// TODO:WRITEDOCSTRING- Returns a Python to C++ conversion function if true, or NULL if false.
-LIBSHIBOKEN_API PythonToCppFunc isPythonToCppReferenceConvertible(SbkObjectType* type, PyObject* pyIn);
+LIBSHIBOKEN_API PythonToCppFunc isPythonToCppReferenceConvertible(SbkObjectType *type, PyObject *pyIn);
/// This is the same as isPythonToCppValueConvertible function.
-LIBSHIBOKEN_API PythonToCppFunc isPythonToCppConvertible(SbkConverter* converter, PyObject* pyIn);
+LIBSHIBOKEN_API PythonToCppFunc isPythonToCppConvertible(SbkConverter *converter, PyObject *pyIn);
// Python -> C++ ---------------------------------------------------------------------------
// TODO:WRITEDOCSTRING - function used by the generated [TYPE]_PythonToCpp_[TYPE]_PTR
-LIBSHIBOKEN_API void pythonToCppPointer(SbkObjectType* type, PyObject* pyIn, void* cppOut);
+LIBSHIBOKEN_API void pythonToCppPointer(SbkObjectType *type, PyObject *pyIn, void *cppOut);
// TODO:WRITEDOCSTRING - function used by the generated isConvertible when the PyObject is None,
// making a C++ NULL pointer the result of the toCpp function call.
// DRAFT: When the Python object is a Py_None, it's C++ conversion is always a NULL pointer.
-LIBSHIBOKEN_API void nonePythonToCppNullPtr(PyObject*, void* cppOut);
+LIBSHIBOKEN_API void nonePythonToCppNullPtr(PyObject *, void *cppOut);
// TODO:WRITEDOCSTRING - tells if \p toCpp is an implicit conversion.
-LIBSHIBOKEN_API bool isImplicitConversion(SbkObjectType* type, PythonToCppFunc toCpp);
+LIBSHIBOKEN_API bool isImplicitConversion(SbkObjectType *type, PythonToCppFunc toCpp);
} } // namespace Shiboken::Conversions
diff --git a/sources/shiboken2/libshiboken/typespec.cpp b/sources/shiboken2/libshiboken/typespec.cpp
index a67daf12d..6dc5b00bc 100644
--- a/sources/shiboken2/libshiboken/typespec.cpp
+++ b/sources/shiboken2/libshiboken/typespec.cpp
@@ -599,17 +599,16 @@ offsetof(PyHeapTypeObject, as_sequence.sq_slice),
PyObject *
PyType_FromSpecWithBases(PyType_Spec *spec, PyObject *bases)
{
- PyHeapTypeObject *res = (PyHeapTypeObject*)PyType_GenericAlloc(&PyType_Type, 0);
+ auto res = reinterpret_cast<PyHeapTypeObject *>(PyType_GenericAlloc(&PyType_Type, 0));
PyTypeObject *type, *base;
PyObject *modname;
- char *s;
- char *res_start = (char*)res;
+ auto res_start = reinterpret_cast<char *>(res);
PyType_Slot *slot;
/* Set the type name and qualname */
- s = (char *)strrchr(spec->name, '.'); // C++11
+ auto s = const_cast<char *>(strrchr(spec->name, '.')); // C++11
if (s == NULL)
- s = (char*)spec->name;
+ s = const_cast<char *>(spec->name);
else
s++;
@@ -686,7 +685,7 @@ PyType_FromSpecWithBases(PyType_Spec *spec, PyObject *bases)
if (slot->slot == Py_tp_base || slot->slot == Py_tp_bases)
/* Processed above */
continue;
- *(void**)(res_start + slotoffsets[slot->slot]) = slot->pfunc;
+ *reinterpret_cast<void **>(res_start + slotoffsets[slot->slot]) = slot->pfunc;
/* need to make a copy of the docstring slot, which usually
points to a static string literal */
@@ -746,7 +745,7 @@ PyType_FromSpecWithBases(PyType_Spec *spec, PyObject *bases)
goto fail;
}
- return (PyObject*)res;
+ return reinterpret_cast<PyObject *>(res);
fail:
Py_DECREF(res);
@@ -770,7 +769,7 @@ PyType_GetSlot(PyTypeObject *type, int slot)
/* Extension module requesting slot from a future version */
return NULL;
}
- return *(void**)(((char*)type) + slotoffsets[slot]);
+ return *reinterpret_cast<void **>(reinterpret_cast<char *>(type) + slotoffsets[slot]);
}
} // extern "C"
diff --git a/sources/shiboken2/libshiboken/typespec.h b/sources/shiboken2/libshiboken/typespec.h
index 81227acac..193b654c2 100644
--- a/sources/shiboken2/libshiboken/typespec.h
+++ b/sources/shiboken2/libshiboken/typespec.h
@@ -53,19 +53,19 @@ typedef struct{
} PyType_Slot;
typedef struct{
- const char* name;
+ const char *name;
int basicsize;
int itemsize;
unsigned int flags;
PyType_Slot *slots; /* terminated by slot==0. */
} PyType_Spec;
-LIBSHIBOKEN_API PyObject *PyType_FromSpec(PyType_Spec*);
+LIBSHIBOKEN_API PyObject *PyType_FromSpec(PyType_Spec *);
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
-LIBSHIBOKEN_API PyObject *PyType_FromSpecWithBases(PyType_Spec*, PyObject*);
+LIBSHIBOKEN_API PyObject *PyType_FromSpecWithBases(PyType_Spec *, PyObject *);
#endif
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03040000
-LIBSHIBOKEN_API void* PyType_GetSlot(PyTypeObject*, int);
+LIBSHIBOKEN_API void *PyType_GetSlot(PyTypeObject *, int);
#endif
// from typeslots.h
diff --git a/sources/shiboken2/libshiboken/voidptr.cpp b/sources/shiboken2/libshiboken/voidptr.cpp
index 5b0cb84ea..d4ce58c87 100644
--- a/sources/shiboken2/libshiboken/voidptr.cpp
+++ b/sources/shiboken2/libshiboken/voidptr.cpp
@@ -61,10 +61,10 @@ PyObject *SbkVoidPtrObject_new(PyTypeObject *type, PyObject *args, PyObject *kwd
// SbkVoidPtrObject *self =
// reinterpret_cast<SbkVoidPtrObject *>(type->tp_alloc);
PyObject *ob = type->tp_alloc(type, 0);
- SbkVoidPtrObject *self = reinterpret_cast<SbkVoidPtrObject *>(ob);
+ auto *self = reinterpret_cast<SbkVoidPtrObject *>(ob);
- if (self != 0) {
- self->cptr = 0;
+ if (self != nullptr) {
+ self->cptr = nullptr;
self->size = -1;
self->isWritable = false;
}
@@ -80,9 +80,9 @@ int SbkVoidPtrObject_init(PyObject *self, PyObject *args, PyObject *kwds)
PyObject *addressObject;
Py_ssize_t size = -1;
int isWritable = 0;
- SbkVoidPtrObject *sbkSelf = reinterpret_cast<SbkVoidPtrObject *>(self);
+ auto *sbkSelf = reinterpret_cast<SbkVoidPtrObject *>(self);
- static const char *kwlist[] = {"address", "size", "writeable", 0};
+ static const char *kwlist[] = {"address", "size", "writeable", nullptr};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|ni", const_cast<char **>(kwlist),
&addressObject, &size, &isWritable))
@@ -90,7 +90,7 @@ int SbkVoidPtrObject_init(PyObject *self, PyObject *args, PyObject *kwds)
// Void pointer.
if (SbkVoidPtr_Check(addressObject)) {
- SbkVoidPtrObject *sbkOther = reinterpret_cast<SbkVoidPtrObject *>(addressObject);
+ auto *sbkOther = reinterpret_cast<SbkVoidPtrObject *>(addressObject);
sbkSelf->cptr = sbkOther->cptr;
sbkSelf->size = sbkOther->size;
sbkSelf->isWritable = sbkOther->isWritable;
@@ -105,17 +105,17 @@ int SbkVoidPtrObject_init(PyObject *self, PyObject *args, PyObject *kwds)
sbkSelf->cptr = bufferView.buf;
sbkSelf->size = bufferView.len > 0 ? bufferView.len : size;
- sbkSelf->isWritable = bufferView.readonly > 0 ? false : true;
+ sbkSelf->isWritable = bufferView.readonly <= 0;
// Release the buffer.
PyBuffer_Release(&bufferView);
}
// Shiboken::Object wrapper.
else if (Shiboken::Object::checkType(addressObject)) {
- SbkObject *sbkOther = reinterpret_cast<SbkObject *>(addressObject);
+ auto *sbkOther = reinterpret_cast<SbkObject *>(addressObject);
sbkSelf->cptr = sbkOther->d->cptr[0];
sbkSelf->size = size;
- sbkSelf->isWritable = isWritable > 0 ? true : false;
+ sbkSelf->isWritable = isWritable > 0;
}
// An integer representing an address.
else {
@@ -137,7 +137,7 @@ int SbkVoidPtrObject_init(PyObject *self, PyObject *args, PyObject *kwds)
}
sbkSelf->cptr = cptr;
sbkSelf->size = size;
- sbkSelf->isWritable = isWritable > 0 ? true : false;
+ sbkSelf->isWritable = isWritable > 0;
}
}
@@ -147,8 +147,8 @@ int SbkVoidPtrObject_init(PyObject *self, PyObject *args, PyObject *kwds)
PyObject *SbkVoidPtrObject_richcmp(PyObject *obj1, PyObject *obj2, int op)
{
PyObject *result = Py_False;
- void *cptr1 = 0;
- void *cptr2 = 0;
+ void *cptr1 = nullptr;
+ void *cptr2 = nullptr;
bool validObjects = true;
if (SbkVoidPtr_Check(obj1))
@@ -178,18 +178,18 @@ PyObject *SbkVoidPtrObject_richcmp(PyObject *obj1, PyObject *obj2, int op)
PyObject *SbkVoidPtrObject_int(PyObject *v)
{
- SbkVoidPtrObject *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(v);
+ auto *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(v);
return PyLong_FromVoidPtr(sbkObject->cptr);
}
PyObject *toBytes(PyObject *self, PyObject *args)
{
- SbkVoidPtrObject *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(self);
+ auto *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(self);
if (sbkObject->size < 0) {
PyErr_SetString(PyExc_IndexError, "VoidPtr does not have a size set.");
return nullptr;
}
- PyObject *bytes = PyBytes_FromStringAndSize(reinterpret_cast<const char*>(sbkObject->cptr),
+ PyObject *bytes = PyBytes_FromStringAndSize(reinterpret_cast<const char *>(sbkObject->cptr),
sbkObject->size);
Py_XINCREF(bytes);
return bytes;
@@ -197,12 +197,12 @@ PyObject *toBytes(PyObject *self, PyObject *args)
static struct PyMethodDef SbkVoidPtrObject_methods[] = {
{"toBytes", toBytes, METH_NOARGS},
- {0}
+ {nullptr}
};
static Py_ssize_t SbkVoidPtrObject_length(PyObject *v)
{
- SbkVoidPtrObject *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(v);
+ auto *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(v);
if (sbkObject->size < 0) {
PyErr_SetString(PyExc_IndexError, "VoidPtr does not have a size set.");
return -1;
@@ -218,7 +218,7 @@ PyObject *SbkVoidPtrObject_repr(PyObject *v)
{
- SbkVoidPtrObject *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(v);
+ auto *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(v);
#ifdef IS_PY3K
PyObject *s = PyUnicode_FromFormat("%s(%p, %zd, %s)",
#else
@@ -234,7 +234,7 @@ PyObject *SbkVoidPtrObject_repr(PyObject *v)
PyObject *SbkVoidPtrObject_str(PyObject *v)
{
- SbkVoidPtrObject *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(v);
+ auto *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(v);
#ifdef IS_PY3K
PyObject *s = PyUnicode_FromFormat("%s(Address %p, Size %zd, isWritable %s)",
#else
@@ -251,10 +251,10 @@ PyObject *SbkVoidPtrObject_str(PyObject *v)
static int SbkVoidPtrObject_getbuffer(PyObject *obj, Py_buffer *view, int flags)
{
- if (view == NULL)
+ if (view == nullptr)
return -1;
- SbkVoidPtrObject *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(obj);
+ auto *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(obj);
if (sbkObject->size < 0)
return -1;
@@ -273,34 +273,34 @@ static int SbkVoidPtrObject_getbuffer(PyObject *obj, Py_buffer *view, int flags)
view->len = sbkObject->size;
view->readonly = readonly;
view->itemsize = 1;
- view->format = NULL;
+ view->format = nullptr;
if ((flags & PyBUF_FORMAT) == PyBUF_FORMAT)
- view->format = "B";
+ view->format = const_cast<char *>("B");
view->ndim = 1;
- view->shape = NULL;
+ view->shape = nullptr;
if ((flags & PyBUF_ND) == PyBUF_ND)
view->shape = &(view->len);
- view->strides = NULL;
+ view->strides = nullptr;
if ((flags & PyBUF_STRIDES) == PyBUF_STRIDES)
view->strides = &(view->itemsize);
- view->suboffsets = NULL;
- view->internal = NULL;
+ view->suboffsets = nullptr;
+ view->internal = nullptr;
return 0;
}
#if PY_VERSION_HEX < 0x03000000
-static Py_ssize_t SbkVoidPtrObject_readbufferproc(PyObject* self, Py_ssize_t segment, void** ptrptr)
+static Py_ssize_t SbkVoidPtrObject_readbufferproc(PyObject *self, Py_ssize_t segment, void **ptrptr)
{
if (segment || !Shiboken::Object::isValid(self))
return -1;
SbkVoidPtrObject *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(self);
- *ptrptr = reinterpret_cast<void*>(sbkObject->cptr);
+ *ptrptr = reinterpret_cast<void *>(sbkObject->cptr);
return sbkObject->size;
}
-static Py_ssize_t SbkVoidPtrObject_segcountproc(PyObject* self, Py_ssize_t* lenp)
+static Py_ssize_t SbkVoidPtrObject_segcountproc(PyObject *self, Py_ssize_t *lenp)
{
if (lenp) {
SbkVoidPtrObject *sbkObject = reinterpret_cast<SbkVoidPtrObject *>(self);
@@ -321,7 +321,7 @@ PyBufferProcs SbkVoidPtrObjectBufferProc = {
static PyBufferProcs SbkVoidPtrObjectBufferProc = {
(getbufferproc)SbkVoidPtrObject_getbuffer, // bf_getbuffer
- (releasebufferproc)0 // bf_releasebuffer
+ (releasebufferproc)nullptr // bf_releasebuffer
};
#endif
@@ -337,7 +337,7 @@ static PyType_Slot SbkVoidPtrType_slots[] = {
{Py_tp_new, (void *)SbkVoidPtrObject_new},
{Py_tp_dealloc, (void *)object_dealloc},
{Py_tp_methods, (void *)SbkVoidPtrObject_methods},
- {0, 0}
+ {0, nullptr}
};
static PyType_Spec SbkVoidPtrType_spec = {
"shiboken2.libshiboken.VoidPtr",
@@ -354,7 +354,7 @@ PyTypeObject *SbkVoidPtrTypeF(void)
{
static PyTypeObject *type = nullptr;
if (!type)
- type = (PyTypeObject *)PyType_FromSpec(&SbkVoidPtrType_spec);
+ type = reinterpret_cast<PyTypeObject *>(PyType_FromSpec(&SbkVoidPtrType_spec));
#if PY_VERSION_HEX < 0x03000000
type->tp_as_buffer = &SbkVoidPtrObjectBufferProc;
@@ -410,24 +410,24 @@ static PyObject *toPython(const void *cppIn)
static void VoidPtrToCpp(PyObject *pyIn, void *cppOut)
{
- SbkVoidPtrObject *sbkIn = reinterpret_cast<SbkVoidPtrObject *>(pyIn);
+ auto *sbkIn = reinterpret_cast<SbkVoidPtrObject *>(pyIn);
*reinterpret_cast<void **>(cppOut) = sbkIn->cptr;
}
static PythonToCppFunc VoidPtrToCppIsConvertible(PyObject *pyIn)
{
- return SbkVoidPtr_Check(pyIn) ? VoidPtrToCpp : 0;
+ return SbkVoidPtr_Check(pyIn) ? VoidPtrToCpp : nullptr;
}
static void SbkObjectToCpp(PyObject *pyIn, void *cppOut)
{
- SbkObject *sbkIn = reinterpret_cast<SbkObject *>(pyIn);
+ auto *sbkIn = reinterpret_cast<SbkObject *>(pyIn);
*reinterpret_cast<void **>(cppOut) = sbkIn->d->cptr[0];
}
static PythonToCppFunc SbkObjectToCppIsConvertible(PyObject *pyIn)
{
- return Shiboken::Object::checkType(pyIn) ? SbkObjectToCpp : 0;
+ return Shiboken::Object::checkType(pyIn) ? SbkObjectToCpp : nullptr;
}
static void PythonBufferToCpp(PyObject *pyIn, void *cppOut)
@@ -453,14 +453,14 @@ static PythonToCppFunc PythonBufferToCppIsConvertible(PyObject *pyIn)
// Bail out if the object can't provide a simple contiguous buffer.
if (PyObject_GetBuffer(pyIn, &bufferView, PyBUF_SIMPLE) < 0)
- return 0;
+ return nullptr;
// Release the buffer.
PyBuffer_Release(&bufferView);
return PythonBufferToCpp;
}
- return 0;
+ return nullptr;
}
SbkConverter *createConverter()
diff --git a/sources/shiboken2/tests/libminimal/typedef.h b/sources/shiboken2/tests/libminimal/typedef.h
index 8e3455652..b8d6faacd 100644
--- a/sources/shiboken2/tests/libminimal/typedef.h
+++ b/sources/shiboken2/tests/libminimal/typedef.h
@@ -34,7 +34,7 @@
#include <vector>
// Test wrapping of a typedef
-typedef std::vector<int> MyArrayInt;
+using MyArrayInt = std::vector<int>;
LIBMINIMAL_API bool arrayFuncInt(std::vector<int> a);
LIBMINIMAL_API bool arrayFuncIntTypedef(MyArrayInt a);
@@ -43,7 +43,7 @@ LIBMINIMAL_API std::vector<int> arrayFuncIntReturn(int size);
LIBMINIMAL_API MyArrayInt arrayFuncIntReturnTypedef(int size);
// Test wrapping of a typedef of a typedef
-typedef MyArrayInt MyArray;
+using MyArray = MyArrayInt;
LIBMINIMAL_API bool arrayFunc(std::vector<int> a);
LIBMINIMAL_API bool arrayFuncTypedef(MyArray a);
diff --git a/sources/shiboken2/tests/libother/otherderived.cpp b/sources/shiboken2/tests/libother/otherderived.cpp
index 5b1714f2a..d23f6ad23 100644
--- a/sources/shiboken2/tests/libother/otherderived.cpp
+++ b/sources/shiboken2/tests/libother/otherderived.cpp
@@ -51,7 +51,7 @@ OtherDerived::pureVirtual()
void*
OtherDerived::pureVirtualReturningVoidPtr()
{
- return 0;
+ return nullptr;
}
void
diff --git a/sources/shiboken2/tests/libother/othermultiplederived.cpp b/sources/shiboken2/tests/libother/othermultiplederived.cpp
index 554df3c76..e7ee4f96d 100644
--- a/sources/shiboken2/tests/libother/othermultiplederived.cpp
+++ b/sources/shiboken2/tests/libother/othermultiplederived.cpp
@@ -45,6 +45,6 @@ Base1* OtherMultipleDerived::createObject(const std::string& objName)
return new MDerived3;
else if (objName == "OtherMultipleDerived")
return new OtherMultipleDerived;
- return 0;
+ return nullptr;
}
diff --git a/sources/shiboken2/tests/libsample/abstract.cpp b/sources/shiboken2/tests/libsample/abstract.cpp
index c4900d0af..e60c792c4 100644
--- a/sources/shiboken2/tests/libsample/abstract.cpp
+++ b/sources/shiboken2/tests/libsample/abstract.cpp
@@ -38,7 +38,7 @@ Abstract::Abstract(int id) : m_id(id)
{
primitiveField = 123;
valueTypeField = Point(12, 34);
- objectTypeField = 0;
+ objectTypeField = nullptr;
bitField = 0;
}
diff --git a/sources/shiboken2/tests/libsample/abstract.h b/sources/shiboken2/tests/libsample/abstract.h
index 9e7cf5a29..09906f1ee 100644
--- a/sources/shiboken2/tests/libsample/abstract.h
+++ b/sources/shiboken2/tests/libsample/abstract.h
@@ -74,7 +74,7 @@ public:
inline int id() { return m_id; }
// factory method
- inline static Abstract* createObject() { return 0; }
+ inline static Abstract* createObject() { return nullptr; }
// method that receives an Object Type
inline static int getObjectId(Abstract* obj) { return obj->id(); }
diff --git a/sources/shiboken2/tests/libsample/blackbox.cpp b/sources/shiboken2/tests/libsample/blackbox.cpp
index f3dd57e97..0546ba7c2 100644
--- a/sources/shiboken2/tests/libsample/blackbox.cpp
+++ b/sources/shiboken2/tests/libsample/blackbox.cpp
@@ -49,7 +49,7 @@ BlackBox::keepObjectType(ObjectType* object)
m_ticket++;
std::pair<int, ObjectType*> item(m_ticket, object);
m_objects.insert(item);
- object->setParent(0);
+ object->setParent(nullptr);
return m_ticket;
}
@@ -63,7 +63,7 @@ BlackBox::retrieveObjectType(int ticket)
m_objects.erase(it);
return second;
}
- return 0;
+ return nullptr;
}
void
@@ -93,7 +93,7 @@ BlackBox::retrievePoint(int ticket)
m_points.erase(it);
return second;
}
- return 0;
+ return nullptr;
}
void
diff --git a/sources/shiboken2/tests/libsample/derived.cpp b/sources/shiboken2/tests/libsample/derived.cpp
index 4fa3e4081..0dc026876 100644
--- a/sources/shiboken2/tests/libsample/derived.cpp
+++ b/sources/shiboken2/tests/libsample/derived.cpp
@@ -54,7 +54,7 @@ Derived::pureVirtual()
void*
Derived::pureVirtualReturningVoidPtr()
{
- return 0;
+ return nullptr;
}
void
@@ -100,7 +100,7 @@ Derived::otherOverloaded(int a, double b)
struct SecretClass : public Abstract {
virtual void pureVirtual() {}
- virtual void* pureVirtualReturningVoidPtr() { return 0; }
+ virtual void *pureVirtualReturningVoidPtr() { return nullptr; }
virtual PrintFormat returnAnEnum() { return Short; }
void hideFunction(HideType*){};
private:
diff --git a/sources/shiboken2/tests/libsample/expression.cpp b/sources/shiboken2/tests/libsample/expression.cpp
index a6051306e..0c255a659 100644
--- a/sources/shiboken2/tests/libsample/expression.cpp
+++ b/sources/shiboken2/tests/libsample/expression.cpp
@@ -30,18 +30,18 @@
#include "expression.h"
#include <sstream>
-Expression::Expression() : m_value(0), m_operation(None), m_operand1(0), m_operand2(0)
+Expression::Expression() : m_value(0), m_operation(None), m_operand1(nullptr), m_operand2(nullptr)
{
}
-Expression::Expression(int number) : m_value(number), m_operation(None), m_operand1(0), m_operand2(0)
+Expression::Expression(int number) : m_value(number), m_operation(None), m_operand1(nullptr), m_operand2(nullptr)
{
}
Expression::Expression(const Expression& other)
{
- m_operand1 = other.m_operand1 ? new Expression(*other.m_operand1) : 0;
- m_operand2 = other.m_operand2 ? new Expression(*other.m_operand2) : 0;
+ m_operand1 = other.m_operand1 ? new Expression(*other.m_operand1) : nullptr;
+ m_operand2 = other.m_operand2 ? new Expression(*other.m_operand2) : nullptr;
m_value = other.m_value;
m_operation = other.m_operation;
}
@@ -50,8 +50,8 @@ Expression& Expression::operator=(const Expression& other)
{
delete m_operand1;
delete m_operand2;
- m_operand1 = other.m_operand1 ? new Expression(*other.m_operand1) : 0;
- m_operand2 = other.m_operand2 ? new Expression(*other.m_operand2) : 0;
+ m_operand1 = other.m_operand1 ? new Expression(*other.m_operand1) : nullptr;
+ m_operand2 = other.m_operand2 ? new Expression(*other.m_operand2) : nullptr;
m_operation = other.m_operation;
m_value = other.m_value;
return *this;
diff --git a/sources/shiboken2/tests/libsample/functions.cpp b/sources/shiboken2/tests/libsample/functions.cpp
index 5cc9a1c67..288fa96ee 100644
--- a/sources/shiboken2/tests/libsample/functions.cpp
+++ b/sources/shiboken2/tests/libsample/functions.cpp
@@ -118,19 +118,19 @@ overloadedFunc(double val)
char*
returnNullPrimitivePointer()
{
- return 0;
+ return nullptr;
}
ObjectType*
returnNullObjectTypePointer()
{
- return 0;
+ return nullptr;
}
Event*
returnNullValueTypePointer()
{
- return 0;
+ return nullptr;
}
unsigned int
diff --git a/sources/shiboken2/tests/libsample/handle.h b/sources/shiboken2/tests/libsample/handle.h
index 400a0a3a6..824c28b9a 100644
--- a/sources/shiboken2/tests/libsample/handle.h
+++ b/sources/shiboken2/tests/libsample/handle.h
@@ -33,19 +33,19 @@
/* See http://bugs.pyside.org/show_bug.cgi?id=1105. */
namespace Foo {
- typedef unsigned long HANDLE;
+ using HANDLE = unsigned long;
}
class LIBSAMPLE_API OBJ
{
};
-typedef OBJ* HANDLE;
+using HANDLE = OBJ *;
class LIBSAMPLE_API HandleHolder
{
public:
- explicit HandleHolder(HANDLE ptr = 0) : m_handle(ptr) {}
+ explicit HandleHolder(HANDLE ptr = nullptr) : m_handle(ptr) {}
explicit HandleHolder(Foo::HANDLE val): m_handle2(val) {}
inline void set(HANDLE ptr) { HANDLE tmp; tmp = m_handle; m_handle = tmp; }
@@ -63,7 +63,7 @@ private:
};
struct LIBSAMPLE_API PrimitiveStruct {};
-typedef struct PrimitiveStruct* PrimitiveStructPtr;
+using PrimitiveStructPtr = struct PrimitiveStruct *;
struct LIBSAMPLE_API PrimitiveStructPointerHolder
{
PrimitiveStructPtr primitiveStructPtr;
diff --git a/sources/shiboken2/tests/libsample/listuser.h b/sources/shiboken2/tests/libsample/listuser.h
index 92360884f..7e67039d9 100644
--- a/sources/shiboken2/tests/libsample/listuser.h
+++ b/sources/shiboken2/tests/libsample/listuser.h
@@ -39,7 +39,7 @@
class LIBSAMPLE_API ListUser
{
public:
- typedef std::list<Point*> PointList;
+ using PointList = std::list<Point *>;
enum ListOfSomething {
ListOfPoint,
diff --git a/sources/shiboken2/tests/libsample/modifications.h b/sources/shiboken2/tests/libsample/modifications.h
index 035ec844e..fa32bdec3 100644
--- a/sources/shiboken2/tests/libsample/modifications.h
+++ b/sources/shiboken2/tests/libsample/modifications.h
@@ -117,7 +117,7 @@ public:
double callDifferenceOfPointCoordinates(const Point* pt, bool* ok) { return differenceOfPointCoordinates(pt, ok); }
// Sets an ObjectType in the argument and returns true.
- bool nonConversionRuleForArgumentWithDefaultValue(ObjectType** object = 0);
+ bool nonConversionRuleForArgumentWithDefaultValue(ObjectType **object = nullptr);
ObjectType* getObject() const { return m_object; }
// Inject code with a %CONVERTTOPYTHON that receives an user's primitive type.
diff --git a/sources/shiboken2/tests/libsample/objectmodel.h b/sources/shiboken2/tests/libsample/objectmodel.h
index e15ce06a4..1890ac47f 100644
--- a/sources/shiboken2/tests/libsample/objectmodel.h
+++ b/sources/shiboken2/tests/libsample/objectmodel.h
@@ -35,8 +35,8 @@
class LIBSAMPLE_API ObjectModel : public ObjectType
{
public:
- explicit ObjectModel(ObjectType* parent = 0)
- : ObjectType(parent), m_data(0)
+ explicit ObjectModel(ObjectType *parent = nullptr)
+ : ObjectType(parent), m_data(nullptr)
{}
void setData(ObjectType* data);
diff --git a/sources/shiboken2/tests/libsample/objecttype.cpp b/sources/shiboken2/tests/libsample/objecttype.cpp
index f82b7cf0d..855c08611 100644
--- a/sources/shiboken2/tests/libsample/objecttype.cpp
+++ b/sources/shiboken2/tests/libsample/objecttype.cpp
@@ -35,7 +35,7 @@
using namespace std;
-ObjectType::ObjectType(ObjectType* parent) : m_parent(0), m_layout(0), m_call_id(-1)
+ObjectType::ObjectType(ObjectType* parent) : m_parent(nullptr), m_layout(nullptr), m_call_id(-1)
{
setParent(parent);
}
@@ -66,7 +66,7 @@ ObjectType::removeChild(ObjectType* child)
ObjectTypeList::iterator child_iter = std::find(m_children.begin(), m_children.end(), child);
if (child_iter != m_children.end()) {
m_children.erase(child_iter);
- child->m_parent = 0;
+ child->m_parent = nullptr;
}
}
@@ -74,15 +74,15 @@ ObjectType*
ObjectType::takeChild(ObjectType* child)
{
if (!child)
- return 0;
+ return nullptr;
ObjectTypeList::iterator child_iter = std::find(m_children.begin(), m_children.end(), child);
if (child_iter != m_children.end()) {
m_children.erase(child_iter);
- child->m_parent = 0;
+ child->m_parent = nullptr;
return child;
}
- return 0;
+ return nullptr;
}
ObjectType*
@@ -101,7 +101,7 @@ ObjectType::findChild(const Str& name)
if ((*child_iter)->objectName() == name)
return *child_iter;
}
- return 0;
+ return nullptr;
}
void
@@ -218,8 +218,8 @@ ObjectTypeLayout* ObjectType::takeLayout()
{
ObjectTypeLayout* l = layout();
if (!l)
- return 0;
- m_layout = 0;
+ return nullptr;
+ m_layout = nullptr;
l->setParent(0);
return l;
}
diff --git a/sources/shiboken2/tests/libsample/objecttype.h b/sources/shiboken2/tests/libsample/objecttype.h
index ecd67b684..1f2a9c7e8 100644
--- a/sources/shiboken2/tests/libsample/objecttype.h
+++ b/sources/shiboken2/tests/libsample/objecttype.h
@@ -69,9 +69,9 @@ class LIBSAMPLE_API ObjectType
{
public:
// ### Fixme: Use uintptr_t in C++ 11
- typedef size_t Identifier;
+ using Identifier = size_t;
- explicit ObjectType(ObjectType* parent = 0);
+ explicit ObjectType(ObjectType *parent = nullptr);
virtual ~ObjectType();
// factory method
diff --git a/sources/shiboken2/tests/libsample/objectview.h b/sources/shiboken2/tests/libsample/objectview.h
index 6a54057e9..b68d031e9 100644
--- a/sources/shiboken2/tests/libsample/objectview.h
+++ b/sources/shiboken2/tests/libsample/objectview.h
@@ -38,7 +38,7 @@ class ObjectModel;
class LIBSAMPLE_API ObjectView : public ObjectType
{
public:
- ObjectView(ObjectModel* model = 0, ObjectType* parent = 0)
+ ObjectView(ObjectModel *model = nullptr, ObjectType *parent = nullptr)
: ObjectType(parent), m_model(model)
{}
diff --git a/sources/shiboken2/tests/libsample/overload.h b/sources/shiboken2/tests/libsample/overload.h
index 6d0165619..aa2572d50 100644
--- a/sources/shiboken2/tests/libsample/overload.h
+++ b/sources/shiboken2/tests/libsample/overload.h
@@ -83,7 +83,7 @@ public:
FunctionEnum wrapperIntIntOverloads(const Polygon& arg0, int arg1, int arg2) { return Function1; }
// Similar to QImage constructor
- FunctionEnum strBufferOverloads(const Str& arg0, const char* arg1 = 0, bool arg2 = true) { return Function0; }
+ FunctionEnum strBufferOverloads(const Str &arg0, const char *arg1 = nullptr, bool arg2 = true) { return Function0; }
FunctionEnum strBufferOverloads(unsigned char* arg0, int arg1) { return Function1; }
FunctionEnum strBufferOverloads() { return Function2; }
diff --git a/sources/shiboken2/tests/libsample/photon.h b/sources/shiboken2/tests/libsample/photon.h
index 2a32d511a..1dcb4f83e 100644
--- a/sources/shiboken2/tests/libsample/photon.h
+++ b/sources/shiboken2/tests/libsample/photon.h
@@ -93,8 +93,8 @@ template class LIBSAMPLE_API TemplateBase<IdentityType>;
template class LIBSAMPLE_API TemplateBase<DuplicatorType>;
#endif
-typedef TemplateBase<IdentityType> ValueIdentity;
-typedef TemplateBase<DuplicatorType> ValueDuplicator;
+using ValueIdentity = TemplateBase<IdentityType>;
+using ValueDuplicator = TemplateBase<DuplicatorType>;
LIBSAMPLE_API int callCalculateForValueDuplicatorPointer(ValueDuplicator* value);
LIBSAMPLE_API int callCalculateForValueDuplicatorReference(ValueDuplicator& value);
@@ -116,7 +116,7 @@ LIBSAMPLE_API int countValueDuplicators(const std::list<TemplateBase<DuplicatorT
class Pointer
{
public:
- Pointer() PHOTON_NOEXCEPT : px(0) {}
+ Pointer() PHOTON_NOEXCEPT : px(nullptr) {}
Pointer(int* p) : px(p) {}
void reset() PHOTON_NOEXCEPT { Pointer().swap(*this); }
diff --git a/sources/shiboken2/tests/libsample/polygon.h b/sources/shiboken2/tests/libsample/polygon.h
index 3eafa3094..728332d1a 100644
--- a/sources/shiboken2/tests/libsample/polygon.h
+++ b/sources/shiboken2/tests/libsample/polygon.h
@@ -37,7 +37,7 @@
class LIBSAMPLE_API Polygon
{
public:
- typedef std::list<Point> PointList;
+ using PointList = std::list<Point>;
Polygon() {}
Polygon(double x, double y);
diff --git a/sources/shiboken2/tests/libsample/protected.h b/sources/shiboken2/tests/libsample/protected.h
index 6cdc66e2b..0f4fbf299 100644
--- a/sources/shiboken2/tests/libsample/protected.h
+++ b/sources/shiboken2/tests/libsample/protected.h
@@ -50,7 +50,7 @@ protected:
inline int protectedSum(int a0, int a1) { return a0 + a1; }
inline int modifiedProtectedSum(int a0, int a1) { return a0 + a1; }
inline static const char* protectedStatic() { return "protectedStatic"; }
- inline const char* dataTypeName(void *data = 0) const { return "pointer"; }
+ inline const char* dataTypeName(void *data = nullptr) const { return "pointer"; }
inline const char* dataTypeName(int data) const { return "integer"; }
private:
@@ -130,8 +130,8 @@ public:
: protectedValueTypeProperty(Point(0, 0)),
protectedProperty(0),
protectedEnumProperty(Event::NO_EVENT),
- protectedValueTypePointerProperty(0),
- protectedObjectTypeProperty(0)
+ protectedValueTypePointerProperty(nullptr),
+ protectedObjectTypeProperty(nullptr)
{}
protected:
// This is deliberately the first member to test wrapper registration
diff --git a/sources/shiboken2/tests/libsample/samplenamespace.cpp b/sources/shiboken2/tests/libsample/samplenamespace.cpp
index e066869d2..fc9f6d395 100644
--- a/sources/shiboken2/tests/libsample/samplenamespace.cpp
+++ b/sources/shiboken2/tests/libsample/samplenamespace.cpp
@@ -78,7 +78,7 @@ getNumber(Option opt)
retval = rand() % 100;
break;
case UnixTime:
- retval = (int) time(0);
+ retval = (int) time(nullptr);
break;
default:
retval = 0;
diff --git a/sources/shiboken2/tests/libsample/samplenamespace.h b/sources/shiboken2/tests/libsample/samplenamespace.h
index 27fa11290..6868b5f0a 100644
--- a/sources/shiboken2/tests/libsample/samplenamespace.h
+++ b/sources/shiboken2/tests/libsample/samplenamespace.h
@@ -92,7 +92,7 @@ inline double powerOfTwo(double num) {
return num * num;
}
-LIBSAMPLE_API void doSomethingWithArray(const unsigned char* data, unsigned int size, const char* format = 0);
+LIBSAMPLE_API void doSomethingWithArray(const unsigned char *data, unsigned int size, const char *format = nullptr);
LIBSAMPLE_API int enumItemAsDefaultValueToIntArgument(int value = ZeroIn);
@@ -145,19 +145,19 @@ public:
// enum SampleNamespace {
// };
virtual OkThisIsRecursiveEnough* someVirtualMethod(OkThisIsRecursiveEnough* arg) { return arg; }
- inline OkThisIsRecursiveEnough* methodReturningTypeFromParentScope() { return 0; }
+ inline OkThisIsRecursiveEnough *methodReturningTypeFromParentScope() { return nullptr; }
};
// The combination of the following two overloaded methods could trigger a
// problematic behaviour on the overload decisor, if it isn't working properly.
-LIBSAMPLE_API void forceDecisorSideA(ObjectType* object = 0);
+LIBSAMPLE_API void forceDecisorSideA(ObjectType *object = nullptr);
LIBSAMPLE_API void forceDecisorSideA(const Point& pt, const Str& text, ObjectType* object = 0);
// The combination of the following two overloaded methods could trigger a
// problematic behaviour on the overload decisor, if it isn't working properly.
// This is a variation of forceDecisorSideB.
-LIBSAMPLE_API void forceDecisorSideB(int a, ObjectType* object = 0);
-LIBSAMPLE_API void forceDecisorSideB(int a, const Point& pt, const Str& text, ObjectType* object = 0);
+LIBSAMPLE_API void forceDecisorSideB(int a, ObjectType *object = nullptr);
+LIBSAMPLE_API void forceDecisorSideB(int a, const Point &pt, const Str &text, ObjectType *object = nullptr);
// Add a new signature on type system with only a Point value as parameter.
LIBSAMPLE_API double passReferenceToValueType(const Point& point, double multiplier);
diff --git a/sources/shiboken2/tests/libsample/simplefile.cpp b/sources/shiboken2/tests/libsample/simplefile.cpp
index a47571a01..3b68e02c3 100644
--- a/sources/shiboken2/tests/libsample/simplefile.cpp
+++ b/sources/shiboken2/tests/libsample/simplefile.cpp
@@ -34,7 +34,7 @@
class SimpleFile_p
{
public:
- SimpleFile_p(const char* filename) : m_descriptor(0), m_size(0)
+ SimpleFile_p(const char* filename) : m_descriptor(nullptr), m_size(0)
{
m_filename = strdup(filename);
}
@@ -73,7 +73,7 @@ long SimpleFile::size()
bool
SimpleFile::open()
{
- if ((p->m_descriptor = fopen(p->m_filename, "rb")) == 0)
+ if ((p->m_descriptor = fopen(p->m_filename, "rb")) == nullptr)
return false;
fseek(p->m_descriptor, 0, SEEK_END);
@@ -88,7 +88,7 @@ SimpleFile::close()
{
if (p->m_descriptor) {
fclose(p->m_descriptor);
- p->m_descriptor = 0;
+ p->m_descriptor = nullptr;
}
}
diff --git a/sources/shiboken2/tests/libsample/size.h b/sources/shiboken2/tests/libsample/size.h
index c72021231..76502b416 100644
--- a/sources/shiboken2/tests/libsample/size.h
+++ b/sources/shiboken2/tests/libsample/size.h
@@ -188,8 +188,8 @@ inline const Size operator/(const Size& s, double div)
return Size(s.m_width / div, s.m_height / div);
}
-typedef double real;
-typedef unsigned short ushort;
+using real = double;
+using ushort = unsigned short;
class LIBSAMPLE_API SizeF
{
public:
diff --git a/sources/shiboken2/tests/libsample/sometime.h b/sources/shiboken2/tests/libsample/sometime.h
index 319cd7f8f..ef16efa29 100644
--- a/sources/shiboken2/tests/libsample/sometime.h
+++ b/sources/shiboken2/tests/libsample/sometime.h
@@ -70,7 +70,7 @@ public:
NumArgs somethingCompletelyDifferent();
NumArgs somethingCompletelyDifferent(int h, int m,
ImplicitConv ic = ImplicitConv::CtorThree,
- ObjectType* type = 0);
+ ObjectType *type = nullptr);
Str toString() const;
bool operator==(const Time& other) const;
diff --git a/sources/shiboken2/tests/libsample/str.h b/sources/shiboken2/tests/libsample/str.h
index d3bcbaafc..2f7cee8c3 100644
--- a/sources/shiboken2/tests/libsample/str.h
+++ b/sources/shiboken2/tests/libsample/str.h
@@ -49,7 +49,7 @@ public:
char get_char(int pos) const;
bool set_char(int pos, char ch);
- int toInt(bool* ok = 0, int base = 10) const;
+ int toInt(bool *ok = nullptr, int base = 10) const;
void show() const;
@@ -71,8 +71,8 @@ private:
LIBSAMPLE_API Str operator+(int number, const Str& str);
LIBSAMPLE_API unsigned int strHash(const Str& str);
-typedef Str PStr;
+using PStr = Str;
LIBSAMPLE_API void changePStr(PStr* pstr, const char* suffix);
-LIBSAMPLE_API void duplicatePStr(PStr* pstr = 0);
+LIBSAMPLE_API void duplicatePStr(PStr *pstr = nullptr);
#endif // STR_H
diff --git a/sources/shiboken2/tests/libsample/strlist.h b/sources/shiboken2/tests/libsample/strlist.h
index 27fc05e6e..43aa15390 100644
--- a/sources/shiboken2/tests/libsample/strlist.h
+++ b/sources/shiboken2/tests/libsample/strlist.h
@@ -60,6 +60,6 @@ private:
CtorEnum m_ctorUsed;
};
-typedef StrList PStrList;
+using PStrList = StrList;
#endif // STRLIST_H
diff --git a/sources/shiboken2/tests/libsample/virtualmethods.cpp b/sources/shiboken2/tests/libsample/virtualmethods.cpp
index 2d26bd7c8..294feca60 100644
--- a/sources/shiboken2/tests/libsample/virtualmethods.cpp
+++ b/sources/shiboken2/tests/libsample/virtualmethods.cpp
@@ -40,7 +40,7 @@ bool
VirtualMethods::createStr(const char* text, Str*& ret)
{
if (!text) {
- ret = 0;
+ ret = nullptr;
return false;
}
diff --git a/sources/shiboken2/tests/libsample/voidholder.h b/sources/shiboken2/tests/libsample/voidholder.h
index 23408fad8..367e99ddf 100644
--- a/sources/shiboken2/tests/libsample/voidholder.h
+++ b/sources/shiboken2/tests/libsample/voidholder.h
@@ -34,7 +34,7 @@
class VoidHolder
{
public:
- explicit VoidHolder(void* ptr = 0) : m_ptr(ptr) {}
+ explicit VoidHolder(void *ptr = nullptr) : m_ptr(ptr) {}
~VoidHolder() {}
inline void* voidPointer() { return m_ptr; }
inline static void* gimmeMeSomeVoidPointer()
diff --git a/sources/shiboken2/tests/libsmart/smart.h b/sources/shiboken2/tests/libsmart/smart.h
index 2e3c96406..3347b22c1 100644
--- a/sources/shiboken2/tests/libsmart/smart.h
+++ b/sources/shiboken2/tests/libsmart/smart.h
@@ -81,7 +81,7 @@ public:
template <class T>
class SharedPtr {
public:
- SharedPtr() : m_refData(0) {
+ SharedPtr() : m_refData(nullptr) {
if (shouldPrint())
std::cout << "shared_ptr default constructor " << this << "\n";
}
@@ -122,7 +122,7 @@ public:
{
if (m_refData)
return m_refData->m_heldPtr;
- return 0;
+ return nullptr;
}
int useCount() const
@@ -147,7 +147,7 @@ public:
{
if (m_refData)
return m_refData->m_heldPtr;
- return 0;
+ return nullptr;
}
bool operator!() const