Skip to content

Commit

Permalink
Doc: Clean up widget snippets project
Browse files Browse the repository at this point in the history
The main snippets project must be a subdirs project.
Move some files and update the affected documentation.

Task-number: QTBUG-86497
Change-Id: I60073d1b8bd53aa09600eeccf06ba8457ac7c708
Reviewed-by: Venugopal Shivashankar <[email protected]>
(cherry picked from commit e7c15a6)
Reviewed-by: Qt Cherry-pick Bot <[email protected]>
  • Loading branch information
paulwicking authored and Qt Cherry-pick Bot committed Sep 10, 2020
1 parent 9650b78 commit febce79
Show file tree
Hide file tree
Showing 14 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/widgets/dialogs/qfiledialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ QFileDialog::~QFileDialog()
For instance:
\snippet filedialogurls.cpp 0
\snippet filedialogurls/filedialogurls.cpp 0
The file dialog will then look like this:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
**
****************************************************************************/

#include <QtGui>
#include <QFileDialog>
#include <QtGui>

int loadFileDialog()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@
**
****************************************************************************/

#include <QtGui>
#include <QGraphicsScene>
#include <QGraphicsEllipseItem>
#include <QGraphicsScene>
#include <QStyleOptionGraphicsItem>
#include <QtGui>

class CustomScene : public QGraphicsScene
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
File renamed without changes.
12 changes: 6 additions & 6 deletions src/widgets/doc/snippets/snippets.pro
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ TARGET = widgets_snippets

QT += widgets printsupport

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)
14 changes: 7 additions & 7 deletions src/widgets/doc/src/graphicsview.qdoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -443,7 +443,7 @@

Example:

\snippet graphicsview.cpp 6
\snippet graphicsview/graphicsview.cpp 6

\section2 Item Groups

Expand Down
2 changes: 1 addition & 1 deletion src/widgets/graphicsview/qgraphicsscene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5362,7 +5362,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
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/styles/qstyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/widgets/widgets/qabstractscrollarea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/widgets/widgets/qmdiarea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1950,7 +1950,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
Expand Down

0 comments on commit febce79

Please sign in to comment.