diff options
author | Casper van Donderen <casper.vandonderen@nokia.com> | 2012-05-07 18:49:48 +0200 |
---|---|---|
committer | Marius Storm-Olsen <marius.storm-olsen@nokia.com> | 2012-05-09 08:36:46 +0200 |
commit | 97b5b8009254004608feefb903cbf44abaa099f6 (patch) | |
tree | cf3a79caa34085de1308eb86cac6ea0d9663aa9c /doc/src/snippets/code | |
parent | cfdc5628b1fc2cbafa2aebca38995e5718fcb0de (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/code')
61 files changed, 0 insertions, 6316 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] |