Adding ./doc from boost

Reviewer: Lauro Moura <lauro.neto@openbossa.org>
          Luciano Wolf <luciano.wolf@openbossa.org>
This commit is contained in:
Lauro Neto 2010-04-27 18:12:50 -03:00 • committed by Renato Filho
commit aaece960d3
1108 changed files with 70655 additions and 0 deletions

View file

@ -0,0 +1,102 @@
############################################################################
##
## Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
## Contact: Qt Software Information (qt-info@nokia.com)
##
## This file is part of the example classes of the Qt Toolkit.
##
## $QT_BEGIN_LICENSE:LGPL$
## Commercial Usage
## Licensees holding valid Qt Commercial licenses may use self file in
## accordance with the Qt Commercial License Agreement provided with the
## Software or, alternatively, in accordance with the terms contained in
## a written agreement between you and Nokia.
##
## GNU Lesser General Public License Usage
## Alternatively, self file may be used under the terms of the GNU Lesser
## General Public License version 2.1 as published by the Free Software
## Foundation and appearing in the file LICENSE.LGPL included in the
## packaging of self file. Please review the following information to
## ensure the GNU Lesser General Public License version 2.1 requirements
## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
##
## In addition, as a special exception, Nokia gives you certain
## additional rights. These rights are described in the Nokia Qt LGPL
## Exception version 1.0, included in the file LGPL_EXCEPTION.txt in self
## package.
##
## GNU General Public License Usage
## Alternatively, self file may be used under the terms of the GNU
## General Public License version 3.0 as published by the Free Software
## Foundation and appearing in the file LICENSE.GPL included in the
## packaging of self file. Please review the following information to
## ensure the GNU General Public License version 3.0 requirements will be
## met: http://www.gnu.org/copyleft/gpl.html.
##
## If you are unsure which license is appropriate for your use, please
## contact the sales department at qt-sales@nokia.com.
## $QT_END_LICENSE$
##
############################################################################
//! [0]
def __init__(self, parent):
QSortFilterProxyModel.__init__(self, parent)
//! [0]
//! [1]
def setFilterMinimumDate(self, date):
self.minDate = date
self.invalidateFilter()
//! [1]
//! [2]
def setFilterMaximumDate(self, date):
self.maxDate = date
self.invalidateFilter()
//! [2]
//! [3]
def filterAcceptsRow(self, sourceRow, sourceParent):
index0 = sourceModel().index(sourceRow, 0, sourceParent)
index1 = sourceModel().index(sourceRow, 1, sourceParent)
index2 = sourceModel().index(sourceRow, 2, sourceParent)
return (sourceModel().data(index0).toString().contains(filterRegExp())
|| sourceModel().data(index1).toString().contains(filterRegExp()))
&& dateInRange(sourceModel().data(index2).toDate())
//! [3]
//! [4] //! [5]
def lessThan(self, left, right):
leftData = sourceModel().data(left)
rightData = sourceModel().data(right)
//! [4]
//! [6]
if leftData.type() == QVariant.DateTime:
return leftData.toDateTime() < rightData.toDateTime()
else:
emailPattern = QRegExp("([\\w\\.]*@[\\w\\.]*)")
leftString = leftData.toString()
if left.column() == 1 && emailPattern.indexIn(leftString) != -1:
leftString = emailPattern.cap(1)
rightString = rightData.toString()
if right.column() == 1 && emailPattern.indexIn(rightString) != -1:
rightString = emailPattern.cap(1)
return QString.localeAwareCompare(leftString, rightString) < 0
//! [5] //! [6]
//! [7]
def dateInRange(self, date):
return (!minDate.isValid() || date > minDate)
&& (!maxDate.isValid() || date < maxDate)
//! [7]

View file

