Merge remote-tracking branch 'origin/release' into stable

Change-Id: I89c251999ae2a82522b40471fd13f2e06b00ece8
This commit is contained in:
Frederik Gladhorn 2013-06-10 10:00:34 +02:00
commit 0eff16611f
13 changed files with 99 additions and 105 deletions

View File

@ -54,7 +54,7 @@ defineReplace(cmakeProcessLibs) {
variable = $$1
out =
for(v, variable) {
if(!equals(v, -framework)) {
if(!equals(v, -framework):!equals(v, -L.*)) {
v ~= s,^-l,,
v ~= s,^-lib,,
v ~= s,.lib$,,

View File

@ -2251,8 +2251,8 @@ void QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::E
if (!p->receivedExpose) {
if (p->resizeEventPending) {
// as a convenience for plugins, send a resize event before the first expose event if they haven't done so
QSize size = p->geometry.size();
QResizeEvent e(size, size);
// window->geometry() should have a valid size as soon as a handle exists.
QResizeEvent e(window->geometry().size(), p->geometry.size());
QGuiApplication::sendSpontaneousEvent(window, &e);
p->resizeEventPending = false;

View File

@ -1316,6 +1316,12 @@ void QFontEngineFT::doKerning(QGlyphLayout *g, QFontEngine::ShaperFlags flags) c
unlockFace();
}
}
if (shouldUseDesignMetrics(flags) && !(fontDef.styleStrategy & QFont::ForceIntegerMetrics))
flags |= DesignMetrics;
else
flags &= ~DesignMetrics;
QFontEngine::doKerning(g, flags);
}
@ -1571,12 +1577,18 @@ bool QFontEngineFT::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs
return true;
}
bool QFontEngineFT::shouldUseDesignMetrics(QFontEngine::ShaperFlags flags) const
{
if (!FT_IS_SCALABLE(freetype->face))
return false;
return default_hint_style == HintNone || default_hint_style == HintLight || (flags & DesignMetrics);
}
void QFontEngineFT::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlags flags) const
{
FT_Face face = 0;
bool design = (default_hint_style == HintNone ||
default_hint_style == HintLight ||
(flags & DesignMetrics)) && FT_IS_SCALABLE(freetype->face);
bool design = shouldUseDesignMetrics(flags);
for (int i = 0; i < glyphs->numGlyphs; i++) {
Glyph *g = cacheEnabled ? defaultGlyphSet.getGlyph(glyphs->glyphs[i]) : 0;
// Since we are passing Format_None to loadGlyph, use same default format logic as loadGlyph

View File

@ -325,6 +325,7 @@ private:
friend class QFontEngineMultiFontConfig;
int loadFlags(QGlyphSet *set, GlyphFormat format, int flags, bool &hsubpixel, int &vfactor) const;
bool shouldUseDesignMetrics(ShaperFlags flags) const;
GlyphFormat defaultFormat;
FT_Matrix matrix;

View File

@ -49,6 +49,8 @@
QT_BEGIN_NAMESPACE
class QCocoaMenuBar;
class QCocoaMenu : public QPlatformMenu
{
public:
@ -87,6 +89,8 @@ public:
QList<QCocoaMenuItem *> items() const;
QList<QCocoaMenuItem *> merged() const;
void setMenuBar(QCocoaMenuBar *menuBar);
QCocoaMenuBar *menuBar() const;
private:
QCocoaMenuItem *itemOrNull(int index) const;
void insertNative(QCocoaMenuItem *item, QCocoaMenuItem *beforeItem);
@ -97,6 +101,7 @@ private:
NSObject *m_delegate;
bool m_enabled;
quintptr m_tag;
QCocoaMenuBar *m_menuBar;
};
QT_END_NAMESPACE

View File

@ -215,7 +215,8 @@ QT_BEGIN_NAMESPACE
QCocoaMenu::QCocoaMenu() :
m_enabled(true),
m_tag(0)
m_tag(0),
m_menuBar(0)
{
m_delegate = [[QT_MANGLE_NAMESPACE(QCocoaMenuDelegate) alloc] initWithMenu:this];
m_nativeItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
@ -534,4 +535,14 @@ void QCocoaMenu::syncModalState(bool modal)
}
}
void QCocoaMenu::setMenuBar(QCocoaMenuBar *menuBar)
{
m_menuBar = menuBar;
}
QCocoaMenuBar *QCocoaMenu::menuBar() const
{
return m_menuBar;
}
QT_END_NAMESPACE

View File

@ -75,6 +75,8 @@ private:
static QCocoaMenuBar *findGlobalMenubar();
bool shouldDisable(QCocoaWindow *active) const;
void insertNativeMenu(QCocoaMenu *menu, QCocoaMenu *beforeMenu);
void removeNativeMenu(QCocoaMenu *menu);
QList<QCocoaMenu*> m_menus;
NSMenu *m_nativeMenu;

View File

@ -83,9 +83,24 @@ QCocoaMenuBar::~QCocoaMenuBar()
}
}
void QCocoaMenuBar::insertMenu(QPlatformMenu *platformMenu, QPlatformMenu *before)
void QCocoaMenuBar::insertNativeMenu(QCocoaMenu *menu, QCocoaMenu *beforeMenu)
{
QCocoaAutoReleasePool pool;
if (beforeMenu) {
NSUInteger nativeIndex = [m_nativeMenu indexOfItem:beforeMenu->nsMenuItem()];
[m_nativeMenu insertItem: menu->nsMenuItem() atIndex: nativeIndex];
} else {
[m_nativeMenu addItem: menu->nsMenuItem()];
}
menu->setMenuBar(this);
syncMenu(static_cast<QPlatformMenu *>(menu));
[m_nativeMenu setSubmenu: menu->nsMenu() forItem: menu->nsMenuItem()];
}
void QCocoaMenuBar::insertMenu(QPlatformMenu *platformMenu, QPlatformMenu *before)
{
QCocoaMenu *menu = static_cast<QCocoaMenu *>(platformMenu);
QCocoaMenu *beforeMenu = static_cast<QCocoaMenu *>(before);
#ifdef QT_COCOA_ENABLE_MENU_DEBUG
@ -96,39 +111,36 @@ void QCocoaMenuBar::insertMenu(QPlatformMenu *platformMenu, QPlatformMenu *befor
qWarning() << Q_FUNC_INFO << "This menu already belongs to the menubar, remove it first";
return;
}
if (beforeMenu) {
if (!m_menus.contains(beforeMenu)) {
qWarning() << Q_FUNC_INFO << "The before menu does not belong to the menubar";
return;
}
m_menus.insert(m_menus.indexOf(beforeMenu), menu);
NSUInteger nativeIndex = [m_nativeMenu indexOfItem:beforeMenu->nsMenuItem()];
[m_nativeMenu insertItem: menu->nsMenuItem() atIndex: nativeIndex];
} else {
m_menus.append(menu);
[m_nativeMenu addItem: menu->nsMenuItem()];
if (beforeMenu && !m_menus.contains(beforeMenu)) {
qWarning() << Q_FUNC_INFO << "The before menu does not belong to the menubar";
return;
}
platformMenu->setParent(this);
syncMenu(platformMenu);
[m_nativeMenu setSubmenu: menu->nsMenu() forItem: menu->nsMenuItem()];
m_menus.insert(beforeMenu ? m_menus.indexOf(beforeMenu) : m_menus.size(), menu);
if (!menu->menuBar())
insertNativeMenu(menu, beforeMenu);
}
void QCocoaMenuBar::removeNativeMenu(QCocoaMenu *menu)
{
QCocoaAutoReleasePool pool;
if (menu->menuBar() == this)
menu->setMenuBar(0);
NSUInteger realIndex = [m_nativeMenu indexOfItem:menu->nsMenuItem()];
[m_nativeMenu removeItemAtIndex: realIndex];
}
void QCocoaMenuBar::removeMenu(QPlatformMenu *platformMenu)
{
QCocoaAutoReleasePool pool;
QCocoaMenu *menu = static_cast<QCocoaMenu *>(platformMenu);
if (!m_menus.contains(menu)) {
qWarning() << Q_FUNC_INFO << "Trying to remove a menu that does not belong to the menubar";
return;
}
m_menus.removeOne(menu);
if (platformMenu->parent() == this)
platformMenu->setParent(0);
NSUInteger realIndex = [m_nativeMenu indexOfItem:menu->nsMenuItem()];
[m_nativeMenu removeItemAtIndex: realIndex];
removeNativeMenu(menu);
}
void QCocoaMenuBar::syncMenu(QPlatformMenu *menu)
@ -207,6 +219,20 @@ void QCocoaMenuBar::updateMenuBarImmediately()
m->syncModalState(disableForModal);
}
// reparent shared menu items if necessary.
// We browse the list in reverse order to be sure that the next items are redrawn before the current ones,
// in this way we are sure that "beforeMenu" (see below) is part of the native menu before "m" is redraw
for (int i = mb->m_menus.size() - 1; i >= 0; i--) {
QCocoaMenu *m = mb->m_menus.at(i);
QCocoaMenuBar *menuBar = m->menuBar();
if (menuBar != mb) {
QCocoaMenu *beforeMenu = i < (mb->m_menus.size() - 1) ? mb->m_menus.at(i + 1) : 0;
if (menuBar)
menuBar->removeNativeMenu(m);
mb->insertNativeMenu(m, beforeMenu);
}
}
QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader();
[loader ensureAppMenuInMenu:mb->nsMenu()];

