summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJanne Anttila <janne.anttila@digia.com>2009-09-25 11:37:51 (GMT)
committerJanne Anttila <janne.anttila@digia.com>2009-09-25 11:37:51 (GMT)
commitf33e399b34eda645d2b87b053e887d0b21e8e32a (patch)
tree1f6f87ef5892a7ff36fbc419a9796159e018cd0f
parent02f161410dce9e2bac89f11d293f811bb224257c (diff)
parent8a993264ca8bd6273f1d5bb4288d64592d07760f (diff)
downloadQt-f33e399b34eda645d2b87b053e887d0b21e8e32a.zip
Qt-f33e399b34eda645d2b87b053e887d0b21e8e32a.tar.gz
Qt-f33e399b34eda645d2b87b053e887d0b21e8e32a.tar.bz2
Merge branch '4.6' of git@scm.dev.troll.no:qt/qt into 4.6
-rw-r--r--demos/embedded/fluidlauncher/fluidlauncher.cpp27
-rw-r--r--demos/embedded/fluidlauncher/fluidlauncher.h5
-rw-r--r--demos/embedded/fluidlauncher/slideshow.cpp5
-rw-r--r--demos/embedded/fluidlauncher/slideshow.h2
-rw-r--r--examples/graphicsview/anchorlayout/anchorlayout.pro1
-rw-r--r--src/corelib/global/qglobal.cpp34
-rw-r--r--src/corelib/kernel/qeventdispatcher_glib.cpp133
-rw-r--r--src/corelib/kernel/qeventdispatcher_glib_p.h2
-rw-r--r--src/corelib/kernel/qeventdispatcher_unix.cpp8
-rw-r--r--src/corelib/statemachine/qabstracttransition.cpp6
-rw-r--r--src/corelib/statemachine/qabstracttransition_p.h4
-rw-r--r--src/corelib/statemachine/qstate.cpp4
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout_p.cpp2
-rw-r--r--src/gui/graphicsview/qsimplex_p.cpp173
-rw-r--r--src/gui/kernel/qapplication_s60.cpp19
-rw-r--r--tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp47
-rw-r--r--tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp6
-rw-r--r--tests/auto/qscriptcontext/tst_qscriptcontext.cpp10
-rw-r--r--tests/auto/windowsmobile/test/testQMenuBar_current.pngbin23702 -> 22964 bytes
-rw-r--r--tests/auto/windowsmobile/test/testSimpleWidget_current.pngbin22034 -> 23841 bytes
-rw-r--r--tests/auto/windowsmobile/test/tst_windowsmobile.cpp17
-rw-r--r--tools/designer/src/lib/shared/qdesigner_menubar.cpp2
-rw-r--r--tools/designer/src/lib/shared/qdesigner_propertysheet.cpp11
-rw-r--r--tools/designer/translations/translations.pro2
-rw-r--r--tools/linguist/phrasebooks/russian.qph92
25 files changed, 494 insertions, 118 deletions
diff --git a/demos/embedded/fluidlauncher/fluidlauncher.cpp b/demos/embedded/fluidlauncher/fluidlauncher.cpp
index 808f362..3cd3f3c 100644
--- a/demos/embedded/fluidlauncher/fluidlauncher.cpp
+++ b/demos/embedded/fluidlauncher/fluidlauncher.cpp
@@ -54,6 +54,10 @@ FluidLauncher::FluidLauncher(QStringList* args)
slideShowWidget = new SlideShow();
inputTimer = new QTimer();
+ addWidget(pictureFlowWidget);
+ addWidget(slideShowWidget);
+ setCurrentWidget(pictureFlowWidget);
+
QRect screen_size = QApplication::desktop()->screenGeometry();
QObject::connect(pictureFlowWidget, SIGNAL(itemActivated(int)), this, SLOT(launchApplication(int)));
@@ -80,7 +84,7 @@ FluidLauncher::FluidLauncher(QStringList* args)
if (success) {
populatePictureFlow();
- pictureFlowWidget->showFullScreen();
+ showFullScreen();
inputTimer->start();
} else {
pictureFlowWidget->setAttribute(Qt::WA_DeleteOnClose, true);
@@ -222,7 +226,6 @@ void FluidLauncher::launchApplication(int index)
}
inputTimer->stop();
- pictureFlowWidget->hide();
QObject::connect(demoList[index], SIGNAL(demoFinished()), this, SLOT(demoFinished()));
@@ -234,6 +237,7 @@ void FluidLauncher::switchToLauncher()
{
slideShowWidget->stopShow();
inputTimer->start();
+ setCurrentWidget(pictureFlowWidget);
}
@@ -253,11 +257,28 @@ void FluidLauncher::switchToSlideshow()
{
inputTimer->stop();
slideShowWidget->startShow();
+ setCurrentWidget(slideShowWidget);
}
void FluidLauncher::demoFinished()
{
- pictureFlowWidget->showFullScreen();
+ setCurrentWidget(pictureFlowWidget);
inputTimer->start();
}
+void FluidLauncher::changeEvent(QEvent* event)
+{
+ if (event->type() == QEvent::ActivationChange) {
+ if (isActiveWindow()) {
+ if(currentWidget() == pictureFlowWidget) {
+ resetInputTimeout();
+ } else {
+ slideShowWidget->startShow();
+ }
+ } else {
+ inputTimer->stop();
+ slideShowWidget->stopShow();
+ }
+ }
+ QStackedWidget::changeEvent(event);
+}
diff --git a/demos/embedded/fluidlauncher/fluidlauncher.h b/demos/embedded/fluidlauncher/fluidlauncher.h
index 2c40526..ff742e2 100644
--- a/demos/embedded/fluidlauncher/fluidlauncher.h
+++ b/demos/embedded/fluidlauncher/fluidlauncher.h
@@ -50,7 +50,7 @@
#include "slideshow.h"
#include "demoapplication.h"
-class FluidLauncher : public QObject
+class FluidLauncher : public QStackedWidget
{
Q_OBJECT
@@ -65,6 +65,9 @@ public slots:
void inputTimedout();
void demoFinished();
+protected:
+ void changeEvent(QEvent *event);
+
private:
PictureFlow* pictureFlowWidget;
SlideShow* slideShowWidget;
diff --git a/demos/embedded/fluidlauncher/slideshow.cpp b/demos/embedded/fluidlauncher/slideshow.cpp
index a397c2b..55daedf 100644
--- a/demos/embedded/fluidlauncher/slideshow.cpp
+++ b/demos/embedded/fluidlauncher/slideshow.cpp
@@ -83,7 +83,8 @@ void SlideShowPrivate::showNextSlide()
-SlideShow::SlideShow()
+SlideShow::SlideShow(QWidget* parent) :
+ QWidget(parent)
{
d = new SlideShowPrivate;
@@ -125,7 +126,6 @@ void SlideShow::clearImages()
void SlideShow::startShow()
{
- showFullScreen();
d->interSlideTimer.start(d->slideInterval, this);
d->showNextSlide();
update();
@@ -134,7 +134,6 @@ void SlideShow::startShow()
void SlideShow::stopShow()
{
- hide();
d->interSlideTimer.stop();
}
diff --git a/demos/embedded/fluidlauncher/slideshow.h b/demos/embedded/fluidlauncher/slideshow.h
index 6d51662..214652e 100644
--- a/demos/embedded/fluidlauncher/slideshow.h
+++ b/demos/embedded/fluidlauncher/slideshow.h
@@ -53,7 +53,7 @@ class SlideShow : public QWidget
Q_PROPERTY(int slideInterval READ slideInterval WRITE setSlideInterval)
public:
- SlideShow();
+ SlideShow(QWidget* parent = 0);
~SlideShow();
void addImage(QString filename);
void addImageDir(QString dirName);
diff --git a/examples/graphicsview/anchorlayout/anchorlayout.pro b/examples/graphicsview/anchorlayout/anchorlayout.pro
index c969c8b..c2a1bea 100644
--- a/examples/graphicsview/anchorlayout/anchorlayout.pro
+++ b/examples/graphicsview/anchorlayout/anchorlayout.pro
@@ -12,3 +12,4 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/graphicsview/anchorlayout
INSTALLS += target sources
TARGET = anchorlayout_example
+CONFIG+=console \ No newline at end of file
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 4974acf..97362af 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -1769,25 +1769,6 @@ static QSysInfo::S60Version cachedS60Version = QSysInfo::S60Version(-1);
QSysInfo::S60Version QSysInfo::s60Version()
{
-# ifdef Q_CC_NOKIAX86
- // For emulator builds. Emulators don't support the trick we use to figure
- // out which SDK we are running under, so simply hardcode it there.
-# if defined(__SERIES60_31__)
- return SV_S60_3_1;
-
-# elif defined(__S60_32__)
- return SV_S60_3_2;
-
-# elif defined(__S60_50__)
- return SV_S60_5_0;
-
-# else
- return SV_S60_Unknown;
-
-# endif
-
-# else
- // For hardware builds.
if (cachedS60Version != -1)
return cachedS60Version;
@@ -1818,6 +1799,19 @@ QSysInfo::S60Version QSysInfo::s60Version()
delete contents;
}
+# ifdef Q_CC_NOKIAX86
+ // Some emulator environments may not contain the version specific .sis files, so
+ // simply hardcode the version on those environments.
+# if defined(__SERIES60_31__)
+ return cachedS60Version = SV_S60_3_1;
+# elif defined(__S60_32__)
+ return cachedS60Version = SV_S60_3_2;
+# elif defined(__S60_50__)
+ return cachedS60Version = SV_S60_5_0;
+# else
+ return cachedS60Version = SV_S60_Unknown;
+# endif
+# else
return cachedS60Version = SV_S60_Unknown;
# endif
}
@@ -2718,7 +2712,7 @@ int qrand()
\since 4.6
\brief The QT_TRID_NOOP macro marks an id for dynamic translation.
-
+
The only purpose of this macro is to provide an anchor for attaching
meta data like to qtTrId().
diff --git a/src/corelib/kernel/qeventdispatcher_glib.cpp b/src/corelib/kernel/qeventdispatcher_glib.cpp
index 6e457f4..665b73e 100644
--- a/src/corelib/kernel/qeventdispatcher_glib.cpp
+++ b/src/corelib/kernel/qeventdispatcher_glib.cpp
@@ -127,16 +127,11 @@ struct GTimerSource
GSource source;
QTimerInfoList timerList;
QEventLoop::ProcessEventsFlags processEventsFlags;
+ bool runWithIdlePriority;
};
-static gboolean timerSourcePrepare(GSource *source, gint *timeout)
+static gboolean timerSourcePrepareHelper(GTimerSource *src, gint *timeout)
{
- gint dummy;
- if (!timeout)
- timeout = &dummy;
-
- GTimerSource *src = reinterpret_cast<GTimerSource *>(source);
-
timeval tv = { 0l, 0l };
if (!(src->processEventsFlags & QEventLoop::X11ExcludeTimers) && src->timerList.timerWait(tv))
*timeout = (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
@@ -146,10 +141,8 @@ static gboolean timerSourcePrepare(GSource *source, gint *timeout)
return (*timeout == 0);
}
-static gboolean timerSourceCheck(GSource *source)
+static gboolean timerSourceCheckHelper(GTimerSource *src)
{
- GTimerSource *src = reinterpret_cast<GTimerSource *>(source);
-
if (src->timerList.isEmpty()
|| (src->processEventsFlags & QEventLoop::X11ExcludeTimers))
return false;
@@ -160,9 +153,35 @@ static gboolean timerSourceCheck(GSource *source)
return true;
}
+static gboolean timerSourcePrepare(GSource *source, gint *timeout)
+{
+ gint dummy;
+ if (!timeout)
+ timeout = &dummy;
+
+ GTimerSource *src = reinterpret_cast<GTimerSource *>(source);
+ if (src->runWithIdlePriority) {
+ if (timeout)
+ *timeout = -1;
+ return false;
+ }
+
+ return timerSourcePrepareHelper(src, timeout);
+}
+
+static gboolean timerSourceCheck(GSource *source)
+{
+ GTimerSource *src = reinterpret_cast<GTimerSource *>(source);
+ if (src->runWithIdlePriority)
+ return false;
+ return timerSourceCheckHelper(src);
+}
+
static gboolean timerSourceDispatch(GSource *source, GSourceFunc, gpointer)
{
- (void) reinterpret_cast<GTimerSource *>(source)->timerList.activateTimers();
+ GTimerSource *timerSource = reinterpret_cast<GTimerSource *>(source);
+ timerSource->runWithIdlePriority = true;
+ (void) timerSource->timerList.activateTimers();
return true; // ??? don't remove, right again?
}
@@ -175,6 +194,53 @@ static GSourceFuncs timerSourceFuncs = {
NULL
};
+struct GIdleTimerSource
+{
+ GSource source;
+ GTimerSource *timerSource;
+};
+
+static gboolean idleTimerSourcePrepare(GSource *source, gint *timeout)
+{
+ GIdleTimerSource *idleTimerSource = reinterpret_cast<GIdleTimerSource *>(source);
+ GTimerSource *timerSource = idleTimerSource->timerSource;
+ if (!timerSource->runWithIdlePriority) {
+ // Yield to the normal priority timer source
+ if (timeout)
+ *timeout = -1;
+ return false;
+ }
+
+ return timerSourcePrepareHelper(timerSource, timeout);
+}
+
+static gboolean idleTimerSourceCheck(GSource *source)
+{
+ GIdleTimerSource *idleTimerSource = reinterpret_cast<GIdleTimerSource *>(source);
+ GTimerSource *timerSource = idleTimerSource->timerSource;
+ if (!timerSource->runWithIdlePriority) {
+ // Yield to the normal priority timer source
+ return false;
+ }
+ return timerSourceCheckHelper(timerSource);
+}
+
+static gboolean idleTimerSourceDispatch(GSource *source, GSourceFunc, gpointer)
+{
+ GTimerSource *timerSource = reinterpret_cast<GIdleTimerSource *>(source)->timerSource;
+ (void) timerSourceDispatch(&timerSource->source, 0, 0);
+ return true;
+}
+
+static GSourceFuncs idleTimerSourceFuncs = {
+ idleTimerSourcePrepare,
+ idleTimerSourceCheck,
+ idleTimerSourceDispatch,
+ NULL,
+ NULL,
+ NULL
+};
+
struct GPostEventSource
{
GSource source;
@@ -235,14 +301,15 @@ QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(GMainContext *context)
g_main_context_ref(mainContext);
} else {
QCoreApplication *app = QCoreApplication::instance();
- if (app && QThread::currentThread() == app->thread()) {
- mainContext = g_main_context_default();
- g_main_context_ref(mainContext);
- } else {
- mainContext = g_main_context_new();
- }
+ if (app && QThread::currentThread() == app->thread()) {
+ mainContext = g_main_context_default();
+ g_main_context_ref(mainContext);
+ } else {
+ mainContext = g_main_context_new();
+ }
}
+ // setup post event source
postEventSource = reinterpret_cast<GPostEventSource *>(g_source_new(&postEventSourceFuncs,
sizeof(GPostEventSource)));
postEventSource->serialNumber = 1;
@@ -257,14 +324,21 @@ QEventDispatcherGlibPrivate::QEventDispatcherGlibPrivate(GMainContext *context)
g_source_set_can_recurse(&socketNotifierSource->source, true);
g_source_attach(&socketNotifierSource->source, mainContext);
- // setup timerSource
+ // setup normal and idle timer sources
timerSource = reinterpret_cast<GTimerSource *>(g_source_new(&timerSourceFuncs,
sizeof(GTimerSource)));
(void) new (&timerSource->timerList) QTimerInfoList();
timerSource->processEventsFlags = QEventLoop::AllEvents;
+ timerSource->runWithIdlePriority = false;
g_source_set_can_recurse(&timerSource->source, true);
- g_source_set_priority(&timerSource->source, G_PRIORITY_DEFAULT_IDLE);
g_source_attach(&timerSource->source, mainContext);
+
+ idleTimerSource = reinterpret_cast<GIdleTimerSource *>(g_source_new(&idleTimerSourceFuncs,
+ sizeof(GIdleTimerSource)));
+ idleTimerSource->timerSource = timerSource;
+ g_source_set_can_recurse(&idleTimerSource->source, true);
+ g_source_set_priority(&idleTimerSource->source, G_PRIORITY_DEFAULT_IDLE);
+ g_source_attach(&idleTimerSource->source, mainContext);
}
QEventDispatcherGlib::QEventDispatcherGlib(QObject *parent)
@@ -272,12 +346,9 @@ QEventDispatcherGlib::QEventDispatcherGlib(QObject *parent)
{
}
-QEventDispatcherGlib::QEventDispatcherGlib(GMainContext *mainContext,
- QObject *parent)
- : QAbstractEventDispatcher(*(new QEventDispatcherGlibPrivate(mainContext)),
- parent)
-{
-}
+QEventDispatcherGlib::QEventDispatcherGlib(GMainContext *mainContext, QObject *parent)
+ : QAbstractEventDispatcher(*(new QEventDispatcherGlibPrivate(mainContext)), parent)
+{ }
QEventDispatcherGlib::~QEventDispatcherGlib()
{
@@ -289,6 +360,9 @@ QEventDispatcherGlib::~QEventDispatcherGlib()
g_source_destroy(&d->timerSource->source);
g_source_unref(&d->timerSource->source);
d->timerSource = 0;
+ g_source_destroy(&d->idleTimerSource->source);
+ g_source_unref(&d->idleTimerSource->source);
+ d->idleTimerSource = 0;
// destroy socket notifier source
for (int i = 0; i < d->socketNotifierSource->pollfds.count(); ++i) {
@@ -324,11 +398,16 @@ bool QEventDispatcherGlib::processEvents(QEventLoop::ProcessEventsFlags flags)
// tell postEventSourcePrepare() and timerSource about any new flags
QEventLoop::ProcessEventsFlags savedFlags = d->timerSource->processEventsFlags;
d->timerSource->processEventsFlags = flags;
-
+
+ if (!(flags & QEventLoop::EventLoopExec)) {
+ // force timers to be sent at normal priority
+ d->timerSource->runWithIdlePriority = false;
+ }
+
bool result = g_main_context_iteration(d->mainContext, canWait);
while (!result && canWait)
result = g_main_context_iteration(d->mainContext, canWait);
-
+
d->timerSource->processEventsFlags = savedFlags;
if (canWait)
diff --git a/src/corelib/kernel/qeventdispatcher_glib_p.h b/src/corelib/kernel/qeventdispatcher_glib_p.h
index 8dbc44d..6a4e726 100644
--- a/src/corelib/kernel/qeventdispatcher_glib_p.h
+++ b/src/corelib/kernel/qeventdispatcher_glib_p.h
@@ -98,6 +98,7 @@ protected:
struct GPostEventSource;
struct GSocketNotifierSource;
struct GTimerSource;
+struct GIdleTimerSource;
class Q_CORE_EXPORT QEventDispatcherGlibPrivate : public QAbstractEventDispatcherPrivate
{
@@ -108,6 +109,7 @@ public:
GPostEventSource *postEventSource;
GSocketNotifierSource *socketNotifierSource;
GTimerSource *timerSource;
+ GIdleTimerSource *idleTimerSource;
};
QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp
index a912971..5a0afb8 100644
--- a/src/corelib/kernel/qeventdispatcher_unix.cpp
+++ b/src/corelib/kernel/qeventdispatcher_unix.cpp
@@ -446,10 +446,10 @@ bool QTimerInfoList::timerWait(timeval &tm)
// Find first waiting timer not already active
QTimerInfo *t = 0;
for (QTimerInfoList::const_iterator it = constBegin(); it != constEnd(); ++it) {
- if (!(*it)->inTimerEvent) {
- t = *it;
- break;
- }
+ if (!(*it)->inTimerEvent) {
+ t = *it;
+ break;
+ }
}
if (!t)
diff --git a/src/corelib/statemachine/qabstracttransition.cpp b/src/corelib/statemachine/qabstracttransition.cpp
index a81fe0f..8b858c7 100644
--- a/src/corelib/statemachine/qabstracttransition.cpp
+++ b/src/corelib/statemachine/qabstracttransition.cpp
@@ -187,7 +187,7 @@ QAbstractState *QAbstractTransition::targetState() const
Q_D(const QAbstractTransition);
if (d->targetStates.isEmpty())
return 0;
- return d->targetStates.first();
+ return d->targetStates.first().data();
}
/*!
@@ -211,7 +211,7 @@ QList<QAbstractState*> QAbstractTransition::targetStates() const
Q_D(const QAbstractTransition);
QList<QAbstractState*> result;
for (int i = 0; i < d->targetStates.size(); ++i) {
- QAbstractState *target = d->targetStates.at(i);
+ QAbstractState *target = d->targetStates.at(i).data();
if (target)
result.append(target);
}
@@ -225,7 +225,7 @@ void QAbstractTransition::setTargetStates(const QList<QAbstractState*> &targets)
{
Q_D(QAbstractTransition);
- for (int i=0; i<targets.size(); ++i) {
+ for (int i = 0; i < targets.size(); ++i) {
QAbstractState *target = targets.at(i);
if (!target) {
qWarning("QAbstractTransition::setTargetStates: target state(s) cannot be null");
diff --git a/src/corelib/statemachine/qabstracttransition_p.h b/src/corelib/statemachine/qabstracttransition_p.h
index 7465243..5b4df1b 100644
--- a/src/corelib/statemachine/qabstracttransition_p.h
+++ b/src/corelib/statemachine/qabstracttransition_p.h
@@ -56,7 +56,7 @@
#include <private/qobject_p.h>
#include <QtCore/qlist.h>
-#include <QtCore/qpointer.h>
+#include <QtCore/qsharedpointer.h>
QT_BEGIN_NAMESPACE
@@ -80,7 +80,7 @@ public:
QStateMachine *machine() const;
void emitTriggered();
- QList<QPointer<QAbstractState> > targetStates;
+ QList<QWeakPointer<QAbstractState> > targetStates;
#ifndef QT_NO_ANIMATION
QList<QAbstractAnimation*> animations;
diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp
index 70026b8..a6e4a57 100644
--- a/src/corelib/statemachine/qstate.cpp
+++ b/src/corelib/statemachine/qstate.cpp
@@ -291,9 +291,9 @@ QAbstractTransition *QState::addTransition(QAbstractTransition *transition)
}
transition->setParent(this);
- const QList<QPointer<QAbstractState> > &targets = QAbstractTransitionPrivate::get(transition)->targetStates;
+ const QList<QWeakPointer<QAbstractState> > &targets = QAbstractTransitionPrivate::get(transition)->targetStates;
for (int i = 0; i < targets.size(); ++i) {
- QAbstractState *t = targets.at(i);
+ QAbstractState *t = targets.at(i).data();
if (!t) {
qWarning("QState::addTransition: cannot add transition to null state");
return 0;
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
index 7041d58..49aabf5 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
+++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
@@ -542,7 +542,7 @@ static bool simplifySequentialChunk(Graph<AnchorVertex, AnchorData> *graph,
void QGraphicsAnchorLayoutPrivate::simplifyGraph(Orientation orientation)
{
static bool noSimplification = !qgetenv("QT_ANCHORLAYOUT_NO_SIMPLIFICATION").isEmpty();
- if (noSimplification)
+ if (noSimplification || items.isEmpty())
return;
if (graphSimplified[orientation])
diff --git a/src/gui/graphicsview/qsimplex_p.cpp b/src/gui/graphicsview/qsimplex_p.cpp
index e3a991e..1ba24a3 100644
--- a/src/gui/graphicsview/qsimplex_p.cpp
+++ b/src/gui/graphicsview/qsimplex_p.cpp
@@ -48,6 +48,32 @@
QT_BEGIN_NAMESPACE
+/*!
+ \class QSimplex
+
+ The QSimplex class is a Linear Programming problem solver based on the two-phase
+ simplex method.
+
+ It takes a set of QSimplexConstraints as its restrictive constraints and an
+ additional QSimplexConstraint as its objective function. Then methods to maximize
+ and minimize the problem solution are provided.
+
+ The two-phase simplex method is based on the following steps:
+ First phase:
+ 1.a) Modify the original, complex, and possibly not feasible problem, into a new,
+ easy to solve problem.
+ 1.b) Set as the objective of the new problem, a feasible solution for the original
+ complex problem.
+ 1.c) Run simplex to optimize the modified problem and check whether a solution for
+ the original problem exists.
+
+ Second phase:
+ 2.a) Go back to the original problem with the feasibl (but not optimal) solution
+ found in the first phase.
+ 2.b) Set the original objective.
+ 3.c) Run simplex to optimize the original problem towards its optimal solution.
+*/
+
QSimplex::QSimplex() : objective(0), rows(0), columns(0), firstArtificial(0), matrix(0)
{
}
@@ -84,15 +110,31 @@ void QSimplex::clearDataStructures()
objective = 0;
}
+/*!
+ Sets the new constraints in the simplex solver and returns whether the problem
+ is feasible.
+
+ This method sets the new constraints, normalizes them, creates the simplex matrix
+ and runs the first simplex phase.
+*/
bool QSimplex::setConstraints(const QList<QSimplexConstraint *> newConstraints)
{
+ ////////////////////////////
+ // Reset to initial state //
+ ////////////////////////////
clearDataStructures();
if (newConstraints.isEmpty())
return true; // we are ok with no constraints
constraints = newConstraints;
- // Set Variables direct mapping
+ ///////////////////////////////////////
+ // Prepare variables and constraints //
+ ///////////////////////////////////////
+
+ // Set Variables direct mapping.
+ // "variables" is a list that provides a stable, indexed list of all variables
+ // used in this problem.
QSet<QSimplexVariable *> variablesSet;
for (int i = 0; i < constraints.size(); ++i)
variablesSet += \
@@ -100,12 +142,25 @@ bool QSimplex::setConstraints(const QList<QSimplexConstraint *> newConstraints)
variables = variablesSet.toList();
// Set Variables reverse mapping
+ // We also need to be able to find the index for a given variable, to do that
+ // we store in each variable its index.
for (int i = 0; i < variables.size(); ++i) {
// The variable "0" goes at the column "1", etc...
variables[i]->index = i + 1;
}
// Normalize Constraints
+ // In this step, we prepare the constraints in two ways:
+ // Firstly, we modify all constraints of type "LessOrEqual" or "MoreOrEqual"
+ // by the adding slack or surplus variables and making them "Equal" constraints.
+ // Secondly, we need every single constraint to have a direct, easy feasible
+ // solution. Constraints that have slack variables are already easy to solve,
+ // to all the others we add artificial variables.
+ //
+ // At the end we modify the constraints as follows:
+ // - LessOrEqual: SLACK variable is added.
+ // - Equal: ARTIFICIAL variable is added.
+ // - More or Equal: ARTIFICIAL and SURPLUS variables are added.
int variableIndex = variables.size();
QList <QSimplexVariable *> artificialList;
@@ -138,12 +193,18 @@ bool QSimplex::setConstraints(const QList<QSimplexConstraint *> newConstraints)
}
}
+ // All original, slack and surplus have already had its index set
+ // at this point. We now set the index of the artificial variables
+ // as to ensure they are at the end of the variable list and therefore
+ // can be easily removed at the end of this method.
firstArtificial = variableIndex + 1;
for (int i = 0; i < artificialList.size(); ++i)
artificialList[i]->index = ++variableIndex;
artificialList.clear();
- // Matrix
+ /////////////////////////////
+ // Fill the Simplex matrix //
+ /////////////////////////////
// One for each variable plus the Basic and BFS columns (first and last)
columns = variableIndex + 2;
@@ -188,24 +249,61 @@ bool QSimplex::setConstraints(const QList<QSimplexConstraint *> newConstraints)
setValueAt(i, columns - 1, c->constant);
}
- // Set temporary objective: -1 * sum_of_artificial_vars
+ // Set objective for the first-phase Simplex.
+ // Z = -1 * sum_of_artificial_vars
for (int j = firstArtificial; j < columns - 1; ++j)
setValueAt(0, j, 1.0);
// Maximize our objective (artificial vars go to zero)
solveMaxHelper();
+ // If there is a solution where the sum of all artificial
+ // variables is zero, then all of them can be removed and yet
+ // we will have a feasible (but not optimal) solution for the
+ // original problem.
+ // Otherwise, we clean up our structures and report there is
+ // no feasible solution.
if (valueAt(0, columns - 1) != 0.0) {
qWarning() << "QSimplex: No feasible solution!";
clearDataStructures();
return false;
}
- // Remove artificial variables
+ // Remove artificial variables. We already have a feasible
+ // solution for the first problem, thus we don't need them
+ // anymore.
clearColumns(firstArtificial, columns - 2);
+
+ #ifdef QT_DEBUG
+ // Ensure that at the end of the simplex each row should either:
+ // - Have a positive value on the column associated to its variable, or
+ // - Have zero values in all columns.
+ //
+ // This avoids a regression where restrictions would be lost
+ // due to randomness in the pivotRowForColumn method.
+ for (int i = 1; i < rows; ++i) {
+ int variableIndex = valueAt(i, 0);
+ if (valueAt(i, variableIndex) > 0)
+ continue;
+
+ for (int j = 1; j < columns; ++j) {
+ Q_ASSERT(valueAt(i, j) == 0);
+ }
+ }
+ #endif
+
return true;
}
+/*!
+ \internal
+
+ Run simplex on the current matrix with the current objective.
+
+ This is the iterative method. The matrix lines are combined
+ as to modify the variable values towards the best solution possible.
+ The method returns when the matrix is in the optimal state.
+*/
void QSimplex::solveMaxHelper()
{
reducedRowEchelon();
@@ -235,23 +333,21 @@ void QSimplex::clearColumns(int first, int last)
void QSimplex::dumpMatrix()
{
- printf("---- Simplex Matrix ----\n");
+ qDebug("---- Simplex Matrix ----\n");
- printf(" ");
+ QString str(QLatin1String(" "));
for (int j = 0; j < columns; ++j)
- printf(" <% 2d >", j);
- printf("\n");
-
+ str += QString::fromAscii(" <%1 >").arg(j, 2);
+ qDebug("%s", qPrintable(str));
for (int i = 0; i < rows; ++i) {
- printf("Row %2d:", i);
+ str = QString::fromAscii("Row %1:").arg(i, 2);
qreal *row = matrix + i * columns;
- for (int j = 0; j < columns; ++j) {
- printf(" % 2.2f", row[j]);
- }
- printf("\n");
+ for (int j = 0; j < columns; ++j)
+ str += QString::fromAscii("%1").arg(row[j], 7, 'f', 2);
+ qDebug("%s", qPrintable(str));
}
- printf("------------------------\n\n");
+ qDebug("------------------------\n");
}
void QSimplex::combineRows(int toIndex, int fromIndex, qreal factor)
@@ -292,6 +388,23 @@ int QSimplex::findPivotColumn()
return minIndex;
}
+/*!
+ \internal
+
+ For a given pivot column, find the pivot row. That is, the row with the
+ minimum associated "quotient" where:
+
+ - quotient is the division of the value in the last column by the value
+ in the pivot column.
+ - rows with value less or equal to zero are ignored
+ - if two rows have the same quotient, lines are chosen based on the
+ highest variable index (value in the first column)
+
+ The last condition avoids a bug where artificial variables would be
+ left behind for the second-phase simplex, and with 'good'
+ constraints would be removed before it, what would lead to incorrect
+ results.
+*/
int QSimplex::pivotRowForColumn(int column)
{
qreal min = qreal(999999999999.0); // ###
@@ -306,6 +419,8 @@ int QSimplex::pivotRowForColumn(int column)
if (quotient < min) {
min = quotient;
minIndex = i;
+ } else if ((quotient == min) && (valueAt(i, 0) > valueAt(minIndex, 0))) {
+ minIndex = i;
}
}
@@ -320,6 +435,12 @@ void QSimplex::reducedRowEchelon()
}
}
+/*!
+ \internal
+
+ Does one iteration towards a better solution for the problem.
+ See 'solveMaxHelper'.
+*/
bool QSimplex::iterate()
{
// Find Pivot column
@@ -351,7 +472,7 @@ bool QSimplex::iterate()
setValueAt(pivotRow, 0, pivotColumn);
// dumpMatrix();
- // printf("------------ end of iteration --------------\n");
+ // qDebug("------------ end of iteration --------------\n");
return true;
}
@@ -361,7 +482,13 @@ bool QSimplex::iterate()
Both solveMin and solveMax are interfaces to this method.
The enum solverFactor admits 2 values: Minimum (-1) and Maximum (+1).
- */
+
+ This method sets the original objective and runs the second phase
+ Simplex to obtain the optimal solution for the problem. As the internal
+ simplex solver is only able to _maximize_ objectives, we handle the
+ minimization case by inverting the original objective and then
+ maximizing it.
+*/
qreal QSimplex::solver(solverFactor factor)
{
// Remove old objective
@@ -381,16 +508,28 @@ qreal QSimplex::solver(solverFactor factor)
return factor * valueAt(0, columns - 1);
}
+/*!
+ Minimize the original objective.
+*/
qreal QSimplex::solveMin()
{
return solver(Minimum);
}
+/*!
+ Maximize the original objective.
+*/
qreal QSimplex::solveMax()
{
return solver(Maximum);
}
+/*!
+ \internal
+
+ Reads results from the simplified matrix and saves them in the
+ "result" member of each QSimplexVariable.
+*/
void QSimplex::collectResults()
{
// All variables are zero unless overridden below.
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 27e8602..8daac42 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -480,7 +480,7 @@ void QSymbianControl::HandlePointerEvent(const TPointerEvent& pEvent)
alienWidget = qwidget;
S60->mousePressTarget = alienWidget;
}
-
+
alienWidget = S60->mousePressTarget;
if (alienWidget != S60->lastPointerEventTarget)
@@ -600,7 +600,7 @@ TKeyResponse QSymbianControl::OfferKeyEvent(const TKeyEvent& keyEvent, TEventCod
if (keyCode >= Qt::Key_Left && keyCode <= Qt::Key_Down || keyCode == Qt::Key_Select) {
/*Explanation about virtualMouseAccel:
Tapping an arrow key allows precise pixel positioning
- Holding an arrow key down, acceleration is applied to allow cursor
+ Holding an arrow key down, acceleration is applied to allow cursor
to be quickly moved to another part of the screen by key repeats.
*/
if (S60->virtualMouseLastKey == keyCode) {
@@ -668,7 +668,7 @@ TKeyResponse QSymbianControl::OfferKeyEvent(const TKeyEvent& keyEvent, TEventCod
}
}
#endif
-
+
Qt::KeyboardModifiers mods = mapToQtModifiers(keyEvent.iModifiers);
QKeyEventEx qKeyEvent(type == EEventKeyUp ? QEvent::KeyRelease : QEvent::KeyPress, keyCode,
mods, qt_keymapper_private()->translateKeyEvent(keyCode, mods),
@@ -993,13 +993,13 @@ void qt_init(QApplicationPrivate * /* priv */, int)
S60->hasTouchscreen = true;
S60->virtualMouseRequired = false;
}
-
+
if (touch) {
QApplicationPrivate::navigationMode = Qt::NavigationModeNone;
} else {
QApplicationPrivate::navigationMode = Qt::NavigationModeKeypadDirectional;
}
-
+
#ifndef QT_NO_CURSOR
//Check if window server pointer cursors are supported or not
#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS
@@ -1063,7 +1063,7 @@ void qt_cleanup()
// it dies.
delete QApplicationPrivate::inputContext;
QApplicationPrivate::inputContext = 0;
-
+
//Change mouse pointer back
S60->wsSession().SetPointerCursorMode(EPointerCursorNone);
@@ -1383,7 +1383,8 @@ int QApplication::s60ProcessEvent(TWsEvent *event)
} else if ((visChangedEvent->iFlags & TWsVisibilityChangedEvent::EPartiallyVisible)
&& !w->d_func()->maybeBackingStore()) {
w->d_func()->topData()->backingStore = new QWidgetBackingStore(w);
- w->update();
+ w->d_func()->invalidateBuffer(w->rect());
+ w->repaint();
}
return 1;
}
@@ -1599,7 +1600,7 @@ void QApplicationPrivate::setNavigationMode(Qt::NavigationMode mode)
const bool isCursorOn = (mode == Qt::NavigationModeCursorAuto
&& !S60->hasTouchscreen)
|| mode == Qt::NavigationModeCursorForceVisible;
-
+
if (!wasCursorOn && isCursorOn) {
//Show the cursor, when changing from another mode to cursor mode
qt_symbian_set_cursor_visible(true);
@@ -1629,7 +1630,7 @@ void QApplication::restoreOverrideCursor()
if (qApp->d_func()->cursor_list.isEmpty())
return;
qApp->d_func()->cursor_list.removeFirst();
-
+
if (!qApp->d_func()->cursor_list.isEmpty()) {
qt_symbian_setGlobalCursor(qApp->d_func()->cursor_list.first());
}
diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
index 2c4a253..2fee98d 100644
--- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
+++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
@@ -154,6 +154,8 @@ void tst_QGraphicsAnchorLayout::simple()
QGraphicsWidget p;
p.setLayout(l);
+ QVERIFY(l->hasConflicts() == false);
+
QCOMPARE(l->count(), 2);
}
@@ -183,6 +185,8 @@ void tst_QGraphicsAnchorLayout::simple_center()
setAnchor(l, b, Qt::AnchorBottom, c, Qt::AnchorTop, 0);
setAnchor(l, c, Qt::AnchorBottom, l, Qt::AnchorBottom, 0);
+ QVERIFY(l->hasConflicts() == false);
+
QCOMPARE(l->count(), 3);
QGraphicsWidget *p = new QGraphicsWidget(0, Qt::Window);
@@ -193,6 +197,8 @@ void tst_QGraphicsAnchorLayout::simple_center()
QSizeF layoutMaximumSize = l->effectiveSizeHint(Qt::MaximumSize);
QCOMPARE(layoutMaximumSize, QSizeF(200, 20));
+
+ delete p;
}
void tst_QGraphicsAnchorLayout::simple_semifloat()
@@ -228,6 +234,8 @@ void tst_QGraphicsAnchorLayout::simple_semifloat()
setAnchor(l, a, Qt::AnchorBottom, l, Qt::AnchorBottom, 0);
setAnchor(l, b, Qt::AnchorBottom, l, Qt::AnchorBottom, 0);
+ QVERIFY(l->hasConflicts() == false);
+
QCOMPARE(l->count(), 4);
QGraphicsWidget *p = new QGraphicsWidget(0, Qt::Window);
@@ -240,6 +248,8 @@ void tst_QGraphicsAnchorLayout::simple_semifloat()
QSizeF layoutMaximumSize = l->effectiveSizeHint(Qt::MaximumSize);
QCOMPARE(layoutMaximumSize, QSizeF(200, 20));
+
+ delete p;
}
void tst_QGraphicsAnchorLayout::layoutDirection()
@@ -286,6 +296,10 @@ void tst_QGraphicsAnchorLayout::layoutDirection()
view->show();
QCOMPARE(checkReverseDirection(p), true);
+ QVERIFY(l->hasConflicts() == false);
+
+ delete p;
+ delete view;
}
void tst_QGraphicsAnchorLayout::diagonal()
@@ -326,6 +340,8 @@ void tst_QGraphicsAnchorLayout::diagonal()
l->addAnchor(e, Qt::AnchorRight, l, Qt::AnchorRight);
l->addAnchor(d, Qt::AnchorRight, e, Qt::AnchorLeft);
+ QVERIFY(l->hasConflicts() == false);
+
QCOMPARE(l->count(), 5);
QGraphicsWidget p;
@@ -373,6 +389,9 @@ void tst_QGraphicsAnchorLayout::diagonal()
QCOMPARE(p.size(), testA);
QCOMPARE(checkReverseDirection(&p), true);
+
+ c->setMinimumWidth(300);
+ QVERIFY(l->hasConflicts());
}
void tst_QGraphicsAnchorLayout::parallel()
@@ -465,6 +484,8 @@ void tst_QGraphicsAnchorLayout::parallel()
QCOMPARE(e->geometry(), QRectF(375, 400, 175, 100));
QCOMPARE(f->geometry(), QRectF(550, 500, 200, 100));
QCOMPARE(p.size(), layoutMaximumSize);
+
+ QVERIFY(l->hasConflicts() == false);
}
void tst_QGraphicsAnchorLayout::parallel2()
@@ -489,6 +510,7 @@ void tst_QGraphicsAnchorLayout::parallel2()
l->addAnchor(l, Qt::AnchorLeft, b, Qt::AnchorLeft);
l->addAnchor(b, Qt::AnchorRight, a, Qt::AnchorRight);
+ QVERIFY(l->hasConflicts() == false);
QCOMPARE(l->count(), 2);
QGraphicsWidget p;
@@ -570,6 +592,8 @@ void tst_QGraphicsAnchorLayout::snake()
QCOMPARE(b->geometry(), QRectF(90.0, 100.0, 10.0, 100.0));
QCOMPARE(c->geometry(), QRectF(90.0, 200.0, 100.0, 100.0));
QCOMPARE(p.size(), layoutMaximumSize);
+
+ QVERIFY(l->hasConflicts() == false);
}
void tst_QGraphicsAnchorLayout::snakeOppositeDirections()
@@ -603,6 +627,7 @@ void tst_QGraphicsAnchorLayout::snakeOppositeDirections()
l->addAnchor(c, Qt::AnchorRight, l, Qt::AnchorRight);
+ QVERIFY(l->hasConflicts() == false);
QCOMPARE(l->count(), 3);
QGraphicsWidget p;
@@ -706,6 +731,8 @@ void tst_QGraphicsAnchorLayout::fairDistribution()
QCOMPARE(c->geometry(), QRectF(200.0, 200.0, 100.0, 100.0));
QCOMPARE(d->geometry(), QRectF(0.0, 300.0, 300.0, 100.0));
QCOMPARE(p.size(), layoutMaximumSize);
+
+ QVERIFY(l->hasConflicts() == false);
}
void tst_QGraphicsAnchorLayout::fairDistributionOppositeDirections()
@@ -782,6 +809,8 @@ void tst_QGraphicsAnchorLayout::fairDistributionOppositeDirections()
QCOMPARE(a->size(), d->size());
QCOMPARE(e->size().width(), 4 * a->size().width());
QCOMPARE(p.size(), layoutMaximumSize);
+
+ QVERIFY(l->hasConflicts() == false);
}
void tst_QGraphicsAnchorLayout::proportionalPreferred()
@@ -844,6 +873,8 @@ void tst_QGraphicsAnchorLayout::proportionalPreferred()
QCOMPARE(a->size().width(), 10 * factor);
QCOMPARE(c->size().width(), 14 * factor);
QCOMPARE(p.size(), QSizeF(12, 400));
+
+ QVERIFY(l->hasConflicts() == false);
}
void tst_QGraphicsAnchorLayout::example()
@@ -897,6 +928,7 @@ void tst_QGraphicsAnchorLayout::example()
l->addAnchor(l, Qt::AnchorLeft, g, Qt::AnchorLeft);
l->addAnchor(f, Qt::AnchorRight, g, Qt::AnchorRight);
+ QVERIFY(l->hasConflicts() == false);
QCOMPARE(l->count(), 7);
QGraphicsWidget p;
@@ -985,6 +1017,10 @@ void tst_QGraphicsAnchorLayout::setSpacing()
QCOMPARE(b->geometry(), QRectF(24, 0, 20, 20));
QCOMPARE(c->geometry(), QRectF(0, 20, 44, 20));
+ QVERIFY(l->hasConflicts() == false);
+
+ delete p;
+ delete view;
}
/*!
@@ -1067,6 +1103,8 @@ void tst_QGraphicsAnchorLayout::hardComplexS60()
QSizeF layoutMaximumSize = l->effectiveSizeHint(Qt::MaximumSize);
QCOMPARE(layoutMaximumSize, QSizeF(240, 40));
+ QVERIFY(l->hasConflicts() == false);
+ delete p;
}
void tst_QGraphicsAnchorLayout::stability()
@@ -1128,6 +1166,7 @@ void tst_QGraphicsAnchorLayout::delete_anchor()
QGraphicsWidget *p = new QGraphicsWidget;
p->setLayout(l);
+ QVERIFY(l->hasConflicts() == false);
QCOMPARE(l->count(), 3);
scene.addItem(p);
@@ -1277,10 +1316,10 @@ void tst_QGraphicsAnchorLayout::conflicts()
a->setMinimumSize(QSizeF(29,10));
QCOMPARE(l->hasConflicts(), false);
- // It will currently fail if we uncomment this:
- //QEXPECT_FAIL("", "The constraints are just within their bounds in order to be feasible", Continue);
- //a->setMinimumSize(QSizeF(30,10));
- //QCOMPARE(l->hasConflicts(), false);
+ a->setMinimumSize(QSizeF(30,10));
+ QCOMPARE(l->hasConflicts(), false);
+
+ delete p;
}
QTEST_MAIN(tst_QGraphicsAnchorLayout)
diff --git a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp
index 8228ab9..a6746db 100644
--- a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp
+++ b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp
@@ -58,10 +58,9 @@ public:
setSpacing( 0 );
}
- // ###: Remove me when isValid() is supported
bool isValid()
{
- return true;
+ return !hasConflicts();
}
void setAnchor(
@@ -463,9 +462,6 @@ void tst_QGraphicsAnchorLayout1::testAddAndRemoveAnchor()
void tst_QGraphicsAnchorLayout1::testIsValid()
{
- // ###: REMOVE ME
- return;
-
// Empty, valid
{
QGraphicsWidget *widget = new QGraphicsWidget;
diff --git a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp
index dc7184c..063075d 100644
--- a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp
+++ b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp
@@ -944,6 +944,16 @@ void tst_QScriptContext::inheritActivationAndThisObject()
QVERIFY(ret.isNumber());
QCOMPARE(ret.toInt32(), 123);
}
+
+ // QT-2219
+ {
+ eng.globalObject().setProperty("a", 123);
+ QScriptValue ret = eng.evaluate("(function() { myEval('var a = 456'); return a; })()");
+ QVERIFY(ret.isNumber());
+ QCOMPARE(ret.toInt32(), 456);
+ QEXPECT_FAIL("", "QT-2219: Wrong activation object is returned from native function's parent context", Continue);
+ QVERIFY(eng.globalObject().property("a").strictlyEquals(123));
+ }
}
static QScriptValue parentContextToString(QScriptContext *ctx, QScriptEngine *)
diff --git a/tests/auto/windowsmobile/test/testQMenuBar_current.png b/tests/auto/windowsmobile/test/testQMenuBar_current.png
index d03e69a..f0042b8 100644
--- a/tests/auto/windowsmobile/test/testQMenuBar_current.png
+++ b/tests/auto/windowsmobile/test/testQMenuBar_current.png
Binary files differ
diff --git a/tests/auto/windowsmobile/test/testSimpleWidget_current.png b/tests/auto/windowsmobile/test/testSimpleWidget_current.png
index 09a10a3..8086c41 100644
--- a/tests/auto/windowsmobile/test/testSimpleWidget_current.png
+++ b/tests/auto/windowsmobile/test/testSimpleWidget_current.png
Binary files differ
diff --git a/tests/auto/windowsmobile/test/tst_windowsmobile.cpp b/tests/auto/windowsmobile/test/tst_windowsmobile.cpp
index 2d7c9ea..7a86a51 100644
--- a/tests/auto/windowsmobile/test/tst_windowsmobile.cpp
+++ b/tests/auto/windowsmobile/test/tst_windowsmobile.cpp
@@ -57,6 +57,8 @@ class tst_WindowsMobile : public QObject
public:
tst_WindowsMobile()
{
+ qApp->setCursorFlashTime (24 * 3600 * 1000); // once a day
+ // qApp->setCursorFlashTime (INT_MAX);
#ifdef Q_OS_WINCE_WM
q_initDD();
#endif
@@ -123,11 +125,20 @@ void compareScreenshots(const QString &image1, const QString &image2)
QImage screenShot(image1);
QImage original(image2);
- //ignore the clock
+ // cut away the title bar before comparing
+ QDesktopWidget desktop;
+ QRect desktopFrameRect = desktop.frameGeometry();
+ QRect desktopClientRect = desktop.availableGeometry();
+
QPainter p1(&screenShot);
QPainter p2(&original);
- p1.fillRect(310, 6, 400, 34, Qt::black);
- p2.fillRect(310, 6, 400, 34, Qt::black);
+
+ //screenShot.save("scr1.png", "PNG");
+ p1.fillRect(0, 0, desktopFrameRect.width(), desktopClientRect.y(), Qt::black);
+ p2.fillRect(0, 0, desktopFrameRect.width(), desktopClientRect.y(), Qt::black);
+
+ //screenShot.save("scr2.png", "PNG");
+ //original.save("orig1.png", "PNG");
QVERIFY(original == screenShot);
}
diff --git a/tools/designer/src/lib/shared/qdesigner_menubar.cpp b/tools/designer/src/lib/shared/qdesigner_menubar.cpp
index 6d231ca..80c7b53 100644
--- a/tools/designer/src/lib/shared/qdesigner_menubar.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_menubar.cpp
@@ -104,6 +104,8 @@ QDesignerMenuBar::QDesignerMenuBar(QWidget *parent) :
setContextMenuPolicy(Qt::DefaultContextMenu);
setAcceptDrops(true); // ### fake
+ // Fake property: Keep the menu bar editable in the form even if a native menu bar is used.
+ setNativeMenuBar(false);
m_addMenu->setText(tr("Type Here"));
addAction(m_addMenu);
diff --git a/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp b/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp
index 851bfc1..7574fdd 100644
--- a/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp
+++ b/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp
@@ -63,6 +63,7 @@
#include <QtGui/QApplication>
#include <QtGui/QToolBar>
#include <QtGui/QMainWindow>
+#include <QtGui/QMenuBar>
QT_BEGIN_NAMESPACE
@@ -611,9 +612,15 @@ QDesignerPropertySheet::QDesignerPropertySheet(QObject *object, QObject *parent)
createFakeProperty(QLatin1String("dragEnabled"));
// windowModality is visible only for the main container, in which case the form windows enables it on loading
setVisible(createFakeProperty(QLatin1String("windowModality")), false);
- if (qobject_cast<const QToolBar *>(d->m_object)) // prevent toolbars from being dragged off
+ if (qobject_cast<const QToolBar *>(d->m_object)) { // prevent toolbars from being dragged off
createFakeProperty(QLatin1String("floatable"), QVariant(true));
-
+ } else {
+ if (qobject_cast<const QMenuBar *>(d->m_object)) {
+ // Keep the menu bar editable in the form even if a native menu bar is used.
+ const bool nativeMenuBarDefault = !qApp->testAttribute(Qt::AA_DontUseNativeMenuBar);
+ createFakeProperty(QLatin1String("nativeMenuBar"), QVariant(nativeMenuBarDefault));
+ }
+ }
if (d->m_canHaveLayoutAttributes) {
static const QString layoutGroup = QLatin1String("Layout");
const char* fakeLayoutProperties[] = {
diff --git a/tools/designer/translations/translations.pro b/tools/designer/translations/translations.pro
index 8395259..c8cd76d 100644
--- a/tools/designer/translations/translations.pro
+++ b/tools/designer/translations/translations.pro
@@ -133,7 +133,7 @@ HEADERS += ../../shared/findwidget/abstractfindwidget.h \
TRANSLATIONS=$$[QT_INSTALL_TRANSLATIONS]/designer_de.ts \
$$[QT_INSTALL_TRANSLATIONS]/designer_ja.ts \
$$[QT_INSTALL_TRANSLATIONS]/designer_pl.ts \
+ $$[QT_INSTALL_TRANSLATIONS]/designer_ru.ts \
$$[QT_INSTALL_TRANSLATIONS]/designer_zh_CN.ts \
$$[QT_INSTALL_TRANSLATIONS]/designer_zh_TW.ts \
$$[QT_INSTALL_TRANSLATIONS]/designer_untranslated.ts
-
diff --git a/tools/linguist/phrasebooks/russian.qph b/tools/linguist/phrasebooks/russian.qph
index 69af041..9d40bd3 100644
--- a/tools/linguist/phrasebooks/russian.qph
+++ b/tools/linguist/phrasebooks/russian.qph
@@ -201,10 +201,6 @@
<target>разделить выбранные элементы</target>
</phrase>
<phrase>
- <source>dock</source>
- <target>док</target>
-</phrase>
-<phrase>
<source>document</source>
<target>документ</target>
</phrase>
@@ -302,7 +298,7 @@
</phrase>
<phrase>
<source>font style</source>
- <target>стиль шрифта</target>
+ <target>начертание</target>
</phrase>
<phrase>
<source>function key</source>
@@ -510,7 +506,7 @@
</phrase>
<phrase>
<source>OK</source>
- <target>Готово</target>
+ <target>ОК</target>
</phrase>
<phrase>
<source>OLE</source>
@@ -1038,10 +1034,6 @@
</phrase>
<phrase>
<source>OK</source>
- <target>Выбрать</target>
-</phrase>
-<phrase>
- <source>OK</source>
<target>Закрыть</target>
</phrase>
<phrase>
@@ -1092,4 +1084,84 @@
<source>Checkable</source>
<target>Переключаемое</target>
</phrase>
+<phrase>
+ <source>Style</source>
+ <target>Начертание</target>
+</phrase>
+<phrase>
+ <source>Point size</source>
+ <target>Размер</target>
+</phrase>
+<phrase>
+ <source>Family</source>
+ <target>Шрифт</target>
+</phrase>
+<phrase>
+ <source>Writing system</source>
+ <target>Система письма</target>
+</phrase>
+<phrase>
+ <source>OK</source>
+ <target>Удалить</target>
+</phrase>
+<phrase>
+ <source>Style</source>
+ <target>Стиль</target>
+</phrase>
+<phrase>
+ <source>Edit</source>
+ <target>Изменить</target>
+</phrase>
+<phrase>
+ <source>Invalid</source>
+ <target>Некорректный</target>
+</phrase>
+<phrase>
+ <source>Invalid</source>
+ <target>Некорректная</target>
+</phrase>
+<phrase>
+ <source>Invalid</source>
+ <target>Некорректное</target>
+</phrase>
+<phrase>
+ <source>tag</source>
+ <target>тэг</target>
+</phrase>
+<phrase>
+ <source>tab order</source>
+ <target>порядок обхода</target>
+</phrase>
+<phrase>
+ <source>Ascending</source>
+ <target>По возрастанию</target>
+</phrase>
+<phrase>
+ <source>Descending</source>
+ <target>По убыванию</target>
+</phrase>
+<phrase>
+ <source>Reset</source>
+ <target>Сбросить</target>
+</phrase>
+<phrase>
+ <source>Sort order</source>
+ <target>Порядок сортировки</target>
+</phrase>
+<phrase>
+ <source>Appearance</source>
+ <target>Внешний вид</target>
+</phrase>
+<phrase>
+ <source>View</source>
+ <target>Просмотр</target>
+</phrase>
+<phrase>
+ <source>Actions</source>
+ <target>Действия</target>
+</phrase>
+<phrase>
+ <source>Table of Contents</source>
+ <target>Оглавление</target>
+</phrase>
</QPH>