summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-04-29 14:17:08 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-04-29 14:17:09 +0200
commit85e3c53e5c5e2de993c90ece324a68d0ff62f417 (patch)
tree6f078576f01f18afcdae773e48664640ce795abe /src/gui/kernel
parent2e749c089f6fd93909e7cd4cc8129f2969b35185 (diff)
parent7f943968ade6a65321d4a00822f5b3a034a19e0c (diff)
Merge remote-tracking branch 'origin/stable' into dev
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qevent.cpp8
-rw-r--r--src/gui/kernel/qguiapplication.cpp7
-rw-r--r--src/gui/kernel/qkeysequence.cpp13
-rw-r--r--src/gui/kernel/qopenglcontext.cpp2
-rw-r--r--src/gui/kernel/qwindow.cpp8
-rw-r--r--src/gui/kernel/qwindow.h6
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp4
-rw-r--r--src/gui/kernel/qwindowsysteminterface.h2
-rw-r--r--src/gui/kernel/qwindowsysteminterface_p.h6
9 files changed, 41 insertions, 15 deletions
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 4f1f7d838f..c5be379b7d 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -966,7 +966,7 @@ QKeyEvent::~QKeyEvent()
\sa QApplication::keyboardModifiers()
*/
-//###### We must check with XGetModifierMapping
+
Qt::KeyboardModifiers QKeyEvent::modifiers() const
{
if (key() == Qt::Key_Shift)
@@ -977,6 +977,8 @@ Qt::KeyboardModifiers QKeyEvent::modifiers() const
return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::AltModifier);
if (key() == Qt::Key_Meta)
return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::MetaModifier);
+ if (key() == Qt::Key_AltGr)
+ return Qt::KeyboardModifiers(QInputEvent::modifiers()^Qt::GroupSwitchModifier);
return QInputEvent::modifiers();
}
@@ -990,10 +992,10 @@ Qt::KeyboardModifiers QKeyEvent::modifiers() const
*/
bool QKeyEvent::matches(QKeySequence::StandardKey matchKey) const
{
- uint searchkey = (modifiers() | key()) & ~(Qt::KeypadModifier); //The keypad modifier should not make a difference
+ //The keypad and group switch modifier should not make a difference
+ uint searchkey = (modifiers() | key()) & ~(Qt::KeypadModifier | Qt::GroupSwitchModifier);
const uint platform = QKeySequencePrivate::currentKeyPlatforms();
-
uint N = QKeySequencePrivate::numberOfKeyBindings;
int first = 0;
int last = N - 1;
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index fba516c135..3c79e62e75 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1640,6 +1640,10 @@ void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate
}
emit qApp->focusWindowChanged(newFocus);
+ if (previous)
+ emit previous->activeChanged();
+ if (newFocus)
+ emit newFocus->activeChanged();
}
void QGuiApplicationPrivate::processWindowStateChangedEvent(QWindowSystemInterfacePrivate::WindowStateChangedEvent *wse)
@@ -1736,6 +1740,9 @@ void QGuiApplicationPrivate::processCloseEvent(QWindowSystemInterfacePrivate::Cl
QCloseEvent event;
QGuiApplication::sendSpontaneousEvent(e->window.data(), &event);
+ if (e->accepted) {
+ *(e->accepted) = !event.isAccepted();
+ }
}
void QGuiApplicationPrivate::processFileOpenEvent(QWindowSystemInterfacePrivate::FileOpenEvent *e)
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index 44de8c5847..a0255f610a 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -1225,7 +1225,8 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence
*gmodifs << QModifKeyName(Qt::CTRL, QLatin1String("ctrl+"))
<< QModifKeyName(Qt::SHIFT, QLatin1String("shift+"))
<< QModifKeyName(Qt::ALT, QLatin1String("alt+"))
- << QModifKeyName(Qt::META, QLatin1String("meta+"));
+ << QModifKeyName(Qt::META, QLatin1String("meta+"))
+ << QModifKeyName(Qt::KeypadModifier, QLatin1String("numpad+"));
}
} else {
gmodifs = globalPortableModifs();
@@ -1233,7 +1234,8 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence
*gmodifs << QModifKeyName(Qt::CTRL, QLatin1String("ctrl+"))
<< QModifKeyName(Qt::SHIFT, QLatin1String("shift+"))
<< QModifKeyName(Qt::ALT, QLatin1String("alt+"))
- << QModifKeyName(Qt::META, QLatin1String("meta+"));
+ << QModifKeyName(Qt::META, QLatin1String("meta+"))
+ << QModifKeyName(Qt::KeypadModifier, QLatin1String("numpad+"));
}
}
if (!gmodifs) return ret;
@@ -1244,7 +1246,8 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence
modifs << QModifKeyName(Qt::CTRL, QCoreApplication::translate("QShortcut", "Ctrl").toLower().append(QLatin1Char('+')))
<< QModifKeyName(Qt::SHIFT, QCoreApplication::translate("QShortcut", "Shift").toLower().append(QLatin1Char('+')))
<< QModifKeyName(Qt::ALT, QCoreApplication::translate("QShortcut", "Alt").toLower().append(QLatin1Char('+')))
- << QModifKeyName(Qt::META, QCoreApplication::translate("QShortcut", "Meta").toLower().append(QLatin1Char('+')));
+ << QModifKeyName(Qt::META, QCoreApplication::translate("QShortcut", "Meta").toLower().append(QLatin1Char('+')))
+ << QModifKeyName(Qt::KeypadModifier, QCoreApplication::translate("QShortcut", "Numpad").toLower().append(QLatin1Char('+')));
}
modifs += *gmodifs; // Test non-translated ones last
@@ -1418,10 +1421,12 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat
addKey(s, nativeText ? QCoreApplication::translate("QShortcut", "Alt") : QString::fromLatin1("Alt"), format);
if ((key & Qt::SHIFT) == Qt::SHIFT)
addKey(s, nativeText ? QCoreApplication::translate("QShortcut", "Shift") : QString::fromLatin1("Shift"), format);
+ if ((key & Qt::KeypadModifier) == Qt::KeypadModifier)
+ addKey(s, nativeText ? QCoreApplication::translate("QShortcut", "Numpad") : QString::fromLatin1("Numpad"), format);
}
- key &= ~(Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier);
+ key &= ~(Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier | Qt::KeypadModifier);
QString p;
if (key && key < Qt::Key_Escape && key != Qt::Key_Space) {
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp
index 483baf0f09..c93752c3d7 100644
--- a/src/gui/kernel/qopenglcontext.cpp
+++ b/src/gui/kernel/qopenglcontext.cpp
@@ -759,7 +759,7 @@ bool QOpenGLContext::makeCurrent(QSurface *surface)
return false;
if (surface->surfaceType() != QSurface::OpenGLSurface) {
- qWarning() << "QOpenGLContext::makeCurrent() called with non-opengl surface";
+ qWarning() << "QOpenGLContext::makeCurrent() called with non-opengl surface" << surface;
return false;
}
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 8c9bc575bd..0dd85f2d56 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -874,6 +874,14 @@ bool QWindow::isExposed() const
}
/*!
+ \property QWindow::active
+ \brief the active status of the window
+ \since 5.1
+
+ \sa requestActivate()
+*/
+
+/*!
Returns true if the window should appear active from a style perspective.
This is the case for the window that has input focus as well as windows
diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h
index 9b1ed2c702..79f90f2c62 100644
--- a/src/gui/kernel/qwindow.h
+++ b/src/gui/kernel/qwindow.h
@@ -115,6 +115,7 @@ class Q_GUI_EXPORT QWindow : public QObject, public QSurface
Q_PROPERTY(int maximumWidth READ maximumWidth WRITE setMaximumWidth NOTIFY maximumWidthChanged REVISION 1)
Q_PROPERTY(int maximumHeight READ maximumHeight WRITE setMaximumHeight NOTIFY maximumHeightChanged REVISION 1)
Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
+ Q_PROPERTY(bool active READ isActive NOTIFY activeChanged REVISION 1)
Q_PROPERTY(Visibility visibility READ visibility WRITE setVisibility NOTIFY visibilityChanged REVISION 1)
Q_PROPERTY(Qt::ScreenOrientation contentOrientation READ contentOrientation WRITE reportContentOrientationChange NOTIFY contentOrientationChanged REVISION 1)
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged REVISION 1)
@@ -170,8 +171,6 @@ public:
void setMask(const QRegion &region);
QRegion mask() const;
- void requestActivate();
-
bool isActive() const;
void reportContentOrientationChange(Qt::ScreenOrientation orientation);
@@ -264,6 +263,8 @@ public:
static QWindow *fromWinId(WId id);
public Q_SLOTS:
+ Q_REVISION(1) void requestActivate();
+
void setVisible(bool visible);
void show();
@@ -310,6 +311,7 @@ Q_SIGNALS:
void visibleChanged(bool arg);
Q_REVISION(1) void visibilityChanged(QWindow::Visibility visibility);
+ Q_REVISION(1) void activeChanged();
Q_REVISION(1) void contentOrientationChanged(Qt::ScreenOrientation orientation);
void focusObjectChanged(QObject *object);
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index d2add91d66..7dc1e7f7e5 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -140,11 +140,11 @@ void QWindowSystemInterface::handleGeometryChange(QWindow *tlw, const QRect &new
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
}
-void QWindowSystemInterface::handleCloseEvent(QWindow *tlw)
+void QWindowSystemInterface::handleCloseEvent(QWindow *tlw, bool *accepted)
{
if (tlw) {
QWindowSystemInterfacePrivate::CloseEvent *e =
- new QWindowSystemInterfacePrivate::CloseEvent(tlw);
+ new QWindowSystemInterfacePrivate::CloseEvent(tlw, accepted);
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
}
}
diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h
index 212259c113..521c2a4941 100644
--- a/src/gui/kernel/qwindowsysteminterface.h
+++ b/src/gui/kernel/qwindowsysteminterface.h
@@ -131,7 +131,7 @@ public:
static void handleTouchCancelEvent(QWindow *w, ulong timestamp, QTouchDevice *device, Qt::KeyboardModifiers mods = Qt::NoModifier);
static void handleGeometryChange(QWindow *w, const QRect &newRect);
- static void handleCloseEvent(QWindow *w);
+ static void handleCloseEvent(QWindow *w, bool *accepted = 0);
static void handleEnterEvent(QWindow *w, const QPointF &local = QPointF(), const QPointF& global = QPointF());
static void handleLeaveEvent(QWindow *w);
static void handleEnterLeaveEvent(QWindow *enter, QWindow *leave, const QPointF &local = QPointF(), const QPointF& global = QPointF());
diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h
index f1bc4667f7..a6ea15c5f2 100644
--- a/src/gui/kernel/qwindowsysteminterface_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_p.h
@@ -105,9 +105,11 @@ public:
class CloseEvent : public WindowSystemEvent {
public:
- explicit CloseEvent(QWindow *w)
- : WindowSystemEvent(Close), window(w) { }
+ explicit CloseEvent(QWindow *w, bool *a = 0)
+ : WindowSystemEvent(Close), window(w), accepted(a)
+ { }
QPointer<QWindow> window;
+ bool *accepted;
};
class GeometryChangeEvent : public WindowSystemEvent {