From 9ad35a85e893eadb6602846194bb87e6f9a65211 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 25 Jun 2019 12:58:12 +0200 Subject: Remove left-over C++ example snippets Change-Id: I15d5c647e68344ae4a05898be6d8a334cf25f3b4 Reviewed-by: Christian Tismer --- .../src/snippets/accessibilityfactorysnippet.cpp | 77 - .../src/snippets/accessibilitypluginsnippet.cpp | 84 - .../codesnippets/doc/src/snippets/brush/brush.cpp | 96 - .../src/snippets/brush/gradientcreationsnippet.cpp | 72 - .../doc/src/snippets/brushstyles/main.cpp | 61 - .../doc/src/snippets/brushstyles/renderarea.cpp | 88 - .../doc/src/snippets/brushstyles/stylewidget.cpp | 154 -- .../doc/src/snippets/buffer/buffer.cpp | 133 - .../doc/src/snippets/clipboard/main.cpp | 62 - .../snippets/code/src_corelib_global_qglobal.cpp | 514 ---- .../snippets/code/src_gui_dialogs_qmessagebox.cpp | 152 -- .../snippets/code/src_gui_text_qtextdocument.cpp | 60 - .../snippets/code/src_sql_kernel_qsqldatabase.cpp | 146 -- .../doc/src/snippets/coordsys/coordsys.cpp | 86 - .../doc/src/snippets/customstyle/customstyle.cpp | 98 - .../doc/src/snippets/customstyle/main.cpp | 64 - .../doc/src/snippets/customviewstyle.cpp | 79 - .../designer/autoconnection/imagedialog.cpp | 79 - .../src/snippets/designer/autoconnection/main.cpp | 61 - .../doc/src/snippets/designer/imagedialog/main.cpp | 63 - .../designer/multipleinheritance/imagedialog.cpp | 69 - .../snippets/designer/multipleinheritance/main.cpp | 61 - .../designer/noautoconnection/imagedialog.cpp | 86 - .../snippets/designer/noautoconnection/main.cpp | 61 - .../designer/singleinheritance/imagedialog.cpp | 69 - .../snippets/designer/singleinheritance/main.cpp | 61 - .../doc/src/snippets/dockwidgets/main.cpp | 62 - .../doc/src/snippets/dockwidgets/mainwindow.cpp | 131 - .../doc/src/snippets/draganddrop/dragwidget.cpp | 163 -- .../doc/src/snippets/draganddrop/main.cpp | 63 - .../doc/src/snippets/draganddrop/mainwindow.cpp | 94 - .../doc/src/snippets/dragging/main.cpp | 61 - .../doc/src/snippets/dropactions/main.cpp | 61 - .../doc/src/snippets/dropactions/window.cpp | 115 - .../doc/src/snippets/dropevents/main.cpp | 62 - .../doc/src/snippets/dropevents/window.cpp | 97 - .../doc/src/snippets/droprectangle/main.cpp | 61 - .../doc/src/snippets/droprectangle/window.cpp | 106 - .../doc/src/snippets/eventfilters/filterobject.cpp | 84 - .../doc/src/snippets/eventfilters/main.cpp | 64 - .../doc/src/snippets/events/events.cpp | 107 - .../snippets/explicitlysharedemployee/employee.cpp | 119 - .../src/snippets/explicitlysharedemployee/main.cpp | 60 - .../codesnippets/doc/src/snippets/file/file.cpp | 130 - .../doc/src/snippets/filedialogurls.cpp | 71 - .../doc/src/snippets/fileinfo/main.cpp | 102 - .../src/snippets/graphicssceneadditemsnippet.cpp | 90 - .../doc/src/snippets/i18n-non-qt-class/main.cpp | 64 - .../doc/src/snippets/i18n-non-qt-class/myclass.cpp | 57 - .../doc/src/snippets/inherited-slot/button.cpp | 63 - .../doc/src/snippets/inherited-slot/main.cpp | 76 - .../doc/src/snippets/itemselection/main.cpp | 125 - .../codesnippets/doc/src/snippets/javastyle.cpp | 2755 -------------------- .../doc/codesnippets/doc/src/snippets/moc/main.cpp | 75 - .../doc/src/snippets/modelview-subclasses/main.cpp | 78 - .../src/snippets/modelview-subclasses/model.cpp | 162 -- .../doc/src/snippets/modelview-subclasses/view.cpp | 324 --- .../src/snippets/modelview-subclasses/window.cpp | 122 - .../doc/src/snippets/painterpath/painterpath.cpp | 86 - .../doc/src/snippets/persistentindexes/main.cpp | 61 - .../src/snippets/persistentindexes/mainwindow.cpp | 130 - .../doc/src/snippets/plaintextlayout/main.cpp | 62 - .../doc/src/snippets/plaintextlayout/window.cpp | 118 - .../doc/src/snippets/pointer/pointer.cpp | 70 - .../doc/src/snippets/porting4-dropevents/main.cpp | 62 - .../src/snippets/porting4-dropevents/window.cpp | 134 - .../doc/src/snippets/printing-qprinter/main.cpp | 63 - .../doc/src/snippets/printing-qprinter/object.cpp | 81 - .../doc/src/snippets/process/process.cpp | 86 - .../doc/src/snippets/qcalendarwidget/main.cpp | 74 - .../doc/src/snippets/qcolumnview/main.cpp | 89 - .../doc/src/snippets/qdebug/qdebugsnippet.cpp | 83 - .../doc/src/snippets/qdir-filepaths/main.cpp | 64 - .../doc/src/snippets/qelapsedtimer/main.cpp | 119 - .../doc/src/snippets/qgl-namespace/main.cpp | 56 - .../codesnippets/doc/src/snippets/qlabel/main.cpp | 98 - .../doc/src/snippets/qlineargradient/main.cpp | 60 - .../src/snippets/qlineargradient/paintwidget.cpp | 77 - .../doc/src/snippets/qlistview-dnd/main.cpp | 61 - .../doc/src/snippets/qlistview-dnd/mainwindow.cpp | 93 - .../doc/src/snippets/qlistview-dnd/model.cpp | 161 -- .../doc/src/snippets/qlistview-using/main.cpp | 61 - .../src/snippets/qlistview-using/mainwindow.cpp | 147 -- .../doc/src/snippets/qlistwidget-dnd/main.cpp | 61 - .../src/snippets/qlistwidget-dnd/mainwindow.cpp | 97 - .../doc/src/snippets/qlistwidget-using/main.cpp | 61 - .../src/snippets/qlistwidget-using/mainwindow.cpp | 168 -- .../src/snippets/qmetaobject-invokable/main.cpp | 62 - .../src/snippets/qmetaobject-invokable/window.cpp | 67 - .../doc/src/snippets/qprocess-environment/main.cpp | 88 - .../snippets/qprocess/qprocess-simpleexecution.cpp | 75 - .../src/snippets/qsignalmapper/buttonwidget.cpp | 77 - .../doc/src/snippets/qsignalmapper/main.cpp | 71 - .../src/snippets/qsortfilterproxymodel/main.cpp | 87 - .../doc/src/snippets/qsplashscreen/mainwindow.cpp | 60 - .../doc/src/snippets/qsql-namespace/main.cpp | 56 - .../codesnippets/doc/src/snippets/qstack/main.cpp | 65 - .../doc/src/snippets/qstackedlayout/main.cpp | 99 - .../doc/src/snippets/qstandarditemmodel/main.cpp | 81 - .../doc/src/snippets/qstringlistmodel/main.cpp | 78 - .../doc/src/snippets/qstyleplugin/main.cpp | 107 - .../doc/src/snippets/qsvgwidget/main.cpp | 69 - .../doc/src/snippets/qt-namespace/main.cpp | 56 - .../doc/src/snippets/qtablewidget-dnd/main.cpp | 61 - .../src/snippets/qtablewidget-dnd/mainwindow.cpp | 153 -- .../src/snippets/qtablewidget-resizing/main.cpp | 61 - .../snippets/qtablewidget-resizing/mainwindow.cpp | 124 - .../doc/src/snippets/qtablewidget-using/main.cpp | 61 - .../src/snippets/qtablewidget-using/mainwindow.cpp | 159 -- .../doc/src/snippets/qtcast/qtcast.cpp | 89 - .../doc/src/snippets/qtest-namespace/main.cpp | 57 - .../doc/src/snippets/qtreeview-dnd/main.cpp | 61 - .../doc/src/snippets/qtreeview-dnd/mainwindow.cpp | 100 - .../doc/src/snippets/qtreeview-dnd/treeitem.cpp | 135 - .../doc/src/snippets/qtreeview-dnd/treemodel.cpp | 272 -- .../doc/src/snippets/qtreewidget-using/main.cpp | 61 - .../qtreewidgetitemiterator-using/main.cpp | 61 - .../doc/src/snippets/qtscript/evaluation/main.cpp | 60 - .../snippets/qtscript/registeringobjects/main.cpp | 66 - .../qtscript/registeringobjects/myobject.cpp | 63 - .../snippets/qtscript/registeringvalues/main.cpp | 62 - .../src/snippets/qtscript/scriptedslot/main.cpp | 82 - .../doc/src/snippets/quiloader/main.cpp | 77 - .../doc/src/snippets/quiloader/mywidget.cpp | 69 - .../doc/src/snippets/qx11embedcontainer/main.cpp | 77 - .../src/snippets/qx11embedwidget/embedwidget.cpp | 76 - .../doc/src/snippets/qx11embedwidget/main.cpp | 71 - .../doc/src/snippets/qxmlschema/main.cpp | 124 - .../doc/src/snippets/qxmlstreamwriter/main.cpp | 86 - .../doc/src/snippets/reading-selections/main.cpp | 69 - .../doc/src/snippets/reading-selections/window.cpp | 130 - .../doc/src/snippets/scribe-overview/main.cpp | 81 - .../doc/src/snippets/scriptdebugger.cpp | 113 - .../doc/src/snippets/separations/finalwidget.cpp | 136 - .../doc/src/snippets/separations/main.cpp | 60 - .../doc/src/snippets/separations/screenwidget.cpp | 227 -- .../doc/src/snippets/separations/viewer.cpp | 338 --- .../doc/src/snippets/settings/settings.cpp | 188 -- .../doc/src/snippets/sharedemployee/employee.cpp | 51 - .../doc/src/snippets/sharedemployee/main.cpp | 60 - .../doc/src/snippets/sharedtablemodel/main.cpp | 99 - .../doc/src/snippets/signalmapper/filereader.cpp | 109 - .../doc/src/snippets/signalmapper/main.cpp | 63 - .../doc/src/snippets/signalsandslots/lcdnumber.cpp | 87 - .../snippets/signalsandslots/signalsandslots.cpp | 94 - .../doc/src/snippets/simplemodel-use/main.cpp | 103 - .../doc/src/snippets/simpleparse/handler.cpp | 148 -- .../doc/src/snippets/simpleparse/main.cpp | 97 - .../doc/src/snippets/splitterhandle/main.cpp | 67 - .../doc/src/snippets/splitterhandle/splitter.cpp | 88 - .../doc/src/snippets/streaming/main.cpp | 118 - .../doc/src/snippets/stringlistmodel/main.cpp | 89 - .../doc/src/snippets/textblock-formats/main.cpp | 128 - .../doc/src/snippets/textblock-fragments/main.cpp | 62 - .../snippets/textblock-fragments/mainwindow.cpp | 158 -- .../src/snippets/textblock-fragments/xmlwriter.cpp | 128 - .../doc/src/snippets/textdocument-blocks/main.cpp | 62 - .../snippets/textdocument-blocks/mainwindow.cpp | 166 -- .../src/snippets/textdocument-blocks/xmlwriter.cpp | 94 - .../src/snippets/textdocument-charformats/main.cpp | 102 - .../doc/src/snippets/textdocument-cursors/main.cpp | 89 - .../doc/src/snippets/textdocument-find/main.cpp | 101 - .../doc/src/snippets/textdocument-frames/main.cpp | 63 - .../snippets/textdocument-frames/mainwindow.cpp | 171 -- .../src/snippets/textdocument-frames/xmlwriter.cpp | 126 - .../src/snippets/textdocument-imagedrop/main.cpp | 62 - .../snippets/textdocument-imagedrop/textedit.cpp | 81 - .../src/snippets/textdocument-imageformat/main.cpp | 108 - .../doc/src/snippets/textdocument-images/main.cpp | 82 - .../src/snippets/textdocument-listitems/main.cpp | 62 - .../snippets/textdocument-listitems/mainwindow.cpp | 207 -- .../doc/src/snippets/textdocument-lists/main.cpp | 62 - .../src/snippets/textdocument-lists/mainwindow.cpp | 201 -- .../src/snippets/textdocument-printing/main.cpp | 62 - .../snippets/textdocument-printing/mainwindow.cpp | 134 - .../src/snippets/textdocument-selections/main.cpp | 62 - .../textdocument-selections/mainwindow.cpp | 213 -- .../doc/src/snippets/textdocument-tables/main.cpp | 62 - .../src/snippets/textdocument-tables/xmlwriter.cpp | 163 -- .../doc/src/snippets/textdocumentendsnippet.cpp | 68 - .../doc/src/snippets/threads/threads.cpp | 130 - .../doc/src/snippets/timeline/main.cpp | 82 - .../src/snippets/uitools/calculatorform/main.cpp | 67 - .../doc/src/snippets/updating-selections/main.cpp | 69 - .../src/snippets/updating-selections/window.cpp | 119 - .../doc/src/snippets/webkit/webpage/main.cpp | 93 - .../doc/src/snippets/widget-mask/main.cpp | 64 - .../snippets/widgets-tutorial/childwidget/main.cpp | 67 - .../widgets-tutorial/nestedlayouts/main.cpp | 98 - .../snippets/widgets-tutorial/toplevel/main.cpp | 63 - .../widgets-tutorial/windowlayout/main.cpp | 69 - .../doc/src/snippets/xml/rsslisting/handler.cpp | 188 -- .../doc/src/snippets/xml/rsslisting/main.cpp | 73 - .../doc/src/snippets/xml/rsslisting/rsslisting.cpp | 255 -- 194 files changed, 21720 deletions(-) delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/accessibilityfactorysnippet.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/accessibilitypluginsnippet.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/brush/brush.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/brush/gradientcreationsnippet.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/brushstyles/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/brushstyles/renderarea.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/brushstyles/stylewidget.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/buffer/buffer.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/clipboard/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/code/src_corelib_global_qglobal.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/code/src_gui_dialogs_qmessagebox.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/code/src_gui_text_qtextdocument.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/code/src_sql_kernel_qsqldatabase.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/coordsys/coordsys.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/customstyle/customstyle.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/customstyle/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/customviewstyle.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/designer/autoconnection/imagedialog.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/designer/autoconnection/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/designer/imagedialog/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/designer/multipleinheritance/imagedialog.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/designer/multipleinheritance/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/designer/noautoconnection/imagedialog.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/designer/noautoconnection/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/designer/singleinheritance/imagedialog.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/designer/singleinheritance/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/dockwidgets/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/dockwidgets/mainwindow.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/draganddrop/dragwidget.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/draganddrop/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/draganddrop/mainwindow.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/dragging/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/dropactions/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/dropactions/window.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/dropevents/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/dropevents/window.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/droprectangle/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/droprectangle/window.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/eventfilters/filterobject.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/eventfilters/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/events/events.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/explicitlysharedemployee/employee.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/explicitlysharedemployee/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/file/file.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/filedialogurls.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/fileinfo/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/graphicssceneadditemsnippet.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/i18n-non-qt-class/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/i18n-non-qt-class/myclass.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/inherited-slot/button.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/inherited-slot/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/itemselection/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/javastyle.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/moc/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/modelview-subclasses/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/modelview-subclasses/model.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/modelview-subclasses/view.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/modelview-subclasses/window.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/painterpath/painterpath.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/persistentindexes/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/persistentindexes/mainwindow.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/plaintextlayout/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/plaintextlayout/window.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/pointer/pointer.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/porting4-dropevents/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/porting4-dropevents/window.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/printing-qprinter/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/printing-qprinter/object.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/process/process.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qcalendarwidget/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qcolumnview/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qdebug/qdebugsnippet.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qdir-filepaths/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qelapsedtimer/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qgl-namespace/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qlabel/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qlineargradient/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qlineargradient/paintwidget.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qlistview-dnd/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qlistview-dnd/mainwindow.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qlistview-dnd/model.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qlistview-using/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qlistview-using/mainwindow.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qlistwidget-dnd/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qlistwidget-dnd/mainwindow.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qlistwidget-using/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qlistwidget-using/mainwindow.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qmetaobject-invokable/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qmetaobject-invokable/window.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qprocess-environment/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qprocess/qprocess-simpleexecution.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qsignalmapper/buttonwidget.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qsignalmapper/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qsortfilterproxymodel/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qsplashscreen/mainwindow.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qsql-namespace/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qstack/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qstackedlayout/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qstandarditemmodel/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qstringlistmodel/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qstyleplugin/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qsvgwidget/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qt-namespace/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qtablewidget-dnd/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qtablewidget-dnd/mainwindow.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qtablewidget-resizing/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qtablewidget-resizing/mainwindow.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qtablewidget-using/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qtablewidget-using/mainwindow.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qtcast/qtcast.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qtest-namespace/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qtreeview-dnd/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qtreeview-dnd/mainwindow.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qtreeview-dnd/treeitem.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qtreeview-dnd/treemodel.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qtreewidget-using/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qtreewidgetitemiterator-using/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qtscript/evaluation/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qtscript/registeringobjects/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qtscript/registeringobjects/myobject.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qtscript/registeringvalues/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qtscript/scriptedslot/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/quiloader/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/quiloader/mywidget.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qx11embedcontainer/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qx11embedwidget/embedwidget.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qx11embedwidget/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qxmlschema/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/qxmlstreamwriter/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/reading-selections/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/reading-selections/window.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/scribe-overview/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/scriptdebugger.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/separations/finalwidget.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/separations/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/separations/screenwidget.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/separations/viewer.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/settings/settings.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/sharedemployee/employee.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/sharedemployee/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/sharedtablemodel/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/signalmapper/filereader.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/signalmapper/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/signalsandslots/lcdnumber.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/signalsandslots/signalsandslots.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/simplemodel-use/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/simpleparse/handler.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/simpleparse/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/splitterhandle/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/splitterhandle/splitter.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/streaming/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/stringlistmodel/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/textblock-formats/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/textblock-fragments/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/textblock-fragments/mainwindow.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/textblock-fragments/xmlwriter.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-blocks/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-blocks/mainwindow.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-blocks/xmlwriter.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-charformats/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-cursors/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-find/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-frames/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-frames/mainwindow.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-frames/xmlwriter.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-imagedrop/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-imagedrop/textedit.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-imageformat/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-images/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-listitems/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-listitems/mainwindow.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-lists/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-lists/mainwindow.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-printing/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-printing/mainwindow.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-selections/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-selections/mainwindow.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-tables/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/textdocument-tables/xmlwriter.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/textdocumentendsnippet.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/threads/threads.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/timeline/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/uitools/calculatorform/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/updating-selections/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/updating-selections/window.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/webkit/webpage/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/widget-mask/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/widgets-tutorial/childwidget/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/widgets-tutorial/nestedlayouts/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/widgets-tutorial/toplevel/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/widgets-tutorial/windowlayout/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/xml/rsslisting/handler.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/xml/rsslisting/main.cpp delete mode 100644 sources/pyside2/doc/codesnippets/doc/src/snippets/xml/rsslisting/rsslisting.cpp (limited to 'sources/pyside2/doc/codesnippets/doc/src/snippets') 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 - -//! [0] -QAccessibleInterface *sliderFactory(const QString &classname, QObject *object) -{ - QAccessibleInterface *interface = 0; - - if (classname == "QSlider" && object && object->isWidgetType()) - interface = new SliderInterface(classname, - static_cast(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 - -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(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 - -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 - -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 - -#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 - -#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 - -#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 -#include -#include - -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 - -#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 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 - -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 - -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 -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 -#include -#include - -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 -#include - -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 ") -html = Qt::escape(plain) -# html == "#include <QtCore>" -//! [0] - - -//! [1] -... -//! [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 - -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 - -#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 - -#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 - -#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 - -#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 - -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 - -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 - -#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 - -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 - -#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 - -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 - -#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 - -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 - -#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 - -#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 - -#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 - -#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 - -#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 - -#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 - -#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 - -#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 - -#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 - -#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 - -#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 - -#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 - -#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(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 -#include - -#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 -#include - -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(event); - if (ke->key() == Qt::Key_Tab) { - // special tab handling here - return true; - } - } else if (event->type() == MyCustomEventType) { - MyCustomEvent *myEvent = static_cast(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 -#include - -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 - -int main(int argv, char **args) -{ - QApplication app(argv, args); - -//![0] - QList 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 -#include -#include -#include -#include -#include -#include - -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 - -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 -#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 -#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 -#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 -#include -#include -#include -#include -#include -#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 -#include -#include -#include - -#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 - -#include "javastyle.h" -#include - -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(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(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(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(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(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(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(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(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(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(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(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(option); - if (copy.state & State_HasFocus) - copy.state ^= State_HasFocus; - painter->setBrush(Qt::NoBrush); - QWindowsStyle::drawControl(CE_TabBarTabLabel, ©, painter, - widget); - break; - } - case CE_TabBarTabShape: { - const QStyleOptionTab *tab = - qstyleoption_cast(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(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(widget) || - qobject_cast(widget) || - qobject_cast(widget) || - qobject_cast(widget) || - qobject_cast(widget) || - qobject_cast(widget)) - widget->setAttribute(Qt::WA_Hover, true); -} - -void JavaStyle::unpolish(QWidget *widget) -{ - if (qobject_cast(widget) || - qobject_cast(widget) || - qobject_cast(widget) || - qobject_cast(widget) || - qobject_cast(widget) || - qobject_cast(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(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(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(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(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(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(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(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(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(option); - if (slider->tickPosition == QSlider::TicksBelow) { - return QSize(contentsSize.width(), contentsSize.height() + 15); - } else { - return contentsSize; - } - } - case CT_MenuBarItem: { - const QStyleOptionMenuItem *menuItem = - qstyleoption_cast(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(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 - -#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 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#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 -#include -#include -#include -#include -#include -#include - -#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 - - - -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 - -#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 - -#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 ¤tIndex) -{ - 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 - -#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 -#include - -#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 -#include -#include - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - -//! [0] - QPointer 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 - -#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 - -#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(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 -#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 -#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 - -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 -#include - -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 - -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 -#include - -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 -#include - -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 - -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 - -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 - -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 -#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 -#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 - -#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 - -#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 - -#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 - -#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 - -#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 ¤t) -{ - 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 - -#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 - -#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 - -#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 - -#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 -#include -#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 - -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 -#include - -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 - -#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 - -#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 - -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 - -#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 - -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 -#include -using namespace std; - -int main(int argc, char *argv[]) -{ -//! [0] - QStack 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 -#include - -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 -#include - -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 - -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 -#include - -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 -#include - -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 - -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 - -#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 -#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 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 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 - -#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 - -#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 - -#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 -#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 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 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 -#include - -#include "qtcast.h" - -MyWidget::MyWidget() -{ -//! [0] - QObject *obj = new MyWidget; -//! [0] - -//! [1] - QWidget *widget = qobject_cast(obj); -//! [1] - -//! [2] - MyWidget *myWidget = qobject_cast(obj); -//! [2] - -//! [3] - QLabel *label = qobject_cast(obj); -//! [3] //! [4] - // label is 0 -//! [4] - -//! [5] - if (QLabel *label = qobject_cast(obj)) { -//! [5] //! [6] - label->setText(tr("Ping")); - } else if (QPushButton *button = qobject_cast(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 - -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 - -#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 - -#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 - -#include "treeitem.h" - -TreeItem::TreeItem(const QList &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(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 - -#include "treeitem.h" -#include "treemodel.h" - -TreeModel::TreeModel(const QStringList &strings, QObject *parent) - : QAbstractItemModel(parent) -{ - QList 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(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(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(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(parent.internalPointer()); - - if (position < 0 || position > parentItem->childCount()) - return false; - - QList 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(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(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(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(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 parents; - QList 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 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 - -#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 - -#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 - -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 -#include -#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 - -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 -#include -#include -#include -#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 -#include - -#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 -#include - -#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 -#include - -//! [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 - -#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 -#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 -#include - -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("" - + "" - + "" ) - - 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 -#include -#include -#include - -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(""); - 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 - -#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 -#include -#include -#include -#include -#include - -#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 -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("

