summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/dialogs/qpagesetupdialog_win.cpp4
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp64
-rw-r--r--src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp3
-rw-r--r--src/gui/graphicsview/qgraphicssceneindex.cpp19
-rw-r--r--src/gui/graphicsview/qgraphicsscenelinearindex.cpp57
-rw-r--r--src/gui/itemviews/qtreeview.cpp24
-rw-r--r--src/gui/kernel/qapplication_win.cpp2
-rw-r--r--src/gui/kernel/qapplication_x11.cpp4
-rw-r--r--src/gui/kernel/qwidget_win.cpp2
-rw-r--r--src/gui/painting/qregion_win.cpp2
-rw-r--r--src/gui/text/qfontdatabase_win.cpp2
-rw-r--r--src/gui/widgets/qspinbox.cpp4
12 files changed, 130 insertions, 57 deletions
diff --git a/src/gui/dialogs/qpagesetupdialog_win.cpp b/src/gui/dialogs/qpagesetupdialog_win.cpp
index a84a7ce..3f2fb34 100644
--- a/src/gui/dialogs/qpagesetupdialog_win.cpp
+++ b/src/gui/dialogs/qpagesetupdialog_win.cpp
@@ -78,8 +78,8 @@ int QPageSetupDialog::exec()
psd.lStructSize = sizeof(PAGESETUPDLG);
// we need a temp DEVMODE struct if we don't have a global DEVMODE
- HGLOBAL hDevMode;
- int devModeSize;
+ HGLOBAL hDevMode = 0;
+ int devModeSize = 0;
if (!ep->globalDevMode) {
devModeSize = sizeof(DEVMODE) + ep->devMode->dmDriverExtra;
hDevMode = GlobalAlloc(GHND, devModeSize);
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 06333ae..6b6080b 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -1626,6 +1626,20 @@ QList<QGraphicsItem *> QGraphicsScene::items(const QRectF &rect, Qt::ItemSelecti
*/
/*!
+ \fn QList<QGraphicsItem *> QGraphicsScene::items(qreal x, qreal y, qreal w, qreal h,
+ Qt::ItemSelectionMode mode, Qt::SortOrder order, const QTransform &deviceTransform) const
+ \overload
+ \since 4.6
+
+ Returns all visible items that, depending on \a mode, are either inside or
+ intersect with the rectangle defined by \a x, \a y, \a w and \a h, in a list
+ sorted using \a order.
+
+ \a deviceTransform is the transformation that applies to the view, and needs to
+ be provided if the scene contains items that ignore transformations.
+*/
+
+/*!
\overload
Returns all visible items that, depending on \a mode, are either inside or
@@ -1660,13 +1674,16 @@ QList<QGraphicsItem *> QGraphicsScene::items(const QPainterPath &path, Qt::ItemS
}
/*!
+ \since 4.6
+
Returns all visible items that, depending on \a mode, are at the specified \a pos
- and return a list sorted using \a order.
+ in a list sorted using \a order.
The default value for \a mode is Qt::IntersectsItemShape; all items whose
exact shape intersects with \a pos are returned.
- \a deviceTransform is the transformation apply to the view.
+ \a deviceTransform is the transformation that applies to the view, and needs to
+ be provided if the scene contains items that ignore transformations.
\sa itemAt()
*/
@@ -1679,6 +1696,7 @@ QList<QGraphicsItem *> QGraphicsScene::items(const QPointF &pos, Qt::ItemSelecti
/*!
\overload
+ \since 4.6
Returns all visible items that, depending on \a mode, are either inside or
intersect with the specified \a rect and return a list sorted using \a order.
@@ -1686,7 +1704,8 @@ QList<QGraphicsItem *> QGraphicsScene::items(const QPointF &pos, Qt::ItemSelecti
The default value for \a mode is Qt::IntersectsItemShape; all items whose
exact shape intersects with or is contained by \a rect are returned.
- \a deviceTransform is the transformation apply to the view.
+ \a deviceTransform is the transformation that applies to the view, and needs to
+ be provided if the scene contains items that ignore transformations.
\sa itemAt()
*/
@@ -1699,6 +1718,7 @@ QList<QGraphicsItem *> QGraphicsScene::items(const QRectF &rect, Qt::ItemSelecti
/*!
\overload
+ \since 4.6
Returns all visible items that, depending on \a mode, are either inside or
intersect with the specified \a polygon and return a list sorted using \a order.
@@ -1706,7 +1726,8 @@ QList<QGraphicsItem *> QGraphicsScene::items(const QRectF &rect, Qt::ItemSelecti
The default value for \a mode is Qt::IntersectsItemShape; all items whose
exact shape intersects with or is contained by \a polygon are returned.
- \a deviceTransform is the transformation apply to the view.
+ \a deviceTransform is the transformation that applies to the view, and needs to
+ be provided if the scene contains items that ignore transformations.
\sa itemAt()
*/
@@ -1718,7 +1739,8 @@ QList<QGraphicsItem *> QGraphicsScene::items(const QPolygonF &polygon, Qt::ItemS
}
/*!
- \overload
+ \overload
+ \since 4.6
Returns all visible items that, depending on \a mode, are either inside or
intersect with the specified \a path and return a list sorted using \a order.
@@ -1726,7 +1748,8 @@ QList<QGraphicsItem *> QGraphicsScene::items(const QPolygonF &polygon, Qt::ItemS
The default value for \a mode is Qt::IntersectsItemShape; all items whose
exact shape intersects with or is contained by \a path are returned.
- \a deviceTransform is the transformation apply to the view.
+ \a deviceTransform is the transformation that applies to the view, and needs to
+ be provided if the scene contains items that ignore transformations.
\sa itemAt()
*/
@@ -1767,8 +1790,6 @@ QList<QGraphicsItem *> QGraphicsScene::collidingItems(const QGraphicsItem *item,
}
/*!
- \fn QGraphicsItem *QGraphicsScene::itemAt(const QPointF &position) const
-
Returns the topmost visible item at the specified \a position, or 0 if
there are no items at this position.
@@ -1776,15 +1797,29 @@ QList<QGraphicsItem *> QGraphicsScene::collidingItems(const QGraphicsItem *item,
\sa items(), collidingItems(), QGraphicsItem::setZValue()
*/
-QGraphicsItem *QGraphicsScene::itemAt(const QPointF &pos) const
+QGraphicsItem *QGraphicsScene::itemAt(const QPointF &position) const
{
- QList<QGraphicsItem *> itemsAtPoint = items(pos);
+ QList<QGraphicsItem *> itemsAtPoint = items(position);
return itemsAtPoint.isEmpty() ? 0 : itemsAtPoint.first();
}
-QGraphicsItem *QGraphicsScene::itemAt(const QPointF &pos, const QTransform &deviceTransform) const
+/*!
+ \overload
+ \since 4.6
+
+ Returns the topmost visible item at the specified \a position, or 0
+ if there are no items at this position.
+
+ \a deviceTransform is the transformation that applies to the view, and needs to
+ be provided if the scene contains items that ignore transformations.
+
+ \note The topmost item is the one with the highest Z-value.
+
+ \sa items(), collidingItems(), QGraphicsItem::setZValue()
+ */
+QGraphicsItem *QGraphicsScene::itemAt(const QPointF &position, const QTransform &deviceTransform) const
{
- QList<QGraphicsItem *> itemsAtPoint = items(pos, Qt::IntersectsItemShape,
+ QList<QGraphicsItem *> itemsAtPoint = items(position, Qt::IntersectsItemShape,
Qt::AscendingOrder, deviceTransform);
return itemsAtPoint.isEmpty() ? 0 : itemsAtPoint.first();
}
@@ -1869,11 +1904,14 @@ void QGraphicsScene::setSelectionArea(const QPainterPath &path, Qt::ItemSelectio
/*!
\overload
- \since 4.3
+ \since 4.6
Sets the selection area to \a path using \a mode to determine if items are
included in the selection area.
+ \a deviceTransform is the transformation that applies to the view, and needs to
+ be provided if the scene contains items that ignore transformations.
+
\sa clearSelection(), selectionArea()
*/
void QGraphicsScene::setSelectionArea(const QPainterPath &path, Qt::ItemSelectionMode mode,
diff --git a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp
index a54ade9..c409a9e 100644
--- a/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp
+++ b/src/gui/graphicsview/qgraphicsscenebsptreeindex.cpp
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -542,6 +542,7 @@ void QGraphicsSceneBspTreeIndex::clear()
d->indexedItems.clear();
d->unindexedItems.clear();
d->untransformableItems.clear();
+ d->regenerateIndex = true;
}
/*!
diff --git a/src/gui/graphicsview/qgraphicssceneindex.cpp b/src/gui/graphicsview/qgraphicssceneindex.cpp
index 01efde4..ab5ca85 100644
--- a/src/gui/graphicsview/qgraphicssceneindex.cpp
+++ b/src/gui/graphicsview/qgraphicssceneindex.cpp
@@ -34,7 +34,7 @@
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
-** contact the sales department at qt-sales@nokia.com.
+** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -553,20 +553,9 @@ QList<QGraphicsItem *> QGraphicsSceneIndex::estimateTopLevelItems(const QRectF &
}
/*!
- \fn virtual QList<QGraphicsItem *>
- QGraphicsSceneIndex::estimateItems(const QRectF &rect, Qt::SortOrder
- order, const QTransform &deviceTransform) const = 0
-
- This pure virtual function return an estimation of items in the \a rect.
- This method return a list sorted using \a order.
-
- \a deviceTransform is the transformation apply to the view.
-*/
-
-/*!
- \fn virtual QList<QGraphicsItem *>
- QGraphicsSceneIndex::items(Qt::SortOrder order = Qt::AscendingOrder) const
- = 0; This pure virtual function all items in the index and sort them using
+ \fn QList<QGraphicsItem *> QGraphicsSceneIndex::items(Qt::SortOrder order = Qt::AscendingOrder) const
+
+ This pure virtual function all items in the index and sort them using
\a order.
*/
diff --git a/src/gui/graphicsview/qgraphicsscenelinearindex.cpp b/src/gui/graphicsview/qgraphicsscenelinearindex.cpp
index 5e6ac30..45cf702 100644
--- a/src/gui/graphicsview/qgraphicsscenelinearindex.cpp
+++ b/src/gui/graphicsview/qgraphicsscenelinearindex.cpp
@@ -1,11 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module 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://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
/*!
\class QGraphicsSceneLinearIndex
\brief The QGraphicsSceneLinearIndex class provides an implementation of
a linear indexing algorithm for discovering items in QGraphicsScene.
\since 4.6
- \ingroup multimedia
\ingroup graphicsview-api
- \mainclass
\internal
QGraphicsSceneLinearIndex index is default linear implementation to discover items.
@@ -30,32 +69,26 @@
/*!
- \fn virtual QList<QGraphicsItem *> QGraphicsSceneLinearIndex::estimateItems(const QRectF &rect, Qt::SortOrder order) const;
+ \fn virtual QList<QGraphicsItem *> QGraphicsSceneLinearIndex::estimateItems(const QRectF &rect, Qt::SortOrder order) const
Returns an estimation visible items that are either inside or
intersect with the specified \a rect and return a list sorted using \a order.
*/
/*!
- \fn QRectF QGraphicsSceneLinearIndex::indexedRect() const;
- \reimp
- Return the rect indexed by the the index.
-*/
-
-/*!
- \fn void QGraphicsSceneLinearIndex::clear();
+ \fn void QGraphicsSceneLinearIndex::clear()
\reimp
Clear the all the BSP index.
*/
/*!
- \fn virtual void QGraphicsSceneLinearIndex::addItem(QGraphicsItem *item);
+ \fn virtual void QGraphicsSceneLinearIndex::addItem(QGraphicsItem *item)
Add the \a item into the index.
*/
/*!
- \fn virtual void QGraphicsSceneLinearIndex::removeItem(QGraphicsItem *item);
+ \fn virtual void QGraphicsSceneLinearIndex::removeItem(QGraphicsItem *item)
Add the \a item from the index.
*/
diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp
index 7084e6d..f7fa3ad 100644
--- a/src/gui/itemviews/qtreeview.cpp
+++ b/src/gui/itemviews/qtreeview.cpp
@@ -1095,18 +1095,22 @@ void QTreeView::scrollTo(const QModelIndex &index, ScrollHint hint)
} else if (hint == PositionAtTop || (hint == EnsureVisible && item < top)) {
verticalScrollBar()->setValue(item);
} else { // PositionAtBottom or PositionAtCenter
- int itemLocation = item;
+ const int currentItemHeight = d->itemHeight(item);
int y = (hint == PositionAtCenter
- ? area.height() / 2
+ //we center on the current item with a preference to the top item (ie. -1)
+ ? area.height() / 2 + currentItemHeight - 1
+ //otherwise we simply take the whole space
: area.height());
- while (y > 0 && item > 0)
- y -= d->itemHeight(item--);
- // end up half over the top of the area
- if (y < 0 && item < itemLocation)
- ++item;
- // end up half over the bottom of the area
- if (item >= 0 && item < itemLocation)
- ++item;
+ if (y > currentItemHeight) {
+ while (item >= 0) {
+ y -= d->itemHeight(item);
+ if (y < 0) { //there is no more space left
+ item++;
+ break;
+ }
+ item--;
+ }
+ }
verticalScrollBar()->setValue(item);
}
} else { // ScrollPerPixel
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index 243e361..ed219cd 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -1009,6 +1009,8 @@ const QString qt_reg_winclass(QWidget *w) // register window class
#ifndef QT_NO_DEBUG
if (!atom)
qErrnoWarning("QApplication::regClass: Registering window class failed.");
+#else
+ Q_UNUSED(atom);
#endif
winclassNames()->insert(cname, 1);
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp
index 5ef6b2e..cc41299 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -117,7 +117,9 @@ extern "C" {
#define XK_MISCELLANY
#include <X11/keysymdef.h>
+#if !defined(QT_NO_XINPUT)
#include <X11/extensions/XI.h>
+#endif
#include <stdlib.h>
#include <string.h>
@@ -655,11 +657,13 @@ static int qt_x_errhandler(Display *dpy, XErrorEvent *err)
break;
default:
+#if !defined(QT_NO_XINPUT)
if (err->request_code == X11->xinput_major
&& err->error_code == (X11->xinput_errorbase + XI_BadDevice)
&& err->minor_code == 3 /* X_OpenDevice */) {
return 0;
}
+#endif
break;
}
diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp
index dcf541c..46fa3be 100644
--- a/src/gui/kernel/qwidget_win.cpp
+++ b/src/gui/kernel/qwidget_win.cpp
@@ -264,7 +264,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
HINSTANCE appinst = qWinAppInst();
HWND parentw, destroyw = 0;
- WId id;
+ WId id = 0;
QString windowClassName = qt_reg_winclass(q);
diff --git a/src/gui/painting/qregion_win.cpp b/src/gui/painting/qregion_win.cpp
index 873439e..249b1a6 100644
--- a/src/gui/painting/qregion_win.cpp
+++ b/src/gui/painting/qregion_win.cpp
@@ -59,7 +59,7 @@ HRGN qt_tryCreateRegion(QRegion::RegionType type, int left, int top, int right,
{
const int tries = 10;
for (int i = 0; i < tries; ++i) {
- HRGN region;
+ HRGN region = 0;
switch (type) {
case QRegion::Rectangle:
region = CreateRectRgn(left, top, right, bottom);
diff --git a/src/gui/text/qfontdatabase_win.cpp b/src/gui/text/qfontdatabase_win.cpp
index 2e8e5e4..974b955 100644
--- a/src/gui/text/qfontdatabase_win.cpp
+++ b/src/gui/text/qfontdatabase_win.cpp
@@ -1026,6 +1026,8 @@ static void getFamiliesAndSignatures(const QByteArray &fontData, QFontDatabasePr
signature.fsCsb[0] = qFromBigEndian<quint32>(table + 78);
signature.fsCsb[1] = qFromBigEndian<quint32>(table + 82);
+ } else {
+ memset(&signature, 0, sizeof(signature));
}
appFont->signatures << signature;
}
diff --git a/src/gui/widgets/qspinbox.cpp b/src/gui/widgets/qspinbox.cpp
index 3933272..7441df4 100644
--- a/src/gui/widgets/qspinbox.cpp
+++ b/src/gui/widgets/qspinbox.cpp
@@ -1206,7 +1206,7 @@ bool QDoubleSpinBoxPrivate::isIntermediateValue(const QString &str) const
return false;
}
if (doright) {
- QSBDEBUG("match %lld min_left %lld max_left %lld", match, min_left, max_left);
+ QSBDEBUG() << "match" << match << "min_left" << min_left << "max_left" << max_left;
if (!doleft) {
if (min_left == max_left) {
const bool ret = isIntermediateValueHelper(qAbs(left),
@@ -1473,7 +1473,7 @@ QString QDoubleSpinBoxPrivate::textFromValue(const QVariant &f) const
static bool isIntermediateValueHelper(qint64 num, qint64 min, qint64 max, qint64 *match)
{
- QSBDEBUG("%lld %lld %lld", num, min, max);
+ QSBDEBUG() << num << min << max;
if (num >= min && num <= max) {
if (match)