diff options
author | Paul Wicking <paul.wicking@qt.io> | 2020-09-08 08:23:36 +0200 |
---|---|---|
committer | Paul Wicking <paul.wicking@qt.io> | 2020-09-10 18:26:39 +0200 |
commit | e7c15a60ea787ffe5e5b2dcd0c0f7c875553b11c (patch) | |
tree | 6a4e2b13cdef3de3f5ff04495901318385c61d44 /src/widgets | |
parent | 8a2ca17b2dcd4947c8777fbc4ec2b086b764f39b (diff) | |
download | qtbase-e7c15a60ea787ffe5e5b2dcd0c0f7c875553b11c.tar.gz |
Doc: Clean up widget snippets project
The main snippets project must be a subdirs project.
Move some files and update the affected documentation.
Task-number: QTBUG-86497
Pick-to: 5.15
Change-Id: I60073d1b8bd53aa09600eeccf06ba8457ac7c708
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
Diffstat (limited to 'src/widgets')
14 files changed, 27 insertions, 27 deletions
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index c4df58b6aa..adbf655750 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -408,7 +408,7 @@ QFileDialog::~QFileDialog() For instance: - \snippet filedialogurls.cpp 0 + \snippet filedialogurls/filedialogurls.cpp 0 The file dialog will then look like this: diff --git a/src/widgets/doc/snippets/customviewstyle.cpp b/src/widgets/doc/snippets/customviewstyle/customviewstyle.cpp index 1e4cf2b711..1e4cf2b711 100644 --- a/src/widgets/doc/snippets/customviewstyle.cpp +++ b/src/widgets/doc/snippets/customviewstyle/customviewstyle.cpp diff --git a/src/widgets/doc/snippets/filedialogurls.cpp b/src/widgets/doc/snippets/filedialogurls/filedialogurls.cpp index 4b73a6c818..f269ad3f20 100644 --- a/src/widgets/doc/snippets/filedialogurls.cpp +++ b/src/widgets/doc/snippets/filedialogurls/filedialogurls.cpp @@ -48,8 +48,8 @@ ** ****************************************************************************/ -#include <QtGui> #include <QFileDialog> +#include <QtGui> int loadFileDialog() { diff --git a/src/widgets/doc/snippets/graphicssceneadditemsnippet.cpp b/src/widgets/doc/snippets/graphicssceneadditem/graphicssceneadditemsnippet.cpp index 0ce135dc63..3d5c172dca 100644 --- a/src/widgets/doc/snippets/graphicssceneadditemsnippet.cpp +++ b/src/widgets/doc/snippets/graphicssceneadditem/graphicssceneadditemsnippet.cpp @@ -48,10 +48,10 @@ ** ****************************************************************************/ -#include <QtGui> -#include <QGraphicsScene> #include <QGraphicsEllipseItem> +#include <QGraphicsScene> #include <QStyleOptionGraphicsItem> +#include <QtGui> class CustomScene : public QGraphicsScene { diff --git a/src/widgets/doc/snippets/graphicsview.cpp b/src/widgets/doc/snippets/graphicsview/graphicsview.cpp index 37947b4a35..29187ba326 100644 --- a/src/widgets/doc/snippets/graphicsview.cpp +++ b/src/widgets/doc/snippets/graphicsview/graphicsview.cpp @@ -47,14 +47,14 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ +#include <QDrag> +#include <QGraphicsSceneMouseEvent> #include <QGraphicsView> +#include <QMimeData> #include <QOpenGLWidget> -#include <QPrinter> #include <QPrintDialog> +#include <QPrinter> #include <QStandardItem> -#include <QMimeData> -#include <QDrag> -#include <QGraphicsSceneMouseEvent> void graphicsview_snippet_main() { diff --git a/src/widgets/doc/snippets/graphicsview_snippet.cpp b/src/widgets/doc/snippets/graphicsview/graphicsview_snippet.cpp index 9d058d0f6a..9d058d0f6a 100644 --- a/src/widgets/doc/snippets/graphicsview_snippet.cpp +++ b/src/widgets/doc/snippets/graphicsview/graphicsview_snippet.cpp diff --git a/src/widgets/doc/snippets/mdiareasnippets.cpp b/src/widgets/doc/snippets/mdiarea/mdiareasnippets.cpp index c1e2d37ccb..c1e2d37ccb 100644 --- a/src/widgets/doc/snippets/mdiareasnippets.cpp +++ b/src/widgets/doc/snippets/mdiarea/mdiareasnippets.cpp diff --git a/src/widgets/doc/snippets/myscrollarea.cpp b/src/widgets/doc/snippets/myscrollarea/myscrollarea.cpp index 8afe4a6834..8afe4a6834 100644 --- a/src/widgets/doc/snippets/myscrollarea.cpp +++ b/src/widgets/doc/snippets/myscrollarea/myscrollarea.cpp diff --git a/src/widgets/doc/snippets/snippets.pro b/src/widgets/doc/snippets/snippets.pro index fcfd998373..55b690b469 100644 --- a/src/widgets/doc/snippets/snippets.pro +++ b/src/widgets/doc/snippets/snippets.pro @@ -8,11 +8,11 @@ QT += widgets QT += printsupport opengl openglwidgets -SOURCES += customviewstyle.cpp \ - filedialogurls.cpp \ - graphicssceneadditemsnippet.cpp \ - graphicsview.cpp \ - mdiareasnippets.cpp \ - myscrollarea.cpp +SOURCES += customviewstyle/customviewstyle.cpp \ + filedialogurls/filedialogurls.cpp \ + graphicssceneadditem/graphicssceneadditemsnippet.cpp \ + graphicsview/graphicsview.cpp \ + mdiarea/mdiareasnippets.cpp \ + myscrollarea/myscrollarea.cpp load(qt_common) diff --git a/src/widgets/doc/src/graphicsview.qdoc b/src/widgets/doc/src/graphicsview.qdoc index 2dfad442a3..bd95e88b20 100644 --- a/src/widgets/doc/src/graphicsview.qdoc +++ b/src/widgets/doc/src/graphicsview.qdoc @@ -89,7 +89,7 @@ descending stacking order (i.e., the first returned item is topmost, and the last item is bottom-most). - \snippet graphicsview.cpp 0 + \snippet graphicsview/graphicsview.cpp 0 QGraphicsScene's event propagation architecture schedules scene events for delivery to items, and also manages propagation between items. If @@ -120,7 +120,7 @@ enable OpenGL support, you can set a QOpenGLWidget as the viewport by calling QGraphicsView::setViewport(). - \snippet graphicsview.cpp 1 + \snippet graphicsview/graphicsview.cpp 1 The view receives input events from the keyboard and mouse, and translates these to scene events (converting the coordinates used @@ -327,7 +327,7 @@ Here is an example of how to implement zoom and rotate slots in a subclass of QGraphicsView: - \snippet graphicsview_snippet.cpp 2 + \snippet graphicsview/graphicsview_snippet.cpp 2 The slots could be connected to \l{QToolButton}{QToolButtons} with \l{QAbstractButton::autoRepeat}{autoRepeat} enabled. @@ -347,7 +347,7 @@ a QPainter to either of the rendering functions. This example shows how to print the whole scene into a full page, using QPrinter. - \snippet graphicsview.cpp 3 + \snippet graphicsview/graphicsview.cpp 3 The difference between the scene and view rendering functions is that one operates in scene coordinates, and the other in view coordinates. @@ -358,7 +358,7 @@ is to render the exact contents of the viewport using the provided painter. - \snippet graphicsview.cpp 4 + \snippet graphicsview/graphicsview.cpp 4 When the source and target areas' sizes do not match, the source contents are stretched to fit into the target area. By passing a @@ -384,7 +384,7 @@ so in mousePressEvent() or mouseMoveEvent(), you can get the originating widget pointer from the event. For example: - \snippet graphicsview.cpp 5 + \snippet graphicsview/graphicsview.cpp 5 To intercept drag and drop events for the scene, you reimplement QGraphicsScene::dragEnterEvent() and whichever event handlers your @@ -443,7 +443,7 @@ Example: - \snippet graphicsview.cpp 6 + \snippet graphicsview/graphicsview.cpp 6 \section2 Item Groups diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp index 545b7c6c9b..220221a5e9 100644 --- a/src/widgets/graphicsview/qgraphicsscene.cpp +++ b/src/widgets/graphicsview/qgraphicsscene.cpp @@ -5272,7 +5272,7 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool Example: - \snippet graphicssceneadditemsnippet.cpp 0 + \snippet graphicssceneadditem/graphicssceneadditemsnippet.cpp 0 Since Qt 4.6, this function is not called anymore unless the QGraphicsView::IndirectPainting flag is given as an Optimization diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp index 5f58540eb6..d327bca5fe 100644 --- a/src/widgets/styles/qstyle.cpp +++ b/src/widgets/styles/qstyle.cpp @@ -372,7 +372,7 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C We include a small example where we customize the drawing of item backgrounds. - \snippet customviewstyle.cpp 0 + \snippet customviewstyle/customviewstyle.cpp 0 The primitive element PE_PanelItemViewItem is responsible for painting the background of items, and is called from diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp index be6a0c3288..f692054f76 100644 --- a/src/widgets/widgets/qabstractscrollarea.cpp +++ b/src/widgets/widgets/qabstractscrollarea.cpp @@ -127,13 +127,13 @@ QT_BEGIN_NAMESPACE QWidget::move(). When the area contents or the viewport size changes, we do the following: - \snippet myscrollarea.cpp 1 + \snippet myscrollarea/myscrollarea.cpp 1 When the scroll bars change value, we need to update the widget position, i.e., find the part of the widget that is to be drawn in the viewport: - \snippet myscrollarea.cpp 0 + \snippet myscrollarea/myscrollarea.cpp 0 In order to track scroll bar movements, reimplement the virtual function scrollContentsBy(). In order to fine-tune scrolling diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp index 5311fbdb13..782c20660a 100644 --- a/src/widgets/widgets/qmdiarea.cpp +++ b/src/widgets/widgets/qmdiarea.cpp @@ -51,7 +51,7 @@ applications, but can also be placed in any layout. The following code adds an area to a main window: - \snippet mdiareasnippets.cpp 0 + \snippet mdiarea/mdiareasnippets.cpp 0 Unlike the window managers for top-level windows, all window flags (Qt::WindowFlags) are supported by QMdiArea as long as the flags @@ -1948,7 +1948,7 @@ void QMdiArea::activatePreviousSubWindow() \note Once the subwindow has been added, its parent will be the \e{viewport widget} of the QMdiArea. - \snippet mdiareasnippets.cpp 1 + \snippet mdiarea/mdiareasnippets.cpp 1 When you create your own subwindow, you must set the Qt::WA_DeleteOnClose widget attribute if you want the window to be |