diff options
Diffstat (limited to 'doc/src/snippets/code')
8 files changed, 92 insertions, 3 deletions
diff --git a/doc/src/snippets/code/doc_src_introtodbus.qdoc b/doc/src/snippets/code/doc_src_introtodbus.qdoc index bedfe7f..97b14e9 100644 --- a/doc/src/snippets/code/doc_src_introtodbus.qdoc +++ b/doc/src/snippets/code/doc_src_introtodbus.qdoc @@ -1,3 +1,8 @@ //! [0] org.freedesktop.DBus //! [0] + +//! [QDBUS_DEBUG] +examples/dbus/remotecontrolledcar/controller/controller & +QDBUS_DEBUG=1 examples/dbus/remotecontrolledcar/car/car & +//! [QDBUS_DEBUG] 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_corelib_tools_qeasingcurve.cpp b/doc/src/snippets/code/src_corelib_tools_qeasingcurve.cpp new file mode 100644 index 0000000..65358ea --- /dev/null +++ b/doc/src/snippets/code/src_corelib_tools_qeasingcurve.cpp @@ -0,0 +1,4 @@ +//! [0] +qreal myEasingFunction(qreal progress); +//! [0] + 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/code/src_gui_image_qpixmapcache.cpp b/doc/src/snippets/code/src_gui_image_qpixmapcache.cpp index c4b6353..2a04f64 100644 --- a/doc/src/snippets/code/src_gui_image_qpixmapcache.cpp +++ b/doc/src/snippets/code/src_gui_image_qpixmapcache.cpp @@ -13,7 +13,7 @@ painter->drawPixmap(0, 0, p); //! [1] QPixmap pm; -if (!QPixmapCache::find("my_big_image", pm)) { +if (!QPixmapCache::find("my_big_image", &pm)) { pm.load("bigimage.png"); QPixmapCache::insert("my_big_image", pm); } diff --git a/doc/src/snippets/code/src_gui_painting_qpen.cpp b/doc/src/snippets/code/src_gui_painting_qpen.cpp index 538fa09..b5995f7 100644 --- a/doc/src/snippets/code/src_gui_painting_qpen.cpp +++ b/doc/src/snippets/code/src_gui_painting_qpen.cpp @@ -25,7 +25,7 @@ QVector<qreal> dashes; qreal space = 4; dashes << 1 << space << 3 << space << 9 << space - << 27 << space << 9; + << 27 << space << 9 << space; pen.setDashPattern(dashes); //! [2] @@ -36,6 +36,6 @@ QPen pen; QVector<qreal> dashes; qreal space = 4; dashes << 1 << space << 3 << space << 9 << space - << 27 << space << 9; + << 27 << space << 9 << space; pen.setDashPattern(dashes); //! [3] diff --git a/doc/src/snippets/code/src_gui_qproxystyle.cpp b/doc/src/snippets/code/src_gui_qproxystyle.cpp new file mode 100644 index 0000000..46a2a5f --- /dev/null +++ b/doc/src/snippets/code/src_gui_qproxystyle.cpp @@ -0,0 +1,45 @@ +//! [0] +class MyProxyStyle : public QProxyStyle +{ +public: + + int styleHint(StyleHint hint, const QStyleOption *option = 0, + const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const + { + if (hint == QStyle::SH_UnderlineShortcut) + return 1; + return QProxyStyle::styleHint(hint, option, widget, returnData); + } +}; + +//! [0] + +//! [1] +#include "textedit.h" +#include <QApplication> +#include <QProxyStyle> + +class MyProxyStyle : public QProxyStyle +{ + public: + int styleHint(StyleHint hint, const QStyleOption *option = 0, + const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const + { + if (hint == QStyle::SH_UnderlineShortcut) + return 0; + return QProxyStyle::styleHint(hint, option, widget, returnData); + } +}; + +int main(int argc, char **argv) +{ + Q_INIT_RESOURCE(textedit); + + QApplication a(argc, argv); + a.setStyle(new MyProxyStyle); + TextEdit mw; + mw.resize(700, 800); + mw.show(); + //... +} +//! [1] diff --git a/doc/src/snippets/code/src_network_access_qnetworkdiskcache.cpp b/doc/src/snippets/code/src_network_access_qnetworkdiskcache.cpp new file mode 100644 index 0000000..acd3938 --- /dev/null +++ b/doc/src/snippets/code/src_network_access_qnetworkdiskcache.cpp @@ -0,0 +1,24 @@ +//! [0] +QNetworkAccessManager *manager = new QNetworkAccessManager(this); +QNetworkDiskCache *diskCache = new QNetworkDiskCache(this); +diskCache->setCacheDirectory("cacheDir"); +manager->setCache(diskCache); +//! [0] + +//! [1] +// do a normal request (preferred from network, as this is the default) +QNetworkRequest request(QUrl(QString("http://www.qtsoftware.com"))); +manager->get(request); + +// do a request preferred from cache +QNetworkRequest request2(QUrl(QString("http://www.qtsoftware.com"))); +request2.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache); +manager->get(request2); +//! [1] + +//! [2] +void replyFinished(QNetworkReply *reply) { + QVariant fromCache = reply->attribute(QNetworkRequest::SourceIsFromCacheAttribute); + qDebug() << "page from cache?" << fromCache.toBool(); +} +//! [2] |