diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/src/designer-manual.qdoc | 104 | ||||
-rw-r--r-- | doc/src/examples/basicgraphicslayouts.qdoc | 55 | ||||
-rw-r--r-- | doc/src/qnamespace.qdoc | 28 | ||||
-rw-r--r-- | doc/src/qset.qdoc | 10 | ||||
-rw-r--r-- | doc/src/snippets/code/doc_src_stylesheet.qdoc | 5 | ||||
-rw-r--r-- | doc/src/snippets/code/src_gui_image_qpixmap.cpp | 6 | ||||
-rw-r--r-- | doc/src/snippets/qprocess-environment/main.cpp | 13 |
7 files changed, 191 insertions, 30 deletions
diff --git a/doc/src/designer-manual.qdoc b/doc/src/designer-manual.qdoc index 03b74e6..2706182 100644 --- a/doc/src/designer-manual.qdoc +++ b/doc/src/designer-manual.qdoc @@ -2411,12 +2411,106 @@ pixmap property in the property editor. is used to hide widgets that should not be explicitly created by the user, but are required by other widgets. - If you would like to use a container widget that is not a subclass of the - containers provided in \QD, but the container is still based on the notion - of \e{Current Page}, you need to provide a container extension and - tell \QD which method to use to add the pages. This can be done using the - \c{<addpagemethod>} XML tag. + + A complete custom widget specification looks like: + + \code +<ui language="c++"> displayname="MyWidget"> + <widget class="widgets::MyWidget" name="mywidget"/> + <customwidgets> + <customwidget> + <class>widgets::MyWidget</class> + <addpagemethod>addPage</addpagemethod> + <propertyspecifications> + <stringpropertyspecification name="fileName" notr="true" type="singleline" + <stringpropertyspecification name="text" type="richtext" + </propertyspecifications> + </customwidget> + </customwidgets> +</ui> + \endcode + + Attributes of the \c{<ui>} tag: + \table + \header + \o Attribute + \o Presence + \o Values + \o Comment + \row + \o \c{language} + \o optional + \o "c++", "jambi" + \o This attribute specifies the language the custom widget is intended for. + It is mainly there to prevent C++-plugins from appearing in Qt Jambi. + \row + \o \c{displayname} + \o optional + \o Class name + \o The value of the attribute appears in the Widget box and can be used to + strip away namespaces. + \endtable + + The \c{<addpagemethod>} tag tells \QD and \l uic which method should be used to + add pages to a container widget. This applies to container widgets that require + calling a particular method to add a child rather than adding the child by passing + the parent. In particular, this is relevant for containers that are not a + a subclass of the containers provided in \QD, but are based on the notion + of \e{Current Page}. In addition, you need to provide a container extension + for them. + + The \c{<propertyspecifications>} element can contain a list of property meta information. + Currently, properties of type string are supported. For these properties, the + \c{<stringpropertyspecification>} tag can be used. This tag has the following attributes: + + + \table + \header + \o Attribute + \o Presence + \o Values + \o Comment + \row + \o \c{name} + \o required + \o Name of the property + \row + \o \c{type} + \o required + \o See below table + \o The value of the attribute determines how the property editor will handle them. + \row + \o \c{notr} + \o optional + \o "true", "false" + \o If the attribute is "true", the value is not meant to be translated. + \endtable + Values of the \c{type} attribute of the string property: + + \table + \header + \o Value + \o Type + \row + \o \c{"richtext"} + \o Rich text. + \row + \o \c{"multiline"} + \o Multi-line plain text. + \row + \o \c{"singleline"} + \o Single-line plain text. + \row + \o \c{"stylesheet"} + \o A CSS-style sheet. + \row + \o \c{"objectname"} + \o An object name (restricted set of valid characters). + \row + \o \c{"url"} + \o URL, file name. + \endtable \section1 Plugin Requirements diff --git a/doc/src/examples/basicgraphicslayouts.qdoc b/doc/src/examples/basicgraphicslayouts.qdoc index 92571af..9696fb6 100644 --- a/doc/src/examples/basicgraphicslayouts.qdoc +++ b/doc/src/examples/basicgraphicslayouts.qdoc @@ -45,6 +45,7 @@ The Basic Graphics Layouts example shows how to use the layout classes in QGraphicsView: QGraphicsLinearLayout and QGraphicsGridLayout. + In addition to that it shows how to write your own custom layout item. \image basicgraphicslayouts-example.png Screenshot of the Basic Layouts Example @@ -115,26 +116,24 @@ \section1 LayoutItem Class Definition - The \c LayoutItem class is a subclass of QGraphicsWidget. It has a - constructor, a destructor, and a reimplementation of the - {QGraphicsItem::paint()}{paint()} function. + The \c LayoutItem class is a subclass of QGraphicsLayoutItem and + QGraphicsItem. It has a constructor, a destructor, and some required + reimplementations. + Since it inherits QGraphicsLayoutItem it must reimplement + {QGraphicsLayoutItem::setGeometry()}{setGeometry()} and + {QGraphicsLayoutItem::sizeHint()}{sizeHint()}. + In addition to that it inherits QGraphicsItem, so it must reimplement + {QGraphicsItem::boundingRect()}{boundingRect()} and + {QGraphicsItem::paint()}{paint()}. \snippet examples/graphicsview/basicgraphicslayouts/layoutitem.h 0 - The \c LayoutItem class also has a private instance of QPixmap, \c pix. - - \note We subclass QGraphicsWidget so that \c LayoutItem objects can - be automatically plugged into a layout, as QGraphicsWidget is a - specialization of QGraphicsLayoutItem. + The \c LayoutItem class also has a private instance of QPixmap, \c m_pix. \section1 LayoutItem Class Implementation - In \c{LayoutItem}'s constructor, \c pix is instantiated and the - \c{QT_original_R.png} image is loaded into it. We set the size of - \c LayoutItem to be slightly larger than the size of the pixmap as we - require some space around it for borders that we will paint later. - Alternatively, you could scale the pixmap to prevent the item from - becoming smaller than the pixmap. + In \c{LayoutItem}'s constructor, \c m_pix is instantiated and the + \c{block.png} image is loaded into it. \snippet examples/graphicsview/basicgraphicslayouts/layoutitem.cpp 0 @@ -148,4 +147,32 @@ \snippet examples/graphicsview/basicgraphicslayouts/layoutitem.cpp 2 + The reimplementation of {QGraphicsItem::boundingRect()}{boundingRect()} + will set the top left corner at (0,0), and the size of it will be + the size of the layout items + {QGraphicsLayoutItem::geometry()}{geometry()}. This is the area that + we paint within. + + \snippet examples/graphicsview/basicgraphicslayouts/layoutitem.cpp 3 + + + The reimplementation of {QGraphicsLayoutItem::setGeometry()}{setGeometry()} + simply calls its baseclass implementation. However, since this will change + the boundingRect we must also call + {QGraphicsItem::prepareGeometryChange()}{prepareGeometryChange()}. + Finally, we move the item according to \c geom.topLeft(). + + \snippet examples/graphicsview/basicgraphicslayouts/layoutitem.cpp 4 + + + Since we don't want the size of the item to be smaller than the pixmap, we + must make sure that we return a size hint that is larger than \c m_pix. + We also add some extra space around for borders that we will paint later. + Alternatively, you could scale the pixmap to prevent the item from + becoming smaller than the pixmap. + The preferred size is the same as the minimum size hint, while we set + maximum to be a large value + + \snippet examples/graphicsview/basicgraphicslayouts/layoutitem.cpp 5 + */
\ No newline at end of file diff --git a/doc/src/qnamespace.qdoc b/doc/src/qnamespace.qdoc index d9f001e..9ea6b52 100644 --- a/doc/src/qnamespace.qdoc +++ b/doc/src/qnamespace.qdoc @@ -129,13 +129,8 @@ Therefore, if it is important to minimize resource consumption, do not set this attribute. - \value AA_MSWindowsUseDirect3DByDefault Is a Windows specific - attribute, that will make the Direct3D paint engine the - default Qt widget paint engine. Note that you can toggle - usage of the Direct3D engine on individual QWidgets by - setting/clearing the \c WA_MSWindowsUseDirect3D attribute - on a specific widget. \bold {This functionality is - experimental}. + \value AA_MSWindowsUseDirect3DByDefault This value is obsolete and + has no effect. \value AA_DontShowIconsInMenus Actions with the Icon property won't be shown in any menus unless specifically set by the @@ -948,10 +943,8 @@ position. This is set/cleared by QWidget::move() and by QWidget::setGeometry(). - \value WA_MSWindowsUseDirect3D Makes drawing to a widget - with this attribute set use the Direct3D paint engine, if the - Direct3D paint engine is available. \bold {This functionality - is experimental.} + \value WA_MSWindowsUseDirect3D This value is obsolete and has no + effect. \value WA_NoBackground This value is obsolete. Use WA_OpaquePaintEvent instead. @@ -2658,3 +2651,16 @@ \sa QGraphicsWidget::windowFrameSectionAt() */ + +/*! + \enum Qt::TileRule + \since 4.6 + + This enum describes how to repeat or stretch the parts of an image when drawing. + + \value Stretch Scale the image to fit to the available area. + \value Repeat Tile the image until there is no more space. May crop the last image. + \value Round Like Repeat, but scales the images down to ensure that the last image is not cropped. + + \sa QPixmapBorders, qDrawBorderPixmap() +*/ diff --git a/doc/src/qset.qdoc b/doc/src/qset.qdoc index 7fbf97a..9795123 100644 --- a/doc/src/qset.qdoc +++ b/doc/src/qset.qdoc @@ -324,6 +324,16 @@ \sa insert(), remove(), find() */ +/*! + \fn bool QSet::contains(const QSet<T> &other) const + \since 4.6 + + Returns true if the set contains all items from the \a other set; + otherwise returns false. + + \sa insert(), remove(), find() +*/ + /*! \fn QSet::const_iterator QSet::begin() const Returns a const \l{STL-style iterator} positioned at the first diff --git a/doc/src/snippets/code/doc_src_stylesheet.qdoc b/doc/src/snippets/code/doc_src_stylesheet.qdoc index 60622d3..a62148f 100644 --- a/doc/src/snippets/code/doc_src_stylesheet.qdoc +++ b/doc/src/snippets/code/doc_src_stylesheet.qdoc @@ -1538,6 +1538,11 @@ QSplitter::handle:horizontal { QSplitter::handle:vertical { height: 2px; } + +QSplitter::handle:pressed { + url(images/splitter_pressed.png); +} + //! [142] diff --git a/doc/src/snippets/code/src_gui_image_qpixmap.cpp b/doc/src/snippets/code/src_gui_image_qpixmap.cpp index f86eeae..822b466 100644 --- a/doc/src/snippets/code/src_gui_image_qpixmap.cpp +++ b/doc/src/snippets/code/src_gui_image_qpixmap.cpp @@ -10,3 +10,9 @@ static const char * const start_xpm[]={ QPixmap myPixmap; myPixmap->setMask(myPixmap->createHeuristicMask()); //! [1] + +//! [2] +QPixmap pixmap("background.png"); +QRegion exposed; +pixmap.scroll(10, 10, pixmap.rect(), &exposed); +//! [2] diff --git a/doc/src/snippets/qprocess-environment/main.cpp b/doc/src/snippets/qprocess-environment/main.cpp index bce3578..148518b 100644 --- a/doc/src/snippets/qprocess-environment/main.cpp +++ b/doc/src/snippets/qprocess-environment/main.cpp @@ -43,6 +43,7 @@ void startProcess() { + { //! [0] QProcess process; QStringList env = QProcess::systemEnvironment(); @@ -51,6 +52,18 @@ env.replaceInStrings(QRegExp("^PATH=(.*)", Qt::CaseInsensitive), "PATH=\\1;C:\\B process.setEnvironment(env); process.start("myapp"); //! [0] + } + + { +//! [1] +QProcess process; +QHash<QString, QString> env = QProcess::systemEnvironmentHash(); +env.insert("TMPDIR", "C:\\MyApp\\temp"); // Add an environment variable +env["PATH"] += ";C:\\Bin"; +process.setEnvironment(env); +process.start("myapp"); +//! [0] + } } int main(int argc, char *argv[]) |