Scribe Overview

") - - 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 -#include -#include - -// 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 -#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 -#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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#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 - -#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 - -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 -#include -#include -#include - -#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 -#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 -#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 - -#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(new QObject(0)); -//! [5] - if (widget->inherits("QAbstractButton")) { - QAbstractButton *button = static_cast(widget); - button->toggle(); -//! [5] //! [6] - } -//! [6] - -//! [7] - if (QAbstractButton *button = qobject_cast(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 - -/*! - 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 -#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& 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 -#include -#include "handler.h" - -#include - -int main(int argc, char **argv) -{ - if (argc != 2) { - std::cout << "Usage: " << argv[0] << " " << 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 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 -#include - -#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 - -#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 -#include -#include - -//! [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 -#include -#include - -#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 - -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 - -#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 - -#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 - -#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 ¤tBlock, - 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 ¤tBlock) -{ -} - -void XmlWriter::processFragment(const QTextFragment ¤tFragment) -{ -} 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 - -#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 - -#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 - -#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 - -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 - -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 - -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 - -#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 - -#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 - -#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 -#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 - -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(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 - -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 - -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 - -#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 - -#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 - -#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 - -#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 - -#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 - -#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 - -#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 - -#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 - -#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 - -#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(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 -#include - -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 -#include -#include - -#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 *> caches; - -void cacheObject(const QString &key, SomeClass *object) -//! [7] //! [8] -{ - if (!caches.hasLocalData()) - caches.setLocalData(new QCache); - - 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 -#include - -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 - -//! [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 - -#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 -#include -#include -#include - -#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 ¤t, - 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 - -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 - -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 - -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 rows = QList() - << (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 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 - -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 - -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 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; -} - -- cgit v1.2.3