summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorMorten Sørvig <msorvig@trolltech.com>2009-06-16 11:20:15 (GMT)
committerMorten Sørvig <msorvig@trolltech.com>2009-06-16 11:20:15 (GMT)
commitc41591d57377cd7c520efc93d9c087ad34d2bb6f (patch)
tree975a8573da68b3f9bd169ecf607f7492f723a003 /src/gui
parent1e6b142fa2833f55972d6d4aa7dde0bb215c2f25 (diff)
parentacc764552c552df31719af561e285886085371e9 (diff)
downloadQt-c41591d57377cd7c520efc93d9c087ad34d2bb6f.zip
Qt-c41591d57377cd7c520efc93d9c087ad34d2bb6f.tar.gz
Qt-c41591d57377cd7c520efc93d9c087ad34d2bb6f.tar.bz2
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp13
-rw-r--r--src/gui/kernel/qapplication_x11.cpp17
-rw-r--r--src/gui/kernel/qt_x11_p.h2
-rw-r--r--src/gui/kernel/qwidget.cpp2
-rw-r--r--src/gui/math3d/qgenericmatrix.cpp2
-rw-r--r--src/gui/painting/qregion.cpp4
-rw-r--r--src/gui/styles/qproxystyle.cpp15
-rw-r--r--src/gui/styles/qstyle.cpp27
-rw-r--r--src/gui/widgets/qplaintextedit.cpp1
-rw-r--r--src/gui/widgets/qtextedit.cpp1
10 files changed, 46 insertions, 38 deletions
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 38a1abe..1340adf 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -5282,11 +5282,14 @@ void QGraphicsScenePrivate::markDirty(QGraphicsItem *item, const QRectF &rect, b
return;
}
- item->d_ptr->dirty = 1;
- if (fullItemUpdate)
- item->d_ptr->fullUpdatePending = 1;
- else if (!item->d_ptr->fullUpdatePending)
- item->d_ptr->needsRepaint |= rect;
+ bool hasNoContents = item->d_ptr->flags & QGraphicsItem::ItemHasNoContents;
+ if (!hasNoContents) {
+ item->d_ptr->dirty = 1;
+ if (fullItemUpdate)
+ item->d_ptr->fullUpdatePending = 1;
+ else if (!item->d_ptr->fullUpdatePending)
+ item->d_ptr->needsRepaint |= rect;
+ }
if (invalidateChildren) {
item->d_ptr->allChildrenDirty = 1;
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp
index 7387fb0..8526760 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -128,7 +128,7 @@ extern "C" {
#include <private/qbackingstore_p.h>
-#if defined(Q_OS_BSD4) || _POSIX_VERSION+0 < 200112L
+#if _POSIX_VERSION+0 < 200112L && !defined(Q_OS_BSD4)
# define QT_NO_UNSETENV
#endif
@@ -1761,7 +1761,7 @@ void qt_init(QApplicationPrivate *priv, int,
X11->pattern_fills[i].screen = -1;
#endif
- X11->startupId = X11->originalStartupId = X11->startupIdString = 0;
+ X11->startupId = 0;
int argc = priv->argc;
char **argv = priv->argv;
@@ -2559,15 +2559,13 @@ void qt_init(QApplicationPrivate *priv, int,
#endif // QT_NO_TABLET
X11->startupId = getenv("DESKTOP_STARTUP_ID");
- X11->originalStartupId = X11->startupId;
if (X11->startupId) {
#ifndef QT_NO_UNSETENV
unsetenv("DESKTOP_STARTUP_ID");
#else
// it's a small memory leak, however we won't crash if Qt is
// unloaded and someones tries to use the envoriment.
- X11->startupIdString = strdup("DESKTOP_STARTUP_ID=");
- putenv(X11->startupIdString);
+ putenv(strdup("DESKTOP_STARTUP_ID="));
#endif
}
} else {
@@ -2701,15 +2699,6 @@ void qt_cleanup()
#endif
}
-#ifdef QT_NO_UNSETENV
- // restore original value back.
- if (X11->originalStartupId && X11->startupIdString) {
- putenv(X11->originalStartupId);
- free(X11->startupIdString);
- X11->startupIdString = 0;
- }
-#endif
-
#ifndef QT_NO_XRENDER
for (int i = 0; i < X11->solid_fill_count; ++i) {
if (X11->solid_fills[i].picture)
diff --git a/src/gui/kernel/qt_x11_p.h b/src/gui/kernel/qt_x11_p.h
index b480f34..3493a8b 100644
--- a/src/gui/kernel/qt_x11_p.h
+++ b/src/gui/kernel/qt_x11_p.h
@@ -506,8 +506,6 @@ struct QX11Data
int fc_hint_style;
char *startupId;
- char *originalStartupId;
- char *startupIdString;
DesktopEnvironment desktopEnvironment;
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index db73c07..eed873a 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -5635,7 +5635,7 @@ bool QWidget::hasFocus() const
called from focusOutEvent() or focusInEvent(), you may get an
infinite recursion.
- \sa focus(), hasFocus(), clearFocus(), focusInEvent(), focusOutEvent(),
+ \sa hasFocus(), clearFocus(), focusInEvent(), focusOutEvent(),
setFocusPolicy(), focusWidget(), QApplication::focusWidget(), grabKeyboard(),
grabMouse(), {Keyboard Focus}
*/
diff --git a/src/gui/math3d/qgenericmatrix.cpp b/src/gui/math3d/qgenericmatrix.cpp
index 747b012..82be256 100644
--- a/src/gui/math3d/qgenericmatrix.cpp
+++ b/src/gui/math3d/qgenericmatrix.cpp
@@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE
But they can be different if the user wants to store elements
internally in a fixed-point format for the underlying hardware.
- \sa QMatrix4x4, QFixedPoint
+ \sa QMatrix4x4
*/
/*!
diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp
index c4cd77a..03e01c9 100644
--- a/src/gui/painting/qregion.cpp
+++ b/src/gui/painting/qregion.cpp
@@ -698,6 +698,8 @@ bool QRegion::intersects(const QRegion &region) const
if (!rect_intersects(boundingRect(), region.boundingRect()))
return false;
+ if (numRects() == 1 && region.numRects() == 1)
+ return true;
const QVector<QRect> myRects = rects();
const QVector<QRect> otherRects = region.rects();
@@ -723,6 +725,8 @@ bool QRegion::intersects(const QRect &rect) const
const QRect r = rect.normalized();
if (!rect_intersects(boundingRect(), r))
return false;
+ if (numRects() == 1)
+ return true;
const QVector<QRect> myRects = rects();
for (QVector<QRect>::const_iterator it = myRects.constBegin(); it < myRects.constEnd(); ++it)
diff --git a/src/gui/styles/qproxystyle.cpp b/src/gui/styles/qproxystyle.cpp
index 853dcd1..94269b0 100644
--- a/src/gui/styles/qproxystyle.cpp
+++ b/src/gui/styles/qproxystyle.cpp
@@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE
Below is an example that overrides the shortcut underline
behavior on all platforms:
- \snippet doc/src/snippets/code/src_gui_qproxystyle.cpp 0
+ \snippet doc/src/snippets/code/src_gui_qproxystyle.cpp 1
Warning: Although Qt's internal styles should respect this hint,
there is no guarantee that it will work for all styles. It would
@@ -372,11 +372,14 @@ bool QProxyStyle::event(QEvent *e)
Returns an icon for the given \a standardIcon.
Reimplement this slot to provide your own icons in a QStyle
- subclass; because of binary compatibility constraints, the
- standardIcon() function (introduced in Qt 4.1) is not
- virtual. Instead, standardIcon() will dynamically detect and call \e
- this slot. The default implementation simply calls the
- standardPixmap() function with the given parameters.
+ subclass. The \a option argument can be used to pass extra
+ information required to find the appropriate icon. The \a widget
+ argument is optional and can also be used to help find the icon.
+
+ \note Because of binary compatibility constraints, standardIcon()
+ introduced in Qt 4.1 is not virtual. Therefore it must dynamically
+ detect and call \e this slot. This default implementation simply
+ calls standardIcon() with the given parameters.
\sa standardIcon()
*/
diff --git a/src/gui/styles/qstyle.cpp b/src/gui/styles/qstyle.cpp
index 6ca301c..c848022 100644
--- a/src/gui/styles/qstyle.cpp
+++ b/src/gui/styles/qstyle.cpp
@@ -168,12 +168,21 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C
\section1 Creating a Custom Style
- If you want to design a custom look and feel for your application,
- the first step is to pick one of the styles provided with Qt to
- build your custom style from. The choice will depend on which
- existing style resembles your style the most. The most general
- class that you can use as base is QCommonStyle (and not QStyle).
- This is because Qt requires its styles to be \l{QCommonStyle}s.
+ You can create a custom look and feel for your application by
+ creating a custom style. There are two approaches to creating a
+ custom style. In the static approach, you either choose an
+ existing QStyle class, subclass it, and reimplement virtual
+ functions to provide the custom behavior, or you create an entire
+ QStyle class from scratch. In the dynamic approach, you modify the
+ behavior of your system style at runtime. The static approach is
+ described below. The dynamic approach is described in QProxyStyle.
+
+ The first step in the static approach is to pick one of the styles
+ provided by Qt from which you will build your custom style. Your
+ choice of QStyle class will depend on which style resembles your
+ desired style the most. The most general class that you can use as
+ a base is QCommonStyle (not QStyle). This is because Qt requires
+ its styles to be \l{QCommonStyle}s.
Depending on which parts of the base style you want to change,
you must reimplement the functions that are used to draw those
@@ -222,7 +231,7 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C
\section1 Using a Custom Style
There are several ways of using a custom style in a Qt
- application. The simplest way is call the
+ application. The simplest way is to pass the custom style to the
QApplication::setStyle() static function before creating the
QApplication object:
@@ -232,8 +241,8 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C
it before the constructor, you ensure that the user's preference,
set using the \c -style command-line option, is respected.
- You may want to make your style available for use in other
- applications, some of which may not be yours and are not available for
+ You may want to make your custom style available for use in other
+ applications, which may not be yours and hence not available for
you to recompile. The Qt Plugin system makes it possible to create
styles as plugins. Styles created as plugins are loaded as shared
objects at runtime by Qt itself. Please refer to the \link
diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp
index ca7dffd..827acac 100644
--- a/src/gui/widgets/qplaintextedit.cpp
+++ b/src/gui/widgets/qplaintextedit.cpp
@@ -2020,6 +2020,7 @@ void QPlainTextEdit::inputMethodEvent(QInputMethodEvent *e)
}
#endif
d->sendControlEvent(e);
+ ensureCursorVisible();
}
/*!\reimp
diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp
index 1c4df93..61cd0ce 100644
--- a/src/gui/widgets/qtextedit.cpp
+++ b/src/gui/widgets/qtextedit.cpp
@@ -1659,6 +1659,7 @@ void QTextEdit::inputMethodEvent(QInputMethodEvent *e)
}
#endif
d->sendControlEvent(e);
+ ensureCursorVisible();
}
/*!\reimp