diff options
author | Janne Koskinen <janne.p.koskinen@digia.com> | 2009-08-18 14:44:21 (GMT) |
---|---|---|
committer | Janne Koskinen <janne.p.koskinen@digia.com> | 2009-08-18 14:44:21 (GMT) |
commit | 3d6056dfe01116e34a2b47a70fb95e73753ef766 (patch) | |
tree | ee4e1430dc9f0b06ab89091682d5a60525eac560 /src/gui | |
parent | 52e469a629d32b7f7e52518874dab13fcd4bb814 (diff) | |
parent | 69689f3527f373618a1f4adad543b60afea46c17 (diff) | |
download | Qt-3d6056dfe01116e34a2b47a70fb95e73753ef766.zip Qt-3d6056dfe01116e34a2b47a70fb95e73753ef766.tar.gz Qt-3d6056dfe01116e34a2b47a70fb95e73753ef766.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-s60-public
Diffstat (limited to 'src/gui')
232 files changed, 3394 insertions, 1083 deletions
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp index abeca0d..9084817 100644 --- a/src/gui/accessible/qaccessible.cpp +++ b/src/gui/accessible/qaccessible.cpp @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE relating to accessibility. \ingroup accessibility - \mainclass + Accessible applications can be used by people who are not able to use applications by conventional means. diff --git a/src/gui/dialogs/qabstractprintdialog.cpp b/src/gui/dialogs/qabstractprintdialog.cpp index ac4c9e8..9e91382 100644 --- a/src/gui/dialogs/qabstractprintdialog.cpp +++ b/src/gui/dialogs/qabstractprintdialog.cpp @@ -59,6 +59,8 @@ class QPrintDialogPrivate : public QAbstractPrintDialogPrivate \brief The QAbstractPrintDialog class provides a base implementation for print dialogs used to configure printers. + \ingroup printing + This class implements getter and setter functions that are used to customize settings shown in print dialogs, but it is not used directly. Use QPrintDialog to display a print dialog in your application. @@ -357,7 +359,8 @@ void QAbstractPrintDialogPrivate::setPrinter(QPrinter *newPrinter) \brief The QPrintDialog class provides a dialog for specifying the printer's configuration. - \ingroup dialogs + \ingroup standard-dialogs + \ingroup printing The dialog allows users to change document-related settings, such as the paper size and orientation, type of print (color or diff --git a/src/gui/dialogs/qcolordialog.cpp b/src/gui/dialogs/qcolordialog.cpp index 4a40b48..766dcb4 100644 --- a/src/gui/dialogs/qcolordialog.cpp +++ b/src/gui/dialogs/qcolordialog.cpp @@ -1510,9 +1510,7 @@ static const Qt::WindowFlags DefaultWindowFlags = \class QColorDialog \brief The QColorDialog class provides a dialog widget for specifying colors. - \mainclass - \ingroup dialogs - \ingroup multimedia + \ingroup standard-dialogs The color dialog's function is to allow users to choose colors. For example, you might use this in a drawing program to allow the diff --git a/src/gui/dialogs/qdialog.cpp b/src/gui/dialogs/qdialog.cpp index 326dee4..16e5330 100644 --- a/src/gui/dialogs/qdialog.cpp +++ b/src/gui/dialogs/qdialog.cpp @@ -78,9 +78,9 @@ QT_BEGIN_NAMESPACE \class QDialog \brief The QDialog class is the base class of dialog windows. - \ingroup dialogs + \ingroup dialog-classes \ingroup abstractwidgets - \mainclass + A dialog window is a top-level window mostly used for short-term tasks and brief communications with the user. QDialogs may be diff --git a/src/gui/dialogs/qerrormessage.cpp b/src/gui/dialogs/qerrormessage.cpp index bc9972c..c83f33c 100644 --- a/src/gui/dialogs/qerrormessage.cpp +++ b/src/gui/dialogs/qerrormessage.cpp @@ -133,8 +133,7 @@ QSize QErrorMessageTextView::sizeHint() const \brief The QErrorMessage class provides an error message display dialog. - \ingroup dialogs - \ingroup misc + \ingroup standard-dialog An error message widget consists of a text label and a checkbox. The checkbox lets the user control whether the same error message will be diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index 7a30c3d..0a4c1e2 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -92,8 +92,8 @@ Q_GUI_EXPORT _qt_filedialog_save_filename_hook qt_filedialog_save_filename_hook /*! \class QFileDialog \brief The QFileDialog class provides a dialog that allow users to select files or directories. - \ingroup dialogs - \mainclass + \ingroup standard-dialogs + The QFileDialog class enables a user to traverse the file system in order to select one or many files or a directory. @@ -2730,7 +2730,7 @@ void QFileDialogPrivate::_q_updateOkButton() if (lineEditText.startsWith(QLatin1String("//")) || lineEditText.startsWith(QLatin1Char('\\'))) { button->setEnabled(true); if (acceptMode == QFileDialog::AcceptSave) - button->setText(isOpenDirectory ? QFileDialog::tr("&Open") : acceptLabel); + button->setText(acceptLabel); return; } diff --git a/src/gui/dialogs/qfontdialog.cpp b/src/gui/dialogs/qfontdialog.cpp index 3e57585..512dc65 100644 --- a/src/gui/dialogs/qfontdialog.cpp +++ b/src/gui/dialogs/qfontdialog.cpp @@ -112,9 +112,8 @@ static const Qt::WindowFlags DefaultWindowFlags = /*! \class QFontDialog - \ingroup dialogs - \ingroup text - \mainclass + \ingroup standard-dialogs + \brief The QFontDialog class provides a dialog widget for selecting a font. A font dialog is created through one of the static getFont() diff --git a/src/gui/dialogs/qinputdialog.cpp b/src/gui/dialogs/qinputdialog.cpp index a2b8304..39a6b07 100644 --- a/src/gui/dialogs/qinputdialog.cpp +++ b/src/gui/dialogs/qinputdialog.cpp @@ -425,8 +425,8 @@ void QInputDialogPrivate::_q_currentRowChanged(const QModelIndex &newIndex, \class QInputDialog \brief The QInputDialog class provides a simple convenience dialog to get a single value from the user. - \ingroup dialogs - \mainclass + \ingroup standard-dialogs + The input value can be a string, a number or an item from a list. A label must be set to tell the user what they should enter. diff --git a/src/gui/dialogs/qmessagebox.cpp b/src/gui/dialogs/qmessagebox.cpp index 857ce46..7f21990 100644 --- a/src/gui/dialogs/qmessagebox.cpp +++ b/src/gui/dialogs/qmessagebox.cpp @@ -434,8 +434,8 @@ void QMessageBoxPrivate::_q_buttonClicked(QAbstractButton *button) \brief The QMessageBox class provides a modal dialog for informing the user or for asking the user a question and receiving an answer. - \ingroup dialogs - \mainclass + \ingroup standard-dialogs + A message box displays a primary \l{QMessageBox::text}{text} to alert the user to a situation, an \l{QMessageBox::informativeText} diff --git a/src/gui/dialogs/qpagesetupdialog.cpp b/src/gui/dialogs/qpagesetupdialog.cpp index 5ca4935..a91eaea 100644 --- a/src/gui/dialogs/qpagesetupdialog.cpp +++ b/src/gui/dialogs/qpagesetupdialog.cpp @@ -45,6 +45,52 @@ QT_BEGIN_NAMESPACE +/*! + \class QPageSetupDialog + + \brief The QPageSetupDialog class provides a configuration dialog + for the page-related options on a printer. + + \ingroup standard-dialogs + \ingroup printing + + On Windows and Mac OS X the page setup dialog is implemented using + the native page setup dialogs. + + Note that on Windows and Mac OS X custom paper sizes won't be + reflected in the native page setup dialogs. Additionally, custom + page margins set on a QPrinter won't show in the native Mac OS X + page setup dialog. + + \sa QPrinter, QPrintDialog +*/ + + +/*! + \fn QPageSetupDialog::QPageSetupDialog(QPrinter *printer, QWidget *parent) + + Constructs a page setup dialog that configures \a printer with \a + parent as the parent widget. +*/ + +/*! + \since 4.5 + + \fn QPageSetupDialog::QPageSetupDialog(QWidget *parent) + + Constructs a page setup dialog that configures a default-constructed + QPrinter with \a parent as the parent widget. + + \sa printer() +*/ + +/*! + \fn QPrinter *QPageSetupDialog::printer() + + Returns the printer that was passed to the QPageSetupDialog + constructor. +*/ + // hack class QPageSetupDialogPrivate : public QAbstractPageSetupDialogPrivate { diff --git a/src/gui/dialogs/qprintdialog.qdoc b/src/gui/dialogs/qprintdialog.qdoc new file mode 100644 index 0000000..b52edff --- /dev/null +++ b/src/gui/dialogs/qprintdialog.qdoc @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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://qt.nokia.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifdef QT3_SUPPORT +/*! + \fn QPrinter *QPrintDialog::printer() const + + Returns a pointer to the printer this dialog configures, or 0 if + this dialog does not operate on any printer. + + This function is available for Unix platforms only. +*/ + +/*! + \fn void QPrintDialog::setPrinter(QPrinter *printer, bool pickupSettings) + + Sets this dialog to configure printer \a printer, or no printer if \a printer + is null. If \a pickupSettings is true, the dialog reads most of + its settings from \a printer. If \a pickupSettings is false (the + default) the dialog keeps its old settings. + + This function is available for Unix platforms only. +*/ + +/*! + \fn void QPrintDialog::addButton(QPushButton *button) + + Adds the \a button to the layout of the print dialog. The added + buttons are arranged from the left to the right below the + last groupbox of the printdialog. + + This function is available for Unix platforms only. +*/ +#endif diff --git a/src/gui/dialogs/qprintpreviewdialog.cpp b/src/gui/dialogs/qprintpreviewdialog.cpp index 6565739..8ac4717 100644 --- a/src/gui/dialogs/qprintpreviewdialog.cpp +++ b/src/gui/dialogs/qprintpreviewdialog.cpp @@ -625,6 +625,9 @@ void QPrintPreviewDialogPrivate::_q_zoomFactorChanged() \brief The QPrintPreviewDialog class provides a dialog for previewing and configuring page layouts for printer output. + \ingroup standard-dialogs + \ingroup printing + Using QPrintPreviewDialog in your existing application is straightforward: diff --git a/src/gui/dialogs/qprogressdialog.cpp b/src/gui/dialogs/qprogressdialog.cpp index 1ca1515..d55eadb 100644 --- a/src/gui/dialogs/qprogressdialog.cpp +++ b/src/gui/dialogs/qprogressdialog.cpp @@ -196,8 +196,8 @@ void QProgressDialogPrivate::_q_disconnectOnClose() /*! \class QProgressDialog \brief The QProgressDialog class provides feedback on the progress of a slow operation. - \ingroup dialogs - \mainclass + \ingroup standard-dialogs + A progress dialog is used to give the user an indication of how long an operation is going to take, and to demonstrate that the diff --git a/src/gui/egl/egl.pri b/src/gui/egl/egl.pri index 651507f..75a3d91 100644 --- a/src/gui/egl/egl.pri +++ b/src/gui/egl/egl.pri @@ -25,4 +25,4 @@ for(p, QMAKE_LIBDIR_EGL) { } !isEmpty(QMAKE_INCDIR_EGL): INCLUDEPATH += $$QMAKE_INCDIR_EGL -!isEmpty(QMAKE_LIBS_EGL): LIBS += $$QMAKE_LIBS_EGL +!isEmpty(QMAKE_LIBS_EGL): LIBS_PRIVATE += $$QMAKE_LIBS_EGL diff --git a/src/gui/embedded/embedded.pri b/src/gui/embedded/embedded.pri index e8eb959..255a504 100644 --- a/src/gui/embedded/embedded.pri +++ b/src/gui/embedded/embedded.pri @@ -189,7 +189,7 @@ embedded { } contains( mouse-drivers, tslib ) { - LIBS += -lts + LIBS_PRIVATE += -lts HEADERS +=embedded/qmousetslib_qws.h SOURCES +=embedded/qmousetslib_qws.cpp } diff --git a/src/gui/embedded/qdirectpainter_qws.cpp b/src/gui/embedded/qdirectpainter_qws.cpp index bae6ed9..bba862b 100644 --- a/src/gui/embedded/qdirectpainter_qws.cpp +++ b/src/gui/embedded/qdirectpainter_qws.cpp @@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE /*! \class QDirectPainter - \ingroup multimedia + \ingroup painting \ingroup qws \brief The QDirectPainter class provides direct access to the diff --git a/src/gui/embedded/qlock.cpp b/src/gui/embedded/qlock.cpp index 0f88832..c32e9b5 100644 --- a/src/gui/embedded/qlock.cpp +++ b/src/gui/embedded/qlock.cpp @@ -128,7 +128,6 @@ public: \brief The QLock class is a wrapper for a System V shared semaphore. \ingroup qws - \ingroup io \internal diff --git a/src/gui/graphicsview/qgraphicsgridlayout.cpp b/src/gui/graphicsview/qgraphicsgridlayout.cpp index ee7048f..0fb284f 100644 --- a/src/gui/graphicsview/qgraphicsgridlayout.cpp +++ b/src/gui/graphicsview/qgraphicsgridlayout.cpp @@ -44,7 +44,7 @@ \brief The QGraphicsGridLayout class provides a grid layout for managing widgets in Graphics View. \since 4.4 - \ingroup multimedia + \ingroup graphicsview-api The most common way to use QGraphicsGridLayout is to construct an object diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 5a84cfd..4f64c2a 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -44,7 +44,7 @@ \brief The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene. \since 4.2 - \ingroup multimedia + \ingroup graphicsview-api It provides a light-weight foundation for writing your own custom items. @@ -328,6 +328,10 @@ used for Asian languages. This flag was introduced in Qt 4.6. + \value ItemNegativeZStacksBehindParent The item automatically stacks behind + it's parent if it's z-value is negative. This flag enables setZValue() to + toggle ItemStacksBehindParent. + \value ItemAutoDetectsFocusProxy The item will assign any child that gains input focus as its focus proxy. See also focusProxy(). This flag was introduced in Qt 4.6. @@ -1196,6 +1200,9 @@ QGraphicsItem::QGraphicsItem(QGraphicsItemPrivate &dd, QGraphicsItem *parent, Destroys the QGraphicsItem and all its children. If this item is currently associated with a scene, the item will be removed from the scene before it is deleted. + + \note It is more efficient to remove the item from the QGraphicsScene before + destroying the item. */ QGraphicsItem::~QGraphicsItem() { @@ -1209,10 +1216,12 @@ QGraphicsItem::~QGraphicsItem() Q_ASSERT(d_ptr->children.isEmpty()); } - if (d_ptr->scene) + if (d_ptr->scene) { d_ptr->scene->d_func()->removeItemHelper(this); - else + } else { + d_ptr->resetFocusProxy(); d_ptr->setParentItemHelper(0); + } if (d_ptr->transformData) { for(int i = 0; i < d_ptr->transformData->graphicsTransforms.size(); ++i) { @@ -1573,6 +1582,11 @@ void QGraphicsItem::setFlags(GraphicsItemFlags flags) d_ptr->scene->d_func()->updateInputMethodSensitivityInViews(); } + if ((flags & ItemNegativeZStacksBehindParent) != (oldFlags & ItemNegativeZStacksBehindParent)) { + // Update stack-behind. + setFlag(ItemStacksBehindParent, d_ptr->z < qreal(0.0)); + } + if (d_ptr->scene) { d_ptr->scene->d_func()->markDirty(this, QRectF(), /*invalidateChildren=*/true, @@ -2202,11 +2216,10 @@ qreal QGraphicsItem::effectiveOpacity() const void QGraphicsItem::setOpacity(qreal opacity) { // Notify change. - const QVariant newOpacityVariant(itemChange(ItemOpacityChange, double(opacity))); - qreal newOpacity = newOpacityVariant.toDouble(); + const QVariant newOpacityVariant(itemChange(ItemOpacityChange, opacity)); - // Normalize. - newOpacity = qBound<qreal>(0.0, newOpacity, 1.0); + // Normalized opacity + qreal newOpacity = qBound(qreal(0), newOpacityVariant.toReal(), qreal(1)); // No change? Done. if (newOpacity == d_ptr->opacity) @@ -2625,13 +2638,11 @@ void QGraphicsItem::setFocusProxy(QGraphicsItem *item) } QGraphicsItem *lastFocusProxy = d_ptr->focusProxy; + if (lastFocusProxy) + lastFocusProxy->d_ptr->focusProxyRefs.removeOne(&d_ptr->focusProxy); d_ptr->focusProxy = item; - if (d_ptr->scene) { - if (lastFocusProxy) - d_ptr->scene->d_func()->focusProxyReverseMap.remove(lastFocusProxy, this); - if (item) - d_ptr->scene->d_func()->focusProxyReverseMap.insert(item, this); - } + if (item) + item->d_ptr->focusProxyRefs << &d_ptr->focusProxy; } /*! @@ -3708,8 +3719,8 @@ qreal QGraphicsItem::zValue() const */ void QGraphicsItem::setZValue(qreal z) { - const QVariant newZVariant(itemChange(ItemZValueChange, double(z))); - qreal newZ = qreal(newZVariant.toDouble()); + const QVariant newZVariant(itemChange(ItemZValueChange, z)); + qreal newZ = newZVariant.toReal(); if (newZ == d_ptr->z) return; @@ -3729,6 +3740,9 @@ void QGraphicsItem::setZValue(qreal z) itemChange(ItemZValueHasChanged, newZVariant); + if (d_ptr->flags & ItemNegativeZStacksBehindParent) + setFlag(QGraphicsItem::ItemStacksBehindParent, z < qreal(0.0)); + if (d_ptr->isObject) emit static_cast<QGraphicsObject *>(this)->zChanged(); } @@ -4638,6 +4652,19 @@ void QGraphicsItemPrivate::clearSubFocus() /*! \internal + Sets the focusProxy pointer to 0 for all items that have this item as their + focusProxy. ### Qt 5: Use QPointer instead. +*/ +void QGraphicsItemPrivate::resetFocusProxy() +{ + for (int i = 0; i < focusProxyRefs.size(); ++i) + *focusProxyRefs.at(i) = 0; + focusProxyRefs.clear(); +} + +/*! + \internal + Tells us if it is a proxy widget */ bool QGraphicsItemPrivate::isProxyWidget() const @@ -6828,11 +6855,12 @@ QGraphicsObject::QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent By default, this property is true. - \sa QGraphicsItem::isEnabled(), QGraphicsItem::setEnabled(), enabledChanged() + \sa QGraphicsItem::isEnabled(), QGraphicsItem::setEnabled() + \sa QGraphicsObject::enabledChanged() */ /*! - \fn QGraphicsObject::enabledChanged() + \fn void QGraphicsObject::enabledChanged() This signal gets emitted whenever the item get's enabled or disabled. @@ -6884,7 +6912,7 @@ QGraphicsObject::QGraphicsObject(QGraphicsItemPrivate &dd, QGraphicsItem *parent \brief The QAbstractGraphicsShapeItem class provides a common base for all path items. \since 4.2 - \ingroup multimedia + \ingroup graphicsview-api This class does not fully implement an item by itself; in particular, it does not implement boundingRect() and paint(), which are inherited by @@ -7019,7 +7047,6 @@ QPainterPath QAbstractGraphicsShapeItem::opaqueArea() const \brief The QGraphicsPathItem class provides a path item that you can add to a QGraphicsScene. \since 4.2 - \ingroup multimedia \ingroup graphicsview-api To set the item's path, pass a QPainterPath to QGraphicsPathItem's @@ -7222,7 +7249,6 @@ QVariant QGraphicsPathItem::extension(const QVariant &variant) const \brief The QGraphicsRectItem class provides a rectangle item that you can add to a QGraphicsScene. \since 4.2 - \ingroup multimedia \ingroup graphicsview-api To set the item's rectangle, pass a QRectF to QGraphicsRectItem's @@ -7467,7 +7493,6 @@ QVariant QGraphicsRectItem::extension(const QVariant &variant) const \brief The QGraphicsEllipseItem class provides an ellipse item that you can add to a QGraphicsScene. \since 4.2 - \ingroup multimedia \ingroup graphicsview-api QGraphicsEllipseItem respresents an ellipse with a fill and an outline, @@ -7784,7 +7809,6 @@ QVariant QGraphicsEllipseItem::extension(const QVariant &variant) const \brief The QGraphicsPolygonItem class provides a polygon item that you can add to a QGraphicsScene. \since 4.2 - \ingroup multimedia \ingroup graphicsview-api To set the item's polygon, pass a QPolygonF to @@ -8018,7 +8042,6 @@ QVariant QGraphicsPolygonItem::extension(const QVariant &variant) const \brief The QGraphicsLineItem class provides a line item that you can add to a QGraphicsScene. \since 4.2 - \ingroup multimedia \ingroup graphicsview-api To set the item's line, pass a QLineF to QGraphicsLineItem's @@ -8280,7 +8303,6 @@ QVariant QGraphicsLineItem::extension(const QVariant &variant) const \brief The QGraphicsPixmapItem class provides a pixmap item that you can add to a QGraphicsScene. \since 4.2 - \ingroup multimedia \ingroup graphicsview-api To set the item's pixmap, pass a QPixmap to QGraphicsPixmapItem's @@ -8644,7 +8666,6 @@ QVariant QGraphicsPixmapItem::extension(const QVariant &variant) const \brief The QGraphicsTextItem class provides a text item that you can add to a QGraphicsScene to display formatted text. \since 4.2 - \ingroup multimedia \ingroup graphicsview-api If you only need to show plain text in an item, consider using QGraphicsSimpleTextItem @@ -9557,7 +9578,6 @@ void QGraphicsSimpleTextItemPrivate::updateBoundingRect() \brief The QGraphicsSimpleTextItem class provides a simple text path item that you can add to a QGraphicsScene. \since 4.2 - \ingroup multimedia \ingroup graphicsview-api To set the item's text, you can either pass a QString to @@ -9793,7 +9813,6 @@ QVariant QGraphicsSimpleTextItem::extension(const QVariant &variant) const \brief The QGraphicsItemGroup class provides treating a group of items as one. \since 4.2 - \ingroup multimedia \ingroup graphicsview-api A QGraphicsItemGroup is a special type of compound item that @@ -10147,6 +10166,9 @@ QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemFlag flag) case QGraphicsItem::ItemAcceptsInputMethod: str = "ItemAcceptsInputMethod"; break; + case QGraphicsItem::ItemNegativeZStacksBehindParent: + str = "ItemNegativeZStacksBehindParent"; + break; case QGraphicsItem::ItemAutoDetectsFocusProxy: str = "ItemAutoDetectsFocusProxy"; break; diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index 622ca82..d34787d 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -102,7 +102,8 @@ public: ItemHasNoContents = 0x400, ItemSendsGeometryChanges = 0x800, ItemAcceptsInputMethod = 0x1000, - ItemAutoDetectsFocusProxy = 0x2000 + ItemAutoDetectsFocusProxy = 0x2000, + ItemNegativeZStacksBehindParent = 0x4000 // NB! Don't forget to increase the d_ptr->flags bit field by 1 when adding a new flag. }; Q_DECLARE_FLAGS(GraphicsItemFlags, GraphicsItemFlag) @@ -453,6 +454,7 @@ private: }; Q_DECLARE_OPERATORS_FOR_FLAGS(QGraphicsItem::GraphicsItemFlags) +Q_DECLARE_INTERFACE(QGraphicsItem, "com.trolltech.Qt.QGraphicsItem") inline void QGraphicsItem::setPos(qreal ax, qreal ay) { setPos(QPointF(ax, ay)); } @@ -505,9 +507,9 @@ class Q_GUI_EXPORT QGraphicsObject : public QObject, public QGraphicsItem Q_OBJECT Q_PROPERTY(QGraphicsObject * parent READ parentObject WRITE setParentItem NOTIFY parentChanged DESIGNABLE false) Q_PROPERTY(QString id READ objectName WRITE setObjectName) - Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged) + Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged FINAL) Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged) - Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged) + Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged FINAL) Q_PROPERTY(QPointF pos READ pos WRITE setPos) Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged) Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged) diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 786a435..24326f6 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -95,7 +95,7 @@ public: void purge(); }; -class Q_AUTOTEST_EXPORT QGraphicsItemPrivate +class Q_GUI_EXPORT QGraphicsItemPrivate { Q_DECLARE_PUBLIC(QGraphicsItem) public: @@ -165,6 +165,7 @@ public: acceptedTouchBeginEvent(0), filtersDescendantEvents(0), sceneTransformTranslateOnly(0), + mouseSetsFocus(1), globalStackingOrder(-1), q_ptr(0) { @@ -201,7 +202,7 @@ public: virtual QVariant inputMethodQueryHelper(Qt::InputMethodQuery query) const; static bool movableAncestorIsSelected(const QGraphicsItem *item); - void setPosHelper(const QPointF &pos); + virtual void setPosHelper(const QPointF &pos); void setTransformHelper(const QTransform &transform); void appendGraphicsTransform(QGraphicsTransform *t); void setVisibleHelper(bool newVisible, bool explicitly, bool update = true); @@ -398,6 +399,7 @@ public: void setSubFocus(); void clearSubFocus(); + void resetFocusProxy(); inline QTransform transformToParent() const; inline void ensureSortedChildren(); @@ -419,6 +421,7 @@ public: int siblingIndex; int depth; QGraphicsItem *focusProxy; + QList<QGraphicsItem **> focusProxyRefs; QGraphicsItem *subFocusItem; Qt::InputMethodHints imHints; @@ -450,7 +453,7 @@ public: // New 32 bits quint32 fullUpdatePending : 1; - quint32 flags : 14; + quint32 flags : 15; quint32 dirtyChildrenBoundingRect : 1; quint32 paintedViewBoundingRectsNeedRepaint : 1; quint32 dirtySceneTransform : 1; @@ -463,7 +466,8 @@ public: quint32 acceptedTouchBeginEvent : 1; quint32 filtersDescendantEvents : 1; quint32 sceneTransformTranslateOnly : 1; - quint32 unused : 5; // feel free to use + quint32 mouseSetsFocus : 1; + quint32 unused : 3; // feel free to use // Optional stacking order int globalStackingOrder; diff --git a/src/gui/graphicsview/qgraphicsitemanimation.cpp b/src/gui/graphicsview/qgraphicsitemanimation.cpp index 0d7a3c6..c9b95ad 100644 --- a/src/gui/graphicsview/qgraphicsitemanimation.cpp +++ b/src/gui/graphicsview/qgraphicsitemanimation.cpp @@ -44,7 +44,6 @@ \brief The QGraphicsItemAnimation class provides simple animation support for QGraphicsItem. \since 4.2 - \ingroup multimedia \ingroup graphicsview-api The QGraphicsItemAnimation class animates a QGraphicsItem. You can diff --git a/src/gui/graphicsview/qgraphicslayout.cpp b/src/gui/graphicsview/qgraphicslayout.cpp index 3f039c6..58c174c 100644 --- a/src/gui/graphicsview/qgraphicslayout.cpp +++ b/src/gui/graphicsview/qgraphicslayout.cpp @@ -57,7 +57,6 @@ QT_BEGIN_NAMESPACE \brief The QGraphicsLayout class provides the base class for all layouts in Graphics View. \since 4.4 - \ingroup multimedia \ingroup graphicsview-api QGraphicsLayout is an abstract class that defines a virtual API for diff --git a/src/gui/graphicsview/qgraphicslayout.h b/src/gui/graphicsview/qgraphicslayout.h index d7e087b..1a21e53 100644 --- a/src/gui/graphicsview/qgraphicslayout.h +++ b/src/gui/graphicsview/qgraphicslayout.h @@ -85,6 +85,8 @@ private: friend class QGraphicsWidget; }; +Q_DECLARE_INTERFACE(QGraphicsLayout, "com.trolltech.Qt.QGraphicsLayout") + #endif QT_END_NAMESPACE diff --git a/src/gui/graphicsview/qgraphicslayoutitem.cpp b/src/gui/graphicsview/qgraphicslayoutitem.cpp index 46cf620..d33beaf 100644 --- a/src/gui/graphicsview/qgraphicslayoutitem.cpp +++ b/src/gui/graphicsview/qgraphicslayoutitem.cpp @@ -264,7 +264,6 @@ void QGraphicsLayoutItemPrivate::setSizeComponent( \brief The QGraphicsLayoutItem class can be inherited to allow your custom items to be managed by layouts. \since 4.4 - \ingroup multimedia \ingroup graphicsview-api QGraphicsLayoutItem is an abstract class that defines a set of virtual diff --git a/src/gui/graphicsview/qgraphicslayoutitem.h b/src/gui/graphicsview/qgraphicslayoutitem.h index 717777a..fb25e0c 100644 --- a/src/gui/graphicsview/qgraphicslayoutitem.h +++ b/src/gui/graphicsview/qgraphicslayoutitem.h @@ -122,6 +122,8 @@ private: friend class QGraphicsLayout; }; +Q_DECLARE_INTERFACE(QGraphicsLayoutItem, "com.trolltech.Qt.QGraphicsLayoutItem") + inline void QGraphicsLayoutItem::setMinimumSize(qreal aw, qreal ah) { setMinimumSize(QSizeF(aw, ah)); } inline void QGraphicsLayoutItem::setPreferredSize(qreal aw, qreal ah) diff --git a/src/gui/graphicsview/qgraphicslinearlayout.cpp b/src/gui/graphicsview/qgraphicslinearlayout.cpp index c0ff00e..185780a 100644 --- a/src/gui/graphicsview/qgraphicslinearlayout.cpp +++ b/src/gui/graphicsview/qgraphicslinearlayout.cpp @@ -44,7 +44,6 @@ \brief The QGraphicsLinearLayout class provides a horizontal or vertical layout for managing widgets in Graphics View. \since 4.4 - \ingroup multimedia \ingroup graphicsview-api The default orientation for a linear layout is Qt::Horizontal. You can diff --git a/src/gui/graphicsview/qgraphicsproxywidget.cpp b/src/gui/graphicsview/qgraphicsproxywidget.cpp index 784ee0e..4f626a2 100644 --- a/src/gui/graphicsview/qgraphicsproxywidget.cpp +++ b/src/gui/graphicsview/qgraphicsproxywidget.cpp @@ -67,7 +67,6 @@ QT_BEGIN_NAMESPACE \brief The QGraphicsProxyWidget class provides a proxy layer for embedding a QWidget in a QGraphicsScene. \since 4.4 - \ingroup multimedia \ingroup graphicsview-api QGraphicsProxyWidget embeds QWidget-based widgets, for example, a diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 9b7dfe6..a2a92b8 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -44,9 +44,8 @@ \brief The QGraphicsScene class provides a surface for managing a large number of 2D graphical items. \since 4.2 - \ingroup multimedia \ingroup graphicsview-api - \mainclass + The class serves as a container for QGraphicsItems. It is used together with QGraphicsView for visualizing graphical items, such as lines, @@ -494,11 +493,7 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item) item->d_func()->scene = 0; // Unregister focus proxy. - QMultiHash<QGraphicsItem *, QGraphicsItem *>::iterator it = focusProxyReverseMap.find(item); - while (it != focusProxyReverseMap.end() && it.key() == item) { - it.value()->d_ptr->focusProxy = 0; - it = focusProxyReverseMap.erase(it); - } + item->d_ptr->resetFocusProxy(); // Remove from parent, or unregister from toplevels. if (QGraphicsItem *parentItem = item->parentItem()) { @@ -1083,7 +1078,7 @@ void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mou // Set focus on the topmost enabled item that can take focus. bool setFocus = false; foreach (QGraphicsItem *item, cachedItemsUnderMouse) { - if (item->isEnabled() && (item->flags() & QGraphicsItem::ItemIsFocusable)) { + if (item->isEnabled() && ((item->flags() & QGraphicsItem::ItemIsFocusable) && item->d_ptr->mouseSetsFocus)) { if (!item->isWidget() || ((QGraphicsWidget *)item)->focusPolicy() & Qt::ClickFocus) { setFocus = true; if (item != q->focusItem()) @@ -3806,7 +3801,8 @@ void QGraphicsScene::wheelEvent(QGraphicsSceneWheelEvent *wheelEvent) bool hasSetFocus = false; foreach (QGraphicsItem *item, wheelCandidates) { - if (!hasSetFocus && item->isEnabled() && (item->flags() & QGraphicsItem::ItemIsFocusable)) { + if (!hasSetFocus && item->isEnabled() + && ((item->flags() & QGraphicsItem::ItemIsFocusable) && item->d_ptr->mouseSetsFocus)) { if (item->isWidget() && static_cast<QGraphicsWidget *>(item)->focusPolicy() == Qt::WheelFocus) { hasSetFocus = true; if (item != focusItem()) @@ -5302,7 +5298,7 @@ bool QGraphicsScenePrivate::sendTouchBeginEvent(QGraphicsItem *origin, QTouchEve // Set focus on the topmost enabled item that can take focus. bool setFocus = false; foreach (QGraphicsItem *item, cachedItemsUnderMouse) { - if (item->isEnabled() && (item->flags() & QGraphicsItem::ItemIsFocusable)) { + if (item->isEnabled() && ((item->flags() & QGraphicsItem::ItemIsFocusable) && item->d_ptr->mouseSetsFocus)) { if (!item->isWidget() || ((QGraphicsWidget *)item)->focusPolicy() & Qt::ClickFocus) { setFocus = true; if (item != q->focusItem()) diff --git a/src/gui/graphicsview/qgraphicsscene_p.h b/src/gui/graphicsview/qgraphicsscene_p.h index 8b53306..685f534 100644 --- a/src/gui/graphicsview/qgraphicsscene_p.h +++ b/src/gui/graphicsview/qgraphicsscene_p.h @@ -59,6 +59,7 @@ #include "qgraphicssceneevent.h" #include "qgraphicsview.h" +#include "qgraphicsview_p.h" #include "qgraphicsitem_p.h" #include <private/qobject_p.h> @@ -131,7 +132,6 @@ public: QGraphicsWidget *activeWindow; int activationRefCount; void setFocusItemHelper(QGraphicsItem *item, Qt::FocusReason focusReason); - QMultiHash<QGraphicsItem *, QGraphicsItem *> focusProxyReverseMap; QList<QGraphicsWidget *> popupWidgets; void addPopup(QGraphicsWidget *widget); diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp index 37308f0..433d0a8 100644 --- a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp +++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp @@ -44,9 +44,8 @@ \brief The QGraphicsSceneBspTreeIndex class provides an implementation of a BSP indexing algorithm for discovering items in QGraphicsScene. \since 4.6 - \ingroup multimedia \ingroup graphicsview-api - \mainclass + \internal QGraphicsSceneBspTreeIndex index use a BSP(Binary Space Partitioning) diff --git a/src/gui/graphicsview/qgraphicssceneevent.cpp b/src/gui/graphicsview/qgraphicssceneevent.cpp index f04b241..3ec14c3 100644 --- a/src/gui/graphicsview/qgraphicssceneevent.cpp +++ b/src/gui/graphicsview/qgraphicssceneevent.cpp @@ -44,7 +44,6 @@ \brief The QGraphicsSceneEvent class provides a base class for all graphics view related events. \since 4.2 - \ingroup multimedia \ingroup graphicsview-api When a QGraphicsView receives Qt mouse, keyboard, and drag and @@ -86,7 +85,6 @@ \brief The QGraphicsSceneMouseEvent class provides mouse events in the graphics view framework. \since 4.2 - \ingroup multimedia \ingroup graphicsview-api When a QGraphicsView receives a QMouseEvent, it translates it to @@ -111,7 +109,6 @@ \brief The QGraphicsSceneWheelEvent class provides wheel events in the graphics view framework. \since 4.2 - \ingroup multimedia \ingroup graphicsview-api \l{QWheelEvent}{QWheelEvent}s received by a QGraphicsView are translated @@ -128,7 +125,6 @@ \brief The QGraphicsSceneContextMenuEvent class provides context menu events in the graphics view framework. \since 4.2 - \ingroup multimedia \ingroup graphicsview-api A QContextMenuEvent received by a QGraphicsView is translated @@ -160,7 +156,6 @@ \brief The QGraphicsSceneHoverEvent class provides hover events in the graphics view framework. \since 4.2 - \ingroup multimedia \ingroup graphicsview-api When a QGraphicsView receives a QHoverEvent event, it translates @@ -176,7 +171,6 @@ \brief The QGraphicsSceneHelpEvent class provides events when a tooltip is requested. \since 4.2 - \ingroup multimedia \ingroup graphicsview-api When a QGraphicsView receives a QEvent of type @@ -201,7 +195,6 @@ \brief The QGraphicsSceneDragDropEvent class provides events for drag and drop in the graphics view framework. \since 4.2 - \ingroup multimedia \ingroup graphicsview-api QGraphicsView inherits the drag and drop functionality provided @@ -226,7 +219,6 @@ \brief The QGraphicsSceneResizeEvent class provides events for widget resizing in the graphics view framework. \since 4.4 - \ingroup multimedia \ingroup graphicsview-api A QGraphicsWidget sends itself a QGraphicsSceneResizeEvent immediately @@ -243,7 +235,6 @@ \brief The QGraphicsSceneMoveEvent class provides events for widget moving in the graphics view framework. \since 4.4 - \ingroup multimedia \ingroup graphicsview-api A QGraphicsWidget sends itself a QGraphicsSceneMoveEvent immediately when diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp index 37a2fc3..feb44bb 100644 --- a/src/gui/graphicsview/qgraphicssceneindex.cpp +++ b/src/gui/graphicsview/qgraphicssceneindex.cpp @@ -43,9 +43,8 @@ \brief The QGraphicsSceneIndex class provides a base class to implement a custom indexing algorithm for discovering items in QGraphicsScene. \since 4.6 - \ingroup multimedia \ingroup graphicsview-api - \mainclass + \internal The QGraphicsSceneIndex class provides a base class to implement diff --git a/src/gui/graphicsview/qgraphicstransform.cpp b/src/gui/graphicsview/qgraphicstransform.cpp index 005460e..edfcf8a 100644 --- a/src/gui/graphicsview/qgraphicstransform.cpp +++ b/src/gui/graphicsview/qgraphicstransform.cpp @@ -44,6 +44,7 @@ \brief The QGraphicsTransform class is an abstract base class for building advanced transformations on QGraphicsItems. \since 4.6 + \ingroup graphicsview-api As an alternative to QGraphicsItem::transform, QGraphicsTransform lets you create and control advanced transformations that can be configured diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index f9700c5..07dc6ad 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -48,9 +48,8 @@ static const int QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS = 503; // largest prime < \brief The QGraphicsView class provides a widget for displaying the contents of a QGraphicsScene. \since 4.2 - \ingroup multimedia \ingroup graphicsview-api - \mainclass + QGraphicsView visualizes the contents of a QGraphicsScene in a scrollable viewport. To create a scene with geometrical items, see QGraphicsScene's @@ -493,8 +492,8 @@ void QGraphicsViewPrivate::centerView(QGraphicsView::ViewportAnchor anchor) // Last scene pos: lastMouseMoveScenePoint // Current mouse pos: QPointF transformationDiff = q->mapToScene(viewport->rect().center()) - - q->mapToScene(q->mapFromGlobal(QCursor::pos())); - q->centerOn(lastMouseMoveScenePoint + transformationDiff);; + - q->mapToScene(viewport->mapFromGlobal(QCursor::pos())); + q->centerOn(lastMouseMoveScenePoint + transformationDiff); } else { q->centerOn(lastCenterPoint); } diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index b3cf547..157fbe5 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -74,7 +74,6 @@ QT_BEGIN_NAMESPACE \brief The QGraphicsWidget class is the base class for all widget items in a QGraphicsScene. \since 4.4 - \ingroup multimedia \ingroup graphicsview-api QGraphicsWidget is an extended base item that provides extra functionality @@ -258,7 +257,7 @@ QGraphicsWidget::~QGraphicsWidget() //we check if we have a layout previously if (d->layout) { - delete d->layout; + QGraphicsLayout *temp = d->layout; foreach (QGraphicsItem * item, childItems()) { // In case of a custom layout which doesn't remove and delete items, we ensure that // the parent layout item does not point to the deleted layout. This code is here to @@ -269,6 +268,8 @@ QGraphicsWidget::~QGraphicsWidget() widget->setParentLayoutItem(0); } } + d->layout = 0; + delete temp; } // Remove this graphics widget from widgetStyles diff --git a/src/gui/graphicsview/qgraphicswidget.h b/src/gui/graphicsview/qgraphicswidget.h index ad16685..ea8e78e 100644 --- a/src/gui/graphicsview/qgraphicswidget.h +++ b/src/gui/graphicsview/qgraphicswidget.h @@ -69,6 +69,7 @@ class QGraphicsWidgetPrivate; class Q_GUI_EXPORT QGraphicsWidget : public QGraphicsObject, public QGraphicsLayoutItem { Q_OBJECT + Q_INTERFACES(QGraphicsItem QGraphicsLayoutItem) Q_PROPERTY(QPalette palette READ palette WRITE setPalette) Q_PROPERTY(QFont font READ font WRITE setFont) Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection RESET unsetLayoutDirection) diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri index 1010f7f..0970385 100644 --- a/src/gui/image/image.pri +++ b/src/gui/image/image.pri @@ -92,7 +92,7 @@ SOURCES += \ SOURCES += image/qpnghandler.cpp contains(QT_CONFIG, system-png) { - unix:LIBS += -lpng + unix:LIBS_PRIVATE += -lpng win32:LIBS += libpng.lib } else { !isEqual(QT_ARCH, i386):!isEqual(QT_ARCH, x86_64):DEFINES += PNG_NO_ASSEMBLER_CODE diff --git a/src/gui/image/qbitmap.cpp b/src/gui/image/qbitmap.cpp index 5827dc1..e239022 100644 --- a/src/gui/image/qbitmap.cpp +++ b/src/gui/image/qbitmap.cpp @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE \class QBitmap \brief The QBitmap class provides monochrome (1-bit depth) pixmaps. - \ingroup multimedia + \ingroup painting \ingroup shared The QBitmap class is a monochrome off-screen paint device used diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index 0d854d0..5a88e29 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -445,9 +445,9 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loaderV2, \brief The QIcon class provides scalable icons in different modes and states. - \ingroup multimedia + \ingroup painting \ingroup shared - \mainclass + A QIcon can generate smaller, larger, active, and disabled pixmaps from the set of pixmaps it is given. Such pixmaps are used by Qt @@ -871,7 +871,7 @@ QList<QSize> QIcon::availableSizes(Mode mode, State state) const \since 4.6 Sets the search paths for icon themes to \a paths. - \sa themeSearchPaths(), fromTheme() + \sa themeSearchPaths(), fromTheme(), setThemeName() */ void QIcon::setThemeSearchPaths(const QStringList &paths) { @@ -893,7 +893,7 @@ void QIcon::setThemeSearchPaths(const QStringList &paths) On Mac the default search path will search in the [Contents/Resources/icons] part of the application bundle. - \sa setThemeSearchPaths(), fromTheme() + \sa setThemeSearchPaths(), fromTheme(), setThemeName() */ QStringList QIcon::themeSearchPaths() { @@ -903,16 +903,17 @@ QStringList QIcon::themeSearchPaths() /*! \since 4.6 - Sets the current icon theme. + Sets the current icon theme to \a name. - The name should correspond to a directory name in the - current \ themeSearchPath() containing an index.theme - file describing it's contents.. + The \a name should correspond to a directory name in the + current themeSearchPath() containing an index.theme + file describing it's contents. + \sa themeSearchPaths(), themeName() */ -void QIcon::setThemeName(const QString &path) +void QIcon::setThemeName(const QString &name) { - QIconLoader::instance()->setThemeName(path); + QIconLoader::instance()->setThemeName(name); } /*! @@ -923,7 +924,8 @@ void QIcon::setThemeName(const QString &path) On X11, the current icon theme depends on your desktop settings. On other platforms it is not set by default. - \sa themeSearchPaths(), fromTheme(), hasThemeIcon() + \sa setThemeName(), themeSearchPaths(), fromTheme(), + hasThemeIcon() */ QString QIcon::themeName() { @@ -960,7 +962,7 @@ QString QIcon::themeName() compliant theme in one of your themeSearchPaths() and set the appropriate themeName(). - \sa themeName(), themeSearchPaths() + \sa themeName(), setThemeName(), themeSearchPaths() */ QIcon QIcon::fromTheme(const QString &name, const QIcon &fallback) { @@ -994,10 +996,10 @@ QIcon QIcon::fromTheme(const QString &name, const QIcon &fallback) /*! \since 4.6 - Returns true if there is an icon available for a \a name in the current - icon theme, otherwise returns false. + Returns true if there is an icon available for \a name in the + current icon theme, otherwise returns false. - \sa themeSearchPaths(), fromTheme() + \sa themeSearchPaths(), fromTheme(), setThemeName() */ bool QIcon::hasThemeIcon(const QString &name) { diff --git a/src/gui/image/qiconengine.cpp b/src/gui/image/qiconengine.cpp index 8e39607..930834d 100644 --- a/src/gui/image/qiconengine.cpp +++ b/src/gui/image/qiconengine.cpp @@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE \brief The QIconEngine class provides an abstract base class for QIcon renderers. - \ingroup multimedia + \ingroup painting \bold {Use QIconEngineV2 instead.} @@ -144,7 +144,7 @@ void QIconEngine::addFile(const QString &/*fileName*/, const QSize &/*size*/, QI \brief The QIconEngineV2 class provides an abstract base class for QIcon renderers. - \ingroup multimedia + \ingroup painting \since 4.3 An icon engine renders \l{QIcon}s. With icon engines, you can diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 5e635d6..86e27bd 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -61,11 +61,7 @@ #include <qhash.h> -#ifdef QT_RASTER_IMAGEENGINE #include <private/qpaintengine_raster_p.h> -#else -#include <qpaintengine.h> -#endif #include <private/qimage_p.h> @@ -343,9 +339,9 @@ bool QImageData::checkForAlphaPixels() const /*! \class QImage - \ingroup multimedia + \ingroup painting \ingroup shared - \mainclass + \reentrant \brief The QImage class provides a hardware-independent image @@ -5254,11 +5250,10 @@ QPaintEngine *QImage::paintEngine() const if (!d) return 0; -#ifdef QT_RASTER_IMAGEENGINE if (!d->paintEngine) { d->paintEngine = new QRasterPaintEngine(const_cast<QImage *>(this)); } -#endif + return d->paintEngine; } diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp index 06c8f21..b127de7 100644 --- a/src/gui/image/qimagereader.cpp +++ b/src/gui/image/qimagereader.cpp @@ -47,7 +47,7 @@ for reading images from files or other devices. \reentrant - \ingroup multimedia + \ingroup painting \ingroup io The most common way to read images is through QImage and QPixmap's diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp index c734169..1f06493 100644 --- a/src/gui/image/qimagewriter.cpp +++ b/src/gui/image/qimagewriter.cpp @@ -45,7 +45,7 @@ for writing images to files or other devices. \reentrant - \ingroup multimedia + \ingroup painting \ingroup io QImageWriter supports setting format specific options, such as the diff --git a/src/gui/image/qmovie.cpp b/src/gui/image/qmovie.cpp index 2265e7b..179e6bb 100644 --- a/src/gui/image/qmovie.cpp +++ b/src/gui/image/qmovie.cpp @@ -45,7 +45,7 @@ \brief The QMovie class is a convenience class for playing movies with QImageReader. - \ingroup multimedia + \ingroup painting First, create a QMovie object by passing either the name of a file or a pointer to a QIODevice containing an animated image format to QMovie's @@ -356,7 +356,7 @@ QFrameInfo QMoviePrivate::infoForFrame(int frameNumber) reader = new QImageReader(device, format); else reader = new QImageReader(absoluteFilePath, format); - reader->canRead(); // Provoke a device->open() call + (void)reader->canRead(); // Provoke a device->open() call reader->device()->seek(initialDevicePos); reader->setBackgroundColor(bgColor); reader->setScaledSize(scaledSize); diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp index 2dcb9c7..1136a97 100644 --- a/src/gui/image/qpicture.cpp +++ b/src/gui/image/qpicture.cpp @@ -69,9 +69,9 @@ void qt_format_text(const QFont &fnt, const QRectF &_r, \brief The QPicture class is a paint device that records and replays QPainter commands. - \ingroup multimedia + \ingroup painting \ingroup shared - \mainclass + A picture serializes painter commands to an IO device in a platform-independent format. They are sometimes referred to as meta-files. @@ -1303,7 +1303,7 @@ QList<QByteArray> QPicture::outputFormats() \brief The QPictureIO class contains parameters for loading and saving pictures. - \ingroup multimedia + \ingroup painting \ingroup io QPictureIO contains a QIODevice object that is used for picture data diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 93077d7..79b1f17 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -854,14 +854,10 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers return false; QPixmap pm; - QT_TRY { - if (data->pixelType() == QPixmapData::BitmapType) - pm = QBitmap::fromImage(image, flags); - else - pm = fromImage(image, flags); - } QT_CATCH (const std::bad_alloc &) { - // swallow bad allocs and leave pm a null pixmap - } + if (data->pixelType() == QPixmapData::BitmapType) + pm = QBitmap::fromImage(image, flags); + else + pm = fromImage(image, flags); if (!pm.isNull()) { *this = pm; QPixmapCache::insert(key, *this); @@ -1569,9 +1565,9 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode) \brief The QPixmap class is an off-screen image representation that can be used as a paint device. - \ingroup multimedia + \ingroup painting \ingroup shared - \mainclass + Qt provides four classes for handling image data: QImage, QPixmap, QBitmap and QPicture. QImage is designed and optimized for I/O, @@ -1993,16 +1989,11 @@ QPixmap QPixmap::fromImage(const QImage &image, Qt::ImageConversionFlags flags) if (image.isNull()) return QPixmap(); - QT_TRY { - QGraphicsSystem* gs = QApplicationPrivate::graphicsSystem(); - QScopedPointer<QPixmapData> data(gs ? gs->createPixmapData(QPixmapData::PixmapType) - : QGraphicsSystem::createDefaultPixmapData(QPixmapData::PixmapType)); - data->fromImage(image, flags); - return QPixmap(data.take()); - } QT_CATCH(const std::bad_alloc &) { - // we're out of memory - return a null Pixmap - return QPixmap(); - } + QGraphicsSystem* gs = QApplicationPrivate::graphicsSystem(); + QScopedPointer<QPixmapData> data(gs ? gs->createPixmapData(QPixmapData::PixmapType) + : QGraphicsSystem::createDefaultPixmapData(QPixmapData::PixmapType)); + data->fromImage(image, flags); + return QPixmap(data.take()); } /*! diff --git a/src/gui/image/qpixmap_mac.cpp b/src/gui/image/qpixmap_mac.cpp index 8c911bb..5959da1 100644 --- a/src/gui/image/qpixmap_mac.cpp +++ b/src/gui/image/qpixmap_mac.cpp @@ -38,7 +38,6 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -//#define QT_RASTER_PAINTENGINE #include "qpixmap.h" #include "qimage.h" @@ -52,9 +51,6 @@ #include <private/qdrawhelper_p.h> #include <private/qpixmap_mac_p.h> #include <private/qpixmap_raster_p.h> -#ifdef QT_RASTER_PAINTENGINE -# include <private/qpaintengine_raster_p.h> -#endif #include <private/qpaintengine_mac_p.h> #include <private/qt_mac_p.h> #include <private/qt_cocoa_helpers_mac_p.h> @@ -1098,14 +1094,7 @@ QPaintEngine* QMacPixmapData::paintEngine() const { if (!pengine) { QMacPixmapData *that = const_cast<QMacPixmapData*>(this); -#ifdef QT_RASTER_PAINTENGINE - if (qgetenv("QT_MAC_USE_COREGRAPHICS").isNull()) - that->pengine = new QRasterPaintEngine(); - else - that->pengine = new QCoreGraphicsPaintEngine(); -#else that->pengine = new QCoreGraphicsPaintEngine(); -#endif } return pengine; } diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index 58b3ee4..ab19924 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -202,10 +202,13 @@ return a null QPixmap. QPixmap QPixmap::fromSymbianCFbsBitmap(CFbsBitmap *bitmap) { + if (!bitmap) + return QPixmap(); + int width = bitmap->SizeInPixels().iWidth; int height = bitmap->SizeInPixels().iHeight; - if (!bitmap || width <= 0 || height <= 0 || bitmap->IsCompressedInRAM()) + if (width <= 0 || height <= 0 || bitmap->IsCompressedInRAM()) return QPixmap(); TDisplayMode displayMode = bitmap->DisplayMode(); diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp index 5f0564e..b8d6ac1 100644 --- a/src/gui/image/qpixmapcache.cpp +++ b/src/gui/image/qpixmapcache.cpp @@ -51,8 +51,7 @@ QT_BEGIN_NAMESPACE \brief The QPixmapCache class provides an application-wide cache for pixmaps. - \ingroup environment - \ingroup multimedia + \ingroup painting This class is a tool for optimized drawing with QPixmap. You can use it to store temporary pixmaps that are expensive to generate diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp index cd80b10..968ecd7 100644 --- a/src/gui/image/qpixmapfilter.cpp +++ b/src/gui/image/qpixmapfilter.cpp @@ -65,7 +65,7 @@ public: /*! \class QPixmapFilter \since 4.5 - \ingroup multimedia + \ingroup painting \brief The QPixmapFilter class provides the basic functionality for pixmap filter classes. Pixmap filter can be for example colorize or blur. @@ -172,7 +172,7 @@ QRectF QPixmapFilter::boundingRectFor(const QRectF &rect) const /*! \class QPixmapConvolutionFilter \since 4.5 - \ingroup multimedia + \ingroup painting \brief The QPixmapConvolutionFilter class provides convolution filtering for pixmaps. @@ -517,7 +517,7 @@ static void grayscale(const QImage &image, QImage &dest, const QRect& rect = QRe /*! \class QPixmapColorizeFilter \since 4.5 - \ingroup multimedia + \ingroup painting \brief The QPixmapColorizeFilter class provides colorizing filtering for pixmaps. @@ -641,7 +641,7 @@ public: /*! \class QPixmapDropShadowFilter \since 4.5 - \ingroup multimedia + \ingroup painting \brief The QPixmapDropShadowFilter class is a convenience class for drawing pixmaps with drop shadows. diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp index e3475d6..64bc5d3 100644 --- a/src/gui/image/qpnghandler.cpp +++ b/src/gui/image/qpnghandler.cpp @@ -956,7 +956,7 @@ QVariant QPngHandler::option(ImageOption option) const void QPngHandler::setOption(ImageOption option, const QVariant &value) { if (option == Gamma) - d->gamma = value.toDouble(); + d->gamma = value.toFloat(); else if (option == Quality) d->quality = value.toInt(); else if (option == Description) diff --git a/src/gui/image/qppmhandler.cpp b/src/gui/image/qppmhandler.cpp index 77ccb48..ed8f4c1 100644 --- a/src/gui/image/qppmhandler.cpp +++ b/src/gui/image/qppmhandler.cpp @@ -80,7 +80,7 @@ static int read_pbm_int(QIODevice *d) else if (isspace((uchar) c)) continue; else if (c == '#') - d->readLine(buf, buflen); + (void)d->readLine(buf, buflen); else break; } diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index d4f8341..833e000 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -102,7 +102,7 @@ void QCoeFepInputContext::reset() void QCoeFepInputContext::ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateEvent aEventType) { - QT_TRAP_THROWING(m_fepState->ReportAknEdStateEventL(QT_EAknCursorPositionChanged)); + QT_TRAP_THROWING(m_fepState->ReportAknEdStateEventL(aEventType)); } void QCoeFepInputContext::update() diff --git a/src/gui/inputmethod/qinputcontextfactory.cpp b/src/gui/inputmethod/qinputcontextfactory.cpp index 6279bed..5b8e5d0 100644 --- a/src/gui/inputmethod/qinputcontextfactory.cpp +++ b/src/gui/inputmethod/qinputcontextfactory.cpp @@ -89,7 +89,6 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, \class QInputContextFactory \brief The QInputContextFactory class creates QInputContext objects. - \ingroup appearance The input context factory creates a QInputContext object for a given key with QInputContextFactory::create(). diff --git a/src/gui/itemviews/qabstractitemdelegate.cpp b/src/gui/itemviews/qabstractitemdelegate.cpp index 22b96fc..447538a 100644 --- a/src/gui/itemviews/qabstractitemdelegate.cpp +++ b/src/gui/itemviews/qabstractitemdelegate.cpp @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE data items from a model. \ingroup model-view - \mainclass + A QAbstractItemDelegate provides the interface and common functionality for delegates in the model/view architecture. Delegates display diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 78f81cb..8f8eae5 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -74,6 +74,7 @@ QAbstractItemViewPrivate::QAbstractItemViewPrivate() currentlyCommittingEditor(0), pressedModifiers(Qt::NoModifier), pressedPosition(QPoint(-1, -1)), + pressedAlreadySelected(false), viewportEnteredNeeded(false), state(QAbstractItemView::NoState), editTriggers(QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed), @@ -166,7 +167,7 @@ void QAbstractItemViewPrivate::checkMouseMove(const QPersistentModelIndex &index item view classes. \ingroup model-view - \mainclass + QAbstractItemView class is the base class for every standard view that uses a QAbstractItemModel. QAbstractItemView is an abstract @@ -584,7 +585,7 @@ void QAbstractItemView::setModel(QAbstractItemModel *model) "QAbstractItemView::setModel", "The parent of a top level index should be invalid"); - if (d->model && d->model != QAbstractItemModelPrivate::staticEmptyModel()) { + if (d->model != QAbstractItemModelPrivate::staticEmptyModel()) { connect(d->model, SIGNAL(destroyed()), this, SLOT(_q_modelDestroyed())); connect(d->model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), diff --git a/src/gui/itemviews/qcolumnview.cpp b/src/gui/itemviews/qcolumnview.cpp index fd8106f..9597656 100644 --- a/src/gui/itemviews/qcolumnview.cpp +++ b/src/gui/itemviews/qcolumnview.cpp @@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE \brief The QColumnView class provides a model/view implementation of a column view. \ingroup model-view \ingroup advanced - \mainclass + QColumnView displays a model in a number of QListViews, one for each hierarchy in the tree. This is sometimes referred to as a cascading list. diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp index efbddde..5d3bb12 100644 --- a/src/gui/itemviews/qheaderview.cpp +++ b/src/gui/itemviews/qheaderview.cpp @@ -88,7 +88,7 @@ QDataStream &operator>>(QDataStream &in, QHeaderViewPrivate::SectionSpan &span) item views. \ingroup model-view - \mainclass + A QHeaderView displays the headers used in item views such as the QTableView and QTreeView classes. It takes the place of Qt3's \c QHeader @@ -2615,7 +2615,7 @@ void QHeaderView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bot int first = orientation() == Qt::Horizontal ? topLeft.column() : topLeft.row(); int last = orientation() == Qt::Horizontal ? bottomRight.column() : bottomRight.row(); for (int i = first; i <= last && !resizeRequired; ++i) - resizeRequired = (resizeRequired && resizeMode(i)); + resizeRequired = (resizeMode(i) == ResizeToContents); if (resizeRequired) d->doDelayedResizeSections(); } diff --git a/src/gui/itemviews/qitemdelegate.cpp b/src/gui/itemviews/qitemdelegate.cpp index 3e42ea6..5b69f44 100644 --- a/src/gui/itemviews/qitemdelegate.cpp +++ b/src/gui/itemviews/qitemdelegate.cpp @@ -185,7 +185,7 @@ QSizeF QItemDelegatePrivate::doTextLayout(int lineWidth) const data items from a model. \ingroup model-view - \mainclass + QItemDelegate can be used to provide custom display features and editor widgets for item views based on QAbstractItemView subclasses. Using a @@ -352,7 +352,10 @@ void QItemDelegate::setClipping(bool clip) QString QItemDelegatePrivate::valueToText(const QVariant &value, const QStyleOptionViewItemV4 &option) { QString text; - switch (value.type()) { + switch (value.userType()) { + case QMetaType::Float: + text = option.locale.toString(value.toFloat(), 'g'); + break; case QVariant::Double: text = option.locale.toString(value.toDouble(), 'g', DBL_DIG); break; @@ -719,8 +722,6 @@ void QItemDelegate::drawDisplay(QPainter *painter, const QStyleOptionViewItem &o //let's add the last line (after the last QChar::LineSeparator) elided += option.fontMetrics.elidedText(text.mid(start), option.textElideMode, textRect.width()); - if (end != -1) - elided += QChar::LineSeparator; } d->textLayout.setText(elided); textLayoutSize = d->doTextLayout(textRect.width()); diff --git a/src/gui/itemviews/qitemselectionmodel_p.h b/src/gui/itemviews/qitemselectionmodel_p.h index 6e1046c..e9e6bb1 100644 --- a/src/gui/itemviews/qitemselectionmodel_p.h +++ b/src/gui/itemviews/qitemselectionmodel_p.h @@ -65,7 +65,7 @@ public: QItemSelectionModelPrivate() : model(0), currentCommand(QItemSelectionModel::NoUpdate), - tableSelected(false) {} + tableSelected(false), tableColCount(0), tableRowCount(0) {} QItemSelection expandSelection(const QItemSelection &selection, QItemSelectionModel::SelectionFlags command) const; diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index 945d5e7..ea38f5f 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -66,7 +66,7 @@ QT_BEGIN_NAMESPACE \ingroup model-view \ingroup advanced - \mainclass + A QListView presents items stored in a model, either as a simple non-hierarchical list, or as a collection of icons. This class is used @@ -1957,7 +1957,6 @@ bool QListView::event(QEvent *e) QListViewPrivate::QListViewPrivate() : QAbstractItemViewPrivate(), dynamicListView(0), - staticListView(0), wrap(false), space(0), flow(QListView::TopToBottom), @@ -1968,14 +1967,17 @@ QListViewPrivate::QListViewPrivate() modeProperties(0), column(0), uniformItemSizes(false), - batchSize(100) + batchSize(100), + showElasticBand(false) { } QListViewPrivate::~QListViewPrivate() { - delete staticListView; - delete dynamicListView; + if (viewMode == QListView::ListMode) + delete staticListView; + else + delete dynamicListView; } void QListViewPrivate::clear() diff --git a/src/gui/itemviews/qlistview_p.h b/src/gui/itemviews/qlistview_p.h index 1131059..6c8d324 100644 --- a/src/gui/itemviews/qlistview_p.h +++ b/src/gui/itemviews/qlistview_p.h @@ -351,9 +351,10 @@ public: QItemViewPaintPairs draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const; - // ### FIXME: we only need one at a time - QDynamicListViewBase *dynamicListView; - QStaticListViewBase *staticListView; + union { + QDynamicListViewBase *dynamicListView; + QStaticListViewBase *staticListView; + }; // ### FIXME: see if we can move the members into the dynamic/static classes diff --git a/src/gui/itemviews/qlistwidget.cpp b/src/gui/itemviews/qlistwidget.cpp index 2792bbd..232b4d2 100644 --- a/src/gui/itemviews/qlistwidget.cpp +++ b/src/gui/itemviews/qlistwidget.cpp @@ -708,9 +708,7 @@ QVariant QListWidgetItem::data(int role) const bool QListWidgetItem::operator<(const QListWidgetItem &other) const { const QVariant v1 = data(Qt::DisplayRole), v2 = other.data(Qt::DisplayRole); - if (QAbstractItemModelPrivate::canConvertToDouble(v1) && QAbstractItemModelPrivate::canConvertToDouble(v2)) - return v1.toDouble() < v2.toDouble(); - return v1.toString() < v2.toString(); + return QAbstractItemModelPrivate::variantLessThan(v1, v2); } #ifndef QT_NO_DATASTREAM @@ -1127,7 +1125,7 @@ void QListWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft, \brief The QListWidget class provides an item-based list widget. \ingroup model-view - \mainclass + QListWidget is a convenience class that provides a list view similar to the one supplied by QListView, but with a classic item-based interface for diff --git a/src/gui/itemviews/qlistwidget_p.h b/src/gui/itemviews/qlistwidget_p.h index 124222c..0851e20 100644 --- a/src/gui/itemviews/qlistwidget_p.h +++ b/src/gui/itemviews/qlistwidget_p.h @@ -163,7 +163,6 @@ class QListWidgetItemPrivate public: QListWidgetItemPrivate(QListWidgetItem *item) : q(item), theid(-1) {} QListWidgetItem *q; - int id; QVector<QWidgetItemData> values; int theid; }; diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp index d39506d..d173efe 100644 --- a/src/gui/itemviews/qsortfilterproxymodel.cpp +++ b/src/gui/itemviews/qsortfilterproxymodel.cpp @@ -1278,82 +1278,76 @@ void QSortFilterProxyModelPrivate::_q_sourceColumnsRemoved( /*! \since 4.1 \class QSortFilterProxyModel - \brief The QSortFilterProxyModel class provides support for sorting and filtering data passed - between another model and a view. + \brief The QSortFilterProxyModel class provides support for sorting and + filtering data passed between another model and a view. \ingroup model-view - QSortFilterProxyModel can be used for sorting items, filtering - out items, or both. The model transforms the structure of a - source model by mapping the model indexes it supplies to new - indexes, corresponding to different locations, for views to use. - This approach allows a given source model to be restructured as - far as views are concerned without requiring any transformations - on the underlying data, and without duplicating the data in + QSortFilterProxyModel can be used for sorting items, filtering out items, + or both. The model transforms the structure of a source model by mapping + the model indexes it supplies to new indexes, corresponding to different + locations, for views to use. This approach allows a given source model to + be restructured as far as views are concerned without requiring any + transformations on the underlying data, and without duplicating the data in memory. - Let's assume that we want to sort and filter the items provided - by a custom model. The code to set up the model and the view, \e - without sorting and filtering, would look like this: + Let's assume that we want to sort and filter the items provided by a custom + model. The code to set up the model and the view, \e without sorting and + filtering, would look like this: \snippet doc/src/snippets/qsortfilterproxymodel-details/main.cpp 1 - To add sorting and filtering support to \c MyItemModel, we need - to create a QSortFilterProxyModel, call setSourceModel() with the - \c MyItemModel as argument, and install the QSortFilterProxyModel - on the view: + To add sorting and filtering support to \c MyItemModel, we need to create + a QSortFilterProxyModel, call setSourceModel() with the \c MyItemModel as + argument, and install the QSortFilterProxyModel on the view: \snippet doc/src/snippets/qsortfilterproxymodel-details/main.cpp 0 \snippet doc/src/snippets/qsortfilterproxymodel-details/main.cpp 2 - At this point, neither sorting nor filtering is enabled; the - original data is displayed in the view. Any changes made through - the QSortFilterProxyModel are applied to the original model. + At this point, neither sorting nor filtering is enabled; the original data + is displayed in the view. Any changes made through the + QSortFilterProxyModel are applied to the original model. - The QSortFilterProxyModel acts as a wrapper for the original - model. If you need to convert source \l{QModelIndex}es to - sorted/filtered model indexes or vice versa, use mapToSource(), - mapFromSource(), mapSelectionToSource(), and - mapSelectionFromSource(). + The QSortFilterProxyModel acts as a wrapper for the original model. If you + need to convert source \l{QModelIndex}es to sorted/filtered model indexes + or vice versa, use mapToSource(), mapFromSource(), mapSelectionToSource(), + and mapSelectionFromSource(). - \note By default, the model does not dynamically re-sort and re-filter - data whenever the original model changes. This behavior can be - changed by setting the \l{QSortFilterProxyModel::dynamicSortFilter} - {dynamicSortFilter} property. + \note By default, the model does not dynamically re-sort and re-filter data + whenever the original model changes. This behavior can be changed by + setting the \l{QSortFilterProxyModel::dynamicSortFilter}{dynamicSortFilter} + property. - The \l{itemviews/basicsortfiltermodel}{Basic Sort/Filter Model} - and \l{itemviews/customsortfiltermodel}{Custom Sort/Filter Model} - examples illustrate how to use QSortFilterProxyModel to perform - basic sorting and filtering and how to subclass it to implement - custom behavior. + The \l{itemviews/basicsortfiltermodel}{Basic Sort/Filter Model} and + \l{itemviews/customsortfiltermodel}{Custom Sort/Filter Model} examples + illustrate how to use QSortFilterProxyModel to perform basic sorting and + filtering and how to subclass it to implement custom behavior. \section1 Sorting QTableView and QTreeView have a - \l{QTreeView::sortingEnabled}{sortingEnabled} property that - controls whether the user can sort the view by clicking the - view's horizontal header. For example: + \l{QTreeView::sortingEnabled}{sortingEnabled} property that controls + whether the user can sort the view by clicking the view's horizontal + header. For example: \snippet doc/src/snippets/qsortfilterproxymodel-details/main.cpp 3 - When this feature is on (the default is off), clicking on a - header section sorts the items according to that column. By - clicking repeatedly, the user can alternate between ascending and - descending order. + When this feature is on (the default is off), clicking on a header section + sorts the items according to that column. By clicking repeatedly, the user + can alternate between ascending and descending order. \image qsortfilterproxymodel-sorting.png A sorted QTreeView - Behind the scene, the view calls the sort() virtual function on - the model to reorder the data in the model. To make your data - sortable, you can either implement sort() in your model, or you - use a QSortFilterProxyModel to wrap your model -- - QSortFilterProxyModel provides a generic sort() reimplementation - that operates on the sortRole() (Qt::DisplayRole by default) of - the items and that understands several data types, including \c - int, QString, and QDateTime. For hierarchical models, sorting is - applied recursively to all child items. String comparisons are - case sensitive by default; this can be changed by setting the - \l{QSortFilterProxyModel::}{sortCaseSensitivity} property. + Behind the scene, the view calls the sort() virtual function on the model + to reorder the data in the model. To make your data sortable, you can + either implement sort() in your model, or use a QSortFilterProxyModel to + wrap your model -- QSortFilterProxyModel provides a generic sort() + reimplementation that operates on the sortRole() (Qt::DisplayRole by + default) of the items and that understands several data types, including + \c int, QString, and QDateTime. For hierarchical models, sorting is applied + recursively to all child items. String comparisons are case sensitive by + default; this can be changed by setting the \l{QSortFilterProxyModel::} + {sortCaseSensitivity} property. Custom sorting behavior is achieved by subclassing QSortFilterProxyModel and reimplementing lessThan(), which is @@ -1365,43 +1359,42 @@ void QSortFilterProxyModelPrivate::_q_sourceColumnsRemoved( \l{itemviews/customsortfiltermodel}{Custom Sort/Filter Model} example.) - An alternative approach to sorting is to disable sorting on the - view and to impose a certain order to the user. This is done by - explicitly calling sort() with the desired column and order as - arguments on the QSortFilterProxyModel (or on the original model - if it implements sort()). For example: + An alternative approach to sorting is to disable sorting on the view and to + impose a certain order to the user. This is done by explicitly calling + sort() with the desired column and order as arguments on the + QSortFilterProxyModel (or on the original model if it implements sort()). + For example: \snippet doc/src/snippets/qsortfilterproxymodel-details/main.cpp 4 - QSortFilterProxyModel can be sorted by column -1, in which case it - returns to the sort order of the underlying source model. + QSortFilterProxyModel can be sorted by column -1, in which case it returns + to the sort order of the underlying source model. \section1 Filtering - In addition to sorting, QSortFilterProxyModel can be used to hide - items that don't match a certain filter. The filter is specified - using a QRegExp object and is applied to the filterRole() - (Qt::DisplayRole by default) of each item, for a given column. - The QRegExp object can be used to match a regular expression, a - wildcard pattern, or a fixed string. For example: + In addition to sorting, QSortFilterProxyModel can be used to hide items + that do not match a certain filter. The filter is specified using a QRegExp + object and is applied to the filterRole() (Qt::DisplayRole by default) of + each item, for a given column. The QRegExp object can be used to match a + regular expression, a wildcard pattern, or a fixed string. For example: \snippet doc/src/snippets/qsortfilterproxymodel-details/main.cpp 5 - For hierarchical models, the filter is applied recursively to all - children. If a parent item doesn't match the filter, none of its - children will be shown. + For hierarchical models, the filter is applied recursively to all children. + If a parent item doesn't match the filter, none of its children will be + shown. - A common use case is to let the user specify the filter regexp, - wildcard pattern, or fixed string in a QLineEdit and to connect - the \l{QLineEdit::textChanged()}{textChanged()} signal to - setFilterRegExp(), setFilterWildcard(), or setFilterFixedString() - to reapply the filter. + A common use case is to let the user specify the filter regexp, wildcard + pattern, or fixed string in a QLineEdit and to connect the + \l{QLineEdit::textChanged()}{textChanged()} signal to setFilterRegExp(), + setFilterWildcard(), or setFilterFixedString() to reapply the filter. Custom filtering behavior can be achieved by reimplementing the filterAcceptsRow() and filterAcceptsColumn() functions. For - example, the following implementation ignores the - \l{QSortFilterProxyModel::filterKeyColumn}{filterKeyColumn} - property and performs filtering on columns 0, 1, and 2: + example (from the \l{itemviews/customsortfiltermodel} + {Custom Sort/Filter Model} example), the following implementation ignores + the \l{QSortFilterProxyModel::filterKeyColumn}{filterKeyColumn} property + and performs filtering on columns 0, 1, and 2: \snippet examples/itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp 3 @@ -1411,24 +1404,24 @@ void QSortFilterProxyModelPrivate::_q_sourceColumnsRemoved( If you are working with large amounts of filtering and have to invoke invalidateFilter() repeatedly, using reset() may be more efficient, - depending on the implementation of your model. However, note that reset() - returns the proxy model to its original state, losing selection - information, and will cause the proxy model to be repopulated. + depending on the implementation of your model. However, reset() returns the + proxy model to its original state, losing selection information, and will + cause the proxy model to be repopulated. \section1 Subclassing - \bold{Note:} Some general guidelines for subclassing models are - available in the \l{Model Subclassing Reference}. - Since QAbstractProxyModel and its subclasses are derived from - QAbstractItemModel, much of the same advice about subclassing normal - models also applies to proxy models. In addition, it is worth noting - that many of the default implementations of functions in this class - are written so that they call the equivalent functions in the relevant - source model. This simple proxying mechanism may need to be overridden - for source models with more complex behavior; for example, if the - source model provides a custom hasChildren() implementation, you - should also provide one in the proxy model. + QAbstractItemModel, much of the same advice about subclassing normal models + also applies to proxy models. In addition, it is worth noting that many of + the default implementations of functions in this class are written so that + they call the equivalent functions in the relevant source model. This + simple proxying mechanism may need to be overridden for source models with + more complex behavior; for example, if the source model provides a custom + hasChildren() implementation, you should also provide one in the proxy + model. + + \note Some general guidelines for subclassing models are available in the + \l{Model Subclassing Reference}. \sa QAbstractProxyModel, QAbstractItemModel, {Model/View Programming}, {Basic Sort/Filter Model Example}, {Custom Sort/Filter Model Example} @@ -1991,9 +1984,11 @@ Qt::SortOrder QSortFilterProxyModel::sortOrder() const \brief the QRegExp used to filter the contents of the source model Setting this property overwrites the current - \l{QSortFilterProxyModel::filterCaseSensitivity} - {filterCaseSensitivity}. By default, the QRegExp is an empty - string matching all contents. + \l{QSortFilterProxyModel::filterCaseSensitivity}{filterCaseSensitivity}. + By default, the QRegExp is an empty string matching all contents. + + If no QRegExp or an empty string is set, everything in the source model + will be accepted. \sa filterCaseSensitivity, setFilterWildcard(), setFilterFixedString() */ @@ -2316,7 +2311,7 @@ bool QSortFilterProxyModel::lessThan(const QModelIndex &left, const QModelIndex Q_D(const QSortFilterProxyModel); QVariant l = (left.model() ? left.model()->data(left, d->sort_role) : QVariant()); QVariant r = (right.model() ? right.model()->data(right, d->sort_role) : QVariant()); - switch (l.type()) { + switch (l.userType()) { case QVariant::Invalid: return (r.type() == QVariant::Invalid); case QVariant::Int: @@ -2327,6 +2322,8 @@ bool QSortFilterProxyModel::lessThan(const QModelIndex &left, const QModelIndex return l.toLongLong() < r.toLongLong(); case QVariant::ULongLong: return l.toULongLong() < r.toULongLong(); + case QMetaType::Float: + return l.toFloat() < r.toFloat(); case QVariant::Double: return l.toDouble() < r.toDouble(); case QVariant::Char: diff --git a/src/gui/itemviews/qstandarditemmodel.cpp b/src/gui/itemviews/qstandarditemmodel.cpp index f2fc37e..9ae3214 100644 --- a/src/gui/itemviews/qstandarditemmodel.cpp +++ b/src/gui/itemviews/qstandarditemmodel.cpp @@ -1806,7 +1806,7 @@ bool QStandardItem::operator<(const QStandardItem &other) const const int role = model() ? model()->sortRole() : Qt::DisplayRole; const QVariant l = data(role), r = other.data(role); // this code is copied from QSortFilterProxyModel::lessThan() - switch (l.type()) { + switch (l.userType()) { case QVariant::Invalid: return (r.type() == QVariant::Invalid); case QVariant::Int: @@ -1817,6 +1817,8 @@ bool QStandardItem::operator<(const QStandardItem &other) const return l.toLongLong() < r.toLongLong(); case QVariant::ULongLong: return l.toULongLong() < r.toULongLong(); + case QMetaType::Float: + return l.toFloat() < r.toFloat(); case QVariant::Double: return l.toDouble() < r.toDouble(); case QVariant::Char: diff --git a/src/gui/itemviews/qstandarditemmodel_p.h b/src/gui/itemviews/qstandarditemmodel_p.h index 1ee3432..a8b36ed 100644 --- a/src/gui/itemviews/qstandarditemmodel_p.h +++ b/src/gui/itemviews/qstandarditemmodel_p.h @@ -75,6 +75,7 @@ public: parent(0), rows(0), columns(0), + q_ptr(0), lastIndexOf(2) { } virtual ~QStandardItemPrivate(); diff --git a/src/gui/itemviews/qstringlistmodel.cpp b/src/gui/itemviews/qstringlistmodel.cpp index d57de1a..9462dfe 100644 --- a/src/gui/itemviews/qstringlistmodel.cpp +++ b/src/gui/itemviews/qstringlistmodel.cpp @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE \brief The QStringListModel class provides a model that supplies strings to views. \ingroup model-view - \mainclass + QStringListModel is an editable model that can be used for simple cases where you need to display a number of strings in a view diff --git a/src/gui/itemviews/qstyleditemdelegate.cpp b/src/gui/itemviews/qstyleditemdelegate.cpp index 913af89..b5f676a 100644 --- a/src/gui/itemviews/qstyleditemdelegate.cpp +++ b/src/gui/itemviews/qstyleditemdelegate.cpp @@ -112,7 +112,7 @@ public: data items from a model. \ingroup model-view - \mainclass + \since 4.4 When displaying data from models in Qt item views, e.g., a @@ -267,9 +267,10 @@ QStyledItemDelegate::~QStyledItemDelegate() QString QStyledItemDelegate::displayText(const QVariant &value, const QLocale& locale) const { QString text; - switch (value.type()) { + switch (value.userType()) { + case QMetaType::Float: case QVariant::Double: - text = locale.toString(value.toDouble()); + text = locale.toString(value.toReal()); break; case QVariant::Int: case QVariant::LongLong: diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp index 61c2b60..a9db9f5 100644 --- a/src/gui/itemviews/qtableview.cpp +++ b/src/gui/itemviews/qtableview.cpp @@ -508,7 +508,7 @@ void QTableViewPrivate::drawCell(QPainter *painter, const QStyleOptionViewItemV4 \ingroup model-view \ingroup advanced - \mainclass + A QTableView implements a table view that displays items from a model. This class is used to provide standard tables that were diff --git a/src/gui/itemviews/qtablewidget.cpp b/src/gui/itemviews/qtablewidget.cpp index fea81e5..b04aea2 100644 --- a/src/gui/itemviews/qtablewidget.cpp +++ b/src/gui/itemviews/qtablewidget.cpp @@ -1392,9 +1392,7 @@ QVariant QTableWidgetItem::data(int role) const bool QTableWidgetItem::operator<(const QTableWidgetItem &other) const { const QVariant v1 = data(Qt::DisplayRole), v2 = other.data(Qt::DisplayRole); - if (QAbstractItemModelPrivate::canConvertToDouble(v1) && QAbstractItemModelPrivate::canConvertToDouble(v2)) - return v1.toDouble() < v2.toDouble(); - return v1.toString() < v2.toString(); + return QAbstractItemModelPrivate::variantLessThan(v1, v2); } #ifndef QT_NO_DATASTREAM @@ -1488,7 +1486,7 @@ QTableWidgetItem &QTableWidgetItem::operator=(const QTableWidgetItem &other) \brief The QTableWidget class provides an item-based table view with a default model. \ingroup model-view - \mainclass + Table widgets provide standard table display facilities for applications. The items in a QTableWidget are provided by QTableWidgetItem. diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index cbe1d2a..7dad192 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -66,7 +66,7 @@ QT_BEGIN_NAMESPACE \ingroup model-view \ingroup advanced - \mainclass + A QTreeView implements a tree representation of items from a model. This class is used to provide standard hierarchical lists that @@ -2797,15 +2797,14 @@ int QTreeView::indexRowSizeHint(const QModelIndex &index) const if (isRightToLeft()) { start = (start == -1 ? count - 1 : start); - end = (end == -1 ? 0 : end); + end = 0; } else { start = (start == -1 ? 0 : start); - end = (end == -1 ? count - 1 : end); + end = count - 1; } - int tmp = start; - start = qMin(start, end); - end = qMax(tmp, end); + if (end < start) + qSwap(end, start); int height = -1; QStyleOptionViewItemV4 option = d->viewOptionsV4(); diff --git a/src/gui/itemviews/qtreeview_p.h b/src/gui/itemviews/qtreeview_p.h index d17016f..1bbba89 100644 --- a/src/gui/itemviews/qtreeview_p.h +++ b/src/gui/itemviews/qtreeview_p.h @@ -82,7 +82,7 @@ public: uniformRowHeights(false), rootDecoration(true), itemsExpandable(true), sortingEnabled(false), expandsOnDoubleClick(true), - allColumnsShowFocus(false), current(0), + allColumnsShowFocus(false), current(0), spanning(false), animationsEnabled(false), columnResizeTimerID(0), autoExpandDelay(-1), hoverBranch(-1), geometryRecursionBlock(false) {} diff --git a/src/gui/itemviews/qtreewidget.cpp b/src/gui/itemviews/qtreewidget.cpp index eaed05f..b636284 100644 --- a/src/gui/itemviews/qtreewidget.cpp +++ b/src/gui/itemviews/qtreewidget.cpp @@ -75,7 +75,7 @@ public: \brief The QTreeModel class manages the items stored in a tree view. \ingroup model-view - \mainclass + */ /*! @@ -1768,6 +1768,7 @@ QVariant QTreeWidgetItem::data(int column, int role) const // special case for check state in tristate if (children.count() && (itemFlags & Qt::ItemIsTristate)) return childrenCheckState(column); + // fallthrough intended default: if (column >= 0 && column < values.size()) { const QVector<QWidgetItemData> &column_values = values.at(column); @@ -1789,9 +1790,7 @@ bool QTreeWidgetItem::operator<(const QTreeWidgetItem &other) const int column = view ? view->sortColumn() : 0; const QVariant v1 = data(column, Qt::DisplayRole); const QVariant v2 = other.data(column, Qt::DisplayRole); - if (QAbstractItemModelPrivate::canConvertToDouble(v1) && QAbstractItemModelPrivate::canConvertToDouble(v2)) - return v1.toDouble() < v2.toDouble(); - return v1.toString() < v2.toString(); + return QAbstractItemModelPrivate::variantLessThan(v1, v2); } #ifndef QT_NO_DATASTREAM @@ -2074,6 +2073,8 @@ QList<QTreeWidgetItem*> QTreeWidgetItem::takeChildren() void QTreeWidgetItemPrivate::sortChildren(int column, Qt::SortOrder order, bool climb) { QTreeModel *model = (q->view ? qobject_cast<QTreeModel*>(q->view->model()) : 0); + if (!model) + return; model->sortItems(&q->children, column, order); if (climb) { QList<QTreeWidgetItem*>::iterator it = q->children.begin(); @@ -2328,7 +2329,7 @@ void QTreeWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft, tree model. \ingroup model-view - \mainclass + The QTreeWidget class is a convenience class that provides a standard tree widget with a classic item-based interface similar to that used by diff --git a/src/gui/itemviews/qtreewidgetitemiterator_p.h b/src/gui/itemviews/qtreewidgetitemiterator_p.h index 3ffe823..ee0808c 100644 --- a/src/gui/itemviews/qtreewidgetitemiterator_p.h +++ b/src/gui/itemviews/qtreewidgetitemiterator_p.h @@ -73,7 +73,8 @@ public: } QTreeWidgetItemIteratorPrivate(const QTreeWidgetItemIteratorPrivate& other) - : m_currentIndex(other.m_currentIndex), m_model(other.m_model), m_parentIndex(other.m_parentIndex) + : m_currentIndex(other.m_currentIndex), m_model(other.m_model), + m_parentIndex(other.m_parentIndex), q_ptr(other.q_ptr) { } diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 531c283..c7d06f7 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -145,7 +145,7 @@ unix:x11 { HEADERS += \ kernel/qguieventdispatcher_glib_p.h QMAKE_CXXFLAGS += $$QT_CFLAGS_GLIB - LIBS +=$$QT_LIBS_GLIB + LIBS_PRIVATE +=$$QT_LIBS_GLIB } SOURCES += \ kernel/qeventdispatcher_x11.cpp @@ -226,7 +226,7 @@ embedded { QMAKE_BUNDLE_DATA += MENU_NIB RESOURCES += mac/macresources.qrc - LIBS += -framework AppKit + LIBS_PRIVATE += -framework AppKit } wince*: { diff --git a/src/gui/kernel/mac.pri b/src/gui/kernel/mac.pri index 415fe0a..1538510 100644 --- a/src/gui/kernel/mac.pri +++ b/src/gui/kernel/mac.pri @@ -1,4 +1,4 @@ !x11:!embedded:mac { - LIBS += -framework Carbon -lz + LIBS_PRIVATE += -framework Carbon -lz *-mwerks:INCLUDEPATH += compat } diff --git a/src/gui/kernel/qaction.cpp b/src/gui/kernel/qaction.cpp index b7ccd72..00cba04 100644 --- a/src/gui/kernel/qaction.cpp +++ b/src/gui/kernel/qaction.cpp @@ -183,8 +183,8 @@ void QActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map) \brief The QAction class provides an abstract user interface action that can be inserted into widgets. - \ingroup application - \mainclass + \ingroup mainwindow-classes + \omit * parent and widget are different diff --git a/src/gui/kernel/qactiongroup.cpp b/src/gui/kernel/qactiongroup.cpp index 5d429e4..9a12dea 100644 --- a/src/gui/kernel/qactiongroup.cpp +++ b/src/gui/kernel/qactiongroup.cpp @@ -100,7 +100,7 @@ void QActionGroupPrivate::_q_actionHovered() \class QActionGroup \brief The QActionGroup class groups actions together. - \ingroup application + \ingroup mainwindow-classes In some situations it is useful to group actions together. For example, if you have a \gui{Left Align} action, a \gui{Right diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 4cc7e00..38592e0 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -179,9 +179,6 @@ QApplicationPrivate::~QApplicationPrivate() \brief The QApplication class manages the GUI application's control flow and main settings. - \ingroup application - \mainclass - QApplication contains the main event loop, where all events from the window system and other sources are processed and dispatched. It also handles the application's initialization, finalization, and provides session @@ -2331,10 +2328,6 @@ bool QApplication::event(QEvent *e) } else if (te->timerId() == d->toolTipFallAsleep.timerId()) { d->toolTipFallAsleep.stop(); } -#ifdef QT_MAC_USE_COCOA - } else if (e->type() == QEvent::CocoaRequestModal) { - d->_q_runAppModalWindow(); -#endif } return QCoreApplication::event(e); } @@ -4153,9 +4146,6 @@ bool QApplicationPrivate::notify_helper(QObject *receiver, QEvent * e) \class QSessionManager \brief The QSessionManager class provides access to the session manager. - \ingroup application - \ingroup environment - A session manager in a desktop environment (in which Qt GUI applications live) keeps track of a session, which is a group of running applications, each of which has a particular state. The state of an application contains diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm index 5b503b3..0c17892 100644 --- a/src/gui/kernel/qapplication_mac.mm +++ b/src/gui/kernel/qapplication_mac.mm @@ -1409,13 +1409,8 @@ void QApplicationPrivate::enterModal_sys(QWidget *widget) qt_button_down = 0; #ifdef QT_MAC_USE_COCOA - if (!qt_mac_is_macsheet(widget)) { - // Add a new, empty (null), NSModalSession to the stack. - // The next time we spin the event dispatcher, it will - // check the stack, and recurse into a modal session for it: - QCocoaModalSessionInfo info = {widget, 0}; - QEventDispatcherMacPrivate::cocoaModalSessionStack.push(info); - } + if (!qt_mac_is_macsheet(widget)) + QEventDispatcherMacPrivate::beginModalSession(widget); #endif } @@ -1441,7 +1436,7 @@ void QApplicationPrivate::leaveModal_sys(QWidget *widget) } #ifdef QT_MAC_USE_COCOA if (!qt_mac_is_macsheet(widget)) - QEventDispatcherMacPrivate::rebuildModalSessionStack(true); + QEventDispatcherMacPrivate::endModalSession(widget); #endif } #ifdef DEBUG_MODAL_EVENTS @@ -1452,21 +1447,6 @@ void QApplicationPrivate::leaveModal_sys(QWidget *widget) qt_event_request_menubarupdate(); } -#if defined(QT_MAC_USE_COCOA) -void QApplicationPrivate::_q_runAppModalWindow() -{ - if (QEventDispatcherMacPrivate::blockCocoaRequestModal) { - // Just postpone the event until the event dispatcher tells - // us (by releasing the block) that it is OK to recurse into - // a new event loop for our non-execing modal window: - qApp->postEvent(qApp, new QEvent(QEvent::CocoaRequestModal)); - } else { - // Recurse into a new event loop for the current app modal window: - threadData->eventDispatcher->processEvents(QEventLoop::DialogExec); - } -} -#endif - QWidget *QApplicationPrivate::tryModalHelper_sys(QWidget *top) { #ifndef QT_MAC_USE_COCOA diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 50ab238..7a27756 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -486,12 +486,6 @@ public: void _q_alertTimeOut(); QHash<QWidget *, QTimer *> alertTimerHash; #endif -#if defined(QT_MAC_USE_COCOA) - void _q_runAppModalWindow(); -#endif -#if defined(QT_MAC_USE_COCOA) - void _q_runModalWindow(); -#endif #ifndef QT_NO_STYLE_STYLESHEET static QString styleSheet; #endif diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index db78349..44ac380 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -75,10 +75,11 @@ QT_BEGIN_NAMESPACE #if defined(QT_DEBUG) static bool appNoGrab = false; // Grabbing enabled #endif - +static bool app_do_modal = false; // modal mode Q_GLOBAL_STATIC(QS60Data, qt_s60Data); -extern bool qt_sendSpontaneousEvent(QObject*,QEvent*); +extern bool qt_sendSpontaneousEvent(QObject*,QEvent*); +extern QWidgetList *qt_modal_stack; // stack of modal widgets extern QDesktopWidget *qt_desktopWidget; // qapplication.cpp QWidget *qt_button_down = 0; // widget got last button-down @@ -788,17 +789,26 @@ QString QApplicationPrivate::appName() const bool QApplicationPrivate::modalState() { - return false; + return app_do_modal; } -void QApplicationPrivate::enterModal_sys(QWidget * /* widget */) +void QApplicationPrivate::enterModal_sys(QWidget *widget) { - // TODO: Implement QApplicationPrivate::enterModal_sys(QWidget *widget) + if (!qt_modal_stack) + qt_modal_stack = new QWidgetList; + qt_modal_stack->insert(0, widget); + app_do_modal = true; } -void QApplicationPrivate::leaveModal_sys(QWidget * /* widget */) +void QApplicationPrivate::leaveModal_sys(QWidget *widget) { - // TODO: Implement QApplicationPrivate::leaveModal_sys(QWidget *widget) + if (qt_modal_stack && qt_modal_stack->removeAll(widget)) { + if (qt_modal_stack->isEmpty()) { + delete qt_modal_stack; + qt_modal_stack = 0; + } + } + app_do_modal = qt_modal_stack != 0; } void QApplicationPrivate::openPopup(QWidget *popup) diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index 3b1a581..db349f0 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -4579,6 +4579,7 @@ bool QETWidget::translateXinputEvent(const XEvent *ev, QTabletDeviceData *tablet // Do event compression. Skip over tablet+mouse move events if there are newer ones. qt_tablet_motion_data tabletMotionData; tabletMotionData.tabletMotionType = tablet->xinput_motion; + XEvent dummy; while (true) { // Find first mouse event since we expect them in pairs inside Qt tabletMotionData.error =false; @@ -4591,7 +4592,6 @@ bool QETWidget::translateXinputEvent(const XEvent *ev, QTabletDeviceData *tablet } // Now discard any duplicate tablet events. - XEvent dummy; tabletMotionData.error = false; tabletMotionData.timestamp = mouseMotionEvent.xmotion.time; while (XCheckIfEvent(X11->display, &dummy, &qt_tabletMotion_scanner, (XPointer) &tabletMotionData)) { diff --git a/src/gui/kernel/qboxlayout.cpp b/src/gui/kernel/qboxlayout.cpp index 6a35e38..3f2a5dc 100644 --- a/src/gui/kernel/qboxlayout.cpp +++ b/src/gui/kernel/qboxlayout.cpp @@ -452,7 +452,6 @@ void QBoxLayoutPrivate::calcHfw(int w) vertically. \ingroup geomanagement - \ingroup appearance QBoxLayout takes the space it gets (from its parent layout or from the parentWidget()), divides it up into a row of boxes, and makes @@ -1290,8 +1289,6 @@ QBoxLayout::Direction QBoxLayout::direction() const \brief The QHBoxLayout class lines up widgets horizontally. \ingroup geomanagement - \ingroup appearance - \mainclass This class is used to construct horizontal box layout objects. See QBoxLayout for details. @@ -1408,8 +1405,6 @@ QHBoxLayout::~QHBoxLayout() \brief The QVBoxLayout class lines up widgets vertically. \ingroup geomanagement - \ingroup appearance - \mainclass This class is used to construct vertical box layout objects. See QBoxLayout for details. diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp index 2779717..fce4f65 100644 --- a/src/gui/kernel/qclipboard.cpp +++ b/src/gui/kernel/qclipboard.cpp @@ -58,10 +58,6 @@ QT_BEGIN_NAMESPACE \class QClipboard \brief The QClipboard class provides access to the window system clipboard. - \ingroup io - \ingroup environment - \mainclass - The clipboard offers a simple mechanism to copy and paste data between applications. diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index c20445a..45b0ada 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -102,7 +102,7 @@ static dndenum_mapper dnd_enums[] = { { NSDragOperationCopy, Qt::CopyAction, true }, { NSDragOperationGeneric, Qt::CopyAction, false }, { NSDragOperationEvery, Qt::ActionMask, false }, - { NSDragOperationNone, Qt::IgnoreAction, false } + { NSDragOperationNone, Qt::IgnoreAction, false } }; static NSDragOperation qt_mac_mapDropAction(Qt::DropAction action) @@ -228,14 +228,14 @@ extern "C" { currentCustomTypes = new QStringList(); *currentCustomTypes = customTypes; const NSString* mimeTypeGeneric = @"com.trolltech.qt.MimeTypeName"; - NSMutableArray *supportedTypes = [NSMutableArray arrayWithObjects:NSColorPboardType, - NSFilenamesPboardType, NSStringPboardType, - NSFilenamesPboardType, NSPostScriptPboardType, NSTIFFPboardType, - NSRTFPboardType, NSTabularTextPboardType, NSFontPboardType, - NSRulerPboardType, NSFileContentsPboardType, NSColorPboardType, - NSRTFDPboardType, NSHTMLPboardType, NSPICTPboardType, + NSMutableArray *supportedTypes = [NSMutableArray arrayWithObjects:NSColorPboardType, + NSFilenamesPboardType, NSStringPboardType, + NSFilenamesPboardType, NSPostScriptPboardType, NSTIFFPboardType, + NSRTFPboardType, NSTabularTextPboardType, NSFontPboardType, + NSRulerPboardType, NSFileContentsPboardType, NSColorPboardType, + NSRTFDPboardType, NSHTMLPboardType, NSPICTPboardType, NSURLPboardType, NSPDFPboardType, NSVCardPboardType, - NSFilesPromisePboardType, NSInkTextPboardType, + NSFilesPromisePboardType, NSInkTextPboardType, NSMultipleTextSelectionPboardType, mimeTypeGeneric, nil]; // Add custom types supported by the application. for (int i = 0; i < customTypes.size(); i++) { @@ -280,16 +280,16 @@ extern "C" { dropData = 0; } } - -- (void)addDropData:(id <NSDraggingInfo>)sender + +- (void)addDropData:(id <NSDraggingInfo>)sender { [self removeDropData]; - CFStringRef dropPasteboard = (CFStringRef) [[sender draggingPasteboard] name]; + CFStringRef dropPasteboard = (CFStringRef) [[sender draggingPasteboard] name]; dropData = new QCocoaDropData(dropPasteboard); -} +} -- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender -{ +- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender +{ if (qwidget->testAttribute(Qt::WA_DropSiteRegistered) == false) return NSDragOperationNone; NSPoint windowPoint = [sender draggingLocation]; @@ -307,7 +307,7 @@ extern "C" { NSPoint globalPoint = [[sender draggingDestinationWindow] convertBaseToScreen:windowPoint]; NSPoint localPoint = [self convertPoint:windowPoint fromView:nil]; QPoint posDrag(localPoint.x, localPoint.y); - NSDragOperation nsActions = [sender draggingSourceOperationMask]; + NSDragOperation nsActions = [sender draggingSourceOperationMask]; Qt::DropActions qtAllowed = qt_mac_mapNSDragOperations(nsActions); QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec.lastOperation) = nsActions; Qt::KeyboardModifiers modifiers = Qt::NoModifier; @@ -336,8 +336,8 @@ extern "C" { qDMEvent.accept(); // accept by default, since enter event was accepted. QApplication::sendEvent(qwidget, &qDMEvent); if (!qDMEvent.isAccepted() || qDMEvent.dropAction() == Qt::IgnoreAction) { - // since we accepted the drag enter event, the widget expects - // future drage move events. + // since we accepted the drag enter event, the widget expects + // future drage move events. // ### check if we need to treat this like the drag enter event. nsActions = QT_PREPEND_NAMESPACE(qt_mac_mapDropAction)(qDEEvent.dropAction()); } else { @@ -345,7 +345,7 @@ extern "C" { } QT_PREPEND_NAMESPACE(qt_mac_copy_answer_rect)(qDMEvent); return nsActions; - } + } } - (NSDragOperation)draggingUpdated:(id < NSDraggingInfo >)sender @@ -373,7 +373,7 @@ extern "C" { if (qt_mac_mouse_inside_answer_rect(posDrag) && QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec.lastOperation) == nsActions) return QT_PREPEND_NAMESPACE(qt_mac_mapDropActions)(QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec.lastAction)); - // send drag move event to the widget + // send drag move event to the widget QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec.lastOperation) = nsActions; Qt::DropActions qtAllowed = QT_PREPEND_NAMESPACE(qt_mac_mapNSDragOperations)(nsActions); Qt::KeyboardModifiers modifiers = Qt::NoModifier; @@ -436,7 +436,7 @@ extern "C" { NSPoint localPoint = [self convertPoint:windowPoint fromView:nil]; QPoint posDrop(localPoint.x, localPoint.y); - NSDragOperation nsActions = [sender draggingSourceOperationMask]; + NSDragOperation nsActions = [sender draggingSourceOperationMask]; Qt::DropActions qtAllowed = qt_mac_mapNSDragOperations(nsActions); QMimeData *mimeData = dropData; if (QDragManager::self()->source()) @@ -563,11 +563,6 @@ extern "C" { qt_sendSpontaneousEvent(qwidget, &e); if (!redirectionOffset.isNull()) QPainter::restoreRedirected(qwidget); -#ifdef QT_RASTER_PAINTENGINE - if(engine && engine->type() == QPaintEngine::Raster) - static_cast<QRasterPaintEngine*>(engine)->flush(qwidget, - qrgn.boundingRect().topLeft()); -#endif if (engine) engine->setSystemClip(QRegion()); qwidget->setAttribute(Qt::WA_WState_InPaintEvent, false); @@ -638,7 +633,7 @@ extern "C" { QHoverEvent he(QEvent::HoverEnter, QPoint(viewPoint.x, viewPoint.y), QPoint(-1, -1)); QApplicationPrivate::instance()->notify_helper(qwidget, &he); } - } + } } - (void)mouseExited:(NSEvent *)event @@ -647,7 +642,7 @@ extern "C" { NSPoint globalPoint = [[event window] convertBaseToScreen:[event locationInWindow]]; if (!qAppInstance()->activeModalWidget() || QApplicationPrivate::tryModalHelper(qwidget, 0)) { QApplication::sendEvent(qwidget, &leaveEvent); - + // ### Think about if it is necessary to update the cursor, should only be for a few cases. qt_mac_update_cursor_at_global_pos(flipPoint(globalPoint).toPoint()); if (qwidget->testAttribute(Qt::WA_Hover) @@ -679,7 +674,7 @@ extern "C" { { qt_mac_handleMouseEvent(self, theEvent, QEvent::MouseButtonPress, Qt::LeftButton); // Don't call super here. This prevents us from getting the mouseUp event, - // which we need to send even if the mouseDown event was not accepted. + // which we need to send even if the mouseDown event was not accepted. // (this is standard Qt behavior.) } @@ -843,7 +838,7 @@ extern "C" { } #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 -- (void)touchesBeganWithEvent:(NSEvent *)event; +- (void)touchesBeganWithEvent:(NSEvent *)event; { bool all = qwidget->testAttribute(Qt::WA_TouchPadAcceptSingleTouchEvents); qt_translateRawTouchEvent(qwidget, QTouchEvent::TouchPad, QCocoaTouch::getCurrentTouchPointList(event, all)); @@ -1128,7 +1123,7 @@ extern "C" { while (index < composingLength) { NSRange effectiveRange; NSRange range = NSMakeRange(index, composingLength-index); - NSDictionary *attributes = [aString attributesAtIndex:index + NSDictionary *attributes = [aString attributesAtIndex:index longestEffectiveRange:&effectiveRange inRange:range]; NSNumber *underlineStyle = [attributes objectForKey:NSUnderlineStyleAttributeName]; @@ -1137,7 +1132,7 @@ extern "C" { NSColor *color = [attributes objectForKey:NSUnderlineColorAttributeName]; if (color) { clr = colorFrom(color); - } + } QTextCharFormat format; format.setFontUnderline(true); format.setUnderlineColor(clr); @@ -1213,7 +1208,7 @@ extern "C" { - (NSRange) markedRange { - NSRange range; + NSRange range; if (composing) { range.location = 0; range.length = composingLength; @@ -1238,13 +1233,13 @@ extern "C" { selRange.length = 0; } return selRange; - + } - (NSRect) firstRectForCharacterRange:(NSRange)theRange { Q_UNUSED(theRange); - // The returned rect is always based on the internal cursor. + // The returned rect is always based on the internal cursor. QRect mr(qwidget->inputMethodQuery(Qt::ImMicroFocus).toRect()); QPoint mp(qwidget->mapToGlobal(QPoint(mr.bottomLeft()))); NSRect rect ; @@ -1392,7 +1387,7 @@ Qt::DropAction QDragManager::drag(QDrag *o) NSImage *image = (NSImage *)qt_mac_create_nsimage(pix); [image retain]; DnDParams *dndParams = [QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent]; - // save supported actions + // save supported actions [dndParams->view setSupportedActions: qt_mac_mapDropActions(dragPrivate()->possible_actions)]; NSPoint imageLoc = {dndParams->localPoint.x - hotspot.x(), dndParams->localPoint.y + pix.height() - hotspot.y()}; @@ -1416,7 +1411,7 @@ Qt::DropAction QDragManager::drag(QDrag *o) Qt::DropAction performedAction(qt_mac_mapNSDragOperation(dndParams->performedAction)); // do post drag processing, if required. if(performedAction != Qt::IgnoreAction) { - // check if the receiver points us to a file location. + // check if the receiver points us to a file location. // if so, we need to do the file copy/move ourselves. QCFType<CFURLRef> pasteLocation = 0; PasteboardCopyPasteLocation(dragBoard.pasteBoard(), &pasteLocation); diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp index 9d2407b..dd7a07c 100644 --- a/src/gui/kernel/qcursor.cpp +++ b/src/gui/kernel/qcursor.cpp @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE \ingroup appearance \ingroup shared - \mainclass + This class is mainly used to create mouse cursors that are associated with particular widgets and to get and set the position diff --git a/src/gui/kernel/qdesktopwidget.qdoc b/src/gui/kernel/qdesktopwidget.qdoc new file mode 100644 index 0000000..8e6673a --- /dev/null +++ b/src/gui/kernel/qdesktopwidget.qdoc @@ -0,0 +1,264 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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://qt.nokia.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \class QDesktopWidget + \brief The QDesktopWidget class provides access to screen information on multi-head systems. + + \ingroup advanced + \ingroup desktop + + QApplication::desktop() function should be used to get an instance + of the QDesktopWidget. + + Systems with more than one graphics card and monitor can manage the + physical screen space available either as multiple desktops, or as a + large virtual desktop, which usually has the size of the bounding + rectangle of all the screens (see virtualDesktop). For an + application, one of the available screens is the primary screen, i.e. + the screen where the main widget resides (see primaryScreen). All + windows opened in the context of the application should be + constrained to the boundaries of the primary screen; for example, + it would be inconvenient if a dialog box popped up on a different + screen, or split over two screens. + + The QDesktopWidget provides information about the geometry of the + available screens with screenGeometry(). The number of screens + available is returned by screenCount, and the screenCountChanged + signal is emitted when screens are added or removed during runtime. + The screen number that a particular point or widget is located in + is returned by screenNumber(). + + Widgets provided by Qt use this class, for example, to place + tooltips, menus and dialog boxes according to the parent or + application widget. Applications can use this class to save window + positions, or to place child widgets and dialogs on one particular + screen. + + \img qdesktopwidget.png Managing Multiple Screens + + In the illustration above, Application One's primary screen is + screen 0, and App Two's primary screen is screen 1. + + \target multiple screens note + \note QDesktopWidget inherits the QWidget properties, width() and + height(), which specify the size of the desktop. However, for + desktops with multiple screens, the size of the desktop is the union + of all the screen sizes, so width() and height() should \e not be + used for computing the size of a widget to be placed on one of the + screens. The correct width and height values are obtained using + availableGeometry() or screenGeometry() for a particular screen. + + \sa QApplication, QApplication::desktop(), QX11Info::appRootWindow() +*/ + +/*! + \fn QDesktopWidget::QDesktopWidget() + + \internal + + Creates the desktop widget. + + If the system supports a virtual desktop, this widget will have + the size of the virtual desktop; otherwise this widget will have + the size of the primary screen. + + Instead of using QDesktopWidget directly, use QApplication::desktop(). +*/ + +/*! + \fn QDesktopWidget::~QDesktopWidget() + + \internal + + Destroys the desktop widget and frees any allocated resources. +*/ + +/*! + \fn int QDesktopWidget::numScreens() const + + Returns the number of available screens. + + \obsolete + + This function is deprecated. Use screenCount instead. + + \sa primaryScreen +*/ + +/*! + \fn QWidget *QDesktopWidget::screen(int screen) + + Returns a widget that represents the screen with index \a screen + (a value of -1 means the default screen). + + If the system uses a virtual desktop, the returned widget will + have the geometry of the entire virtual desktop; i.e., bounding + every \a screen. + + \sa primaryScreen, screenCount, virtualDesktop +*/ + +/*! + \fn const QRect QDesktopWidget::availableGeometry(int screen) const + + Returns the available geometry of the screen with index \a screen. What + is available will be subrect of screenGeometry() based on what the + platform decides is available (for example excludes the dock and menu bar + on Mac OS X, or the task bar on Windows). The default screen is used if + \a screen is -1. + + \sa screenNumber(), screenGeometry() +*/ + +/*! + \fn const QRect QDesktopWidget::availableGeometry(const QWidget *widget) const + \overload + + Returns the available geometry of the screen which contains \a widget. + + \sa screenGeometry() +*/ + +/*! + \fn const QRect QDesktopWidget::availableGeometry(const QPoint &p) const + \overload + + Returns the available geometry of the screen which contains \a p. + + \sa screenGeometry() +*/ + + +/*! + \fn const QRect QDesktopWidget::screenGeometry(int screen) const + + Returns the geometry of the screen with index \a screen. The default + screen is used if \a screen is -1. + + \sa screenNumber() +*/ + +/*! + \fn const QRect QDesktopWidget::screenGeometry(const QWidget *widget) const + \overload + + Returns the geometry of the screen which contains \a widget. +*/ + +/*! + \fn const QRect QDesktopWidget::screenGeometry(const QPoint &p) const + \overload + + Returns the geometry of the screen which contains \a p. +*/ + + +/*! + \fn int QDesktopWidget::screenNumber(const QWidget *widget) const + + Returns the index of the screen that contains the largest + part of \a widget, or -1 if the widget not on a screen. + + \sa primaryScreen +*/ + +/*! + \fn int QDesktopWidget::screenNumber(const QPoint &point) const + + \overload + Returns the index of the screen that contains the \a point, or the + screen which is the shortest distance from the \a point. + + \sa primaryScreen +*/ + +/*! + \fn void QDesktopWidget::resizeEvent(QResizeEvent *event) + \reimp +*/ + +/*! + \fn void QDesktopWidget::resized(int screen) + + This signal is emitted when the size of \a screen changes. +*/ + +/*! + \fn void QDesktopWidget::workAreaResized(int screen) + + This signal is emitted when the work area available on \a screen changes. +*/ + +/*! + \property QDesktopWidget::screenCount + \brief the number of screens currently available on the system. + + \since 4.6 + + \sa screenCountChanged() +*/ + +/*! + \property QDesktopWidget::primaryScreen + \brief the index of the screen that is configured to be the primary screen + on the system. +*/ + +/*! + \property QDesktopWidget::virtualDesktop + + \brief if the system manages the available screens in a virtual desktop. + + For virtual desktops, screen() will always return the same widget. + The size of the virtual desktop is the size of this desktop + widget. +*/ + +/*! + \fn void QDesktopWidget::screenCountChanged(int newCount) + + \since 4.6 + + This signal is emitted when the number of screens changes to \a newCount. + + \sa screenCount +*/ diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm index 2e45479..efe6375 100644 --- a/src/gui/kernel/qeventdispatcher_mac.mm +++ b/src/gui/kernel/qeventdispatcher_mac.mm @@ -497,6 +497,40 @@ static bool IsMouseOrKeyEvent( NSEvent* event ) } #endif +static inline void qt_mac_waitForMoreEvents() +{ +#ifndef QT_MAC_USE_COCOA + while(CFRunLoopRunInMode(kCFRunLoopDefaultMode, 1.0e20, true) == kCFRunLoopRunTimedOut); +#else + // If no event exist in the cocoa event que, wait + // (and free up cpu time) until at least one event occur. + // This implementation is a bit on the edge, but seems to + // work fine: + NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask + untilDate:[NSDate distantFuture] + inMode:NSDefaultRunLoopMode + dequeue:YES]; + if (event) + [NSApp postEvent:event atStart:YES]; +#endif +} + +#ifdef QT_MAC_USE_COCOA +static inline void qt_mac_waitForMoreModalSessionEvents() +{ + // If no event exist in the cocoa event que, wait + // (and free up cpu time) until at least one event occur. + // This implementation is a bit on the edge, but seems to + // work fine: + NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask + untilDate:[NSDate distantFuture] + inMode:NSModalPanelRunLoopMode + dequeue:YES]; + if (event) + [NSApp postEvent:event atStart:YES]; +} +#endif + bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags) { Q_D(QEventDispatcherMac); @@ -515,55 +549,42 @@ bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags) QMacCocoaAutoReleasePool pool; NSEvent* event = 0; - if (flags & QEventLoop::DialogExec || flags & QEventLoop::EventLoopExec) { - // The point of the CocoaRequestModal event is to make sure that a - // non-execed app modal window recurses into it's own dialog exec - // once cocoa is spinning the event loop for us (e.g on top of [NSApp run]). - // We expect only one event to notify us about this, regardless of how many - // widgets that are waiting to be modal. So we remove all other pending - // events, if any. And since cocoa will now take over event processing for us, - // we allow new app modal widgets to recurse on top of us, hence the release of - // the block: - QBoolBlocker block(d->blockCocoaRequestModal, false); - QCoreApplication::removePostedEvents(qApp, QEvent::CocoaRequestModal); - - if (NSModalSession session = d->activeModalSession()) - while ([NSApp runModalSession:session] == NSRunContinuesResponse) { - // runModalSession will not wait for events, so we do it - // ourselves (otherwise we would spend 100% CPU inside this loop): - event = [NSApp nextEventMatchingMask:NSAnyEventMask - untilDate:[NSDate distantFuture] inMode:NSModalPanelRunLoopMode dequeue:YES]; - if (event) - [NSApp postEvent:event atStart:YES]; - } - else + // If Qt is used as a plugin, or just added into a native cocoa + // application, we should not run or stop NSApplication; + // This will be done from outside Qt. + // And if processEvents is called manually (rather than from QEventLoop), we + // cannot enter a tight loop and block the call, but instead return after one flush: + bool canExec_3rdParty = d->nsAppRunCalledByQt || ![NSApp isRunning]; + bool canExec_Qt = flags & QEventLoop::DialogExec || flags & QEventLoop::EventLoopExec; + + if (canExec_Qt && canExec_3rdParty) { + // We can use exec-mode, meaning that we can stay in a tight loop until + // interrupted. This is mostly an optimization, but it also allow us + // to use [NSApp run], which is the recommended way of running applications + // in cocoa. [NSApp run] should be called at least once for any cocoa app. + if (NSModalSession session = d->currentModalSession()) { + QBoolBlocker execGuard(d->currentExecIsNSAppRun, false); + while (!d->interrupt && [NSApp runModalSession:session] == NSRunContinuesResponse) + qt_mac_waitForMoreModalSessionEvents(); + } else { + d->nsAppRunCalledByQt = true; + QBoolBlocker execGuard(d->currentExecIsNSAppRun, true); [NSApp run]; - - d->rebuildModalSessionStack(false); + } retVal = true; } else do { - // Since we now are going to spin the event loop just _one_ round - // we need to block all incoming CocoaRequestModal events to ensure - // that we don't recurse into a new exec-ing event loop while doing - // so (and as such, 'hang' the thread inside the recursion): - QBoolBlocker block(d->blockCocoaRequestModal, true); + // INVARIANT: We cannot block the thread (and run in a tight loop). + // Instead we will process all current pending events and return. bool mustRelease = false; if (!(flags & QEventLoop::ExcludeUserInputEvents) && !d->queuedUserInputEvents.isEmpty()) { - // process a pending user input event + // Process a pending user input event mustRelease = true; event = static_cast<NSEvent *>(d->queuedUserInputEvents.takeFirst()); } else { - if (NSModalSession session = d->activeModalSession()) { - // There's s a modal widget showing, run it's session: - if (flags & QEventLoop::WaitForMoreEvents) { - // Wait for at least one event - // before spinning the session: - event = [NSApp nextEventMatchingMask:NSAnyEventMask - untilDate:[NSDate distantFuture] inMode:NSModalPanelRunLoopMode dequeue:YES]; - if (event) - [NSApp postEvent:event atStart:YES]; - } + if (NSModalSession session = d->currentModalSession()) { + if (flags & QEventLoop::WaitForMoreEvents) + qt_mac_waitForMoreModalSessionEvents(); [NSApp runModalSession:session]; retVal = true; break; @@ -634,41 +655,35 @@ bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags) && (flags & QEventLoop::WaitForMoreEvents)); if (canWait) { // INVARIANT: We haven't processed any events yet. And we're told - // to stay inside this function until at least one event is processed - // (WaitForMoreEvents). So we wait on the window server: -#ifndef QT_MAC_USE_COCOA - while(CFRunLoopRunInMode(kCFRunLoopDefaultMode, 1.0e20, true) == kCFRunLoopRunTimedOut); -#else - QMacCocoaAutoReleasePool pool; - NSEvent *manualEvent = [NSApp nextEventMatchingMask:NSAnyEventMask - untilDate:[NSDate distantFuture] inMode:NSDefaultRunLoopMode - dequeue:YES]; - if (manualEvent) - [NSApp sendEvent:manualEvent]; -#endif + // to stay inside this function until at least one event is processed. + qt_mac_waitForMoreEvents(); flags &= ~QEventLoop::WaitForMoreEvents; } else { - // Done with event processing for now. Leave the function: + // Done with event processing for now. + // Leave the function: break; } } - // Because pending deffered-delete events are only sendt after - // returning from the loop level they were posted in, we schedule - // an extra wakup to force the _current_ run loop to process them (in - // case the application stands idle waiting for the delete event): - wakeUp(); +#ifdef QT_MAC_USE_COCOA + // In case we _now_ process events using [NSApp run], we need to stop it to + // ensure that: + // 1. the QEventLoop that called us is still executing, or + // 2. we have a modal session that needs to be spun instead. + // In case this is a plain call to processEvents (perhaps from a loop) + // from the application (rather than from a QEventLoop), we delay the + // interrupting until we/ actually enter a lower loop level (hence the + // deffered delete of the object below): + QtMacInterruptDispatcherHelp::interruptLater(); +#endif - if (d->interrupt){ - // We restart NSApplication by first stopping it, and then call 'run' - // again (NSApplication is actually already stopped, hence the need - // for a restart, but calling stop again will also make the call - // return from the current recursion). When the call returns to - // QEventLoop (mind, not from this recursion, but from the one we're - // about to stop), it will just call QEventDispatcherMac::processEvents() - // again. + if (d->interrupt) { + // We should continue to leave all recursion to processEvents until + // processEvents is called again (e.g. from a QEventLoop that + // was not yet told to quit: interrupt(); } + return retVal; } @@ -700,104 +715,169 @@ bool QEventDispatcherMacPrivate::blockSendPostedEvents = false; #ifdef QT_MAC_USE_COCOA QStack<QCocoaModalSessionInfo> QEventDispatcherMacPrivate::cocoaModalSessionStack; -bool QEventDispatcherMacPrivate::blockCocoaRequestModal = false; +bool QEventDispatcherMacPrivate::currentExecIsNSAppRun = false; +bool QEventDispatcherMacPrivate::nsAppRunCalledByQt = false; +NSModalSession QEventDispatcherMacPrivate::currentModalSessionCached = 0; -static void qt_mac_setChildDialogsResponsive(QWidget *widget, bool responsive) +int QEventDispatcherMacPrivate::activeModalSessionCount() { + // Returns the number of modal sessions created + // (and not just pushed onto the stack, pending to be created) + int count = 0; + for (int i=cocoaModalSessionStack.size()-1; i>=0; --i) { + QCocoaModalSessionInfo &info = cocoaModalSessionStack[i]; + if (info.session) + ++count; + } + return count; +} + +void QEventDispatcherMacPrivate::temporarilyStopAllModalSessions() +{ + // Stop all created modal session, and as such, make then + // pending again. The next call to currentModalSession will + // recreate the session on top again: + int stackSize = cocoaModalSessionStack.size(); + for (int i=stackSize-1; i>=0; --i) { + QCocoaModalSessionInfo &info = cocoaModalSessionStack[i]; + if (info.session) { + [NSApp endModalSession:info.session]; + info.session = 0; + } + } + currentModalSessionCached = 0; +} + +NSModalSession QEventDispatcherMacPrivate::currentModalSession() +{ + // If we have one or more modal windows, this function will create + // a session for each of those, and return the one for the top. + if (currentModalSessionCached) + return currentModalSessionCached; + + if (cocoaModalSessionStack.isEmpty()) + return 0; + + // Since this code will end up calling our Qt event handler + // (also from beginModalSessionForWindow), we need to block + // that to avoid side effects of events beeing delivered: + QBoolBlocker block(blockSendPostedEvents, true); + + if (![NSApp isRunning]) { + // Sadly, we need to introduce this little event flush + // to stop dialogs from blinking/poping in front if a + // modal session restart was needed: + while (NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask + untilDate:nil + inMode:NSDefaultRunLoopMode + dequeue: YES]) { + qt_mac_send_event(0, event, 0); + } + } + + int sessionCount = cocoaModalSessionStack.size(); + for (int i=0; i<sessionCount; ++i) { + QCocoaModalSessionInfo &info = cocoaModalSessionStack[i]; + if (!info.widget) + continue; + if (info.widget->testAttribute(Qt::WA_DontShowOnScreen)) + continue; + if (!info.session) { + QMacCocoaAutoReleasePool pool; + NSWindow *window = qt_mac_window_for(info.widget); + if (!window) + continue; + info.session = [NSApp beginModalSessionForWindow:window]; + } + currentModalSessionCached = info.session; + } + + return currentModalSessionCached; +} + +static void setChildrenWorksWhenModal(QWidget *widget, bool worksWhenModal) +{ + // For NSPanels (but not NSWindows, sadly), we can set the flag + // worksWhenModal, so that they are active even when they are not modal. QList<QDialog *> dialogs = widget->findChildren<QDialog *>(); for (int i=0; i<dialogs.size(); ++i){ NSWindow *window = qt_mac_window_for(dialogs[i]); if (window && [window isKindOfClass:[NSPanel class]]) { - [static_cast<NSPanel *>(window) setWorksWhenModal:responsive]; - if (responsive && dialogs[i]->isVisible()){ + [static_cast<NSPanel *>(window) setWorksWhenModal:worksWhenModal]; + if (worksWhenModal && dialogs[i]->isVisible()){ [window orderFront:window]; } } } } -NSModalSession QEventDispatcherMacPrivate::activeModalSession() +void QEventDispatcherMacPrivate::updateChildrenWorksWhenModal() { - // Create (if needed) and return the modal session - // for the top-most modal dialog, if any: - if (cocoaModalSessionStack.isEmpty()) - return 0; - QCocoaModalSessionInfo &info = cocoaModalSessionStack.last(); - if (!info.widget) - return 0; - if (info.widget->testAttribute(Qt::WA_DontShowOnScreen)){ - // INVARIANT: We have a modal widget, but it's not visible on screen. - // This will e.g. be true for native dialogs. Make the dialog children - // of the previous modal dialog unresponsive, so that the current dialog - // (native or not) is the only reponsive dialog on screen: - int size = cocoaModalSessionStack.size(); + // Make the dialog children of the widget + // active. And make the dialog children of + // the previous modal dialog unactive again: + int size = cocoaModalSessionStack.size(); + if (size > 0){ + if (QWidget *prevModal = cocoaModalSessionStack[size-1].widget) + setChildrenWorksWhenModal(prevModal, true); if (size > 1){ if (QWidget *prevModal = cocoaModalSessionStack[size-2].widget) - qt_mac_setChildDialogsResponsive(prevModal, false); + setChildrenWorksWhenModal(prevModal, false); } - return 0; } +} - if (!info.session) { - QMacCocoaAutoReleasePool pool; - NSWindow *window = qt_mac_window_for(info.widget); - if (!window) - return 0; - // 'beginModalSessionForWindow' will give the event loop a spin, and as - // such, deliver Qt events. This might lead to inconsistent behaviour - // (especially if CocoaRequestModal is delivered), so we need to block: - QBoolBlocker block(blockSendPostedEvents, true); - info.session = [NSApp beginModalSessionForWindow:window]; - // Make the dialog children of the current modal dialog - // responsive. And make the dialog children of - // the previous modal dialog unresponsive again: - qt_mac_setChildDialogsResponsive(info.widget, true); - int size = cocoaModalSessionStack.size(); - if (size > 1){ - if (QWidget *prevModal = cocoaModalSessionStack[size-2].widget) - qt_mac_setChildDialogsResponsive(prevModal, false); - } - } - return info.session; +void QEventDispatcherMacPrivate::beginModalSession(QWidget *widget) +{ + // Add a new, empty (null), NSModalSession to the stack. + // It will become active the next time QEventDispatcher::processEvents is called. + // A QCocoaModalSessionInfo is considered pending to become active if the widget pointer + // is non-zero, and the session pointer is zero (it will become active upon a call to + // currentModalSession). A QCocoaModalSessionInfo is considered pending to be stopped if + // the widget pointer is zero, and the session pointer is non-zero (it will be fully + // stopped in endModalSession(). + QCocoaModalSessionInfo info = {widget, 0}; + cocoaModalSessionStack.push(info); + updateChildrenWorksWhenModal(); + currentModalSessionCached = 0; } -void QEventDispatcherMacPrivate::rebuildModalSessionStack(bool pop) +void QEventDispatcherMacPrivate::endModalSession(QWidget *widget) { - // Calling [NSApp stopModal], or [NSApp stop], will stop all modal dialogs - // in one go. So to to not confuse cocoa, we need to stop all our modal - // sessions as well. QMacEventDispatcher will make them modal again - // in the correct order as long as they are left on the cocoaModalSessionStack - // and a CocoaRequestModal is posted: - if (cocoaModalSessionStack.isEmpty()) - return; + // Mark all sessions attached to widget as pending to be stopped. We do this + // by setting the widget pointer to zero, but leave the session pointer. + // We don't tell cocoa to stop any sessions just yet, because cocoa only understands + // when we stop the _current_ modal session (which is the session on top of + // the stack, and might not belong to 'widget'). + int stackSize = cocoaModalSessionStack.size(); + for (int i=stackSize-1; i>=0; --i) { + QCocoaModalSessionInfo &info = cocoaModalSessionStack[i]; + if (info.widget == widget) + info.widget = 0; + } - QMacCocoaAutoReleasePool pool; - [NSApp stopModal]; - [NSApp postEvent:[NSEvent otherEventWithType:NSApplicationDefined location:NSZeroPoint - modifierFlags:0 timestamp:0. windowNumber:0 context:0 - subtype:SHRT_MAX data1:0 data2:0] atStart:NO]; + // Now we stop, and remove, all sessions marked as pending + // to be stopped on _top_ of the stack, if any: + bool needToInterruptEventDispatcher = false; + bool needToUpdateChildrenWorksWhenModal = false; - for (int i=0; i<cocoaModalSessionStack.size(); ++i){ + for (int i=stackSize-1; i>=0; --i) { QCocoaModalSessionInfo &info = cocoaModalSessionStack[i]; + if (info.widget) + break; + cocoaModalSessionStack.remove(i); + needToUpdateChildrenWorksWhenModal = true; + currentModalSessionCached = 0; if (info.session) { [NSApp endModalSession:info.session]; - info.session = 0; + needToInterruptEventDispatcher = true; } } - if (pop) { - QCocoaModalSessionInfo info = cocoaModalSessionStack.pop(); - if (info.widget) - qt_mac_setChildDialogsResponsive(info.widget, false); - } - - if (!cocoaModalSessionStack.isEmpty()) { - // Since we now have pending modal sessions again, make - // sure that we enter modal for the one on the top later: - qApp->postEvent(qApp, new QEvent(QEvent::CocoaRequestModal)); - } else { - QCoreApplication::removePostedEvents(qApp, QEvent::CocoaRequestModal); - } + if (needToUpdateChildrenWorksWhenModal) + updateChildrenWorksWhenModal(); + if (needToInterruptEventDispatcher) + QEventDispatcherMac::instance()->interrupt(); } #endif @@ -858,27 +938,29 @@ void QEventDispatcherMacPrivate::postedEventsSourcePerformCallback(void *info) } } -#ifdef QT_MAC_USE_COCOA -static void stopNSApp() -{ - QMacCocoaAutoReleasePool pool; - static const short NSAppShouldStopForQt = SHRT_MAX; - [NSApp stop:NSApp]; - [NSApp postEvent:[NSEvent otherEventWithType:NSApplicationDefined location:NSZeroPoint - modifierFlags:0 timestamp:0. windowNumber:0 context:0 - subtype:NSAppShouldStopForQt data1:0 data2:0] atStart:NO]; -} -#endif - void QEventDispatcherMac::interrupt() { Q_D(QEventDispatcherMac); d->interrupt = true; wakeUp(); + #ifndef QT_MAC_USE_COCOA CFRunLoopStop(mainRunLoop()); #else - stopNSApp(); + QMacCocoaAutoReleasePool pool; + // In case we wait for more events inside + // processEvents (or NSApp run), post a dummy to wake it up: + static const short NSAppShouldStopForQt = SHRT_MAX; + [NSApp postEvent:[NSEvent otherEventWithType:NSApplicationDefined location:NSZeroPoint + modifierFlags:0 timestamp:0. windowNumber:0 context:0 + subtype:NSAppShouldStopForQt data1:0 data2:0] atStart:NO]; + + if (d->activeModalSessionCount() == 0) { + // We should only stop NSApp if we actually started it (and + // not some 3rd party application, e.g. if we are a plugin). + if (d->nsAppRunCalledByQt) + [NSApp stop:NSApp]; + } #endif } @@ -916,5 +998,52 @@ QEventDispatcherMac::~QEventDispatcherMac() CFRelease(d->waitingObserver); } +///////////////////////////////////////////////////////////////////////////// + +#ifdef QT_MAC_USE_COCOA + +QtMacInterruptDispatcherHelp* QtMacInterruptDispatcherHelp::instance = 0; + +QtMacInterruptDispatcherHelp::QtMacInterruptDispatcherHelp() : cancelled(false) +{ + // This is the whole point of encapsulation this code + // inside a class; we can make the code (inside destructor) + // execute on lower loop level: + deleteLater(); +} + +QtMacInterruptDispatcherHelp::~QtMacInterruptDispatcherHelp() +{ + if (cancelled) + return; + + instance = 0; + + if (QEventDispatcherMacPrivate::currentExecIsNSAppRun) { + int activeCount = QEventDispatcherMacPrivate::activeModalSessionCount(); + if (activeCount > 0) { + // The problem we now have hit: [NSApp stop] will not stop NSApp + // if a session is active; it will stop the session instead. + // So to stop NSApp, we need to temporarily stop all the + // sessions, then stop NSApp, then restart the session on top again. + // We need to do this to ensure that we're not stuck inside + // [NSApp run] when we really should be running a modal session: + QEventDispatcherMacPrivate::temporarilyStopAllModalSessions(); + } + } + // Always interrupt once more in case the modal session stack changed + // while processEvents was called manually from within the application: + QEventDispatcherMac::instance()->interrupt(); +} + +void QtMacInterruptDispatcherHelp::interruptLater() { + if (instance) { + instance->cancelled = true; + delete instance; + } + instance = new QtMacInterruptDispatcherHelp; +} + +#endif QT_END_NAMESPACE diff --git a/src/gui/kernel/qeventdispatcher_mac_p.h b/src/gui/kernel/qeventdispatcher_mac_p.h index 225d32e..6747d52 100644 --- a/src/gui/kernel/qeventdispatcher_mac_p.h +++ b/src/gui/kernel/qeventdispatcher_mac_p.h @@ -172,9 +172,15 @@ public: #ifdef QT_MAC_USE_COCOA // The following variables help organizing modal sessions: static QStack<QCocoaModalSessionInfo> cocoaModalSessionStack; - static bool blockCocoaRequestModal; - static NSModalSession activeModalSession(); - static void rebuildModalSessionStack(bool pop); + static bool currentExecIsNSAppRun; + static bool nsAppRunCalledByQt; + static NSModalSession currentModalSessionCached; + static void updateChildrenWorksWhenModal(); + static NSModalSession currentModalSession(); + static int activeModalSessionCount(); + static void temporarilyStopAllModalSessions(); + static void beginModalSession(QWidget *widget); + static void endModalSession(QWidget *widget); #endif MacSocketHash macSockets; @@ -192,6 +198,20 @@ private: CFRunLoopActivity activity, void *info); }; +#ifdef QT_MAC_USE_COCOA +class QtMacInterruptDispatcherHelp : public QObject +{ + static QtMacInterruptDispatcherHelp *instance; + bool cancelled; + + QtMacInterruptDispatcherHelp(); + ~QtMacInterruptDispatcherHelp(); + + public: + static void interruptLater(); +}; +#endif + QT_END_NAMESPACE #endif // QEVENTDISPATCHER_MAC_P_H diff --git a/src/gui/kernel/qformlayout.cpp b/src/gui/kernel/qformlayout.cpp index 4e632de..b3ecc35 100644 --- a/src/gui/kernel/qformlayout.cpp +++ b/src/gui/kernel/qformlayout.cpp @@ -1006,10 +1006,8 @@ QStyle* QFormLayoutPrivate::getStyle() const \since 4.4 \brief The QFormLayout class manages forms of input widgets and their associated labels. - \ingroup appearance \ingroup geomanagement - \mainclass QFormLayout is a convenience layout class that lays out its children in a two-column form. The left column consists of labels diff --git a/src/gui/kernel/qgridlayout.cpp b/src/gui/kernel/qgridlayout.cpp index 6624b77..1f25c63 100644 --- a/src/gui/kernel/qgridlayout.cpp +++ b/src/gui/kernel/qgridlayout.cpp @@ -980,8 +980,7 @@ QRect QGridLayoutPrivate::cellRect(int row, int col) const \brief The QGridLayout class lays out widgets in a grid. \ingroup geomanagement - \ingroup appearance - \mainclass + QGridLayout takes the space made available to it (by its parent layout or by the parentWidget()), divides it up into rows and diff --git a/src/gui/kernel/qkde.cpp b/src/gui/kernel/qkde.cpp index 23de838..98bf0a0 100644 --- a/src/gui/kernel/qkde.cpp +++ b/src/gui/kernel/qkde.cpp @@ -139,8 +139,6 @@ QString QKde::kdeStyle() return QLatin1String("plastique"); else return QLatin1String("windows"); - - return QString(); } /*!\internal diff --git a/src/gui/kernel/qkeymapper.cpp b/src/gui/kernel/qkeymapper.cpp index 0730ef6..7143358 100644 --- a/src/gui/kernel/qkeymapper.cpp +++ b/src/gui/kernel/qkeymapper.cpp @@ -51,7 +51,6 @@ QT_BEGIN_NAMESPACE /*! \class QKeyMapper \since 4.2 - \ingroup application \internal \sa QObject diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index 0716c37..53120da 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -152,9 +152,8 @@ void Q_AUTOTEST_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mn \brief The QKeySequence class encapsulates a key sequence as used by shortcuts. - \ingroup misc \ingroup shared - \mainclass + In its most common form, a key sequence describes a combination of keys that must be used together to perform some action. Key sequences diff --git a/src/gui/kernel/qlayout.cpp b/src/gui/kernel/qlayout.cpp index 3febd2c..4f1f52f 100644 --- a/src/gui/kernel/qlayout.cpp +++ b/src/gui/kernel/qlayout.cpp @@ -75,7 +75,6 @@ static int menuBarHeightForWidth(QWidget *menubar, int w) \class QLayout \brief The QLayout class is the base class of geometry managers. - \ingroup appearance \ingroup geomanagement This is an abstract base class inherited by the concrete classes diff --git a/src/gui/kernel/qlayoutitem.cpp b/src/gui/kernel/qlayoutitem.cpp index 47fe5e6..54f37bf 100644 --- a/src/gui/kernel/qlayoutitem.cpp +++ b/src/gui/kernel/qlayoutitem.cpp @@ -87,7 +87,6 @@ QSizePolicy::operator QVariant() const \brief The QLayoutItem class provides an abstract item that a QLayout manipulates. - \ingroup appearance \ingroup geomanagement This is used by custom layouts. @@ -116,7 +115,6 @@ QSizePolicy::operator QVariant() const /*! \class QSpacerItem - \ingroup appearance \ingroup geomanagement \brief The QSpacerItem class provides blank space in a layout. @@ -144,7 +142,6 @@ QSizePolicy::operator QVariant() const /*! \class QWidgetItem - \ingroup appearance \ingroup geomanagement \brief The QWidgetItem class is a layout item that represents a widget. diff --git a/src/gui/kernel/qmime_mac.cpp b/src/gui/kernel/qmime_mac.cpp index f4d4707..9e8de67 100644 --- a/src/gui/kernel/qmime_mac.cpp +++ b/src/gui/kernel/qmime_mac.cpp @@ -126,9 +126,8 @@ CFStringRef qt_mac_mime_typeUTI = CFSTR("com.pasteboard.trolltech.marker"); \l{http://developer.apple.com/macosx/uniformtypeidentifiers.html}{Uniform Type Identifier (UTI)} format. \since 4.2 - \ingroup io + \ingroup draganddrop - \ingroup misc Qt's drag and drop and clipboard facilities use the MIME standard. On X11, this maps trivially to the Xdnd protocol. On diff --git a/src/gui/kernel/qmime_win.cpp b/src/gui/kernel/qmime_win.cpp index 63f37af..7f82f53 100644 --- a/src/gui/kernel/qmime_win.cpp +++ b/src/gui/kernel/qmime_win.cpp @@ -219,9 +219,7 @@ Q_GLOBAL_STATIC(QWindowsMimeList, theMimeList); /*! \class QWindowsMime \brief The QWindowsMime class maps open-standard MIME to Window Clipboard formats. - \ingroup io \ingroup draganddrop - \ingroup misc Qt's drag-and-drop and clipboard facilities use the MIME standard. On X11, this maps trivially to the Xdnd protocol, but on Windows diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp index 24e735c..c5ae66b 100644 --- a/src/gui/kernel/qpalette.cpp +++ b/src/gui/kernel/qpalette.cpp @@ -399,8 +399,8 @@ void QPalette::setColorGroup(ColorGroup cg, const QColorGroup &g) \ingroup appearance \ingroup shared - \ingroup multimedia - \mainclass + \ingroup painting + A palette consists of three color groups: \e Active, \e Disabled, and \e Inactive. All widgets in Qt contain a palette and diff --git a/src/gui/kernel/qshortcut.cpp b/src/gui/kernel/qshortcut.cpp index 194f648..1c5917c 100644 --- a/src/gui/kernel/qshortcut.cpp +++ b/src/gui/kernel/qshortcut.cpp @@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE \brief The QShortcut class is used to create keyboard shortcuts. \ingroup events - \mainclass + The QShortcut class provides a way of connecting keyboard shortcuts to Qt's \l{signals and slots} mechanism, so that diff --git a/src/gui/kernel/qsizepolicy.qdoc b/src/gui/kernel/qsizepolicy.qdoc new file mode 100644 index 0000000..200deb5 --- /dev/null +++ b/src/gui/kernel/qsizepolicy.qdoc @@ -0,0 +1,521 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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://qt.nokia.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \class QSizePolicy + \brief The QSizePolicy class is a layout attribute describing horizontal + and vertical resizing policy. + + \ingroup geomanagement + + The size policy of a widget is an expression of its willingness to + be resized in various ways, and affects how the widget is treated + by the \l{Layout Management}{layout engine}. Each widget returns a + QSizePolicy that describes the horizontal and vertical resizing + policy it prefers when being laid out. You can change this for + a specific widget by changing its QWidget::sizePolicy property. + + QSizePolicy contains two independent QSizePolicy::Policy values + and two stretch factors; one describes the widgets's horizontal + size policy, and the other describes its vertical size policy. It + also contains a flag to indicate whether the height and width of + its preferred size are related. + + The horizontal and vertical policies can be set in the + constructor, and altered using the setHorizontalPolicy() and + setVerticalPolicy() functions. The stretch factors can be set + using the setHorizontalStretch() and setVerticalStretch() + functions. The flag indicating whether the widget's + \l{QWidget::sizeHint()}{sizeHint()} is width-dependent (such as a + menu bar or a word-wrapping label) can be set using the + setHeightForWidth() function. + + The current size policies and stretch factors be retrieved using + the horizontalPolicy(), verticalPolicy(), horizontalStretch() and + verticalStretch() functions. Alternatively, use the transpose() + function to swap the horizontal and vertical policies and + stretches. The hasHeightForWidth() function returns the current + status of the flag indicating the size hint dependencies. + + Use the expandingDirections() function to determine whether the + associated widget can make use of more space than its + \l{QWidget::sizeHint()}{sizeHint()} function indicates, as well as + find out in which directions it can expand. + + Finally, the QSizePolicy class provides operators comparing this + size policy to a given policy, as well as a QVariant operator + storing this QSizePolicy as a QVariant object. + + \sa QSize, QWidget::sizeHint(), QWidget::sizePolicy, + QLayoutItem::sizeHint() +*/ + +/*! + \enum QSizePolicy::PolicyFlag + + These flags are combined together to form the various \l{Policy} + values: + + \value GrowFlag The widget can grow beyond its size hint if necessary. + \value ExpandFlag The widget should get as much space as possible. + \value ShrinkFlag The widget can shrink below its size hint if necessary. + \value IgnoreFlag The widget's size hint is ignored. The widget will get + as much space as possible. + + \sa Policy +*/ + +/*! + \enum QSizePolicy::Policy + + This enum describes the various per-dimension sizing types used + when constructing a QSizePolicy. + + \value Fixed The QWidget::sizeHint() is the only acceptable + alternative, so the widget can never grow or shrink (e.g. the + vertical direction of a push button). + + \value Minimum The sizeHint() is minimal, and sufficient. The + widget can be expanded, but there is no advantage to it being + larger (e.g. the horizontal direction of a push button). + It cannot be smaller than the size provided by sizeHint(). + + \value Maximum The sizeHint() is a maximum. The widget can be + shrunk any amount without detriment if other widgets need the + space (e.g. a separator line). + It cannot be larger than the size provided by sizeHint(). + + \value Preferred The sizeHint() is best, but the widget can be + shrunk and still be useful. The widget can be expanded, but there + is no advantage to it being larger than sizeHint() (the default + QWidget policy). + + \value Expanding The sizeHint() is a sensible size, but the + widget can be shrunk and still be useful. The widget can make use + of extra space, so it should get as much space as possible (e.g. + the horizontal direction of a horizontal slider). + + \value MinimumExpanding The sizeHint() is minimal, and sufficient. + The widget can make use of extra space, so it should get as much + space as possible (e.g. the horizontal direction of a horizontal + slider). + + \value Ignored The sizeHint() is ignored. The widget will get as + much space as possible. + + \sa PolicyFlag, setHorizontalPolicy(), setVerticalPolicy() +*/ + +/*! + \fn QSizePolicy::QSizePolicy() + + Constructs a QSizePolicy object with \l Fixed as its horizontal + and vertical policies. + + The policies can be altered using the setHorizontalPolicy() and + setVerticalPolicy() functions. Use the setHeightForWidth() + function if the preferred height of the widget is dependent on the + width of the widget (for example, a QLabel with line wrapping). + + \sa setHorizontalStretch(), setVerticalStretch() +*/ + +/*! + \fn QSizePolicy::QSizePolicy(Policy horizontal, Policy vertical) + + Constructs a QSizePolicy object with the given \a horizontal and + \a vertical policies, and DefaultType as the control type. + + Use setHeightForWidth() if the preferred height of the widget is + dependent on the width of the widget (for example, a QLabel with + line wrapping). + + \sa setHorizontalStretch(), setVerticalStretch() +*/ + +/*! + \fn QSizePolicy::QSizePolicy(Policy horizontal, Policy vertical, ControlType type) + \since 4.3 + + Constructs a QSizePolicy object with the given \a horizontal and + \a vertical policies, and the specified control \a type. + + Use setHeightForWidth() if the preferred height of the widget is + dependent on the width of the widget (for example, a QLabel with + line wrapping). + + \sa setHorizontalStretch(), setVerticalStretch(), controlType() +*/ + +/*! + \fn QSizePolicy::Policy QSizePolicy::horizontalPolicy() const + + Returns the horizontal component of the size policy. + + \sa setHorizontalPolicy(), verticalPolicy(), horizontalStretch() +*/ + +/*! + \fn QSizePolicy::Policy QSizePolicy::verticalPolicy() const + + Returns the vertical component of the size policy. + + \sa setVerticalPolicy(), horizontalPolicy(), verticalStretch() +*/ + +/*! + \fn void QSizePolicy::setHorizontalPolicy(Policy policy) + + Sets the horizontal component to the given \a policy. + + \sa horizontalPolicy(), setVerticalPolicy(), setHorizontalStretch() +*/ + +/*! + \fn void QSizePolicy::setVerticalPolicy(Policy policy) + + Sets the vertical component to the given \a policy. + + \sa verticalPolicy(), setHorizontalPolicy(), setVerticalStretch() +*/ + +/*! + \fn Qt::Orientations QSizePolicy::expandingDirections() const + + Returns whether a widget can make use of more space than the + QWidget::sizeHint() function indicates. + + A value of Qt::Horizontal or Qt::Vertical means that the widget + can grow horizontally or vertically (i.e., the horizontal or + vertical policy is \l Expanding or \l MinimumExpanding), whereas + Qt::Horizontal | Qt::Vertical means that it can grow in both + dimensions. + + \sa horizontalPolicy(), verticalPolicy() +*/ + +/*! + \fn ControlType QSizePolicy::controlType() const + \since 4.3 + + Returns the control type associated with the widget for which + this size policy applies. +*/ + +/*! + \fn void QSizePolicy::setControlType(ControlType type) + \since 4.3 + + Sets the control type associated with the widget for which this + size policy applies to \a type. + + The control type specifies the type of the widget for which this + size policy applies. It is used by some styles, notably + QMacStyle, to insert proper spacing between widgets. For example, + the Mac OS X Aqua guidelines specify that push buttons should be + separated by 12 pixels, whereas vertically stacked radio buttons + only require 6 pixels. + + \sa QStyle::layoutSpacing() +*/ + +/*! + \fn void QSizePolicy::setHeightForWidth(bool dependent) + + Sets the flag determining whether the widget's preferred height + depends on its width, to \a dependent. + + \sa hasHeightForWidth() +*/ + +/*! + \fn bool QSizePolicy::hasHeightForWidth() const + + Returns true if the widget's preferred height depends on its + width; otherwise returns false. + + \sa setHeightForWidth() +*/ + +/*! + \fn bool QSizePolicy::operator==(const QSizePolicy &other) const + + Returns true if this policy is equal to \a other; otherwise + returns false. + + \sa operator!=() +*/ + +/*! + \fn bool QSizePolicy::operator!=(const QSizePolicy &other) const + + Returns true if this policy is different from \a other; otherwise + returns false. + + \sa operator==() +*/ + +/*! + \fn int QSizePolicy::horizontalStretch() const + + Returns the horizontal stretch factor of the size policy. + + \sa setHorizontalStretch(), verticalStretch(), horizontalPolicy() +*/ + +/*! + \fn int QSizePolicy::verticalStretch() const + + Returns the vertical stretch factor of the size policy. + + \sa setVerticalStretch(), horizontalStretch(), verticalPolicy() +*/ + +/*! + \fn void QSizePolicy::setHorizontalStretch(uchar stretchFactor) + + Sets the horizontal stretch factor of the size policy to the given \a + stretchFactor. + + \sa horizontalStretch(), setVerticalStretch(), setHorizontalPolicy() +*/ + +/*! + \fn void QSizePolicy::setVerticalStretch(uchar stretchFactor) + + Sets the vertical stretch factor of the size policy to the given + \a stretchFactor. + + \sa verticalStretch(), setHorizontalStretch(), setVerticalPolicy() +*/ + +/*! + \fn void QSizePolicy::transpose() + + Swaps the horizontal and vertical policies and stretches. +*/ + +/*! + \enum QSizePolicy::ControlType + \since 4.3 + + This enum specifies the different types of widgets in terms of + layout interaction: + + \value DefaultType The default type, when none is specified. + \value ButtonBox A QDialogButtonBox instance. + \value CheckBox A QCheckBox instance. + \value ComboBox A QComboBox instance. + \value Frame A QFrame instance. + \value GroupBox A QGroupBox instance. + \value Label A QLabel instance. + \value Line A QFrame instance with QFrame::HLine or QFrame::VLine. + \value LineEdit A QLineEdit instance. + \value PushButton A QPushButton instance. + \value RadioButton A QRadioButton instance. + \value Slider A QAbstractSlider instance. + \value SpinBox A QAbstractSpinBox instance. + \value TabWidget A QTabWidget instance. + \value ToolButton A QToolButton instance. + + \sa setControlType(), controlType() +*/ + +#ifdef QT3_SUPPORT +/*! + \typedef QSizePolicy::SizeType + \compat + + Use the QSizePolicy::Policy enum instead. +*/ + +/*! + \enum QSizePolicy::ExpandData + \compat + + Use the Qt::Orientations enum instead. + + \value NoDirection Use 0 instead. + \value Horizontally Use Qt::Horizontal instead. + \value Vertically Use Qt::Vertical instead. + \value BothDirections Use Qt::Horizontal | Qt::Vertical instead. +*/ + +/*! + \fn bool QSizePolicy::mayShrinkHorizontally() const + + Use the horizontalPolicy() function combined with the + QSizePolicy::PolicyFlag enum instead. + + \oldcode + bool policy = mayShrinkHorizontally(); + \newcode + bool policy = horizontalPolicy() & QSizePolicy::ShrinkFlag; + \endcode +*/ + +/*! + \fn bool QSizePolicy::mayShrinkVertically() const + + Use the verticalPolicy() function combined with the + QSizePolicy::PolicyFlag enum instead. + + \oldcode + bool policy = mayShrinkVertically(); + \newcode + bool policy = verticalPolicy() & QSizePolicy::ShrinkFlag; + \endcode +*/ + +/*! + \fn bool QSizePolicy::mayGrowHorizontally() const + + Use the horizontalPolicy() function combined with the + QSizePolicy::PolicyFlag enum instead. + + \oldcode + bool policy = mayGrowHorizontally(); + \newcode + bool policy = horizontalPolicy() & QSizePolicy::GrowFlag; + \endcode +*/ + +/*! + \fn bool QSizePolicy::mayGrowVertically() const + + Use the verticalPolicy() function combined with the + QSizePolicy::PolicyFlag enum instead. + + \oldcode + bool policy = mayGrowVertically(); + \newcode + bool policy = verticalPolicy() & QSizePolicy::GrowFlag; + \endcode +*/ + +/*! + \fn Qt::QSizePolicy::Orientations QSizePolicy::expanding() const + + Use expandingDirections() instead. +*/ + +/*! + \fn QSizePolicy::QSizePolicy(Policy horizontal, Policy vertical, bool dependent) + + Use the QSizePolicy() constructor and the setHeightForWidth() + function instead. + + \oldcode + QSizePolicy *policy = new QSizePolicy(horizontal, vertical, dependent); + \newcode + QSizePolicy *policy = new QSizePolicy(horizontal, vertical); + policy->setHeightForWidth(dependent); + \endcode +*/ + +/*! + \fn QSizePolicy::QSizePolicy(Policy horizontal, Policy vertical, uchar horizontalStretch, + uchar verticalStretch, bool dependent) + + Use the QSizePolicy() constructor and call the + setHorizontalStretch(), setVerticalStretch(), and + setHeightForWidth() functions instead. + + \oldcode + QSizePolicy *policy = new QSizePolicy(horizontal, vertical, + horizontalStretch, verticalStretch, + dependent); + \newcode + QSizePolicy *policy = new QSizePolicy(horizontal, vertical); + policy->setHorizontalStretch(horizontalStretch); + policy->setVerticalStretch(verticalStretch); + policy->setHeightForWidth(dependent); + \endcode +*/ + +/*! + \fn QSizePolicy::Policy QSizePolicy::horData() const + + Use horizontalPolicy() instead. +*/ + +/*! + \fn QSizePolicy::Policy QSizePolicy::verData() const + + Use verticalPolicy() instead. +*/ + +/*! + \fn void QSizePolicy::setHorData(Policy policy) + + Use setHorizontalPolicy() instead. +*/ + +/*! + \fn void QSizePolicy::setVerData(Policy policy) + + Use setVerticalPolicy() instead. +*/ + +/*! + \fn uint QSizePolicy::horStretch() const + + Use horizontalStretch() instead. +*/ + +/*! + \fn uint QSizePolicy::verStretch() const + + Use verticalStretch() instead. +*/ + +/*! + \fn void QSizePolicy::setHorStretch(uchar stretch) + + Use setHorizontalStretch() instead. +*/ + +/*! + \fn void QSizePolicy::setVerStretch(uchar stretch) + + Use setVerticalStretch() instead. +*/ +#endif diff --git a/src/gui/kernel/qsound.cpp b/src/gui/kernel/qsound.cpp index 4e58c3a..7a16acf 100644 --- a/src/gui/kernel/qsound.cpp +++ b/src/gui/kernel/qsound.cpp @@ -106,7 +106,7 @@ public: \brief The QSound class provides access to the platform audio facilities. \ingroup multimedia - \mainclass + Qt provides the most commonly required audio operation in GUI applications: asynchronously playing a sound file. This is most diff --git a/src/gui/kernel/qstackedlayout.cpp b/src/gui/kernel/qstackedlayout.cpp index 4025b73..c7e25b0 100644 --- a/src/gui/kernel/qstackedlayout.cpp +++ b/src/gui/kernel/qstackedlayout.cpp @@ -65,8 +65,6 @@ public: only one widget is visible at a time. \ingroup geomanagement - \ingroup appearance - \mainclass QStackedLayout can be used to create a user interface similar to the one provided by QTabWidget. There is also a convenience diff --git a/src/gui/kernel/qtooltip.cpp b/src/gui/kernel/qtooltip.cpp index 3ea9cb4..8193c55 100644 --- a/src/gui/kernel/qtooltip.cpp +++ b/src/gui/kernel/qtooltip.cpp @@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE widget. \ingroup helpsystem - \mainclass + The tip is a short piece of text reminding the user of the widget's function. It is drawn immediately below the given diff --git a/src/gui/kernel/qwhatsthis.cpp b/src/gui/kernel/qwhatsthis.cpp index 5a37801..6d0bc33 100644 --- a/src/gui/kernel/qwhatsthis.cpp +++ b/src/gui/kernel/qwhatsthis.cpp @@ -78,7 +78,7 @@ QT_BEGIN_NAMESPACE widget, i.e. answering the question "What's This?". \ingroup helpsystem - \mainclass + "What's This?" help is part of an application's online help system, and provides users with information about the diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 633e8bf..4de08fd 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -460,7 +460,7 @@ void QWidget::setAutoFillBackground(bool enabled) \brief The QWidget class is the base class of all user interface objects. \ingroup basicwidgets - \mainclass + The widget is the atom of the user interface: it receives mouse, keyboard and other events from the window system, and paints a representation of @@ -2785,7 +2785,7 @@ void QWidget::showFullScreen() Calling this function only affects \l{isWindow()}{windows}. On X11, this function may not work properly with certain window - managers. See \l{geometry.html}{Window Geometry} for an explanation. + managers. See the \l{Window Geometry} documentation for an explanation. \sa setWindowState(), showNormal(), showMinimized(), show(), hide(), isVisible() */ @@ -2840,7 +2840,7 @@ void QWidget::showNormal() bool QWidget::isEnabledTo(QWidget* ancestor) const { const QWidget * w = this; - while (w && !w->testAttribute(Qt::WA_ForceDisabled) + while (!w->testAttribute(Qt::WA_ForceDisabled) && !w->isWindow() && w->parentWidget() && w->parentWidget() != ancestor) @@ -3134,8 +3134,8 @@ void QWidget::setDisabled(bool disable) \brief geometry of the widget relative to its parent including any window frame - See the \link geometry.html Window Geometry documentation\endlink - for an overview of geometry issues with windows. + See the \l{Window Geometry} documentation for an overview of geometry + issues with windows. By default, this property contains a value that depends on the user's platform and screen geometry. @@ -3161,8 +3161,8 @@ QRect QWidget::frameGeometry() const \brief the x coordinate of the widget relative to its parent including any window frame - See the \link geometry.html Window Geometry documentation\endlink - for an overview of window geometry. + See the \l{Window Geometry} documentation for an overview of geometry + issues with windows. By default, this property has a value of 0. @@ -3181,8 +3181,8 @@ int QWidget::x() const \brief the y coordinate of the widget relative to its parent and including any window frame - See the \link geometry.html Window Geometry documentation\endlink - for an overview of window geometry. + See the \l{Window Geometry} documentation for an overview of geometry + issues with windows. By default, this property has a value of 0. @@ -3214,8 +3214,8 @@ int QWidget::y() const \warning Calling move() or setGeometry() inside moveEvent() can lead to infinite recursion. - See the \link geometry.html Window Geometry documentation\endlink - for an overview of window geometry. + See the \l{Window Geometry} documentation for an overview of geometry + issues with windows. \sa frameGeometry, size x(), y() */ @@ -3245,8 +3245,8 @@ QPoint QWidget::pos() const \warning Calling setGeometry() inside resizeEvent() or moveEvent() can lead to infinite recursion. - See the \link geometry.html Window Geometry documentation\endlink - for an overview of window geometry. + See the \l{Window Geometry} documentation for an overview of geometry + issues with windows. By default, this property contains a value that depends on the user's platform and screen geometry. @@ -3295,8 +3295,8 @@ QPoint QWidget::pos() const \property QWidget::width \brief the width of the widget excluding any window frame - See the \link geometry.html Window Geometry documentation\endlink - for an overview of window geometry. + See the \l{Window Geometry} documentation for an overview of geometry + issues with windows. \note Do not use this function to find the width of a screen on a \l{QDesktopWidget}{multiple screen desktop}. Read @@ -3312,8 +3312,8 @@ QPoint QWidget::pos() const \property QWidget::height \brief the height of the widget excluding any window frame - See the \link geometry.html Window Geometry documentation\endlink - for an overview of window geometry. + See the \l{Window Geometry} documentation for an overview of geometry + issues with windows. \note Do not use this function to find the height of a screen on a \l {QDesktopWidget} {multiple screen desktop}. Read @@ -3332,8 +3332,8 @@ QPoint QWidget::pos() const The rect property equals QRect(0, 0, width(), height()). - See the \link geometry.html Window Geometry documentation\endlink - for an overview of window geometry. + See the \l{Window Geometry} documentation for an overview of geometry + issues with windows. By default, this property contains a value that depends on the user's platform and screen geometry. @@ -6347,8 +6347,8 @@ void QWidget::setGeometry(const QRect &r) \snippet doc/src/snippets/code/src_gui_kernel_qwidget.cpp 11 - See the \link geometry.html Window Geometry documentation\endlink - for an overview of geometry issues with windows. + See the \l{Window Geometry} documentation for an overview of geometry + issues with windows. Use QMainWindow::saveState() to save the geometry and the state of toolbars and dock widgets. @@ -6389,8 +6389,8 @@ QByteArray QWidget::saveGeometry() const \snippet doc/src/snippets/code/src_gui_kernel_qwidget.cpp 12 - See the \link geometry.html Window Geometry documentation\endlink - for an overview of geometry issues with windows. + See the \l{Window Geometry} documentation for an overview of geometry + issues with windows. Use QMainWindow::restoreState() to restore the geometry and the state of toolbars and dock widgets. @@ -7358,8 +7358,7 @@ bool QWidget::isVisibleTo(QWidget* ancestor) const if (!ancestor) return isVisible(); const QWidget * w = this; - while (w - && !w->isHidden() + while (!w->isHidden() && !w->isWindow() && w->parentWidget() && w->parentWidget() != ancestor) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 0a21af7..fbb05c4 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -72,7 +72,6 @@ ** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ** ****************************************************************************/ -//#define QT_RASTER_PAINTENGINE #include <private/qt_mac_p.h> #include <private/qeventdispatcher_mac_p.h> @@ -88,9 +87,6 @@ #include "qlayout.h" #include "qmenubar.h" #include <private/qbackingstore_p.h> -#ifdef QT_RASTER_PAINTENGINE -# include <private/qpaintengine_raster_p.h> -#endif #include <private/qwindowsurface_mac_p.h> #include <private/qpaintengine_mac_p.h> #include "qpainter.h" @@ -1220,11 +1216,6 @@ OSStatus QWidgetPrivate::qt_widget_event(EventHandlerCallRef er, EventRef event, QApplication::sendSpontaneousEvent(widget, &e); if (!redirectionOffset.isNull()) widget->d_func()->restoreRedirected(); -#ifdef QT_RASTER_PAINTENGINE - if(engine && engine->type() == QPaintEngine::Raster) - static_cast<QRasterPaintEngine*>(engine)->flush(widget, - qrgn.boundingRect().topLeft()); -#endif //cleanup if (engine) @@ -3105,7 +3096,7 @@ void QWidgetPrivate::update_sys(const QRegion &rgn) dirtyOnWidget += rgn; #ifndef QT_MAC_USE_COCOA RgnHandle rgnHandle = rgn.toQDRgnForUpdate_sys(); - if (rgnHandle) + if (rgnHandle) HIViewSetNeedsDisplayInRegion(qt_mac_nativeview_for(q), QMacSmartQuickDrawRegion(rgnHandle), true); else { HIViewSetNeedsDisplay(qt_mac_nativeview_for(q), true); // do a complete repaint on overflow. @@ -3201,10 +3192,13 @@ void QWidgetPrivate::show_sys() #else // sync the opacity value back (in case of a fade). [window setAlphaValue:q->windowOpacity()]; - [window makeKeyAndOrderFront:window]; + + // If this window is app modal, we need to start spinning + // a modal session for it. Interrupting + // the event dispatcher will make this happend: if (data.window_modality == Qt::ApplicationModal) - QCoreApplication::postEvent(qApp, new QEvent(QEvent::CocoaRequestModal)); + QEventDispatcherMac::instance()->interrupt(); #endif if (q->windowType() == Qt::Popup) { if (q->focusWidget()) @@ -3222,13 +3216,6 @@ void QWidgetPrivate::show_sys() #endif } else if (!q->testAttribute(Qt::WA_ShowWithoutActivating)) { qt_event_request_activate(q); -#ifdef QT_MAC_USE_COCOA - if (q->windowModality() == Qt::ApplicationModal) { - // We call 'activeModalSession' early to force creation of q's modal - // session. This seems neccessary for child dialogs to pop to front: - QEventDispatcherMacPrivate::activeModalSession(); - } -#endif } } else if(topData()->embedded || !q->parentWidget() || q->parentWidget()->isVisible()) { #ifndef QT_MAC_USE_COCOA @@ -4563,21 +4550,6 @@ Q_GLOBAL_STATIC(QPaintEngineCleanupHandler, engineHandler) QPaintEngine *QWidget::paintEngine() const { QPaintEngine *&pe = engineHandler()->engine; -#ifdef QT_RASTER_PAINTENGINE - if (!pe) { - if(qgetenv("QT_MAC_USE_COREGRAPHICS").isNull()) - pe = new QRasterPaintEngine(); - else - pe = new QCoreGraphicsPaintEngine(); - } - if (pe->isActive()) { - QPaintEngine *engine = - qgetenv("QT_MAC_USE_COREGRAPHICS").isNull() - ? (QPaintEngine*)new QRasterPaintEngine() : (QPaintEngine*)new QCoreGraphicsPaintEngine(); - engine->setAutoDestruct(true); - return engine; - } -#else if (!pe) pe = new QCoreGraphicsPaintEngine(); if (pe->isActive()) { @@ -4585,7 +4557,6 @@ QPaintEngine *QWidget::paintEngine() const engine->setAutoDestruct(true); return engine; } -#endif return pe; } diff --git a/src/gui/kernel/qwidgetaction.cpp b/src/gui/kernel/qwidgetaction.cpp index 911d332..a397e39 100644 --- a/src/gui/kernel/qwidgetaction.cpp +++ b/src/gui/kernel/qwidgetaction.cpp @@ -54,6 +54,8 @@ QT_BEGIN_NAMESPACE for inserting custom widgets into action based containers, such as toolbars. + \ingroup mainwindow-classes + Most actions in an application are represented as items in menus or buttons in toolbars. However sometimes more complex widgets are necessary. For example a zoom action in a word processor may be @@ -100,9 +102,6 @@ QT_BEGIN_NAMESPACE DirectConnection. \endlist - \ingroup application - \mainclass - \sa QAction, QActionGroup, QWidget */ diff --git a/src/gui/kernel/qx11info_x11.cpp b/src/gui/kernel/qx11info_x11.cpp index 786d48d..136f7f8 100644 --- a/src/gui/kernel/qx11info_x11.cpp +++ b/src/gui/kernel/qx11info_x11.cpp @@ -179,6 +179,7 @@ QX11InfoData* QX11Info::getX11Data(bool def) const QX11InfoData* res = 0; if (def) { res = new QX11InfoData; + res->ref = 0; res->screen = appScreen(); res->depth = appDepth(); res->cells = appCells(); @@ -189,8 +190,8 @@ QX11InfoData* QX11Info::getX11Data(bool def) const } else if (x11data) { res = new QX11InfoData; *res = *x11data; + res->ref = 0; } - res->ref = 0; return res; } diff --git a/src/gui/kernel/x11.pri b/src/gui/kernel/x11.pri index ac40f69..82de1b6 100644 --- a/src/gui/kernel/x11.pri +++ b/src/gui/kernel/x11.pri @@ -1,4 +1,4 @@ x11 { - contains(QT_CONFIG, nas): LIBS += -laudio -lXt + contains(QT_CONFIG, nas): LIBS_PRIVATE += -laudio -lXt } diff --git a/src/gui/math3d/qgenericmatrix.cpp b/src/gui/math3d/qgenericmatrix.cpp index 271571c..1c924c7 100644 --- a/src/gui/math3d/qgenericmatrix.cpp +++ b/src/gui/math3d/qgenericmatrix.cpp @@ -47,6 +47,8 @@ QT_BEGIN_NAMESPACE \class QGenericMatrix \brief The QGenericMatrix class is a template class that represents a NxM transformation matrix with N columns and M rows. \since 4.6 + \ingroup painting + \ingroup painting-3D The QGenericMatrix template has four parameters: diff --git a/src/gui/math3d/qmatrix4x4.cpp b/src/gui/math3d/qmatrix4x4.cpp index a67a832..8fc439b 100644 --- a/src/gui/math3d/qmatrix4x4.cpp +++ b/src/gui/math3d/qmatrix4x4.cpp @@ -52,6 +52,7 @@ QT_BEGIN_NAMESPACE \class QMatrix4x4 \brief The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space. \since 4.6 + \ingroup painting-3D \sa QVector3D, QGenericMatrix */ @@ -1009,11 +1010,24 @@ QMatrix4x4& QMatrix4x4::rotate(qreal angle, const QVector3D& vector) */ QMatrix4x4& QMatrix4x4::rotate(qreal angle, qreal x, qreal y, qreal z) { + if (angle == 0.0f) + return *this; QMatrix4x4 m(1); // The "1" says to not load the identity. - qreal a = angle * M_PI / 180.0f; - qreal c = qCos(a); - qreal s = qSin(a); - qreal ic; + qreal c, s, ic; + if (angle == 90.0f || angle == -270.0f) { + s = 1.0f; + c = 0.0f; + } else if (angle == -90.0f || angle == 270.0f) { + s = -1.0f; + c = 0.0f; + } else if (angle == 180.0f || angle == -180.0f) { + s = 0.0f; + c = -1.0f; + } else { + qreal a = angle * M_PI / 180.0f; + c = qCos(a); + s = qSin(a); + } bool quick = false; if (x == 0.0f) { if (y == 0.0f) { diff --git a/src/gui/math3d/qquaternion.cpp b/src/gui/math3d/qquaternion.cpp index 9e56966..b2c598f 100644 --- a/src/gui/math3d/qquaternion.cpp +++ b/src/gui/math3d/qquaternion.cpp @@ -51,6 +51,7 @@ QT_BEGIN_NAMESPACE \class QQuaternion \brief The QQuaternion class represents a quaternion consisting of a vector and scalar. \since 4.6 + \ingroup painting-3D Quaternions are used to represent rotations in 3D space, and consist of a 3D rotation axis specified by the x, y, and z diff --git a/src/gui/math3d/qvector2d.cpp b/src/gui/math3d/qvector2d.cpp index f7fef6c..1662020 100644 --- a/src/gui/math3d/qvector2d.cpp +++ b/src/gui/math3d/qvector2d.cpp @@ -53,6 +53,8 @@ QT_BEGIN_NAMESPACE \class QVector2D \brief The QVector2D class represents a vector or vertex in 2D space. \since 4.6 + \ingroup painting + \ingroup painting-3D The QVector2D class can also be used to represent vertices in 2D space. We therefore do not need to provide a separate vertex class. diff --git a/src/gui/math3d/qvector3d.cpp b/src/gui/math3d/qvector3d.cpp index 2915d3a..0e3f4e1 100644 --- a/src/gui/math3d/qvector3d.cpp +++ b/src/gui/math3d/qvector3d.cpp @@ -53,6 +53,7 @@ QT_BEGIN_NAMESPACE \class QVector3D \brief The QVector3D class represents a vector or vertex in 3D space. \since 4.6 + \ingroup painting-3D Vectors are one of the main building blocks of 3D representation and drawing. They consist of three coordinates, traditionally called diff --git a/src/gui/math3d/qvector4d.cpp b/src/gui/math3d/qvector4d.cpp index dd64103..a2efff7 100644 --- a/src/gui/math3d/qvector4d.cpp +++ b/src/gui/math3d/qvector4d.cpp @@ -53,6 +53,7 @@ QT_BEGIN_NAMESPACE \class QVector4D \brief The QVector4D class represents a vector or vertex in 4D space. \since 4.6 + \ingroup painting-3D The QVector4D class can also be used to represent vertices in 4D space. We therefore do not need to provide a separate vertex class. diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 2f5b2d6..feef15a 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -46,7 +46,7 @@ HEADERS += \ SOURCES += \ painting/qbezier.cpp \ - painting/qblendfunctions.cpp \ + painting/qblendfunctions.cpp \ painting/qbrush.cpp \ painting/qcolor.cpp \ painting/qcolor_p.cpp \ @@ -57,6 +57,7 @@ SOURCES += \ painting/qmatrix.cpp \ painting/qmemrotate.cpp \ painting/qoutlinemapper.cpp \ + painting/qpaintdevice.cpp \ painting/qpaintengine.cpp \ painting/qpaintengine_alpha.cpp \ painting/qpaintengine_preview.cpp \ @@ -75,14 +76,10 @@ SOURCES += \ painting/qstroker.cpp \ painting/qstylepainter.cpp \ painting/qtessellator.cpp \ - painting/qwindowsurface.cpp \ painting/qtextureglyphcache.cpp \ painting/qtransform.cpp \ + painting/qwindowsurface.cpp \ - DEFINES += QT_RASTER_IMAGEENGINE - win32:DEFINES += QT_RASTER_PAINTENGINE - embedded:DEFINES += QT_RASTER_PAINTENGINE - symbian:DEFINES += QT_RASTER_PAINTENGINE SOURCES += \ painting/qpaintengine_raster.cpp \ painting/qdrawhelper.cpp \ @@ -179,7 +176,6 @@ embedded { symbian { SOURCES += \ - painting/qpaintdevice_s60.cpp \ painting/qregion_s60.cpp \ painting/qcolormap_s60.cpp } @@ -361,6 +357,7 @@ embedded { } + symbian { HEADERS += painting/qwindowsurface_s60_p.h SOURCES += painting/qwindowsurface_s60.cpp @@ -376,3 +373,10 @@ symbian { QMAKE_CXXFLAGS.ARMCC *= -O3 } +contains(QT_CONFIG, zlib) { + INCLUDEPATH += ../3rdparty/zlib +} else:!contains(QT_CONFIG, no-zlib) { + unix:LIBS_PRIVATE += -lz +# win32:LIBS += libz.lib +} + diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp index 1121c0e..e447301 100644 --- a/src/gui/painting/qblendfunctions.cpp +++ b/src/gui/painting/qblendfunctions.cpp @@ -793,8 +793,351 @@ void qt_scale_image_argb32_on_argb32(uchar *destPixels, int dbpl, } } +struct QTransformImageVertex +{ + qreal x, y, u, v; // destination coordinates (x, y) and source coordinates (u, v) +}; + +template <class SrcT, class DestT, class Blender> +void qt_transform_image_rasterize(DestT *destPixels, int dbpl, + const SrcT *srcPixels, int sbpl, + const QTransformImageVertex &topLeft, const QTransformImageVertex &bottomLeft, + const QTransformImageVertex &topRight, const QTransformImageVertex &bottomRight, + const QRect &sourceRect, + const QRect &clip, + qreal topY, qreal bottomY, + int dudx, int dvdx, int dudy, int dvdy, int u0, int v0, + Blender blender) +{ + int fromY = qMax(qRound(topY), clip.top()); + int toY = qMin(qRound(bottomY), clip.top() + clip.height()); + if (fromY >= toY) + return; + + qreal leftSlope = (bottomLeft.x - topLeft.x) / (bottomLeft.y - topLeft.y); + qreal rightSlope = (bottomRight.x - topRight.x) / (bottomRight.y - topRight.y); + int dx_l = int(leftSlope * 0x10000); + int dx_r = int(rightSlope * 0x10000); + int x_l = int((topLeft.x + (0.5 + fromY - topLeft.y) * leftSlope + 0.5) * 0x10000); + int x_r = int((topRight.x + (0.5 + fromY - topRight.y) * rightSlope + 0.5) * 0x10000); + + int fromX, toX, x1, x2, u, v, i, ii; + DestT *line; + for (int y = fromY; y < toY; ++y) { + line = reinterpret_cast<DestT *>(reinterpret_cast<uchar *>(destPixels) + y * dbpl); + + fromX = qMax(x_l >> 16, clip.left()); + toX = qMin(x_r >> 16, clip.left() + clip.width()); + if (fromX < toX) { + // Because of rounding, we can get source coordinates outside the source image. + // Clamp these coordinates to the source rect to avoid segmentation fault and + // garbage on the screen. + + // Find the first pixel on the current scan line where the source coordinates are within the source rect. + x1 = fromX; + u = x1 * dudx + y * dudy + u0; + v = x1 * dvdx + y * dvdy + v0; + for (; x1 < toX; ++x1) { + int uu = u >> 16; + int vv = v >> 16; + if (uu >= sourceRect.left() && uu < sourceRect.left() + sourceRect.width() + && vv >= sourceRect.top() && vv < sourceRect.top() + sourceRect.height()) { + break; + } + u += dudx; + v += dvdx; + } + + // Find the last pixel on the current scan line where the source coordinates are within the source rect. + x2 = toX; + u = (x2 - 1) * dudx + y * dudy + u0; + v = (x2 - 1) * dvdx + y * dvdy + v0; + for (; x2 > x1; --x2) { + int uu = u >> 16; + int vv = v >> 16; + if (uu >= sourceRect.left() && uu < sourceRect.left() + sourceRect.width() + && vv >= sourceRect.top() && vv < sourceRect.top() + sourceRect.height()) { + break; + } + u -= dudx; + v -= dvdx; + } + + // Set up values at the beginning of the scan line. + u = fromX * dudx + y * dudy + u0; + v = fromX * dvdx + y * dvdy + v0; + line += fromX; + + // Beginning of the scan line, with per-pixel checks. + i = x1 - fromX; + while (i) { + int uu = qBound(sourceRect.left(), u >> 16, sourceRect.left() + sourceRect.width() - 1); + int vv = qBound(sourceRect.top(), v >> 16, sourceRect.top() + sourceRect.height() - 1); + blender.write(line, reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + vv * sbpl)[uu]); + u += dudx; + v += dvdx; + ++line; + --i; + } + + // Middle of the scan line, without checks. + // Manual loop unrolling. + i = x2 - x1; + ii = i >> 3; + while (ii) { + blender.write(&line[0], reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx; + blender.write(&line[1], reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx; + blender.write(&line[2], reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx; + blender.write(&line[3], reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx; + blender.write(&line[4], reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx; + blender.write(&line[5], reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx; + blender.write(&line[6], reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx; + blender.write(&line[7], reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx; + line += 8; + --ii; + } + switch (i & 7) { + case 7: blender.write(line, reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx; ++line; + case 6: blender.write(line, reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx; ++line; + case 5: blender.write(line, reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx; ++line; + case 4: blender.write(line, reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx; ++line; + case 3: blender.write(line, reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx; ++line; + case 2: blender.write(line, reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx; ++line; + case 1: blender.write(line, reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + (v >> 16) * sbpl)[u >> 16]); u += dudx; v += dvdx; ++line; + } + + // End of the scan line, with per-pixel checks. + i = toX - x2; + while (i) { + int uu = qBound(sourceRect.left(), u >> 16, sourceRect.left() + sourceRect.width() - 1); + int vv = qBound(sourceRect.top(), v >> 16, sourceRect.top() + sourceRect.height() - 1); + blender.write(line, reinterpret_cast<const SrcT *>(reinterpret_cast<const uchar *>(srcPixels) + vv * sbpl)[uu]); + u += dudx; + v += dvdx; + ++line; + --i; + } + } + x_l += dx_l; + x_r += dx_r; + } +} + +template <class SrcT, class DestT, class Blender> +void qt_transform_image(DestT *destPixels, int dbpl, + const SrcT *srcPixels, int sbpl, + const QRectF &targetRect, + const QRectF &sourceRect, + const QRect &clip, + const QTransform &targetRectTransform, + Blender blender) +{ + enum Corner + { + TopLeft, + TopRight, + BottomRight, + BottomLeft + }; + + // map source rectangle to destination. + QTransformImageVertex v[4]; + v[TopLeft].u = v[BottomLeft].u = sourceRect.left(); + v[TopLeft].v = v[TopRight].v = sourceRect.top(); + v[TopRight].u = v[BottomRight].u = sourceRect.right(); + v[BottomLeft].v = v[BottomRight].v = sourceRect.bottom(); + targetRectTransform.map(targetRect.left(), targetRect.top(), &v[TopLeft].x, &v[TopLeft].y); + targetRectTransform.map(targetRect.right(), targetRect.top(), &v[TopRight].x, &v[TopRight].y); + targetRectTransform.map(targetRect.left(), targetRect.bottom(), &v[BottomLeft].x, &v[BottomLeft].y); + targetRectTransform.map(targetRect.right(), targetRect.bottom(), &v[BottomRight].x, &v[BottomRight].y); + + // find topmost vertex. + int topmost = 0; + for (int i = 1; i < 4; ++i) { + if (v[i].y < v[topmost].y) + topmost = i; + } + // rearrange array such that topmost vertex is at index 0. + switch (topmost) { + case 1: + { + QTransformImageVertex t = v[0]; + for (int i = 0; i < 3; ++i) + v[i] = v[i+1]; + v[3] = t; + } + break; + case 2: + qSwap(v[0], v[2]); + qSwap(v[1], v[3]); + break; + case 3: + { + QTransformImageVertex t = v[3]; + for (int i = 3; i > 0; --i) + v[i] = v[i-1]; + v[0] = t; + } + break; + } + + // if necessary, swap vertex 1 and 3 such that 1 is to the left of 3. + qreal dx1 = v[1].x - v[0].x; + qreal dy1 = v[1].y - v[0].y; + qreal dx2 = v[3].x - v[0].x; + qreal dy2 = v[3].y - v[0].y; + if (dx1 * dy2 - dx2 * dy1 > 0) + qSwap(v[1], v[3]); + + QTransformImageVertex u = {v[1].x - v[0].x, v[1].y - v[0].y, v[1].u - v[0].u, v[1].v - v[0].v}; + QTransformImageVertex w = {v[2].x - v[0].x, v[2].y - v[0].y, v[2].u - v[0].u, v[2].v - v[0].v}; + + qreal det = u.x * w.y - u.y * w.x; + if (det == 0) + return; + + qreal invDet = 1.0 / det; + qreal m11, m12, m21, m22, mdx, mdy; + + m11 = (u.u * w.y - u.y * w.u) * invDet; + m12 = (u.x * w.u - u.u * w.x) * invDet; + m21 = (u.v * w.y - u.y * w.v) * invDet; + m22 = (u.x * w.v - u.v * w.x) * invDet; + mdx = v[0].u - m11 * v[0].x - m12 * v[0].y; + mdy = v[0].v - m21 * v[0].x - m22 * v[0].y; + + int dudx = int(m11 * 0x10000); + int dvdx = int(m21 * 0x10000); + int dudy = int(m12 * 0x10000); + int dvdy = int(m22 * 0x10000); + int u0 = qCeil((0.5 * m11 + 0.5 * m12 + mdx) * 0x10000) - 1; + int v0 = qCeil((0.5 * m21 + 0.5 * m22 + mdy) * 0x10000) - 1; + + int x1 = qFloor(sourceRect.left()); + int y1 = qFloor(sourceRect.top()); + int x2 = qCeil(sourceRect.right()); + int y2 = qCeil(sourceRect.bottom()); + QRect sourceRectI(x1, y1, x2 - x1, y2 - y1); + + // rasterize trapezoids. + if (v[1].y < v[3].y) { + qt_transform_image_rasterize(destPixels, dbpl, srcPixels, sbpl, v[0], v[1], v[0], v[3], sourceRectI, clip, v[0].y, v[1].y, dudx, dvdx, dudy, dvdy, u0, v0, blender); + qt_transform_image_rasterize(destPixels, dbpl, srcPixels, sbpl, v[1], v[2], v[0], v[3], sourceRectI, clip, v[1].y, v[3].y, dudx, dvdx, dudy, dvdy, u0, v0, blender); + qt_transform_image_rasterize(destPixels, dbpl, srcPixels, sbpl, v[1], v[2], v[3], v[2], sourceRectI, clip, v[3].y, v[2].y, dudx, dvdx, dudy, dvdy, u0, v0, blender); + } else { + qt_transform_image_rasterize(destPixels, dbpl, srcPixels, sbpl, v[0], v[1], v[0], v[3], sourceRectI, clip, v[0].y, v[3].y, dudx, dvdx, dudy, dvdy, u0, v0, blender); + qt_transform_image_rasterize(destPixels, dbpl, srcPixels, sbpl, v[0], v[1], v[3], v[2], sourceRectI, clip, v[3].y, v[1].y, dudx, dvdx, dudy, dvdy, u0, v0, blender); + qt_transform_image_rasterize(destPixels, dbpl, srcPixels, sbpl, v[1], v[2], v[3], v[2], sourceRectI, clip, v[1].y, v[2].y, dudx, dvdx, dudy, dvdy, u0, v0, blender); + } +} + +void qt_transform_image_rgb16_on_rgb16(uchar *destPixels, int dbpl, + const uchar *srcPixels, int sbpl, + const QRectF &targetRect, + const QRectF &sourceRect, + const QRect &clip, + const QTransform &targetRectTransform, + int const_alpha) +{ + if (const_alpha == 256) { + Blend_RGB16_on_RGB16_NoAlpha noAlpha; + qt_transform_image(reinterpret_cast<quint16 *>(destPixels), dbpl, + reinterpret_cast<const quint16 *>(srcPixels), sbpl, + targetRect, sourceRect, clip, targetRectTransform, noAlpha); + } else { + Blend_RGB16_on_RGB16_ConstAlpha constAlpha(const_alpha); + qt_transform_image(reinterpret_cast<quint16 *>(destPixels), dbpl, + reinterpret_cast<const quint16 *>(srcPixels), sbpl, + targetRect, sourceRect, clip, targetRectTransform, constAlpha); + } +} + +void qt_transform_image_argb24_on_rgb16(uchar *destPixels, int dbpl, + const uchar *srcPixels, int sbpl, + const QRectF &targetRect, + const QRectF &sourceRect, + const QRect &clip, + const QTransform &targetRectTransform, + int const_alpha) +{ + if (const_alpha == 256) { + Blend_ARGB24_on_RGB16_SourceAlpha noAlpha; + qt_transform_image(reinterpret_cast<quint16 *>(destPixels), dbpl, + reinterpret_cast<const qargb8565 *>(srcPixels), sbpl, + targetRect, sourceRect, clip, targetRectTransform, noAlpha); + } else { + Blend_ARGB24_on_RGB16_SourceAndConstAlpha constAlpha(const_alpha); + qt_transform_image(reinterpret_cast<quint16 *>(destPixels), dbpl, + reinterpret_cast<const qargb8565 *>(srcPixels), sbpl, + targetRect, sourceRect, clip, targetRectTransform, constAlpha); + } +} +void qt_transform_image_argb32_on_rgb16(uchar *destPixels, int dbpl, + const uchar *srcPixels, int sbpl, + const QRectF &targetRect, + const QRectF &sourceRect, + const QRect &clip, + const QTransform &targetRectTransform, + int const_alpha) +{ + if (const_alpha == 256) { + Blend_ARGB32_on_RGB16_SourceAlpha noAlpha; + qt_transform_image(reinterpret_cast<quint16 *>(destPixels), dbpl, + reinterpret_cast<const quint32 *>(srcPixels), sbpl, + targetRect, sourceRect, clip, targetRectTransform, noAlpha); + } else { + Blend_ARGB32_on_RGB16_SourceAndConstAlpha constAlpha(const_alpha); + qt_transform_image(reinterpret_cast<quint16 *>(destPixels), dbpl, + reinterpret_cast<const quint32 *>(srcPixels), sbpl, + targetRect, sourceRect, clip, targetRectTransform, constAlpha); + } +} + + +void qt_transform_image_rgb32_on_rgb32(uchar *destPixels, int dbpl, + const uchar *srcPixels, int sbpl, + const QRectF &targetRect, + const QRectF &sourceRect, + const QRect &clip, + const QTransform &targetRectTransform, + int const_alpha) +{ + if (const_alpha == 256) { + Blend_RGB32_on_RGB32_NoAlpha noAlpha; + qt_transform_image(reinterpret_cast<quint32 *>(destPixels), dbpl, + reinterpret_cast<const quint32 *>(srcPixels), sbpl, + targetRect, sourceRect, clip, targetRectTransform, noAlpha); + } else { + Blend_RGB32_on_RGB32_ConstAlpha constAlpha(const_alpha); + qt_transform_image(reinterpret_cast<quint32 *>(destPixels), dbpl, + reinterpret_cast<const quint32 *>(srcPixels), sbpl, + targetRect, sourceRect, clip, targetRectTransform, constAlpha); + } +} + +void qt_transform_image_argb32_on_argb32(uchar *destPixels, int dbpl, + const uchar *srcPixels, int sbpl, + const QRectF &targetRect, + const QRectF &sourceRect, + const QRect &clip, + const QTransform &targetRectTransform, + int const_alpha) +{ + if (const_alpha == 256) { + Blend_ARGB32_on_ARGB32_SourceAlpha sourceAlpha; + qt_transform_image(reinterpret_cast<quint32 *>(destPixels), dbpl, + reinterpret_cast<const quint32 *>(srcPixels), sbpl, + targetRect, sourceRect, clip, targetRectTransform, sourceAlpha); + } else { + Blend_ARGB32_on_ARGB32_SourceAndConstAlpha constAlpha(const_alpha); + qt_transform_image(reinterpret_cast<quint32 *>(destPixels), dbpl, + reinterpret_cast<const quint32 *>(srcPixels), sbpl, + targetRect, sourceRect, clip, targetRectTransform, constAlpha); + } +} + SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = { { // Format_Invalid 0, // Format_Invalid, @@ -1378,5 +1721,295 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = } }; +SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFormats] = { + { // Format_Invalid + 0, // Format_Invalid, + 0, // Format_Mono, + 0, // Format_MonoLSB, + 0, // Format_Indexed8, + 0, // Format_RGB32, + 0, // Format_ARGB32, + 0, // Format_ARGB32_Premultiplied, + 0, // Format_RGB16, + 0, // Format_ARGB8565_Premultiplied, + 0, // Format_RGB666, + 0, // Format_ARGB6666_Premultiplied, + 0, // Format_RGB555, + 0, // Format_ARGB8555_Premultiplied, + 0, // Format_RGB888, + 0, // Format_RGB444, + 0 // Format_ARGB4444_Premultiplied, + }, + { // Format_Mono + 0, // Format_Invalid, + 0, // Format_Mono, + 0, // Format_MonoLSB, + 0, // Format_Indexed8, + 0, // Format_RGB32, + 0, // Format_ARGB32, + 0, // Format_ARGB32_Premultiplied, + 0, // Format_RGB16, + 0, // Format_ARGB8565_Premultiplied, + 0, // Format_RGB666, + 0, // Format_ARGB6666_Premultiplied, + 0, // Format_RGB555, + 0, // Format_ARGB8555_Premultiplied, + 0, // Format_RGB888, + 0, // Format_RGB444, + 0 // Format_ARGB4444_Premultiplied, + }, + { // Format_MonoLSB + 0, // Format_Invalid, + 0, // Format_Mono, + 0, // Format_MonoLSB, + 0, // Format_Indexed8, + 0, // Format_RGB32, + 0, // Format_ARGB32, + 0, // Format_ARGB32_Premultiplied, + 0, // Format_RGB16, + 0, // Format_ARGB8565_Premultiplied, + 0, // Format_RGB666, + 0, // Format_ARGB6666_Premultiplied, + 0, // Format_RGB555, + 0, // Format_ARGB8555_Premultiplied, + 0, // Format_RGB888, + 0, // Format_RGB444, + 0 // Format_ARGB4444_Premultiplied, + }, + { // Format_Indexed8 + 0, // Format_Invalid, + 0, // Format_Mono, + 0, // Format_MonoLSB, + 0, // Format_Indexed8, + 0, // Format_RGB32, + 0, // Format_ARGB32, + 0, // Format_ARGB32_Premultiplied, + 0, // Format_RGB16, + 0, // Format_ARGB8565_Premultiplied, + 0, // Format_RGB666, + 0, // Format_ARGB6666_Premultiplied, + 0, // Format_RGB555, + 0, // Format_ARGB8555_Premultiplied, + 0, // Format_RGB888, + 0, // Format_RGB444, + 0 // Format_ARGB4444_Premultiplied, + }, + { // Format_RGB32 + 0, // Format_Invalid, + 0, // Format_Mono, + 0, // Format_MonoLSB, + 0, // Format_Indexed8, + qt_transform_image_rgb32_on_rgb32, // Format_RGB32, + 0, // Format_ARGB32, + qt_transform_image_argb32_on_argb32, // Format_ARGB32_Premultiplied, + 0, // Format_RGB16, + 0, // Format_ARGB8565_Premultiplied, + 0, // Format_RGB666, + 0, // Format_ARGB6666_Premultiplied, + 0, // Format_RGB555, + 0, // Format_ARGB8555_Premultiplied, + 0, // Format_RGB888, + 0, // Format_RGB444, + 0 // Format_ARGB4444_Premultiplied, + }, + { // Format_ARGB32 + 0, // Format_Invalid, + 0, // Format_Mono, + 0, // Format_MonoLSB, + 0, // Format_Indexed8, + 0, // Format_RGB32, + 0, // Format_ARGB32, + 0, // Format_ARGB32_Premultiplied, + 0, // Format_RGB16, + 0, // Format_ARGB8565_Premultiplied, + 0, // Format_RGB666, + 0, // Format_ARGB6666_Premultiplied, + 0, // Format_RGB555, + 0, // Format_ARGB8555_Premultiplied, + 0, // Format_RGB888, + 0, // Format_RGB444, + 0 // Format_ARGB4444_Premultiplied, + }, + { // Format_ARGB32_Premultiplied + 0, // Format_Invalid, + 0, // Format_Mono, + 0, // Format_MonoLSB, + 0, // Format_Indexed8, + qt_transform_image_rgb32_on_rgb32, // Format_RGB32, + 0, // Format_ARGB32, + qt_transform_image_argb32_on_argb32, // Format_ARGB32_Premultiplied, + 0, // Format_RGB16, + 0, // Format_ARGB8565_Premultiplied, + 0, // Format_RGB666, + 0, // Format_ARGB6666_Premultiplied, + 0, // Format_RGB555, + 0, // Format_ARGB8555_Premultiplied, + 0, // Format_RGB888, + 0, // Format_RGB444, + 0 // Format_ARGB4444_Premultiplied, + }, + { // Format_RGB16 + 0, // Format_Invalid, + 0, // Format_Mono, + 0, // Format_MonoLSB, + 0, // Format_Indexed8, + 0, // Format_RGB32, + 0, // Format_ARGB32, + qt_transform_image_argb32_on_rgb16, // Format_ARGB32_Premultiplied, + qt_transform_image_rgb16_on_rgb16, // Format_RGB16, + qt_transform_image_argb24_on_rgb16, // Format_ARGB8565_Premultiplied, + 0, // Format_RGB666, + 0, // Format_ARGB6666_Premultiplied, + 0, // Format_RGB555, + 0, // Format_ARGB8555_Premultiplied, + 0, // Format_RGB888, + 0, // Format_RGB444, + 0 // Format_ARGB4444_Premultiplied, + }, + { // Format_ARGB8565_Premultiplied + 0, // Format_Invalid, + 0, // Format_Mono, + 0, // Format_MonoLSB, + 0, // Format_Indexed8, + 0, // Format_RGB32, + 0, // Format_ARGB32, + 0, // Format_ARGB32_Premultiplied, + 0, // Format_RGB16, + 0, // Format_ARGB8565_Premultiplied, + 0, // Format_RGB666, + 0, // Format_ARGB6666_Premultiplied, + 0, // Format_RGB555, + 0, // Format_ARGB8555_Premultiplied, + 0, // Format_RGB888, + 0, // Format_RGB444, + 0 // Format_ARGB4444_Premultiplied, + }, + { // Format_RGB666 + 0, // Format_Invalid, + 0, // Format_Mono, + 0, // Format_MonoLSB, + 0, // Format_Indexed8, + 0, // Format_RGB32, + 0, // Format_ARGB32, + 0, // Format_ARGB32_Premultiplied, + 0, // Format_RGB16, + 0, // Format_ARGB8565_Premultiplied, + 0, // Format_RGB666, + 0, // Format_ARGB6666_Premultiplied, + 0, // Format_RGB555, + 0, // Format_ARGB8555_Premultiplied, + 0, // Format_RGB888, + 0, // Format_RGB444, + 0 // Format_ARGB4444_Premultiplied, + }, + { // Format_ARGB6666_Premultiplied + 0, // Format_Invalid, + 0, // Format_Mono, + 0, // Format_MonoLSB, + 0, // Format_Indexed8, + 0, // Format_RGB32, + 0, // Format_ARGB32, + 0, // Format_ARGB32_Premultiplied, + 0, // Format_RGB16, + 0, // Format_ARGB8565_Premultiplied, + 0, // Format_RGB666, + 0, // Format_ARGB6666_Premultiplied, + 0, // Format_RGB555, + 0, // Format_ARGB8555_Premultiplied, + 0, // Format_RGB888, + 0, // Format_RGB444, + 0 // Format_ARGB4444_Premultiplied, + }, + { // Format_RGB555 + 0, // Format_Invalid, + 0, // Format_Mono, + 0, // Format_MonoLSB, + 0, // Format_Indexed8, + 0, // Format_RGB32, + 0, // Format_ARGB32, + 0, // Format_ARGB32_Premultiplied, + 0, // Format_RGB16, + 0, // Format_ARGB8565_Premultiplied, + 0, // Format_RGB666, + 0, // Format_ARGB6666_Premultiplied, + 0, // Format_RGB555, + 0, // Format_ARGB8555_Premultiplied, + 0, // Format_RGB888, + 0, // Format_RGB444, + 0 // Format_ARGB4444_Premultiplied, + }, + { // Format_ARGB8555_Premultiplied + 0, // Format_Invalid, + 0, // Format_Mono, + 0, // Format_MonoLSB, + 0, // Format_Indexed8, + 0, // Format_RGB32, + 0, // Format_ARGB32, + 0, // Format_ARGB32_Premultiplied, + 0, // Format_RGB16, + 0, // Format_ARGB8565_Premultiplied, + 0, // Format_RGB666, + 0, // Format_ARGB6666_Premultiplied, + 0, // Format_RGB555, + 0, // Format_ARGB8555_Premultiplied, + 0, // Format_RGB888, + 0, // Format_RGB444, + 0 // Format_ARGB4444_Premultiplied, + }, + { // Format_RGB888 + 0, // Format_Invalid, + 0, // Format_Mono, + 0, // Format_MonoLSB, + 0, // Format_Indexed8, + 0, // Format_RGB32, + 0, // Format_ARGB32, + 0, // Format_ARGB32_Premultiplied, + 0, // Format_RGB16, + 0, // Format_ARGB8565_Premultiplied, + 0, // Format_RGB666, + 0, // Format_ARGB6666_Premultiplied, + 0, // Format_RGB555, + 0, // Format_ARGB8555_Premultiplied, + 0, // Format_RGB888, + 0, // Format_RGB444, + 0 // Format_ARGB4444_Premultiplied, + }, + { // Format_RGB444 + 0, // Format_Invalid, + 0, // Format_Mono, + 0, // Format_MonoLSB, + 0, // Format_Indexed8, + 0, // Format_RGB32, + 0, // Format_ARGB32, + 0, // Format_ARGB32_Premultiplied, + 0, // Format_RGB16, + 0, // Format_ARGB8565_Premultiplied, + 0, // Format_RGB666, + 0, // Format_ARGB6666_Premultiplied, + 0, // Format_RGB555, + 0, // Format_ARGB8555_Premultiplied, + 0, // Format_RGB888, + 0, // Format_RGB444, + 0 // Format_ARGB4444_Premultiplied, + }, + { // Format_ARGB4444_Premultiplied + 0, // Format_Invalid, + 0, // Format_Mono, + 0, // Format_MonoLSB, + 0, // Format_Indexed8, + 0, // Format_RGB32, + 0, // Format_ARGB32, + 0, // Format_ARGB32_Premultiplied, + 0, // Format_RGB16, + 0, // Format_ARGB8565_Premultiplied, + 0, // Format_RGB666, + 0, // Format_ARGB6666_Premultiplied, + 0, // Format_RGB555, + 0, // Format_ARGB8555_Premultiplied, + 0, // Format_RGB888, + 0, // Format_RGB444, + 0 // Format_ARGB4444_Premultiplied, + } +}; QT_END_NAMESPACE diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index 1289403..b005842 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -258,7 +258,7 @@ struct QBrushDataPointerDeleter /*! \class QBrush - \ingroup multimedia + \ingroup painting \ingroup shared \brief The QBrush class defines the fill pattern of shapes drawn @@ -1164,7 +1164,7 @@ QDataStream &operator>>(QDataStream &s, QBrush &b) /*! \class QGradient - \ingroup multimedia + \ingroup painting \ingroup shared \brief The QGradient class is used in combination with QBrush to @@ -1528,7 +1528,7 @@ bool QGradient::operator==(const QGradient &gradient) /*! \class QLinearGradient - \ingroup multimedia + \ingroup painting \brief The QLinearGradient class is used in combination with QBrush to specify a linear gradient brush. @@ -1707,7 +1707,7 @@ void QLinearGradient::setFinalStop(const QPointF &stop) /*! \class QRadialGradient - \ingroup multimedia + \ingroup painting \brief The QRadialGradient class is used in combination with QBrush to specify a radial gradient brush. @@ -1964,7 +1964,7 @@ void QRadialGradient::setFocalPoint(const QPointF &focalPoint) /*! \class QConicalGradient - \ingroup multimedia + \ingroup painting \brief The QConicalGradient class is used in combination with QBrush to specify a conical gradient brush. diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp index 11a9ae7..4e93f04 100644 --- a/src/gui/painting/qcolor.cpp +++ b/src/gui/painting/qcolor.cpp @@ -66,9 +66,9 @@ QT_BEGIN_NAMESPACE \class QColor \brief The QColor class provides colors based on RGB, HSV or CMYK values. - \ingroup multimedia + \ingroup painting \ingroup appearance - \mainclass + A color is normally specified in terms of RGB (red, green, and blue) components, but it is also possible to specify it in terms diff --git a/src/gui/painting/qcolormap.qdoc b/src/gui/painting/qcolormap.qdoc new file mode 100644 index 0000000..e4a88f0 --- /dev/null +++ b/src/gui/painting/qcolormap.qdoc @@ -0,0 +1,152 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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://qt.nokia.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \class QColormap + \ingroup painting + + \brief The QColormap class maps device independent QColors to device + dependent pixel values. +*/ + +/*! \enum QColormap::Mode + + This enum describes how QColormap maps device independent RGB + values to device dependent pixel values. + + \value Direct Pixel values are derived directly from the RGB + values, also known as "True Color." + + \value Indexed Pixel values represent indexes into a vector of + available colors, i.e. QColormap uses the index of the color that + most closely matches an RGB value. + + \value Gray Similar to \c Indexed, pixel values represent a vector + of available gray tones. QColormap uses the index of the gray + tone that most closely matches the computed gray tone of an RGB + value. +*/ + +/*! + \fn QColormap QColormap::instance(int screen) + + Returns the colormap for the specified \a screen. If \a screen is + -1, this function returns the colormap for the default screen. +*/ + +/*! + \fn QColormap::QColormap(const QColormap &colormap) + + Constructs a copy of another \a colormap. +*/ + +/*! + \fn QColormap::~QColormap() + + Destroys the colormap. +*/ + +/*! + \fn int QColormap::size() const + + Returns the size of the colormap for \c Indexed and \c Gray modes; + Returns -1 for \c Direct mode. + + \sa colormap() +*/ + +/*! + \fn uint QColormap::pixel(const QColor &color) const + + Returns a device dependent pixel value for the \a color. + + \sa colorAt() +*/ + +/*! + \fn int QColormap::depth() const + + Returns the depth of the device. + + \sa size() +*/ + +/*! + \fn QColormap::Mode QColormap::mode() const + + Returns the mode of this colormap. + + \sa QColormap::Mode +*/ + +/*! + \fn const QColor QColormap::colorAt(uint pixel) const + + Returns a QColor for the \a pixel. + + \sa pixel() +*/ + +/*! + \fn const QVector<QColor> QColormap::colormap() const + + Returns a vector of colors which represents the devices colormap + for \c Indexed and \c Gray modes. This function returns an empty + vector for \c Direct mode. + + \sa size() +*/ + +/*! \fn HPALETTE QColormap::hPal() + + This function is only available on Windows. + + Returns an handle to the HPALETTE used by this colormap. If no + HPALETTE is being used, this function returns zero. +*/ + +/*! \since 4.2 + + \fn QColormap &QColormap::operator=(const QColormap &colormap) + + Assigns the given \a colormap to \e this color map and returns + a reference to \e this color map. +*/ diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index 942b088..0607867 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -146,6 +146,14 @@ typedef void (*SrcOverScaleFunc)(uchar *destPixels, int dbpl, const QRect &clipRect, int const_alpha); +typedef void (*SrcOverTransformFunc)(uchar *destPixels, int dbpl, + const uchar *src, int spbl, + const QRectF &targetRect, + const QRectF &sourceRect, + const QRect &clipRect, + const QTransform &targetRectTransform, + int const_alpha); + struct DrawHelper { ProcessSpans blendColor; @@ -158,6 +166,7 @@ struct DrawHelper { extern SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats]; extern SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats]; +extern SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFormats]; extern DrawHelper qDrawHelper[QImage::NImageFormats]; diff --git a/src/gui/painting/qmatrix.cpp b/src/gui/painting/qmatrix.cpp index ce71a84..abff9bf 100644 --- a/src/gui/painting/qmatrix.cpp +++ b/src/gui/painting/qmatrix.cpp @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE coordinate system. \obsolete - \ingroup multimedia + \ingroup painting A matrix specifies how to translate, scale, shear or rotate the coordinate system, and is typically used when rendering graphics. diff --git a/src/gui/painting/qpaintdevice_s60.cpp b/src/gui/painting/qpaintdevice.cpp index 26ff37a..6477952 100644 --- a/src/gui/painting/qpaintdevice_s60.cpp +++ b/src/gui/painting/qpaintdevice.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui of the Qt Toolkit. +** This file is part of the QtGui module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -34,39 +34,33 @@ ** 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. +** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ #include "qpaintdevice.h" -#include "qpainter.h" -#include "qwidget.h" -#include "qbitmap.h" -#include "qapplication.h" -#include <private/qapplication_p.h> -#include "qprinter.h" QT_BEGIN_NAMESPACE +extern void qt_painter_removePaintDevice(QPaintDevice *); //qpainter.cpp + QPaintDevice::QPaintDevice() { painters = 0; } - QPaintDevice::~QPaintDevice() { if (paintingActive()) qWarning("QPaintDevice: Cannot destroy paint device that is being " - "painted. Be sure to QPainter::end() painters!"); + "painted"); + qt_painter_removePaintDevice(this); } + int QPaintDevice::metric(PaintDeviceMetric) const { qWarning("QPaintDevice::metrics: Device has no metric information"); return 0; } - - -QT_END_NAMESPACE diff --git a/src/gui/painting/qpaintdevice.qdoc b/src/gui/painting/qpaintdevice.qdoc new file mode 100644 index 0000000..5933484 --- /dev/null +++ b/src/gui/painting/qpaintdevice.qdoc @@ -0,0 +1,289 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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://qt.nokia.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \class QPaintDevice + \brief The QPaintDevice class is the base class of objects that + can be painted. + + \ingroup painting + + A paint device is an abstraction of a two-dimensional space that + can be drawn using a QPainter. Its default coordinate system has + its origin located at the top-left position. X increases to the + right and Y increases downwards. The unit is one pixel. + + The drawing capabilities of QPaintDevice are currently implemented + by the QWidget, QImage, QPixmap, QGLPixelBuffer, QPicture, and + QPrinter subclasses. + + To implement support for a new backend, you must derive from + QPaintDevice and reimplement the virtual paintEngine() function to + tell QPainter which paint engine should be used to draw on this + particular device. Note that you also must create a corresponding + paint engine to be able to draw on the device, i.e derive from + QPaintEngine and reimplement its virtual functions. + + \warning Qt requires that a QApplication object exists before + any paint devices can be created. Paint devices access window + system resources, and these resources are not initialized before + an application object is created. + + The QPaintDevice class provides several functions returning the + various device metrics: The depth() function returns its bit depth + (number of bit planes). The height() function returns its height + in default coordinate system units (e.g. pixels for QPixmap and + QWidget) while heightMM() returns the height of the device in + millimeters. Similiarily, the width() and widthMM() functions + return the width of the device in default coordinate system units + and in millimeters, respectively. Alternatively, the protected + metric() function can be used to retrieve the metric information + by specifying the desired PaintDeviceMetric as argument. + + The logicalDpiX() and logicalDpiY() functions return the + horizontal and vertical resolution of the device in dots per + inch. The physicalDpiX() and physicalDpiY() functions also return + the resolution of the device in dots per inch, but note that if + the logical and vertical resolution differ, the corresponding + QPaintEngine must handle the mapping. Finally, the numColors() + function returns the number of different colors available for the + paint device. + + \sa QPaintEngine, QPainter, {The Coordinate System}, {The Paint + System} +*/ + +/*! + \enum QPaintDevice::PaintDeviceMetric + + Describes the various metrics of a paint device. + + \value PdmWidth The width of the paint device in default + coordinate system units (e.g. pixels for QPixmap and QWidget). See + also width(). + + \value PdmHeight The height of the paint device in default + coordinate system units (e.g. pixels for QPixmap and QWidget). See + also height(). + + \value PdmWidthMM The width of the paint device in millimeters. See + also widthMM(). + + \value PdmHeightMM The height of the paint device in millimeters. See + also heightMM(). + + \value PdmNumColors The number of different colors available for + the paint device. See also numColors(). + + \value PdmDepth The bit depth (number of bit planes) of the paint + device. See also depth(). + + \value PdmDpiX The horizontal resolution of the device in dots per + inch. See also logicalDpiX(). + + \value PdmDpiY The vertical resolution of the device in dots per inch. See + also logicalDpiY(). + + \value PdmPhysicalDpiX The horizontal resolution of the device in + dots per inch. See also physicalDpiX(). + + \value PdmPhysicalDpiY The vertical resolution of the device in + dots per inch. See also physicalDpiY(). + + \sa metric() +*/ + +/*! + \fn QPaintDevice::QPaintDevice() + + Constructs a paint device. This constructor can be invoked only from + subclasses of QPaintDevice. +*/ + +/*! + \fn QPaintDevice::~QPaintDevice() + + Destroys the paint device and frees window system resources. +*/ + +/*! + \fn int QPaintDevice::devType() const + + \internal + + Returns the device type identifier, which is QInternal::Widget + if the device is a QWidget, QInternal::Pixmap if it's a + QPixmap, QInternal::Printer if it's a QPrinter, + QInternal::Picture if it's a QPicture, or + QInternal::UnknownDevice in other cases. +*/ + +/*! + \fn bool QPaintDevice::paintingActive() const + + Returns true if the device is currently being painted on, i.e. someone has + called QPainter::begin() but not yet called QPainter::end() for + this device; otherwise returns false. + + \sa QPainter::isActive() +*/ + +/*! + \fn QPaintEngine *QPaintDevice::paintEngine() const + + Returns a pointer to the paint engine used for drawing on the + device. +*/ + +/*! + \fn int QPaintDevice::metric(PaintDeviceMetric metric) const + + Returns the metric information for the given paint device \a metric. + + \sa PaintDeviceMetric +*/ + +/*! + \fn int QPaintDevice::width() const + + Returns the width of the paint device in default coordinate system + units (e.g. pixels for QPixmap and QWidget). + + \sa widthMM() +*/ + +/*! + \fn int QPaintDevice::height() const + + Returns the height of the paint device in default coordinate + system units (e.g. pixels for QPixmap and QWidget). + + \sa heightMM() +*/ + +/*! + \fn int QPaintDevice::widthMM() const + + Returns the width of the paint device in millimeters. Due to platform + limitations it may not be possible to use this function to determine + the actual physical size of a widget on the screen. + + \sa width() +*/ + +/*! + \fn int QPaintDevice::heightMM() const + + Returns the height of the paint device in millimeters. Due to platform + limitations it may not be possible to use this function to determine + the actual physical size of a widget on the screen. + + \sa height() +*/ + +/*! + \fn int QPaintDevice::numColors() const + + Returns the number of different colors available for the paint + device. Since this value is an int, it will not be sufficient to represent + the number of colors on 32 bit displays, in this case INT_MAX is + returned instead. +*/ + +/*! + \fn int QPaintDevice::depth() const + + Returns the bit depth (number of bit planes) of the paint device. +*/ + +/*! + \fn int QPaintDevice::logicalDpiX() const + + Returns the horizontal resolution of the device in dots per inch, + which is used when computing font sizes. For X11, this is usually + the same as could be computed from widthMM(). + + Note that if the logicalDpiX() doesn't equal the physicalDpiX(), + the corresponding QPaintEngine must handle the resolution mapping. + + \sa logicalDpiY(), physicalDpiX() +*/ + +/*! + \fn int QPaintDevice::logicalDpiY() const + + Returns the vertical resolution of the device in dots per inch, + which is used when computing font sizes. For X11, this is usually + the same as could be computed from heightMM(). + + Note that if the logicalDpiY() doesn't equal the physicalDpiY(), + the corresponding QPaintEngine must handle the resolution mapping. + + \sa logicalDpiX(), physicalDpiY() +*/ + +/*! + \fn int QPaintDevice::physicalDpiX() const + + Returns the horizontal resolution of the device in dots per inch. + For example, when printing, this resolution refers to the physical + printer's resolution. The logical DPI on the other hand, refers to + the resolution used by the actual paint engine. + + Note that if the physicalDpiX() doesn't equal the logicalDpiX(), + the corresponding QPaintEngine must handle the resolution mapping. + + \sa physicalDpiY(), logicalDpiX() +*/ + +/*! + \fn int QPaintDevice::physicalDpiY() const + + Returns the horizontal resolution of the device in dots per inch. + For example, when printing, this resolution refers to the physical + printer's resolution. The logical DPI on the other hand, refers to + the resolution used by the actual paint engine. + + Note that if the physicalDpiY() doesn't equal the logicalDpiY(), + the corresponding QPaintEngine must handle the resolution mapping. + + \sa physicalDpiX(), logicalDpiY() +*/ diff --git a/src/gui/painting/qpaintdevice_mac.cpp b/src/gui/painting/qpaintdevice_mac.cpp index bf5e261..aa7c2ac 100644 --- a/src/gui/painting/qpaintdevice_mac.cpp +++ b/src/gui/painting/qpaintdevice_mac.cpp @@ -57,34 +57,6 @@ QT_BEGIN_NAMESPACE Internal variables and functions *****************************************************************************/ - -/***************************************************************************** - External functions - *****************************************************************************/ - -extern void qt_painter_removePaintDevice(QPaintDevice *); //qpainter.cpp - -/***************************************************************************** - QPaintDevice member functions - *****************************************************************************/ -QPaintDevice::QPaintDevice() -{ - painters = 0; -} - -QPaintDevice::~QPaintDevice() -{ - if(paintingActive()) - qWarning("QPaintDevice: Cannot destroy paint device that is being " - "painted, be sure to QPainter::end() painters"); - qt_painter_removePaintDevice(this); -} - -int QPaintDevice::metric(PaintDeviceMetric) const -{ - return 0; -} - /*! \internal */ float qt_mac_defaultDpi_x() { diff --git a/src/gui/painting/qpaintdevice_qws.cpp b/src/gui/painting/qpaintdevice_qws.cpp index 9a6a3d3..b161cb8 100644 --- a/src/gui/painting/qpaintdevice_qws.cpp +++ b/src/gui/painting/qpaintdevice_qws.cpp @@ -48,39 +48,6 @@ QT_BEGIN_NAMESPACE -QPaintDevice::QPaintDevice() -{ - painters = 0; -} - -extern void qt_painter_removePaintDevice(QPaintDevice *); //qpainter.cpp - - -QPaintDevice::~QPaintDevice() -{ - if (paintingActive()) - qWarning("QPaintDevice: Cannot destroy paint device that is being " - "painted"); - qt_painter_removePaintDevice(this); -} - - -int QPaintDevice::metric(PaintDeviceMetric m) const -{ - qWarning("QPaintDevice::metrics: Device has no metric information"); - if (m == PdmDpiX) { - return 72; - } else if (m == PdmDpiY) { - return 72; - } else if (m == PdmNumColors) { - // FIXME: does this need to be a real value? - return 256; - } else { - qDebug("Unrecognised metric %d!",m); - return 0; - } -} - QWSDisplay *QPaintDevice::qwsDisplay() { return qt_fbdpy; diff --git a/src/gui/painting/qpaintdevice_win.cpp b/src/gui/painting/qpaintdevice_win.cpp index 86de028..f964feb 100644 --- a/src/gui/painting/qpaintdevice_win.cpp +++ b/src/gui/painting/qpaintdevice_win.cpp @@ -50,27 +50,6 @@ QT_BEGIN_NAMESPACE -QPaintDevice::QPaintDevice() -{ - painters = 0; -} - -extern void qt_painter_removePaintDevice(QPaintDevice *); //qpainter.cpp - -QPaintDevice::~QPaintDevice() -{ - if (paintingActive()) - qWarning("QPaintDevice: Cannot destroy paint device that is being " - "painted. Be sure to QPainter::end() painters!"); - qt_painter_removePaintDevice(this); -} - -int QPaintDevice::metric(PaintDeviceMetric) const -{ - qWarning("QPaintDevice::metrics: Device has no metric information"); - return 0; -} - HDC QPaintDevice::getDC() const { return 0; diff --git a/src/gui/painting/qpaintdevice_x11.cpp b/src/gui/painting/qpaintdevice_x11.cpp index b0ed732..474f3f1 100644 --- a/src/gui/painting/qpaintdevice_x11.cpp +++ b/src/gui/painting/qpaintdevice_x11.cpp @@ -49,21 +49,6 @@ QT_BEGIN_NAMESPACE -QPaintDevice::QPaintDevice() -{ - painters = 0; -} - -extern void qt_painter_removePaintDevice(QPaintDevice *); //qpainter.cpp - -QPaintDevice::~QPaintDevice() -{ - if (paintingActive()) - qWarning("QPaintDevice: Cannot destroy paint device that is being " - "painted"); - qt_painter_removePaintDevice(this); -} - /*! \internal Returns the X11 Drawable of the paint device. 0 is returned if it @@ -96,12 +81,6 @@ const Q_GUI_EXPORT QX11Info *qt_x11Info(const QPaintDevice *pd) return 0; } -int QPaintDevice::metric(PaintDeviceMetric) const -{ - qWarning("QPaintDevice::metrics: Device has no metric information"); - return 0; -} - #ifdef QT3_SUPPORT diff --git a/src/gui/painting/qpaintengine.cpp b/src/gui/painting/qpaintengine.cpp index a91db26..5dc0922 100644 --- a/src/gui/painting/qpaintengine.cpp +++ b/src/gui/painting/qpaintengine.cpp @@ -145,7 +145,7 @@ QFont QTextItem::font() const /*! \class QPaintEngine - \ingroup multimedia + \ingroup painting \brief The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a given platform. diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index d4e988b..ef4904f 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -1019,9 +1019,6 @@ void QRasterPaintEnginePrivate::drawImage(const QPointF &pt, if (alpha == 0 || !clip.isValid()) return; - if (alpha ==0) - return; - Q_ASSERT(img.depth() >= 8); int srcBPL = img.bytesPerLine(); @@ -2495,10 +2492,7 @@ void QRasterPaintEngine::drawImage(const QPointF &p, const QImage &img) const QClipData *clip = d->clip(); QPointF pt(p.x() + s->matrix.dx(), p.y() + s->matrix.dy()); - // ### TODO: remove this eventually... - static bool NO_BLEND_FUNC = !qgetenv("QT_NO_BLEND_FUNCTIONS").isNull(); - - if (s->flags.fast_images && !NO_BLEND_FUNC) { + if (s->flags.fast_images) { SrcOverBlendFunc func = qBlendFunctions[d->rasterBuffer->format][img.format()]; if (func) { if (!clip) { @@ -2511,6 +2505,8 @@ void QRasterPaintEngine::drawImage(const QPointF &p, const QImage &img) } } + + d->image_filler.clip = clip; d->image_filler.initTexture(&img, s->intOpacity, QTextureData::Plain, img.rect()); if (!d->image_filler.blend) @@ -2562,14 +2558,24 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe if (s->matrix.type() > QTransform::TxTranslate || stretch_sr) { if (s->flags.fast_images) { - SrcOverScaleFunc func = qScaleFunctions[d->rasterBuffer->format][img.format()]; - if (func && (!clip || clip->hasRectClip)) { - func(d->rasterBuffer->buffer(), d->rasterBuffer->bytesPerLine(), - img.bits(), img.bytesPerLine(), - qt_mapRect_non_normalizing(r, s->matrix), sr, - !clip ? d->deviceRect : clip->clipRect, - s->intOpacity); - return; + if (s->matrix.type() > QTransform::TxScale) { + SrcOverTransformFunc func = qTransformFunctions[d->rasterBuffer->format][img.format()]; + if (func && (!clip || clip->hasRectClip)) { + func(d->rasterBuffer->buffer(), d->rasterBuffer->bytesPerLine(), img.bits(), + img.bytesPerLine(), r, sr, !clip ? d->deviceRect : clip->clipRect, + s->matrix, s->intOpacity); + return; + } + } else { + SrcOverScaleFunc func = qScaleFunctions[d->rasterBuffer->format][img.format()]; + if (func && (!clip || clip->hasRectClip)) { + func(d->rasterBuffer->buffer(), d->rasterBuffer->bytesPerLine(), + img.bits(), img.bytesPerLine(), + qt_mapRect_non_normalizing(r, s->matrix), sr, + !clip ? d->deviceRect : clip->clipRect, + s->intOpacity); + return; + } } } @@ -4057,7 +4063,7 @@ void QRasterPaintEnginePrivate::recalculateFastImages() s->flags.fast_images = !(s->renderHints & QPainter::SmoothPixmapTransform) && rasterBuffer->compositionMode == QPainter::CompositionMode_SourceOver - && s->matrix.type() <= QTransform::TxScale; + && s->matrix.type() <= QTransform::TxShear; } diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index fe1fb06..0bca8f7 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -924,8 +924,8 @@ void QPainterPrivate::updateState(QPainterState *newState) \brief The QPainter class performs low-level painting on widgets and other paint devices. - \ingroup multimedia - \mainclass + \ingroup painting + \reentrant QPainter provides highly optimized functions to do most of the @@ -7501,8 +7501,8 @@ void qt_format_text(const QFont &fnt, const QRectF &_r, QFontMetricsF fm(fnt); QString text = str; int offset = 0; -start_lenghtVariant: - bool hasMoreLenghtVariants = false; +start_lengthVariant: + bool hasMoreLengthVariants = false; // compatible behaviour to the old implementation. Replace // tabs by spaces bool has_tab = false; @@ -7524,7 +7524,7 @@ start_lenghtVariant: has_tab = true; } else if (chr == QChar(ushort(0x9c))) { // string with multiple length variants - hasMoreLenghtVariants = true; + hasMoreLengthVariants = true; break; } } @@ -7648,9 +7648,9 @@ start_lenghtVariant: } QRectF bounds = QRectF(r.x() + xoff, r.y() + yoff, width, height); - if (hasMoreLenghtVariants && !(tf & Qt::TextLongestVariant) && !r.contains(bounds)) { + if (hasMoreLengthVariants && !(tf & Qt::TextLongestVariant) && !r.contains(bounds)) { offset++; - goto start_lenghtVariant; + goto start_lengthVariant; } if (brect) *brect = bounds; diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index 994217e..eb8b964 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -164,7 +164,7 @@ static void qt_debug_path(const QPainterPath &path) /*! \class QPainterPath - \ingroup multimedia + \ingroup painting \ingroup shared \brief The QPainterPath class provides a container for painting operations, @@ -2399,7 +2399,7 @@ void qt_path_stroke_cubic_to(qfixed c1x, qfixed c1y, /*! \since 4.1 \class QPainterPathStroker - \ingroup multimedia + \ingroup painting \brief The QPainterPathStroker class is used to generate fillable outlines for a given painter path. diff --git a/src/gui/painting/qpainterpath.h b/src/gui/painting/qpainterpath.h index eb1c7d3..21894a7 100644 --- a/src/gui/painting/qpainterpath.h +++ b/src/gui/painting/qpainterpath.h @@ -301,9 +301,9 @@ inline void QPainterPath::lineTo(qreal x, qreal y) lineTo(QPointF(x, y)); } -inline void QPainterPath::arcTo(qreal x, qreal y, qreal w, qreal h, qreal startAngle, qreal arcLenght) +inline void QPainterPath::arcTo(qreal x, qreal y, qreal w, qreal h, qreal startAngle, qreal arcLength) { - arcTo(QRectF(x, y, w, h), startAngle, arcLenght); + arcTo(QRectF(x, y, w, h), startAngle, arcLength); } inline void QPainterPath::arcMoveTo(qreal x, qreal y, qreal w, qreal h, qreal angle) diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index 3f5643e..478a2a8 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -313,7 +313,7 @@ QByteArray QPdf::generatePath(const QPainterPath &path, const QTransform &matrix Qt::FillRule fillRule = path.fillRule(); - const char *op = 0; + const char *op = ""; switch (flags) { case ClipPath: op = (fillRule == Qt::WindingFill) ? "W n\n" : "W* n\n"; @@ -1471,10 +1471,10 @@ void QPdfBaseEngine::setProperty(PrintEnginePropertyKey key, const QVariant &val { QList<QVariant> margins(value.toList()); Q_ASSERT(margins.size() == 4); - d->leftMargin = margins.at(0).toDouble(); - d->topMargin = margins.at(1).toDouble(); - d->rightMargin = margins.at(2).toDouble(); - d->bottomMargin = margins.at(3).toDouble(); + d->leftMargin = margins.at(0).toReal(); + d->topMargin = margins.at(1).toReal(); + d->rightMargin = margins.at(2).toReal(); + d->bottomMargin = margins.at(3).toReal(); d->hasCustomPageMargins = true; break; } @@ -1576,7 +1576,7 @@ QVariant QPdfBaseEngine::property(PrintEnginePropertyKey key) const margins << d->leftMargin << d->topMargin << d->rightMargin << d->bottomMargin; } else { - const int defaultMargin = 10; // ~3.5 mm + const qreal defaultMargin = 10; // ~3.5 mm margins << defaultMargin << defaultMargin << defaultMargin << defaultMargin; } @@ -1773,6 +1773,9 @@ bool QPdfBaseEnginePrivate::openPrintDevice() (void)execv("/bin/lpr", lprargs); (void)execv("/usr/bin/lp", lpargs); (void)execv("/usr/bin/lpr", lprargs); + + delete []lpargs; + delete []lprargs; } // if we couldn't exec anything, close the fd, // wait for a second so the parent process (the diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp index 047fd9b..51929a2 100644 --- a/src/gui/painting/qpen.cpp +++ b/src/gui/painting/qpen.cpp @@ -52,9 +52,9 @@ typedef QPenPrivate QPenData; /*! \class QPen - \ingroup multimedia + \ingroup painting \ingroup shared - \mainclass + \brief The QPen class defines how a QPainter should draw lines and outlines of shapes. diff --git a/src/gui/painting/qpolygon.cpp b/src/gui/painting/qpolygon.cpp index 87a9848..044b2c5 100644 --- a/src/gui/painting/qpolygon.cpp +++ b/src/gui/painting/qpolygon.cpp @@ -91,7 +91,7 @@ static void qt_polygon_isect_line(const QPointF &p1, const QPointF &p2, const QP \reentrant - \ingroup multimedia + \ingroup painting \ingroup shared A QPolygon object is a QVector<QPoint>. The easiest way to add @@ -489,7 +489,7 @@ QDebug operator<<(QDebug dbg, const QPolygon &a) floating point precision. \reentrant - \ingroup multimedia + \ingroup painting \ingroup shared A QPolygonF is a QVector<QPointF>. The easiest way to add points diff --git a/src/gui/painting/qprintengine_win.cpp b/src/gui/painting/qprintengine_win.cpp index 7ac3224..21c0873 100644 --- a/src/gui/painting/qprintengine_win.cpp +++ b/src/gui/painting/qprintengine_win.cpp @@ -1360,10 +1360,10 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant & Q_ASSERT(margins.size() == 4); int left, top, right, bottom; // specified in 1/100 mm - left = (margins.at(0).toDouble()*25.4/72.0) * 100; - top = (margins.at(1).toDouble()*25.4/72.0) * 100; - right = (margins.at(2).toDouble()*25.4/72.0) * 100; - bottom = (margins.at(3).toDouble()*25.4/72.0) * 100; + left = (margins.at(0).toReal()*25.4/72.0) * 100; + top = (margins.at(1).toReal()*25.4/72.0) * 100; + right = (margins.at(2).toReal()*25.4/72.0) * 100; + bottom = (margins.at(3).toReal()*25.4/72.0) * 100; d->setPageMargins(left, top, right, bottom); break; } diff --git a/src/gui/painting/qprinter.cpp b/src/gui/painting/qprinter.cpp index 326b7b0..df33034 100644 --- a/src/gui/painting/qprinter.cpp +++ b/src/gui/painting/qprinter.cpp @@ -268,8 +268,8 @@ void QPrinterPrivate::addToManualSetList(QPrintEngine::PrintEnginePropertyKey ke \brief The QPrinter class is a paint device that paints on a printer. - \ingroup multimedia - \mainclass + \ingroup printing + This device represents a series of pages of printed output, and is used in almost exactly the same way as other paint devices such as @@ -1664,10 +1664,10 @@ void QPrinter::getPageMargins(qreal *left, qreal *top, qreal *right, qreal *bott Q_ASSERT(left && top && right && bottom); const qreal multiplier = qt_multiplierForUnit(unit, resolution()); QList<QVariant> margins(d->printEngine->property(QPrintEngine::PPK_PageMargins).toList()); - *left = margins.at(0).toDouble() / multiplier; - *top = margins.at(1).toDouble() / multiplier; - *right = margins.at(2).toDouble() / multiplier; - *bottom = margins.at(3).toDouble() / multiplier; + *left = margins.at(0).toReal() / multiplier; + *top = margins.at(1).toReal() / multiplier; + *right = margins.at(2).toReal() / multiplier; + *bottom = margins.at(3).toReal() / multiplier; } /*! @@ -2203,7 +2203,7 @@ bool QPrinter::isOptionEnabled( PrinterOption option ) const \class QPrintEngine \reentrant - \ingroup multimedia + \ingroup printing \brief The QPrintEngine class defines an interface for how QPrinter interacts with a given printing subsystem. diff --git a/src/gui/painting/qprinterinfo.qdoc b/src/gui/painting/qprinterinfo.qdoc new file mode 100644 index 0000000..e3cbe96 --- /dev/null +++ b/src/gui/painting/qprinterinfo.qdoc @@ -0,0 +1,139 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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://qt.nokia.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \class QPrinterInfo + + \brief The QPrinterInfo class gives access to information about + existing printers. + + \ingroup printing + + Use the static functions to generate a list of QPrinterInfo + objects. Each QPrinterInfo object in the list represents a single + printer and can be queried for name, supported paper sizes, and + whether or not it is the default printer. + + \since 4.4 +*/ + +/*! + \fn QList<QPrinterInfo> QPrinterInfo::availablePrinters() + + Returns a list of available printers on the system. +*/ + +/*! + \fn QPrinterInfo QPrinterInfo::defaultPrinter() + + Returns the default printer on the system. + + The return value should be checked using isNull() before being + used, in case there is no default printer. + + \sa isNull() +*/ + +/*! + \fn QPrinterInfo::QPrinterInfo() + + Constructs an empty QPrinterInfo object. + + \sa isNull() +*/ + +/*! + \fn QPrinterInfo::QPrinterInfo(const QPrinterInfo& src) + + Constructs a copy of \a src. +*/ + +/*! + \fn QPrinterInfo::QPrinterInfo(const QPrinter& printer) + + Constructs a QPrinterInfo object from \a printer. +*/ + +/*! + \fn QPrinterInfo::~QPrinterInfo() + + Destroys the QPrinterInfo object. References to the values in the + object become invalid. +*/ + +/*! + \fn QPrinterInfo& QPrinterInfo::operator=(const QPrinterInfo& src) + + Sets the QPrinterInfo object to be equal to \a src. +*/ + +/*! + \fn QString QPrinterInfo::printerName() const + + Returns the name of the printer. + + \sa QPrinter::setPrinterName() +*/ + +/*! + \fn bool QPrinterInfo::isNull() const + + Returns whether this QPrinterInfo object holds a printer definition. + + An empty QPrinterInfo object could result for example from calling + defaultPrinter() when there are no printers on the system. +*/ + +/*! + \fn bool QPrinterInfo::isDefault() const + + Returns whether this printer is the default printer. +*/ + +/*! + \fn QList< QPrinter::PaperSize> QPrinterInfo::supportedPaperSizes() const + \since 4.4 + + Returns a list of supported paper sizes by the printer. + + Not all printer drivers support this query, so the list may be empty. + On Mac OS X 10.3, this function always returns an empty list. +*/ diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index dd684db..0db700a 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE \class QRegion \brief The QRegion class specifies a clip region for a painter. - \ingroup multimedia + \ingroup painting \ingroup shared QRegion is used with QPainter::setClipRegion() to limit the paint diff --git a/src/gui/painting/qstylepainter.cpp b/src/gui/painting/qstylepainter.cpp index 959caa9..93512d0 100644 --- a/src/gui/painting/qstylepainter.cpp +++ b/src/gui/painting/qstylepainter.cpp @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE elements inside a widget. \ingroup appearance - \ingroup multimedia + \ingroup painting QStylePainter extends QPainter with a set of high-level \c draw...() functions implemented on top of QStyle's API. The diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp index 8832a3d..859767b 100644 --- a/src/gui/painting/qtransform.cpp +++ b/src/gui/painting/qtransform.cpp @@ -93,7 +93,7 @@ QT_BEGIN_NAMESPACE \class QTransform \brief The QTransform class specifies 2D transformations of a coordinate system. \since 4.3 - \ingroup multimedia + \ingroup painting A transformation specifies how to translate, scale, shear, rotate or project the coordinate system, and is typically used when diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp index fa6aeb2..0a82c9c 100644 --- a/src/gui/styles/qcleanlooksstyle.cpp +++ b/src/gui/styles/qcleanlooksstyle.cpp @@ -84,14 +84,9 @@ enum Direction { // from windows style static const int windowsItemFrame = 2; // menu item frame width -static const int windowsSepHeight = 6; // separator item height static const int windowsItemHMargin = 3; // menu item hor text margin static const int windowsItemVMargin = 8; // menu item ver text margin -static const int windowsArrowHMargin = 6; // arrow horizontal margin -static const int windowsTabSpacing = 12; // space between text and tab -static const int windowsCheckMarkHMargin = 2; // horiz. margins of check mark static const int windowsRightBorder = 15; // right border on windows -static const int windowsCheckMarkWidth = 12; // checkmarks width on windows /* XPM */ static const char * const dock_widget_close_xpm[] = { diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index ff50d81..d1bed3e 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -5198,8 +5198,7 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget ret = Qt::ToolButtonIconOnly; #ifdef Q_WS_X11 { - Q_D(const QCommonStyle); - static int buttonStyle = d->lookupToolButtonStyle(); + static int buttonStyle = d_func()->lookupToolButtonStyle(); return buttonStyle; } #endif diff --git a/src/gui/styles/qmacstyle.qdoc b/src/gui/styles/qmacstyle.qdoc new file mode 100644 index 0000000..171ddb0 --- /dev/null +++ b/src/gui/styles/qmacstyle.qdoc @@ -0,0 +1,261 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** 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://qt.nokia.com/contact. +** $QT_END_LICENSE$ +** +****************************************************************************/ + + +/*! + \class QMacStyle + \brief The QMacStyle class provides a Mac OS X style using the Apple Appearance Manager. + + \ingroup appearance + + This class is implemented as a wrapper to the HITheme + APIs, allowing applications to be styled according to the current + theme in use on Mac OS X. This is done by having primitives + in QStyle implemented in terms of what Mac OS X would normally theme. + + \warning This style is only available on Mac OS X because it relies on the + HITheme APIs. + + There are additional issues that should be taken + into consideration to make an application compatible with the + \link http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/index.html + Apple Human Interface Guidelines \endlink. Some of these issues are outlined + below. + + \list + + \i Layout - The restrictions on window layout are such that some + aspects of layout that are style-dependent cannot be achieved + using QLayout. Changes are being considered (and feedback would be + appreciated) to make layouts QStyle-able. Some of the restrictions + involve horizontal and vertical widget alignment and widget size + (covered below). + + \i Widget size - Mac OS X allows widgets to have specific fixed sizes. Qt + does not fully implement this behavior so as to maintain cross-platform + compatibility. As a result some widgets sizes may be inappropriate (and + subsequently not rendered correctly by the HITheme APIs).The + QWidget::sizeHint() will return the appropriate size for many + managed widgets (widgets enumerated in \l QStyle::ContentsType). + + \i Effects - QMacStyle uses HITheme for performing most of the drawing, but + also uses emulation in a few cases where HITheme does not provide the + required functionality (for example, tab bars on Panther, the toolbar + separator, etc). We tried to make the emulation as close to the original as + possible. Please report any issues you see in effects or non-standard + widgets. + + \endlist + + There are other issues that need to be considered in the feel of + your application (including the general color scheme to match the + Aqua colors). The Guidelines mentioned above will remain current + with new advances and design suggestions for Mac OS X. + + Note that the functions provided by QMacStyle are + reimplementations of QStyle functions; see QStyle for their + documentation. + + \img qmacstyle.png + \sa QWindowsXPStyle, QWindowsStyle, QPlastiqueStyle, QCDEStyle, QMotifStyle +*/ + + +/*! + \enum QMacStyle::WidgetSizePolicy + + \value SizeSmall + \value SizeLarge + \value SizeMini + \value SizeDefault + \omitvalue SizeNone +*/ + +/*! \fn QMacStyle::QMacStyle() + Constructs a QMacStyle object. +*/ + +/*! \fn QMacStyle::~QMacStyle() + Destructs a QMacStyle object. +*/ + +/*! \fn void QMacStyle::polish(QPalette &pal) + \reimp +*/ + +/*! \fn void QMacStyle::polish(QApplication *) + \reimp +*/ + +/*! \fn void QMacStyle::unpolish(QApplication *) + \reimp +*/ + +/*! \fn void QMacStyle::polish(QWidget* w) + \reimp +*/ + +/*! \fn void QMacStyle::unpolish(QWidget* w) + \reimp +*/ + +/*! \fn int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QWidget *widget) const + \reimp +*/ + +/*! \fn QPalette QMacStyle::standardPalette() const + \reimp +*/ + +/*! \fn int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w, QStyleHintReturn *hret) const + \reimp +*/ + +/*! \fn QPixmap QMacStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const + \reimp +*/ + +/*! \fn QPixmap QMacStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget) const + \reimp +*/ + +/*! + \enum QMacStyle::FocusRectPolicy + + This type is used to signify a widget's focus rectangle policy. + + \value FocusEnabled show a focus rectangle when the widget has focus. + \value FocusDisabled never show a focus rectangle for the widget. + \value FocusDefault show a focus rectangle when the widget has + focus and the widget is a QSpinWidget, QDateTimeEdit, QLineEdit, + QListBox, QListView, editable QTextEdit, or one of their + subclasses. +*/ + +/*! \fn void QMacStyle::setFocusRectPolicy(QWidget *w, FocusRectPolicy policy) + \obsolete + Sets the focus rectangle policy of \a w. The \a policy can be one of + \l{QMacStyle::FocusRectPolicy}. + + This is now simply an interface to the Qt::WA_MacShowFocusRect attribute and the + FocusDefault value does nothing anymore. If you want to set a widget back + to its default value, you must save the old value of the attribute before + you change it. + + \sa focusRectPolicy() QWidget::setAttribute() +*/ + +/*! \fn QMacStyle::FocusRectPolicy QMacStyle::focusRectPolicy(const QWidget *w) + \obsolete + Returns the focus rectangle policy for the widget \a w. + + The focus rectangle policy can be one of \l{QMacStyle::FocusRectPolicy}. + + In 4.3 and up this function will simply test for the + Qt::WA_MacShowFocusRect attribute and will never return + QMacStyle::FocusDefault. + + \sa setFocusRectPolicy(), QWidget::testAttribute() +*/ + +/*! \fn void QMacStyle::setWidgetSizePolicy(const QWidget *widget, WidgetSizePolicy policy) + + \obsolete + + Call QWidget::setAttribute() with Qt::WA_MacMiniSize, Qt::WA_MacSmallSize, + or Qt::WA_MacNormalSize instead. +*/ + +/*! \fn QMacStyle::WidgetSizePolicy QMacStyle::widgetSizePolicy(const QWidget *widget) + \obsolete + + Call QWidget::testAttribute() with Qt::WA_MacMiniSize, Qt::WA_MacSmallSize, + or Qt::WA_MacNormalSize instead. +*/ + +/*! \fn void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w) const + + \reimp +*/ + +/*! \fn void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter *p, const QWidget *w) const + + \reimp +*/ + +/*! \fn QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt, const QWidget *widget) const + + \reimp +*/ + +/*! \fn void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, const QWidget *widget) const + \reimp +*/ + +/*! \fn QStyle::SubControl QMacStyle::hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, const QPoint &pt, const QWidget *widget) const + \reimp +*/ + +/*! \fn QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const + \reimp +*/ + +/*! \fn QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &csz, const QWidget *widget) const + \reimp +*/ + +/*! \fn void QMacStyle::drawItemText(QPainter *p, const QRect &r, int flags, const QPalette &pal, bool enabled, const QString &text, QPalette::ColorRole textRole) const + \reimp +*/ + +/*! \fn bool QMacStyle::event(QEvent *e) + \reimp +*/ + +/*! \fn QIcon QMacStyle::standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *opt, const QWidget *widget) const + \internal +*/ + +/*! \fn int QMacStyle::layoutSpacingImplementation(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option, const QWidget *widget) const + + \internal +*/ + diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index 8736769..08b6ad8 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -4635,12 +4635,12 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex // no longer possible to move it, second the up/down buttons are removed when // there is not enough space for them. if (cc == CC_ScrollBar) { - const int scrollBarLenght = (slider->orientation == Qt::Horizontal) + const int scrollBarLength = (slider->orientation == Qt::Horizontal) ? slider->rect.width() : slider->rect.height(); const QMacStyle::WidgetSizePolicy sizePolicy = widgetSizePolicy(widget); - if (scrollBarLenght < scrollButtonsCutoffSize(thumbIndicatorCutoff, sizePolicy)) + if (scrollBarLength < scrollButtonsCutoffSize(thumbIndicatorCutoff, sizePolicy)) tdi.attributes &= ~kThemeTrackShowThumb; - if (scrollBarLenght < scrollButtonsCutoffSize(scrollButtonsCutoff, sizePolicy)) + if (scrollBarLength < scrollButtonsCutoffSize(scrollButtonsCutoff, sizePolicy)) tdi.enableState = kThemeTrackNothingToScroll; } @@ -5109,9 +5109,9 @@ QStyle::SubControl QMacStyle::hitTestComplexControl(ComplexControl cc, // The arrow buttons are not drawn if the scroll bar is to short, // exclude them from the hit test. - const int scrollBarLenght = (sb->orientation == Qt::Horizontal) + const int scrollBarLength = (sb->orientation == Qt::Horizontal) ? sb->rect.width() : sb->rect.height(); - if (scrollBarLenght < scrollButtonsCutoffSize(scrollButtonsCutoff, widgetSizePolicy(widget))) + if (scrollBarLength < scrollButtonsCutoffSize(scrollButtonsCutoff, widgetSizePolicy(widget))) sbi.enableState = kThemeTrackNothingToScroll; sbi.viewsize = sb->pageStep; diff --git a/src/gui/styles/qplastiquestyle.cpp b/src/gui/styles/qplastiquestyle.cpp index 89d4ca5..04559dc 100644 --- a/src/gui/styles/qplastiquestyle.cpp +++ b/src/gui/styles/qplastiquestyle.cpp @@ -98,7 +98,6 @@ static const int windowsItemHMargin = 3; // menu item hor text margin static const int windowsItemVMargin = 2; // menu item ver text margin static const int windowsArrowHMargin = 6; // arrow horizontal margin static const int windowsTabSpacing = 12; // space between text and tab -static const int windowsCheckMarkHMargin = 2; // horiz. margins of check mark static const int windowsRightBorder = 15; // right border on windows static const int windowsCheckMarkWidth = 12; // checkmarks width on windows diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 50eb2e1..0efc5b4 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -1636,7 +1636,9 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, if (optionProgressBar->minimum == optionProgressBar->maximum && optionProgressBar->minimum == 0) { // busy indicator - QS60StylePrivate::drawSkinPart(QS60StyleEnums::SP_QgnGrafBarWait, painter, progressRect,flags); + const QS60StylePrivate::SkinElementFlag orientationFlag = optionProgressBar->orientation == Qt::Horizontal ? + QS60StylePrivate::SF_PointNorth : QS60StylePrivate::SF_PointWest; + QS60StylePrivate::drawSkinPart(QS60StyleEnums::SP_QgnGrafBarWait, painter, progressRect, flags | orientationFlag); } else { const qreal progressFactor = (optionProgressBar->minimum == optionProgressBar->maximum) ? 1.0 : (qreal)optionProgressBar->progress / optionProgressBar->maximum; @@ -1871,6 +1873,8 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, //todo: update to horizontal table graphic QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_TableHeaderItem, painter, option->rect, flags | QS60StylePrivate::SF_PointWest); } + } else if (qobject_cast<const QFrame *>(widget)) { + QCommonStyle::drawControl(element, option, painter, widget); } if (option->state & State_HasFocus) drawPrimitive(PE_FrameFocusRect, option, painter, widget); @@ -2783,7 +2787,7 @@ QIcon QS60Style::standardIconImplementation(StandardPixmap standardIcon, QS60StyleEnums::SkinParts part; QS60StylePrivate::SkinElementFlags adjustedFlags; if (option) - adjustedFlags = (option->state & State_Enabled) ? + adjustedFlags = (option->state & State_Enabled || option->state == 0) ? QS60StylePrivate::SF_StateEnabled : QS60StylePrivate::SF_StateDisabled; diff --git a/src/gui/styles/qstyleoption.cpp b/src/gui/styles/qstyleoption.cpp index 38abd95..04ecbc4 100644 --- a/src/gui/styles/qstyleoption.cpp +++ b/src/gui/styles/qstyleoption.cpp @@ -712,7 +712,7 @@ QStyleOptionFrameV2 &QStyleOptionFrameV2::operator=(const QStyleOptionFrame &oth Constructs a QStyleOptionFrameV3 object. */ QStyleOptionFrameV3::QStyleOptionFrameV3() - : QStyleOptionFrameV2(Version), frameShape(QFrame::NoFrame) + : QStyleOptionFrameV2(Version), frameShape(QFrame::NoFrame), unused(0) { } @@ -726,7 +726,7 @@ QStyleOptionFrameV3::QStyleOptionFrameV3() \internal */ QStyleOptionFrameV3::QStyleOptionFrameV3(int version) - : QStyleOptionFrameV2(version), frameShape(QFrame::NoFrame) + : QStyleOptionFrameV2(version), frameShape(QFrame::NoFrame), unused(0) { } @@ -954,7 +954,7 @@ QStyleOptionViewItemV2 &QStyleOptionViewItemV2::operator=(const QStyleOptionView Constructs a QStyleOptionViewItemV3 object. */ QStyleOptionViewItemV3::QStyleOptionViewItemV3() - : QStyleOptionViewItemV2(Version) + : QStyleOptionViewItemV2(Version), widget(0) { } @@ -962,7 +962,7 @@ QStyleOptionViewItemV3::QStyleOptionViewItemV3() Constructs a copy of \a other. */ QStyleOptionViewItemV3::QStyleOptionViewItemV3(const QStyleOptionViewItem &other) - : QStyleOptionViewItemV2(Version) + : QStyleOptionViewItemV2(Version), widget(0) { (void)QStyleOptionViewItemV3::operator=(other); } @@ -991,7 +991,7 @@ QStyleOptionViewItemV3 &QStyleOptionViewItemV3::operator = (const QStyleOptionVi \internal */ QStyleOptionViewItemV3::QStyleOptionViewItemV3(int version) - : QStyleOptionViewItemV2(version) + : QStyleOptionViewItemV2(version), widget(0) { } @@ -4845,7 +4845,7 @@ QStyleOptionTabBarBaseV2 &QStyleOptionTabBarBaseV2::operator = (const QStyleOpti /*! \internal */ QStyleOptionTabBarBaseV2::QStyleOptionTabBarBaseV2(int version) - : QStyleOptionTabBarBase(version) + : QStyleOptionTabBarBase(version), documentMode(false) { } @@ -4937,7 +4937,7 @@ QStyleOptionSizeGrip::QStyleOptionSizeGrip(int version) \brief The QStyleOptionGraphicsItem class is used to describe the parameters needed to draw a QGraphicsItem. \since 4.2 - \ingroup multimedia + \ingroup graphicsview-api For performance reasons, the access to the member variables is direct (i.e., using the \c . or \c -> operator). This low-level feel diff --git a/src/gui/styles/qwindowscestyle.cpp b/src/gui/styles/qwindowscestyle.cpp index 49a1254..531b07e 100644 --- a/src/gui/styles/qwindowscestyle.cpp +++ b/src/gui/styles/qwindowscestyle.cpp @@ -56,7 +56,6 @@ QT_BEGIN_NAMESPACE static const int windowsItemFrame = 2; // menu item frame width -static const int windowsSepHeight = 9; // separator item height static const int windowsItemHMargin = 3; // menu item hor text margin static const int windowsItemVMargin = 2; // menu item ver text margin static const int windowsArrowHMargin = 6; // arrow horizontal margin diff --git a/src/gui/styles/qwindowsmobilestyle.cpp b/src/gui/styles/qwindowsmobilestyle.cpp index cad7463..414fc6f 100644 --- a/src/gui/styles/qwindowsmobilestyle.cpp +++ b/src/gui/styles/qwindowsmobilestyle.cpp @@ -83,11 +83,6 @@ extern bool qt_wince_is_windows_mobile_65(); //defined in qguifunctions_wince.cp QT_BEGIN_NAMESPACE static const int windowsItemFrame = 1; // menu item frame width -static const int windowsItemHMargin = 2; // menu item hor text margin -static const int windowsItemVMargin = 2; // menu item ver text margin -static const int windowsArrowHMargin = 6; // arrow horizontal margin -static const int windowsRightBorder = 15; // right border on windows -static const int windowsCheckMarkWidth = 14; // checkmarks width on windows static const int windowsMobileitemViewCheckBoxSize = 13; static const int windowsMobileFrameGroupBoxOffset = 9; diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp index b03653c..e558844 100644 --- a/src/gui/styles/qwindowsstyle.cpp +++ b/src/gui/styles/qwindowsstyle.cpp @@ -121,9 +121,6 @@ static const int windowsSepHeight = 9; // separator item height static const int windowsItemHMargin = 3; // menu item hor text margin static const int windowsItemVMargin = 2; // menu item ver text margin static const int windowsArrowHMargin = 6; // arrow horizontal margin -static const int windowsTabSpacing = 12; // space between text and tab -// Save some space and avoid warning. -//static const int windowsCheckMarkHMargin = 2; // horiz. margins of check mark static const int windowsRightBorder = 15; // right border on windows static const int windowsCheckMarkWidth = 12; // checkmarks width on windows diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp index 5da1e4e..191b71e 100644 --- a/src/gui/styles/qwindowsxpstyle.cpp +++ b/src/gui/styles/qwindowsxpstyle.cpp @@ -125,11 +125,9 @@ static PtrIsThemeBackgroundPartiallyTransparent pIsThemeBackgroundPartiallyTrans // General const values static const int windowsItemFrame = 2; // menu item frame width -static const int windowsSepHeight = 9; // separator item height static const int windowsItemHMargin = 3; // menu item hor text margin static const int windowsItemVMargin = 0; // menu item ver text margin static const int windowsArrowHMargin = 6; // arrow horizontal margin -static const int windowsCheckMarkHMargin = 0; // horiz. margins of check mark static const int windowsRightBorder = 12; // right border on windows // External function calls diff --git a/src/gui/styles/styles.pri b/src/gui/styles/styles.pri index 277be76..70ac6cb 100644 --- a/src/gui/styles/styles.pri +++ b/src/gui/styles/styles.pri @@ -37,7 +37,7 @@ x11|embedded|!macx-*:styles -= mac x11{ QMAKE_CXXFLAGS += $$QT_CFLAGS_QGTKSTYLE - LIBS += $$QT_LIBS_QGTKSTYLE + LIBS_PRIVATE += $$QT_LIBS_QGTKSTYLE styles += gtk } diff --git a/src/gui/text/qabstracttextdocumentlayout.cpp b/src/gui/text/qabstracttextdocumentlayout.cpp index 8b21c8f..f2ddeb6 100644 --- a/src/gui/text/qabstracttextdocumentlayout.cpp +++ b/src/gui/text/qabstracttextdocumentlayout.cpp @@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE \brief The QAbstractTextDocumentLayout class is an abstract base class used to implement custom layouts for QTextDocuments. - \ingroup text + \ingroup richtext-processing The standard layout provided by Qt can handle simple word processing including inline images, lists and tables. diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index 7f9cd9d..fcc26d6 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -383,10 +383,7 @@ LengthData ValueExtractor::lengthValue(const Value& v) if (data.unit != LengthData::None) s.chop(2); - bool ok; - data.number = s.toDouble(&ok); - if (!ok) - data.number = 0; + data.number = s.toDouble(); return data; } @@ -712,7 +709,7 @@ static ColorData parseColorValue(Value v) for (int i = 0; i < qMin(colorDigits.count(), 7); i += 2) { if (colorDigits.at(i).type == Value::Percentage) { - colorDigits[i].variant = colorDigits.at(i).variant.toDouble() * 255. / 100.; + colorDigits[i].variant = colorDigits.at(i).variant.toReal() * (255. / 100.); colorDigits[i].type = Value::Number; } else if (colorDigits.at(i).type != Value::Number) { return ColorData(); @@ -789,19 +786,19 @@ static BrushData parseBrushValue(const Value &v, const QPalette &pal) ColorData cd = parseColorValue(color); if(cd.type == ColorData::Role) dependsOnThePalette = true; - stops.append(QGradientStop(stop.variant.toDouble(), colorFromData(cd, pal))); + stops.append(QGradientStop(stop.variant.toReal(), colorFromData(cd, pal))); } else { parser.next(); Value value; - parser.parseTerm(&value); + (void)parser.parseTerm(&value); if (attr.compare(QLatin1String("spread"), Qt::CaseInsensitive) == 0) { spread = spreads.indexOf(value.variant.toString()); } else { - vars[attr] = value.variant.toString().toDouble(); + vars[attr] = value.variant.toReal(); } } parser.skipSpace(); - parser.test(COMMA); + (void)parser.test(COMMA); } if (gradType == 0) { @@ -1080,8 +1077,8 @@ static bool setFontSizeFromValue(Value value, QFont *font, int *fontSizeAdjustme if (s.endsWith(QLatin1String("pt"), Qt::CaseInsensitive)) { s.chop(2); value.variant = s; - if (value.variant.convert(QVariant::Double)) { - font->setPointSizeF(value.variant.toDouble()); + if (value.variant.convert((QVariant::Type)qMetaTypeId<qreal>())) { + font->setPointSizeF(value.variant.toReal()); valid = true; } } else if (s.endsWith(QLatin1String("px"), Qt::CaseInsensitive)) { @@ -2462,7 +2459,7 @@ bool Parser::parseAttrib(AttributeSelector *attr) bool Parser::parsePseudo(Pseudo *pseudo) { - test(COLON); + (void)test(COLON); pseudo->negated = test(EXCLAMATION_SYM); if (test(IDENT)) { pseudo->name = lexem(); diff --git a/src/gui/text/qcssparser_p.h b/src/gui/text/qcssparser_p.h index 2d21bc2..6f73445 100644 --- a/src/gui/text/qcssparser_p.h +++ b/src/gui/text/qcssparser_p.h @@ -368,18 +368,18 @@ struct Q_GUI_EXPORT Value }; struct ColorData { - ColorData() : type(Invalid) {} - ColorData(const QColor &col) : color(col) , type(Color) {} - ColorData(QPalette::ColorRole r) : role(r) , type(Role) {} + ColorData() : role(QPalette::NoRole), type(Invalid) {} + ColorData(const QColor &col) : color(col), role(QPalette::NoRole), type(Color) {} + ColorData(QPalette::ColorRole r) : role(r), type(Role) {} QColor color; QPalette::ColorRole role; enum { Invalid, Color, Role} type; }; struct BrushData { - BrushData() : type(Invalid) {} - BrushData(const QBrush &br) : brush(br) , type(Brush) {} - BrushData(QPalette::ColorRole r) : role(r) , type(Role) {} + BrushData() : role(QPalette::NoRole), type(Invalid) {} + BrushData(const QBrush &br) : brush(br), role(QPalette::NoRole), type(Brush) {} + BrushData(QPalette::ColorRole r) : role(r), type(Role) {} QBrush brush; QPalette::ColorRole role; enum { Invalid, Brush, Role, DependsOnThePalette } type; @@ -504,7 +504,7 @@ const int NumPseudos = 46; struct Pseudo { - Pseudo() : negated(false) { } + Pseudo() : type(0), negated(false) { } quint64 type; QString name; QString function; @@ -726,7 +726,7 @@ enum TokenType { struct Q_GUI_EXPORT Symbol { - inline Symbol() : start(0), len(-1) {} + inline Symbol() : token(NONE), start(0), len(-1) {} TokenType token; QString text; int start, len; diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index af382cb..96905d0 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -415,11 +415,11 @@ QFontEngineData::~QFontEngineData() \brief The QFont class specifies a font used for drawing text. - \ingroup multimedia + \ingroup painting \ingroup appearance \ingroup shared - \ingroup text - \mainclass + \ingroup richtext-processing + When you create a QFont object you specify various attributes that you want the font to have. Qt will use the font with the specified @@ -2276,9 +2276,8 @@ QDataStream &operator>>(QDataStream &s, QFont &font) \brief The QFontInfo class provides general information about fonts. - \ingroup multimedia + \ingroup appearance \ingroup shared - \ingroup text The QFontInfo class provides the same access functions as QFont, e.g. family(), pointSize(), italic(), weight(), fixedPitch(), diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 1f9e8d7..a8513ce 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -1461,9 +1461,7 @@ QString QFontDatabase::styleString(const QFontInfo &fontInfo) \brief The QFontDatabase class provides information about the fonts available in the underlying window system. - \ingroup environment - \ingroup multimedia - \ingroup text + \ingroup appearance The most common uses of this class are to query the database for the list of font families() and for the pointSizes() and styles() @@ -2602,7 +2600,7 @@ QStringList QFontDatabase::applicationFontFamilies(int id) means that all QPainter::drawText() calls outside the GUI thread will not produce readable output. - \sa threads.html#painting-in-threads + \sa {Thread-Support in Qt Modules#Painting In Threads}{Painting In Threads} */ diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp index 5b47772..c828c9e 100644 --- a/src/gui/text/qfontmetrics.cpp +++ b/src/gui/text/qfontmetrics.cpp @@ -75,9 +75,8 @@ extern int qt_defaultDpi(); \brief The QFontMetrics class provides font metrics information. - \ingroup multimedia + \ingroup painting \ingroup shared - \ingroup text QFontMetrics functions calculate the size of characters and strings for a given font. There are three ways you can create a @@ -859,24 +858,23 @@ QRect QFontMetrics::tightBoundingRect(const QString &text) const right-to-left layouts, and on the left side for right-to-left layouts. Note that this behavior is independent of the text language. - */ -QString QFontMetrics::elidedText(const QString &_text, Qt::TextElideMode mode, int width, int flags) const +QString QFontMetrics::elidedText(const QString &text, Qt::TextElideMode mode, int width, int flags) const { - QString text = _text; + QString _text = text; if (!(flags & Qt::TextLongestVariant)) { int posA = 0; - int posB = text.indexOf(QLatin1Char('\x9c')); + int posB = _text.indexOf(QLatin1Char('\x9c')); while (posB >= 0) { - QString portion = text.mid(posA, posB - posA); + QString portion = _text.mid(posA, posB - posA); if (size(flags, portion).width() <= width) return portion; posA = posB + 1; - posB = text.indexOf(QLatin1Char('\x9c'), posA); + posB = _text.indexOf(QLatin1Char('\x9c'), posA); } - text = text.mid(posA); + _text = _text.mid(posA); } - QStackTextEngine engine(text, QFont(d)); + QStackTextEngine engine(_text, QFont(d)); return engine.elidedText(mode, width, flags); } @@ -942,9 +940,8 @@ int QFontMetrics::lineWidth() const \brief The QFontMetricsF class provides font metrics information. - \ingroup multimedia + \ingroup painting \ingroup shared - \ingroup text QFontMetricsF functions calculate the size of characters and strings for a given font. You can construct a QFontMetricsF object diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp index 5c54500..cdb30ef 100644 --- a/src/gui/text/qsyntaxhighlighter.cpp +++ b/src/gui/text/qsyntaxhighlighter.cpp @@ -219,7 +219,7 @@ void QSyntaxHighlighterPrivate::reformatBlock(QTextBlock block) \since 4.1 - \ingroup text + \ingroup richtext-processing The QSyntaxHighlighter class is a base class for implementing QTextEdit syntax highlighters. A syntax highligher automatically diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index 384e283..da09ee1 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -2288,7 +2288,7 @@ void QTextControl::print(QPrinter *printer) const { #ifndef QT_NO_PRINTER Q_D(const QTextControl); - if (printer && !printer->isValid()) + if (!printer || !printer->isValid()) return; QTextDocument *tempDoc = 0; const QTextDocument *doc = d->doc; diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp index 6ab89dc..88ab9d0 100644 --- a/src/gui/text/qtextcursor.cpp +++ b/src/gui/text/qtextcursor.cpp @@ -84,8 +84,7 @@ QTextCursorPrivate::QTextCursorPrivate(const QTextCursorPrivate &rhs) QTextCursorPrivate::~QTextCursorPrivate() { - if (priv) - priv->removeCursor(this); + priv->removeCursor(this); } QTextCursorPrivate::AdjustResult QTextCursorPrivate::adjustPosition(int positionOfChange, int charsAddedOrRemoved, QTextUndoCommand::Operation op) @@ -125,7 +124,7 @@ QTextCursorPrivate::AdjustResult QTextCursorPrivate::adjustPosition(int position void QTextCursorPrivate::setX() { - if (priv && priv->isInEditBlock()) { + if (priv->isInEditBlock()) { x = -1; // mark dirty return; } @@ -855,9 +854,9 @@ QTextLayout *QTextCursorPrivate::blockLayout(QTextBlock &block) const{ \brief The QTextCursor class offers an API to access and modify QTextDocuments. - \ingroup text + \ingroup richtext-processing \ingroup shared - \mainclass + Text cursors are objects that are used to access and modify the contents and underlying structure of text documents via a programming interface diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index 6fa3e90..bfed368 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -247,8 +247,8 @@ QTextCodec *Qt::codecForHtml(const QByteArray &ba) \brief The QTextDocument class holds formatted text that can be viewed and edited using a QTextEdit. - \ingroup text - \mainclass + \ingroup richtext-processing + QTextDocument is a container for structured rich text documents, providing support for styled text and various types of document elements, such as diff --git a/src/gui/text/qtextdocumentfragment.cpp b/src/gui/text/qtextdocumentfragment.cpp index da7025c..953e965 100644 --- a/src/gui/text/qtextdocumentfragment.cpp +++ b/src/gui/text/qtextdocumentfragment.cpp @@ -259,7 +259,7 @@ void QTextDocumentFragmentPrivate::insert(QTextCursor &_cursor) const \brief The QTextDocumentFragment class represents a piece of formatted text from a QTextDocument. - \ingroup text + \ingroup richtext-processing \ingroup shared A QTextDocumentFragment is a fragment of rich text, that can be inserted into diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index cfec8e9..a795c1f 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -198,8 +198,8 @@ public: if (v.isNull()) { return cellPadding; } else { - Q_ASSERT(v.type() == QVariant::Double); - return QFixed::fromReal(v.toDouble() * deviceScale); + Q_ASSERT(v.userType() == QVariant::Double || v.userType() == QMetaType::Float); + return QFixed::fromReal(v.toReal() * deviceScale); } } @@ -2601,13 +2601,13 @@ void QTextDocumentLayoutPrivate::layoutBlock(const QTextBlock &bl, int blockPosi // float has been added in the meantime, redo layoutStruct->pendingFloats.clear(); - if (haveWordOrAnyWrapMode) { - option.setWrapMode(QTextOption::WrapAnywhere); - tl->setTextOption(option); - } - line.setLineWidth((right-left).toReal()); if (QFixed::fromReal(line.naturalTextWidth()) > right-left) { + if (haveWordOrAnyWrapMode) { + option.setWrapMode(QTextOption::WrapAnywhere); + tl->setTextOption(option); + } + layoutStruct->pendingFloats.clear(); // lines min width more than what we have layoutStruct->y = findY(layoutStruct->y, layoutStruct, QFixed::fromReal(line.naturalTextWidth())); @@ -2619,12 +2619,13 @@ void QTextDocumentLayoutPrivate::layoutBlock(const QTextBlock &bl, int blockPosi else right -= text_indent; line.setLineWidth(qMax<qreal>(line.naturalTextWidth(), (right-left).toReal())); - } - if (haveWordOrAnyWrapMode) { - option.setWrapMode(QTextOption::WordWrap); - tl->setTextOption(option); + if (haveWordOrAnyWrapMode) { + option.setWrapMode(QTextOption::WordWrap); + tl->setTextOption(option); + } } + } QFixed lineHeight = QFixed::fromReal(line.height()); diff --git a/src/gui/text/qtextdocumentwriter.cpp b/src/gui/text/qtextdocumentwriter.cpp index 33a5018..bdb5247 100644 --- a/src/gui/text/qtextdocumentwriter.cpp +++ b/src/gui/text/qtextdocumentwriter.cpp @@ -76,7 +76,7 @@ public: \brief The QTextDocumentWriter class provides a format-independent interface for writing a QTextDocument to files or other devices. - \ingroup text + \ingroup richtext-processing \ingroup io To write a document, construct a QTextDocumentWriter object with either a diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index 82c81ef..6a77fa5 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE \brief The QTextLength class encapsulates the different types of length used in a QTextDocument. - \ingroup text + \ingroup richtext-processing When we specify a value for the length of an element in a text document, we often need to provide some other information so that the length is @@ -267,10 +267,11 @@ private: static uint variantHash(const QVariant &variant) { - switch (variant.type()) { + switch (variant.userType()) { case QVariant::Invalid: return 0; case QVariant::Bool: return variant.toBool(); case QVariant::Int: return variant.toInt(); + case QMetaType::Float: return static_cast<int>(variant.toFloat()); case QVariant::Double: return static_cast<int>(variant.toDouble()); case QVariant::String: return qHash(variant.toString()); case QVariant::Color: return qHash(qvariant_cast<QColor>(variant).rgb()); @@ -325,7 +326,7 @@ void QTextFormatPrivate::recalcFont() const f.setFamily(props.at(i).value.toString()); break; case QTextFormat::FontPointSize: - f.setPointSizeF(props.at(i).value.toDouble()); + f.setPointSizeF(props.at(i).value.toReal()); break; case QTextFormat::FontPixelSize: f.setPixelSize(props.at(i).value.toInt()); @@ -352,10 +353,10 @@ void QTextFormatPrivate::recalcFont() const f.setStrikeOut(props.at(i).value.toBool()); break; case QTextFormat::FontLetterSpacing: - f.setLetterSpacing(QFont::PercentageSpacing, props.at(i).value.toDouble()); + f.setLetterSpacing(QFont::PercentageSpacing, props.at(i).value.toReal()); break; case QTextFormat::FontWordSpacing: - f.setWordSpacing(props.at(i).value.toDouble()); + f.setWordSpacing(props.at(i).value.toReal()); break; case QTextFormat::FontCapitalization: f.setCapitalization(static_cast<QFont::Capitalization> (props.at(i).value.toInt())); @@ -414,7 +415,7 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt) \brief The QTextFormat class provides formatting information for a QTextDocument. - \ingroup text + \ingroup richtext-processing \ingroup shared A QTextFormat is a generic class used for describing the format of @@ -447,7 +448,7 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt) associate the format with a QTextObject. It is used to represent lists, frames, and tables inside the document. - \sa {Text Processing Classes} + \sa {Rich Text Processing} */ /*! @@ -852,7 +853,7 @@ bool QTextFormat::boolProperty(int propertyId) const if (!d) return false; const QVariant prop = d->property(propertyId); - if (prop.type() != QVariant::Bool) + if (prop.userType() != QVariant::Bool) return false; return prop.toBool(); } @@ -868,7 +869,7 @@ int QTextFormat::intProperty(int propertyId) const if (!d) return 0; const QVariant prop = d->property(propertyId); - if (prop.type() != QVariant::Int) + if (prop.userType() != QVariant::Int) return 0; return prop.toInt(); } @@ -885,7 +886,7 @@ qreal QTextFormat::doubleProperty(int propertyId) const if (!d) return 0.; const QVariant prop = d->property(propertyId); - if (prop.type() != QVariant::Double && prop.type() != QMetaType::Float) + if (prop.userType() != QVariant::Double && prop.userType() != QMetaType::Float) return 0.; return qVariantValue<qreal>(prop); } @@ -902,7 +903,7 @@ QString QTextFormat::stringProperty(int propertyId) const if (!d) return QString(); const QVariant prop = d->property(propertyId); - if (prop.type() != QVariant::String) + if (prop.userType() != QVariant::String) return QString(); return prop.toString(); } @@ -920,7 +921,7 @@ QColor QTextFormat::colorProperty(int propertyId) const if (!d) return QColor(); const QVariant prop = d->property(propertyId); - if (prop.type() != QVariant::Color) + if (prop.userType() != QVariant::Color) return QColor(); return qvariant_cast<QColor>(prop); } @@ -937,7 +938,7 @@ QPen QTextFormat::penProperty(int propertyId) const if (!d) return QPen(Qt::NoPen); const QVariant prop = d->property(propertyId); - if (prop.type() != QVariant::Pen) + if (prop.userType() != QVariant::Pen) return QPen(Qt::NoPen); return qvariant_cast<QPen>(prop); } @@ -954,7 +955,7 @@ QBrush QTextFormat::brushProperty(int propertyId) const if (!d) return QBrush(Qt::NoBrush); const QVariant prop = d->property(propertyId); - if (prop.type() != QVariant::Brush) + if (prop.userType() != QVariant::Brush) return QBrush(Qt::NoBrush); return qvariant_cast<QBrush>(prop); } @@ -984,13 +985,13 @@ QVector<QTextLength> QTextFormat::lengthVectorProperty(int propertyId) const if (!d) return vector; const QVariant prop = d->property(propertyId); - if (prop.type() != QVariant::List) + if (prop.userType() != QVariant::List) return vector; QList<QVariant> propertyList = prop.toList(); for (int i=0; i<propertyList.size(); ++i) { QVariant var = propertyList.at(i); - if (var.type() == QVariant::TextLength) + if (var.userType() == QVariant::TextLength) vector.append(qvariant_cast<QTextLength>(var)); } @@ -1078,7 +1079,7 @@ int QTextFormat::objectIndex() const if (!d) return -1; const QVariant prop = d->property(ObjectIndex); - if (prop.type() != QVariant::Int) // #### + if (prop.userType() != QVariant::Int) // #### return -1; return prop.toInt(); } @@ -1183,7 +1184,7 @@ bool QTextFormat::operator==(const QTextFormat &rhs) const \brief The QTextCharFormat class provides formatting information for characters in a QTextDocument. - \ingroup text + \ingroup richtext-processing The character format of text in a document specifies the visual properties of the text, as well as information about its role in a hypertext document. @@ -1654,9 +1655,9 @@ void QTextCharFormat::setUnderlineStyle(UnderlineStyle style) QString QTextCharFormat::anchorName() const { QVariant prop = property(AnchorName); - if (prop.type() == QVariant::StringList) + if (prop.userType() == QVariant::StringList) return prop.toStringList().value(0); - else if (prop.type() != QVariant::String) + else if (prop.userType() != QVariant::String) return QString(); return prop.toString(); } @@ -1672,9 +1673,9 @@ QString QTextCharFormat::anchorName() const QStringList QTextCharFormat::anchorNames() const { QVariant prop = property(AnchorName); - if (prop.type() == QVariant::StringList) + if (prop.userType() == QVariant::StringList) return prop.toStringList(); - else if (prop.type() != QVariant::String) + else if (prop.userType() != QVariant::String) return QStringList(); return QStringList(prop.toString()); } @@ -1796,7 +1797,7 @@ QFont QTextCharFormat::font() const \brief The QTextBlockFormat class provides formatting information for blocks of text in a QTextDocument. - \ingroup text + \ingroup richtext-processing A document is composed of a list of blocks, represented by QTextBlock objects. Each block can contain an item of some kind, such as a @@ -2087,7 +2088,7 @@ QList<QTextOption::Tab> QTextBlockFormat::tabPositions() const \brief The QTextListFormat class provides formatting information for lists in a QTextDocument. - \ingroup text + \ingroup richtext-processing A list is composed of one or more items, represented as text blocks. The list's format specifies the appearance of items in the list. @@ -2197,7 +2198,7 @@ QTextListFormat::QTextListFormat(const QTextFormat &fmt) \brief The QTextFrameFormat class provides formatting information for frames in a QTextDocument. - \ingroup text + \ingroup richtext-processing A text frame groups together one or more blocks of text, providing a layer of structure larger than the paragraph. The format of a frame specifies @@ -2523,7 +2524,7 @@ qreal QTextFrameFormat::rightMargin() const \brief The QTextTableFormat class provides formatting information for tables in a QTextDocument. - \ingroup text + \ingroup richtext-processing A table is a group of cells ordered into rows and columns. Each table contains at least one row and one column. Each cell contains a block. @@ -2729,7 +2730,7 @@ QTextTableFormat::QTextTableFormat(const QTextFormat &fmt) \brief The QTextImageFormat class provides formatting information for images in a QTextDocument. - \ingroup text + \ingroup richtext-processing Inline images are represented by an object replacement character (0xFFFC in Unicode) which has an associated QTextImageFormat. The @@ -2998,7 +2999,7 @@ QTextTableCellFormat::QTextTableCellFormat(const QTextFormat &fmt) \brief The QTextTableCellFormat class provides formatting information for table cells in a QTextDocument. - \ingroup text + \ingroup richtext-processing The table cell format of a table cell in a document specifies the visual properties of the table cell. diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp index 8910394..92b2d4e 100644 --- a/src/gui/text/qtexthtmlparser.cpp +++ b/src/gui/text/qtexthtmlparser.cpp @@ -1443,14 +1443,13 @@ static bool setFloatAttribute(qreal *destination, const QString &value) static void setWidthAttribute(QTextLength *width, QString value) { - qreal realVal; bool ok = false; - realVal = value.toDouble(&ok); + qreal realVal = value.toDouble(&ok); if (ok) { *width = QTextLength(QTextLength::FixedLength, realVal); } else { value = value.trimmed(); - if (!value.isEmpty() && value.at(value.length() - 1) == QLatin1Char('%')) { + if (!value.isEmpty() && value.endsWith(QLatin1Char('%'))) { value.chop(1); realVal = value.toDouble(&ok); if (ok) diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 3520ab6..fcb22e4 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -128,7 +128,7 @@ static QFixed alignLine(QTextEngine *eng, const QScriptLine &line) \brief The QTextInlineObject class represents an inline object in a QTextLayout. - \ingroup text + \ingroup richtext-processing This class is only used if the text layout is used to lay out parts of a QTextDocument. @@ -285,7 +285,7 @@ Qt::LayoutDirection QTextInlineObject::textDirection() const \brief The QTextLayout class is used to lay out and paint a single paragraph of text. - \ingroup text + \ingroup richtext-processing It offers most features expected from a modern text layout engine, including Unicode compliant rendering, line breaking and @@ -1368,7 +1368,7 @@ void QTextLayout::drawCursor(QPainter *p, const QPointF &pos, int cursorPosition \brief The QTextLine class represents a line of text inside a QTextLayout. - \ingroup text + \ingroup richtext-processing A text line is usually created by QTextLayout::createLine(). diff --git a/src/gui/text/qtextlist.cpp b/src/gui/text/qtextlist.cpp index 8348c92..3e5d7b0 100644 --- a/src/gui/text/qtextlist.cpp +++ b/src/gui/text/qtextlist.cpp @@ -63,7 +63,7 @@ public: \brief The QTextList class provides a decorated list of items in a QTextDocument. - \ingroup text + \ingroup richtext-processing A list contains a sequence of text blocks, each of which is marked with a bullet point or other symbol. Multiple levels of lists can be used, and diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp index 98c92eb..4ac0276 100644 --- a/src/gui/text/qtextobject.cpp +++ b/src/gui/text/qtextobject.cpp @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE \brief The QTextObject class is a base class for different kinds of objects that can group parts of a QTextDocument together. - \ingroup text + \ingroup richtext-processing The common grouping text objects are lists (QTextList), frames (QTextFrame), and tables (QTextTable). A text object has an @@ -183,7 +183,7 @@ QTextDocumentPrivate *QTextObject::docHandle() const \brief The QTextBlockGroup class provides a container for text blocks within a QTextDocument. - \ingroup text + \ingroup richtext-processing Block groups can be used to organize blocks of text within a document. They maintain an up-to-date list of the text blocks that belong to @@ -305,7 +305,7 @@ QTextFrameLayoutData::~QTextFrameLayoutData() \brief The QTextFrame class represents a frame in a QTextDocument. - \ingroup text + \ingroup richtext-processing Text frames provide structure for the text in a document. They are used as generic containers for other document elements. @@ -412,11 +412,6 @@ QTextFrameLayoutData::~QTextFrameLayoutData() QTextFrame::QTextFrame(QTextDocument *doc) : QTextObject(*new QTextFramePrivate(doc), doc) { - Q_D(QTextFrame); - d->fragment_start = 0; - d->fragment_end = 0; - d->parentFrame = 0; - d->layoutData = 0; } // ### DOC: What does this do to child frames? @@ -435,11 +430,6 @@ QTextFrame::~QTextFrame() QTextFrame::QTextFrame(QTextFramePrivate &p, QTextDocument *doc) : QTextObject(p, doc) { - Q_D(QTextFrame); - d->fragment_start = 0; - d->fragment_end = 0; - d->parentFrame = 0; - d->layoutData = 0; } /*! @@ -609,7 +599,7 @@ void QTextFramePrivate::remove_me() \brief The iterator class provides an iterator for reading the contents of a QTextFrame. - \ingroup text + \ingroup richtext-processing A frame consists of an arbitrary sequence of \l{QTextBlock}s and child \l{QTextFrame}s. This class provides a way to iterate over the @@ -809,7 +799,7 @@ QTextFrame::iterator &QTextFrame::iterator::operator--() \brief The QTextBlockUserData class is used to associate custom data with blocks of text. \since 4.1 - \ingroup text + \ingroup richtext-processing QTextBlockUserData provides an abstract interface for container classes that are used to associate application-specific user data with text blocks in a QTextDocument. @@ -839,7 +829,7 @@ QTextBlockUserData::~QTextBlockUserData() \brief The QTextBlock class provides a container for text fragments in a QTextDocument. - \ingroup text + \ingroup richtext-processing A text block encapsulates a block or paragraph of text in a QTextDocument. QTextBlock provides read-only access to the block/paragraph structure of @@ -934,7 +924,7 @@ QTextBlockUserData::~QTextBlockUserData() \brief The QTextBlock::iterator class provides an iterator for reading the contents of a QTextBlock. - \ingroup text + \ingroup richtext-processing A block consists of a sequence of text fragments. This class provides a way to iterate over these, and read their contents. It does not provide @@ -1535,7 +1525,7 @@ QTextBlock::iterator &QTextBlock::iterator::operator--() \brief The QTextFragment class holds a piece of text in a QTextDocument with a single QTextCharFormat. - \ingroup text + \ingroup richtext-processing A text fragment describes a piece of text that is stored with a single character format. Text in which the character format changes can be diff --git a/src/gui/text/qtextobject_p.h b/src/gui/text/qtextobject_p.h index e862b30..22034c8 100644 --- a/src/gui/text/qtextobject_p.h +++ b/src/gui/text/qtextobject_p.h @@ -94,7 +94,7 @@ class QTextFramePrivate : public QTextObjectPrivate Q_DECLARE_PUBLIC(QTextFrame) public: QTextFramePrivate(QTextDocument *doc) - : QTextObjectPrivate(doc) + : QTextObjectPrivate(doc), fragment_start(0), fragment_end(0), parentFrame(0), layoutData(0) { } virtual void fragmentAdded(const QChar &type, uint fragment); diff --git a/src/gui/text/qtextoption.cpp b/src/gui/text/qtextoption.cpp index cc67113..97b3b35 100644 --- a/src/gui/text/qtextoption.cpp +++ b/src/gui/text/qtextoption.cpp @@ -201,7 +201,7 @@ QList<QTextOption::Tab> QTextOption::tabs() const \brief The QTextOption class provides a description of general rich text properties. - \ingroup text + \ingroup richtext-processing QTextOption is used to encapsulate common rich text properties in a single object. It contains information about text alignment, layout direction, diff --git a/src/gui/text/qtexttable.cpp b/src/gui/text/qtexttable.cpp index 07d09d1..3657698 100644 --- a/src/gui/text/qtexttable.cpp +++ b/src/gui/text/qtexttable.cpp @@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE \brief The QTextTableCell class represents the properties of a cell in a QTextTable. - \ingroup text + \ingroup richtext-processing Table cells are pieces of document structure that belong to a table. The table orders cells into particular rows and columns; cells can @@ -499,7 +499,7 @@ void QTextTablePrivate::update() const \brief The QTextTable class represents a table in a QTextDocument. - \ingroup text + \ingroup richtext-processing A table is a group of cells ordered into rows and columns. Each table contains at least one row and one column. Each cell contains a block, and diff --git a/src/gui/text/qtexttable_p.h b/src/gui/text/qtexttable_p.h index 4dd52c7..7783b5d 100644 --- a/src/gui/text/qtexttable_p.h +++ b/src/gui/text/qtexttable_p.h @@ -62,7 +62,7 @@ class QTextTablePrivate : public QTextFramePrivate { Q_DECLARE_PUBLIC(QTextTable) public: - QTextTablePrivate(QTextDocument *document) : QTextFramePrivate(document), grid(0), nRows(0), dirty(true), blockFragmentUpdates(false) {} + QTextTablePrivate(QTextDocument *document) : QTextFramePrivate(document), grid(0), nRows(0), nCols(0), dirty(true), blockFragmentUpdates(false) {} ~QTextTablePrivate(); static QTextTable *createTable(QTextDocumentPrivate *, int pos, int rows, int cols, const QTextTableFormat &tableFormat); diff --git a/src/gui/text/qzip.cpp b/src/gui/text/qzip.cpp index 13b98bd..70fc05e 100644 --- a/src/gui/text/qzip.cpp +++ b/src/gui/text/qzip.cpp @@ -772,7 +772,7 @@ QList<QZipReader::FileInfo> QZipReader::fileInfoList() const { d->scanFiles(); QList<QZipReader::FileInfo> files; - for (int i = 0; d && i < d->fileHeaders.size(); ++i) { + for (int i = 0; i < d->fileHeaders.size(); ++i) { QZipReader::FileInfo fi; d->fillFileInfo(i, fi); files.append(fi); diff --git a/src/gui/text/text.pri b/src/gui/text/text.pri index e4d24ff..b28ecd7 100644 --- a/src/gui/text/text.pri +++ b/src/gui/text/text.pri @@ -191,7 +191,7 @@ contains(QT_CONFIG, freetype) { embedded:CONFIG += opentype # pull in the proper freetype2 include directory include($$QT_SOURCE_TREE/config.tests/unix/freetype/freetype.pri) - LIBS += -lfreetype + LIBS_PRIVATE += -lfreetype } else { DEFINES *= QT_NO_FREETYPE } diff --git a/src/gui/util/qsystemtrayicon.cpp b/src/gui/util/qsystemtrayicon.cpp index f4d2f7f..64591c7 100644 --- a/src/gui/util/qsystemtrayicon.cpp +++ b/src/gui/util/qsystemtrayicon.cpp @@ -65,7 +65,6 @@ QT_BEGIN_NAMESPACE \class QSystemTrayIcon \brief The QSystemTrayIcon class provides an icon for an application in the system tray. \since 4.2 - \ingroup application \ingroup desktop Modern operating systems usually provide a special area on the desktop, diff --git a/src/gui/util/qundogroup.cpp b/src/gui/util/qundogroup.cpp index 9fcfe95..07a3a3d 100644 --- a/src/gui/util/qundogroup.cpp +++ b/src/gui/util/qundogroup.cpp @@ -61,7 +61,6 @@ public: \class QUndoGroup \brief The QUndoGroup class is a group of QUndoStack objects. \since 4.2 - \ingroup misc For an overview of the Qt's undo framework, see the \link qundo.html overview\endlink. diff --git a/src/gui/util/qundostack.cpp b/src/gui/util/qundostack.cpp index a5e8004..065cc24 100644 --- a/src/gui/util/qundostack.cpp +++ b/src/gui/util/qundostack.cpp @@ -52,7 +52,6 @@ QT_BEGIN_NAMESPACE \class QUndoCommand \brief The QUndoCommand class is the base class of all commands stored on a QUndoStack. \since 4.2 - \ingroup misc For an overview of Qt's Undo Framework, see the \l{Overview of Qt's Undo Framework}{overview document}. @@ -292,7 +291,6 @@ const QUndoCommand *QUndoCommand::child(int index) const \class QUndoStack \brief The QUndoStack class is a stack of QUndoCommand objects. \since 4.2 - \ingroup misc For an overview of Qt's Undo Framework, see the \l{Overview of Qt's Undo Framework}{overview document}. diff --git a/src/gui/util/qundoview.cpp b/src/gui/util/qundoview.cpp index 0241500..079a62f 100644 --- a/src/gui/util/qundoview.cpp +++ b/src/gui/util/qundoview.cpp @@ -253,7 +253,7 @@ QIcon QUndoModel::cleanIcon() const \class QUndoView \brief The QUndoView class displays the contents of a QUndoStack. \since 4.2 - \ingroup misc + \ingroup advanced QUndoView is a QListView which displays the list of commands pushed on an undo stack. diff --git a/src/gui/widgets/qbuttongroup.cpp b/src/gui/widgets/qbuttongroup.cpp index 8b89a86..26a9d51 100644 --- a/src/gui/widgets/qbuttongroup.cpp +++ b/src/gui/widgets/qbuttongroup.cpp @@ -48,8 +48,6 @@ \ingroup organizers \ingroup geomanagement - \ingroup appearance - \mainclass QButtonGroup provides an abstract container into which button widgets can be placed. It does not provide a visual representation of this container diff --git a/src/gui/widgets/qcalendarwidget.cpp b/src/gui/widgets/qcalendarwidget.cpp index 795bc17..e9042f9 100644 --- a/src/gui/widgets/qcalendarwidget.cpp +++ b/src/gui/widgets/qcalendarwidget.cpp @@ -332,10 +332,9 @@ QString QCalendarMonthValidator::text(const QDate &date, int repeat) const return str + QString::number(date.month()); } else if (repeat == 3) { return m_locale.standaloneMonthName(date.month(), QLocale::ShortFormat); - } else if (repeat >= 4) { + } else /*if (repeat >= 4)*/ { return m_locale.standaloneMonthName(date.month(), QLocale::LongFormat); } - return QString(); } ////////////////////////////////// @@ -1961,7 +1960,7 @@ void QCalendarWidgetPrivate::_q_editingFinished() \brief The QCalendarWidget class provides a monthly based calendar widget allowing the user to select a date. \since 4.2 - \mainclass + \ingroup advanced \image cleanlooks-calendarwidget.png diff --git a/src/gui/widgets/qcheckbox.cpp b/src/gui/widgets/qcheckbox.cpp index 8cdf3b9..faec9d0 100644 --- a/src/gui/widgets/qcheckbox.cpp +++ b/src/gui/widgets/qcheckbox.cpp @@ -73,7 +73,7 @@ public: \brief The QCheckBox widget provides a checkbox with a text label. \ingroup basicwidgets - \mainclass + A QCheckBox is an option button that can be switched on (checked) or off (unchecked). Checkboxes are typically used to represent features in an diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index 923ea05..bf0d52b 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -867,7 +867,7 @@ QComboBox::QComboBox(bool rw, QWidget *parent, const char *name) \brief The QComboBox widget is a combined button and popup list. \ingroup basicwidgets - \mainclass + A QComboBox provides a means of presenting a list of options to the user in a way that takes up the minimum amount of screen space. diff --git a/src/gui/widgets/qcommandlinkbutton.cpp b/src/gui/widgets/qcommandlinkbutton.cpp index 3d12ce9..206221f 100644 --- a/src/gui/widgets/qcommandlinkbutton.cpp +++ b/src/gui/widgets/qcommandlinkbutton.cpp @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE \brief The QCommandLinkButton widget provides a Vista style command link button. \ingroup basicwidgets - \mainclass + The command link is a new control that was introduced by Windows Vista. It's intended use is similar to that of a radio button in that it is used to choose diff --git a/src/gui/widgets/qdatetimeedit.cpp b/src/gui/widgets/qdatetimeedit.cpp index 533f4d0..133d73c 100644 --- a/src/gui/widgets/qdatetimeedit.cpp +++ b/src/gui/widgets/qdatetimeedit.cpp @@ -75,7 +75,7 @@ QT_BEGIN_NAMESPACE \brief The QDateTimeEdit class provides a widget for editing dates and times. \ingroup basicwidgets - \mainclass + QDateTimeEdit allows the user to edit dates by using the keyboard or the arrow keys to increase and decrease date and time values. The @@ -1506,7 +1506,7 @@ void QDateTimeEdit::mousePressEvent(QMouseEvent *event) the QDateTimeEdit widget. \ingroup basicwidgets - \mainclass + Many of the properties and functions provided by QTimeEdit are implemented in QDateTimeEdit. The following properties are most relevant to users of this @@ -1568,7 +1568,7 @@ QTimeEdit::QTimeEdit(const QTime &time, QWidget *parent) the QDateTimeEdit widget. \ingroup basicwidgets - \mainclass + Many of the properties and functions provided by QDateEdit are implemented in QDateTimeEdit. The following properties are most relevant to users of this diff --git a/src/gui/widgets/qdial.cpp b/src/gui/widgets/qdial.cpp index 3fe7c68..90f1c85 100644 --- a/src/gui/widgets/qdial.cpp +++ b/src/gui/widgets/qdial.cpp @@ -168,7 +168,7 @@ int QDialPrivate::valueFromPoint(const QPoint &p) const \brief The QDial class provides a rounded range control (like a speedometer or potentiometer). \ingroup basicwidgets - \mainclass + QDial is used when the user needs to control a value within a program-definable range, and the range either wraps around diff --git a/src/gui/widgets/qdialogbuttonbox.cpp b/src/gui/widgets/qdialogbuttonbox.cpp index 5560367..515efc4 100644 --- a/src/gui/widgets/qdialogbuttonbox.cpp +++ b/src/gui/widgets/qdialogbuttonbox.cpp @@ -57,8 +57,8 @@ QT_BEGIN_NAMESPACE \brief The QDialogButtonBox class is a widget that presents buttons in a layout that is appropriate to the current widget style. - \ingroup application - \mainclass + \ingroup dialog-classes + Dialogs and message boxes typically present buttons in a layout that conforms to the interface guidelines for that platform. Invariably, diff --git a/src/gui/widgets/qdockwidget.cpp b/src/gui/widgets/qdockwidget.cpp index a521921..1193b3e 100644 --- a/src/gui/widgets/qdockwidget.cpp +++ b/src/gui/widgets/qdockwidget.cpp @@ -1069,7 +1069,7 @@ void QDockWidgetPrivate::setWindowState(bool floating, bool unplug, const QRect inside a QMainWindow or floated as a top-level window on the desktop. - \ingroup application + \ingroup mainwindow-classes QDockWidget provides the concept of dock widgets, also know as tool palettes or utility windows. Dock windows are secondary diff --git a/src/gui/widgets/qfocusframe.cpp b/src/gui/widgets/qfocusframe.cpp index 2c88a2e..65dc7d0 100644 --- a/src/gui/widgets/qfocusframe.cpp +++ b/src/gui/widgets/qfocusframe.cpp @@ -118,7 +118,7 @@ void QFocusFrame::initStyleOption(QStyleOption *option) const outside of a widget's normal paintable area. \ingroup basicwidgets - \mainclass + Normally an application will not need to create its own QFocusFrame as QStyle will handle this detail for diff --git a/src/gui/widgets/qfontcombobox.cpp b/src/gui/widgets/qfontcombobox.cpp index 24af989..d3f5bf9 100644 --- a/src/gui/widgets/qfontcombobox.cpp +++ b/src/gui/widgets/qfontcombobox.cpp @@ -276,7 +276,6 @@ void QFontComboBoxPrivate::_q_currentChanged(const QString &text) \since 4.2 \ingroup basicwidgets - \ingroup text The combobox is populated with an alphabetized list of font family names, such as Arial, Helvetica, and Times New Roman. diff --git a/src/gui/widgets/qframe.cpp b/src/gui/widgets/qframe.cpp index a7861ad..62f2ddf 100644 --- a/src/gui/widgets/qframe.cpp +++ b/src/gui/widgets/qframe.cpp @@ -73,7 +73,7 @@ inline void QFramePrivate::init() \brief The QFrame class is the base class of widgets that can have a frame. \ingroup abstractwidgets - \mainclass + QMenu uses this to "raise" the menu above the surrounding screen. QProgressBar has a "sunken" look. QLabel has a flat look. diff --git a/src/gui/widgets/qgroupbox.cpp b/src/gui/widgets/qgroupbox.cpp index 03a08e8..daf92c0 100644 --- a/src/gui/widgets/qgroupbox.cpp +++ b/src/gui/widgets/qgroupbox.cpp @@ -147,8 +147,6 @@ void QGroupBoxPrivate::click() \ingroup organizers \ingroup geomanagement - \ingroup appearance - \mainclass A group box provides a frame, a title and a keyboard shortcut, and displays various other widgets inside itself. The title is on top, diff --git a/src/gui/widgets/qlabel.cpp b/src/gui/widgets/qlabel.cpp index fd97c8f..a9c7e12 100644 --- a/src/gui/widgets/qlabel.cpp +++ b/src/gui/widgets/qlabel.cpp @@ -61,8 +61,6 @@ QT_BEGIN_NAMESPACE \brief The QLabel widget provides a text or image display. \ingroup basicwidgets - \ingroup text - \mainclass QLabel is used for displaying text or an image. No user interaction functionality is provided. The visual appearance of diff --git a/src/gui/widgets/qlcdnumber.cpp b/src/gui/widgets/qlcdnumber.cpp index c4c97ab..d6f5e61 100644 --- a/src/gui/widgets/qlcdnumber.cpp +++ b/src/gui/widgets/qlcdnumber.cpp @@ -74,7 +74,7 @@ public: \brief The QLCDNumber widget displays a number with LCD-like digits. \ingroup basicwidgets - \mainclass + It can display a number in just about any size. It can display decimal, hexadecimal, octal or binary numbers. It is easy to diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index ef6e511..9e15e80 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -128,7 +128,7 @@ void QLineEdit::initStyleOption(QStyleOptionFrame *option) const \brief The QLineEdit widget is a one-line text editor. \ingroup basicwidgets - \mainclass + A line edit allows the user to enter and edit a single line of plain text with a useful collection of editing functions, diff --git a/src/gui/widgets/qlineedit_p.cpp b/src/gui/widgets/qlineedit_p.cpp index 5950d85..cec34da 100644 --- a/src/gui/widgets/qlineedit_p.cpp +++ b/src/gui/widgets/qlineedit_p.cpp @@ -138,6 +138,7 @@ void QLineEditPrivate::init(const QString& txt) { Q_Q(QLineEdit); control = new QLineControl(txt); + control->setFont(q->font()); QObject::connect(control, SIGNAL(textChanged(const QString &)), q, SIGNAL(textChanged(const QString &))); QObject::connect(control, SIGNAL(textEdited(const QString &)), @@ -154,6 +155,8 @@ void QLineEditPrivate::init(const QString& txt) QObject::connect(control, SIGNAL(editFocusChange(bool)), q, SLOT(_q_editFocusChange(bool))); #endif + QObject::connect(control, SIGNAL(cursorPositionChanged(int, int)), + q, SLOT(updateMicroFocus())); // for now, going completely overboard with updates. QObject::connect(control, SIGNAL(selectionChanged()), diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp index 5672d3b..7db800b 100644 --- a/src/gui/widgets/qmainwindow.cpp +++ b/src/gui/widgets/qmainwindow.cpp @@ -73,7 +73,7 @@ class QMainWindowPrivate : public QWidgetPrivate Q_DECLARE_PUBLIC(QMainWindow) public: inline QMainWindowPrivate() - : layout(0), toolButtonStyle(Qt::ToolButtonIconOnly) + : layout(0), explicitIconSize(false), toolButtonStyle(Qt::ToolButtonIconOnly) #ifdef Q_WS_MAC , useHIToolBar(false) #endif @@ -107,8 +107,6 @@ void QMainWindowPrivate::init() layout = new QMainWindowLayout(q); const int metric = q->style()->pixelMetric(QStyle::PM_ToolBarIconSize, 0, q); iconSize = QSize(metric, metric); - explicitIconSize = false; - q->setAttribute(Qt::WA_Hover); } @@ -148,8 +146,8 @@ void QMainWindowPrivate::init() \class QMainWindow \brief The QMainWindow class provides a main application window. - \ingroup application - \mainclass + \ingroup mainwindow-classes + \tableofcontents diff --git a/src/gui/widgets/qmdiarea.cpp b/src/gui/widgets/qmdiarea.cpp index 2390c25..e206bcf 100644 --- a/src/gui/widgets/qmdiarea.cpp +++ b/src/gui/widgets/qmdiarea.cpp @@ -43,8 +43,8 @@ \class QMdiArea \brief The QMdiArea widget provides an area in which MDI windows are displayed. \since 4.3 - \ingroup application - \mainclass + \ingroup mainwindow-classes + QMdiArea functions, essentially, like a window manager for MDI windows. For instance, it draws the windows it manages on itself diff --git a/src/gui/widgets/qmdisubwindow.cpp b/src/gui/widgets/qmdisubwindow.cpp index c645429..d51bd99 100644 --- a/src/gui/widgets/qmdisubwindow.cpp +++ b/src/gui/widgets/qmdisubwindow.cpp @@ -44,8 +44,8 @@ \brief The QMdiSubWindow class provides a subwindow class for QMdiArea. \since 4.3 - \ingroup application - \mainclass + \ingroup mainwindow-classes + QMdiSubWindow represents a top-level window in a QMdiArea, and consists of a title bar with window decorations, an internal widget, and diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index d54200e..69ccae5 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -1207,9 +1207,9 @@ void QMenu::initStyleOption(QStyleOptionMenuItem *option, const QAction *action) \brief The QMenu class provides a menu widget for use in menu bars, context menus, and other popup menus. - \ingroup application + \ingroup mainwindow-classes \ingroup basicwidgets - \mainclass + A menu widget is a selection menu. It can be either a pull-down menu in a menu bar or a standalone context menu. Pull-down menus diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index 8c69843..82b3769 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/gui/widgets/qmenubar.cpp @@ -590,8 +590,7 @@ void QMenuBar::initStyleOption(QStyleOptionMenuItem *option, const QAction *acti \class QMenuBar \brief The QMenuBar class provides a horizontal menu bar. - \ingroup application - \mainclass + \ingroup mainwindow-classes A menu bar consists of a list of pull-down menu items. You add menu items with addMenu(). For example, asuming that \c menubar @@ -715,7 +714,7 @@ void QMenuBar::initStyleOption(QStyleOptionMenuItem *option, const QAction *acti \section1 Examples The \l{mainwindows/menus}{Menus} example shows how to use QMenuBar - and QMenu. The other \l{Qt Examples#Main Windows}{main window + and QMenu. The other \l{Main Window Examples}{main window application examples} also provide menus using these classes. \sa QMenu, QShortcut, QAction, diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp index b365660..20de404 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/gui/widgets/qplaintextedit.cpp @@ -116,8 +116,7 @@ public: \since 4.4 \brief The QPlainTextDocumentLayout class implements a plain text layout for QTextDocument - \ingroup text - + \ingroup richtext-processing A QPlainTextDocumentLayout is required for text documents that can be display or edited in a QPlainTextEdit. See @@ -1013,8 +1012,8 @@ void QPlainTextEditPrivate::ensureViewportLayouted() \brief The QPlainTextEdit class provides a widget that is used to edit and display plain text. - \ingroup text - \mainclass + \ingroup richtext-processing + \tableofcontents diff --git a/src/gui/widgets/qprintpreviewwidget.cpp b/src/gui/widgets/qprintpreviewwidget.cpp index 384d2ca..9544fcf 100644 --- a/src/gui/widgets/qprintpreviewwidget.cpp +++ b/src/gui/widgets/qprintpreviewwidget.cpp @@ -452,7 +452,7 @@ void QPrintPreviewWidgetPrivate::setZoomFactor(qreal _zoomFactor) \brief The QPrintPreviewWidget class provides a widget for previewing page layouts for printer output. - \ingroup multimedia + \ingroup printing QPrintPreviewDialog uses a QPrintPreviewWidget internally, and the purpose of QPrintPreviewWidget is to make it possible to embed the diff --git a/src/gui/widgets/qprogressbar.cpp b/src/gui/widgets/qprogressbar.cpp index b35b9d3..9f91cf7 100644 --- a/src/gui/widgets/qprogressbar.cpp +++ b/src/gui/widgets/qprogressbar.cpp @@ -172,7 +172,7 @@ bool QProgressBarPrivate::repaintRequired() const \brief The QProgressBar widget provides a horizontal or vertical progress bar. \ingroup basicwidgets - \mainclass + A progress bar is used to give the user an indication of the progress of an operation and to reassure them that the application diff --git a/src/gui/widgets/qpushbutton.cpp b/src/gui/widgets/qpushbutton.cpp index 94b39e0..f991620 100644 --- a/src/gui/widgets/qpushbutton.cpp +++ b/src/gui/widgets/qpushbutton.cpp @@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE \brief The QPushButton widget provides a command button. \ingroup basicwidgets - \mainclass + The push button, or command button, is perhaps the most commonly used widget in any graphical user interface. Push (click) a button diff --git a/src/gui/widgets/qradiobutton.cpp b/src/gui/widgets/qradiobutton.cpp index feada97..4b5cead 100644 --- a/src/gui/widgets/qradiobutton.cpp +++ b/src/gui/widgets/qradiobutton.cpp @@ -80,7 +80,7 @@ void QRadioButtonPrivate::init() \brief The QRadioButton widget provides a radio button with a text label. \ingroup basicwidgets - \mainclass + A QRadioButton is an option button that can be switched on (checked) or off (unchecked). Radio buttons typically present the user with a "one diff --git a/src/gui/widgets/qrubberband.cpp b/src/gui/widgets/qrubberband.cpp index 5b61bd4..a04bc55 100644 --- a/src/gui/widgets/qrubberband.cpp +++ b/src/gui/widgets/qrubberband.cpp @@ -98,9 +98,6 @@ void QRubberBand::initStyleOption(QStyleOptionRubberBand *option) const \brief The QRubberBand class provides a rectangle or line that can indicate a selection or a boundary. - \ingroup misc - \mainclass - A rubber band is often used to show a new bounding area (as in a QSplitter or a QDockWidget that is undocking). Historically this has been implemented using a QPainter and XOR, but this approach diff --git a/src/gui/widgets/qscrollarea.cpp b/src/gui/widgets/qscrollarea.cpp index 32d3c2b..31e558b 100644 --- a/src/gui/widgets/qscrollarea.cpp +++ b/src/gui/widgets/qscrollarea.cpp @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE another widget. \ingroup basicwidgets - \mainclass + A scroll area is used to display the contents of a child widget within a frame. If the widget exceeds the size of the frame, the diff --git a/src/gui/widgets/qscrollbar.cpp b/src/gui/widgets/qscrollbar.cpp index 390d1b8..37525e2 100644 --- a/src/gui/widgets/qscrollbar.cpp +++ b/src/gui/widgets/qscrollbar.cpp @@ -431,6 +431,12 @@ void QScrollBarPrivate::init() q->setSizePolicy(sp); q->setAttribute(Qt::WA_WState_OwnSizePolicy, false); q->setAttribute(Qt::WA_OpaquePaintEvent); + +#if !defined(QT_NO_CONTEXTMENU) && defined(Q_WS_WINCE) + if (!q->style()->styleHint(QStyle::SH_ScrollBar_ContextMenu, 0, q)) { + q->setContextMenuPolicy(Qt::PreventContextMenu); + } +#endif } #ifndef QT_NO_CONTEXTMENU diff --git a/src/gui/widgets/qsizegrip.cpp b/src/gui/widgets/qsizegrip.cpp index 080e328..8a1a0e6 100644 --- a/src/gui/widgets/qsizegrip.cpp +++ b/src/gui/widgets/qsizegrip.cpp @@ -165,9 +165,8 @@ Qt::Corner QSizeGripPrivate::corner() const \brief The QSizeGrip class provides a resize handle for resizing top-level windows. - \ingroup application + \ingroup mainwindow-classes \ingroup basicwidgets - \ingroup appearance This widget works like the standard Windows resize handle. In the X11 version this resize handle generally works differently from diff --git a/src/gui/widgets/qslider.cpp b/src/gui/widgets/qslider.cpp index 0b7e7c1..d9c98e1 100644 --- a/src/gui/widgets/qslider.cpp +++ b/src/gui/widgets/qslider.cpp @@ -203,7 +203,7 @@ QStyle::SubControl QSliderPrivate::newHoverControl(const QPoint &pos) \brief The QSlider widget provides a vertical or horizontal slider. \ingroup basicwidgets - \mainclass + The slider is the classic widget for controlling a bounded value. It lets the user move a slider handle along a horizontal or vertical diff --git a/src/gui/widgets/qspinbox.cpp b/src/gui/widgets/qspinbox.cpp index 563d18b..e6a4265 100644 --- a/src/gui/widgets/qspinbox.cpp +++ b/src/gui/widgets/qspinbox.cpp @@ -113,7 +113,7 @@ public: \brief The QSpinBox class provides a spin box widget. \ingroup basicwidgets - \mainclass + QSpinBox is designed to handle integers and discrete sets of values (e.g., month names); use QDoubleSpinBox for floating point @@ -534,7 +534,7 @@ void QSpinBox::fixup(QString &input) const takes doubles. \ingroup basicwidgets - \mainclass + QDoubleSpinBox allows the user to choose a value by clicking the up and down buttons or by pressing Up or Down on the keyboard to diff --git a/src/gui/widgets/qsplashscreen.cpp b/src/gui/widgets/qsplashscreen.cpp index e4f7307..2357164 100644 --- a/src/gui/widgets/qsplashscreen.cpp +++ b/src/gui/widgets/qsplashscreen.cpp @@ -72,9 +72,6 @@ public: \brief The QSplashScreen widget provides a splash screen that can be shown during application startup. - \ingroup misc - \mainclass - A splash screen is a widget that is usually displayed when an application is being started. Splash screens are often used for applications that have long start up times (e.g. database or diff --git a/src/gui/widgets/qsplitter.cpp b/src/gui/widgets/qsplitter.cpp index 98cf2a8..0aa89f4 100644 --- a/src/gui/widgets/qsplitter.cpp +++ b/src/gui/widgets/qsplitter.cpp @@ -931,7 +931,7 @@ QSplitterLayoutStruct *QSplitterPrivate::insertWidget(int index, QWidget *w) \brief The QSplitter class implements a splitter widget. \ingroup organizers - \mainclass + A splitter lets the user control the size of child widgets by dragging the boundary between the children. Any number of widgets may be controlled by a diff --git a/src/gui/widgets/qstackedwidget.cpp b/src/gui/widgets/qstackedwidget.cpp index da942d1..7dedf4a 100644 --- a/src/gui/widgets/qstackedwidget.cpp +++ b/src/gui/widgets/qstackedwidget.cpp @@ -65,8 +65,7 @@ public: \ingroup organizers \ingroup geomanagement - \ingroup appearance - \mainclass + QStackedWidget can be used to create a user interface similar to the one provided by QTabWidget. It is a convenience layout widget diff --git a/src/gui/widgets/qstatusbar.cpp b/src/gui/widgets/qstatusbar.cpp index ed2d5d8..eb58c61 100644 --- a/src/gui/widgets/qstatusbar.cpp +++ b/src/gui/widgets/qstatusbar.cpp @@ -158,9 +158,9 @@ QRect QStatusBarPrivate::messageRect() const \brief The QStatusBar class provides a horizontal bar suitable for presenting status information. - \ingroup application + \ingroup mainwindow-classes \ingroup helpsystem - \mainclass + Each status indicator falls into one of three categories: diff --git a/src/gui/widgets/qtabbar.cpp b/src/gui/widgets/qtabbar.cpp index 410c26f..5166390 100644 --- a/src/gui/widgets/qtabbar.cpp +++ b/src/gui/widgets/qtabbar.cpp @@ -192,7 +192,7 @@ void QTabBar::initStyleOption(QStyleOptionTab *option, int tabIndex) const \brief The QTabBar class provides a tab bar, e.g. for use in tabbed dialogs. \ingroup basicwidgets - \mainclass + QTabBar is straightforward to use; it draws the tabs using one of the predefined \link QTabBar::Shape shapes\endlink, and emits a diff --git a/src/gui/widgets/qtabwidget.cpp b/src/gui/widgets/qtabwidget.cpp index 6828c50..14a554a 100644 --- a/src/gui/widgets/qtabwidget.cpp +++ b/src/gui/widgets/qtabwidget.cpp @@ -64,7 +64,7 @@ QT_BEGIN_NAMESPACE \ingroup organizers \ingroup basicwidgets - \mainclass + A tab widget provides a tab bar (see QTabBar) and a "page area" that is used to display pages related to each tab. By default, the diff --git a/src/gui/widgets/qtextbrowser.cpp b/src/gui/widgets/qtextbrowser.cpp index 803b6fb..7a67a8d 100644 --- a/src/gui/widgets/qtextbrowser.cpp +++ b/src/gui/widgets/qtextbrowser.cpp @@ -580,7 +580,7 @@ void QTextBrowserPrivate::restoreHistoryEntry(const HistoryEntry entry) \class QTextBrowser \brief The QTextBrowser class provides a rich text browser with hypertext navigation. - \ingroup text + \ingroup richtext-processing This class extends QTextEdit (in read-only mode), adding some navigation functionality so that users can follow links in hypertext documents. diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp index b0159b3..bedb3b6 100644 --- a/src/gui/widgets/qtextedit.cpp +++ b/src/gui/widgets/qtextedit.cpp @@ -338,8 +338,8 @@ void QTextEditPrivate::_q_ensureVisible(const QRectF &_rect) \brief The QTextEdit class provides a widget that is used to edit and display both plain and rich text. - \ingroup text - \mainclass + \ingroup richtext-processing + \tableofcontents diff --git a/src/gui/widgets/qtoolbar.cpp b/src/gui/widgets/qtoolbar.cpp index 37c7998..ef0847b 100644 --- a/src/gui/widgets/qtoolbar.cpp +++ b/src/gui/widgets/qtoolbar.cpp @@ -412,8 +412,8 @@ void QToolBarPrivate::plug(const QRect &r) \brief The QToolBar class provides a movable panel that contains a set of controls. - \ingroup application - \mainclass + \ingroup mainwindow-classes + Toolbar buttons are added by adding \e actions, using addAction() or insertAction(). Groups of buttons can be separated using diff --git a/src/gui/widgets/qtoolbox.cpp b/src/gui/widgets/qtoolbox.cpp index 803c6ab..378ed17 100644 --- a/src/gui/widgets/qtoolbox.cpp +++ b/src/gui/widgets/qtoolbox.cpp @@ -252,7 +252,7 @@ void QToolBoxButton::paintEvent(QPaintEvent *) \brief The QToolBox class provides a column of tabbed widget items. - \mainclass + \ingroup basicwidgets A toolbox is a widget that displays a column of tabs one above the diff --git a/src/gui/widgets/qtoolbutton.cpp b/src/gui/widgets/qtoolbutton.cpp index bb8c32f..4ca3d62 100644 --- a/src/gui/widgets/qtoolbutton.cpp +++ b/src/gui/widgets/qtoolbutton.cpp @@ -116,7 +116,7 @@ bool QToolButtonPrivate::hasMenu() const commands or options, usually used inside a QToolBar. \ingroup basicwidgets - \mainclass + A tool button is a special button that provides quick-access to specific commands or options. As opposed to a normal command diff --git a/src/gui/widgets/qvalidator.cpp b/src/gui/widgets/qvalidator.cpp index 7db0247..8f43097 100644 --- a/src/gui/widgets/qvalidator.cpp +++ b/src/gui/widgets/qvalidator.cpp @@ -55,9 +55,6 @@ QT_BEGIN_NAMESPACE \class QValidator \brief The QValidator class provides validation of input text. - \ingroup misc - \mainclass - The class itself is abstract. Two subclasses, \l QIntValidator and \l QDoubleValidator, provide basic numeric-range checking, and \l QRegExpValidator provides general checking using a custom regular @@ -246,8 +243,6 @@ void QValidator::fixup(QString &) const \brief The QIntValidator class provides a validator that ensures a string contains a valid integer within a specified range. - \ingroup misc - Example of use: \snippet doc/src/snippets/code/src_gui_widgets_qvalidator.cpp 0 @@ -497,8 +492,6 @@ public: \brief The QDoubleValidator class provides range checking of floating-point numbers. - \ingroup misc - QDoubleValidator provides an upper bound, a lower bound, and a limit on the number of digits after the decimal point. It does not provide a fixup() function. @@ -767,8 +760,6 @@ QDoubleValidator::Notation QDoubleValidator::notation() const \brief The QRegExpValidator class is used to check a string against a regular expression. - \ingroup misc - QRegExpValidator uses a regular expression (regexp) to determine whether an input string is \l Acceptable, \l Intermediate, or \l Invalid. The regexp can either be supplied diff --git a/src/gui/widgets/qworkspace.cpp b/src/gui/widgets/qworkspace.cpp index d8bcf9b..cd98671 100644 --- a/src/gui/widgets/qworkspace.cpp +++ b/src/gui/widgets/qworkspace.cpp @@ -834,7 +834,6 @@ QSize QWorkspaceTitleBar::sizeHint() const \obsolete \brief The QWorkspace widget provides a workspace window that can be used in an MDI application. - \ingroup application This class is deprecated. Use QMdiArea instead. |