View File

@ -433,6 +433,9 @@ QPlatformWindow *QWindowsIntegration::createPlatformWindow(QWindow *window) cons
return 0;
if (requested.flags != obtained.flags)
window->setFlags(obtained.flags);
// Trigger geometry change signals of QWindow.
if ((obtained.flags & Qt::Desktop) != Qt::Desktop && requested.geometry != obtained.geometry)
QWindowSystemInterface::handleGeometryChange(window, obtained.geometry);
return new QWindowsWindow(window, obtained);
}

View File

@ -1755,12 +1755,12 @@ void HtmlGenerator::generateHeader(const QString& title,
if (shortVersion.count(QChar('.')) == 2)
shortVersion.truncate(shortVersion.lastIndexOf(QChar('.')));
if (!project.isEmpty())
shortVersion = project + QLatin1Char(' ') + shortVersion + QLatin1String(": ");
shortVersion = QLatin1String(" | ") + project + QLatin1Char(' ') + shortVersion;
else
shortVersion = QLatin1String("Qt ") + shortVersion + QLatin1String(": ");
shortVersion = QLatin1String(" | ") + QLatin1String("Qt ") + shortVersion ;
// Generating page title
out() << " <title>" << shortVersion << protectEnc(title) << "</title>\n";
out() << " <title>" << protectEnc(title) << shortVersion << "</title>\n";
// Include style sheet and script links.
out() << headerStyles;

View File

@ -150,12 +150,11 @@ void QDialogPrivate::deletePlatformHelper()
provide a \l{#return}{return value}, and they can have \l{#default}{default buttons}. QDialogs can also have a QSizeGrip in their
lower-right corner, using setSizeGripEnabled().
Note that QDialog (an any other widget that has type Qt::Dialog) uses
the parent widget slightly differently from other classes in Qt. A
dialog is always a top-level widget, but if it has a parent, its
default location is centered on top of the parent's top-level widget
(if it is not top-level itself). It will also share the parent's
taskbar entry.
Note that QDialog (and any other widget that has type \c Qt::Dialog) uses
the parent widget slightly differently from other classes in Qt. A dialog is
always a top-level widget, but if it has a parent, its default location is
centered on top of the parent's top-level widget (if it is not top-level
itself). It will also share the parent's taskbar entry.
Use the overload of the QWidget::setParent() function to change
the ownership of a QDialog widget. This function allows you to

View File

@ -159,23 +159,6 @@ public slots:
}
};
#ifndef QT_NO_EXCEPTIONS
class QEventLoopTestException { };
class ExceptionThrower : public QObject
{
Q_OBJECT
public:
ExceptionThrower() : QObject() { }
public slots:
void throwException()
{
QEventLoopTestException e;
throw e;
}
};
#endif
class tst_QEventLoop : public QObject
{
Q_OBJECT
@ -183,9 +166,6 @@ private slots:
// This test *must* run first. See the definition for why.
void processEvents();
void exec();
#if !defined(QT_NO_EXCEPTIONS) && !defined(Q_OS_WINCE_WM)
void throwInExec();
#endif
void reexec();
void execAfterExit();
void wakeUp();
@ -322,53 +302,6 @@ void tst_QEventLoop::exec()
}
}
#if !defined(QT_NO_EXCEPTIONS) && !defined(Q_OS_WINCE_WM)
// Exceptions need to be enabled for this test
// Q_OS_WINCE_WM case: this platform doesn't support propagating exceptions through the event loop
// Windows Mobile cannot handle cross library exceptions
// qobject.cpp will try to rethrow the exception after handling
// which causes gwes.exe to crash
void tst_QEventLoop::throwInExec()
{
// exceptions compiled in, runtime tests follow.
#if defined(Q_OS_LINUX)
// C++ exceptions can't be passed through glib callbacks. Skip the test if
// we're using the glib event loop.
QByteArray dispatcher = QAbstractEventDispatcher::instance()->metaObject()->className();
if (dispatcher.contains("Glib")) {
QSKIP(
qPrintable(QString(
"Throwing exceptions in exec() won't work if %1 event dispatcher is used.\n"
"Try running with QT_NO_GLIB=1 in environment."
).arg(QString::fromLatin1(dispatcher)))
);
}
#endif
{
// QEventLoop::exec() is exception safe
QEventLoop eventLoop;
int caughtExceptions = 0;
try {
ExceptionThrower exceptionThrower;
QTimer::singleShot(EXEC_TIMEOUT, &exceptionThrower, SLOT(throwException()));
(void) eventLoop.exec();
} catch (...) {
++caughtExceptions;
}
try {
ExceptionThrower exceptionThrower;
QTimer::singleShot(EXEC_TIMEOUT, &exceptionThrower, SLOT(throwException()));
(void) eventLoop.exec();
} catch (...) {
++caughtExceptions;
}
QCOMPARE(caughtExceptions, 2);
}
}
#endif
void tst_QEventLoop::reexec()
{
QEventLoop loop;

View File

@ -8,3 +8,5 @@ TARGET = tst_qopengl
QT += gui gui-private core-private testlib
SOURCES += tst_qopengl.cpp
win32-msvc2010:contains(QT_CONFIG, angle):CONFIG += insignificant_test # QTBUG-31611