summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets
diff options
context:
space:
mode:
authorCasper van Donderen <casper.vandonderen@nokia.com>2012-05-07 18:49:48 +0200
committerMarius Storm-Olsen <marius.storm-olsen@nokia.com>2012-05-09 08:36:46 +0200
commit97b5b8009254004608feefb903cbf44abaa099f6 (patch)
treecf3a79caa34085de1308eb86cac6ea0d9663aa9c /doc/src/snippets
parentcfdc5628b1fc2cbafa2aebca38995e5718fcb0de (diff)
Doc: Modularize QtWidgets documentation.
This change moves the snippets and images to the modularized directories. Change-Id: Idec1afb9db7ea6add1ca4cf25ec4019d8bce0c4d Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com>
Diffstat (limited to 'doc/src/snippets')
-rw-r--r--doc/src/snippets/code/doc_src_layout.cpp166
-rw-r--r--doc/src/snippets/code/doc_src_qt4-styles.cpp82
-rw-r--r--doc/src/snippets/code/doc_src_styles.cpp134
-rw-r--r--doc/src/snippets/code/doc_src_stylesheet.cpp140
-rw-r--r--doc/src/snippets/code/doc_src_stylesheet.qdoc1866
-rw-r--r--doc/src/snippets/code/src_gui_dialogs_qfiledialog.cpp131
-rw-r--r--doc/src/snippets/code/src_gui_dialogs_qfontdialog.cpp85
-rw-r--r--doc/src/snippets/code/src_gui_dialogs_qwizard.cpp80
-rw-r--r--doc/src/snippets/code/src_gui_effects_qgraphicseffect.cpp83
-rw-r--r--doc/src/snippets/code/src_gui_graphicsview_qgraphicsgridlayout.cpp53
-rw-r--r--doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp278
-rw-r--r--doc/src/snippets/code/src_gui_graphicsview_qgraphicslinearlayout.cpp53
-rw-r--r--doc/src/snippets/code/src_gui_graphicsview_qgraphicsproxywidget.cpp87
-rw-r--r--doc/src/snippets/code/src_gui_graphicsview_qgraphicsscene.cpp122
-rw-r--r--doc/src/snippets/code/src_gui_graphicsview_qgraphicssceneevent.cpp45
-rw-r--r--doc/src/snippets/code/src_gui_graphicsview_qgraphicsview.cpp132
-rw-r--r--doc/src/snippets/code/src_gui_graphicsview_qgraphicswidget.cpp66
-rw-r--r--doc/src/snippets/code/src_gui_image_qicon.cpp71
-rw-r--r--doc/src/snippets/code/src_gui_image_qpixmapfilter.cpp62
-rw-r--r--doc/src/snippets/code/src_gui_itemviews_qabstractitemview.cpp58
-rw-r--r--doc/src/snippets/code/src_gui_itemviews_qdatawidgetmapper.cpp63
-rw-r--r--doc/src/snippets/code/src_gui_itemviews_qitemeditorfactory.cpp63
-rw-r--r--doc/src/snippets/code/src_gui_itemviews_qstandarditemmodel.cpp82
-rw-r--r--doc/src/snippets/code/src_gui_itemviews_qtablewidget.cpp45
-rw-r--r--doc/src/snippets/code/src_gui_itemviews_qtreewidget.cpp48
-rw-r--r--doc/src/snippets/code/src_gui_kernel_qaction.cpp49
-rw-r--r--doc/src/snippets/code/src_gui_kernel_qformlayout.cpp76
-rw-r--r--doc/src/snippets/code/src_gui_kernel_qlayout.cpp67
-rw-r--r--doc/src/snippets/code/src_gui_kernel_qlayoutitem.cpp53
-rw-r--r--doc/src/snippets/code/src_gui_kernel_qshortcut.cpp55
-rw-r--r--doc/src/snippets/code/src_gui_kernel_qwidget.cpp137
-rw-r--r--doc/src/snippets/code/src_gui_painting_qdrawutil.cpp98
-rw-r--r--doc/src/snippets/code/src_gui_qproxystyle.cpp85
-rw-r--r--doc/src/snippets/code/src_gui_styles_qstyle.cpp48
-rw-r--r--doc/src/snippets/code/src_gui_styles_qstyleoption.cpp54
-rw-r--r--doc/src/snippets/code/src_gui_util_qcompleter.cpp63
-rw-r--r--doc/src/snippets/code/src_gui_util_qundostack.cpp109
-rw-r--r--doc/src/snippets/code/src_gui_widgets_qabstractbutton.cpp60
-rw-r--r--doc/src/snippets/code/src_gui_widgets_qabstractspinbox.cpp48
-rw-r--r--doc/src/snippets/code/src_gui_widgets_qcalendarwidget.cpp79
-rw-r--r--doc/src/snippets/code/src_gui_widgets_qcheckbox.cpp43
-rw-r--r--doc/src/snippets/code/src_gui_widgets_qdatetimeedit.cpp79
-rw-r--r--doc/src/snippets/code/src_gui_widgets_qdockwidget.cpp48
-rw-r--r--doc/src/snippets/code/src_gui_widgets_qframe.cpp48
-rw-r--r--doc/src/snippets/code/src_gui_widgets_qgroupbox.cpp43
-rw-r--r--doc/src/snippets/code/src_gui_widgets_qlabel.cpp64
-rw-r--r--doc/src/snippets/code/src_gui_widgets_qlineedit.cpp50
-rw-r--r--doc/src/snippets/code/src_gui_widgets_qmainwindow.cpp59
-rw-r--r--doc/src/snippets/code/src_gui_widgets_qmenu.cpp77
-rw-r--r--doc/src/snippets/code/src_gui_widgets_qmenubar.cpp48
-rw-r--r--doc/src/snippets/code/src_gui_widgets_qplaintextedit.cpp55
-rw-r--r--doc/src/snippets/code/src_gui_widgets_qpushbutton.cpp43
-rw-r--r--doc/src/snippets/code/src_gui_widgets_qradiobutton.cpp43
-rw-r--r--doc/src/snippets/code/src_gui_widgets_qrubberband.cpp62
-rw-r--r--doc/src/snippets/code/src_gui_widgets_qscrollarea.cpp49
-rw-r--r--doc/src/snippets/code/src_gui_widgets_qspinbox.cpp80
-rw-r--r--doc/src/snippets/code/src_gui_widgets_qsplashscreen.cpp55
-rw-r--r--doc/src/snippets/code/src_gui_widgets_qsplitter.cpp47
-rw-r--r--doc/src/snippets/code/src_gui_widgets_qstatusbar.cpp43
-rw-r--r--doc/src/snippets/code/src_gui_widgets_qtextbrowser.cpp44
-rw-r--r--doc/src/snippets/code/src_gui_widgets_qtextedit.cpp60
-rw-r--r--doc/src/snippets/customstyle/customstyle.cpp92
-rw-r--r--doc/src/snippets/customstyle/customstyle.h60
-rw-r--r--doc/src/snippets/customviewstyle.cpp69
-rw-r--r--doc/src/snippets/dialogs/dialogs.cpp268
-rw-r--r--doc/src/snippets/filedialogurls.cpp61
-rw-r--r--doc/src/snippets/graphicssceneadditemsnippet.cpp80
-rw-r--r--doc/src/snippets/javastyle.cpp2745
-rw-r--r--doc/src/snippets/layouts/layouts.cpp165
-rw-r--r--doc/src/snippets/mainwindowsnippet.cpp92
-rw-r--r--doc/src/snippets/mdiareasnippets.cpp97
-rw-r--r--doc/src/snippets/myscrollarea.cpp128
-rw-r--r--doc/src/snippets/qlistwidget-using/mainwindow.cpp158
-rw-r--r--doc/src/snippets/qmacnativewidget/main.mm84
-rw-r--r--doc/src/snippets/qsplashscreen/main.cpp63
-rw-r--r--doc/src/snippets/qstackedlayout/main.cpp89
-rw-r--r--doc/src/snippets/qstackedwidget/main.cpp87
-rw-r--r--doc/src/snippets/qstyleoption/main.cpp139
-rw-r--r--doc/src/snippets/qstyleplugin/main.cpp97
-rw-r--r--doc/src/snippets/qtablewidget-resizing/mainwindow.cpp115
-rw-r--r--doc/src/snippets/qtablewidget-using/mainwindow.cpp150
-rw-r--r--doc/src/snippets/qtreewidget-using/mainwindow.cpp230
-rw-r--r--doc/src/snippets/qtreewidgetitemiterator-using/mainwindow.cpp197
-rw-r--r--doc/src/snippets/shareddirmodel/main.cpp81
-rw-r--r--doc/src/snippets/splitter/splitter.cpp84
-rw-r--r--doc/src/snippets/splitterhandle/splitter.cpp78
-rw-r--r--doc/src/snippets/splitterhandle/splitter.h73
-rw-r--r--doc/src/snippets/styles/styles.cpp91
-rw-r--r--doc/src/snippets/stylesheet/common-mistakes.cpp52
-rw-r--r--doc/src/snippets/textdocument-imagedrop/textedit.cpp71
-rw-r--r--doc/src/snippets/timeline/main.cpp72
-rw-r--r--doc/src/snippets/whatsthis/whatsthis.cpp64
-rw-r--r--doc/src/snippets/widget-mask/main.cpp54
-rw-r--r--doc/src/snippets/widgetdelegate.cpp66
94 files changed, 0 insertions, 12368 deletions
diff --git a/doc/src/snippets/code/doc_src_layout.cpp b/doc/src/snippets/code/doc_src_layout.cpp
deleted file mode 100644
index b6abab61d3..0000000000
--- a/doc/src/snippets/code/doc_src_layout.cpp
+++ /dev/null
@@ -1,166 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-#ifndef CARD_H
-#define CARD_H
-
-#include <QtGui>
-#include <QList>
-
-class CardLayout : public QLayout
-{
-public:
- CardLayout(QWidget *parent, int dist): QLayout(parent, 0, dist) {}
- CardLayout(QLayout *parent, int dist): QLayout(parent, dist) {}
- CardLayout(int dist): QLayout(dist) {}
- ~CardLayout();
-
- void addItem(QLayoutItem *item);
- QSize sizeHint() const;
- QSize minimumSize() const;
- QLayoutItem *count() const;
- QLayoutItem *itemAt(int) const;
- QLayoutItem *takeAt(int);
- void setGeometry(const QRect &rect);
-
-private:
- QList<QLayoutItem*> list;
-};
-#endif
-//! [0]
-
-
-//! [1]
-//#include "card.h"
-//! [1]
-
-//! [2]
-QLayoutItem *CardLayout::count() const
-{
- // QList::size() returns the number of QLayoutItems in the list
- return list.size();
-}
-//! [2]
-
-//! [3]
-QLayoutItem *CardLayout::itemAt(int idx) const
-{
- // QList::value() performs index checking, and returns 0 if we are
- // outside the valid range
- return list.value(idx);
-}
-
-QLayoutItem *CardLayout::takeAt(int idx)
-{
- // QList::take does not do index checking
- return idx >= 0 && idx < list.size() ? list.takeAt(idx) : 0;
-}
-//! [3]
-
-
-//! [4]
-void CardLayout::addItem(QLayoutItem *item)
-{
- list.append(item);
-}
-//! [4]
-
-
-//! [5]
-CardLayout::~CardLayout()
-{
- QLayoutItem *item;
- while ((item = takeAt(0)))
- delete item;
-}
-//! [5]
-
-
-//! [6]
-void CardLayout::setGeometry(const QRect &r)
-{
- QLayout::setGeometry(r);
-
- if (list.size() == 0)
- return;
-
- int w = r.width() - (list.count() - 1) * spacing();
- int h = r.height() - (list.count() - 1) * spacing();
- int i = 0;
- while (i < list.size()) {
- QLayoutItem *o = list.at(i);
- QRect geom(r.x() + i * spacing(), r.y() + i * spacing(), w, h);
- o->setGeometry(geom);
- ++i;
- }
-}
-//! [6]
-
-
-//! [7]
-QSize CardLayout::sizeHint() const
-{
- QSize s(0,0);
- int n = list.count();
- if (n > 0)
- s = QSize(100,70); //start with a nice default size
- int i = 0;
- while (i < n) {
- QLayoutItem *o = list.at(i);
- s = s.expandedTo(o->sizeHint());
- ++i;
- }
- return s + n*QSize(spacing(), spacing());
-}
-
-QSize CardLayout::minimumSize() const
-{
- QSize s(0,0);
- int n = list.count();
- int i = 0;
- while (i < n) {
- QLayoutItem *o = list.at(i);
- s = s.expandedTo(o->minimumSize());
- ++i;
- }
- return s + n*QSize(spacing(), spacing());
-}
-//! [7]
diff --git a/doc/src/snippets/code/doc_src_qt4-styles.cpp b/doc/src/snippets/code/doc_src_qt4-styles.cpp
deleted file mode 100644
index 9bebb825e4..0000000000
--- a/doc/src/snippets/code/doc_src_qt4-styles.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-const QStyleOptionFocusRect *focusRectOption =
- qstyleoption_cast<const QStyleOptionFocusRect *>(option);
-if (focusRectOption) {
- ...
-}
-//! [0]
-
-
-//! [1]
-void MyWidget::paintEvent(QPaintEvent *event)
-{
- QPainter painter(this);
- ...
-
- QStyleOptionFocusRect option(1);
- option.init(this);
- option.backgroundColor = palette().color(QPalette::Window);
-
- style().drawPrimitive(QStyle::PE_FrameFocusRect, &option, &painter,
- this);
-}
-//! [1]
-
-
-//! [2]
-void drawControl(ControlElement element,
- QPainter *painter,
- const QWidget *widget,
- const QRect &rect,
- const QColorGroup &colorGroup,
- SFlags how = Style_Default,
- const QStyleOption &option = QStyleOption::Default) const;
-//! [2]
-
-
-//! [3]
-void drawControl(ControlElement element,
- const QStyleOption *option,
- QPainter *painter,
- const QWidget *widget = 0) const;
-//! [3]
diff --git a/doc/src/snippets/code/doc_src_styles.cpp b/doc/src/snippets/code/doc_src_styles.cpp
deleted file mode 100644
index 6c079c6637..0000000000
--- a/doc/src/snippets/code/doc_src_styles.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
- opt.initFrom(q);
- if (down)
- opt.state |= QStyle::State_Sunken;
- if (tristate && noChange)
- opt.state |= QStyle::State_NoChange;
- else
- opt.state |= checked ? QStyle::State_On :
- QStyle::State_Off;
- if (q->testAttribute(Qt::WA_Hover) && q->underMouse()) {
- if (hovering)
- opt.state |= QStyle::State_MouseOver;
- else
- opt.state &= ~QStyle::State_MouseOver;
- }
- opt.text = text;
- opt.icon = icon;
- opt.iconSize = q->iconSize();
-//! [0]
-
-
-//! [1]
- state = QStyle::State_None;
- if (widget->isEnabled())
- state |= QStyle::State_Enabled;
- if (widget->hasFocus())
- state |= QStyle::State_HasFocus;
- if (widget->window()->testAttribute(Qt::WA_KeyboardFocusChange))
- state |= QStyle::State_KeyboardFocusChange;
- if (widget->underMouse())
- state |= QStyle::State_MouseOver;
- if (widget->window()->isActiveWindow())
- state |= QStyle::State_Active;
-#ifdef Q_WS_MAC
- extern bool qt_mac_can_clickThrough(const QWidget *w); //qwidget_mac.cpp
- if (!(state & QStyle::State_Active) && !qt_mac_can_clickThrough(widget))
- state &= ~QStyle::State_Enabled;
-#endif
-#ifdef QT_KEYPAD_NAVIGATION
- if (widget->hasEditFocus())
- state |= QStyle::State_HasEditFocus;
-#endif
-
- direction = widget->layoutDirection();
- rect = widget->rect();
- palette = widget->palette();
- fontMetrics = widget->fontMetrics();
-//! [1]
-
-
-//! [2]
- QStylePainter p(this);
- QStyleOptionButton opt = d->getStyleOption();
- p.drawControl(QStyle::CE_CheckBox, opt);
-//! [2]
-
-
-//! [3]
- QStyleOptionButton subopt = *btn;
- subopt.rect = subElementRect(SE_CheckBoxIndicator, btn, widget);
- drawPrimitive(PE_IndicatorCheckBox, &subopt, p, widget);
- subopt.rect = subElementRect(SE_CheckBoxContents, btn, widget);
- drawControl(CE_CheckBoxLabel, &subopt, p, widget);
-
- if (btn->state & State_HasFocus) {
- QStyleOptionFocusRect fropt;
- fropt.QStyleOption::operator=(*btn);
- fropt.rect = subElementRect(SE_CheckBoxFocusRect, btn, widget);
- drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
- }
-//! [3]
-
-
-//! [4]
- const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt);
- uint alignment = visualAlignment(btn->direction, Qt::AlignLeft | Qt::AlignVCenter);
-
- if (!styleHint(SH_UnderlineShortcut, btn, widget))
- alignment |= Qt::TextHideMnemonic;
- QPixmap pix;
- QRect textRect = btn->rect;
- if (!btn->icon.isNull()) {
- pix = btn->icon.pixmap(btn->iconSize, btn->state & State_Enabled ? QIcon::Normal : QIcon::Disabled);
- drawItemPixmap(p, btn->rect, alignment, pix);
- if (btn->direction == Qt::RightToLeft)
- textRect.setRight(textRect.right() - btn->iconSize.width() - 4);
- else
- textRect.setLeft(textRect.left() + btn->iconSize.width() + 4);
- }
- if (!btn->text.isEmpty()){
- drawItemText(p, textRect, alignment | Qt::TextShowMnemonic,
- btn->palette, btn->state & State_Enabled, btn->text, QPalette::WindowText);
- }
-//! [4]
diff --git a/doc/src/snippets/code/doc_src_stylesheet.cpp b/doc/src/snippets/code/doc_src_stylesheet.cpp
deleted file mode 100644
index eb02634c6d..0000000000
--- a/doc/src/snippets/code/doc_src_stylesheet.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [21]
-qApp->setStyleSheet("QPushButton { color: white }");
-//! [21]
-
-
-//! [22]
-myPushButton->setStyleSheet("* { color: blue }");
-//! [22]
-
-
-//! [23]
-myPushButton->setStyleSheet("color: blue");
-//! [23]
-
-
-//! [24]
-qApp->setStyleSheet("QGroupBox { color: red; } ");
-//! [24]
-
-//! [25]
-qApp->setStyleSheet("QGroupBox, QGroupBox * { color: red; }");
-//! [25]
-
-
-//! [26]
-class MyPushButton : public QPushButton {
- // ...
-}
-
-// ...
-qApp->setStyleSheet("MyPushButton { background: yellow; }");
-//! [26]
-
-
-//! [27]
-namespace ns {
- class MyPushButton : public QPushButton {
- // ...
- }
-}
-
-// ...
-qApp->setStyleSheet("ns--MyPushButton { background: yellow; }");
-//! [27]
-
-
-//! [32]
-void CustomWidget::paintEvent(QPaintEvent *)
-{
- QStyleOption opt;
- opt.init(this);
- QPainter p(this);
- style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
-}
-//! [32]
-
-
-//! [88]
-qApp->setStyleSheet("QLineEdit { background-color: yellow }");
-//! [88]
-
-
-//! [89]
-myDialog->setStyleSheet("QLineEdit { background-color: yellow }");
-//! [89]
-
-
-//! [90]
-myDialog->setStyleSheet("QLineEdit#nameEdit { background-color: yellow }");
-//! [90]
-
-
-//! [91]
-nameEdit->setStyleSheet("background-color: yellow");
-//! [91]
-
-
-//! [92]
-nameEdit->setStyleSheet("color: blue; background-color: yellow");
-//! [92]
-
-
-//! [93]
-nameEdit->setStyleSheet("color: blue;"
- "background-color: yellow;"
- "selection-color: yellow;"
- "selection-background-color: blue;");
-//! [93]
-
-
-//! [95]
-QLineEdit *nameEdit = new QLineEdit(this);
-nameEdit->setProperty("mandatoryField", true);
-
-QLineEdit *emailEdit = new QLineEdit(this);
-emailEdit->setProperty("mandatoryField", true);
-
-QSpinBox *ageSpinBox = new QSpinBox(this);
-ageSpinBox->setProperty("mandatoryField", true);
-//! [95]
diff --git a/doc/src/snippets/code/doc_src_stylesheet.qdoc b/doc/src/snippets/code/doc_src_stylesheet.qdoc
deleted file mode 100644
index 9acba09c67..0000000000
--- a/doc/src/snippets/code/doc_src_stylesheet.qdoc
+++ /dev/null
@@ -1,1866 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-QLineEdit { background: yellow }
-QCheckBox { color: red }
-//! [0]
-
-
-//! [1]
-QPushButton { color: red }
-//! [1]
-
-
-//! [2]
-QPushButton, QLineEdit, QComboBox { color: red }
-//! [2]
-
-
-//! [3]
-QPushButton { color: red }
-QLineEdit { color: red }
-QComboBox { color: red }
-//! [3]
-
-
-//! [4]
-QPushButton { color: red; background-color: white }
-//! [4]
-
-
-//! [5]
-QComboBox::drop-down { image: url(dropdown.png) }
-//! [5]
-
-
-//! [6]
-QComboBox {
- margin-right: 20px;
-}
-QComboBox::drop-down {
- subcontrol-origin: margin;
-}
-//! [6]
-
-
-//! [7]
-QComboBox::down-arrow {
- image: url(down_arrow.png);
-}
-QComboBox::down-arrow:pressed {
- position: relative;
- top: 1px; left: 1px;
-}
-//! [7]
-
-
-//! [8]
-QPushButton:hover { color: white }
-//! [8]
-
-
-//! [9]
-QRadioButton:!hover { color: red }
-//! [9]
-
-
-//! [10]
-QCheckBox:hover:checked { color: white }
-//! [10]
-
-
-//! [11]
-QPushButton:hover:!pressed { color: blue; }
-//! [11]
-
-
-//! [12]
-QCheckBox:hover, QCheckBox:checked { color: white }
-//! [12]
-
-
-//! [13]
-QComboBox::drop-down:hover { image: url(dropdown_bright.png) }
-//! [13]
-
-
-//! [14]
-QPushButton#okButton { color: gray }
-QPushButton { color: red }
-//! [14]
-
-
-//! [15]
-QPushButton:hover { color: white }
-QPushButton { color: red }
-//! [15]
-
-
-//! [16]
-QPushButton:hover { color: white }
-QPushButton:enabled { color: red }
-//! [16]
-
-
-//! [17]
-QPushButton:enabled { color: red }
-QPushButton:hover { color: white }
-//! [17]
-
-
-//! [18]
-QPushButton:hover:enabled { color: white }
-QPushButton:enabled { color: red }
-//! [18]
-
-
-//! [19]
-QPushButton { color: red }
-QAbstractButton { color: gray }
-//! [19]
-
-
-//! [20]
-* {} /* a=0 b=0 c=0 -> specificity = 0 */
-LI {} /* a=0 b=0 c=1 -> specificity = 1 */
-UL LI {} /* a=0 b=0 c=2 -> specificity = 2 */
-UL OL+LI {} /* a=0 b=0 c=3 -> specificity = 3 */
-H1 + *[REL=up]{} /* a=0 b=1 c=1 -> specificity = 11 */
-UL OL LI.red {} /* a=0 b=1 c=3 -> specificity = 13 */
-LI.red.level {} /* a=0 b=2 c=1 -> specificity = 21 */
-#x34y {} /* a=1 b=0 c=0 -> specificity = 100 */
-//! [20]
-
-
-//! [28]
-MyLabel { qproperty-pixmap: url(pixmap.png); }
-MyGroupBox { qproperty-titleColor: rgb(100, 200, 100); }
-QPushButton { qproperty-iconSize: 20px 20px; }
-//! [28]
-
-
-//! [30]
-QPushButton { background-color: red; border: none; }
-//! [30]
-
-
-//! [31]
-QToolButton { background-color: red; border: none; }
-//! [31]
-
-
-//! [33]
-QTreeView {
- alternate-background-color: blue;
- background: yellow;
-}
-//! [33]
-
-
-//! [34]
-QTextEdit { background: yellow }
-//! [34]
-
-
-//! [35]
-QLabel {
- background-image: url(dense6pattern.png);
- background-repeat: repeat-xy;
-}
-//! [35]
-
-
-//! [36]
-QLabel { background-color: yellow }
-QLineEdit { background-color: rgb(255, 0, 0) }
-//! [36]
-
-
-//! [37]
-QFrame { background-image: url(:/images/hydro.png) }
-//! [37]
-
-
-//! [38]
-QFrame {
- background: white url(:/images/ring.png);
- background-repeat: repeat-y;
- background-position: left;
-}
-//! [38]
-
-
-//! [39]
-QFrame {
- background: url(:/images/footer.png);
- background-position: bottom left;
-}
-//! [39]
-
-
-//! [40]
-QTextEdit {
- background-image: url("leaves.png");
- background-attachment: fixed;
-}
-//! [40]
-
-
-//! [41]
-QFrame {
- background-image: url(:/images/header.png);
- background-position: top left;
- background-origin: content;
- background-clip: padding;
-}
-//! [41]
-
-
-//! [42]
-QFrame {
- background-image: url(:/images/header.png);
- background-position: top left;
- background-origin: content;
-}
-//! [42]
-
-
-//! [43]
-QLineEdit { border: 1px solid white }
-//! [43]
-
-
-//! [44]
-QLineEdit {
- border-width: 1px;
- border-style: solid;
- border-color: white;
-}
-//! [44]
-
-
-//! [45]
-QLineEdit {
- border-width: 1px;
- border-style: solid;
- border-radius: 4px;
-}
-//! [45]
-
-
-//! [46]
-QLineEdit {
- border-width: 1px;
- border-style: solid;
- border-color: blue;
-}
-//! [46]
-
-
-//! [47]
-QLineEdit {
- border-width: 2px;
- border-style: solid;
- border-color: darkblue;
-}
-//! [47]
-
-
-//! [48]
-QSpinBox::down-button { bottom: 2px }
-//! [48]
-
-
-//! [49]
-* { button-layout: 2 }
-//! [49]
-
-
-//! [50]
-QPushButton { color: red }
-//! [50]
-
-
-//! [51]
-QDialogButtonBox { dialogbuttonbox-buttons-have-icons: 1; }
-//! [51]
-
-
-//! [52]
-* { etch-disabled-text: 1 }
-//! [52]
-
-
-//! [53]
-QCheckBox { font: bold italic large "Times New Roman" }
-//! [53]
-
-
-//! [54]
-QCheckBox { font-family: "New Century Schoolbook" }
-//! [54]
-
-
-//! [55]
-QTextEdit { font-size: 12px }
-//! [55]
-
-
-//! [56]
-QTextEdit { font-style: italic }
-//! [56]
-
-
-//! [57]
-* { gridline-color: gray }
-//! [57]
-
-
-//! [58]
-QSpinBox::down-button { height: 10px }
-//! [58]
-
-
-//! [59]
-/* implicitly sets the size of down-button to the size of spindown.png */
-QSpinBox::down-button { image: url(:/images/spindown.png) }
-//! [59]
-
-
-//! [60]
-QSpinBox::down-button { left: 2px }
-//! [60]
-
-
-//! [61]
-* { lineedit-password-character: 9679 }
-//! [61]
-
-
-//! [62]
-QLineEdit { margin: 2px }
-//! [62]
-
-
-//! [63]
-QSpinBox { max-height: 24px }
-//! [63]
-
-
-//! [64]
-QComboBox { max-width: 72px }
-//! [64]
-
-
-//! [65]
-QMessageBox { messagebox-text-interaction-flags: 5 }
-//! [65]
-
-
-//! [66]
-QComboBox { min-height: 24px }
-//! [66]
-
-
-//! [67]
-QComboBox { min-width: 72px }
-//! [67]
-
-
-//! [68]
-QToolTip { opacity: 223 }
-//! [68]
-
-
-//! [69]
-QLineEdit { padding: 3px }
-//! [69]
-
-
-//! [70]
-QSpinBox::down-button { right: 2px }
-//! [70]
-
-
-//! [71]
-QTextEdit { selection-background-color: darkblue }
-//! [71]
-
-
-//! [72]
-QTextEdit { selection-color: white }
-//! [72]
-
-
-//! [73]
-* { show-decoration-selected: 1 }
-//! [73]
-
-
-//! [74]
-QMenuBar { spacing: 10 }
-//! [74]
-
-
-//! [75]
-QSpinBox::up-button {
- image: url(:/images/spinup.png);
- subcontrol-origin: content;
- subcontrol-position: right top;
-}
-//! [75]
-
-
-//! [76]
-QSpinBox::down-button {
- image: url(:/images/spindown.png);
- subcontrol-origin: padding;
- subcontrol-position: right bottom;
-}
-//! [76]
-
-
-//! [77]
-QPushButton {
- text-align: left;
-}
-//! [77]
-
-
-//! [78]
-QSpinBox::up-button { top: 2px }
-//! [78]
-
-
-//! [79]
-QSpinBox::up-button { width: 12px }
-//! [79]
-
-
-//! [80]
-QTextEdit { background-position: bottom center }
-//! [80]
-
-
-//! [81]
-QDialog { etch-disabled-text: 1 }
-//! [81]
-
-
-//! [82]
-QLabel { border-color: red } /* red red red red */
-QLabel { border-color: red blue } /* red blue red blue */
-QLabel { border-color: red blue green } /* red blue green blue */
-QLabel { border-color: red blue green yellow } /* red blue green yellow */
-//! [82]
-
-
-//! [83]
-QLabel { border-width: 1px } /* 1px 1px 1px 1px */
-QLabel { border-width: 1px 2px } /* 1px 2px 1px 2px */
-QLabel { border-width: 1px 2px 3px } /* 1px 2px 3px 2px */
-QLabel { border-width: 1px 2px 3px 4px } /* 1px 2px 3px 4px */
-//! [83]
-
-
-//! [84]
-QLabel { border-color: red } /* opaque red */
-QLabel { border-color: #FF0000 } /* opaque red */
-QLabel { border-color: rgba(255, 0, 0, 75%) } /* 75% opaque red */
-QLabel { border-color: rgb(255, 0, 0) } /* opaque red */
-QLabel { border-color: rgb(100%, 0%, 0%) } /* opaque red */
-QLabel { border-color: hsv(60, 255, 255) } /* opaque yellow */
-QLabel { border-color: hsva(240, 255, 255, 75%) } /* 75% blue */
-//! [84]
-
-
-//! [85]
-/* linear gradient from white to green */
-QTextEdit {
- background: qlineargradient(x1:0, y1:0, x2:1, y2:1,
- stop:0 white, stop: 0.4 gray, stop:1 green)
-}
-
-/* linear gradient from white to green */
-QTextEdit {
- background: qlineargradient(x1:0, y1:0, x2:1, y2:1,
- stop:0 white, stop: 0.4 rgba(10, 20, 30, 40), stop:1 rgb(0, 200, 230, 200))
-}
-
-
-/* conical gradient from white to green */
-QTextEdit {
- background: qconicalgradient(cx:0.5, cy:0.5, angle:30,
- stop:0 white, stop:1 #00FF00)
-}
-
-/* radial gradient from white to green */
-QTextEdit {
- background: qradialgradient(cx:0, cy:0, radius: 1,
- fx:0.5, fy:0.5, stop:0 white, stop:1 green)
-}
-//! [85]
-
-
-//! [86]
-* {
- file-icon: url(file.png),
- url(file_selected.png) selected;
- }
-
-QMessageBox {
- dialogbuttonbox-buttons-have-icons: true;
- dialog-ok-icon: url(ok.svg);
- dialog-cancel-icon: url(cancel.png), url(grayed_cancel.png) disabled;
-}
-//! [86]
-
-
-//! [87]
-QPushButton { color: palette(dark); }
-//! [87]
-
-
-//! [94]
-*[mandatoryField="true"] { background-color: yellow }
-//! [94]
-
-
-//! [96]
-QPushButton#evilButton { background-color: red }
-//! [96]
-
-
-//! [97]
-QPushButton#evilButton {
- background-color: red;
- border-style: outset;
- border-width: 2px;
- border-color: beige;
-}
-//! [97]
-
-
-//! [98]
-QPushButton#evilButton {
- background-color: red;
- border-style: outset;
- border-width: 2px;
- border-radius: 10px;
- border-color: beige;
- font: bold 14px;
- min-width: 10em;
- padding: 6px;
-}
-//! [98]
-
-
-//! [99]
-QPushButton#evilButton {
- background-color: red;
- border-style: outset;
- border-width: 2px;
- border-radius: 10px;
- border-color: beige;
- font: bold 14px;
- min-width: 10em;
- padding: 6px;
-}
-QPushButton#evilButton:pressed {
- background-color: rgb(224, 0, 0);
- border-style: inset;
-}
-//! [99]
-
-
-//! [100]
-QPushButton#evilButton::menu-indicator {
- image: url(myindicator.png);
-}
-//! [100]
-
-
-//! [101]
-QPushButton::menu-indicator {
- image: url(myindicator.png);
- subcontrol-position: right center;
- subcontrol-origin: padding;
- left: -2px;
-}
-//! [101]
-
-
-//! [102]
-QLineEdit { color: red }
-//! [102]
-
-
-//! [103]
-QLineEdit { color: red }
-QLineEdit[readOnly="true"] { color: gray }
-//! [103]
-
-
-//! [104]
-QLineEdit { color: red }
-QLineEdit[readOnly="true"] { color: gray }
-#registrationDialog QLineEdit { color: brown }
-//! [104]
-
-
-//! [105]
-QLineEdit { color: red }
-QLineEdit[readOnly="true"] { color: gray }
-QDialog QLineEdit { color: brown }
-//! [105]
-
-
-//! [106]
-QTextEdit, QListView {
- background-color: white;
- background-image: url(draft.png);
- background-attachment: scroll;
-}
-//! [106]
-
-
-//! [107]
-QTextEdit, QListView {
- background-color: white;
- background-image: url(draft.png);
- background-attachment: fixed;
-}
-//! [107]
-
-
-//! [108]
-QCheckBox {
- spacing: 5px;
-}
-
-QCheckBox::indicator {
- width: 13px;
- height: 13px;
-}
-
-QCheckBox::indicator:unchecked {
- image: url(:/images/checkbox_unchecked.png);
-}
-
-QCheckBox::indicator:unchecked:hover {
- image: url(:/images/checkbox_unchecked_hover.png);
-}
-
-QCheckBox::indicator:unchecked:pressed {
- image: url(:/images/checkbox_unchecked_pressed.png);
-}
-
-QCheckBox::indicator:checked {
- image: url(:/images/checkbox_checked.png);
-}
-
-QCheckBox::indicator:checked:hover {
- image: url(:/images/checkbox_checked_hover.png);
-}
-
-QCheckBox::indicator:checked:pressed {
- image: url(:/images/checkbox_checked_pressed.png);
-}
-
-QCheckBox::indicator:indeterminate:hover {
- image: url(:/images/checkbox_indeterminate_hover.png);
-}
-
-QCheckBox::indicator:indeterminate:pressed {
- image: url(:/images/checkbox_indeterminate_pressed.png);
-}
-//! [108]
-
-
-//! [109]
-QComboBox {
- border: 1px solid gray;
- border-radius: 3px;
- padding: 1px 18px 1px 3px;
- min-width: 6em;
-}
-
-QComboBox:editable {
- background: white;
-}
-
-QComboBox:!editable, QComboBox::drop-down:editable {
- background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
- stop: 0 #E1E1E1, stop: 0.4 #DDDDDD,
- stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);
-}
-
-/* QComboBox gets the "on" state when the popup is open */
-QComboBox:!editable:on, QComboBox::drop-down:editable:on {
- background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
- stop: 0 #D3D3D3, stop: 0.4 #D8D8D8,
- stop: 0.5 #DDDDDD, stop: 1.0 #E1E1E1);
-}
-
-QComboBox:on { /* shift the text when the popup opens */
- padding-top: 3px;
- padding-left: 4px;
-}
-
-QComboBox::drop-down {
- subcontrol-origin: padding;
- subcontrol-position: top right;
- width: 15px;
-
- border-left-width: 1px;
- border-left-color: darkgray;
- border-left-style: solid; /* just a single line */
- border-top-right-radius: 3px; /* same radius as the QComboBox */
- border-bottom-right-radius: 3px;
-}
-
-QComboBox::down-arrow {
- image: url(/usr/share/icons/crystalsvg/16x16/actions/1downarrow.png);
-}
-
-QComboBox::down-arrow:on { /* shift the arrow when popup is open */
- top: 1px;
- left: 1px;
-}
-//! [109]
-
-
-//! [110]
-QComboBox QAbstractItemView {
- border: 2px solid darkgray;
- selection-background-color: lightgray;
-}
-//! [110]
-
-
-//! [111]
-QDockWidget {
- border: 1px solid lightgray;
- titlebar-close-icon: url(close.png);
- titlebar-normal-icon: url(undock.png);
-}
-
-QDockWidget::title {
- text-align: left; /* align the text to the left */
- background: lightgray;
- padding-left: 5px;
-}
-
-QDockWidget::close-button, QDockWidget::float-button {
- border: 1px solid transparent;
- background: darkgray;
- padding: 0px;
-}
-
-QDockWidget::close-button:hover, QDockWidget::float-button:hover {
- background: gray;
-}
-
-QDockWidget::close-button:pressed, QDockWidget::float-button:pressed {
- padding: 1px -1px -1px 1px;
-}
-//! [111]
-
-
-//! [112]
-QDockWidget {
- border: 1px solid lightgray;
- titlebar-close-icon: url(close.png);
- titlebar-normal-icon: url(float.png);
-}
-
-QDockWidget::title {
- text-align: left;
- background: lightgray;
- padding-left: 35px;
-}
-
-QDockWidget::close-button, QDockWidget::float-button {
- background: darkgray;
- padding: 0px;
- icon-size: 14px; /* maximum icon size */
-}
-
-QDockWidget::close-button:hover, QDockWidget::float-button:hover {
- background: gray;
-}
-
-QDockWidget::close-button:pressed, QDockWidget::float-button:pressed {
- padding: 1px -1px -1px 1px;
-}
-
-QDockWidget::close-button {
- subcontrol-position: top left;
- subcontrol-origin: margin;
- position: absolute;
- top: 0px; left: 0px; bottom: 0px;
- width: 14px;
-}
-
-QDockWidget::float-button {
- subcontrol-position: top left;
- subcontrol-origin: margin;
- position: absolute;
- top: 0px; left: 16px; bottom: 0px;
- width: 14px;
-}
-//! [112]
-
-
-//! [113]
-QFrame, QLabel, QToolTip {
- border: 2px solid green;
- border-radius: 4px;
- padding: 2px;
- background-image: url(images/welcome.png);
-}
-//! [113]
-
-
-//! [114]
-QGroupBox {
- background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
- stop: 0 #E0E0E0, stop: 1 #FFFFFF);
- border: 2px solid gray;
- border-radius: 5px;
- margin-top: 1ex; /* leave space at the top for the title */
-}
-
-QGroupBox::title {
- subcontrol-origin: margin;
- subcontrol-position: top center; /* position at the top center */
- padding: 0 3px;
- background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
- stop: 0 #FFOECE, stop: 1 #FFFFFF);
-}
-//! [114]
-
-
-//! [115]
-QGroupBox::indicator {
- width: 13px;
- height: 13px;
-}
-
-QGroupBox::indicator:unchecked {
- image: url(:/images/checkbox_unchecked.png);
-}
-
-/* proceed with styling just like QCheckBox */
-//! [115]
-
-
-//! [116]
-QHeaderView::section {
- background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
- stop:0 #616161, stop: 0.5 #505050,
- stop: 0.6 #434343, stop:1 #656565);
- color: white;
- padding-left: 4px;
- border: 1px solid #6c6c6c;
-}
-
-QHeaderView::section:checked
-{
- background-color: red;
-}
-
-/* style the sort indicator */
-QHeaderView::down-arrow {
- image: url(down_arrow.png);
-}
-
-QHeaderView::up-arrow {
- image: url(up_arrow.png);
-}
-//! [116]
-
-
-//! [117]
-QLineEdit {
- border: 2px solid gray;
- border-radius: 10px;
- padding: 0 8px;
- background: yellow;
- selection-background-color: darkgray;
-}
-//! [117]
-
-
-//! [118]
-QLineEdit[echoMode="2"] {
- lineedit-password-character: 9679;
-}
-//! [118]
-
-
-//! [119]
-QLineEdit:read-only {
- background: lightblue;
-//! [119]
-
-
-//! [120]
-QListView {
- alternate-background-color: yellow;
-}
-//! [120]
-
-
-//! [121]
-QListView {
- show-decoration-selected: 1; /* make the selection span the entire width of the view */
-}
-
-QListView::item:alternate {
- background: #EEEEEE;
-}
-
-QListView::item:selected {
- border: 1px solid #6a6ea9;
-}
-
-QListView::item:selected:!active {
- background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
- stop: 0 #ABAFE5, stop: 1 #8588B2);
-}
-
-QListView::item:selected:active {
- background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
- stop: 0 #6a6ea9, stop: 1 #888dd9);
-}
-
-QListView::item:hover {
- background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
- stop: 0 #FAFBFE, stop: 1 #DCDEF1);
-}
-//! [121]
-
-
-//! [122]
-QMainWindow::separator {
- background: yellow;
- width: 10px; /* when vertical */
- height: 10px; /* when horizontal */
-}
-
-QMainWindow::separator:hover {
- background: red;
-}
-//! [122]
-
-
-//! [123]
-QMenu {
- background-color: #ABABAB; /* sets background of the menu */
- border: 1px solid black;
-}
-
-QMenu::item {
- /* sets background of menu item. set this to something non-transparent
- if you want menu color and menu item color to be different */
- background-color: transparent;
-}
-
-QMenu::item:selected { /* when user selects item using mouse or keyboard */
- background-color: #654321;
-}
-//! [123]
-
-
-//! [124]
-QMenu {
- background-color: white;
- margin: 2px; /* some spacing around the menu */
-}
-
-QMenu::item {
- padding: 2px 25px 2px 20px;
- border: 1px solid transparent; /* reserve space for selection border */
-}
-
-QMenu::item:selected {
- border-color: darkblue;
- background: rgba(100, 100, 100, 150);
-}
-
-QMenu::icon:checked { /* appearance of a 'checked' icon */
- background: gray;
- border: 1px inset gray;
- position: absolute;
- top: 1px;
- right: 1px;
- bottom: 1px;
- left: 1px;
-}
-
-QMenu::separator {
- height: 2px;
- background: lightblue;
- margin-left: 10px;
- margin-right: 5px;
-}
-
-QMenu::indicator {
- width: 13px;
- height: 13px;
-}
-
-/* non-exclusive indicator = check box style indicator (see QActionGroup::setExclusive) */
-QMenu::indicator:non-exclusive:unchecked {
- image: url(:/images/checkbox_unchecked.png);
-}
-
-QMenu::indicator:non-exclusive:unchecked:selected {
- image: url(:/images/checkbox_unchecked_hover.png);
-}
-
-QMenu::indicator:non-exclusive:checked {
- image: url(:/images/checkbox_checked.png);
-}
-
-QMenu::indicator:non-exclusive:checked:selected {
- image: url(:/images/checkbox_checked_hover.png);
-}
-
-/* exclusive indicator = radio button style indicator (see QActionGroup::setExclusive) */
-QMenu::indicator:exclusive:unchecked {
- image: url(:/images/radiobutton_unchecked.png);
-}
-
-QMenu::indicator:exclusive:unchecked:selected {
- image: url(:/images/radiobutton_unchecked_hover.png);
-}
-
-QMenu::indicator:exclusive:checked {
- image: url(:/images/radiobutton_checked.png);
-}
-
-QMenu::indicator:exclusive:checked:selected {
- image: url(:/images/radiobutton_checked_hover.png);
-}
-
-//! [124]
-
-
-//! [125]
-QMenuBar {
- background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
- stop:0 lightgray, stop:1 darkgray);
-}
-
-QMenuBar::item {
- spacing: 3px; /* spacing between menu bar items */
- padding: 1px 4px;
- background: transparent;
- border-radius: 4px;
-}
-
-QMenuBar::item:selected { /* when selected using mouse or keyboard */
- background: #a8a8a8;
-}
-
-QMenuBar::item:pressed {
- background: #888888;
-}
-//! [125]
-
-
-//! [126]
-QProgressBar {
- border: 2px solid grey;
- border-radius: 5px;
-}
-
-QProgressBar::chunk {
- background-color: #05B8CC;
- width: 20px;
-}
-//! [126]
-
-
-//! [127]
-QProgressBar {
- border: 2px solid grey;
- border-radius: 5px;
- text-align: center;
-}
-//! [127]
-
-
-//! [128]
-QProgressBar::chunk {
- background-color: #CD96CD;
- width: 10px;
- margin: 0.5px;
-}
-//! [128]
-
-
-//! [129]
-QPushButton {
- border: 2px solid #8f8f91;
- border-radius: 6px;
- background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
- stop: 0 #f6f7fa, stop: 1 #dadbde);
- min-width: 80px;
-}
-
-QPushButton:pressed {
- background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
- stop: 0 #dadbde, stop: 1 #f6f7fa);
-}
-
-QPushButton:flat {
- border: none; /* no border for a flat push button */
-}
-
-QPushButton:default {
- border-color: navy; /* make the default button prominent */
-}
-//! [129]
-
-
-//! [130]
-QPushButton:open { /* when the button has its menu open */
- background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
- stop: 0 #dadbde, stop: 1 #f6f7fa);
-}
-
-QPushButton::menu-indicator {
- image: url(menu_indicator.png);
- subcontrol-origin: padding;
- subcontrol-position: bottom right;
-}
-
-QPushButton::menu-indicator:pressed, QPushButton::menu-indicator:open {
- position: relative;
- top: 2px; left: 2px; /* shift the arrow by 2 px */
-}
-//! [130]
-
-
-//! [131]
-QRadioButton::indicator {
- width: 13px;
- height: 13px;
-}
-
-QRadioButton::indicator::unchecked {
- image: url(:/images/radiobutton_unchecked.png);
-}
-
-QRadioButton::indicator:unchecked:hover {
- image: url(:/images/radiobutton_unchecked_hover.png);
-}
-
-QRadioButton::indicator:unchecked:pressed {
- image: url(:/images/radiobutton_unchecked_pressed.png);
-}
-
-QRadioButton::indicator::checked {
- image: url(:/images/radiobutton_checked.png);
-}
-
-QRadioButton::indicator:checked:hover {
- image: url(:/images/radiobutton_checked_hover.png);
-}
-
-QRadioButton::indicator:checked:pressed {
- image: url(:/images/radiobutton_checked_pressed.png);
-}
-//! [131]
-
-
-//! [132]
-QScrollBar:horizontal {
- border: 2px solid grey;
- background: #32CC99;
- height: 15px;
- margin: 0px 20px 0 20px;
-}
-//! [132]
-
-
-//! [133]
-QScrollBar::handle:horizontal {
- background: white;
- min-width: 20px;
-}
-//! [133]
-
-
-//! [134]
-QScrollBar::add-line:horizontal {
- border: 2px solid grey;
- background: #32CC99;
- width: 20px;
- subcontrol-position: right;
- subcontrol-origin: margin;
-}
-
-QScrollBar::sub-line:horizontal {
- border: 2px solid grey;
- background: #32CC99;
- width: 20px;
- subcontrol-position: left;
- subcontrol-origin: margin;
-}
-//! [134]
-
-
-//! [135]
-QScrollBar:left-arrow:horizontal, QScrollBar::right-arrow:horizontal {
- border: 2px solid grey;
- width: 3px;
- height: 3px;
- background: white;
-}
-
-QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal {
- background: none;
-}
-//! [135]
-
-
-//! [136]
-QScrollBar:horizontal {
- border: 2px solid green;
- background: cyan;
- height: 15px;
- margin: 0px 40px 0 0px;
-}
-
-QScrollBar::handle:horizontal {
- background: gray;
- min-width: 20px;
-}
-
-QScrollBar::add-line:horizontal {
- background: blue;
- width: 16px;
- subcontrol-position: right;
- subcontrol-origin: margin;
- border: 2px solid black;
-}
-
-QScrollBar::sub-line:horizontal {
- background: magenta;
- width: 16px;
- subcontrol-position: top right;
- subcontrol-origin: margin;
- border: 2px solid black;
- position: absolute;
- right: 20px;
-}
-
-QScrollBar:left-arrow:horizontal, QScrollBar::right-arrow:horizontal {
- width: 3px;
- height: 3px;
- background: pink;
-}
-
-QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal {
- background: none;
-}
-
-//! [136]
-
-
-//! [137]
- QScrollBar:vertical {
- border: 2px solid grey;
- background: #32CC99;
- width: 15px;
- margin: 22px 0 22px 0;
- }
- QScrollBar::handle:vertical {
- background: white;
- min-height: 20px;
- }
- QScrollBar::add-line:vertical {
- border: 2px solid grey;
- background: #32CC99;
- height: 20px;
- subcontrol-position: bottom;
- subcontrol-origin: margin;
- }
-
- QScrollBar::sub-line:vertical {
- border: 2px solid grey;
- background: #32CC99;
- height: 20px;
- subcontrol-position: top;
- subcontrol-origin: margin;
- }
- QScrollBar::up-arrow:vertical, QScrollBar::down-arrow:vertical {
- border: 2px solid grey;
- width: 3px;
- height: 3px;
- background: white;
- }
-
- QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical {
- background: none;
- }
-//! [137]
-
-
-//! [138]
-QSizeGrip {
- image: url(:/images/sizegrip.png);
- width: 16px;
- height: 16px;
-}
-//! [138]
-
-
-//! [139]
-QSlider::groove:horizontal {
- border: 1px solid #999999;
- height: 8px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */
- background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #B1B1B1, stop:1 #c4c4c4);
- margin: 2px 0;
-}
-
-QSlider::handle:horizontal {
- background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #b4b4b4, stop:1 #8f8f8f);
- border: 1px solid #5c5c5c;
- width: 18px;
- margin: -2px 0; /* handle is placed by default on the contents rect of the groove. Expand outside the groove */
- border-radius: 3px;
-}
-//! [139]
-
-
-//! [140]
-QSlider::groove:vertical {
- background: red;
- position: absolute; /* absolutely position 4px from the left and right of the widget. setting margins on the widget should work too... */
- left: 4px; right: 4px;
-}
-
-QSlider::handle:vertical {
- height: 10px;
- background: green;
- margin: 0 -4px; /* expand outside the groove */
-}
-
-QSlider::add-page:vertical {
- background: white;
-}
-
-QSlider::sub-page:vertical {
- background: pink;
-}
-//! [140]
-
-
-//! [141]
-QSpinBox {
- padding-right: 15px; /* make room for the arrows */
- border-image: url(:/images/frame.png) 4;
- border-width: 3;
-}
-
-QSpinBox::up-button {
- subcontrol-origin: border;
- subcontrol-position: top right; /* position at the top right corner */
-
- width: 16px; /* 16 + 2*1px border-width = 15px padding + 3px parent border */
- border-image: url(:/images/spinup.png) 1;
- border-width: 1px;
-}
-
-QSpinBox::up-button:hover {
- border-image: url(:/images/spinup_hover.png) 1;
-}
-
-QSpinBox::up-button:pressed {
- border-image: url(:/images/spinup_pressed.png) 1;
-}
-
-QSpinBox::up-arrow {
- image: url(:/images/up_arrow.png);
- width: 7px;
- height: 7px;
-}
-
-QSpinBox::up-arrow:disabled, QSpinBox::up-arrow:off { /* off state when value is max */
- image: url(:/images/up_arrow_disabled.png);
-}
-
-QSpinBox::down-button {
- subcontrol-origin: border;
- subcontrol-position: bottom right; /* position at bottom right corner */
-
- width: 16px;
- border-image: url(:/images/spindown.png) 1;
- border-width: 1px;
- border-top-width: 0;
-}
-
-QSpinBox::down-button:hover {
- border-image: url(:/images/spindown_hover.png) 1;
-}
-
-QSpinBox::down-button:pressed {
- border-image: url(:/images/spindown_pressed.png) 1;
-}
-
-QSpinBox::down-arrow {
- image: url(:/images/down_arrow.png);
- width: 7px;
- height: 7px;
-}
-
-QSpinBox::down-arrow:disabled,
-QSpinBox::down-arrow:off { /* off state when value in min */
- image: url(:/images/down_arrow_disabled.png);
-}
-
-//! [141]
-
-
-//! [142]
-QSplitter::handle {
- image: url(images/splitter.png);
-}
-
-QSplitter::handle:horizontal {
- width: 2px;
-}
-
-QSplitter::handle:vertical {
- height: 2px;
-}
-
-QSplitter::handle:pressed {
- url(images/splitter_pressed.png);
-}
-
-//! [142]
-
-
-//! [143]
-QStatusBar {
- background: brown;
-}
-
-QStatusBar::item {
- border: 1px solid red;
- border-radius: 3px;
-}
-//! [143]
-
-
-//! [144]
-QStatusBar QLabel {
- border: 3px solid white;
-}
-//! [144]
-
-
-//! [145]
-QTabWidget::pane { /* The tab widget frame */
- border-top: 2px solid #C2C7CB;
-}
-
-QTabWidget::tab-bar {
- left: 5px; /* move to the right by 5px */
-}
-
-/* Style the tab using the tab sub-control. Note that
- it reads QTabBar _not_ QTabWidget */
-QTabBar::tab {
- background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
- stop: 0 #E1E1E1, stop: 0.4 #DDDDDD,
- stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);
- border: 2px solid #C4C4C3;
- border-bottom-color: #C2C7CB; /* same as the pane color */
- border-top-left-radius: 4px;
- border-top-right-radius: 4px;
- min-width: 8ex;
- padding: 2px;
-}
-
-QTabBar::tab:selected, QTabBar::tab:hover {
- background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
- stop: 0 #fafafa, stop: 0.4 #f4f4f4,
- stop: 0.5 #e7e7e7, stop: 1.0 #fafafa);
-}
-
-QTabBar::tab:selected {
- border-color: #9B9B9B;
- border-bottom-color: #C2C7CB; /* same as pane color */
-}
-
-QTabBar::tab:!selected {
- margin-top: 2px; /* make non-selected tabs look smaller */
-}
-//! [145]
-
-
-//! [146]
-QTabWidget::pane { /* The tab widget frame */
- border-top: 2px solid #C2C7CB;
-}
-
-QTabWidget::tab-bar {
- left: 5px; /* move to the right by 5px */
-}
-
-/* Style the tab using the tab sub-control. Note that
- it reads QTabBar _not_ QTabWidget */
-QTabBar::tab {
- background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
- stop: 0 #E1E1E1, stop: 0.4 #DDDDDD,
- stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);
- border: 2px solid #C4C4C3;
- border-bottom-color: #C2C7CB; /* same as the pane color */
- border-top-left-radius: 4px;
- border-top-right-radius: 4px;
- min-width: 8ex;
- padding: 2px;
-}
-
-QTabBar::tab:selected, QTabBar::tab:hover {
- background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
- stop: 0 #fafafa, stop: 0.4 #f4f4f4,
- stop: 0.5 #e7e7e7, stop: 1.0 #fafafa);
-}
-
-QTabBar::tab:selected {
- border-color: #9B9B9B;
- border-bottom-color: #C2C7CB; /* same as pane color */
-}
-
-QTabBar::tab:!selected {
- margin-top: 2px; /* make non-selected tabs look smaller */
-}
-
-/* make use of negative margins for overlapping tabs */
-QTabBar::tab:selected {
- /* expand/overlap to the left and right by 4px */
- margin-left: -4px;
- margin-right: -4px;
-}
-
-QTabBar::tab:first:selected {
- margin-left: 0; /* the first selected tab has nothing to overlap with on the left */
-}
-
-QTabBar::tab:last:selected {
- margin-right: 0; /* the last selected tab has nothing to overlap with on the right */
-}
-
-QTabBar::tab:only-one {
- margin: 0; /* if there is only one tab, we don't want overlapping margins */
-}
-//! [146]
-
-
-//! [147]
-QTabWidget::pane { /* The tab widget frame */
- border-top: 2px solid #C2C7CB;
- position: absolute;
- top: -0.5em;
-}
-
-QTabWidget::tab-bar {
- alignment: center;
-}
-
-/* Style the tab using the tab sub-control. Note that
- it reads QTabBar _not_ QTabWidget */
-QTabBar::tab {
- background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
- stop: 0 #E1E1E1, stop: 0.4 #DDDDDD,
- stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);
- border: 2px solid #C4C4C3;
- border-bottom-color: #C2C7CB; /* same as the pane color */
- border-top-left-radius: 4px;
- border-top-right-radius: 4px;
- min-width: 8ex;
- padding: 2px;
-}
-
-QTabBar::tab:selected, QTabBar::tab:hover {
- background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
- stop: 0 #fafafa, stop: 0.4 #f4f4f4,
- stop: 0.5 #e7e7e7, stop: 1.0 #fafafa);
-}
-
-QTabBar::tab:selected {
- border-color: #9B9B9B;
- border-bottom-color: #C2C7CB; /* same as pane color */
-}
-//! [147]
-
-
-//! [148]
-QTabBar::tear {
- image: url(tear_indicator.png);
-}
-
-QTabBar::scroller { /* the width of the scroll buttons */
- width: 20px;
-}
-
-QTabBar QToolButton { /* the scroll buttons are tool buttons */
- border-image: url(scrollbutton.png) 2;
- border-width: 2px;
-}
-
-QTabBar QToolButton::right-arrow { /* the arrow mark in the tool buttons */
- image: url(rightarrow.png);
-}
-
-QTabBar QToolButton::left-arrow {
- image: url(leftarrow.png);
-}
-//! [148]
-
-
-//! [149]
-QTableView {
- selection-background-color: qlineargradient(x1: 0, y1: 0, x2: 0.5, y2: 0.5,
- stop: 0 #FF92BB, stop: 1 white);
-}
-//! [149]
-
-
-//! [150]
-QTableView QTableCornerButton::section {
- background: red;
- border: 2px outset red;
-}
-//! [150]
-
-
-//! [151]
-QToolBar {
- background: red;
- spacing: 3px; /* spacing between items in the tool bar */
-}
-
-QToolBar::handle {
- image: url(handle.png);
-}
-//! [151]
-
-
-//! [152]
-QToolBox::tab {
- background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
- stop: 0 #E1E1E1, stop: 0.4 #DDDDDD,
- stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);
- border-radius: 5px;
- color: darkgray;
-}
-
-QToolBox::tab:selected { /* italicize selected tabs */
- font: italic;
- color: white;
-}
-//! [152]
-
-
-//! [153]
-QToolButton { /* all types of tool button */
- border: 2px solid #8f8f91;
- border-radius: 6px;
- background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
- stop: 0 #f6f7fa, stop: 1 #dadbde);
-}
-
-QToolButton[popupMode="1"] { /* only for MenuButtonPopup */
- padding-right: 20px; /* make way for the popup button */
-}
-
-QToolButton:pressed {
- background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
- stop: 0 #dadbde, stop: 1 #f6f7fa);
-}
-
-/* the subcontrols below are used only in the MenuButtonPopup mode */
-QToolButton::menu-button {
- border: 2px solid gray;
- border-top-right-radius: 6px;
- border-bottom-right-radius: 6px;
- /* 16px width + 4px for border = 20px allocated above */
- width: 16px;
-}
-
-QToolButton::menu-arrow {
- image: url(downarrow.png);
-}
-
-QToolButton::menu-arrow:open {
- top: 1px; left: 1px; /* shift it a bit */
-}
-//! [153]
-
-
-//! [154]
-QToolTip {
- border: 2px solid darkkhaki;
- padding: 5px;
- border-radius: 3px;
- opacity: 200;
-}
-//! [154]
-
-
-//! [155]
-QTreeView {
- alternate-background-color: yellow;
-}
-//! [155]
-
-
-//! [156]
-QTreeView {
- show-decoration-selected: 1;
-}
-
-QTreeView::item {
- border: 1px solid #d9d9d9;
- border-top-color: transparent;
- border-bottom-color: transparent;
-}
-
-QTreeView::item:hover {
- background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #e7effd, stop: 1 #cbdaf1);
- border: 1px solid #bfcde4;
-}
-
-QTreeView::item:selected {
- border: 1px solid #567dbc;
-}
-
-QTreeView::item:selected:active{
- background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #6ea1f1, stop: 1 #567dbc);
-}
-
-QTreeView::item:selected:!active {
- background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #6b9be8, stop: 1 #577fbf);
-}
-//! [156]
-
-
-//! [157]
-QTreeView::branch {
- background: palette(base);
-}
-
-QTreeView::branch:has-siblings:!adjoins-item {
- background: cyan;
-}
-
-QTreeView::branch:has-siblings:adjoins-item {
- background: red;
-}
-
-QTreeView::branch:!has-children:!has-siblings:adjoins-item {
- background: blue;
-}
-
-QTreeView::branch:closed:has-children:has-siblings {
- background: pink;
-}
-
-QTreeView::branch:has-children:!has-siblings:closed {
- background: gray;
-}
-
-QTreeView::branch:open:has-children:has-siblings {
- background: magenta;
-}
-
-QTreeView::branch:open:has-children:!has-siblings {
- background: green;
-}
-
-//! [157]
-
-
-//! [158]
-QTreeView::branch:has-siblings:!adjoins-item {
- border-image: url(vline.png) 0;
-}
-
-QTreeView::branch:has-siblings:adjoins-item {
- border-image: url(branch-more.png) 0;
-}
-
-QTreeView::branch:!has-children:!has-siblings:adjoins-item {
- border-image: url(branch-end.png) 0;
-}
-
-QTreeView::branch:has-children:!has-siblings:closed,
-QTreeView::branch:closed:has-children:has-siblings {
- border-image: none;
- image: url(branch-closed.png);
-}
-
-QTreeView::branch:open:has-children:!has-siblings,
-QTreeView::branch:open:has-children:has-siblings {
- border-image: none;
- image: url(branch-open.png);
-}
-//! [158]
-
-//! [159]
-QTabBar::close-button {
- image: url(close.png)
- subcontrol-position: left;
-}
-QTabBar::close-button:hover {
- image: url(close-hover.png)
-}
-
-//! [159]
diff --git a/doc/src/snippets/code/src_gui_dialogs_qfiledialog.cpp b/doc/src/snippets/code/src_gui_dialogs_qfiledialog.cpp
deleted file mode 100644
index 1a89ff327f..0000000000
--- a/doc/src/snippets/code/src_gui_dialogs_qfiledialog.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-fileName = QFileDialog::getOpenFileName(this,
- tr("Open Image"), "/home/jana", tr("Image Files (*.png *.jpg *.bmp)"));
-//! [0]
-
-
-//! [1]
-"Images (*.png *.xpm *.jpg);;Text files (*.txt);;XML files (*.xml)"
-//! [1]
-
-
-//! [2]
-QFileDialog dialog(this);
-dialog.setFileMode(QFileDialog::AnyFile);
-//! [2]
-
-
-//! [3]
-dialog.setNameFilter(tr("Images (*.png *.xpm *.jpg)"));
-//! [3]
-
-
-//! [4]
-dialog.setViewMode(QFileDialog::Detail);
-//! [4]
-
-
-//! [5]
-QStringList fileNames;
-if (dialog.exec())
- fileNames = dialog.selectedFiles();
-//! [5]
-
-
-//! [6]
-dialog.setNameFilter("All C++ files (*.cpp *.cc *.C *.cxx *.c++)");
-dialog.setNameFilter("*.cpp *.cc *.C *.cxx *.c++");
-//! [6]
-
-
-//! [7]
-QStringList filters;
-filters << "Image files (*.png *.xpm *.jpg)"
- << "Text files (*.txt)"
- << "Any files (*)";
-
-QFileDialog dialog(this);
-dialog.setNameFilters(filters);
-dialog.exec();
-//! [7]
-
-
-//! [8]
-QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"),
- "/home",
- tr("Images (*.png *.xpm *.jpg)"));
-//! [8]
-
-
-//! [9]
-QStringList files = QFileDialog::getOpenFileNames(
- this,
- "Select one or more files to open",
- "/home",
- "Images (*.png *.xpm *.jpg)");
-//! [9]
-
-
-//! [10]
-QStringList list = files;
-QStringList::Iterator it = list.begin();
-while(it != list.end()) {
- myProcessing(*it);
- ++it;
-}
-//! [10]
-
-
-//! [11]
-QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"),
- "/home/jana/untitled.png",
- tr("Images (*.png *.xpm *.jpg)"));
-//! [11]
-
-
-//! [12]
-QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"),
- "/home",
- QFileDialog::ShowDirsOnly
- | QFileDialog::DontResolveSymlinks);
-//! [12]
diff --git a/doc/src/snippets/code/src_gui_dialogs_qfontdialog.cpp b/doc/src/snippets/code/src_gui_dialogs_qfontdialog.cpp
deleted file mode 100644
index e07ecbca3e..0000000000
--- a/doc/src/snippets/code/src_gui_dialogs_qfontdialog.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-bool ok;
-QFont font = QFontDialog::getFont(
- &ok, QFont("Helvetica [Cronyx]", 10), this);
-if (ok) {
- // the user clicked OK and font is set to the font the user selected
-} else {
- // the user canceled the dialog; font is set to the initial
- // value, in this case Helvetica [Cronyx], 10
-}
-//! [0]
-
-
-//! [1]
-myWidget.setFont(QFontDialog::getFont(0, myWidget.font()));
-//! [1]
-
-
-//! [2]
-bool ok;
-QFont font = QFontDialog::getFont(&ok, QFont("Times", 12), this);
-if (ok) {
- // font is set to the font the user selected
-} else {
- // the user canceled the dialog; font is set to the initial
- // value, in this case Times, 12.
-}
-//! [2]
-
-
-//! [3]
-myWidget.setFont(QFontDialog::getFont(0, myWidget.font()));
-//! [3]
-
-
-//! [4]
-bool ok;
-QFont font = QFontDialog::getFont(&ok, this);
-if (ok) {
- // font is set to the font the user selected
-} else {
- // the user canceled the dialog; font is set to the default
- // application font, QApplication::font()
-}
-//! [4]
diff --git a/doc/src/snippets/code/src_gui_dialogs_qwizard.cpp b/doc/src/snippets/code/src_gui_dialogs_qwizard.cpp
deleted file mode 100644
index 47db20da99..0000000000
--- a/doc/src/snippets/code/src_gui_dialogs_qwizard.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-int LicenseWizard::nextId() const
-{
- switch (currentId()) {
- case Page_Intro:
- if (field("intro.evaluate").toBool()) {
- return Page_Evaluate;
- } else {
- return Page_Register;
- }
- case Page_Evaluate:
- return Page_Conclusion;
- case Page_Register:
- if (field("register.upgradeKey").toString().isEmpty()) {
- return Page_Details;
- } else {
- return Page_Conclusion;
- }
- case Page_Details:
- return Page_Conclusion;
- case Page_Conclusion:
- default:
- return -1;
- }
-}
-//! [0]
-
-
-//! [1]
-MyWizard::MyWizard(QWidget *parent)
- : QWizard(parent)
-{
- ...
- QList<QWizard::WizardButton> layout;
- layout << QWizard::Stretch << QWizard::BackButton << QWizard::CancelButton
- << QWizard::NextButton << QWizard::FinishButton;
- setButtonLayout(layout);
- ...
-}
-//! [1]
diff --git a/doc/src/snippets/code/src_gui_effects_qgraphicseffect.cpp b/doc/src/snippets/code/src_gui_effects_qgraphicseffect.cpp
deleted file mode 100644
index 3e0b0b64ee..0000000000
--- a/doc/src/snippets/code/src_gui_effects_qgraphicseffect.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-MyGraphicsOpacityEffect::draw(QPainter *painter)
-{
- // Fully opaque; draw directly without going through a pixmap.
- if (qFuzzyCompare(m_opacity, 1)) {
- drawSource(painter);
- return;
- }
- ...
-}
-//! [0]
-
-//! [1]
-MyGraphicsEffect::draw(QPainter *painter)
-{
- ...
- QPoint offset;
- if (sourceIsPixmap()) {
- // No point in drawing in device coordinates (pixmap will be scaled anyways).
- const QPixmap pixmap = sourcePixmap(Qt::LogicalCoordinates, &offset);
- ...
- painter->drawPixmap(offset, pixmap);
- } else {
- // Draw pixmap in device coordinates to avoid pixmap scaling;
- const QPixmap pixmap = sourcePixmap(Qt::DeviceCoordinates, &offset);
- painter->setWorldTransform(QTransform());
- ...
- painter->drawPixmap(offset, pixmap);
- }
- ...
-}
-//! [1]
-
-//! [2]
-...
-QLinearGradient alphaGradient(rect.topLeft(), rect.bottomLeft());
-alphaGradient.setColorAt(0.0, Qt::transparent);
-alphaGradient.setColorAt(0.5, Qt::black);
-alphaGradient.setColorAt(1.0, Qt::transparent);
-QGraphicsOpacityEffect *effect = new QGraphicsOpacityEffect;
-effect->setOpacityMask(alphaGradient);
-...
-//! [2]
diff --git a/doc/src/snippets/code/src_gui_graphicsview_qgraphicsgridlayout.cpp b/doc/src/snippets/code/src_gui_graphicsview_qgraphicsgridlayout.cpp
deleted file mode 100644
index 9a974de016..0000000000
--- a/doc/src/snippets/code/src_gui_graphicsview_qgraphicsgridlayout.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-QGraphicsScene scene;
-QGraphicsWidget *textEdit = scene.addWidget(new QTextEdit);
-QGraphicsWidget *pushButton = scene.addWidget(new QPushButton);
-
-QGraphicsGridLayout *layout = new QGraphicsGridLayout;
-layout->addItem(textEdit, 0, 0);
-layout->addItem(pushButton, 0, 1);
-
-QGraphicsWidget *form = new QGraphicsWidget;
-form->setLayout(layout);
-scene.addItem(form);
-//! [0]
diff --git a/doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp b/doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp
deleted file mode 100644
index 01df05c084..0000000000
--- a/doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp
+++ /dev/null
@@ -1,278 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-class SimpleItem : public QGraphicsItem
-{
-public:
- QRectF boundingRect() const
- {
- qreal penWidth = 1;
- return QRectF(-10 - penWidth / 2, -10 - penWidth / 2,
- 20 + penWidth, 20 + penWidth);
- }
-
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
- QWidget *widget)
- {
- painter->drawRoundedRect(-10, -10, 20, 20, 5, 5);
- }
-};
-//! [0]
-
-
-//! [1]
-class CustomItem : public QGraphicsItem
-{
- ...
- enum { Type = UserType + 1 };
-
- int type() const
- {
- // Enable the use of qgraphicsitem_cast with this item.
- return Type;
- }
- ...
-};
-//! [1]
-
-
-//! [2]
-item->setCursor(Qt::IBeamCursor);
-//! [2]
-
-
-//! [3]
-item->setCursor(Qt::IBeamCursor);
-//! [3]
-
-
-//! [4]
-QGraphicsRectItem rect;
-rect.setPos(100, 100);
-
-rect.sceneTransform().map(QPointF(0, 0));
-// returns QPointF(100, 100);
-
-rect.sceneTransform().inverted().map(QPointF(100, 100));
-// returns QPointF(0, 0);
-//! [4]
-
-
-//! [5]
-QGraphicsRectItem rect;
-rect.setPos(100, 100);
-
-rect.deviceTransform(view->viewportTransform()).map(QPointF(0, 0));
-// returns the item's (0, 0) point in view's viewport coordinates
-
-rect.deviceTransform(view->viewportTransform()).inverted().map(QPointF(100, 100));
-// returns view's viewport's (100, 100) coordinate in item coordinates
-//! [5]
-
-
-//! [6]
-// Rotate an item 45 degrees around (0, 0).
-item->rotate(45);
-
-// Rotate an item 45 degrees around (x, y).
-item->setTransform(QTransform().translate(x, y).rotate(45).translate(-x, -y));
-//! [6]
-
-
-//! [7]
-// Scale an item by 3x2 from its origin
-item->scale(3, 2);
-
-// Scale an item by 3x2 from (x, y)
-item->setTransform(QTransform().translate(x, y).scale(3, 2).translate(-x, -y));
-//! [7]
-
-
-//! [8]
-QRectF CircleItem::boundingRect() const
-{
- qreal penWidth = 1;
- return QRectF(-radius - penWidth / 2, -radius - penWidth / 2,
- diameter + penWidth, diameter + penWidth);
-}
-//! [8]
-
-
-//! [9]
-QPainterPath RoundItem::shape() const
-{
- QPainterPath path;
- path.addEllipse(boundingRect());
- return path;
-}
-//! [9]
-
-
-//! [10]
-void RoundRectItem::paint(QPainter *painter,
- const QStyleOptionGraphicsItem *option,
- QWidget *widget)
-{
- painter->drawRoundedRect(-10, -10, 20, 20, 5, 5);
-}
-//! [10]
-
-
-//! [11]
-static const int ObjectName = 0;
-
-QGraphicsItem *item = scene.itemAt(100, 50);
-if (item->data(ObjectName).toString().isEmpty()) {
- if (qgraphicsitem_cast<ButtonItem *>(item))
- item->setData(ObjectName, "Button");
-}
-//! [11]
-
-
-//! [12]
-QGraphicsScene scene;
-QGraphicsEllipseItem *ellipse = scene.addEllipse(QRectF(-10, -10, 20, 20));
-QGraphicsLineItem *line = scene.addLine(QLineF(-10, -10, 20, 20));
-
-line->installSceneEventFilter(ellipse);
-// line's events are filtered by ellipse's sceneEventFilter() function.
-
-ellipse->installSceneEventFilter(line);
-// ellipse's events are filtered by line's sceneEventFilter() function.
-//! [12]
-
-
-//! [13]
-void CustomItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
-{
- QMenu menu;
- QAction *removeAction = menu.addAction("Remove");
- QAction *markAction = menu.addAction("Mark");
- QAction *selectedAction = menu.exec(event->screenPos());
- // ...
-}
-//! [13]
-
-
-//! [14]
-CustomItem::CustomItem()
-{
- setAcceptDrops(true);
- ...
-}
-
-void CustomItem::dragEnterEvent(QGraphicsSceneDragDropEvent *event)
-{
- event->setAccepted(event->mimeData()->hasFormat("text/plain"));
-}
-//! [14]
-
-
-//! [15]
-QVariant Component::itemChange(GraphicsItemChange change, const QVariant &value)
-{
- if (change == ItemPositionChange && scene()) {
- // value is the new position.
- QPointF newPos = value.toPointF();
- QRectF rect = scene()->sceneRect();
- if (!rect.contains(newPos)) {
- // Keep the item inside the scene rect.
- newPos.setX(qMin(rect.right(), qMax(newPos.x(), rect.left())));
- newPos.setY(qMin(rect.bottom(), qMax(newPos.y(), rect.top())));
- return newPos;
- }
- }
- return QGraphicsItem::itemChange(change, value);
-}
-//! [15]
-
-
-//! [16]
-void CircleItem::setRadius(qreal newRadius)
-{
- if (radius != newRadius) {
- prepareGeometryChange();
- radius = newRadius;
- }
-}
-//! [16]
-
-
-//! [17]
-// Group all selected items together
-QGraphicsItemGroup *group = scene->createItemGroup(scene->selecteditems());
-
-// Destroy the group, and delete the group item
-scene->destroyItemGroup(group);
-//! [17]
-
-
-//! [QGraphicsItem type]
-class CustomItem : public QGraphicsItem
-{
- ...
- enum { Type = UserType + 1 };
-
- int type() const
- {
- // Enable the use of qgraphicsitem_cast with this item.
- return Type;
- }
- ...
-};
-//! [QGraphicsItem type]
-
-//! [18]
-class QGraphicsPathItem : public QAbstractGraphicsShapeItem
-{
- public:
- enum { Type = 2 };
- int type() const { return Type; }
- ...
-};
-//! [18]
-
-//! [19]
-QTransform xform = item->deviceTransform(view->viewportTransform());
-QRect deviceRect = xform.mapRect(rect).toAlignedRect();
-view->viewport()->scroll(dx, dy, deviceRect);
-//! [19]
-
diff --git a/doc/src/snippets/code/src_gui_graphicsview_qgraphicslinearlayout.cpp b/doc/src/snippets/code/src_gui_graphicsview_qgraphicslinearlayout.cpp
deleted file mode 100644
index e3998201af..0000000000
--- a/doc/src/snippets/code/src_gui_graphicsview_qgraphicslinearlayout.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-QGraphicsScene scene;
-QGraphicsWidget *textEdit = scene.addWidget(new QTextEdit);
-QGraphicsWidget *pushButton = scene.addWidget(new QPushButton);
-
-QGraphicsLinearLayout *layout = new QGraphicsLinearLayout;
-layout->addItem(textEdit);
-layout->addItem(pushButton);
-
-QGraphicsWidget *form = new QGraphicsWidget;
-form->setLayout(layout);
-scene.addItem(form);
-//! [0]
diff --git a/doc/src/snippets/code/src_gui_graphicsview_qgraphicsproxywidget.cpp b/doc/src/snippets/code/src_gui_graphicsview_qgraphicsproxywidget.cpp
deleted file mode 100644
index e508dbfb2b..0000000000
--- a/doc/src/snippets/code/src_gui_graphicsview_qgraphicsproxywidget.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-int main(int argc, char **argv)
-{
- QApplication app(argc, argv);
-
- QTabWidget *tabWidget = new QTabWidget;
-
- QGraphicsScene scene;
- QGraphicsProxyWidget *proxy = scene.addWidget(tabWidget);
-
- QGraphicsView view(&scene);
- view.show();
-
- return app.exec();
-}
-//! [0]
-
-//! [1]
-QGroupBox *groupBox = new QGroupBox("Contact Details");
-QLabel *numberLabel = new QLabel("Telephone number");
-QLineEdit *numberEdit = new QLineEdit;
-
-QFormLayout *layout = new QFormLayout;
-layout->addRow(numberLabel, numberEdit);
-groupBox->setLayout(layout);
-
-QGraphicsScene scene;
-QGraphicsProxyWidget *proxy = scene.addWidget(groupBox);
-
-QGraphicsView view(&scene);
-view.show();
-//! [1]
-
-//! [2]
-QGraphicsScene scene;
-
-QLineEdit *edit = new QLineEdit;
-QGraphicsProxyWidget *proxy = scene.addWidget(edit);
-
-edit->isVisible(); // returns true
-proxy->isVisible(); // also returns true
-
-edit->hide();
-
-edit->isVisible(); // returns false
-proxy->isVisible(); // also returns false
-//! [2]
diff --git a/doc/src/snippets/code/src_gui_graphicsview_qgraphicsscene.cpp b/doc/src/snippets/code/src_gui_graphicsview_qgraphicsscene.cpp
deleted file mode 100644
index 40b240c56f..0000000000
--- a/doc/src/snippets/code/src_gui_graphicsview_qgraphicsscene.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-QGraphicsScene scene;
-scene.addText("Hello, world!");
-
-QGraphicsView view(&scene);
-view.show();
-//! [0]
-
-
-//! [1]
-QGraphicsScene scene;
-scene.addItem(...
-...
-QPrinter printer(QPrinter::HighResolution);
-printer.setPaperSize(QPrinter::A4);
-
-QPainter painter(&printer);
-scene.render(&painter);
-//! [1]
-
-
-//! [2]
-QSizeF segmentSize = sceneRect().size() / pow(2, depth - 1);
-//! [2]
-
-
-//! [3]
-QGraphicsScene scene;
-QGraphicsView view(&scene);
-view.show();
-
-// a blue background
-scene.setBackgroundBrush(Qt::blue);
-
-// a gradient background
-QRadialGradient gradient(0, 0, 10);
-gradient.setSpread(QGradient::RepeatSpread);
-scene.setBackgroundBrush(gradient);
-//! [3]
-
-
-//! [4]
-QGraphicsScene scene;
-QGraphicsView view(&scene);
-view.show();
-
-// a white semi-transparent foreground
-scene.setForegroundBrush(QColor(255, 255, 255, 127));
-
-// a grid foreground
-scene.setForegroundBrush(QBrush(Qt::lightGray, Qt::CrossPattern));
-//! [4]
-
-
-//! [5]
-QRectF TileScene::rectForTile(int x, int y) const
-{
- // Return the rectangle for the tile at position (x, y).
- return QRectF(x * tileWidth, y * tileHeight, tileWidth, tileHeight);
-}
-
-void TileScene::setTile(int x, int y, const QPixmap &pixmap)
-{
- // Sets or replaces the tile at position (x, y) with pixmap.
- if (x >= 0 && x < numTilesH && y >= 0 && y < numTilesV) {
- tiles[y][x] = pixmap;
- invalidate(rectForTile(x, y), BackgroundLayer);
- }
-}
-
-void TileScene::drawBackground(QPainter *painter, const QRectF &exposed)
-{
- // Draws all tiles that intersect the exposed area.
- for (int y = 0; y < numTilesV; ++y) {
- for (int x = 0; x < numTilesH; ++x) {
- QRectF rect = rectForTile(x, y);
- if (exposed.intersects(rect))
- painter->drawPixmap(rect.topLeft(), tiles[y][x]);
- }
- }
-}
-//! [5]
diff --git a/doc/src/snippets/code/src_gui_graphicsview_qgraphicssceneevent.cpp b/doc/src/snippets/code/src_gui_graphicsview_qgraphicssceneevent.cpp
deleted file mode 100644
index 0e9ceea6a0..0000000000
--- a/doc/src/snippets/code/src_gui_graphicsview_qgraphicssceneevent.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-
-setDropAction(proposedAction());
-
-//! [0]
diff --git a/doc/src/snippets/code/src_gui_graphicsview_qgraphicsview.cpp b/doc/src/snippets/code/src_gui_graphicsview_qgraphicsview.cpp
deleted file mode 100644
index d07b5f7cf6..0000000000
--- a/doc/src/snippets/code/src_gui_graphicsview_qgraphicsview.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-QGraphicsScene scene;
-scene.addText("Hello, world!");
-
-QGraphicsView view(&scene);
-view.show();
-//! [0]
-
-
-//! [1]
-QGraphicsScene scene;
-scene.addRect(QRectF(-10, -10, 20, 20));
-
-QGraphicsView view(&scene);
-view.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
-view.show();
-//! [1]
-
-
-//! [2]
-QGraphicsView view;
-view.setBackgroundBrush(QImage(":/images/backgroundtile.png"));
-view.setCacheMode(QGraphicsView::CacheBackground);
-//! [2]
-
-
-//! [3]
-QGraphicsScene scene;
-scene.addText("GraphicsView rotated clockwise");
-
-QGraphicsView view(&scene);
-view.rotate(90); // the text is rendered with a 90 degree clockwise rotation
-view.show();
-//! [3]
-
-
-//! [4]
-QGraphicsScene scene;
-scene.addItem(...
-...
-
-QGraphicsView view(&scene);
-view.show();
-...
-
-QPrinter printer(QPrinter::HighResolution);
-printer.setPageSize(QPrinter::A4);
-QPainter painter(&printer);
-
-// print, fitting the viewport contents into a full page
-view.render(&painter);
-
-// print the upper half of the viewport into the lower.
-// half of the page.
-QRect viewport = view.viewport()->rect();
-view.render(&painter,
- QRectF(0, printer.height() / 2,
- printer.width(), printer.height() / 2),
- viewport.adjusted(0, 0, 0, -viewport.height() / 2));
-
-//! [4]
-
-
-//! [5]
-void CustomView::mousePressEvent(QMouseEvent *event)
-{
- qDebug() << "There are" << items(event->pos()).size()
- << "items at position" << mapToScene(event->pos());
-}
-//! [5]
-
-
-//! [6]
-void CustomView::mousePressEvent(QMouseEvent *event)
-{
- if (QGraphicsItem *item = itemAt(event->pos())) {
- qDebug() << "You clicked on item" << item;
- } else {
- qDebug() << "You didn't click on an item.";
- }
-}
-//! [6]
-
-
-//! [7]
-QGraphicsScene scene;
-scene.addText("GraphicsView rotated clockwise");
-
-QGraphicsView view(&scene);
-view.rotate(90); // the text is rendered with a 90 degree clockwise rotation
-view.show();
-//! [7]
diff --git a/doc/src/snippets/code/src_gui_graphicsview_qgraphicswidget.cpp b/doc/src/snippets/code/src_gui_graphicsview_qgraphicswidget.cpp
deleted file mode 100644
index da92f2d2e1..0000000000
--- a/doc/src/snippets/code/src_gui_graphicsview_qgraphicswidget.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-void MyGroupBoxWidget::initStyleOption(QStyleOption *option) const
-{
- QGraphicsWidget::initStyleOption(option);
- if (QStyleOptionGroupBox *box = qstyleoption_cast<QStyleOptionGroupBox *>(option)) {
- // Add group box specific state.
- box->flat = isFlat();
- ...
- }
-}
-//! [0]
-
-
-//! [1]
-setTabOrder(a, b); // a to b
-setTabOrder(b, c); // a to b to c
-setTabOrder(c, d); // a to b to c to d
-//! [1]
-
-
-//! [2]
-// WRONG
-setTabOrder(c, d); // c to d
-setTabOrder(a, b); // a to b AND c to d
-setTabOrder(b, c); // a to b to c, but not c to d
-//! [2]
diff --git a/doc/src/snippets/code/src_gui_image_qicon.cpp b/doc/src/snippets/code/src_gui_image_qicon.cpp
deleted file mode 100644
index 28ebea8f65..0000000000
--- a/doc/src/snippets/code/src_gui_image_qicon.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-QToolButton *button = new QToolButton;
-button->setIcon(QIcon("open.xpm"));
-//! [0]
-
-
-//! [1]
-button->setIcon(QIcon());
-//! [1]
-
-
-//! [2]
-void MyWidget::drawIcon(QPainter *painter, QPoint pos)
-{
- QPixmap pixmap = icon.pixmap(QSize(22, 22),
- isEnabled() ? QIcon::Normal
- : QIcon::Disabled,
- isChecked() ? QIcon::On
- : QIcon::Off);
- painter->drawPixmap(pos, pixmap);
-}
-//! [2]
-
-//! [3]
- QIcon undoicon = QIcon::fromTheme("edit-undo");
-//! [3]
-
-//! [4]
- QIcon undoicon = QIcon::fromTheme("edit-undo", QIcon(":/undo.png"));
-//! [4]
-
diff --git a/doc/src/snippets/code/src_gui_image_qpixmapfilter.cpp b/doc/src/snippets/code/src_gui_image_qpixmapfilter.cpp
deleted file mode 100644
index 55d5aa4897..0000000000
--- a/doc/src/snippets/code/src_gui_image_qpixmapfilter.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-QPixmapColorizeFilter *myFilter = new QPixmapColorFilter;
-myFilter->setColor(QColor(128, 0, 0));
-myFilter->draw(painter, QPoint(0, 0), originalPixmap);
-//! [0]
-
-//! [1]
-QPixmapConvolutionFilter *myFilter = new QPixmapConvolutionFilter;
-qreal kernel[] = {
- 0.0,-1.0, 0.0,
- -1.0, 5.0,-1.0,
- 0.0,-1.0, 0.0
- };
-myFilter->setConvolutionKernel(kernel, 3, 3);
-myFilter->draw(painter, QPoint(0, 0), originalPixmap);
-//! [1]
-
-//! [2]
-QPixmapDropShadowFilter *myFilter = new QPixmapDropShadowFilter;
-myFilter->draw(painter, QPoint(0, 0), originalPixmap);
-//! [2]
-
diff --git a/doc/src/snippets/code/src_gui_itemviews_qabstractitemview.cpp b/doc/src/snippets/code/src_gui_itemviews_qabstractitemview.cpp
deleted file mode 100644
index 2a497ff37c..0000000000
--- a/doc/src/snippets/code/src_gui_itemviews_qabstractitemview.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-void MyView::resizeEvent(QResizeEvent *event) {
- horizontalScrollBar()->setRange(0, realWidth - width());
- ...
-}
-//! [0]
-
-//! [1]
-setIndexWidget(index, new QLineEdit);
-...
-setIndexWidget(index, new QTextEdit);
-//! [1]
-
-//! [2]
-QItemSelectionModel *m = view->selectionModel();
-view->setModel(new model);
-delete m;
-//! [2]
diff --git a/doc/src/snippets/code/src_gui_itemviews_qdatawidgetmapper.cpp b/doc/src/snippets/code/src_gui_itemviews_qdatawidgetmapper.cpp
deleted file mode 100644
index d968260d39..0000000000
--- a/doc/src/snippets/code/src_gui_itemviews_qdatawidgetmapper.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-QDataWidgetMapper *mapper = new QDataWidgetMapper;
-mapper->setModel(model);
-mapper->addMapping(mySpinBox, 0);
-mapper->addMapping(myLineEdit, 1);
-mapper->addMapping(myCountryChooser, 2);
-mapper->toFirst();
-//! [0]
-
-
-//! [1]
-QDataWidgetMapper *mapper = new QDataWidgetMapper();
-mapper->setModel(myModel);
-mapper->addMapping(nameLineEdit, 0);
-mapper->addMapping(ageSpinBox, 1);
-//! [1]
-
-
-//! [2]
-QDataWidgetMapper *mapper = new QDataWidgetMapper();
-connect(myTableView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
- mapper, SLOT(setCurrentModelIndex(QModelIndex)));
-//! [2]
diff --git a/doc/src/snippets/code/src_gui_itemviews_qitemeditorfactory.cpp b/doc/src/snippets/code/src_gui_itemviews_qitemeditorfactory.cpp
deleted file mode 100644
index 3f1e11c04c..0000000000
--- a/doc/src/snippets/code/src_gui_itemviews_qitemeditorfactory.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-Q_PROPERTY(QColor color READ color WRITE setColor USER true)
-//! [0]
-
-
-//! [1]
-QItemEditorCreator<MyEditor> *itemCreator =
- new QItemEditorCreator<MyEditor>("myProperty");
-
-QItemEditorFactory *factory = new QItemEditorFactory;
-//! [1]
-
-
-//! [2]
-QItemEditorFactory *editorFactory = new QItemEditorFactory;
-QItemEditorCreatorBase *creator = new QStandardItemEditorCreator<MyFancyDateTimeEdit>();
-editorFactory->registerEditor(QVariant::DateType, creator);
-//! [2]
-
-
-//! [3]
-Q_PROPERTY(QColor color READ color WRITE setColor USER true)
-//! [3]
diff --git a/doc/src/snippets/code/src_gui_itemviews_qstandarditemmodel.cpp b/doc/src/snippets/code/src_gui_itemviews_qstandarditemmodel.cpp
deleted file mode 100644
index ae91339867..0000000000
--- a/doc/src/snippets/code/src_gui_itemviews_qstandarditemmodel.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-QStandardItemModel model(4, 4);
-for (int row = 0; row < 4; ++row) {
- for (int column = 0; column < 4; ++column) {
- QStandardItem *item = new QStandardItem(QString("row %0, column %1").arg(row).arg(column));
- model.setItem(row, column, item);
- }
-}
-//! [0]
-
-
-//! [1]
-QStandardItemModel model;
-QStandardItem *parentItem = model.invisibleRootItem();
-for (int i = 0; i < 4; ++i) {
- QStandardItem *item = new QStandardItem(QString("item %0").arg(i));
- parentItem->appendRow(item);
- parentItem = item;
-}
-//! [1]
-
-
-//! [2]
-QTreeView *treeView = new QTreeView(this);
-treeView->setModel(myStandardItemModel);
-connect(treeView, SIGNAL(clicked(QModelIndex)),
- this, SLOT(clicked(QModelIndex)));
-//! [2]
-
-
-//! [3]
-void MyWidget::clicked(const QModelIndex &index)
-{
- QStandardItem *item = myStandardItemModel->itemFromIndex(index);
- // Do stuff with the item ...
-}
-//! [3]
-
-
-//! [4]
-treeView->scrollTo(item->index());
-//! [4]
diff --git a/doc/src/snippets/code/src_gui_itemviews_qtablewidget.cpp b/doc/src/snippets/code/src_gui_itemviews_qtablewidget.cpp
deleted file mode 100644
index 169fff57b9..0000000000
--- a/doc/src/snippets/code/src_gui_itemviews_qtablewidget.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-setCellWidget(index, new QLineEdit);
-...
-setCellWidget(index, new QTextEdit);
-//! [0]
diff --git a/doc/src/snippets/code/src_gui_itemviews_qtreewidget.cpp b/doc/src/snippets/code/src_gui_itemviews_qtreewidget.cpp
deleted file mode 100644
index b299d765f3..0000000000
--- a/doc/src/snippets/code/src_gui_itemviews_qtreewidget.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-QTreeWidget *treeWidget = new QTreeWidget();
-treeWidget->setColumnCount(1);
-QList<QTreeWidgetItem *> items;
-for (int i = 0; i < 10; ++i)
- items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("item: %1").arg(i))));
-treeWidget->insertTopLevelItems(0, items);
-//! [0]
diff --git a/doc/src/snippets/code/src_gui_kernel_qaction.cpp b/doc/src/snippets/code/src_gui_kernel_qaction.cpp
deleted file mode 100644
index af876cd872..0000000000
--- a/doc/src/snippets/code/src_gui_kernel_qaction.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-QApplication app(argc, argv);
-app.setAttribute(Qt::AA_DontShowIconsInMenus); // Icons are *no longer shown* in menus
-// ...
-QAction *myAction = new QAction();
-// ...
-myAction->setIcon(SomeIcon);
-myAction->setIconVisibleInMenu(true); // Icon *will* be shown in menus for *this* action.
-//! [0]
diff --git a/doc/src/snippets/code/src_gui_kernel_qformlayout.cpp b/doc/src/snippets/code/src_gui_kernel_qformlayout.cpp
deleted file mode 100644
index 1f7517b613..0000000000
--- a/doc/src/snippets/code/src_gui_kernel_qformlayout.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-QFormLayout *formLayout = new QFormLayout;
-formLayout->addRow(tr("&Name:"), nameLineEdit);
-formLayout->addRow(tr("&Email:"), emailLineEdit);
-formLayout->addRow(tr("&Age:"), ageSpinBox);
-setLayout(formLayout);
-//! [0]
-
-
-//! [1]
-nameLabel = new QLabel(tr("&Name:"));
-nameLabel->setBuddy(nameLineEdit);
-
-emailLabel = new QLabel(tr("&Name:"));
-emailLabel->setBuddy(emailLineEdit);
-
-ageLabel = new QLabel(tr("&Name:"));
-ageLabel->setBuddy(ageSpinBox);
-
-QGridLayout *gridLayout = new QGridLayout;
-gridLayout->addWidget(nameLabel, 0, 0);
-gridLayout->addWidget(nameLineEdit, 0, 1);
-gridLayout->addWidget(emailLabel, 1, 0);
-gridLayout->addWidget(emailLineEdit, 1, 1);
-gridLayout->addWidget(ageLabel, 2, 0);
-gridLayout->addWidget(ageSpinBox, 2, 1);
-setLayout(gridLayout);
-//! [1]
-
-
-//! [2]
-formLayout->setRowWrapPolicy(QFormLayout::DontWrapRows);
-formLayout->setFieldGrowthPolicy(QFormLayout::FieldsStayAtSizeHint);
-formLayout->setFormAlignment(Qt::AlignHCenter | Qt::AlignTop);
-formLayout->setLabelAlignment(Qt::AlignLeft);
-//! [2]
diff --git a/doc/src/snippets/code/src_gui_kernel_qlayout.cpp b/doc/src/snippets/code/src_gui_kernel_qlayout.cpp
deleted file mode 100644
index cabd753b5d..0000000000
--- a/doc/src/snippets/code/src_gui_kernel_qlayout.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-static void paintLayout(QPainter *painter, QLayoutItem *item)
-{
- QLayout *layout = item->layout();
- if (layout) {
- for (int i = 0; i < layout->count(); ++i)
- paintLayout(painter, layout->itemAt(i));
- }
- painter->drawRect(item->geometry());
-}
-
-void MyWidget::paintEvent(QPaintEvent *)
-{
- QPainter painter(this);
- if (layout())
- paintLayout(&painter, layout());
-}
-//! [0]
-
-
-//! [1]
-QLayoutItem *child;
-while ((child = layout->takeAt(0)) != 0) {
- ...
- delete child;
-}
-//! [1]
diff --git a/doc/src/snippets/code/src_gui_kernel_qlayoutitem.cpp b/doc/src/snippets/code/src_gui_kernel_qlayoutitem.cpp
deleted file mode 100644
index 378253c605..0000000000
--- a/doc/src/snippets/code/src_gui_kernel_qlayoutitem.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-int MyLayout::heightForWidth(int w) const
-{
- if (cache_dirty || cached_width != w) {
- // not all C++ compilers support "mutable"
- MyLayout *that = (MyLayout*)this;
- int h = calculateHeightForWidth(w);
- that->cached_hfw = h;
- return h;
- }
- return cached_hfw;
-}
-//! [0]
diff --git a/doc/src/snippets/code/src_gui_kernel_qshortcut.cpp b/doc/src/snippets/code/src_gui_kernel_qshortcut.cpp
deleted file mode 100644
index 31e3e3291e..0000000000
--- a/doc/src/snippets/code/src_gui_kernel_qshortcut.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-shortcut = new QShortcut(QKeySequence(tr("Ctrl+O", "File|Open")),
- parent);
-//! [0]
-
-
-//! [1]
-setKey(0); // no signal emitted
-setKey(QKeySequence()); // no signal emitted
-setKey(0x3b1); // Greek letter alpha
-setKey(Qt::Key_D); // 'd', e.g. to delete
-setKey('q'); // 'q', e.g. to quit
-setKey(Qt::CTRL + Qt::Key_P); // Ctrl+P, e.g. to print document
-setKey("Ctrl+P"); // Ctrl+P, e.g. to print document
-//! [1]
diff --git a/doc/src/snippets/code/src_gui_kernel_qwidget.cpp b/doc/src/snippets/code/src_gui_kernel_qwidget.cpp
deleted file mode 100644
index 3e94519073..0000000000
--- a/doc/src/snippets/code/src_gui_kernel_qwidget.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-w->setWindowState(w->windowState() ^ Qt::WindowFullScreen);
-//! [0]
-
-
-//! [1]
-w->setWindowState(w->windowState() & ~Qt::WindowMinimized | Qt::WindowActive);
-//! [1]
-
-
-//! [2]
-width = baseSize().width() + i * sizeIncrement().width();
-height = baseSize().height() + j * sizeIncrement().height();
-//! [2]
-
-
-//! [3]
-aWidget->window()->setWindowTitle("New Window Title");
-//! [3]
-
-
-//! [4]
-QFont font("Helvetica", 12, QFont::Bold);
-setFont(font);
-//! [4]
-
-
-//! [5]
-QFont font;
-font.setBold(false);
-setFont(font);
-//! [5]
-
-
-//! [6]
-setCursor(Qt::IBeamCursor);
-//! [6]
-
-
-//! [7]
-QPixmap pixmap(widget->size());
-widget->render(&pixmap);
-//! [7]
-
-
-//! [8]
-QPainter painter(this);
-...
-painter.end();
-myWidget->render(this);
-//! [8]
-
-
-//! [9]
-setTabOrder(a, b); // a to b
-setTabOrder(b, c); // a to b to c
-setTabOrder(c, d); // a to b to c to d
-//! [9]
-
-
-//! [10]
-// WRONG
-setTabOrder(c, d); // c to d
-setTabOrder(a, b); // a to b AND c to d
-setTabOrder(b, c); // a to b to c, but not c to d
-//! [10]
-
-
-//! [11]
-void MyWidget::closeEvent(QCloseEvent *event)
-{
- QSettings settings("MyCompany", "MyApp");
- settings.setValue("geometry", saveGeometry());
- QWidget::closeEvent(event);
-}
-//! [11]
-
-
-//! [12]
-QSettings settings("MyCompany", "MyApp");
-myWidget->restoreGeometry(settings.value("myWidget/geometry").toByteArray());
-//! [12]
-
-
-//! [13]
-setUpdatesEnabled(false);
-bigVisualChanges();
-setUpdatesEnabled(true);
-//! [13]
-
-
-//! [14]
-...
-extern void qt_x11_set_global_double_buffer(bool);
-qt_x11_set_global_double_buffer(false);
-...
-//! [14]
diff --git a/doc/src/snippets/code/src_gui_painting_qdrawutil.cpp b/doc/src/snippets/code/src_gui_painting_qdrawutil.cpp
deleted file mode 100644
index 0f70fce8ef..0000000000
--- a/doc/src/snippets/code/src_gui_painting_qdrawutil.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-QFrame frame:
-frame.setFrameStyle(QFrame::HLine | QFrame::Sunken);
-//! [0]
-
-
-//! [1]
-QFrame frame:
-frame.setFrameStyle(QFrame::Box | QFrame::Raised);
-//! [1]
-
-
-//! [2]
-QFrame frame:
-frame.setFrameStyle( QFrame::Panel | QFrame::Sunken);
-//! [2]
-
-
-//! [3]
-QFrame frame:
-frame.setFrameStyle(QFrame::WinPanel | QFrame::Raised);
-//! [3]
-
-
-//! [4]
-QFrame frame:
-frame.setFrameStyle(QFrame::Box | QFrame::Plain);
-//! [4]
-
-
-//! [5]
-QFrame frame:
-frame.setFrameStyle(QFrame::HLine | QFrame::Sunken);
-//! [5]
-
-
-//! [6]
-QFrame frame:
-frame.setFrameStyle(QFrame::Box | QFrame::Raised);
-//! [6]
-
-
-//! [7]
-QFrame frame:
-frame.setFrameStyle( QFrame::Panel | QFrame::Sunken);
-//! [7]
-
-
-//! [8]
-QFrame frame:
-frame.setFrameStyle(QFrame::WinPanel | QFrame::Raised);
-//! [8]
-
-
-//! [9]
-QFrame frame:
-frame.setFrameStyle(QFrame::Box | QFrame::Plain);
-//! [9]
diff --git a/doc/src/snippets/code/src_gui_qproxystyle.cpp b/doc/src/snippets/code/src_gui_qproxystyle.cpp
deleted file mode 100644
index ae9ff131aa..0000000000
--- a/doc/src/snippets/code/src_gui_qproxystyle.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [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_gui_styles_qstyle.cpp b/doc/src/snippets/code/src_gui_styles_qstyle.cpp
deleted file mode 100644
index ed4ebb60a4..0000000000
--- a/doc/src/snippets/code/src_gui_styles_qstyle.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-./myapplication -style motif
-//! [0]
-
-
-//! [1]
-./myapplication -style custom
-//! [1]
diff --git a/doc/src/snippets/code/src_gui_styles_qstyleoption.cpp b/doc/src/snippets/code/src_gui_styles_qstyleoption.cpp
deleted file mode 100644
index 962212388f..0000000000
--- a/doc/src/snippets/code/src_gui_styles_qstyleoption.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-int MyStyle::styleHint(StyleHint stylehint, const QStyleOption *opt,
- const QWidget *widget, QStyleHintReturn* returnData) const;
-{
- if (stylehint == SH_RubberBand_Mask) {
- const QStyleHintReturnMask *maskReturn =
- qstyleoption_cast<const QStyleHintReturnMask *>(hint);
- if (maskReturn) {
- ...
- }
- }
- ...
-}
-//! [0]
diff --git a/doc/src/snippets/code/src_gui_util_qcompleter.cpp b/doc/src/snippets/code/src_gui_util_qcompleter.cpp
deleted file mode 100644
index 2e8eac17ad..0000000000
--- a/doc/src/snippets/code/src_gui_util_qcompleter.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-QStringList wordList;
-wordList << "alpha" << "omega" << "omicron" << "zeta";
-
-QLineEdit *lineEdit = new QLineEdit(this);
-
-QCompleter *completer = new QCompleter(wordList, this);
-completer->setCaseSensitivity(Qt::CaseInsensitive);
-lineEdit->setCompleter(completer);
-//! [0]
-
-
-//! [1]
-QCompleter *completer = new QCompleter(this);
-completer->setModel(new QDirModel(completer));
-lineEdit->setCompleter(completer);
-//! [1]
-
-
-//! [2]
-for (int i = 0; completer->setCurrentRow(i); i++)
- qDebug() << completer->currentCompletion() << " is match number " << i;
-//! [2]
diff --git a/doc/src/snippets/code/src_gui_util_qundostack.cpp b/doc/src/snippets/code/src_gui_util_qundostack.cpp
deleted file mode 100644
index 7e06a8ef6f..0000000000
--- a/doc/src/snippets/code/src_gui_util_qundostack.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-class AppendText : public QUndoCommand
-{
-public:
- AppendText(QString *doc, const QString &text)
- : m_document(doc), m_text(text) { setText("append text"); }
- virtual void undo()
- { m_document->chop(m_text.length()); }
- virtual void redo()
- { m_document->append(m_text); }
-private:
- QString *m_document;
- QString m_text;
-};
-//! [0]
-
-
-//! [1]
-MyCommand *command1 = new MyCommand();
-stack->push(command1);
-MyCommand *command2 = new MyCommand();
-stack->push(command2);
-
-stack->undo();
-
-MyCommand *command3 = new MyCommand();
-stack->push(command3); // command2 gets deleted
-//! [1]
-
-
-//! [2]
-QUndoCommand *insertRed = new QUndoCommand(); // an empty command
-insertRed->setText("insert red text");
-
-new InsertText(document, idx, text, insertRed); // becomes child of insertRed
-new SetColor(document, idx, text.length(), Qt::red, insertRed);
-
-stack.push(insertRed);
-//! [2]
-
-
-//! [3]
-bool AppendText::mergeWith(const QUndoCommand *other)
-{
- if (other->id() != id()) // make sure other is also an AppendText command
- return false;
- m_text += static_cast<const AppendText*>(other)->m_text;
- return true;
-}
-//! [3]
-
-
-//! [4]
-stack.beginMacro("insert red text");
-stack.push(new InsertText(document, idx, text));
-stack.push(new SetColor(document, idx, text.length(), Qt::red));
-stack.endMacro(); // indexChanged() is emitted
-//! [4]
-
-
-//! [5]
-QUndoCommand *insertRed = new QUndoCommand(); // an empty command
-insertRed->setText("insert red text");
-
-new InsertText(document, idx, text, insertRed); // becomes child of insertRed
-new SetColor(document, idx, text.length(), Qt::red, insertRed);
-
-stack.push(insertRed);
-//! [5]
diff --git a/doc/src/snippets/code/src_gui_widgets_qabstractbutton.cpp b/doc/src/snippets/code/src_gui_widgets_qabstractbutton.cpp
deleted file mode 100644
index 948ed0e958..0000000000
--- a/doc/src/snippets/code/src_gui_widgets_qabstractbutton.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-QPushButton *button = new QPushButton(tr("Ro&ck && Roll"), this);
-//! [0]
-
-
-//! [1]
-button->setIcon(QIcon(":/images/print.png"));
-button->setShortcut(tr("Alt+F7"));
-//! [1]
-
-
-//! [2]
-void MyWidget::reactToToggle(bool checked)
-{
- if (checked) {
- // Examine the new button states.
- ...
- }
-}
-//! [2]
diff --git a/doc/src/snippets/code/src_gui_widgets_qabstractspinbox.cpp b/doc/src/snippets/code/src_gui_widgets_qabstractspinbox.cpp
deleted file mode 100644
index 66f3449760..0000000000
--- a/doc/src/snippets/code/src_gui_widgets_qabstractspinbox.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-QSpinBox *spinBox = new QSpinBox(this);
-spinBox->setRange(0, 100);
-spinBox->setWrapping(true);
-spinBox->setValue(100);
-spinBox->stepBy(1);
-// value is 0
-//! [0]
diff --git a/doc/src/snippets/code/src_gui_widgets_qcalendarwidget.cpp b/doc/src/snippets/code/src_gui_widgets_qcalendarwidget.cpp
deleted file mode 100644
index 6f99bdf0ce..0000000000
--- a/doc/src/snippets/code/src_gui_widgets_qcalendarwidget.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-QCalendarWidget *calendar;
-calendar->setGridVisible(true);
-//! [0]
-
-
-//! [1]
-QCalendarWidget *calendar;
-calendar->setGridVisible(true);
-calendar->setMinimumDate(QDate(2006, 6, 19));
-//! [1]
-
-
-//! [2]
-QCalendarWidget *calendar;
-calendar->setGridVisible(true);
-calendar->setMaximumDate(QDate(2006, 7, 3));
-//! [2]
-
-
-//! [3]
-QCalendarWidget *calendar;
-
-calendar->setDateRange(min, max);
-//! [3]
-
-
-//! [4]
-QCalendarWidget *calendar;
-
-calendar->setMinimumDate(min);
-calendar->setMaximumDate(max);
-//! [4]
-
-
-//! [5]
-QCalendarWidget *calendar;
-calendar->setGridVisible(true);
-//! [5]
diff --git a/doc/src/snippets/code/src_gui_widgets_qcheckbox.cpp b/doc/src/snippets/code/src_gui_widgets_qcheckbox.cpp
deleted file mode 100644
index 71ee59bc85..0000000000
--- a/doc/src/snippets/code/src_gui_widgets_qcheckbox.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-QCheckBox *checkbox = new QCheckBox("C&ase sensitive", this);
-//! [0]
diff --git a/doc/src/snippets/code/src_gui_widgets_qdatetimeedit.cpp b/doc/src/snippets/code/src_gui_widgets_qdatetimeedit.cpp
deleted file mode 100644
index 5eb9e739ea..0000000000
--- a/doc/src/snippets/code/src_gui_widgets_qdatetimeedit.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-QDateTimeEdit *dateEdit = new QDateTimeEdit(QDate::currentDate());
-dateEdit->setMinimumDate(QDate::currentDate().addDays(-365));
-dateEdit->setMaximumDate(QDate::currentDate().addDays(365));
-dateEdit->setDisplayFormat("yyyy.MM.dd");
-//! [0]
-
-
-//! [1]
-setDateTimeRange(min, max);
-//! [1]
-
-
-//! [2]
-setMinimumDateTime(min);
-setMaximumDateTime(max);
-//! [2]
-
-
-//! [3]
-setDateRange(min, max);
-//! [3]
-
-
-//! [4]
-setMinimumDate(min);
-setMaximumDate(max);
-//! [4]
-
-
-//! [5]
-setTimeRange(min, max);
-//! [5]
-
-
-//! [6]
-setMinimumTime(min);
-setMaximumTime(max);
-//! [6]
diff --git a/doc/src/snippets/code/src_gui_widgets_qdockwidget.cpp b/doc/src/snippets/code/src_gui_widgets_qdockwidget.cpp
deleted file mode 100644
index 690e3d5f33..0000000000
--- a/doc/src/snippets/code/src_gui_widgets_qdockwidget.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-QDockWidget *dockWidget = qobject_cast<QDockWidget*>(parentWidget());
-if (dockWidget->features() & QDockWidget::DockWidgetVerticalTitleBar) {
- // I need to be vertical
-} else {
- // I need to be horizontal
-}
-//! [0]
diff --git a/doc/src/snippets/code/src_gui_widgets_qframe.cpp b/doc/src/snippets/code/src_gui_widgets_qframe.cpp
deleted file mode 100644
index 6e3afcd8cf..0000000000
--- a/doc/src/snippets/code/src_gui_widgets_qframe.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-QLabel label(...);
-label.setFrameStyle(QFrame::Panel | QFrame::Raised);
-label.setLineWidth(2);
-
-QProgressBar pbar(...);
-label.setFrameStyle(QFrame::NoFrame);
-//! [0]
diff --git a/doc/src/snippets/code/src_gui_widgets_qgroupbox.cpp b/doc/src/snippets/code/src_gui_widgets_qgroupbox.cpp
deleted file mode 100644
index fc0339f690..0000000000
--- a/doc/src/snippets/code/src_gui_widgets_qgroupbox.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-g->setTitle("&User information");
-//! [0]
diff --git a/doc/src/snippets/code/src_gui_widgets_qlabel.cpp b/doc/src/snippets/code/src_gui_widgets_qlabel.cpp
deleted file mode 100644
index 83b02a2f22..0000000000
--- a/doc/src/snippets/code/src_gui_widgets_qlabel.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-QLabel *label = new QLabel(this);
-label->setFrameStyle(QFrame::Panel | QFrame::Sunken);
-label->setText("first line\nsecond line");
-label->setAlignment(Qt::AlignBottom | Qt::AlignRight);
-//! [0]
-
-
-//! [1]
-QLineEdit* phoneEdit = new QLineEdit(this);
-QLabel* phoneLabel = new QLabel("&Phone:", this);
-phoneLabel->setBuddy(phoneEdit);
-//! [1]
-
-
-//! [2]
-QLineEdit *nameEd = new QLineEdit(this);
-QLabel *nameLb = new QLabel("&Name:", this);
-nameLb->setBuddy(nameEd);
-QLineEdit *phoneEd = new QLineEdit(this);
-QLabel *phoneLb = new QLabel("&Phone:", this);
-phoneLb->setBuddy(phoneEd);
-// (layout setup not shown)
-//! [2]
diff --git a/doc/src/snippets/code/src_gui_widgets_qlineedit.cpp b/doc/src/snippets/code/src_gui_widgets_qlineedit.cpp
deleted file mode 100644
index 12ed38ad65..0000000000
--- a/doc/src/snippets/code/src_gui_widgets_qlineedit.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-void LineEdit::contextMenuEvent(QContextMenuEvent *event)
-{
- QMenu *menu = createStandardContextMenu();
- menu->addAction(tr("My Menu Item"));
- //...
- menu->exec(event->globalPos());
- delete menu;
-}
-//! [0]
diff --git a/doc/src/snippets/code/src_gui_widgets_qmainwindow.cpp b/doc/src/snippets/code/src_gui_widgets_qmainwindow.cpp
deleted file mode 100644
index 3558922ec9..0000000000
--- a/doc/src/snippets/code/src_gui_widgets_qmainwindow.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-void MyMainWindow::closeEvent(QCloseEvent *event)
-{
- QSettings settings("MyCompany", "MyApp");
- settings.setValue("geometry", saveGeometry());
- settings.setValue("windowState", saveState());
- QMainWindow::closeEvent(event);
-}
-//! [0]
-
-
-//! [1]
-void MainWindow::readSettings()
-{
- QSettings settings("MyCompany", "MyApp");
- restoreGeometry(settings.value("myWidget/geometry").toByteArray());
- restoreState(settings.value("myWidget/windowState").toByteArray());
-}
-//! [1]
diff --git a/doc/src/snippets/code/src_gui_widgets_qmenu.cpp b/doc/src/snippets/code/src_gui_widgets_qmenu.cpp
deleted file mode 100644
index 5799248bf4..0000000000
--- a/doc/src/snippets/code/src_gui_widgets_qmenu.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-exec(QCursor::pos());
-//! [0]
-
-
-//! [1]
-exec(somewidget.mapToGlobal(QPoint(0,0)));
-//! [1]
-
-
-//! [2]
-exec(e->globalPos());
-//! [2]
-
-
-//! [3]
-exec(QCursor::pos());
-//! [3]
-
-
-//! [4]
-exec(somewidget.mapToGlobal(QPoint(0, 0)));
-//! [4]
-
-
-//! [5]
-exec(e->globalPos());
-//! [5]
-
-
-//! [6]
-QMenu menu;
-QAction *at = actions[0]; // Assumes actions is not empty
-foreach (QAction *a, actions)
- menu.addAction(a);
-menu.exec(pos, at);
-//! [6]
diff --git a/doc/src/snippets/code/src_gui_widgets_qmenubar.cpp b/doc/src/snippets/code/src_gui_widgets_qmenubar.cpp
deleted file mode 100644
index 412bc2d5eb..0000000000
--- a/doc/src/snippets/code/src_gui_widgets_qmenubar.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-menubar->addMenu(fileMenu);
-//! [0]
-
-
-//! [1]
-QMenuBar *menuBar = new QMenuBar(0);
-//! [1]
diff --git a/doc/src/snippets/code/src_gui_widgets_qplaintextedit.cpp b/doc/src/snippets/code/src_gui_widgets_qplaintextedit.cpp
deleted file mode 100644
index 931c6c69a6..0000000000
--- a/doc/src/snippets/code/src_gui_widgets_qplaintextedit.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-void MyQPlainTextEdit::contextMenuEvent(QContextMenuEvent *event)
-{
- QMenu *menu = createStandardContextMenu();
- menu->addAction(tr("My Menu Item"));
- //...
- menu->exec(event->globalPos());
- delete menu;
-}
-//! [0]
-
-
-//! [1]
-edit->textCursor().insertText(text);
-//! [1]
diff --git a/doc/src/snippets/code/src_gui_widgets_qpushbutton.cpp b/doc/src/snippets/code/src_gui_widgets_qpushbutton.cpp
deleted file mode 100644
index e0ae945620..0000000000
--- a/doc/src/snippets/code/src_gui_widgets_qpushbutton.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-QPushButton *button = new QPushButton("&Download", this);
-//! [0]
diff --git a/doc/src/snippets/code/src_gui_widgets_qradiobutton.cpp b/doc/src/snippets/code/src_gui_widgets_qradiobutton.cpp
deleted file mode 100644
index a93809fa5d..0000000000
--- a/doc/src/snippets/code/src_gui_widgets_qradiobutton.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-QRadioButton *button = new QRadioButton("Search from the &cursor", this);
-//! [0]
diff --git a/doc/src/snippets/code/src_gui_widgets_qrubberband.cpp b/doc/src/snippets/code/src_gui_widgets_qrubberband.cpp
deleted file mode 100644
index b8d6a14d1c..0000000000
--- a/doc/src/snippets/code/src_gui_widgets_qrubberband.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-void Widget::mousePressEvent(QMouseEvent *event)
-{
- origin = event->pos();
- if (!rubberBand)
- rubberBand = new QRubberBand(QRubberBand::Rectangle, this);
- rubberBand->setGeometry(QRect(origin, QSize()));
- rubberBand->show();
-}
-
-void Widget::mouseMoveEvent(QMouseEvent *event)
-{
- rubberBand->setGeometry(QRect(origin, event->pos()).normalized());
-}
-
-void Widget::mouseReleaseEvent(QMouseEvent *event)
-{
- rubberBand->hide();
- // determine selection, for example using QRect::intersects()
- // and QRect::contains().
-}
-//! [0]
diff --git a/doc/src/snippets/code/src_gui_widgets_qscrollarea.cpp b/doc/src/snippets/code/src_gui_widgets_qscrollarea.cpp
deleted file mode 100644
index 9c90a0c53d..0000000000
--- a/doc/src/snippets/code/src_gui_widgets_qscrollarea.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-QLabel *imageLabel = new QLabel;
-QImage image("happyguy.png");
-imageLabel->setPixmap(QPixmap::fromImage(image));
-
-scrollArea = new QScrollArea;
-scrollArea->setBackgroundRole(QPalette::Dark);
-scrollArea->setWidget(imageLabel);
-//! [0]
diff --git a/doc/src/snippets/code/src_gui_widgets_qspinbox.cpp b/doc/src/snippets/code/src_gui_widgets_qspinbox.cpp
deleted file mode 100644
index fc1f5b7e47..0000000000
--- a/doc/src/snippets/code/src_gui_widgets_qspinbox.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-sb->setPrefix("$");
-//! [0]
-
-
-//! [1]
-sb->setSuffix(" km");
-//! [1]
-
-
-//! [2]
-setRange(minimum, maximum);
-//! [2]
-
-
-//! [3]
-setMinimum(minimum);
-setMaximum(maximum);
-//! [3]
-
-
-//! [4]
-spinbox->setPrefix("$");
-//! [4]
-
-
-//! [5]
-spinbox->setSuffix(" km");
-//! [5]
-
-
-//! [6]
-setRange(minimum, maximum);
-//! [6]
-
-
-//! [7]
-setMinimum(minimum);
-setMaximum(maximum);
-//! [7]
diff --git a/doc/src/snippets/code/src_gui_widgets_qsplashscreen.cpp b/doc/src/snippets/code/src_gui_widgets_qsplashscreen.cpp
deleted file mode 100644
index 48f1051e2c..0000000000
--- a/doc/src/snippets/code/src_gui_widgets_qsplashscreen.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-QPixmap pixmap(":/splash.png");
-QSplashScreen *splash = new QSplashScreen(pixmap);
-splash->show();
-
-... // Loading some items
-splash->showMessage("Loaded modules");
-
-qApp->processEvents();
-
-... // Establishing connections
-splash->showMessage("Established connections");
-
-qApp->processEvents();
-//! [0]
diff --git a/doc/src/snippets/code/src_gui_widgets_qsplitter.cpp b/doc/src/snippets/code/src_gui_widgets_qsplitter.cpp
deleted file mode 100644
index 18007a4cdf..0000000000
--- a/doc/src/snippets/code/src_gui_widgets_qsplitter.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-QWidget *widget = splitter->widget(index);
-QSizePolicy policy = widget->sizePolicy();
-policy.setHorizontalStretch(stretch);
-policy.setVerticalStretch(stretch);
-widget->setSizePolicy(policy);
-//! [0]
diff --git a/doc/src/snippets/code/src_gui_widgets_qstatusbar.cpp b/doc/src/snippets/code/src_gui_widgets_qstatusbar.cpp
deleted file mode 100644
index 6ea752b237..0000000000
--- a/doc/src/snippets/code/src_gui_widgets_qstatusbar.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-statusBar()->addWidget(new MyReadWriteIndication);
-//! [0]
diff --git a/doc/src/snippets/code/src_gui_widgets_qtextbrowser.cpp b/doc/src/snippets/code/src_gui_widgets_qtextbrowser.cpp
deleted file mode 100644
index ed30c2d80a..0000000000
--- a/doc/src/snippets/code/src_gui_widgets_qtextbrowser.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-backaction.setToolTip(browser.historyTitle(-1));
-forwardaction.setToolTip(browser.historyTitle(+1));
-//! [0]
diff --git a/doc/src/snippets/code/src_gui_widgets_qtextedit.cpp b/doc/src/snippets/code/src_gui_widgets_qtextedit.cpp
deleted file mode 100644
index cd1ae62c84..0000000000
--- a/doc/src/snippets/code/src_gui_widgets_qtextedit.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [0]
-void MyTextEdit::contextMenuEvent(QContextMenuEvent *event)
-{
- QMenu *menu = createStandardContextMenu();
- menu->addAction(tr("My Menu Item"));
- //...
- menu->exec(event->globalPos());
- delete menu;
-}
-//! [0]
-
-
-//! [1]
-edit->textCursor().insertText(text);
-//! [1]
-
-
-//! [2]
-edit->textCursor().insertHtml(fragment);
-//! [2]
diff --git a/doc/src/snippets/customstyle/customstyle.cpp b/doc/src/snippets/customstyle/customstyle.cpp
deleted file mode 100644
index 2e0843c49c..0000000000
--- a/doc/src/snippets/customstyle/customstyle.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-#include "customstyle.h"
-
-CustomStyle::CustomStyle()
-{
-//! [0]
- QSpinBox *spinBox = qobject_cast<QSpinBox *>(widget);
- if (spinBox) {
-//! [0] //! [1]
- }
-//! [1]
-}
-
-//! [2]
-void CustomStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option,
- QPainter *painter, const QWidget *widget) const
-{
- if (element == PE_IndicatorSpinUp || element == PE_IndicatorSpinDown) {
- QPolygon points(3);
- int x = option->rect.x();
- int y = option->rect.y();
- int w = option->rect.width() / 2;
- int h = option->rect.height() / 2;
- x += (option->rect.width() - w) / 2;
- y += (option->rect.height() - h) / 2;
-
- if (element == PE_IndicatorSpinUp) {
- points[0] = QPoint(x, y + h);
- points[1] = QPoint(x + w, y + h);
- points[2] = QPoint(x + w / 2, y);
- } else { // PE_SpinBoxDown
- points[0] = QPoint(x, y);
- points[1] = QPoint(x + w, y);
- points[2] = QPoint(x + w / 2, y + h);
- }
-
- if (option->state & State_Enabled) {
- painter->setPen(option->palette.mid().color());
- painter->setBrush(option->palette.buttonText());
- } else {
- painter->setPen(option->palette.buttonText().color());
- painter->setBrush(option->palette.mid());
- }
- painter->drawPolygon(points);
- } else {
- QWindowsStyle::drawPrimitive(element, option, painter, widget);
-//! [2] //! [3]
- }
-//! [3] //! [4]
-}
-//! [4]
diff --git a/doc/src/snippets/customstyle/customstyle.h b/doc/src/snippets/customstyle/customstyle.h
deleted file mode 100644
index 437994d2e2..0000000000
--- a/doc/src/snippets/customstyle/customstyle.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CUSTOMSTYLE_H
-#define CUSTOMSTYLE_H
-
-#include <QWindowsStyle>
-
-//! [0]
-class CustomStyle : public QWindowsStyle
-{
- Q_OBJECT
-
-public:
- CustomStyle()
- ~CustomStyle() {}
-
- void drawPrimitive(PrimitiveElement element, const QStyleOption *option,
- QPainter *painter, const QWidget *widget) const;
-};
-//! [0]
-
-#endif
diff --git a/doc/src/snippets/customviewstyle.cpp b/doc/src/snippets/customviewstyle.cpp
deleted file mode 100644
index 55a766d17d..0000000000
--- a/doc/src/snippets/customviewstyle.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-#include "customviewstyle.h"
-
-
-
-void CustomViewStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
-{
-
-//![0]
- switch (element) {
- case (PE_PanelItemViewItem): {
- painter->save();
-
- QPoint topLeft = option->rect.topLeft();
- QPoint bottomRight = option->rect.topRight();
- QLinearGradient backgroundGradient(topLeft, bottomRight);
- backgroundGradient.setColorAt(0.0, QColor(Qt::yellow).lighter(190));
- backgroundGradient.setColorAt(1.0, Qt::white);
- painter->fillRect(option->rect, QBrush(backgroundGradient));
-
- painter->restore();
- break;
- }
- default:
- QWindowsStyle::drawPrimitive(element, option, painter, widget);
- }
-//![0]
-}
diff --git a/doc/src/snippets/dialogs/dialogs.cpp b/doc/src/snippets/dialogs/dialogs.cpp
deleted file mode 100644
index 78916f862c..0000000000
--- a/doc/src/snippets/dialogs/dialogs.cpp
+++ /dev/null
@@ -1,268 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-typedef QDialog WordCountDialog;
-typedef QDialog FindDialog;
-
-#define this 0
-#define setWordCount(x) isVisible()
-
-QString tr(const char *text)
-{
- return QApplication::translate(text, text);
-}
-
-class EditorWindow : public QMainWindow
-{
-public:
- void find();
- void countWords();
-
-private:
- FindDialog *findDialog;
-};
-
-//! [0]
-void EditorWindow::find()
-{
- if (!findDialog) {
- findDialog = new FindDialog(this);
- connect(findDialog, SIGNAL(findNext()), this, SLOT(findNext()));
- }
-
- findDialog->show();
- findDialog->raise();
- findDialog->activateWindow();
-}
-//! [0]
-
-//! [1]
-void EditorWindow::countWords()
-{
- WordCountDialog dialog(this);
- dialog.setWordCount(document().wordCount());
- dialog.exec();
-}
-//! [1]
-
-inline bool boo()
-{
- QMessageBox::information(this, "Application name",
- "Unable to find the user preferences file.\n"
- "The factory default will be used instead.");
-
- QString filename;
- if (QFile::exists(filename) &&
- QMessageBox::question(
- this,
- tr("Overwrite File? -- Application Name"),
- tr("A file called %1 already exists."
- "Do you want to overwrite it?")
- .arg(filename),
- tr("&Yes"), tr("&No"),
- QString(), 0, 1))
- return false;
-
- switch(QMessageBox::warning(this, "Application name",
- "Could not connect to the <mumble> server.\n"
- "This program can't function correctly "
- "without the server.\n\n",
- "Retry",
- "Quit", 0, 0, 1)) {
- case 0: // The user clicked the Retry again button or pressed Enter
- // try again
- break;
- case 1: // The user clicked the Quit or pressed Escape
- // exit
- break;
- }
-
- switch(QMessageBox::information(this, "Application name here",
- "The document contains unsaved changes\n"
- "Do you want to save the changes before exiting?",
- "&Save", "&Discard", "Cancel",
- 0, // Enter == button 0
- 2)) { // Escape == button 2
- case 0: // Save clicked or Alt+S pressed or Enter pressed.
- // save
- break;
- case 1: // Discard clicked or Alt+D pressed
- // don't save but exit
- break;
- case 2: // Cancel clicked or Escape pressed
- // don't exit
- break;
- }
-
- switch(QMessageBox::warning(this, "Application name here",
- "Could not save the user preferences,\n"
- "because the disk is full. You can delete\n"
- "some files and press Retry, or you can\n"
- "abort the Save Preferences operation.",
- QMessageBox::Retry | QMessageBox::Default,
- QMessageBox::Abort | QMessageBox::Escape)) {
- case QMessageBox::Retry: // Retry clicked or Enter pressed
- // try again
- break;
- case QMessageBox::Abort: // Abort clicked or Escape pressed
- // abort
- break;
- }
-
- QString errorDetails;
- QMessageBox::critical(0, "Application name here",
- QString("An internal error occurred. Please ") +
- "call technical support at 1234-56789 and report\n"+
- "these numbers:\n\n" + errorDetails +
- "\n\nApplication will now exit.");
-
- QMessageBox::about(this, "About <Application>",
- "<Application> is a <one-paragraph blurb>\n\n"
- "Copyright 1991-2003 Such-and-such. "
- "<License words here.>\n\n"
- "For technical support, call 1234-56789 or see\n"
- "http://www.such-and-such.com/Application/\n");
-
- {
- // saving the file
- QMessageBox mb("Application name here",
- "Saving the file will overwrite the original file on the disk.\n"
- "Do you really want to save?",
- QMessageBox::Information,
- QMessageBox::Yes | QMessageBox::Default,
- QMessageBox::No,
- QMessageBox::Cancel | QMessageBox::Escape);
- mb.setButtonText(QMessageBox::Yes, "Save");
- mb.setButtonText(QMessageBox::No, "Discard");
- switch(mb.exec()) {
- case QMessageBox::Yes:
- // save and exit
- break;
- case QMessageBox::No:
- // exit without saving
- break;
- case QMessageBox::Cancel:
- // don't save and don't exit
- break;
- }
- }
-
- {
- // hardware failure
-//! [2]
- QMessageBox mb("Application Name",
- "Hardware failure.\n\nDisk error detected\nDo you want to stop?",
- QMessageBox::Question,
- QMessageBox::Yes | QMessageBox::Default,
- QMessageBox::No | QMessageBox::Escape,
- QMessageBox::NoButton);
- if (mb.exec() == QMessageBox::No) {
- // try again
-//! [2]
- }
- }
-}
-
-inline void moo()
-{
- int numFiles;
-//! [3]
- QProgressDialog progress("Copying files...", "Abort Copy", 0, numFiles, this);
- progress.setWindowModality(Qt::WindowModal);
-
- for (int i = 0; i < numFiles; i++) {
- progress.setValue(i);
-
- if (progress.wasCanceled())
- break;
- //... copy one file
- }
- progress.setValue(numFiles);
-//! [3]
-}
-
-class Operation : public QObject
-{
-public:
- Operation(QObject *parent);
- void perform();
- void cancel();
-
-private:
- int steps;
- QProgressDialog *pd;
- QTimer *t;
-};
-
-//! [4]
-// Operation constructor
-Operation::Operation(QObject *parent)
- : QObject(parent), steps(0)
-{
- pd = new QProgressDialog("Operation in progress.", "Cancel", 0, 100);
- connect(pd, SIGNAL(canceled()), this, SLOT(cancel()));
- t = new QTimer(this);
- connect(t, SIGNAL(timeout()), this, SLOT(perform()));
- t->start(0);
-}
-//! [4] //! [5]
-
-void Operation::perform()
-{
- pd->setValue(steps);
- //... perform one percent of the operation
- steps++;
- if (steps > pd->maximum())
- t->stop();
-}
-//! [5] //! [6]
-
-void Operation::cancel()
-{
- t->stop();
- //... cleanup
-}
-//! [6]
-
-int main()
-{
-}
diff --git a/doc/src/snippets/filedialogurls.cpp b/doc/src/snippets/filedialogurls.cpp
deleted file mode 100644
index b1e41cbcad..0000000000
--- a/doc/src/snippets/filedialogurls.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-int main(int argv, char **args)
-{
- QApplication app(argv, args);
-
-//![0]
- QList<QUrl> urls;
- urls << QUrl::fromLocalFile("/home/gvatteka/dev/qt-45")
- << QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::MusicLocation));
-
- QFileDialog dialog;
- dialog.setSidebarUrls(urls);
- dialog.setFileMode(QFileDialog::AnyFile);
- if(dialog.exec()) {
- // ...
- }
-//![0]
-
- return app.exec();
-}
diff --git a/doc/src/snippets/graphicssceneadditemsnippet.cpp b/doc/src/snippets/graphicssceneadditemsnippet.cpp
deleted file mode 100644
index 1130a59217..0000000000
--- a/doc/src/snippets/graphicssceneadditemsnippet.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-class CustomScene : public QGraphicsScene
-{
-public:
- CustomScene()
- { addItem(new QGraphicsEllipseItem(QRect(10, 10, 30, 30))); }
-
- void drawItems(QPainter *painter, int numItems, QGraphicsItem *items[],
- const QStyleOptionGraphicsItem options[],
- QWidget *widget = 0);
-};
-
-//! [0]
-void CustomScene::drawItems(QPainter *painter, int numItems,
- QGraphicsItem *items[],
- const QStyleOptionGraphicsItem options[],
- QWidget *widget)
-{
- for (int i = 0; i < numItems; ++i) {
- // Draw the item
- painter->save();
- painter->setMatrix(items[i]->sceneMatrix(), true);
- items[i]->paint(painter, &options[i], widget);
- painter->restore();
- }
-}
-//! [0]
-
-int main(int argv, char **args)
-{
- QApplication app(argv, args);
-
- CustomScene scene;
- QGraphicsView view(&scene);
-
- view.show();
-
- return app.exec();
-}
diff --git a/doc/src/snippets/javastyle.cpp b/doc/src/snippets/javastyle.cpp
deleted file mode 100644
index a00df57e82..0000000000
--- a/doc/src/snippets/javastyle.cpp
+++ /dev/null
@@ -1,2745 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-#include "javastyle.h"
-#include <math.h>
-
-static const int windowsItemFrame = 2;
-static const int windowsSepHeight = 2;
-static const int windowsItemHMargin = 3;
-static const int windowsItemVMargin = 2;
-static const int windowsArrowHMargin = 6;
-static const int windowsTabSpacing = 12;
-static const int windowsCheckMarkHMargin = 2;
-static const int windowsRightBorder = 15;
-static const int windowsCheckMarkWidth = 12;
-
-JavaStyle::JavaStyle()
-{
- qApp->setPalette(standardPalette());
-}
-
-
-inline QPoint JavaStyle::adjustScrollPoint(const QPoint &point,
- Qt::Orientation orientation,
- bool add) const
-{
- int adder = add ? -1 : 1;
- QPoint retPoint;
-
- if (orientation == Qt::Horizontal) {
- retPoint = QPoint(point.y() * adder, point.x());
- } else {
- retPoint = QPoint(point.x(), point.y() * adder);
- }
-
- return retPoint;
-}
-
-QPalette JavaStyle::standardPalette() const
-{
- QPalette palette = QWindowsStyle::standardPalette();
-
- palette.setBrush(QPalette::Active, QPalette::Button,
- QColor(184, 207, 229));
- palette.setBrush(QPalette::Active, QPalette::WindowText,
- Qt::black);
- palette.setBrush(QPalette::Active, QPalette::Background,
- QColor(238, 238, 238));
- palette.setBrush(QPalette::Active, QPalette::Window,
- QColor(238 ,238, 238));
- palette.setBrush(QPalette::Active, QPalette::Base, Qt::white);
- palette.setBrush(QPalette::Active, QPalette::AlternateBase, QColor(238, 238, 238));
- palette.setBrush(QPalette::Active, QPalette::Text, Qt::black);
- palette.setBrush(QPalette::Active, QPalette::BrightText, Qt::white);
-
- palette.setBrush(QPalette::Active, QPalette::Light, QColor(163, 184, 204)); // focusFrameColor
- palette.setBrush(QPalette::Active, QPalette::Midlight, QColor(99, 130, 191)); // tabBarBorderColor
- palette.setBrush(QPalette::Active, QPalette::Dark, QColor(106, 104, 100));
- palette.setBrush(QPalette::Active, QPalette::Mid, QColor(122, 138, 153)); //defaultFrameColor
- palette.setBrush(QPalette::Active, QPalette::Shadow, QColor(122, 138, 153)); // defaultFrame
-
- palette.setBrush(QPalette::Active, QPalette::Highlight, QColor(184, 207, 229));
- palette.setBrush(QPalette::Active, QPalette::HighlightedText, Qt::black);
-
- palette.setBrush(QPalette::Inactive, QPalette::Highlight, QColor(184, 207, 229));
- palette.setBrush(QPalette::Inactive, QPalette::HighlightedText, Qt::black);
-
- palette.setBrush(QPalette::Disabled, QPalette::Button,
- QColor(238, 238, 238));
- palette.setBrush(QPalette::Disabled, QPalette::WindowText,
- QColor(153, 153, 153));
- palette.setBrush(QPalette::Disabled, QPalette::Background, QColor(238, 238, 238));
-
- palette.setBrush(QPalette::Inactive, QPalette::Button,
- QColor(184, 207, 229));
- palette.setBrush(QPalette::Inactive, QPalette::Background,
- QColor(238, 238, 238));
- palette.setBrush(QPalette::Inactive, QPalette::Window,
- QColor(238 ,238, 238));
- palette.setBrush(QPalette::Inactive, QPalette::Light, QColor(163, 184, 204)); // focusFrameColor
- palette.setBrush(QPalette::Inactive, QPalette::Midlight, QColor(99, 130, 191)); // tabBarBorderColor
- palette.setBrush(QPalette::Inactive, QPalette::Dark,QColor(106, 104, 100));
- palette.setBrush(QPalette::Inactive, QPalette::Mid, QColor(122, 138, 153)); //defaultFrame
- palette.setBrush(QPalette::Inactive, QPalette::Shadow, QColor(122, 138, 153)); // defaultFrame
-
- return palette;
-}
-
-inline void JavaStyle::drawScrollBarArrow(const QRect &rect, QPainter *painter,
- const QStyleOptionSlider *option,
- bool add) const
-{
-
- painter->save();
-
- Qt::Orientation orient = option->orientation;
- QPoint offset;
-
- if (add) {
- if (orient == Qt::Vertical) {
- offset = rect.bottomLeft();
- } else {
- offset = rect.topRight();
- }
- } else {
- offset = rect.topLeft();
- }
-
- QPainterPath arrow;
- arrow.moveTo(offset + adjustScrollPoint(QPoint(4, 8), orient, add));
- arrow.lineTo(offset + adjustScrollPoint(QPoint(7, 5), orient, add));
- arrow.lineTo(offset + adjustScrollPoint(QPoint(8, 5), orient, add));
- arrow.lineTo(offset + adjustScrollPoint(QPoint(11, 8), orient, add));
- arrow.lineTo(offset + adjustScrollPoint(QPoint(4, 8), orient, add));
-
- QColor fillColor;
- if (option->state & State_Sunken)
- fillColor = QColor(option->palette.color(QPalette::Button));
- else
- fillColor = option->palette.color(QPalette::Background);
-
- painter->fillRect(rect, fillColor);
-
- painter->setPen(option->palette.color(QPalette::Base));
- int adjust = option->state & State_Sunken ? 0 : 1;
- painter->drawRect(rect.adjusted(adjust, adjust, -1, -1));
- painter->setPen(option->palette.color(QPalette::Mid));
- painter->drawRect(rect.adjusted(0, 0, -1, -1));
-
- painter->setPen(option->palette.color(QPalette::WindowText));
- painter->setBrush(option->palette.color(QPalette::WindowText));
- painter->drawPath(arrow);
-
- painter->restore();
-}
-
-inline QPoint JavaStyle::adjustScrollHandlePoint(Qt::Orientation orig,
- const QPoint &point) const
-{
- QPoint retPoint;
-
- if (orig == Qt::Vertical)
- retPoint = point;
- else
- retPoint = QPoint(point.y(), point.x());
-
- return retPoint;
-}
-
-void JavaStyle::drawControl(ControlElement control, const QStyleOption *option,
- QPainter *painter, const QWidget *widget) const
-{
-
- painter->save();
-
- switch (control) {
- case CE_ToolBoxTabShape: {
- const QStyleOptionToolBox *box =
- qstyleoption_cast<const QStyleOptionToolBox *>(option);
-
- painter->save();
-
- if (box->direction == Qt::RightToLeft) {
- painter->rotate(1);
- painter->translate(box->rect.width(), -box->rect.height());
- }
-
- int textWidth = box->fontMetrics.width(box->text) + 20;
-
- QPolygon innerLine;
- innerLine << (box->rect.topLeft() + QPoint(0, 1)) <<
- (box->rect.topLeft() + QPoint(textWidth, 1)) <<
- (box->rect.bottomLeft() + QPoint(textWidth + 15, -3)) <<
- (box->rect.bottomRight() + QPoint(0, -3)) <<
- box->rect.bottomRight() <<
- box->rect.bottomLeft() <<
- box->rect.topLeft();
-
- painter->setPen(box->palette.color(QPalette::Base));
- painter->setBrush(QColor(200, 221, 242));
- painter->drawPolygon(innerLine);
-
- QPolygon outerLine;
- outerLine << (box->rect.bottomRight() + QPoint(0, -3)) <<
- box->rect.bottomRight() <<
- box->rect.bottomLeft() <<
- box->rect.topLeft() <<
- (box->rect.topLeft() + QPoint(textWidth, 0)) <<
- (box->rect.bottomLeft() + QPoint(textWidth + 15, -4)) <<
- (box->rect.bottomRight() + QPoint(0, -4));
-
- painter->setPen(box->palette.color(QPalette::Midlight));
- painter->setBrush(Qt::NoBrush);
- painter->drawPolyline(outerLine);
-
- painter->restore();
- break;
- }
- case CE_DockWidgetTitle: {
- const QStyleOptionDockWidgetV2 *docker =
- new QStyleOptionDockWidgetV2(
- *qstyleoption_cast<const QStyleOptionDockWidget *>(option));
-
- QRect rect = docker->rect;
- QRect titleRect = rect;
- if (docker->verticalTitleBar) {
- QRect r = rect;
- QSize s = r.size();
- s.transpose();
- r.setSize(s);
-
- titleRect = QRect(r.left() + rect.bottom()
- - titleRect.bottom(),
- r.top() + titleRect.left() - rect.left(),
- titleRect.height(), titleRect.width());
-
- painter->translate(r.left(), r.top() + r.width());
- painter->rotate(-90);
- painter->translate(-r.left(), -r.top());
-
- rect = r;
- }
-
- QLinearGradient gradient(rect.topLeft(),
- rect.bottomLeft());
- gradient.setColorAt(1.0, QColor(191, 212, 231));
- gradient.setColorAt(0.3, Qt::white);
- gradient.setColorAt(0.0, QColor(221, 232, 243));
-
- painter->setPen(Qt::NoPen);
- painter->setBrush(gradient);
- painter->drawRect(rect.adjusted(0, 0, -1, -1));
-
- if (!docker->title.isEmpty()) {
- QRect textRect = docker->fontMetrics.boundingRect(docker->title);
- textRect.moveCenter(rect.center());
-
- QFont font = painter->font();
- font.setPointSize(font.pointSize() - 1);
- painter->setFont(font);
- painter->setPen(docker->palette.text().color());
- painter->drawText(textRect, docker->title,
- QTextOption(Qt::AlignHCenter |
- Qt::AlignVCenter));
- }
- break;
- }
- case CE_RubberBand: {
- painter->setPen(option->palette.color(QPalette::Active,
- QPalette::WindowText));
- painter->drawRect(option->rect.adjusted(0, 0, -1, -1));
- break;
- }
- case CE_SizeGrip: {
- break;
- }
- case CE_HeaderSection: {
- const QStyleOptionHeader *header =
- qstyleoption_cast<const QStyleOptionHeader *>(option);
-
- painter->setPen(Qt::NoPen);
- painter->setBrush(option->palette.color(QPalette::Active,
- QPalette::Background));
- painter->drawRect(option->rect);
-
- painter->setPen(header->palette.color(QPalette::Mid));
- if (header->orientation == Qt::Horizontal) {
- if (header->position == QStyleOptionHeader::Beginning ||
- header->position == QStyleOptionHeader::OnlyOneSection) {
- painter->drawRect(header->rect.adjusted(0, 0, -1, -1));
- painter->setPen(header->palette.color(QPalette::Base));
- painter->drawLine(header->rect.bottomLeft() + QPoint(1, -1),
- header->rect.topLeft() + QPoint(1, 1));
- painter->drawLine(header->rect.topLeft() + QPoint(1, 1),
- header->rect.topRight() + QPoint(-1, 1));
- } else {
- painter->drawLine(header->rect.bottomRight(),
- header->rect.topRight());
- painter->drawLine(header->rect.topLeft(),
- header->rect.topRight());
- painter->drawLine(header->rect.bottomLeft(),
- header->rect.bottomRight());
- painter->setPen(option->palette.color(QPalette::Base));
- painter->drawLine(header->rect.bottomLeft() + QPoint(0, -1),
- header->rect.topLeft() + QPoint(0, 1));
- painter->drawLine(header->rect.topLeft() + QPoint(1, 1),
- header->rect.topRight() + QPoint(-1, 1));
- }
- } else { // Vertical
- if (header->position == QStyleOptionHeader::Beginning ||
- header->position == QStyleOptionHeader::OnlyOneSection) {
- painter->drawRect(header->rect.adjusted(0, 0, -1, -1));
- painter->setPen(header->palette.color(QPalette::Base));
- painter->drawLine(header->rect.bottomLeft() + QPoint(1, -1),
- header->rect.topLeft() + QPoint(1, 1));
- painter->drawLine(header->rect.topLeft() + QPoint(1, 1),
- header->rect.topRight() + QPoint(-1, 1));
- } else {
- painter->drawLine(header->rect.bottomLeft(),
- header->rect.bottomRight());
- painter->drawLine(header->rect.topLeft(),
- header->rect.bottomLeft());
- painter->drawLine(header->rect.topRight(),
- header->rect.bottomRight());
- painter->setPen(header->palette.color(QPalette::Base));
- painter->drawLine(header->rect.topLeft(),
- header->rect.topRight() + QPoint(-1, 0));
- painter->drawLine(header->rect.bottomLeft() + QPoint(1, -1),
- header->rect.topLeft() + QPoint(1, 0));
- }
- }
- break;
- }
- case CE_ToolBar: {
- QRect rect = option->rect;
-
- QLinearGradient gradient(rect.topLeft(), rect.bottomLeft());
- gradient.setColorAt(1.0, QColor(221, 221, 221));
- gradient.setColorAt(0.0, QColor(241, 241, 241));
-
- if (option->state & State_Horizontal) {
- painter->setPen(QColor(204, 204, 204));
- painter->setBrush(gradient);
- } else {
- painter->setPen(Qt::NoPen);
- painter->setBrush(option->palette.color(QPalette::Background));
- }
- painter->drawRect(rect.adjusted(0, 0, -1, -1));
- break;
- }
- case CE_ProgressBar: {
- const QStyleOptionProgressBar *bar1 =
- qstyleoption_cast<const QStyleOptionProgressBar *>(option);
-
- QStyleOptionProgressBarV2 *bar = new QStyleOptionProgressBarV2(*bar1);
-
- QRect rect = bar->rect;
- if (bar->orientation == Qt::Vertical) {
- rect = QRect(rect.left(), rect.top(), rect.height(), rect.width());
- QMatrix m;
- m.translate(rect.height()-1, 0);
- m.rotate(90.0);
- painter->setMatrix(m);
- }
-
- painter->setPen(bar->palette.color(QPalette::Mid));
- painter->drawRect(rect.adjusted(0, 0, -1, -1));
-
- QRect grooveRect = subElementRect(SE_ProgressBarGroove, bar,
- widget);
- if (bar->orientation == Qt::Vertical) {
- grooveRect = QRect(grooveRect.left(), grooveRect.top(),
- grooveRect.height(), grooveRect.width());
- }
-
- QStyleOptionProgressBar grooveBar = *bar;
- grooveBar.rect = grooveRect;
-
- drawControl(CE_ProgressBarGroove, &grooveBar, painter, widget);
-
- QRect progressRect = subElementRect(SE_ProgressBarContents, bar,
- widget);
- if (bar->orientation == Qt::Vertical) {
- progressRect = QRect(progressRect.left(), progressRect.top(),
- progressRect.height(), progressRect.width());
- progressRect.adjust(0, 0, 0, -1);
- }
- QStyleOptionProgressBar progressOpt = *bar;
- progressOpt.rect = progressRect;
- drawControl(CE_ProgressBarContents, &progressOpt, painter, widget);
-
- QRect labelRect = subElementRect(SE_ProgressBarLabel, bar, widget);
- if (bar->orientation == Qt::Vertical) {
- labelRect = QRect(labelRect.left(), labelRect.top(),
- labelRect.height(), labelRect.width());
- }
- QStyleOptionProgressBar subBar = *bar;
- subBar.rect = labelRect;
- if (bar->textVisible)
- drawControl(CE_ProgressBarLabel, &subBar, painter, widget);
-
- delete bar;
- break;
- }
- case CE_ProgressBarGroove: {
- painter->setBrush(option->palette.color(QPalette::Background));
- painter->setPen(Qt::NoPen);
- painter->drawRect(option->rect.adjusted(0, 0, -1, -1));
-
- painter->setPen(option->palette.color(QPalette::Button));
- painter->drawLine(option->rect.topLeft() + QPoint(0, 0),
- option->rect.topRight() + QPoint(0, 0));
- break;
- }
- case CE_ProgressBarContents: {
- const QStyleOptionProgressBar *bar =
- qstyleoption_cast<const QStyleOptionProgressBar *>(option);
- int progress = int((double(bar->progress) /
- double(bar->maximum - bar->minimum)) *
- bar->rect.width());
-
- painter->setBrush(bar->palette.color(QPalette::Light));
- painter->setPen(Qt::NoPen);
- QRect progressRect = QRect(bar->rect.topLeft(), QPoint(progress,
- bar->rect.bottom()));
- painter->drawRect(progressRect);
-
- painter->setPen(bar->palette.color(QPalette::Midlight));
- painter->setBrush(Qt::NoBrush);
-
- painter->drawLine(bar->rect.bottomLeft(), bar->rect.topLeft());
- painter->drawLine(bar->rect.topLeft(), QPoint(progress,
- bar->rect.top()));
- break;
- }
- case CE_ProgressBarLabel: {
- painter->save();
- const QStyleOptionProgressBar *bar =
- qstyleoption_cast<const QStyleOptionProgressBar *>(option);
-
- QRect rect = bar->rect;
- QRect leftRect;
-
- int progressIndicatorPos = int((double(bar->progress) /
- double(bar->maximum - bar->minimum)) *
- bar->rect.width());
-
- QFont font;
- font.setBold(true);
- painter->setFont(font);
- painter->setPen(bar->palette.color(QPalette::Midlight));
-
- if (progressIndicatorPos >= 0 &&
- progressIndicatorPos <= rect.width()) {
- leftRect = QRect(bar->rect.topLeft(),
- QPoint(progressIndicatorPos,
- bar->rect.bottom()));
- } else if (progressIndicatorPos > rect.width()) {
- painter->setPen(bar->palette.color(QPalette::Base));
- } else {
- painter->setPen(bar->palette.color(QPalette::Midlight));
- }
-
- QRect textRect = QFontMetrics(font).boundingRect(bar->text);
- textRect.moveCenter(option->rect.center());
- painter->drawText(textRect, bar->text,
- QTextOption(Qt::AlignCenter));
- if (!leftRect.isNull()) {
- painter->setPen(bar->palette.color(QPalette::Base));
- painter->setClipRect(leftRect, Qt::IntersectClip);
- painter->drawText(textRect, bar->text,
- QTextOption(Qt::AlignCenter));
- }
-
- painter->restore();
- break;
- }
- case CE_MenuBarEmptyArea: {
- QRect emptyArea = option->rect.adjusted(0, 0, -1, -1);
- QLinearGradient gradient(emptyArea.topLeft(), emptyArea.bottomLeft()
- - QPoint(0, 1));
- gradient.setColorAt(0.0, option->palette.color(QPalette::Base));
- gradient.setColorAt(1.0, QColor(223, 223, 223));
-
- painter->setPen(QColor(238, 238, 238));
- painter->setBrush(gradient);
- painter->drawRect(emptyArea.adjusted(0, 0, 0, -1));
- break;
- }
- case CE_MenuBarItem: {
- if (!(option->state & State_Sunken)) {
- QLinearGradient gradient(option->rect.topLeft(),
- option->rect.bottomLeft());
- gradient.setColorAt(0.0, Qt::white);
- gradient.setColorAt(1.0, QColor(223, 223, 223));
-
- painter->setPen(Qt::NoPen);
- painter->setBrush(gradient);
- } else {
- painter->setBrush(option->palette.color(QPalette::Light));
- }
-
- painter->drawRect(option->rect);
- if (option->state & State_Sunken) {
- painter->setPen(option->palette.color(QPalette::Mid));
- painter->drawRect(option->rect.adjusted(0, 0, -1, -1));
- painter->setPen(option->palette.color(QPalette::Base));
- painter->setBrush(Qt::NoBrush);
- painter->drawLine(option->rect.bottomRight() + QPoint(0, -1),
- option->rect.topRight() + QPoint(0, -1));
- }
- QCommonStyle::drawControl(control, option, painter, widget);
- break;
- }
- case CE_MenuItem: {
- const QStyleOptionMenuItem *menuItem =
- qstyleoption_cast<const QStyleOptionMenuItem *>(option);
-
- bool selected = menuItem->state & State_Selected;
- bool checkable = menuItem->checkType !=
- QStyleOptionMenuItem::NotCheckable;
- bool checked = menuItem->checked;
-
- if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) {
- QPoint center = menuItem->rect.center();
-
- painter->setPen(menuItem->palette.color(QPalette::Midlight));
- painter->drawLine(QPoint(menuItem->rect.left() - 2, center.y()),
- QPoint(menuItem->rect.right(), center.y()));
- painter->setPen(menuItem->palette.color(QPalette::Base));
- painter->drawLine(QPoint(menuItem->rect.left() - 2,
- center.y() + 1),
- QPoint(menuItem->rect.right(),
- center.y() + 1));
-
- break;
- }
-
- if (selected) {
- painter->setBrush(menuItem->palette.color(QPalette::Light));
- painter->setPen(Qt::NoPen);
- painter->drawRect(menuItem->rect);
- painter->setPen(menuItem->palette.color(QPalette::Midlight));
- painter->drawLine(menuItem->rect.topLeft(),
- menuItem->rect.topRight());
- painter->setPen(menuItem->palette.color(QPalette::Base));
- painter->drawLine(menuItem->rect.bottomLeft(),
- menuItem->rect.bottomRight());
- }
-
- if (checkable) {
- QRect checkRect(option->rect.left() + 5,
- option->rect.center().y() - 5, 10, 10);
- if (menuItem->checkType & QStyleOptionMenuItem::Exclusive) {
- QStyleOptionButton button;
- button.rect = checkRect;
- button.state = menuItem->state;
- if (button.state & State_Sunken)
- button.state ^= State_Sunken;
- if (checked)
- button.state |= State_On;
- button.palette = menuItem->palette;
- drawPrimitive(PE_IndicatorRadioButton, &button, painter,
- widget);
- } else {
- QBrush buttonBrush = gradientBrush(option->rect);
- painter->setBrush(buttonBrush);
- painter->setPen(option->palette.color(QPalette::Mid));
-
- painter->drawRect(checkRect);
-
- if (checked) {
- QImage image(":/images/checkboxchecked.png");
- painter->drawImage(QPoint(option->rect.left() + 5,
- option->rect.center().y() - 8), image);
- }
- }
- }
-
- bool dis = !(menuItem->state & State_Enabled);
- bool act = menuItem->state & State_Selected;
- const QStyleOption *opt = option;
- const QStyleOptionMenuItem *menuitem = menuItem;
- int checkcol = qMax(menuitem->maxIconWidth, 20);
- if (menuItem->icon.isNull())
- checkcol = 0;
-
- QPainter *p = painter;
- QRect vCheckRect = visualRect(opt->direction, menuitem->rect,
- QRect(menuitem->rect.x(),
- menuitem->rect.y(),
- checkcol, menuitem->rect.height()));
- if (!menuItem->icon.isNull()) {
- QIcon::Mode mode = dis ? QIcon::Disabled : QIcon::Normal;
- if (act && !dis)
- mode = QIcon::Active;
- QPixmap pixmap;
- if (checked)
- pixmap = menuItem->icon.pixmap(
- pixelMetric(PM_SmallIconSize), mode, QIcon::On);
- else
- pixmap = menuItem->icon.pixmap(
- pixelMetric(PM_SmallIconSize), mode);
- int pixw = pixmap.width();
- int pixh = pixmap.height();
-
- int adjustedIcon = checkable ? 15 : 0;
- QRect pmr(0, 0, pixw, pixh);
- pmr.moveCenter(vCheckRect.center());
- painter->setPen(menuItem->palette.text().color());
- if (checkable && checked)
- painter->drawPixmap(QPoint(pmr.left() +
- adjustedIcon, pmr.top() + 1), pixmap);
- else
- painter->drawPixmap(pmr.topLeft() +
- QPoint(adjustedIcon, 0), pixmap);
- }
-
- if (selected) {
- painter->setPen(menuItem->palette.highlightedText().color());
- } else {
- painter->setPen(menuItem->palette.text().color());
- }
- int x, y, w, h;
- menuitem->rect.getRect(&x, &y, &w, &h);
- int tab = menuitem->tabWidth;
- QColor discol;
- if (dis) {
- discol = menuitem->palette.text().color();
- p->setPen(discol);
- }
- int xm = windowsItemFrame + checkcol + windowsItemHMargin;
- int xpos = menuitem->rect.x() + xm;
- QRect textRect;
- if (!menuItem->icon.isNull())
- textRect.setRect(xpos, y + windowsItemVMargin, w - xm -
- windowsRightBorder - tab + 1, h - 2 * windowsItemVMargin);
- else
- textRect.setRect(menuItem->rect.left() + 9,
- y + windowsItemVMargin,
- w - xm - windowsRightBorder - tab,
- h - 2 * windowsItemVMargin);
-
- if (checkable)
- textRect.adjust(10, 0, 10, 0);
-
- QRect vTextRect = visualRect(opt->direction, menuitem->rect,
- textRect);
- QString s = menuitem->text;
- if (!s.isEmpty()) {
- int t = s.indexOf(QLatin1Char('\t'));
- int text_flags = Qt::AlignVCenter | Qt::TextShowMnemonic |
- Qt::TextDontClip | Qt::TextSingleLine;
- if (!styleHint(SH_UnderlineShortcut, menuitem, widget))
- text_flags |= Qt::TextHideMnemonic;
- text_flags |= Qt::AlignLeft;
- if (t >= 0) {
- QRect vShortcutRect = visualRect(opt->direction,
- menuitem->rect,
- QRect(textRect.topRight(),
- QPoint(menuitem->rect.right(), textRect.bottom())));
- if (dis && !act) {
- p->setPen(menuitem->palette.light().color());
- p->drawText(vShortcutRect.adjusted(1, 1, 1, 1),
- text_flags,
- s.mid(t + 1));
- p->setPen(discol);
- }
- p->drawText(vShortcutRect, text_flags, s.mid(t + 1));
- s = s.left(t);
- }
- QFont font = menuitem->font;
- if (menuitem->menuItemType == QStyleOptionMenuItem::DefaultItem)
- font.setBold(true);
- p->setFont(font);
- if (dis && !act) {
- p->setPen(menuitem->palette.light().color());
- p->drawText(vTextRect.adjusted(1,1,1,1), text_flags,
- s.left(t));
- p->setPen(discol);
- }
- p->drawText(vTextRect, text_flags, s.left(t));
- }
-
- if (menuItem->menuItemType & QStyleOptionMenuItem::SubMenu) {
- QPoint center = menuItem->rect.center();
- QPoint drawStart(menuItem->rect.right() - 6, center.y() + 4);
-
- QPainterPath arrow;
- arrow.moveTo(drawStart);
- arrow.lineTo(drawStart + QPoint(0, -8));
- arrow.lineTo(drawStart + QPoint(4, -5));
- arrow.lineTo(drawStart + QPoint(4, -4));
- arrow.lineTo(drawStart + QPoint(0, 0));
-
- painter->save();
- painter->setBrush(menuItem->palette.color(QPalette::Text));
- painter->setPen(Qt::NoPen);
- painter->drawPath(arrow);
- painter->restore();
- }
-
- break;
- }
- case CE_MenuVMargin: {
- break;
- }
- case CE_MenuHMargin: {
- break;
- }
- case CE_Splitter: {
- drawSplitter(option, painter, option->state & State_Horizontal);
- break;
- }
- case CE_ScrollBarAddPage: {
- case CE_ScrollBarSubPage:
- const QStyleOptionSlider *scrollBar =
- qstyleoption_cast<const QStyleOptionSlider *>(option);
- QRect myRect;
- if (scrollBar->orientation == Qt::Horizontal) {
- myRect = QRect(option->rect.topLeft(),
- option->rect.bottomRight()).adjusted(0, 0, 1, -1);
- } else {
- myRect = option->rect;
- }
-
- painter->setPen(Qt::NoPen);
- painter->setBrush(option->palette.color(QPalette::Background));
- painter->drawRect(myRect);
-
- painter->setBrush(Qt::NoBrush);
- painter->setPen(scrollBar->palette.color(QPalette::Mid));
- painter->drawRect(myRect.adjusted(0, 0, -1, 0));
- painter->setPen(scrollBar->palette.color(QPalette::Button));
- painter->drawLine(myRect.bottomLeft() + QPoint(1, 0),
- myRect.topLeft() + QPoint(1, 1));
- painter->drawLine(myRect.topLeft() + QPoint(1, 1),
- myRect.topRight() + QPoint(-1, 1));
- break;
- }
- case CE_ScrollBarSubLine: {
- const QStyleOptionSlider *scrollBar =
- qstyleoption_cast<const QStyleOptionSlider *>(option);
- int scrollBarExtent = pixelMetric(PM_ScrollBarExtent);
- QRect scrollBarSubLine = option->rect;
-
- QRect button1;
- QRect button2;
-
- if (scrollBar->orientation == Qt::Horizontal) {
- button1.setRect(scrollBarSubLine.left(), scrollBarSubLine.top(),
- 16, scrollBarExtent);
- button2.setRect(scrollBarSubLine.right() - 15,
- scrollBarSubLine.top(), 16, scrollBarExtent);
- } else {
- button1.setRect(scrollBarSubLine.left(), scrollBarSubLine.top(),
- scrollBarExtent, 16);
- button2.setRect(scrollBarSubLine.left(),
- scrollBarSubLine.bottom() - 15, scrollBarExtent, 16);
- }
-
- painter->fillRect(button2, Qt::blue);
-
- drawScrollBarArrow(button1, painter, scrollBar);
- drawScrollBarArrow(button2, painter, scrollBar);
- break;
- }
- case CE_ScrollBarAddLine: {
- const QStyleOptionSlider *scrollBar =
- qstyleoption_cast<const QStyleOptionSlider *>(option);
- QRect button(option->rect.left(), option->rect.top(), 16, 16);
- drawScrollBarArrow(button, painter, scrollBar, true);
- break;
- }
- case CE_ScrollBarSlider: {
- const QStyleOptionSlider *scrollBar =
- qstyleoption_cast<const QStyleOptionSlider *>(option);
-
- painter->setPen(scrollBar->palette.color(QPalette::Midlight));
- painter->drawRect(scrollBar->rect.adjusted(-1, 0, -3, -1));
-
- QPoint g1, g2;
- if (scrollBar->orientation == Qt::Horizontal) {
- g1 = option->rect.topLeft();
- g2 = option->rect.bottomLeft();
- } else {
- g1 = option->rect.topLeft();
- g2 = option->rect.topRight();
- }
-
- if (scrollBar->state & State_Enabled) {
- QLinearGradient gradient(g1, g2);
- gradient.setColorAt(1.0, QColor(188, 210, 230));
- gradient.setColorAt(0.3, Qt::white);
- gradient.setColorAt(0.0, QColor(223, 233, 243));
- painter->setBrush(gradient);
- } else {
- painter->setPen(scrollBar->palette.buttonText().color());
- painter->setBrush(scrollBar->palette.button());
- }
- painter->drawRect(scrollBar->rect.adjusted(0, 0, -1, -1));
-
- int sliderLength = option->rect.height();
- int drawPos = scrollBar->orientation == Qt::Vertical ?
- (sliderLength / 2) + 1 : 1 - ((option->rect.width() / 2));
-
- QPoint origin;
- if (scrollBar->orientation == Qt::Vertical)
- origin = option->rect.bottomLeft();
- else
- origin = option->rect.topLeft();
-
- painter->setPen(scrollBar->palette.color(QPalette::Base));
- painter->drawLine(origin + adjustScrollHandlePoint(
- scrollBar->orientation,
- QPoint(4, -drawPos)),
- origin + adjustScrollHandlePoint(
- scrollBar->orientation,
- QPoint(13, -drawPos)));
- painter->drawLine(origin + adjustScrollHandlePoint(
- scrollBar->orientation,
- QPoint(4, 2 - drawPos)),
- origin + adjustScrollHandlePoint(
- scrollBar->orientation,
- QPoint(13, 2 - drawPos)));
- painter->drawLine(origin + adjustScrollHandlePoint(
- scrollBar->orientation,
- QPoint(4, 4 - drawPos)),
- origin + adjustScrollHandlePoint(
- scrollBar->orientation,
- QPoint(13, 4 - drawPos)));
-
- painter->setPen(option->palette.color(QPalette::Midlight));
- painter->drawLine(origin + adjustScrollHandlePoint(
- scrollBar->orientation,
- QPoint(3, -(drawPos + 1))),
- origin + adjustScrollHandlePoint(
- scrollBar->orientation,
- QPoint(12, -(drawPos + 1))));
- painter->drawLine(origin + adjustScrollHandlePoint(
- scrollBar->orientation,
- QPoint(3, 1 - drawPos)),
- origin + adjustScrollHandlePoint(
- scrollBar->orientation,
- QPoint(12, 1 - drawPos)));
- painter->drawLine(origin + adjustScrollHandlePoint(
- scrollBar->orientation,
- QPoint(3, 3 - drawPos)),
- origin + adjustScrollHandlePoint(
- scrollBar->orientation,
- QPoint(12, 3 - drawPos)));
-
- break;
- }
- case CE_TabBarTabLabel: {
- QStyleOptionTab copy =
- *qstyleoption_cast<const QStyleOptionTab *>(option);
- if (copy.state & State_HasFocus)
- copy.state ^= State_HasFocus;
- painter->setBrush(Qt::NoBrush);
- QWindowsStyle::drawControl(CE_TabBarTabLabel, &copy, painter,
- widget);
- break;
- }
- case CE_TabBarTabShape: {
- const QStyleOptionTab *tab =
- qstyleoption_cast<const QStyleOptionTab *>(option);
- QRect myRect = option->rect;
- QPoint bottomLeft, bottomRight, topLeft, topRight;
-
- if ((tab->position == QStyleOptionTab::Beginning) ||
- (tab->position == QStyleOptionTab::OnlyOneTab)) {
- if (tab->shape == QTabBar::RoundedSouth ||
- tab->shape == QTabBar::RoundedNorth) {
- myRect = myRect.adjusted(2, 0, 0, 0);
- } else {
- myRect = myRect.adjusted(0, 2, 0, 0);
- }
- }
-
- switch (tab->shape) {
- case QTabBar::RoundedNorth:
- topLeft = myRect.topLeft();
- topRight = myRect.topRight();
- bottomLeft = myRect.bottomLeft();
- bottomRight = myRect.bottomRight();
- break;
- case QTabBar::RoundedSouth:
- topLeft = myRect.bottomLeft();
- topRight = myRect.bottomRight();
- bottomLeft = myRect.topLeft();
- bottomRight = myRect.topRight();
- break;
- case QTabBar::RoundedWest:
- topLeft = myRect.topLeft();
- topRight = myRect.bottomLeft();
- bottomLeft = myRect.topRight();
- bottomRight = myRect.bottomRight();
- break;
- case QTabBar::RoundedEast:
- topLeft = myRect.topRight();
- topRight = myRect.bottomRight();
- bottomLeft = myRect.topLeft();
- bottomRight = myRect.bottomLeft();
- break;
- default:
- ;
- }
-
- QPainterPath outerPath;
- outerPath.moveTo(bottomLeft + adjustTabPoint(QPoint(0, -2),
- tab->shape));
- outerPath.lineTo(bottomLeft + adjustTabPoint(QPoint(0, -14),
- tab->shape));
- outerPath.lineTo(topLeft + adjustTabPoint(QPoint(6 , 0),
- tab->shape));
- outerPath.lineTo(topRight + adjustTabPoint(QPoint(0, 0),
- tab->shape));
- outerPath.lineTo(bottomRight + adjustTabPoint(QPoint(0, -2),
- tab->shape));
-
- if (tab->state & State_Selected ||
- tab->position == QStyleOptionTab::OnlyOneTab) {
- QPainterPath innerPath;
- innerPath.moveTo(topLeft + adjustTabPoint(QPoint(6, 2),
- tab->shape));
- innerPath.lineTo(topRight + adjustTabPoint(QPoint(-1, 2),
- tab->shape));
- innerPath.lineTo(bottomRight + adjustTabPoint(QPoint(-1 , -2),
- tab->shape));
- innerPath.lineTo(bottomLeft + adjustTabPoint(QPoint(2 , -2),
- tab->shape));
- innerPath.lineTo(bottomLeft + adjustTabPoint(QPoint(2 , -14),
- tab->shape));
- innerPath.lineTo(topLeft + adjustTabPoint(QPoint(6, 2),
- tab->shape));
-
- QPainterPath whitePath;
- whitePath.moveTo(bottomLeft + adjustTabPoint(QPoint(1, -2),
- tab->shape));
- whitePath.lineTo(bottomLeft + adjustTabPoint(QPoint(1, -14),
- tab->shape));
- whitePath.lineTo(topLeft + adjustTabPoint(QPoint(6, 1),
- tab->shape));
- whitePath.lineTo(topRight + adjustTabPoint(QPoint(-1, 1),
- tab->shape));
-
- painter->setPen(tab->palette.color(QPalette::Midlight));
- painter->setBrush(QColor(200, 221, 242));
- painter->drawPath(outerPath);
- painter->setPen(QColor(200, 221, 242));
- painter->drawRect(QRect(bottomLeft + adjustTabPoint(
- QPoint(2, -3), tab->shape),
- bottomRight + adjustTabPoint(
- QPoint(-2, 0), tab->shape)));
- painter->setPen(tab->palette.color(QPalette::Base));
- painter->setBrush(Qt::NoBrush);
- painter->drawPath(whitePath);
-
- if (option->state & State_HasFocus) {
- painter->setPen(option->palette.color(QPalette::Mid));
- painter->drawPath(innerPath);
- }
- } else {
- painter->setPen(tab->palette.color(QPalette::Mid));
- painter->drawPath(outerPath);
- }
- break;
- }
- case CE_PushButtonLabel:
- painter->save();
-
- if (const QStyleOptionButton *button =
- qstyleoption_cast<const QStyleOptionButton *>(option)) {
- QRect ir = button->rect;
- uint tf = Qt::AlignVCenter | Qt::TextShowMnemonic;
- if (!styleHint(SH_UnderlineShortcut, button, widget))
- tf |= Qt::TextHideMnemonic;
-
- if (!button->icon.isNull()) {
- QPoint point;
-
- QIcon::Mode mode = button->state & State_Enabled ? QIcon::Normal
- : QIcon::Disabled;
- if (mode == QIcon::Normal && button->state & State_HasFocus)
- mode = QIcon::Active;
- QIcon::State state = QIcon::Off;
- if (button->state & State_On)
- state = QIcon::On;
-
- QPixmap pixmap = button->icon.pixmap(button->iconSize, mode,
- state);
- int w = pixmap.width();
- int h = pixmap.height();
-
- if (!button->text.isEmpty())
- w += button->fontMetrics.width(button->text) + 2;
-
- point = QPoint(ir.x() + ir.width() / 2 - w / 2,
- ir.y() + ir.height() / 2 - h / 2);
-
- if (button->direction == Qt::RightToLeft)
- point.rx() += pixmap.width();
-
- painter->drawPixmap(visualPos(button->direction, button->rect,
- point), pixmap);
-
- if (button->direction == Qt::RightToLeft)
- ir.translate(-point.x() - 2, 0);
- else
- ir.translate(point.x() + pixmap.width(), 0);
-
- if (!button->text.isEmpty())
- tf |= Qt::AlignLeft;
-
- } else {
- tf |= Qt::AlignHCenter;
- }
-
- if (button->fontMetrics.height() > 14)
- ir.translate(0, 1);
-
- drawItemText(painter, ir, tf, button->palette, (button->state &
- State_Enabled),
- button->text, QPalette::ButtonText);
- }
-
- painter->restore();
- break;
-
- default:
- QWindowsStyle::drawControl(control, option, painter, widget);
- }
- painter->restore();
-}
-
-inline QPoint JavaStyle::adjustTabPoint(const QPoint &point,
- QTabBar::Shape shape) const
-{
- QPoint rPoint;
-
- switch (shape) {
- case QTabBar::RoundedWest:
- rPoint = QPoint(point.y(), point.x());
- break;
- case QTabBar::RoundedSouth:
- rPoint = QPoint(point.x(), point.y() * -1);
- break;
- case QTabBar::RoundedEast:
- rPoint = QPoint(point.y() * -1, point.x());
- break;
- default:
- rPoint = point;
- }
- return rPoint;
-}
-
-QRect JavaStyle::subControlRect(ComplexControl control,
- const QStyleOptionComplex *option,
- SubControl subControl,
- const QWidget *widget) const
-{
- QRect rect = QWindowsStyle::subControlRect(control, option, subControl,
- widget);
-
- switch (control) {
- case CC_TitleBar: {
- const QStyleOptionTitleBar *bar =
- qstyleoption_cast<const QStyleOptionTitleBar *>(option);
-
- switch (subControl) {
- case SC_TitleBarMinButton: {
- rect = QRect(bar->rect.topRight() + QPoint(-68, 2),
- QSize(15, 15));
- break;
- }
- case SC_TitleBarMaxButton: {
- rect = QRect(bar->rect.topRight() + QPoint(-43, 3),
- QSize(15, 15));
- break;
- }
- case SC_TitleBarCloseButton: {
- rect = QRect(bar->rect.topRight() + QPoint(-18, 3),
- QSize(15, 15));
- break;
- }
- case SC_TitleBarLabel: {
- QRect labelRect = bar->fontMetrics.boundingRect(bar->text);
- rect = labelRect;
- rect.translate(bar->rect.left() + 30, 0);
- rect.moveTop(bar->rect.top());
- rect.adjust(0, 2, 2, 2);
- break;
- }
- case SC_TitleBarSysMenu: {
- rect = QRect(bar->rect.topLeft() + QPoint(6, 3),
- QSize(16, 16));
- break;
- }
- default:
- ;
- }
- break;
- }
- case CC_GroupBox: {
- const QStyleOptionGroupBox *box =
- qstyleoption_cast<const QStyleOptionGroupBox *>(option);
- bool hasCheckbox = box->subControls & SC_GroupBoxCheckBox;
- int checkAdjust = 13;
-
- QRect textRect = box->fontMetrics.boundingRect(box->text);
-
- switch (subControl) {
- case SC_GroupBoxFrame: {
- rect = box->rect;
- break;
- }
- case SC_GroupBoxCheckBox: {
- if (hasCheckbox) {
- rect = QRect(box->rect.topLeft() + QPoint(7, 4 +
- (textRect.height() / 2 - checkAdjust / 2)),
- QSize(checkAdjust, checkAdjust));
- }
- else {
- rect = QRect();
- }
- break;
- }
- case SC_GroupBoxLabel: {
- rect = QRect(box->rect.topLeft() + QPoint(7 + (hasCheckbox ?
- checkAdjust + 2 : 0), 4), textRect.size());
- break;
- }
- case SC_GroupBoxContents: {
- rect = box->rect.adjusted(10, 10 + textRect.height(), -10,
- -10);
- break;
- }
- default:
- ;
- }
- break;
- }
- case CC_SpinBox: {
- const QStyleOptionSpinBox *spinBox =
- qstyleoption_cast<const QStyleOptionSpinBox *>(option);
- int spinnerWidth = 16;
- QRect myRect = spinBox->rect;
- QPoint center = myRect.center();
- int frameWidth = pixelMetric(PM_SpinBoxFrameWidth, spinBox, widget);
-
- switch (subControl) {
- case SC_SpinBoxUp: {
- rect = QRect(myRect.topRight() + QPoint(-16, 0),
- QSize(16, center.y() - myRect.topRight().y()));
- break;
- }
- case SC_SpinBoxDown: {
- rect = QRect(QPoint(myRect.bottomRight().x() - 16,
- center.y() + 1),
- QSize(16, myRect.bottomRight().y() -
- center.y() - 1));
- break;
- }
- case SC_SpinBoxFrame: {
- rect = QRect(myRect.topLeft(), myRect.bottomRight() +
- QPoint(-16, 0));
- break;
- }
- case SC_SpinBoxEditField: {
- rect = QRect(myRect.topLeft() + QPoint(2, 2),
- myRect.bottomRight() + QPoint(-15 - frameWidth, -2));
- break;
- }
- default:
- ;
- }
- break;
- }
- case CC_ToolButton: {
- const QStyleOptionToolButton *button =
- qstyleoption_cast<const QStyleOptionToolButton *>(option);
-
- switch (subControl) {
- case SC_ToolButton: {
- rect = option->rect.adjusted(1, 1, -1, -1);
- break;
- }
- case SC_ToolButtonMenu: {
- rect = QRect(option->rect.bottomRight() +
- QPoint(-11, -11), QSize(10, 10));
- break;
- }
- }
- break;
- }
- case CC_ComboBox: {
- const QStyleOptionComboBox *combo =
- qstyleoption_cast<const QStyleOptionComboBox *>(option);
-
- bool reverse = combo->direction == Qt::RightToLeft;
-
- switch (subControl) {
- case SC_ComboBoxFrame:
- rect = combo->rect;
- break;
- case SC_ComboBoxArrow:
- if (reverse) {
- rect = QRect(combo->rect.topLeft(),
- combo->rect.bottomLeft() + QPoint(17, 0));
- } else {
- rect = QRect(combo->rect.topRight() + QPoint(-17, 0),
- combo->rect.bottomRight());
- }
- break;
- case SC_ComboBoxEditField:
- if (reverse) {
- rect = QRect(combo->rect.topLeft() + QPoint(19, 2),
- combo->rect.bottomRight() + QPoint(-2, 2));
- } else {
- rect = QRect(combo->rect.topLeft() + QPoint(2, 2),
- combo->rect.bottomRight() + QPoint(-19, -2));
- }
- break;
- case SC_ComboBoxListBoxPopup:
- rect = combo->rect;
- break;
- }
- break;
- }
- case CC_ScrollBar: {
- const QStyleOptionSlider *scrollBar =
- qstyleoption_cast<const QStyleOptionSlider *>(option);
- int scrollBarExtent = pixelMetric(PM_ScrollBarExtent, scrollBar,
- widget);
- int sliderMaxLength = ((scrollBar->orientation == Qt::Horizontal) ?
- scrollBar->rect.width() :
- scrollBar->rect.height()) - (16 * 3);
- int sliderMinLength = pixelMetric(PM_ScrollBarSliderMin, scrollBar,
- widget);
- int sliderLength;
-
- if (scrollBar->maximum != scrollBar->minimum) {
- uint valueRange = scrollBar->maximum - scrollBar->minimum;
- sliderLength = (scrollBar->pageStep * sliderMaxLength) /
- (valueRange + scrollBar->pageStep);
-
- if (sliderLength < sliderMinLength || valueRange > INT_MAX / 2)
- sliderLength = sliderMinLength;
- if (sliderLength > sliderMaxLength)
- sliderLength = sliderMaxLength;
- } else {
- sliderLength = sliderMaxLength;
- }
- int sliderStart = 16 + sliderPositionFromValue(scrollBar->minimum,
- scrollBar->maximum,
- scrollBar->sliderPosition,
- sliderMaxLength - sliderLength,
- scrollBar->upsideDown);
- QRect scrollBarRect = scrollBar->rect;
-
- switch (subControl) {
- case SC_ScrollBarSubLine:
- if (scrollBar->orientation == Qt::Horizontal) {
- rect.setRect(scrollBarRect.left(), scrollBarRect.top(),
- scrollBarRect.width() - 16, scrollBarExtent);
- } else {
- rect.setRect(scrollBarRect.left(), scrollBarRect.top(),
- scrollBarExtent, scrollBarRect.height() - 16);
- }
- break;
- case SC_ScrollBarAddLine:
- if (scrollBar->orientation == Qt::Horizontal) {
- rect.setRect(scrollBarRect.right() - 15,
- scrollBarRect.top(), 16, scrollBarExtent);
- } else {
- rect.setRect(scrollBarRect.left(), scrollBarRect.bottom()
- - 15, scrollBarExtent, 16);
- }
- break;
- case SC_ScrollBarSubPage:
- if (scrollBar->orientation == Qt::Horizontal) {
- rect.setRect(scrollBarRect.left() + 16, scrollBarRect.top(),
- sliderStart - (scrollBarRect.left() + 16),
- scrollBarExtent);
- } else {
- rect.setRect(scrollBarRect.left(), scrollBarRect.top() + 16,
- scrollBarExtent,
- sliderStart - (scrollBarRect.left() + 16));
- }
- break;
- case SC_ScrollBarAddPage:
- if (scrollBar->orientation == Qt::Horizontal)
- rect.setRect(sliderStart + sliderLength, 0,
- sliderMaxLength - sliderStart -
- sliderLength + 16, scrollBarExtent);
- else
- rect.setRect(0, sliderStart + sliderLength,
- scrollBarExtent, sliderMaxLength -
- sliderStart - sliderLength + 16);
- break;
- case SC_ScrollBarGroove:
- if (scrollBar->orientation == Qt::Horizontal) {
- rect = scrollBarRect.adjusted(16, 0, -32, 0);
- } else {
- rect = scrollBarRect.adjusted(0, 16, 0, -32);
- }
- break;
- case SC_ScrollBarSlider:
- if (scrollBar->orientation == Qt::Horizontal) {
- rect.setRect(sliderStart, 0, sliderLength,
- scrollBarExtent);
- } else {
- rect.setRect(0, sliderStart, scrollBarExtent,
- sliderLength);
- }
- break;
- default:
- return QWindowsStyle::subControlRect(control, option,
- subControl, widget);
- }
- break;
- }
- case CC_Slider: {
- const QStyleOptionSlider *slider =
- qstyleoption_cast<const QStyleOptionSlider *>(option);
- rect = slider->rect;
- int tickSize = pixelMetric(PM_SliderTickmarkOffset, option, widget);
- int handleSize = pixelMetric(PM_SliderControlThickness, option,
- widget);
-
- int dist = slider->orientation == Qt::Vertical ? slider->rect.height() :
- slider->rect.width();
- int pos = QStyle::sliderPositionFromValue(slider->minimum,
- slider->maximum, slider->sliderValue, dist - handleSize);
-
- switch (subControl) {
- case SC_SliderGroove: {
- QPoint center = rect.center();
-
- if (slider->orientation == Qt::Horizontal) {
- rect.setHeight(handleSize);
- if (slider->tickPosition == QSlider::TicksBelow) {
- center.ry() -= tickSize;
- }
- } else {
- rect.adjust(0, 0, 0, 0);
- rect.setWidth(handleSize);
- if (slider->tickPosition == QSlider::TicksBelow) {
- center.rx() -= tickSize;
- }
- }
- rect.moveCenter(center);
- break;
- }
- case SC_SliderHandle: {
- QPoint center = rect.center();
-
- if (slider->orientation == Qt::Horizontal) {
- rect.setHeight(handleSize);
- if (slider->tickPosition == QSlider::TicksBelow) {
- center.ry() -= tickSize;
- }
-
- rect.moveCenter(center);
-
- if (slider->upsideDown)
- rect.setLeft(slider->rect.right() -
- pos - (handleSize - 1));
- else
- rect.setLeft(pos);
-
- rect.setWidth(handleSize - 1);
- } else {
- rect.setWidth(handleSize);
- if (slider->tickPosition == QSlider::TicksBelow) {
- center.rx() -= tickSize;
- }
-
- rect.moveCenter(center);
-
- if (slider->upsideDown)
- rect.setTop(slider->rect.bottom() -
- ((pos + handleSize) - 2));
- else
- rect.setTop(slider->rect.top() + pos);
-
- rect.setHeight(handleSize);
- }
- break;
- }
- case SC_SliderTickmarks: {
- QPoint center = slider->rect.center();
-
- if (slider->tickPosition & QSlider::TicksBelow) {
- if (slider->orientation == Qt::Horizontal) {
- rect.setHeight(tickSize);
- center.ry() += tickSize / 2;
- rect.adjust(6, 0, -10, 0);
- } else {
- rect.setWidth(tickSize);
- center.rx() += tickSize / 2;
- rect.adjust(0, 6, 0, -10);
- }
- } else {
- rect = QRect();
- }
- rect.moveCenter(center);
- break;
- }
- default:
- ;
- }
- break;
- }
- default:
- return QWindowsStyle::subControlRect(control, option, subControl,
- widget);
- }
- return rect;
-}
-
-static const char * const sliderHandleImage[] = {
- "15 16 7 1",
- " c None",
- "+ c #FFFFFF",
- "@ c #FFFFFF",
- "$ c #FFFFFF",
- "( c #E5EDF5",
- ") c #F2F6FA",
- "[ c #FFFFFF",
- " +++++++++++++ ",
- "+@@@@@@@@@@@@@+",
- "+@(((((((((((@+",
- "+@(((((((((((@+",
- "+@)))))))))))@+",
- "+@[[[[[[[[[[[@+",
- "+@[[[[[[[[[[[@+",
- "+@)))))))))))@+",
- "+@)))))))))))@+",
- " +@)))))))))@+ ",
- " +@(((((((@+ ",
- " +@(((((@+ ",
- " +@(((@+ ",
- " +@(@+ ",
- " +@+ ",
- " + "};
-
-
-void JavaStyle::drawComplexControl(ComplexControl control,
- const QStyleOptionComplex *option,
- QPainter *painter,
- const QWidget *widget) const
-{
- painter->save();
-
- switch (control) {
- case CC_TitleBar: {
- const QStyleOptionTitleBar *bar =
- qstyleoption_cast<const QStyleOptionTitleBar *>(option);
-
- bool sunken = bar->state & State_Sunken;
-
- QLinearGradient gradient(bar->rect.bottomLeft(),
- bar->rect.topLeft());
- gradient.setColorAt(0.0, QColor(191, 212, 231));
- gradient.setColorAt(0.7, Qt::white);
- gradient.setColorAt(1.0, QColor(221, 232, 243));
-
- painter->setPen(Qt::NoPen);
- if (bar->titleBarState & State_Active) {
- painter->setBrush(gradient);
- }
- else
- painter->setBrush(bar->palette.color(QPalette::Active,
- QPalette::Background));
-
- painter->drawRect(bar->rect.adjusted(0, 0, -1, -1));
-
- painter->setBrush(QColor(233, 233, 233));
- painter->drawRect(QRect(bar->rect.bottomLeft() + QPoint(0, 1),
- bar->rect.bottomRight() + QPoint(0, 2)));
-
- QRect minButtonRect = subControlRect(control, bar,
- SC_TitleBarMinButton);
- QRect maxButtonRect = subControlRect(control, bar,
- SC_TitleBarMaxButton);
- QRect closeButtonRect = subControlRect(control, bar,
- SC_TitleBarCloseButton);
- QRect systemButtonRect = subControlRect(control, bar,
- SC_TitleBarSysMenu);
- QRect labelRect = subControlRect(control, bar, SC_TitleBarLabel);
- QRect gripRect = QRect(QPoint(labelRect.right() + 5, bar->rect.top() + 5),
- QPoint(minButtonRect.left() - 5,
- bar->rect.bottom() - 4));
-
- QColor textColor = option->palette.color(QPalette::Text);
- painter->setPen(textColor);
- painter->setBrush(Qt::NoBrush);
-
- drawItemText(painter, labelRect, Qt::TextShowMnemonic |
- Qt::AlignHCenter | Qt::AlignCenter,
- bar->palette, bar->state & State_Enabled, bar->text,
- textColor.isValid() ? QPalette::NoRole :
- QPalette::WindowText);
-
- for (int i = 0; i < gripRect.width(); ++i) {
- painter->setPen(i % 2 ? bar->palette.color(QPalette::Midlight)
- : Qt::white);
-
- for (int j = 0; j < 4; ++j) {
- painter->drawPoint(i + gripRect.left(),
- gripRect.top() - 2 + i % 4 + 4 * j);
- }
- }
-
- QPixmap maximizePixmap(":/images/internalmaximize.png");
- QPixmap minimizePixmap(":/images/internalminimize.png");
- QPixmap closePixmap(":/images/internalclose.png");
- QPixmap internalPixmap(":/images/internalsystem.png");
- QPixmap internalCloseDownPixmap(":/images/internalclosedown.png");
- QPixmap minimizeDownPixmap(":/images/internalminimizedown.png");
- QPixmap maximizeDownPixmap(":/images/internalmaximizedown.png");
-
- if (bar->activeSubControls & SC_TitleBarCloseButton &&
- bar->state & State_Sunken)
- painter->drawPixmap(closeButtonRect.topLeft(),
- internalCloseDownPixmap);
- else
- painter->drawPixmap(closeButtonRect.topLeft(), closePixmap);
-
- if (bar->activeSubControls & SC_TitleBarMinButton &&
- bar->state & State_Sunken)
- painter->drawPixmap(minButtonRect.topLeft(),
- minimizeDownPixmap);
- else
- painter->drawPixmap(minButtonRect.topLeft(), minimizePixmap);
-
- if (bar->activeSubControls & SC_TitleBarMaxButton &&
- bar->state & State_Sunken)
- painter->drawPixmap(maxButtonRect.topLeft(),
- maximizeDownPixmap);
- else
- painter->drawPixmap(maxButtonRect.topLeft(), maximizePixmap);
-
- painter->drawPixmap(systemButtonRect.topLeft(), internalPixmap);
-
- break;
- }
- case CC_GroupBox: {
- const QStyleOptionGroupBox *box =
- qstyleoption_cast<const QStyleOptionGroupBox *>(option);
-
- QRect frameRect = subControlRect(control, box, SC_GroupBoxFrame);
- QRect labelRect = subControlRect(control, box, SC_GroupBoxLabel);
- QRect contentsRect = subControlRect(control, box,
- SC_GroupBoxContents);
- QRect checkerRect = subControlRect(control, box,
- SC_GroupBoxCheckBox);
-
- int y = labelRect.center().y();
-
- painter->setPen(box->palette.color(QPalette::Button));
- painter->drawRect(frameRect.adjusted(2, y - frameRect.top(), -2,
- -2));
-
- painter->setPen(box->palette.color(QPalette::Background));
-
- if (box->subControls & SC_GroupBoxCheckBox) {
- painter->drawLine(checkerRect.left() - 1, y,
- checkerRect.right() + 2, y);
- QStyleOptionButton checker;
- checker.QStyleOption::operator=(*box);
- checker.rect = checkerRect;
- drawPrimitive(PE_IndicatorCheckBox, &checker, painter, widget);
- }
-
- if (box->subControls & SC_GroupBoxLabel && !box->text.isEmpty()) {
- painter->drawLine(labelRect.left() - 1, y,
- labelRect.right() +1, y);
-
- QColor textColor = box->textColor;
- if (textColor.isValid())
- painter->setPen(textColor);
-
- drawItemText(painter, labelRect, Qt::TextShowMnemonic |
- Qt::AlignHCenter | int(box->textAlignment),
- box->palette, box->state & State_Enabled,
- box->text, textColor.isValid() ? QPalette::NoRole :
- QPalette::WindowText);
- }
- break;
- }
- case CC_SpinBox: {
- const QStyleOptionSpinBox *spinner =
- qstyleoption_cast<const QStyleOptionSpinBox *>(option);
-
- QRect frameRect = subControlRect(control, spinner, SC_SpinBoxFrame);
- QRect upRect = subControlRect(control, spinner, SC_SpinBoxUp);
- QRect downRect = subControlRect(control, spinner, SC_SpinBoxDown);
-
- painter->setPen(Qt::white);
- painter->drawRect(frameRect.adjusted(1, 1, -1, -1));
- painter->drawPoint(frameRect.bottomLeft());
-
- painter->setPen(spinner->palette.color(QPalette::Mid));
- painter->drawRect(frameRect.adjusted(0, 0, -1, -2));
-
- bool isEnabled = (spinner->state & State_Enabled);
- bool hover = isEnabled && (spinner->state & State_MouseOver);
- bool sunken = (spinner->state & State_Sunken);
- bool upIsActive = (spinner->activeSubControls == SC_SpinBoxUp);
- bool downIsActive = (spinner->activeSubControls == SC_SpinBoxDown);
- bool stepUpEnabled = spinner->stepEnabled &
- QAbstractSpinBox::StepUpEnabled;
- bool stepDownEnabled = spinner->stepEnabled &
- QAbstractSpinBox::StepDownEnabled;
-
- painter->setBrush(spinner->palette.color(QPalette::Background));
-
- painter->drawRect(upRect);
- if (upIsActive && stepUpEnabled) {
- if (sunken) {
- drawSunkenButtonShadow(painter, upRect,
- spinner->palette.color(QPalette::Mid));
- } else if (hover) {
- drawButtonHoverFrame(painter, upRect,
- spinner->palette.color(QPalette::Mid),
- spinner->palette.color(QPalette::Button));
- }
- }
-
- QStyleOptionSpinBox upSpin = *spinner;
- upSpin.rect = upRect;
- drawPrimitive(PE_IndicatorSpinUp, &upSpin, painter, widget);
-
- painter->drawRect(downRect);
- if (downIsActive && stepDownEnabled) {
- if (sunken) {
- drawSunkenButtonShadow(painter, downRect,
- spinner->palette.color(QPalette::Mid));
- } else if (hover) {
- drawButtonHoverFrame(painter, downRect,
- spinner->palette.color(QPalette::Mid),
- spinner->palette.color(QPalette::Button));
- }
- }
-
- QStyleOptionSpinBox downSpin = *spinner;
- downSpin.rect = downRect;
- drawPrimitive(PE_IndicatorSpinDown, &downSpin, painter, widget);
-
- break;
- }
- case CC_ToolButton: {
- const QStyleOptionToolButton *button =
- qstyleoption_cast<const QStyleOptionToolButton *>(option);
-
- painter->setPen(Qt::white);
- painter->drawRect(button->rect.adjusted(1, 1, -1, -1));
-
- QStyleOptionToolButton panelOption = *button;
- QRect panelRect;
- if (!(button->state & State_MouseOver) &&
- !(button->state & State_On)) {
- painter->setPen(QColor(153, 153, 153));
- painter->drawRect(button->rect.adjusted(0, 0, -2, -2));
-
- panelRect = subControlRect(control, option, SC_ToolButton);
- panelOption.rect = panelRect;
- } else {
- panelOption.rect.adjust(0, 0, -1, -1);
- }
-
- QRect menuRect = subControlRect(control, option, SC_ToolButtonMenu);
-
- drawPrimitive(PE_PanelButtonTool, &panelOption, painter, widget);
-
- QStyleOptionToolButton menuOption = *button;
- menuOption.rect = menuRect;
-
- QStyleOptionToolButton label = *button;
- int fw = 5;
-
- drawControl(CE_ToolButtonLabel, &label, painter, widget);
- if (button->subControls & SC_ToolButtonMenu) {
- painter->setPen(button->palette.color(QPalette::WindowText));
- drawPrimitive(PE_IndicatorArrowDown, &menuOption, painter, widget);
- }
-
- if (button->state & State_HasFocus) {
- QStyleOptionToolButton focusOption = *button;
- focusOption.rect = label.rect.adjusted(-1, -1, 1, 1);
-
- drawPrimitive(PE_FrameFocusRect, &focusOption, painter, widget);
- }
-
- break;
- }
- case CC_ComboBox: {
- const QStyleOptionComboBox *combo =
- qstyleoption_cast<const QStyleOptionComboBox *>(option);
-
- QRect frameRect = subControlRect(control, option, SC_ComboBoxFrame,
- widget);
- painter->setPen(combo->palette.color(QPalette::Mid));
-
- if (option->state & State_HasFocus)
- painter->setBrush(option->palette.color(QPalette::Light));
- else
- painter->setBrush(combo->palette.color(QPalette::Background));
-
- painter->drawRect(frameRect.adjusted(0, 0, -1, -1));
-
- QRect arrowRect = subControlRect(control, option, SC_ComboBoxArrow,
- widget);
- painter->setPen(combo->palette.color(QPalette::Button));
- painter->setBrush(Qt::NoBrush);
-
- if (combo->direction == Qt::LeftToRight) {
- painter->drawRect(QRect(frameRect.topLeft() + QPoint(1, 1),
- arrowRect.bottomLeft() + QPoint(-2, -2)));
- } else {
- painter->drawRect(QRect(arrowRect.topLeft() + QPoint(1, 1),
- frameRect.bottomRight() + QPoint(-2, -2)));
- }
-
- QStyleOptionButton button;
- button.rect = arrowRect;
- button.state = combo->state;
- button.palette = combo->palette;
-
- if (button.state & State_On)
- button.state ^= State_On;
-
- painter->save();
- drawButtonBackground(&button, painter, false);
- painter->restore();
-
- QPoint center = arrowRect.center();
- QPoint offset = QPoint(arrowRect.bottomLeft().x() + 1,
- center.y() + 7);
- QPainterPath arrow;
- arrow.moveTo(offset + QPoint(4, -8));
- arrow.lineTo(offset + QPoint(7, -5));
- arrow.lineTo(offset + QPoint(8, -5));
- arrow.lineTo(offset + QPoint(11, -8));
- arrow.lineTo(offset + QPoint(4, -8));
-
- painter->setBrush(combo->palette.color(QPalette::WindowText));
- painter->setPen(combo->palette.color(QPalette::WindowText));
-
- painter->drawPath(arrow);
-
- QRect fieldRect = subControlRect(control, option,
- SC_ComboBoxEditField, widget);
-
- break;
- }
- case CC_Slider: {
- const QStyleOptionSlider *slider =
- qstyleoption_cast<const QStyleOptionSlider *>(option);
-
- bool horizontal = slider->orientation == Qt::Horizontal;
-
- QRect groove = subControlRect(control, option, SC_SliderGroove,
- widget);
- QRect ticks = subControlRect(control, option, SC_SliderTickmarks,
- widget);
- QRect handle = subControlRect(control, option, SC_SliderHandle,
- widget);
-
- QRect afterHandle = QRect(handle.topLeft() + xySwitch(QPoint(4, 6), horizontal),
- groove.bottomRight() + xySwitch(QPoint(-4, -6), horizontal));
- QRect beforeHandle = QRect(groove.topLeft() + xySwitch(QPoint(4, 6), horizontal),
- handle.bottomRight() + xySwitch(QPoint(-4, -6), horizontal));
-
- if (slider->upsideDown || !horizontal) {
- QRect remember;
- remember = afterHandle;
- afterHandle = beforeHandle;
- beforeHandle = remember;
- }
-
- painter->setPen(slider->palette.color(QPalette::Mid));
- painter->setBrush(option->palette.color(QPalette::Background));
- painter->drawRect(afterHandle);
- painter->setPen(slider->palette.color(QPalette::Light));
- painter->drawLine(afterHandle.topLeft() + xySwitch(QPoint(0, 1), horizontal),
- afterHandle.topRight() + xySwitch(QPoint(0, 1), horizontal));
- painter->setPen(option->palette.color(QPalette::Midlight));
-
- if (horizontal) {
- painter->setBrush(gradientBrush(QRect(QPoint(groove.x(),
- handle.y() + 1),
- QSize(groove.width(),
- handle.height() + 1))));
- } else {
- QRect rect = QRect(QPoint(groove.x(),
- handle.x() - 1),
- QSize(groove.height(),
- handle.width() + 1));
- QLinearGradient gradient(groove.bottomLeft(),
- groove.bottomRight());
- gradient.setColorAt(1.0, QColor(188, 210, 230));
- gradient.setColorAt(0.3, Qt::white);
- gradient.setColorAt(0.0, QColor(223, 233, 243));
-
- painter->setBrush(gradient);
- }
-
- painter->drawRect(beforeHandle);
-
- QPainterPath handlePath;
- QPainterPath innerPath;
- QPoint topLeft, topRight, bottomLeft;
- if (horizontal) {
- topLeft = handle.topLeft();
- topRight = handle.topRight();
- bottomLeft = handle.bottomLeft();
- } else {
- topLeft = handle.bottomLeft();
- topRight = handle.topLeft();
- bottomLeft = handle.topRight();
- }
-
- if (horizontal) {
- QImage image(sliderHandleImage);
-
- image.setColor(1,
- option->palette.color(QPalette::Midlight).rgb());
- image.setColor(2,
- option->palette.color(QPalette::Button).rgb());
-
- if (!(slider->state & State_Enabled)) {
- image.setColor(4, slider->palette.color(QPalette::Background).rgb());
- image.setColor(5, slider->palette.color(QPalette::Background).rgb());
- image.setColor(6, slider->palette.color(QPalette::Background).rgb());
- }
-
- painter->drawImage(handle.topLeft(), image);
- } else {
- QImage image(":/images/verticalsliderhandle.png");
- painter->drawImage(handle.topLeft(), image);
- }
-
- if (slider->tickPosition & QSlider::TicksBelow) {
- painter->setPen(slider->palette.color(QPalette::Light));
- int tickInterval = slider->tickInterval ? slider->tickInterval :
- slider->pageStep;
-
- for (int i = 0; i <= slider->maximum; i += tickInterval) {
- if (horizontal) {
- int pos = int(((i / double(slider->maximum)) *
- ticks.width()) - 1);
- painter->drawLine(QPoint(ticks.left() + pos,
- ticks.top() + 2), QPoint(ticks.left() + pos, ticks.top() + 8));
- } else {
- int pos = int(((i / double(slider->maximum)) *
- ticks.height()) - 1);
- painter->drawLine(QPoint(ticks.left() + 2, ticks.bottom() - pos),
- QPoint(ticks.right() - 2, ticks.bottom() - pos));
- }
- }
- if (horizontal) {
- painter->drawLine(QPoint(ticks.right(), ticks.top() + 2),
- QPoint(ticks.right(), ticks.top() + 8));
- } else {
- painter->drawLine(QPoint(ticks.left() + 2, ticks.top()),
- QPoint(ticks.right() - 2, ticks.top()));
- }
- }
- break;
- }
- default:
- QWindowsStyle::drawComplexControl(control, option, painter, widget);
- }
- painter->restore();
-}
-
-inline void JavaStyle::drawSunkenButtonShadow(QPainter *painter,
- QRect rect,
- const QColor &frameColor,
- bool reverse) const
-{
- painter->save();
-
- painter->setPen(frameColor);
-
- if (!reverse) {
- painter->drawLine(QLine(QPoint(rect.x() + 1, rect.y() + 1),
- QPoint(rect.x() + rect.width() - 1, rect.y() + 1)));
- painter->drawLine(QLine(QPoint(rect.x() + 1, rect.y()),
- QPoint(rect.x() + 1, rect.y() + rect.height())));
- } else {
- painter->drawLine(QLine(QPoint(rect.right(), rect.bottom()),
- QPoint(rect.right(), rect.top())));
- painter->drawLine(QLine(QPoint(rect.left(), rect.top() + 1),
- QPoint(rect.right(), rect.top() + 1)));
- }
- painter->restore();
-}
-
-inline void JavaStyle::drawButtonHoverFrame(QPainter *painter, QRect rect,
- const QColor &frameColor,
- const QColor &activeFrame) const
-{
- painter->save();
-
- painter->setPen(activeFrame);
- painter->drawRect(rect);
- rect.adjust(1, 1, -1, -1);
- painter->setPen(frameColor);
- painter->drawRect(rect);
- rect.adjust(1, 1, -1, -1);
- painter->setPen(activeFrame);
- painter->drawRect(rect);
-
- painter->restore();
-}
-
-QStyle::SubControl JavaStyle::hitTestComplexControl(ComplexControl control,
- const QStyleOptionComplex *option,
- const QPoint &pos,
- const QWidget *widget) const
-{
- SubControl ret = SC_None;
-
- switch (control) {
- case CC_TitleBar: {
- const QStyleOptionTitleBar *bar =
- qstyleoption_cast<const QStyleOptionTitleBar *>(option);
-
- QRect maximize = subControlRect(control, bar, SC_TitleBarMaxButton);
- if (maximize.contains(pos)) {
- ret = SC_TitleBarMaxButton;
- break;
- }
- QRect minimize = subControlRect(control, bar, SC_TitleBarMinButton);
- if (minimize.contains(pos)) {
- ret = SC_TitleBarMinButton;
- break;
- }
- QRect close = subControlRect(control, bar, SC_TitleBarCloseButton);
- if (close.contains(pos)) {
- ret = SC_TitleBarCloseButton;
- break;
- }
- QRect system = subControlRect(control, bar, SC_TitleBarSysMenu);
- if (system.contains(pos)) {
- ret = SC_TitleBarSysMenu;
- break;
- }
- ret = SC_TitleBarLabel;
- break;
- }
- case CC_ScrollBar:
- if (const QStyleOptionSlider *scrollBar =
- qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- QRect slider = subControlRect(control, scrollBar,
- SC_ScrollBarSlider, widget);
- if (slider.contains(pos)) {
- ret = SC_ScrollBarSlider;
- break;
- }
-
- QRect scrollBarAddLine = subControlRect(control, scrollBar,
- SC_ScrollBarAddLine, widget);
- if (scrollBarAddLine.contains(pos)) {
- ret = SC_ScrollBarAddLine;
- break;
- }
-
- QRect scrollBarSubPage = subControlRect(control, scrollBar,
- SC_ScrollBarSubPage, widget);
- if (scrollBarSubPage.contains(pos)) {
- ret = SC_ScrollBarSubPage;
- break;
- }
-
- QRect scrollBarAddPage = subControlRect(control, scrollBar,
- SC_ScrollBarAddPage, widget);
- if (scrollBarAddPage.contains(pos)) {
- ret = SC_ScrollBarAddPage;
- break;
- }
-
- QRect scrollBarSubLine = subControlRect(control, scrollBar,
- SC_ScrollBarSubLine, widget);
- if (scrollBarSubLine.contains(pos)) {
- ret = SC_ScrollBarSubLine;
- break;
- }
- }
- break;
-
- default:
- ret = QWindowsStyle::hitTestComplexControl(control, option, pos,
- widget);
- }
- return ret;
-}
-
-void JavaStyle::polish(QWidget *widget)
-{
- if (qobject_cast<QCheckBox *>(widget) ||
- qobject_cast<QRadioButton *>(widget) ||
- qobject_cast<QPushButton *>(widget) ||
- qobject_cast<QToolButton *>(widget) ||
- qobject_cast<QSpinBox *>(widget) ||
- qobject_cast<QGroupBox *>(widget))
- widget->setAttribute(Qt::WA_Hover, true);
-}
-
-void JavaStyle::unpolish(QWidget *widget)
-{
- if (qobject_cast<QPushButton *>(widget) ||
- qobject_cast<QCheckBox *>(widget) ||
- qobject_cast<QRadioButton *>(widget) ||
- qobject_cast<QToolButton *>(widget) ||
- qobject_cast<QSpinBox *>(widget) ||
- qobject_cast<QGroupBox *>(widget))
- widget->setAttribute(Qt::WA_Hover, false);
-}
-
-void JavaStyle::drawSplitter(const QStyleOption *option, QPainter *painter,
- bool horizontal) const
-{
- QRect rect = option->rect;
-
- painter->setPen(Qt::NoPen);
- painter->setBrush(option->palette.color(QPalette::Background));
-
- painter->drawRect(rect);
-
- QColor colors[] = { Qt::white, option->palette.color(QPalette::Mid) };
- int iterations = horizontal ? rect.height() - 1 : rect.width() - 1;
- for (int i = 0; i < iterations; ++i) {
- painter->setPen(colors[i % 2]);
- painter->drawPoint(xySwitch(QPoint(rect.x() + 0 + (i % 4),
- rect.y() + i), horizontal));
- }
-}
-
-inline QPoint JavaStyle::xySwitch(const QPoint &point, bool horizontal) const
-{
- QPoint retPoint = point;
-
- if (!horizontal) {
- retPoint = QPoint(point.y(), point.x());
- }
-
- return retPoint;
-}
-
-void JavaStyle::drawPrimitive(PrimitiveElement element,
- const QStyleOption *option,
- QPainter *painter,
- const QWidget *widget) const
-{
- painter->save();
-
- switch (element) {
- case PE_PanelButtonBevel:
- case PE_FrameButtonBevel: {
- painter->save();
- painter->setBrush(option->palette.background());
- painter->setPen(Qt::NoPen);
- painter->drawRect(option->rect);
- painter->restore();
- break;
- }
- case PE_IndicatorBranch: {
- painter->save();
- QColor lineColor(204, 204, 255);
- QPixmap openPixmap(":/images/jtreeopen.png");
- QPixmap closedPixmap(":/images/jtreeclosed.png");
- QRect pixmapRect(QPoint(0, 0), QSize(12, 12));
- pixmapRect.moveCenter(option->rect.center());
- pixmapRect.translate(2, 0);
- QPoint center = option->rect.center();
-
- painter->setPen(lineColor);
- painter->setBrush(Qt::NoBrush);
-
- if (option->state & State_Item) {
- painter->drawLine(center,
- QPoint(option->rect.right(), center.y()));
-
- painter->drawLine(center, QPoint(center.x(),
- option->rect.top()));
-
- if (option->state & State_Sibling) {
- painter->drawLine(center, QPoint(center.x(),
- option->rect.bottom()));
- }
-
- if (option->state & State_Children)
- if (option->state & State_Open)
- painter->drawPixmap(pixmapRect.topLeft(), closedPixmap);
- else
- painter->drawPixmap(pixmapRect.topLeft(), openPixmap);
- } else if (option->state & State_Sibling) {
- painter->drawLine(center.x(), option->rect.top(), center.x(),
- option->rect.bottom());
- }
-
- painter->restore();
- break;
- }
- case PE_IndicatorViewItemCheck: {
- break;
- }
- case PE_FrameWindow: {
- painter->save();
- bool active = option->state & State_Active;
-
- painter->setPen(Qt::NoPen);
- painter->setBrush(active ? option->palette.color(QPalette::Midlight)
- : option->palette.color(QPalette::Mid));
-
- painter->drawRect(QRect(option->rect.topLeft(), option->rect.bottomLeft() + QPoint(5, 0)));
- painter->drawRect(QRect(option->rect.bottomLeft(), option->rect.bottomRight() + QPoint(0, -5)));
- painter->drawRect(QRect(option->rect.bottomRight() + QPoint(-5, 0), option->rect.topRight()));
- painter->drawRect(QRect(option->rect.topLeft(), option->rect.topRight() + QPoint(0, 4)));
-
- painter->setBrush(Qt::NoBrush);
- painter->setPen(option->palette.color(QPalette::Active, QPalette::WindowText));
- painter->drawLine(option->rect.topLeft() + QPoint(2, 14),
- option->rect.bottomLeft() + QPoint(2, -14));
-
- painter->drawLine(option->rect.topRight() + QPoint(-2, 14),
- option->rect.bottomRight() + QPoint(-2, -14));
-
- painter->drawLine(option->rect.topLeft() + QPoint(14, 2),
- option->rect.topRight() + QPoint(-14, 2));
-
- painter->drawLine(option->rect.bottomLeft() + QPoint(14, -2),
- option->rect.bottomRight() + QPoint(-14, -2));
-
- painter->setPen(active ? option->palette.color(QPalette::Light) :
- option->palette.color(QPalette::Button));
- painter->drawLine(option->rect.topLeft() + QPoint(3, 15),
- option->rect.bottomLeft() + QPoint(3, -13));
-
- painter->drawLine(option->rect.topRight() + QPoint(-1, 15),
- option->rect.bottomRight() + QPoint(-1, -13));
-
- painter->drawLine(option->rect.topLeft() + QPoint(15, 3),
- option->rect.topRight() + QPoint(-13, 3));
-
- painter->drawLine(option->rect.bottomLeft() + QPoint(15, -1),
- option->rect.bottomRight() + QPoint(-13, -1));
-
- painter->restore();
- break;
- }
- case PE_IndicatorSpinUp: {
- const QStyleOptionSpinBox *spinner =
- qstyleoption_cast<const QStyleOptionSpinBox *>(option);
- int add = spinner->state & State_Sunken &&
- spinner->activeSubControls & SC_SpinBoxUp ? 1 : 0;
-
- QPoint center = option->rect.center();
- painter->drawLine(center.x() + add, center.y() + 1 + add,
- center.x() + 2 + add, center.y() + 1 + add);
- painter->drawPoint(center.x() + 1 + add, center.y() + add);
- break;
- }
- case PE_IndicatorSpinDown: {
- const QStyleOptionSpinBox *spinner =
- qstyleoption_cast<const QStyleOptionSpinBox *>(option);
-
- int add = spinner->state & State_Sunken &&
- spinner->activeSubControls & SC_SpinBoxDown ? 1 : 0;
- QPoint center = option->rect.center();
- painter->drawLine(center.x() + add, center.y() + add,
- center.x() + 2 + add, center.y() + add);
- painter->drawPoint(center.x() + 1 + add, center.y() + 1 + add);
- break;
- }
- case PE_FrameDockWidget: {
- drawPrimitive(PE_FrameWindow, option, painter, widget);
- break;
- }
- case PE_IndicatorToolBarHandle: {
- QPoint offset;
- bool horizontal = option->state & State_Horizontal;
-
- if (horizontal)
- offset = option->rect.topLeft();
- else
- offset = option->rect.topLeft();
-
- int iterations = horizontal ? option->rect.height() :
- option->rect.width();
-
- for (int i = 0; i < iterations; ++i) {
- painter->setPen(i % 2 ? Qt::white :
- option->palette.color(QPalette::Mid));
- int add = i % 4;
- painter->drawPoint(offset + xySwitch(QPoint(add, i),
- horizontal));
- painter->drawPoint(offset + xySwitch(QPoint(add + 4, i),
- horizontal));
- if (add + 8 < 10)
- painter->drawPoint(offset + xySwitch(QPoint(add + 8, i),
- horizontal));
- }
-
- break;
- }
- case PE_IndicatorToolBarSeparator: {
- break;
- }
- case PE_PanelButtonTool: {
- const QStyleOptionToolButton *button =
- qstyleoption_cast<const QStyleOptionToolButton *>(option);
-
- if (!button) {
- painter->setPen(Qt::red);
- if (!(option->state & State_Enabled))
- painter->drawRect(option->rect.adjusted(0, 0, -1, -1));
- drawButtonBackground(option, painter, false);
- break;
- }
-
- if (button->state & State_MouseOver || button->state & State_On) {
- QStyleOptionButton bevel;
- bevel.state = button->state;
- bevel.rect = button->rect;
- bevel.palette = button->palette;
-
- drawButtonBackground(&bevel, painter, false);
- } else {
- painter->setPen(Qt::NoPen);
- painter->setBrush(button->palette.color(QPalette::Background));
-
- painter->drawRect(button->rect.adjusted(0, 0, -1, -1));
- }
- break;
- }
- case PE_FrameMenu: {
- painter->setPen(option->palette.color(QPalette::Midlight));
- painter->drawRect(option->rect.adjusted(0, 0, -1, -1));
- break;
- }
- case PE_PanelButtonCommand: {
- const QStyleOptionButton *btn =
- qstyleoption_cast<const QStyleOptionButton *>(option);
- bool hover = (btn->state & State_Enabled) &&
- (btn->state & State_MouseOver);
- bool sunken = btn->state & State_Sunken;
- bool isDefault = btn->features & QStyleOptionButton::DefaultButton;
- bool on = option->state & State_On;
-
- drawButtonBackground(option, painter, false);
-
- QRect rect = option->rect.adjusted(0, 0, -1, -1);
- if (hover && !sunken && !isDefault && !on) {
- drawButtonHoverFrame(painter, rect,
- btn->palette.color(QPalette::Mid),
- btn->palette.color(QPalette::Button));
- } else if (isDefault) {
- drawPrimitive(PE_FrameDefaultButton, option, painter, widget);
- }
- break;
- }
- case PE_FrameDefaultButton: {
- painter->setPen(option->palette.color(QPalette::Mid));
- QRect rect = option->rect.adjusted(0, 0, -1, -1);
- painter->drawRect(rect);
- painter->drawRect(rect.adjusted(1, 1, -1, -1));
- break;
- }
-//! [0]
- case PE_IndicatorCheckBox: {
- painter->save();
- drawButtonBackground(option, painter, true);
-
- if (option->state & State_Enabled &&
- option->state & State_MouseOver &&
- !(option->state & State_Sunken)) {
- painter->setPen(option->palette.color(QPalette::Button));
- QRect rect = option->rect.adjusted(1, 1, -2, -2);
- painter->drawRect(rect);
- rect = rect.adjusted(1, 1, -1, -1);
- painter->drawRect(rect);
- }
-
- if (option->state & State_On) {
- QImage image(":/images/checkboxchecked.png");
- painter->drawImage(option->rect.topLeft(), image);
- }
- painter->restore();
- break;
-//! [0]
- }
- case PE_IndicatorRadioButton: {
- painter->save();
- QBrush radioBrush = option->palette.button();
-
- if (!(option->state & State_Sunken) &&
- option->state & State_Enabled)
- radioBrush = gradientBrush(option->rect);
-
- painter->setBrush(radioBrush);
- if (option->state & State_Enabled)
- painter->setPen(option->palette.color(QPalette::Mid));
- else
- painter->setPen(option->palette.color(QPalette::Disabled,
- QPalette::WindowText));
- painter->drawEllipse(option->rect.adjusted(0, 0, -1, -1));
-
- if (option->state & State_MouseOver &&
- option->state & State_Enabled &&
- !(option->state & State_Sunken)) {
- gradientBrush(option->rect);
- painter->setPen(option->palette.color(QPalette::Button));
- painter->setBrush(Qt::NoBrush);
- QRect rect = option->rect.adjusted(1, 1, -2, -2);
- painter->drawEllipse(rect);
- rect = rect.adjusted(1, 1, -1, -1);
- painter->drawEllipse(rect);
- }
-
- if (option->state & State_On) {
- painter->setBrush(option->palette.color(QPalette::Text));
- painter->setPen(Qt::NoPen);
- painter->drawEllipse(option->rect.adjusted(3, 3, -3, -3));
- }
- if (option->state & State_Sunken &&
- option->state & State_Enabled) {
- painter->setPen(option->palette.color(QPalette::Mid));
- painter->drawArc(option->rect.adjusted(1, 1, -2, -2), 80 * 16,
- 100 * 16);
- }
- painter->restore();
- break;
- }
- case PE_FrameTabWidget: {
- painter->setPen(option->palette.color(QPalette::Midlight));
- painter->drawRect(option->rect.adjusted(0, 0, -1, -1));
- painter->setPen(Qt::white);
- painter->drawRect(option->rect.adjusted(1, 1, -2, -2));
- break;
- }
- case PE_Frame:
- case PE_FrameLineEdit: {
- const QStyleOptionFrame *frame =
- qstyleoption_cast<const QStyleOptionFrame *>(option);
- const QStyleOptionFrameV2 frameV2(*frame);
-
- painter->setPen(frame->palette.color(QPalette::Mid));
- painter->drawRect(frameV2.rect.adjusted(0, 0, -2, -2));
- painter->setPen(Qt::white);
- painter->drawRect(frameV2.rect.adjusted(1, 1, -1, -1));
- painter->setPen(frameV2.palette.color(QPalette::Active,
- QPalette::Background));
- painter->drawLine(frameV2.rect.bottomLeft(),
- frameV2.rect.bottomLeft() + QPoint(1, -1));
- painter->drawLine(frameV2.rect.topRight(),
- frameV2.rect.topRight() + QPoint(-1, 1));
- break;
- }
- case PE_FrameFocusRect: {
- painter->setPen(option->palette.color(QPalette::Light));
- painter->setBrush(Qt::NoBrush);
- QRect rect = option->rect;
- rect = rect.adjusted(0,0, -1, -1);
- painter->drawRect(rect);
- break;
- }
- default:
- QWindowsStyle::drawPrimitive(element, option, painter, widget);
- }
- painter->restore();
-}
-
-//! [1]
-void JavaStyle::drawButtonBackground(const QStyleOption *option,
- QPainter *painter, bool isCheckbox) const
-{
- QBrush buttonBrush = option->palette.button();
- bool sunken = option->state & State_Sunken;
- bool disabled = !(option->state & State_Enabled);
- bool on = option->state & State_On;
-
- if (!sunken && !disabled && (!on || isCheckbox))
- buttonBrush = gradientBrush(option->rect);
-
- painter->fillRect(option->rect, buttonBrush);
-
- QRect rect = option->rect.adjusted(0, 0, -1, -1);
-
- if (disabled)
- painter->setPen(option->palette.color(QPalette::Disabled,
- QPalette::WindowText));
- else
- painter->setPen(option->palette.color(QPalette::Mid));
-
- painter->drawRect(rect);
-
- if (sunken && !disabled) {
- drawSunkenButtonShadow(painter, rect,
- option->palette.color(QPalette::Mid),
- option->direction == Qt::RightToLeft);
- }
-}
-//! [1]
-
-QBrush JavaStyle::gradientBrush(const QRect &rect) const
-{
- QLinearGradient gradient(rect.topLeft(), rect.bottomLeft());
- gradient.setColorAt(1.0, QColor(188, 210, 230));
- gradient.setColorAt(0.3, Qt::white);
- gradient.setColorAt(0.0, QColor(223, 233, 243));
-
- return QBrush(gradient);
-}
-
-QRect JavaStyle::subElementRect(SubElement element,
- const QStyleOption *option,
- const QWidget *widget) const
-{
- QRect rect;
-
- switch (element) {
- case SE_ToolBoxTabContents: {
- const QStyleOptionToolBox *box =
- qstyleoption_cast<const QStyleOptionToolBox *>(option);
-
- rect.moveTopLeft(box->rect.topLeft() + QPoint(0, 2));
- rect.setHeight(box->rect.height() - 4);
- rect.setWidth(box->fontMetrics.width(box->text) + 15);
- break;
- }
- case SE_ProgressBarLabel:
- case SE_ProgressBarGroove:
- case SE_ProgressBarContents: {
- rect = option->rect.adjusted(1, 1, -1, -1);
- break;
- }
- case SE_PushButtonFocusRect: {
- const QStyleOptionButton *btn =
- qstyleoption_cast<const QStyleOptionButton *>(option);
-
- rect = btn->fontMetrics.boundingRect(btn->text);
- rect = QRect(0, 0, btn->fontMetrics.width(btn->text),
- rect.height());
-
- if (!btn->icon.isNull()) {
- rect.adjust(0, 0, btn->iconSize.width(), btn->iconSize.height()
- > rect.height() ? btn->iconSize.height() - rect.height() : 0);
- rect.translate(-btn->iconSize.width(), 0);
- rect.adjust(-1, -1, 1, 1);
- }
- rect = QRect(int(ceil((btn->rect.width() - rect.width()) / 2.0)),
- int(ceil((btn->rect.height() - rect.height()) / 2.0)),
- rect.width() - 1, rect.height());
- rect.adjust(-1, 0, 1, 0);
-
- break;
- }
- default:
- rect = QWindowsStyle::subElementRect(element, option, widget);
- }
- return rect;
-}
-
-int JavaStyle::pixelMetric(PixelMetric metric,
- const QStyleOption* /* option */,
- const QWidget* /*widget*/) const
-{
- int value = 0;
-
- switch (metric) {
- case PM_ButtonShiftHorizontal:
- case PM_ButtonShiftVertical:
- case PM_TabBarTabShiftHorizontal:
- case PM_ButtonDefaultIndicator:
- case PM_TabBarTabShiftVertical:
- value = 0;
- break;
- case PM_TabBarBaseOverlap:
- case PM_DefaultFrameWidth:
- value = 2;
- break;
- case PM_TabBarTabVSpace:
- value = 4;
- break;
- case PM_ScrollBarExtent:
- value = 16;
- break;
- case PM_ScrollBarSliderMin:
- value = 26;
- break;
- case PM_SplitterWidth:
- value = 8;
- break;
- case PM_SliderThickness:
- value = 16;
- break;
- case PM_SliderControlThickness:
- value = 16;
- break;
- case PM_SliderTickmarkOffset:
- value = 10;
- break;
- case PM_SliderSpaceAvailable:
- break;
- case PM_MenuPanelWidth:
- value = 1;
- break;
- case PM_MenuVMargin:
- value = 2;
- break;
- case PM_MenuBarPanelWidth:
- value = 1;
- break;
- case PM_MenuBarItemSpacing:
- value = 0;
- break;
- case PM_MenuBarHMargin:
- value = 3;
- break;
- case PM_MenuBarVMargin:
- value = 0;
- break;
- case PM_ComboBoxFrameWidth:
- value = 1;
- break;
- case PM_MenuButtonIndicator:
- value = 15;
- break;
- case PM_ToolBarItemMargin:
- value = 3;
- break;
- case PM_ToolBarHandleExtent:
- value = 13;
- break;
- case PM_SpinBoxFrameWidth:
- value = 2;
- break;
- case PM_TitleBarHeight: {
- value = 21;
- break;
- case PM_MDIFrameWidth:
- value = 6;
- break;
- }
- case PM_DockWidgetFrameWidth: {
- value = 5;
- break;
- }
- default:
- value = QWindowsStyle::pixelMetric(metric);
- }
- return value;
-}
-
-
-int JavaStyle::styleHint(StyleHint hint, const QStyleOption *option,
- const QWidget *widget,
- QStyleHintReturn *returnData) const
-{
- int ret;
-
- switch (hint) {
- case SH_Table_GridLineColor: {
- ret = static_cast<int>(option->palette.color(QPalette::Mid).rgb());
- break;
- }
- case QStyle::SH_Menu_Scrollable:
- ret = 1;
- break;
- default:
- ret = QWindowsStyle::styleHint(hint, option, widget, returnData);
- }
- return ret;
-}
-
-QPixmap JavaStyle::standardPixmap(StandardPixmap standardPixmap,
- const QStyleOption *option,
- const QWidget *widget) const
-{
- QPixmap pixmap = QWindowsStyle::standardPixmap(standardPixmap, option,
- widget);
-
- QPixmap maximizePixmap(":/images/internalmaximize.png");
- QPixmap minimizePixmap(":/images/internalminimize.png");
- QPixmap closePixmap(":/images/internalclose.png");
- QPixmap internalPixmap(":/images/internalsystem.png");
- QPixmap internalCloseDownPixmap(":/images/internalclosedown.png");
- QPixmap minimizeDownPixmap(":/images/internalminimizedown.png");
- QPixmap maximizeDownPixmap(":/images/internalmaximizedown.png");
- QPixmap dirOpenPixmap(":/images/open24.png");
- QPixmap filePixmap(":/images/file.png");
-
- switch (standardPixmap) {
- case SP_DirLinkIcon:
- case SP_DirClosedIcon:
- case SP_DirIcon:
- case SP_DirOpenIcon: {
- pixmap = closePixmap;
- break;
- }
- case SP_FileIcon: {
- pixmap = filePixmap;
- break;
- }
- case SP_FileDialogBack: {
- pixmap = QPixmap(":/images/fileback.png");
- break;
- }
- case SP_FileDialogToParent: {
- pixmap = QPixmap(":/images/fileparent.png");
- break;
- }
- case SP_FileDialogNewFolder: {
- pixmap = QPixmap(":/images/open24.png");
- break;
- }
- case SP_FileDialogListView: {
- pixmap = QPixmap(":/images/filelist.png");
- break;
- }
- case SP_FileDialogDetailedView: {
- pixmap = QPixmap(":/images/filedetail.png");
- break;
- }
- case SP_MessageBoxInformation: {
- pixmap = QPixmap(":/images/information.png");
- break;
- }
- case SP_MessageBoxWarning: {
- pixmap = QPixmap(":/images/warning.png");
- }
- case SP_MessageBoxCritical: {
- pixmap = QPixmap(":/images/critical.png");
- break;
- }
- case SP_MessageBoxQuestion: {
- pixmap = QPixmap(":/images/question.png");
- break;
- }
- case SP_TitleBarNormalButton:
- pixmap = maximizePixmap;
- break;
- case SP_TitleBarCloseButton:
- pixmap = closePixmap;
- break;
- default:
- ;
- }
-
- return pixmap;
-}
-
-QSize JavaStyle::sizeFromContents(ContentsType type,
- const QStyleOption *option,
- const QSize &contentsSize,
- const QWidget *widget) const
-{
- switch (type) {
- case CT_ComboBox: {
- return QSize(contentsSize.width() + 27, contentsSize.height());
- }
- case CT_Slider: {
- const QStyleOptionSlider *slider =
- qstyleoption_cast<const QStyleOptionSlider *>(option);
- if (slider->tickPosition == QSlider::TicksBelow) {
- return QSize(contentsSize.width(), contentsSize.height() + 15);
- } else {
- return contentsSize;
- }
- }
- case CT_MenuBarItem: {
- const QStyleOptionMenuItem *menuItem =
- qstyleoption_cast<const QStyleOptionMenuItem *>(option);
- QFontMetrics metrics(menuItem->font);
- QRect boundingRect = metrics.boundingRect(menuItem->text);
- int width = boundingRect.width() + 14;
- int height = boundingRect.height() + 3;
- if (height < 20)
- height = 20;
-
- return QSize(width, height);
- }
- case CT_MenuItem: {
- const QStyleOptionMenuItem *menuItem =
- qstyleoption_cast<const QStyleOptionMenuItem *>(option);
- QSize defaultSize = QWindowsStyle::sizeFromContents(type, option,
- contentsSize, widget);
-
- if (menuItem->menuItemType == QStyleOptionMenuItem::Separator)
- return defaultSize;
-
- int width = 30;
- int height = 0;
-
- if (!menuItem->icon.isNull()) {
- width += 20;
- height += 20;
- }
- if (!menuItem->text.isEmpty()) {
- QFontMetrics metrics(menuItem->font);
- QString text = menuItem->text;
- text.remove(QLatin1Char('\t'));
- QRect textRect = metrics.boundingRect(text);
- width += textRect.width();
- if (height < textRect.height())
- height += textRect.height();
- }
- if (menuItem->checkType != QStyleOptionMenuItem::NotCheckable) {
- width += 10;
- if (height < 10)
- height = 10;
- }
- return QSize(width, height);
- }
- default:
- return QWindowsStyle::sizeFromContents(type, option, contentsSize,
- widget);
- }
-}
diff --git a/doc/src/snippets/layouts/layouts.cpp b/doc/src/snippets/layouts/layouts.cpp
deleted file mode 100644
index 49c341c048..0000000000
--- a/doc/src/snippets/layouts/layouts.cpp
+++ /dev/null
@@ -1,165 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-
- {
-//! [0]
- QWidget *window = new QWidget;
-//! [0] //! [1]
- QPushButton *button1 = new QPushButton("One");
-//! [1] //! [2]
- QPushButton *button2 = new QPushButton("Two");
- QPushButton *button3 = new QPushButton("Three");
- QPushButton *button4 = new QPushButton("Four");
- QPushButton *button5 = new QPushButton("Five");
-//! [2]
-
-//! [3]
- QHBoxLayout *layout = new QHBoxLayout;
-//! [3] //! [4]
- layout->addWidget(button1);
- layout->addWidget(button2);
- layout->addWidget(button3);
- layout->addWidget(button4);
- layout->addWidget(button5);
-
- window->setLayout(layout);
-//! [4]
- window->setWindowTitle("QHBoxLayout");
-//! [5]
- window->show();
-//! [5]
- }
-
- {
-//! [6]
- QWidget *window = new QWidget;
-//! [6] //! [7]
- QPushButton *button1 = new QPushButton("One");
-//! [7] //! [8]
- QPushButton *button2 = new QPushButton("Two");
- QPushButton *button3 = new QPushButton("Three");
- QPushButton *button4 = new QPushButton("Four");
- QPushButton *button5 = new QPushButton("Five");
-//! [8]
-
-//! [9]
- QVBoxLayout *layout = new QVBoxLayout;
-//! [9] //! [10]
- layout->addWidget(button1);
- layout->addWidget(button2);
- layout->addWidget(button3);
- layout->addWidget(button4);
- layout->addWidget(button5);
-
- window->setLayout(layout);
-//! [10]
- window->setWindowTitle("QVBoxLayout");
-//! [11]
- window->show();
-//! [11]
- }
-
- {
-//! [12]
- QWidget *window = new QWidget;
-//! [12] //! [13]
- QPushButton *button1 = new QPushButton("One");
-//! [13] //! [14]
- QPushButton *button2 = new QPushButton("Two");
- QPushButton *button3 = new QPushButton("Three");
- QPushButton *button4 = new QPushButton("Four");
- QPushButton *button5 = new QPushButton("Five");
-//! [14]
-
-//! [15]
- QGridLayout *layout = new QGridLayout;
-//! [15] //! [16]
- layout->addWidget(button1, 0, 0);
- layout->addWidget(button2, 0, 1);
- layout->addWidget(button3, 1, 0, 1, 2);
- layout->addWidget(button4, 2, 0);
- layout->addWidget(button5, 2, 1);
-
- window->setLayout(layout);
-//! [16]
- window->setWindowTitle("QGridLayout");
-//! [17]
- window->show();
-//! [17]
- }
-
- {
-//! [18]
- QWidget *window = new QWidget;
-//! [18]
-//! [19]
- QPushButton *button1 = new QPushButton("One");
- QLineEdit *lineEdit1 = new QLineEdit();
-//! [19]
-//! [20]
- QPushButton *button2 = new QPushButton("Two");
- QLineEdit *lineEdit2 = new QLineEdit();
- QPushButton *button3 = new QPushButton("Three");
- QLineEdit *lineEdit3 = new QLineEdit();
-//! [20]
-//! [21]
- QFormLayout *layout = new QFormLayout;
-//! [21]
-//! [22]
- layout->addRow(button1, lineEdit1);
- layout->addRow(button2, lineEdit2);
- layout->addRow(button3, lineEdit3);
-
- window->setLayout(layout);
-//! [22]
- window->setWindowTitle("QFormLayout");
-//! [23]
- window->show();
-//! [23]
- }
-
- return app.exec();
-}
diff --git a/doc/src/snippets/mainwindowsnippet.cpp b/doc/src/snippets/mainwindowsnippet.cpp
deleted file mode 100644
index 76305e9ce2..0000000000
--- a/doc/src/snippets/mainwindowsnippet.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-#include "mainwindow.h"
-
-MainWindow::MainWindow()
-{
- createMenus();
- createToolBars();
- createDockWidgets();
- //setMenuWidget(new QPushButton("Hello"));
-}
-
-void MainWindow::createMenus()
-{
- //setMenuWidget(new QPushButton("Hello"));
- QMenu *menu = new QMenu("File");
- menu->addAction("Save &As");
-
- QMenuBar *bar = new QMenuBar;
- bar->addMenu(menu);
-
- setMenuWidget(new QWidget());
-}
-
-void MainWindow::createToolBars()
-{
- setToolButtonStyle(Qt::ToolButtonTextOnly);
- QToolBar *t1 = new QToolBar;
- t1->addAction(new QAction("t1", this));
-
- QToolBar *t2 = new QToolBar;
- t2->addAction(new QAction("t2", this));
-
- addToolBar(Qt::LeftToolBarArea, t1);
- addToolBar(Qt::LeftToolBarArea, t2);
-}
-
-void MainWindow::createDockWidgets()
-{
- QWidget *dockWidgetContents = new QWidget;
- QVBoxLayout *layout = new QVBoxLayout;
- layout->addWidget(new QPushButton("My Button."));
- dockWidgetContents->setLayout(layout);
-
-//! [0]
- QDockWidget *dockWidget = new QDockWidget(tr("Dock Widget"), this);
- dockWidget->setAllowedAreas(Qt::LeftDockWidgetArea |
- Qt::RightDockWidgetArea);
- dockWidget->setWidget(dockWidgetContents);
- addDockWidget(Qt::LeftDockWidgetArea, dockWidget);
-//! [0]
-}
diff --git a/doc/src/snippets/mdiareasnippets.cpp b/doc/src/snippets/mdiareasnippets.cpp
deleted file mode 100644
index 711f25bd83..0000000000
--- a/doc/src/snippets/mdiareasnippets.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-void mainWindowExample()
-{
- QMdiArea *mdiArea = new QMdiArea;
-//! [0]
- QMainWindow *mainWindow = new QMainWindow;
- mainWindow->setCentralWidget(mdiArea);
-//! [0]
-
- mdiArea->addSubWindow(new QPushButton("Push Me Now!"));
-
- mainWindow->show();
-}
-
-void addingSubWindowsExample()
-{
- QWidget *internalWidget1 = new QWidget;
- QWidget *internalWidget2 = new QWidget;
-
-//! [1]
- QMdiArea mdiArea;
- QMdiSubWindow *subWindow1 = new QMdiSubWindow;
- subWindow1->setWidget(internalWidget1);
- subWindow1->setAttribute(Qt::WA_DeleteOnClose);
- mdiArea.addSubWindow(subWindow1);
-
- QMdiSubWindow *subWindow2 =
- mdiArea.addSubWindow(internalWidget2);
-
-//! [1]
- subWindow1->show();
- subWindow2->show();
-
- mdiArea.show();
-}
-
-int main(int argv, char **args)
-{
- QApplication app(argv, args);
-
- mainWindowExample();
- //addingSubWindowsExample();
-
- QAction *act = new QAction(qApp);
- act->setShortcut(Qt::ALT + Qt::Key_S);
- act->setShortcutContext( Qt::ApplicationShortcut );
- QObject::connect(act, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
-
- QWidget widget5;
- widget5.show();
- widget5.addAction(act);
-
- return app.exec();
-}
-
-
diff --git a/doc/src/snippets/myscrollarea.cpp b/doc/src/snippets/myscrollarea.cpp
deleted file mode 100644
index a6a575f922..0000000000
--- a/doc/src/snippets/myscrollarea.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-class MyScrollArea : public QAbstractScrollArea
-{
-public:
- MyScrollArea(QWidget *w);
- void setWidget(QWidget *w);
-
-protected:
- void scrollContentsBy(int dx, int dy);
- void resizeEvent(QResizeEvent *event);
-
-private:
- void updateWidgetPosition();
- void updateArea();
-
- QWidget *widget;
-};
-
-MyScrollArea::MyScrollArea(QWidget *widget)
- : QAbstractScrollArea()
-{
- setWidget(widget);
-}
-
-void MyScrollArea::setWidget(QWidget *w)
-{
- widget = w;
- widget->setParent(viewport());
- if (!widget->testAttribute(Qt::WA_Resized))
- widget->resize(widget->sizeHint());
-
- verticalScrollBar()->setValue(0);
- verticalScrollBar()->setValue(0);
-
- updateArea();
-}
-
-void MyScrollArea::updateWidgetPosition()
-{
-//! [0]
- int hvalue = horizontalScrollBar()->value();
- int vvalue = verticalScrollBar()->value();
- QPoint topLeft = viewport()->rect().topLeft();
-
- widget->move(topLeft.x() - hvalue, topLeft.y() - vvalue);
-//! [0]
-}
-
-void MyScrollArea::scrollContentsBy(int /*dx*/, int /*dy*/)
-{
- updateWidgetPosition();
-}
-
-void MyScrollArea::updateArea()
-{
-//! [1]
- QSize areaSize = viewport()->size();
- QSize widgetSize = widget->size();
-
- verticalScrollBar()->setPageStep(areaSize.height());
- horizontalScrollBar()->setPageStep(areaSize.width());
- verticalScrollBar()->setRange(0, widgetSize.height() - areaSize.height());
- horizontalScrollBar()->setRange(0, widgetSize.width() - areaSize.width());
- updateWidgetPosition();
-//! [1]
-}
-
-void MyScrollArea::resizeEvent(QResizeEvent *event)
-{
- updateArea();
-}
-
-int main(int argv, char **args)
-{
- QApplication app(argv, args);
-
- QPixmap pixmap("mypixmap.png");
- QLabel label;
- label.setPixmap(pixmap);
- MyScrollArea area(&label);
- area.resize(300, 300);
- area.show();
-
- area.setWidget(&label);
-
- return app.exec();
-}
diff --git a/doc/src/snippets/qlistwidget-using/mainwindow.cpp b/doc/src/snippets/qlistwidget-using/mainwindow.cpp
deleted file mode 100644
index 8e30f7979b..0000000000
--- a/doc/src/snippets/qlistwidget-using/mainwindow.cpp
+++ /dev/null
@@ -1,158 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-#include "mainwindow.h"
-
-MainWindow::MainWindow()
-{
- QMenu *fileMenu = new QMenu(tr("&File"));
-
- QAction *quitAction = fileMenu->addAction(tr("E&xit"));
- quitAction->setShortcut(tr("Ctrl+Q"));
-
- QMenu *itemsMenu = new QMenu(tr("&Items"));
-
- insertAction = itemsMenu->addAction(tr("&Insert Item"));
- removeAction = itemsMenu->addAction(tr("&Remove Item"));
- QAction *ascendingAction = itemsMenu->addAction(tr("Sort in &Ascending Order"));
- QAction *descendingAction = itemsMenu->addAction(tr("Sort in &Descending Order"));
-
- menuBar()->addMenu(fileMenu);
- menuBar()->addMenu(itemsMenu);
-
-/* For convenient quoting:
-//! [0]
- QListWidget *listWidget = new QListWidget(this);
-//! [0]
-*/
- listWidget = new QListWidget(this);
- listWidget->setSelectionMode(QAbstractItemView::SingleSelection);
-
- connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));
- connect(ascendingAction, SIGNAL(triggered()), this, SLOT(sortAscending()));
- connect(descendingAction, SIGNAL(triggered()), this, SLOT(sortDescending()));
- connect(insertAction, SIGNAL(triggered()), this, SLOT(insertItem()));
- connect(removeAction, SIGNAL(triggered()), this, SLOT(removeItem()));
- connect(listWidget,
- SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)),
- this, SLOT(updateMenus(QListWidgetItem *)));
-
- setupListItems();
- updateMenus(listWidget->currentItem());
-
- setCentralWidget(listWidget);
- setWindowTitle(tr("List Widget"));
-}
-
-void MainWindow::setupListItems()
-{
-//! [1]
- new QListWidgetItem(tr("Oak"), listWidget);
- new QListWidgetItem(tr("Fir"), listWidget);
- new QListWidgetItem(tr("Pine"), listWidget);
-//! [1]
- new QListWidgetItem(tr("Birch"), listWidget);
-//! [2]
- new QListWidgetItem(tr("Hazel"), listWidget);
-//! [2]
- new QListWidgetItem(tr("Redwood"), listWidget);
-//! [3]
- new QListWidgetItem(tr("Sycamore"), listWidget);
- new QListWidgetItem(tr("Chestnut"), listWidget);
- new QListWidgetItem(tr("Mahogany"), listWidget);
-//! [3]
-}
-
-void MainWindow::sortAscending()
-{
-//! [4]
- listWidget->sortItems(Qt::AscendingOrder);
-//! [4]
-}
-
-void MainWindow::sortDescending()
-{
-//! [5]
- listWidget->sortItems(Qt::DescendingOrder);
-//! [5]
-}
-
-void MainWindow::insertItem()
-{
- if (!listWidget->currentItem())
- return;
-
- QString itemText = QInputDialog::getText(this, tr("Insert Item"),
- tr("Input text for the new item:"));
-
- if (itemText.isNull())
- return;
-
-//! [6]
- QListWidgetItem *newItem = new QListWidgetItem;
- newItem->setText(itemText);
-//! [6]
- int row = listWidget->row(listWidget->currentItem());
-//! [7]
- listWidget->insertItem(row, newItem);
-//! [7]
-
- QString toolTipText = tr("Tooltip:") + itemText;
- QString statusTipText = tr("Status tip:") + itemText;
- QString whatsThisText = tr("What's This?:") + itemText;
-//! [8]
- newItem->setToolTip(toolTipText);
- newItem->setStatusTip(toolTipText);
- newItem->setWhatsThis(whatsThisText);
-//! [8]
-}
-
-void MainWindow::removeItem()
-{
- listWidget->takeItem(listWidget->row(listWidget->currentItem()));
-}
-
-void MainWindow::updateMenus(QListWidgetItem *current)
-{
- insertAction->setEnabled(current != 0);
- removeAction->setEnabled(current != 0);
-}
diff --git a/doc/src/snippets/qmacnativewidget/main.mm b/doc/src/snippets/qmacnativewidget/main.mm
deleted file mode 100644
index 2c5c49769a..0000000000
--- a/doc/src/snippets/qmacnativewidget/main.mm
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui/QtGui>
-#include <QtGui/qmacnativewidget_mac.h>
-#import <Cocoa/Cocoa.h>
-
-int main(int argc, char **argv)
-{
- QApplication app(argc, argv);
-//![0]
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- NSWindow *window = [[NSWindow alloc] initWithContentRect:NSMakeRect(200, app.desktop()->height() - 200, 239, 200)
- styleMask:NSTitledWindowMask | NSClosableWindowMask
- | NSMiniaturizableWindowMask | NSResizableWindowMask
- backing:NSBackingStoreBuffered defer:NO];
-
- QMacNativeWidget *nativeWidget = new QMacNativeWidget();
- nativeWidget->move(0, 0);
- nativeWidget->setPalette(QPalette(Qt::red));
- nativeWidget->setAutoFillBackground(true);
- QVBoxLayout *layout = new QVBoxLayout();
- QPushButton *pushButton = new QPushButton("An Embedded Qt Button!", nativeWidget);
- pushButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); // Don't use the layout rect calculated from QMacStyle.
- layout->addWidget(pushButton);
- nativeWidget->setLayout(layout);
-
- // Adjust Cocoa layouts
- NSView *nativeWidgetView = reinterpret_cast<NSView *>(nativeWidget->winId());
- NSView *contentView = [window contentView];
- [contentView setAutoresizesSubviews:YES];
- [nativeWidgetView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
- [nativeWidgetView setAutoresizesSubviews:YES];
- NSView *pushButtonView = reinterpret_cast<NSView *>(pushButton->winId());
- [pushButtonView setAutoresizingMask:NSViewWidthSizable];
-
- // Add the nativeWidget to the window.
- [contentView addSubview:nativeWidgetView positioned:NSWindowAbove relativeTo:nil];
- nativeWidget->show();
- pushButton->show();
-
- // Show the window.
- [window makeKeyAndOrderFront:window];
- [pool release];
-//![0]
- return app.exec(); // gives us the same behavior in both
-}
diff --git a/doc/src/snippets/qsplashscreen/main.cpp b/doc/src/snippets/qsplashscreen/main.cpp
deleted file mode 100644
index 49bc084412..0000000000
--- a/doc/src/snippets/qsplashscreen/main.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-#include <stdlib.h>
-
-#include "mainwindow.h"
-
-//! [0]
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- QPixmap pixmap(":/splash.png");
- QSplashScreen splash(pixmap);
- splash.show();
- app.processEvents();
-//! [0]
-
- sleep(5);
-//! [1]
- QMainWindow window;
- window.show();
- splash.finish(&window);
- return app.exec();
-}
-//! [1]
diff --git a/doc/src/snippets/qstackedlayout/main.cpp b/doc/src/snippets/qstackedlayout/main.cpp
deleted file mode 100644
index 771c36c721..0000000000
--- a/doc/src/snippets/qstackedlayout/main.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-#include <QApplication>
-
-class Widget : public QWidget
-{
-public:
- Widget(QWidget *parent = 0);
-};
-
-Widget::Widget(QWidget *parent)
- : QWidget(parent)
-{
-//! [0]
- QWidget *firstPageWidget = new QWidget;
- QWidget *secondPageWidget = new QWidget;
- QWidget *thirdPageWidget = new QWidget;
-
- QStackedLayout *stackedLayout = new QStackedLayout;
- stackedLayout->addWidget(firstPageWidget);
- stackedLayout->addWidget(secondPageWidget);
- stackedLayout->addWidget(thirdPageWidget);
-
-//! [0] //! [1]
- QComboBox *pageComboBox = new QComboBox;
- pageComboBox->addItem(tr("Page 1"));
- pageComboBox->addItem(tr("Page 2"));
- pageComboBox->addItem(tr("Page 3"));
- connect(pageComboBox, SIGNAL(activated(int)),
- stackedLayout, SLOT(setCurrentIndex(int)));
-//! [1]
-
-//! [2]
- QVBoxLayout *mainLayout = new QVBoxLayout;
-//! [2]
- mainLayout->addWidget(pageComboBox);
-//! [3]
- mainLayout->addLayout(stackedLayout);
- setLayout(mainLayout);
-//! [3]
-}
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- Widget widget;
- widget.show();
- return app.exec();
-}
-
diff --git a/doc/src/snippets/qstackedwidget/main.cpp b/doc/src/snippets/qstackedwidget/main.cpp
deleted file mode 100644
index 9a29d773e6..0000000000
--- a/doc/src/snippets/qstackedwidget/main.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-#include <QApplication>
-
-class Widget : public QWidget
-{
-public:
- Widget(QWidget *parent = 0);
-};
-
-Widget::Widget(QWidget *parent)
- : QWidget(parent)
-{
-//! [0]
- QWidget *firstPageWidget = new QWidget;
- QWidget *secondPageWidget = new QWidget;
- QWidget *thirdPageWidget = new QWidget;
-
- QStackedWidget *stackedWidget = new QStackedWidget;
- stackedWidget->addWidget(firstPageWidget);
- stackedWidget->addWidget(secondPageWidget);
- stackedWidget->addWidget(thirdPageWidget);
-
-//! [0] //! [1]
- QComboBox *pageComboBox = new QComboBox;
- pageComboBox->addItem(tr("Page 1"));
- pageComboBox->addItem(tr("Page 2"));
- pageComboBox->addItem(tr("Page 3"));
- connect(pageComboBox, SIGNAL(activated(int)),
- stackedWidget, SLOT(setCurrentIndex(int)));
-
-//! [1] //! [2]
- QVBoxLayout *layout = new QVBoxLayout;
-//! [2]
- layout->addWidget(pageComboBox);
-//! [3]
- layout->addWidget(stackedWidget);
- setLayout(layout);
-//! [3]
-}
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- Widget widget;
- widget.show();
- return app.exec();
-}
diff --git a/doc/src/snippets/qstyleoption/main.cpp b/doc/src/snippets/qstyleoption/main.cpp
deleted file mode 100644
index 78f663012c..0000000000
--- a/doc/src/snippets/qstyleoption/main.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-#include <QApplication>
-
-class MyPushButton : public QPushButton
-{
-public:
- MyPushButton(QWidget *parent = 0);
-
- void paintEvent(QPaintEvent *);
-};
-
-MyPushButton::MyPushButton(QWidget *parent)
- : QPushButton(parent)
-{
-}
-
-//! [0]
-void MyPushButton::paintEvent(QPaintEvent *)
-{
- QStyleOptionButton option;
- option.initFrom(this);
- option.state = isDown() ? QStyle::State_Sunken : QStyle::State_Raised;
- if (isDefault())
- option.features |= QStyleOptionButton::DefaultButton;
- option.text = text();
- option.icon = icon();
-
- QPainter painter(this);
- style()->drawControl(QStyle::CE_PushButton, &option, &painter, this);
-}
-//! [0]
-
-
-
-class MyStyle : public QStyle
-{
-public:
- MyStyle();
-
- void drawPrimitive(PrimitiveElement element, const QStyleOption *option,
- QPainter *painter, const QWidget *widget);
-};
-
-MyStyle::MyStyle()
-{
-//! [1]
- QStyleOptionFrame *option;
-
- if (const QStyleOptionFrame *frameOption =
- qstyleoption_cast<const QStyleOptionFrame *>(option)) {
- QStyleOptionFrameV2 frameOptionV2(*frameOption);
-
- // draw the frame using frameOptionV2
- }
-//! [1]
-
-//! [2]
- if (const QStyleOptionProgressBar *progressBarOption =
- qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
- QStyleOptionProgressBarV2 progressBarV2(*progressBarOption);
-
- // draw the progress bar using progressBarV2
- }
-//! [2]
-
-//! [3]
- if (const QStyleOptionTab *tabOption =
- qstyleoption_cast<const QStyleOptionTab *>(option)) {
- QStyleOptionTabV2 tabV2(*tabOption);
-
- // draw the tab using tabV2
- }
-//! [3]
-}
-
-//! [4]
-void MyStyle::drawPrimitive(PrimitiveElement element,
- const QStyleOption *option,
- QPainter *painter,
- const QWidget *widget)
-{
- if (element == PE_FrameFocusRect) {
- const QStyleOptionFocusRect *focusRectOption =
- qstyleoption_cast<const QStyleOptionFocusRect *>(option);
- if (focusRectOption) {
- // ...
- }
- }
- // ...
-}
-//! [4]
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- MyPushButton button;
- button.show();
- return app.exec();
-}
diff --git a/doc/src/snippets/qstyleplugin/main.cpp b/doc/src/snippets/qstyleplugin/main.cpp
deleted file mode 100644
index 10a122016f..0000000000
--- a/doc/src/snippets/qstyleplugin/main.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QApplication>
-#include <QtGui>
-
-class MyStylePlugin : public QStylePlugin
-{
-public:
- MyStylePlugin(QObject *parent = 0);
-
- QStyle *create(const QString &key);
- QStringList keys() const;
-};
-
-class RocketStyle : public QCommonStyle
-{
-public:
- RocketStyle() {};
-
-};
-
-class StarBusterStyle : public QCommonStyle
-{
-public:
- StarBusterStyle() {};
-};
-
-MyStylePlugin::MyStylePlugin(QObject *parent)
- : QStylePlugin(parent)
-{
-}
-
-//! [0]
-QStringList MyStylePlugin::keys() const
-{
- return QStringList() << "Rocket" << "StarBuster";
-}
-//! [0]
-
-//! [1]
-QStyle *MyStylePlugin::create(const QString &key)
-{
- QString lcKey = key;
- if (lcKey == "rocket") {
- return new RocketStyle;
- } else if (lcKey == "starbuster") {
- return new StarBusterStyle;
- }
- return 0;
-//! [1] //! [2]
-}
-//! [2]
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- MyStylePlugin plugin;
- return app.exec();
-}
diff --git a/doc/src/snippets/qtablewidget-resizing/mainwindow.cpp b/doc/src/snippets/qtablewidget-resizing/mainwindow.cpp
deleted file mode 100644
index f3ab01784e..0000000000
--- a/doc/src/snippets/qtablewidget-resizing/mainwindow.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-#include "mainwindow.h"
-
-MainWindow::MainWindow()
-{
- QMenu *fileMenu = new QMenu(tr("&File"));
-
- QAction *quitAction = fileMenu->addAction(tr("E&xit"));
- quitAction->setShortcut(tr("Ctrl+Q"));
-
- QMenu *tableMenu = new QMenu(tr("&Table"));
-
- QAction *tableWidthAction = tableMenu->addAction(tr("Change Table &Width"));
- QAction *tableHeightAction = tableMenu->addAction(tr("Change Table &Height"));
-
- menuBar()->addMenu(fileMenu);
- menuBar()->addMenu(tableMenu);
-
-//! [0]
- tableWidget = new QTableWidget(this);
-//! [0]
- tableWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
-
- connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));
- connect(tableWidthAction, SIGNAL(triggered()), this, SLOT(changeWidth()));
- connect(tableHeightAction, SIGNAL(triggered()), this, SLOT(changeHeight()));
-
- setupTableItems();
-
- setCentralWidget(tableWidget);
- setWindowTitle(tr("Table Widget Resizing"));
-}
-
-void MainWindow::setupTableItems()
-{
-//! [1]
- tableWidget->setRowCount(10);
- tableWidget->setColumnCount(5);
-//! [1]
-
- for (int row = 0; row < tableWidget->rowCount(); ++row) {
- for (int column = 0; column < tableWidget->columnCount(); ++column) {
-//! [2]
- QTableWidgetItem *newItem = new QTableWidgetItem(tr("%1").arg(
- (row+1)*(column+1)));
- tableWidget->setItem(row, column, newItem);
-//! [2]
- }
- }
-}
-
-void MainWindow::changeWidth()
-{
- bool ok;
-
- int newWidth = QInputDialog::getInteger(this, tr("Change table width"),
- tr("Input the number of columns required (1-20):"),
- tableWidget->columnCount(), 1, 20, 1, &ok);
-
- if (ok)
- tableWidget->setColumnCount(newWidth);
-}
-
-void MainWindow::changeHeight()
-{
- bool ok;
-
- int newHeight = QInputDialog::getInteger(this, tr("Change table height"),
- tr("Input the number of rows required (1-20):"),
- tableWidget->rowCount(), 1, 20, 1, &ok);
-
- if (ok)
- tableWidget->setRowCount(newHeight);
-}
diff --git a/doc/src/snippets/qtablewidget-using/mainwindow.cpp b/doc/src/snippets/qtablewidget-using/mainwindow.cpp
deleted file mode 100644
index b03a5e4999..0000000000
--- a/doc/src/snippets/qtablewidget-using/mainwindow.cpp
+++ /dev/null
@@ -1,150 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-#include "math.h"
-
-#include "mainwindow.h"
-
-MainWindow::MainWindow()
-{
- QMenu *fileMenu = new QMenu(tr("&File"));
-
- QAction *quitAction = fileMenu->addAction(tr("E&xit"));
- quitAction->setShortcut(tr("Ctrl+Q"));
-
- QMenu *itemsMenu = new QMenu(tr("&Items"));
-
- QAction *sumItemsAction = itemsMenu->addAction(tr("&Sum Items"));
- QAction *averageItemsAction = itemsMenu->addAction(tr("&Average Items"));
-
- menuBar()->addMenu(fileMenu);
- menuBar()->addMenu(itemsMenu);
-
-//! [0]
- tableWidget = new QTableWidget(12, 3, this);
-//! [0]
- tableWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
-
-//! [1]
- QTableWidgetItem *valuesHeaderItem = new QTableWidgetItem(tr("Values"));
- tableWidget->setHorizontalHeaderItem(0, valuesHeaderItem);
-//! [1]
- valuesHeaderItem->setTextAlignment(Qt::AlignVCenter);
- QTableWidgetItem *squaresHeaderItem = new QTableWidgetItem(tr("Squares"));
- squaresHeaderItem->setIcon(QIcon(QPixmap(":/Images/squared.png")));
- squaresHeaderItem->setTextAlignment(Qt::AlignVCenter);
-//! [2]
- QTableWidgetItem *cubesHeaderItem = new QTableWidgetItem(tr("Cubes"));
- cubesHeaderItem->setIcon(QIcon(QPixmap(":/Images/cubed.png")));
- cubesHeaderItem->setTextAlignment(Qt::AlignVCenter);
-//! [2]
- tableWidget->setHorizontalHeaderItem(1, squaresHeaderItem);
- tableWidget->setHorizontalHeaderItem(2, cubesHeaderItem);
-
- connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));
- connect(sumItemsAction, SIGNAL(triggered()), this, SLOT(sumItems()));
- connect(averageItemsAction, SIGNAL(triggered()), this, SLOT(averageItems()));
-
- setupTableItems();
-
- setCentralWidget(tableWidget);
- setWindowTitle(tr("Table Widget"));
-}
-
-void MainWindow::setupTableItems()
-{
- for (int row = 0; row < tableWidget->rowCount()-1; ++row) {
- for (int column = 0; column < tableWidget->columnCount(); ++column) {
-//! [3]
- QTableWidgetItem *newItem = new QTableWidgetItem(tr("%1").arg(
- pow(row, column+1)));
- tableWidget->setItem(row, column, newItem);
-//! [3]
- }
- }
- for (int column = 0; column < tableWidget->columnCount(); ++column) {
- QTableWidgetItem *newItem = new QTableWidgetItem;
- newItem->setFlags(Qt::ItemIsEnabled);
- tableWidget->setItem(tableWidget->rowCount()-1, column, newItem);
- }
-}
-
-void MainWindow::averageItems()
-{
- QList<QTableWidgetItem *> selected = tableWidget->selectedItems();
- QTableWidgetItem *item;
- int number = 0;
- double total = 0;
-
- foreach (item, selected) {
- bool ok;
- double value = item->text().toDouble(&ok);
-
- if (ok && !item->text().isEmpty()) {
- total += value;
- number++;
- }
- }
- if (number > 0)
- tableWidget->currentItem()->setText(QString::number(total/number));
-}
-
-void MainWindow::sumItems()
-{
-//! [4]
- QList<QTableWidgetItem *> selected = tableWidget->selectedItems();
- QTableWidgetItem *item;
- int number = 0;
- double total = 0;
-
- foreach (item, selected) {
- bool ok;
- double value = item->text().toDouble(&ok);
-
- if (ok && !item->text().isEmpty()) {
- total += value;
- number++;
- }
- }
-//! [4]
- if (number > 0)
- tableWidget->currentItem()->setText(QString::number(total));
-}
diff --git a/doc/src/snippets/qtreewidget-using/mainwindow.cpp b/doc/src/snippets/qtreewidget-using/mainwindow.cpp
deleted file mode 100644
index 2a62c3e5f8..0000000000
--- a/doc/src/snippets/qtreewidget-using/mainwindow.cpp
+++ /dev/null
@@ -1,230 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-#include "mainwindow.h"
-
-MainWindow::MainWindow()
-{
- QMenu *fileMenu = new QMenu(tr("&File"));
-
- QAction *quitAction = fileMenu->addAction(tr("E&xit"));
- quitAction->setShortcut(tr("Ctrl+Q"));
-
- QMenu *itemsMenu = new QMenu(tr("&Items"));
-
- insertAction = itemsMenu->addAction(tr("&Insert Item"));
- removeAction = itemsMenu->addAction(tr("&Remove Item"));
- removeAction->setEnabled(false);
- itemsMenu->addSeparator();
- ascendingAction = itemsMenu->addAction(tr("Sort in &Ascending Order"));
- descendingAction = itemsMenu->addAction(tr("Sort in &Descending Order"));
- autoSortAction = itemsMenu->addAction(tr("&Automatically Sort Items"));
- autoSortAction->setCheckable(true);
- itemsMenu->addSeparator();
- QAction *findItemsAction = itemsMenu->addAction(tr("&Find Items"));
- findItemsAction->setShortcut(tr("Ctrl+F"));
-
- menuBar()->addMenu(fileMenu);
- menuBar()->addMenu(itemsMenu);
-
-/* For convenient quoting:
-//! [0]
- QTreeWidget *treeWidget = new QTreeWidget(this);
-//! [0]
-*/
- treeWidget = new QTreeWidget(this);
-//! [1]
- treeWidget->setColumnCount(2);
-//! [1] //! [2]
- QStringList headers;
- headers << tr("Subject") << tr("Default");
- treeWidget->setHeaderLabels(headers);
-//! [2]
-
- connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));
- connect(ascendingAction, SIGNAL(triggered()), this, SLOT(sortAscending()));
- connect(autoSortAction, SIGNAL(triggered()), this, SLOT(updateSortItems()));
- connect(descendingAction, SIGNAL(triggered()), this, SLOT(sortDescending()));
- connect(findItemsAction, SIGNAL(triggered()), this, SLOT(findItems()));
- connect(insertAction, SIGNAL(triggered()), this, SLOT(insertItem()));
- connect(removeAction, SIGNAL(triggered()), this, SLOT(removeItem()));
- connect(treeWidget,
- SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
- this, SLOT(updateMenus(QTreeWidgetItem *)));
-
- setupTreeItems();
- updateMenus(treeWidget->currentItem());
-
- setCentralWidget(treeWidget);
- setWindowTitle(tr("Tree Widget"));
-}
-
-void MainWindow::setupTreeItems()
-{
-//! [3]
- QTreeWidgetItem *cities = new QTreeWidgetItem(treeWidget);
- cities->setText(0, tr("Cities"));
- QTreeWidgetItem *osloItem = new QTreeWidgetItem(cities);
- osloItem->setText(0, tr("Oslo"));
- osloItem->setText(1, tr("Yes"));
-//! [3]
-
- (new QTreeWidgetItem(cities))->setText(0, tr("Stockholm"));
- (new QTreeWidgetItem(cities))->setText(0, tr("Helsinki"));
- (new QTreeWidgetItem(cities))->setText(0, tr("Copenhagen"));
-
-//! [4] //! [5]
- QTreeWidgetItem *planets = new QTreeWidgetItem(treeWidget, cities);
-//! [4]
- planets->setText(0, tr("Planets"));
-//! [5]
- (new QTreeWidgetItem(planets))->setText(0, tr("Mercury"));
- (new QTreeWidgetItem(planets))->setText(0, tr("Venus"));
-
- QTreeWidgetItem *earthItem = new QTreeWidgetItem(planets);
- earthItem->setText(0, tr("Earth"));
- earthItem->setText(1, tr("Yes"));
-
- (new QTreeWidgetItem(planets))->setText(0, tr("Mars"));
- (new QTreeWidgetItem(planets))->setText(0, tr("Jupiter"));
- (new QTreeWidgetItem(planets))->setText(0, tr("Saturn"));
- (new QTreeWidgetItem(planets))->setText(0, tr("Uranus"));
- (new QTreeWidgetItem(planets))->setText(0, tr("Neptune"));
- (new QTreeWidgetItem(planets))->setText(0, tr("Pluto"));
-}
-
-void MainWindow::findItems()
-{
- QString itemText = QInputDialog::getText(this, tr("Find Items"),
- tr("Text to find (including wildcards):"));
-
- if (itemText.isEmpty())
- return;
-
-//! [6]
- QTreeWidgetItem *item;
-//! [6]
- foreach (item, treeWidget->selectedItems())
- treeWidget->setItemSelected(item, false);
-
-//! [7]
- QList<QTreeWidgetItem *> found = treeWidget->findItems(
- itemText, Qt::MatchWildcard);
-
- foreach (item, found) {
- treeWidget->setItemSelected(item, true);
- // Show the item->text(0) for each item.
- }
-//! [7]
-}
-
-void MainWindow::insertItem()
-{
- QTreeWidgetItem *currentItem = treeWidget->currentItem();
-
- if (!currentItem)
- return;
-
- QString itemText = QInputDialog::getText(this, tr("Insert Item"),
- tr("Input text for the new item:"));
-
- if (itemText.isEmpty())
- return;
-
-//! [8]
- QTreeWidgetItem *parent = currentItem->parent();
- QTreeWidgetItem *newItem;
- if (parent)
- newItem = new QTreeWidgetItem(parent, treeWidget->currentItem());
- else
-//! [8] //! [9]
- newItem = new QTreeWidgetItem(treeWidget, treeWidget->currentItem());
-//! [9]
-
- newItem->setText(0, itemText);
-}
-
-void MainWindow::removeItem()
-{
- QTreeWidgetItem *currentItem = treeWidget->currentItem();
-
- if (!currentItem)
- return;
-
-//! [10]
- QTreeWidgetItem *parent = currentItem->parent();
- int index;
-
- if (parent) {
- index = parent->indexOfChild(treeWidget->currentItem());
- delete parent->takeChild(index);
- } else {
- index = treeWidget->indexOfTopLevelItem(treeWidget->currentItem());
- delete treeWidget->takeTopLevelItem(index);
-//! [10] //! [11]
- }
-//! [11]
-}
-
-void MainWindow::sortAscending()
-{
- treeWidget->sortItems(0, Qt::AscendingOrder);
-}
-
-void MainWindow::sortDescending()
-{
- treeWidget->sortItems(0, Qt::DescendingOrder);
-}
-
-void MainWindow::updateMenus(QTreeWidgetItem *current)
-{
- insertAction->setEnabled(current != 0);
- removeAction->setEnabled(current != 0);
-}
-
-void MainWindow::updateSortItems()
-{
- ascendingAction->setEnabled(!autoSortAction->isChecked());
- descendingAction->setEnabled(!autoSortAction->isChecked());
-
- treeWidget->setSortingEnabled(autoSortAction->isChecked());
-}
diff --git a/doc/src/snippets/qtreewidgetitemiterator-using/mainwindow.cpp b/doc/src/snippets/qtreewidgetitemiterator-using/mainwindow.cpp
deleted file mode 100644
index a0648b18c5..0000000000
--- a/doc/src/snippets/qtreewidgetitemiterator-using/mainwindow.cpp
+++ /dev/null
@@ -1,197 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-#include "mainwindow.h"
-
-MainWindow::MainWindow()
-{
- QMenu *fileMenu = new QMenu(tr("&File"));
-
- QAction *quitAction = fileMenu->addAction(tr("E&xit"));
- quitAction->setShortcut(tr("Ctrl+Q"));
-
- QMenu *itemsMenu = new QMenu(tr("&Items"));
-
- insertAction = itemsMenu->addAction(tr("&Insert Item"));
- removeAction = itemsMenu->addAction(tr("&Remove Item"));
- removeAction->setEnabled(false);
- itemsMenu->addSeparator();
- ascendingAction = itemsMenu->addAction(tr("Sort in &Ascending Order"));
- descendingAction = itemsMenu->addAction(tr("Sort in &Descending Order"));
- autoSortAction = itemsMenu->addAction(tr("&Automatically Sort Items"));
- autoSortAction->setCheckable(true);
- itemsMenu->addSeparator();
- QAction *findItemsAction = itemsMenu->addAction(tr("&Find Items"));
- findItemsAction->setShortcut(tr("Ctrl+F"));
-
- menuBar()->addMenu(fileMenu);
- menuBar()->addMenu(itemsMenu);
-
-/* For convenient quoting:
- QTreeWidget *treeWidget = new QTreeWidget(this);
-*/
- treeWidget = new QTreeWidget(this);
- treeWidget->setColumnCount(2);
- QStringList headers;
- headers << tr("Subject") << tr("Default");
- treeWidget->setHeaderLabels(headers);
-
- connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));
- connect(ascendingAction, SIGNAL(triggered()), this, SLOT(sortAscending()));
- connect(autoSortAction, SIGNAL(triggered()), this, SLOT(updateSortItems()));
- connect(descendingAction, SIGNAL(triggered()), this, SLOT(sortDescending()));
- connect(findItemsAction, SIGNAL(triggered()), this, SLOT(findItems()));
- connect(insertAction, SIGNAL(triggered()), this, SLOT(insertItem()));
- connect(removeAction, SIGNAL(triggered()), this, SLOT(removeItem()));
- connect(treeWidget,
- SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
- this, SLOT(updateMenus(QTreeWidgetItem *)));
-
- setupTreeItems();
- updateMenus(treeWidget->currentItem());
-
- setCentralWidget(treeWidget);
- setWindowTitle(tr("Tree Widget"));
-}
-
-void MainWindow::setupTreeItems()
-{
- QTreeWidgetItem *planets = new QTreeWidgetItem(treeWidget);
- planets->setText(0, tr("Planets"));
- (new QTreeWidgetItem(planets))->setText(0, tr("Mercury"));
- (new QTreeWidgetItem(planets))->setText(0, tr("Venus"));
-
- QTreeWidgetItem *earthItem = new QTreeWidgetItem(planets);
- earthItem->setText(0, tr("Earth"));
- earthItem->setText(1, tr("Yes"));
-
- (new QTreeWidgetItem(planets))->setText(0, tr("Mars"));
- (new QTreeWidgetItem(planets))->setText(0, tr("Jupiter"));
- (new QTreeWidgetItem(planets))->setText(0, tr("Saturn"));
- (new QTreeWidgetItem(planets))->setText(0, tr("Uranus"));
- (new QTreeWidgetItem(planets))->setText(0, tr("Neptune"));
- (new QTreeWidgetItem(planets))->setText(0, tr("Pluto"));
-}
-
-void MainWindow::findItems()
-{
- QString itemText = QInputDialog::getText(this, tr("Find Items"),
- tr("Text to find:"));
-
- if (itemText.isEmpty())
- return;
-
-//! [0]
- QTreeWidgetItemIterator it(treeWidget);
- while (*it) {
- if ((*it)->text(0) == itemText)
- (*it)->setSelected(true);
- ++it;
- }
-//! [0]
-}
-
-void MainWindow::insertItem()
-{
- QTreeWidgetItem *currentItem = treeWidget->currentItem();
-
- if (!currentItem)
- return;
-
- QString itemText = QInputDialog::getText(this, tr("Insert Item"),
- tr("Input text for the new item:"));
-
- if (itemText.isEmpty())
- return;
-
- QTreeWidgetItem *parent = currentItem->parent();
- QTreeWidgetItem *newItem;
- if (parent)
- newItem = new QTreeWidgetItem(parent, treeWidget->currentItem());
- else
- newItem = new QTreeWidgetItem(treeWidget, treeWidget->currentItem());
-
- newItem->setText(0, itemText);
-}
-
-void MainWindow::removeItem()
-{
- QTreeWidgetItem *currentItem = treeWidget->currentItem();
-
- if (!currentItem)
- return;
-
- QTreeWidgetItem *parent = currentItem->parent();
- int index;
-
- if (parent) {
- index = parent->indexOfChild(treeWidget->currentItem());
- delete parent->takeChild(index);
- } else {
- index = treeWidget->indexOfTopLevelItem(treeWidget->currentItem());
- delete treeWidget->takeTopLevelItem(index);
- }
-}
-
-void MainWindow::sortAscending()
-{
- treeWidget->sortItems(0, Qt::AscendingOrder);
-}
-
-void MainWindow::sortDescending()
-{
- treeWidget->sortItems(0, Qt::DescendingOrder);
-}
-
-void MainWindow::updateMenus(QTreeWidgetItem *current)
-{
- insertAction->setEnabled(current != 0);
- removeAction->setEnabled(current != 0);
-}
-
-void MainWindow::updateSortItems()
-{
- ascendingAction->setEnabled(!autoSortAction->isChecked());
- descendingAction->setEnabled(!autoSortAction->isChecked());
-
- treeWidget->setSortingEnabled(autoSortAction->isChecked());
-}
diff --git a/doc/src/snippets/shareddirmodel/main.cpp b/doc/src/snippets/shareddirmodel/main.cpp
deleted file mode 100644
index 78d439b752..0000000000
--- a/doc/src/snippets/shareddirmodel/main.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*
- main.cpp
-
- A simple example of how to view a model in several views, and share a
- selection model.
-*/
-
-#include <QtGui>
-
-//! [0] //! [1]
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
- QSplitter *splitter = new QSplitter;
-
-//! [2] //! [3]
- QFileSystemModel *model = new QFileSystemModel;
- model->setRootPath(QDir::currentPath());
-//! [0] //! [2] //! [4] //! [5]
- QTreeView *tree = new QTreeView(splitter);
-//! [3] //! [6]
- tree->setModel(model);
-//! [4] //! [6] //! [7]
- tree->setRootIndex(model->index(QDir::currentPath()));
-//! [7]
-
- QListView *list = new QListView(splitter);
- list->setModel(model);
- list->setRootIndex(model->index(QDir::currentPath()));
-
-//! [5]
- QItemSelectionModel *selection = new QItemSelectionModel(model);
- tree->setSelectionModel(selection);
- list->setSelectionModel(selection);
-
-//! [8]
- splitter->setWindowTitle("Two views onto the same file system model");
- splitter->show();
- return app.exec();
-}
-//! [1] //! [8]
diff --git a/doc/src/snippets/splitter/splitter.cpp b/doc/src/snippets/splitter/splitter.cpp
deleted file mode 100644
index 3908f1b0e3..0000000000
--- a/doc/src/snippets/splitter/splitter.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-void processSize(int)
-{
-}
-
-int main()
-{
- QWidget *parent = 0;
-
-//! [0]
- QSplitter *splitter = new QSplitter(parent);
- QListView *listview = new QListView;
- QTreeView *treeview = new QTreeView;
- QTextEdit *textedit = new QTextEdit;
- splitter->addWidget(listview);
- splitter->addWidget(treeview);
- splitter->addWidget(textedit);
-//! [0]
-
- {
- // SAVE STATE
-//! [1]
- QSettings settings;
- settings.setValue("splitterSizes", splitter->saveState());
-//! [1]
- }
-
- {
- // RESTORE STATE
-//! [2]
- QSettings settings;
- splitter->restoreState(settings.value("splitterSizes").toByteArray());
-//! [2]
- }
-
-//! [3]
- QListIterator<int> it(splitter->sizes());
- while (it.hasNext())
- processSize(it.next());
-//! [3]
-
- return 0;
-}
diff --git a/doc/src/snippets/splitterhandle/splitter.cpp b/doc/src/snippets/splitterhandle/splitter.cpp
deleted file mode 100644
index b8b729bb91..0000000000
--- a/doc/src/snippets/splitterhandle/splitter.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-#include "splitter.h"
-
-SplitterHandle::SplitterHandle(Qt::Orientation orientation, QSplitter *parent)
- : QSplitterHandle(orientation, parent)
-{
- gradient.setColorAt(0.0, Qt::darkGreen);
- gradient.setColorAt(0.25, Qt::white);
- gradient.setColorAt(1.0, Qt::darkGreen);
-}
-
-//! [0]
-void SplitterHandle::paintEvent(QPaintEvent *event)
-{
- QPainter painter(this);
- if (orientation() == Qt::Horizontal) {
- gradient.setStart(rect().left(), rect().height()/2);
- gradient.setFinalStop(rect().right(), rect().height()/2);
- } else {
- gradient.setStart(rect().width()/2, rect().top());
- gradient.setFinalStop(rect().width()/2, rect().bottom());
- }
- painter.fillRect(event->rect(), QBrush(gradient));
-}
-//! [0]
-
-Splitter::Splitter(Qt::Orientation orientation, QWidget *parent)
- : QSplitter(orientation, parent)
-{
-}
-
-//! [1]
-QSplitterHandle *Splitter::createHandle()
-{
- return new SplitterHandle(orientation(), this);
-}
-//! [1]
diff --git a/doc/src/snippets/splitterhandle/splitter.h b/doc/src/snippets/splitterhandle/splitter.h
deleted file mode 100644
index ba310b9e8d..0000000000
--- a/doc/src/snippets/splitterhandle/splitter.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SPLITTER_H
-#define SPLITTER_H
-
-#include <QLinearGradient>
-#include <QSplitter>
-#include <QSplitterHandle>
-
-class QPaintEvent;
-
-//! [0]
-class Splitter : public QSplitter
-{
-public:
- Splitter(Qt::Orientation orientation, QWidget *parent = 0);
-
-protected:
- QSplitterHandle *createHandle();
-};
-//! [0]
-
-class SplitterHandle : public QSplitterHandle
-{
-public:
- SplitterHandle(Qt::Orientation orientation, QSplitter *parent);
-
-protected:
- void paintEvent(QPaintEvent *event);
-
-private:
- QLinearGradient gradient;
-};
-
-#endif
diff --git a/doc/src/snippets/styles/styles.cpp b/doc/src/snippets/styles/styles.cpp
deleted file mode 100644
index 1109669bcb..0000000000
--- a/doc/src/snippets/styles/styles.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QStyleOption>
-#include <QStylePainter>
-#include <QWidget>
-
-class MyWidget : public QWidget
-{
-protected:
- void paintEvent(QPaintEvent *event);
- void paintEvent2(QPaintEvent *event);
-
-};
-
-//! [0] //! [1]
-void MyWidget::paintEvent(QPaintEvent * /* event */)
-//! [0]
-{
-//! [2]
- QPainter painter(this);
-//! [2]
-
- QStyleOptionFocusRect option;
- option.initFrom(this);
- option.backgroundColor = palette().color(QPalette::Background);
-
-//! [3]
- style()->drawPrimitive(QStyle::PE_FrameFocusRect, &option, &painter, this);
-//! [3]
-}
-//! [1]
-
-void MyWidget::paintEvent2(QPaintEvent * /* event */)
-//! [4]
-{
-//! [4] //! [5] //! [6]
- QStylePainter painter(this);
-//! [5]
-
- QStyleOptionFocusRect option;
- option.initFrom(this);
- option.backgroundColor = palette().color(QPalette::Background);
-
-//! [7]
- painter.drawPrimitive(QStyle::PE_FrameFocusRect, option);
-//! [7]
-}
-//! [6]
-
-int main()
-{
- return 0;
-}
diff --git a/doc/src/snippets/stylesheet/common-mistakes.cpp b/doc/src/snippets/stylesheet/common-mistakes.cpp
deleted file mode 100644
index d4552fcf1d..0000000000
--- a/doc/src/snippets/stylesheet/common-mistakes.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//! [1]
- QPushButton {
- color: grey;
- border-image: url(/home/kamlie/code/button.png) 3 10 3 10;
- border-top: 3px transparent;
- border-bottom: 3px transparent;
- border-right: 10px transparent;
- border-left: 10px transparent;
- }
-//! [1]
-
-
diff --git a/doc/src/snippets/textdocument-imagedrop/textedit.cpp b/doc/src/snippets/textdocument-imagedrop/textedit.cpp
deleted file mode 100644
index fbb6f73ddc..0000000000
--- a/doc/src/snippets/textdocument-imagedrop/textedit.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "textedit.h"
-#include <QtGui>
-
-TextEdit::TextEdit(QWidget *parent)
- : QTextEdit(parent)
-{
-}
-
-//! [0]
-bool TextEdit::canInsertFromMimeData( const QMimeData *source ) const
-{
- if (source->hasImage())
- return true;
- else
- return QTextEdit::canInsertFromMimeData(source);
-}
-//! [0]
-
-//! [1]
-void TextEdit::insertFromMimeData( const QMimeData *source )
-{
- if (source->hasImage())
- {
- QImage image = qvariant_cast<QImage>(source->imageData());
- QTextCursor cursor = this->textCursor();
- QTextDocument *document = this->document();
- document->addResource(QTextDocument::ImageResource, QUrl("image"), image);
- cursor.insertImage("image");
- }
-}
-//! [1]
diff --git a/doc/src/snippets/timeline/main.cpp b/doc/src/snippets/timeline/main.cpp
deleted file mode 100644
index f4be7f3c5b..0000000000
--- a/doc/src/snippets/timeline/main.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-#include <math.h>
-
-int main(int argv, char *args[])
-{
- QApplication app(argv, args);
-
-//! [0]
- QGraphicsItem *ball = new QGraphicsEllipseItem(0, 0, 20, 20);
-
- QTimeLine *timer = new QTimeLine(5000);
- timer->setFrameRange(0, 100);
-
- QGraphicsItemAnimation *animation = new QGraphicsItemAnimation;
- animation->setItem(ball);
- animation->setTimeLine(timer);
-
- for (int i = 0; i < 200; ++i)
- animation->setPosAt(i / 200.0, QPointF(i, i));
-
- QGraphicsScene *scene = new QGraphicsScene();
- scene->setSceneRect(0, 0, 250, 250);
- scene->addItem(ball);
-
- QGraphicsView *view = new QGraphicsView(scene);
- view->show();
-
- timer->start();
-//! [0]
-
- return app.exec();
-}
diff --git a/doc/src/snippets/whatsthis/whatsthis.cpp b/doc/src/snippets/whatsthis/whatsthis.cpp
deleted file mode 100644
index 3d3f65d317..0000000000
--- a/doc/src/snippets/whatsthis/whatsthis.cpp
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-class MainWindow : public QMainWindow
-{
-public:
- MainWindow();
-
- QAction *newAct;
-};
-
-MainWindow()
-{
-//! [0]
- newAct = new QAction(tr("&New"), this);
- newAct->setShortcut(tr("Ctrl+N"));
- newAct->setStatusTip(tr("Create a new file"));
- newAct->setWhatsThis(tr("Click this option to create a new file."));
-//! [0]
-}
-
-int main()
-{
- return 0;
-}
diff --git a/doc/src/snippets/widget-mask/main.cpp b/doc/src/snippets/widget-mask/main.cpp
deleted file mode 100644
index 18653deb4c..0000000000
--- a/doc/src/snippets/widget-mask/main.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-int main(int argc, char *argv[])
-{
- QApplication app(argc, argv);
-//! [0]
- QLabel topLevelLabel;
- QPixmap pixmap(":/images/tux.png");
- topLevelLabel.setPixmap(pixmap);
- topLevelLabel.setMask(pixmap.mask());
-//! [0]
- topLevelLabel.show();
- return app.exec();
-}
diff --git a/doc/src/snippets/widgetdelegate.cpp b/doc/src/snippets/widgetdelegate.cpp
deleted file mode 100644
index 4d2a6559a5..0000000000
--- a/doc/src/snippets/widgetdelegate.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** You may use this file under the terms of the BSD license as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
-** the names of its contributors may be used to endorse or promote
-** products derived from this software without specific prior written
-** permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-
-#include "widgetdelegate.h"
-
-//![0]
-void WidgetDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
- const QModelIndex &index) const
-{
- if (index.column() == 1) {
- int progress = index.data().toInt();
-
- QStyleOptionProgressBar progressBarOption;
- progressBarOption.rect = option.rect;
- progressBarOption.minimum = 0;
- progressBarOption.maximum = 100;
- progressBarOption.progress = progress;
- progressBarOption.text = QString::number(progress) + "%";
- progressBarOption.textVisible = true;
-
- QApplication::style()->drawControl(QStyle::CE_ProgressBar,
- &progressBarOption, painter);
- } else
- QStyledItemDelegate::paint(painter, option, index);
-
-//![0]
-}