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>
This commit is contained in:
parent
8a2ca17b2d
commit
e7c15a60ea
@ -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:
|
||||
|
||||
|
@ -48,8 +48,8 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtGui>
|
||||
#include <QFileDialog>
|
||||
#include <QtGui>
|
||||
|
||||
int loadFileDialog()
|
||||
{
|
@ -48,10 +48,10 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtGui>
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsEllipseItem>
|
||||
#include <QGraphicsScene>
|
||||
#include <QStyleOptionGraphicsItem>
|
||||
#include <QtGui>
|
||||
|
||||
class CustomScene : public QGraphicsScene
|
||||
{
|
@ -47,14 +47,14 @@
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
#include <QGraphicsView>
|
||||
#include <QOpenGLWidget>
|
||||
#include <QPrinter>
|
||||
#include <QPrintDialog>
|
||||
#include <QStandardItem>
|
||||
#include <QMimeData>
|
||||
#include <QDrag>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
#include <QGraphicsView>
|
||||
#include <QMimeData>
|
||||
#include <QOpenGLWidget>
|
||||
#include <QPrintDialog>
|
||||
#include <QPrinter>
|
||||
#include <QStandardItem>
|
||||
|
||||
void graphicsview_snippet_main()
|
||||
{
|
@ -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)
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user