@ -0,0 +1,94 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
** This file is part of the example classes of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain
** additional rights. These rights are described in the Nokia Qt LGPL
** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
** package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at qt-sales@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
//! [0]
def __init__(self, parent):
QAbstractItemDelegate.__init__(self, parent)
self.pixelSize = 12
//! [0]
//! [1]
def paint(self, painter, option, index):
//! [2]
if option.state and QStyle.State_Selected:
painter.fillRect(option.rect, option.palette.highlight())
//! [1]
//! [3]
size = qMin(option.rect.width(), option.rect.height())
//! [3] //! [4]
brightness = index.model().data(index, Qt.DisplayRole).toInt()
radius = (size/2.0) - (brightness/255.0 * size/2.0)
if radius == 0.0:
return
//! [4]
//! [5]
painter.save()
//! [5] //! [6]
painter.setRenderHint(QPainter.Antialiasing, true)
//! [6] //! [7]
painter.setPen(Qt.NoPen)
//! [7] //! [8]
if option.state and QStyle.State_Selected:
//! [8] //! [9]
painter.setBrush(option.palette.highlightedText())
else
//! [2]
painter.setBrush(QBrush(Qt.black))
//! [9]
//! [10]
painter.drawEllipse(QRectF(option.rect.x() + option.rect.width()/2 - radius,
option.rect.y() + option.rect.height()/2 - radius,
2*radius, 2*radius))
painter.restore()
//! [10]
//! [11]
def sizeHint(self, option, index):
return QSize(self.pixelSize, self.pixelSize)
//! [11]
//! [12]
def setPixelSize(self, size):
self.pixelSize = size
//! [12]

View file

@ -0,0 +1,188 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain
** additional rights. These rights are described in the Nokia Qt LGPL
** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
** package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtGui>
#include <QtXml>
#include "domitem.h"
#include "dommodel.h"
//! [0]
DomModel::DomModel(QDomDocument document, QObject *parent)
: QAbstractItemModel(parent), domDocument(document)
{
rootItem = new DomItem(domDocument, 0);
}
//! [0]
//! [1]
DomModel::~DomModel()
{
delete rootItem;
}
//! [1]
//! [2]
def columnCount(self, parent):
return 3
//! [2]
//! [3]
QVariant DomModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
return QVariant();
if (role != Qt::DisplayRole)
return QVariant();
DomItem *item = static_cast<DomItem*>(index.internalPointer());
QDomNode node = item->node();
//! [3] //! [4]
QStringList attributes;
QDomNamedNodeMap attributeMap = node.attributes();
switch (index.column()) {
case 0:
return node.nodeName();
case 1:
for (int i = 0; i < attributeMap.count(); ++i) {
QDomNode attribute = attributeMap.item(i);
attributes << attribute.nodeName() + "=\""
+attribute.nodeValue() + "\"";
}
return attributes.join(" ");
case 2:
return node.nodeValue().split("\n").join(" ");
default:
return QVariant();
}
}
//! [4]
//! [5]
Qt::ItemFlags DomModel::flags(const QModelIndex &index) const
{
if (!index.isValid())
return 0;
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
}
//! [5]
//! [6]
QVariant DomModel::headerData(int section, Qt::Orientation orientation,
int role) const
{
if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
switch (section) {
case 0:
return tr("Name");
case 1:
return tr("Attributes");
case 2:
return tr("Value");
default:
return QVariant();
}
}
return QVariant();
}
//! [6]
//! [7]
QModelIndex DomModel::index(int row, int column, const QModelIndex &parent)
const
{
if (!hasIndex(row, column, parent))
return QModelIndex();
DomItem *parentItem;
if (!parent.isValid())
parentItem = rootItem;
else
parentItem = static_cast<DomItem*>(parent.internalPointer());
//! [7]
//! [8]
DomItem *childItem = parentItem->child(row);
if (childItem)
return createIndex(row, column, childItem);
else
return QModelIndex();
}
//! [8]
//! [9]
QModelIndex DomModel::parent(const QModelIndex &child) const
{
if (!child.isValid())
return QModelIndex();
DomItem *childItem = static_cast<DomItem*>(child.internalPointer());
DomItem *parentItem = childItem->parent();
if (!parentItem || parentItem == rootItem)
return QModelIndex();
return createIndex(parentItem->row(), 0, parentItem);
}
//! [9]
//! [10]
int DomModel::rowCount(const QModelIndex &parent) const
{
if (parent.column() > 0)
return 0;
DomItem *parentItem;
if (!parent.isValid())
parentItem = rootItem;
else
parentItem = static_cast<DomItem*>(parent.internalPointer());
return parentItem->node().childNodes().count();
}
//! [10]