Merge "Merge remote-tracking branch 'origin/release' into stable" into refs/staging/stable

This commit is contained in:
Frederik Gladhorn 2013-06-03 12:58:00 +02:00 committed by The Qt Project
commit 7315b3ab2f
38 changed files with 121 additions and 143 deletions

6
configure vendored
View File

@ -2344,12 +2344,6 @@ for e in gawk nawk awk; do
fi
done
# find perl
PERL="/usr/bin/perl"
if "$WHICH" perl >/dev/null 2>&1 && ( perl /dev/null ) >/dev/null 2>&1; then
PERL=`$WHICH perl`
fi
### skip this if the user just needs help...
if [ "$OPT_HELP" != "yes" ]; then

View File

@ -62,8 +62,8 @@ android:!bundled_jar_file {
} else {
DEX_CMD = $$SDK_ROOT/platform-tools/dx
!exists($$DEX_CMD): DEX_CMD = $$SDK_ROOT/build-tools/$$BUILD_TOOLS_REVISION/dx
!exists($$DEX_CMD): error("The path $$DEX_CMD does not exist. Please set the environment variable ANDROID_BUILD_TOOLS_REVISION to the revision of the build tools installed in your Android SDK.")
}
!exists($$DEX_CMD): error("The path $$DEX_CMD does not exist. Please set the environment variable ANDROID_BUILD_TOOLS_REVISION to the revision of the build tools installed in your Android SDK.")
QMAKE_LINK_SHLIB_CMD = $$DEX_CMD --dex --output $(TARGET) $$CLASS_DIR
} else {
QMAKE_LINK_SHLIB_CMD = jar cf $(TARGET) -C $$CLASS_DIR .

View File

@ -182,6 +182,7 @@ const char _Optimization[] = "Optimization";
const char _OptimizeReferences[] = "OptimizeReferences";
const char _OutputDirectory[] = "OutputDirectory";
const char _OutputFile[] = "OutputFile";
const char _PlatformToolSet[] = "PlatformToolSet";
const char _PrecompiledHeader[] = "PrecompiledHeader";
const char _PrecompiledHeaderFile[] = "PrecompiledHeaderFile";
const char _PrecompiledHeaderOutputFile[] = "PrecompiledHeaderOutputFile";
@ -467,10 +468,6 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProjectSingleConfig &tool)
<< attrTag("Condition", condition)
<< valueTag(tool.Configuration.IntermediateDirectory);
}
if (tool.Configuration.CompilerVersion >= NET2012) {
xml << tagValue("PlatformToolSet",
platformToolSetVersion(tool.Configuration.CompilerVersion));
}
if ( !tool.Configuration.PrimaryOutput.isEmpty() ) {
xml<< tag("TargetName")
<< attrTag("Condition", condition)
@ -668,10 +665,6 @@ void VCXProjectWriter::write(XmlOutput &xml, VCProject &tool)
<< attrTag("Condition", condition)
<< valueTag(config.IntermediateDirectory);
}
if (config.CompilerVersion >= NET2012) {
xml << tagValue("PlatformToolSet",
platformToolSetVersion(config.CompilerVersion));
}
if (!config.PrimaryOutput.isEmpty()) {
xml << tag("TargetName")
<< attrTag("Condition", condition)
@ -1649,6 +1642,7 @@ void VCXProjectWriter::write(XmlOutput &xml, const VCConfiguration &tool)
xml << tag("PropertyGroup")
<< attrTag("Condition", generateCondition(tool))
<< attrTag("Label", "Configuration")
<< attrTagS(_PlatformToolSet, platformToolSetVersion(tool.CompilerVersion))
<< attrTagS(_OutputDirectory, tool.OutputDirectory)
<< attrTagT(_ATLMinimizesCRunTimeLibraryUsage, tool.ATLMinimizesCRunTimeLibraryUsage)
<< attrTagT(_BuildBrowserInformation, tool.BuildBrowserInformation)
@ -2057,7 +2051,6 @@ QString VCXProjectWriter::platformToolSetVersion(const DotNET version)
case NET2012:
return "v110";
}
Q_ASSERT(!"This MSVC version does not support the PlatformToolSet tag!");
return QString();
}

View File

@ -78,7 +78,10 @@ template <typename T> inline void qbswap(const T src, uchar *dest)
// If you want to avoid the memcopy, you must write specializations for this function
template <typename T> inline void qToUnaligned(const T src, uchar *dest)
{
memcpy(dest, &src, sizeof(T));
// Using sizeof(T) inside memcpy function produces internal compiler error with
// MSVC2008/ARM in tst_endian -> use extra indirection to resolve size of T.
const size_t size = sizeof(T);
memcpy(dest, &src, size);
}
/* T qFromLittleEndian(const uchar *src)

View File

@ -52,6 +52,8 @@
#include "qelapsedtimer.h"
#include "qcoreapplication_p.h"
#include "qsysinfo.h"
#include <private/qthread_p.h>
#include <private/qmutexpool_p.h>
@ -305,8 +307,14 @@ static void resolveTimerAPI()
#endif
triedResolve = true;
#if !defined(Q_OS_WINCE)
# if defined(_MSC_VER) && _MSC_VER >= 1700
if (QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS8) { // QTBUG-27266, Disable when running MSVC2012-built code on pre-Windows 8
# else
{
# endif
qtimeSetEvent = (ptimeSetEvent)QSystemLibrary::resolve(QLatin1String("winmm"), "timeSetEvent");
qtimeKillEvent = (ptimeKillEvent)QSystemLibrary::resolve(QLatin1String("winmm"), "timeKillEvent");
}
#else
qtimeSetEvent = (ptimeSetEvent)QSystemLibrary::resolve(QLatin1String("Mmtimer"), "timeSetEvent");
qtimeKillEvent = (ptimeKillEvent)QSystemLibrary::resolve(QLatin1String("Mmtimer"), "timeKillEvent");

View File

@ -31,6 +31,8 @@ HEADERS += \
kernel/qplatformclipboard.h \
kernel/qplatformnativeinterface.h \
kernel/qplatformmenu.h \
kernel/qshapedpixmapdndwindow_p.h \
kernel/qsimpledrag_p.h \
kernel/qsurfaceformat.h \
kernel/qguiapplication.h \
kernel/qguiapplication_p.h \
@ -89,6 +91,8 @@ SOURCES += \
kernel/qplatformclipboard.cpp \
kernel/qplatformnativeinterface.cpp \
kernel/qsessionmanager.cpp \
kernel/qshapedpixmapdndwindow.cpp \
kernel/qsimpledrag.cpp \
kernel/qsurfaceformat.cpp \
kernel/qguiapplication.cpp \
kernel/qwindow.cpp \

View File

@ -49,6 +49,7 @@
#include <QtGui/private/qpixmap_raster_p.h>
#include <qpa/qplatformscreen_p.h>
#include <private/qdnd_p.h>
#include <private/qsimpledrag_p.h>
QT_BEGIN_NAMESPACE
@ -99,7 +100,11 @@ QPlatformClipboard *QPlatformIntegration::clipboard() const
*/
QPlatformDrag *QPlatformIntegration::drag() const
{
return 0;
static QSimpleDrag *drag = 0;
if (!drag) {
drag = new QSimpleDrag;
}
return drag;
}
#endif

View File

@ -510,15 +510,21 @@ QRect QPlatformWindow::initialGeometry(const QWindow *w,
}
}
if (w->isTopLevel() && qt_window_private(const_cast<QWindow*>(w))->positionAutomatic) {
const QWindow *tp = w->transientParent();
if (tp) {
// A transient window should be centered w.r.t. its transient parent.
rect.moveCenter(tp->geometry().center());
} else {
// Center the window on the screen. (Only applicable on platforms
// which do not provide a better way.)
QPlatformScreen *scr = QPlatformScreen::platformScreenForWindow(w);
rect.moveCenter(scr->availableGeometry().center());
if (const QPlatformScreen *platformScreen = QPlatformScreen::platformScreenForWindow(w)) {
const QRect availableGeometry = platformScreen->availableGeometry();
// Center unless the geometry ( + unknown window frame) is too large for the screen).
if (rect.height() < (availableGeometry.height() * 8) / 9
&& rect.width() < (availableGeometry.width() * 8) / 9) {
const QWindow *tp = w->transientParent();
if (tp) {
// A transient window should be centered w.r.t. its transient parent.
rect.moveCenter(tp->geometry().center());
} else {
// Center the window on the screen. (Only applicable on platforms
// which do not provide a better way.)
rect.moveCenter(availableGeometry.center());
}
}
}
}
return rect;

View File

@ -62,7 +62,7 @@
#include <private/qguiapplication_p.h>
#include <private/qdnd_p.h>
#include <QtPlatformSupport/private/qshapedpixmapdndwindow_p.h>
#include <private/qshapedpixmapdndwindow_p.h>
QT_BEGIN_NAMESPACE

View File

@ -56,7 +56,7 @@ class QEventLoop;
class QDropData;
class QShapedPixmapWindow;
class QBasicDrag : public QPlatformDrag, public QObject
class Q_GUI_EXPORT QBasicDrag : public QPlatformDrag, public QObject
{
public:
virtual ~QBasicDrag();
@ -99,7 +99,7 @@ private:
QShapedPixmapWindow *m_drag_icon_window;
};
class QSimpleDrag : public QBasicDrag
class Q_GUI_EXPORT QSimpleDrag : public QBasicDrag
{
public:
QSimpleDrag();

View File

@ -98,10 +98,12 @@ void QBackingStore::flush(const QRegion &region, QWindow *win, const QPoint &off
if (!win)
win = window();
#ifdef QBACKINGSTORE_DEBUG
if (win && win->isTopLevel() && !qt_window_private(win)->receivedExpose) {
qWarning().nospace() << "QBackingStore::flush() called with non-exposed window "
<< win << ", behavior is undefined";
}
#endif
d_ptr->platformBackingStore->flush(win, region, offset);
}

View File

@ -1579,10 +1579,7 @@ QGLContextPrivate::QGLContextPrivate(QGLContext *context)
{
group = new QGLContextGroup(context);
if (qApp) {
texture_destroyer = new QGLTextureDestroyer;
texture_destroyer->moveToThread(qApp->thread());
}
texture_destroyer = new QGLTextureDestroyer;
}
QGLContextPrivate::~QGLContextPrivate()

View File

@ -335,25 +335,16 @@ QT_END_NAMESPACE
Q_DECLARE_METATYPE(GLuint)
QT_BEGIN_NAMESPACE
class Q_OPENGL_EXPORT QGLTextureDestroyer : public QObject
class Q_OPENGL_EXPORT QGLTextureDestroyer
{
Q_OBJECT
public:
QGLTextureDestroyer() : QObject() {
connect(this, SIGNAL(freeTexture(QGLContext *, QPlatformPixmap *, quint32)),
this, SLOT(freeTexture_slot(QGLContext *, QPlatformPixmap *, quint32)));
}
void emitFreeTexture(QGLContext *context, QPlatformPixmap *boundPixmap, GLuint id) {
emit freeTexture(context, boundPixmap, id);
void emitFreeTexture(QGLContext *context, QPlatformPixmap *, GLuint id) {
if (context->contextHandle())
(new QOpenGLSharedResourceGuard(context->contextHandle(), id, freeTextureFunc))->free();
}
Q_SIGNALS:
void freeTexture(QGLContext *context, QPlatformPixmap *boundPixmap, quint32 id);
private slots:
void freeTexture_slot(QGLContext *context, QPlatformPixmap *boundPixmap, quint32 id) {
Q_UNUSED(boundPixmap);
QGLShareContextScope scope(context);
private:
static void freeTextureFunc(QOpenGLFunctions *, GLuint id) {
glDeleteTextures(1, &id);
}
};

View File

@ -1,6 +0,0 @@
HEADERS += \
$$PWD/qsimpledrag_p.h \
$$PWD/qshapedpixmapdndwindow_p.h
SOURCES += \
$$PWD/qsimpledrag.cpp \
$$PWD/qshapedpixmapdndwindow.cpp

View File

@ -9,7 +9,6 @@ PRECOMPILED_HEADER = ../corelib/global/qt_pch.h
include(cfsocketnotifier/cfsocketnotifier.pri)
include(cglconvenience/cglconvenience.pri)
include(dnd/dnd.pri)
include(eglconvenience/eglconvenience.pri)
include(eventdispatchers/eventdispatchers.pri)
include(fbconvenience/fbconvenience.pri)

View File

@ -45,7 +45,7 @@
#include <Cocoa/Cocoa.h>
#include <QtGui>
#include <qpa/qplatformdrag.h>
#include <QtPlatformSupport/private/qsimpledrag_p.h>
#include <private/qsimpledrag_p.h>
#include <QtGui/private/qdnd_p.h>

View File

@ -177,7 +177,7 @@ static inline QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *getMenuLoader()
}
QKeyEvent accel_ev(QEvent::ShortcutOverride, (keyCode & (~Qt::KeyboardModifierMask)),
Qt::KeyboardModifiers(keyCode & Qt::KeyboardModifierMask));
Qt::KeyboardModifiers(modifiers & Qt::KeyboardModifierMask));
accel_ev.ignore();
QCoreApplication::sendEvent(object, &accel_ev);
if (accel_ev.isAccepted()) {

View File

@ -136,6 +136,17 @@ void QCocoaMenuBar::syncMenu(QPlatformMenu *menu)
QCocoaMenu *cocoaMenu = static_cast<QCocoaMenu *>(menu);
Q_FOREACH (QCocoaMenuItem *item, cocoaMenu->items())
cocoaMenu->syncMenuItem(item);
// If the NSMenu has no visble items, or only separators, we should hide it
// on the menubar. This can happen after syncing the menu items since they
// can be moved to other menus.
BOOL shouldHide = YES;
for (NSMenuItem *item in [cocoaMenu->nsMenu() itemArray])
if (![item isSeparatorItem] && ![item isHidden]) {
shouldHide = NO;
break;
}
[cocoaMenu->nsMenuItem() setHidden:shouldHide];
}
void QCocoaMenuBar::handleReparent(QWindow *newParentWindow)

View File

@ -241,7 +241,8 @@ NSMenuItem *QCocoaMenuItem::sync()
mergeItem = [loader quitMenuItem];
break;
default:
m_textSynced = true;
if (!m_text.isEmpty())
m_textSynced = true;
break;
}
break;
@ -264,7 +265,7 @@ NSMenuItem *QCocoaMenuItem::sync()
m_native = nil; // create item below
m_merged = false;
}
} else {
} else if (!m_text.isEmpty()) {
m_textSynced = true; // NoRole, and that was set explicitly. So, nothing to do anymore.
}

View File

@ -823,6 +823,9 @@ NSWindow * QCocoaWindow::createNSWindow()
if (QSysInfo::QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) {
// Make popup winows show on the same desktop as the parent full-screen window.
[window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenAuxiliary];
if ((type & Qt::Popup) == Qt::Popup)
[window setAnimationBehavior:NSWindowAnimationBehaviorUtilityWindow];
}
#endif
window->m_cocoaPlatformWindow = this;

View File

@ -899,7 +899,6 @@ static QTouchDevice *touchDevice = 0;
ulong timestamp = [nsevent timestamp] * 1000;
ulong nativeModifiers = [nsevent modifierFlags];
Qt::KeyboardModifiers modifiers = [QNSView convertKeyModifiers: nativeModifiers];
NSString *charactersIgnoringModifiers = [nsevent charactersIgnoringModifiers];
NSString *characters = [nsevent characters];
// [from Qt 4 impl] There is no way to get the scan code from carbon. But we cannot
@ -911,19 +910,11 @@ static QTouchDevice *touchDevice = 0;
EventRef eventRef = EventRef([nsevent eventRef]);
GetEventParameter(eventRef, kEventParamKeyCode, typeUInt32, 0, sizeof(nativeVirtualKey), 0, &nativeVirtualKey);
QChar ch;
int keyCode;
if ([charactersIgnoringModifiers length] > 0) { // convert the first character into a key code
if ((modifiers & Qt::ControlModifier) && ([characters length] != 0)) {
ch = QChar([characters characterAtIndex:0]);
} else {
ch = QChar([charactersIgnoringModifiers characterAtIndex:0]);
}
QChar ch = QChar::ReplacementCharacter;
int keyCode = Qt::Key_unknown;
if ([characters length] != 0) {
ch = QChar([characters characterAtIndex:0]);
keyCode = [self convertKeyCode:ch];
} else {
// might be a dead key
ch = QChar::ReplacementCharacter;
keyCode = Qt::Key_unknown;
}
// we will send a key event unless the input method sets m_sendKeyEvent to false
@ -933,7 +924,7 @@ static QTouchDevice *touchDevice = 0;
if (eventType == QEvent::KeyPress) {
// ignore text for the U+F700-U+F8FF range. This is used by Cocoa when
// delivering function keys (e.g. arrow keys, backspace, F1-F35, etc.)
if ([charactersIgnoringModifiers length] == 1 && (ch.unicode() < 0xf700 || ch.unicode() > 0xf8ff))
if (ch.unicode() < 0xf700 || ch.unicode() > 0xf8ff)
text = QCFString::toQString(characters);
if (m_composingText.isEmpty())

View File

@ -111,21 +111,6 @@ public:
}
};
// Class for chaining to gether a bunch of fades. It pretty much is only used for qmenu fading.
class QMacWindowFader
{
QWidgetList m_windowsToFade;
float m_duration;
Q_DISABLE_COPY(QMacWindowFader)
public:
QMacWindowFader(); // PLEASE DON'T CALL THIS.
static QMacWindowFader *currentFader();
void registerWindowToFade(QWidget *window);
void setFadeDuration(float durationInSecs) { m_duration = durationInSecs; }
float fadeDuration() const { return m_duration; }
void performFade();
};
class Q_WIDGETS_EXPORT QMacCocoaAutoReleasePool
{
private:

View File

@ -89,7 +89,7 @@
#include <QtGui/QOpenGLContext>
#endif
#include <QtPlatformSupport/private/qsimpledrag_p.h>
#include <private/qsimpledrag_p.h>
#include <QtCore/QDebug>
#include <QtCore/QHash>

View File

@ -552,11 +552,15 @@ QVariant QWindowsIntegration::styleHint(QPlatformIntegration::StyleHint hint) co
break;
case QPlatformIntegration::UseRtlExtensions:
return QVariant(d->m_context.useRTLExtensions());
#ifdef Q_OS_WINCE
case QPlatformIntegration::SynthesizeMouseFromTouchEvents:
// We do not want Qt to synthesize mouse events as Windows also does that.
// Alternatively, Windows-generated touch mouse events can be identified and
// ignored by checking GetMessageExtraInfo() for MI_WP_SIGNATURE (0xFF515700).
return false;
#endif // Q_OS_WINCE
default:
break;
}
return QPlatformIntegration::styleHint(hint);
}

View File

@ -157,9 +157,19 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
QtWindows::WindowsEventType et,
MSG msg, LRESULT *result)
{
enum { signatureMask = 0xffffff00, miWpSignature = 0xff515700 };
if (et == QtWindows::MouseWheelEvent)
return translateMouseWheelEvent(window, hwnd, msg, result);
#ifndef Q_OS_WINCE
// Check for events synthesized from touch. Lower byte is touch index, 0 means pen.
const LPARAM extraInfo = GetMessageExtraInfo();
const bool fromTouch = (extraInfo & signatureMask) == miWpSignature && (extraInfo & 0xff);
if (fromTouch)
return false;
#endif // !Q_OS_WINCE
const QPoint winEventPosition(GET_X_LPARAM(msg.lParam), GET_Y_LPARAM(msg.lParam));
if (et & QtWindows::NonClientEventFlag) {
const QPoint globalPosition = winEventPosition;

View File

@ -503,15 +503,6 @@ QWindowsWindow::WindowData
const QWindowCreationContextPtr context(new QWindowCreationContext(w, rect, data.customMargins, style, exStyle));
QWindowsContext::instance()->setWindowCreationContext(context);
QRect screenGeometry;
if (QScreen *screen = w->screen())
screenGeometry = screen->availableVirtualGeometry();
if (context->frameX < screenGeometry.left())
context->frameX = screenGeometry.left();
if (context->frameY < screenGeometry.top())
context->frameY = screenGeometry.top();
if (QWindowsContext::verboseWindows)
qDebug().nospace()
<< "CreateWindowEx: " << w << *this

View File

@ -57,8 +57,8 @@
#include <qpa/qwindowsysteminterface.h>
#include <QtPlatformSupport/private/qshapedpixmapdndwindow_p.h>
#include <QtPlatformSupport/private/qsimpledrag_p.h>
#include <private/qshapedpixmapdndwindow_p.h>
#include <private/qsimpledrag_p.h>
QT_BEGIN_NAMESPACE

View File

@ -43,7 +43,7 @@
#define QXCBDRAG_H
#include <qpa/qplatformdrag.h>
#include <QtPlatformSupport/private/qsimpledrag_p.h>
#include <private/qsimpledrag_p.h>
#include <qxcbobject.h>
#include <xcb/xcb.h>
#include <qlist.h>

View File

@ -397,8 +397,11 @@ void CodeMarker::insert(FastSection &fastSection,
bool irrelevant = false;
bool inheritedMember = false;
if (!node->relates()) {
if (node->parent() != fastSection.parent_) { // && !node->parent()->isAbstract()) {
if ((node->parent()->subType() != Node::QmlClass) || !node->parent()->isAbstract()) {
InnerNode* p = node->parent();
if (p->subType() == Node::QmlPropertyGroup)
p = p->parent();
if (p != fastSection.parent_) { // && !node->parent()->isAbstract()) {
if (p->subType() != Node::QmlClass || !p->isAbstract()) {
//if (node->type() != Node::QmlProperty) {
inheritedMember = true;
}

View File

@ -3138,7 +3138,7 @@ void DitaXmlGenerator::generateOverviewList(const Node* relative)
// If we encounter a group definition page, we add all
// the pages in that group to the list for that group.
foreach (Node* member, docNode->members()) {
if (member->type() != Node::Document)
if (member->isInternal() || member->type() != Node::Document)
continue;
DocNode* page = static_cast<DocNode*>(member);
if (page) {
@ -3155,7 +3155,7 @@ void DitaXmlGenerator::generateOverviewList(const Node* relative)
// If we encounter a page that belongs to a group then
// we add that page to the list for that group.
const DocNode* gn = qdb_->getGroup(group);
if (gn)
if (gn && !docNode->isInternal())
docNodeMap[gn].insert(sortKey, docNode);
}
}

View File

@ -2644,7 +2644,7 @@ void HtmlGenerator::generateOverviewList(const Node *relative)
// If we encounter a group definition page, we add all
// the pages in that group to the list for that group.
foreach (Node *member, docNode->members()) {
if (member->type() != Node::Document)
if (member->isInternal() || member->type() != Node::Document)
continue;
DocNode *page = static_cast<DocNode *>(member);
if (page) {
@ -2661,7 +2661,7 @@ void HtmlGenerator::generateOverviewList(const Node *relative)
// If we encounter a page that belongs to a group then
// we add that page to the list for that group.
const DocNode* gn = qdb_->getGroup(group);
if (gn)
if (gn && !docNode->isInternal())
docNodeMap[gn].insert(sortKey, docNode);
}
}

View File

@ -862,9 +862,12 @@ Node* InnerNode::findChildNodeByNameAndType(const QString& name, Type type)
if (type == Function)
return primaryFunctionMap.value(name);
else {
Node *node = childMap.value(name);
if (node && node->type() == type)
return node;
QList<Node*> nodes = childMap.values(name);
for (int i=0; i<nodes.size(); ++i) {
Node* node = nodes.at(i);
if (node->type() == type)
return node;
}
}
return 0;
}

View File

@ -1183,8 +1183,13 @@ void QDocIndexFiles::generateIndexSections(QXmlStreamWriter& writer,
It is just a place holder for a collection of QML property
nodes. Recurse to its children, which are the QML property
nodes.
Do the same thing for collision nodes - we want children
of collision nodes in the index, but leaving out the
parent collision page will make searching for nodes easier.
*/
if (child->subType() == Node::QmlPropertyGroup) {
if (child->subType() == Node::QmlPropertyGroup ||
child->subType() == Node::Collision) {
const InnerNode* pgn = static_cast<const InnerNode*>(child);
foreach (Node* c, pgn->childNodes()) {
generateIndexSections(writer, c, generateInternalNodes);

View File

@ -3366,7 +3366,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
if (const QStyleOptionToolButton *tb = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) {
QStyleOptionToolButton myTb = *tb;
myTb.state &= ~State_AutoRaise;
if (w && qobject_cast<QToolBar *>(w->parentWidget())) {
if (QStyleHelper::hasAncestor(opt->styleObject, QAccessible::ToolBar)) {
QRect cr = tb->rect;
int shiftX = 0;
int shiftY = 0;
@ -3405,7 +3405,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
if (tb->toolButtonStyle != Qt::ToolButtonIconOnly) {
needText = true;
if (tb->toolButtonStyle == Qt::ToolButtonTextUnderIcon) {
QMainWindow *mw = qobject_cast<QMainWindow *>(w->window());
QMainWindow *mw = w ? qobject_cast<QMainWindow *>(w->window()) : 0;
if (mw && mw->unifiedTitleAndToolBarOnMac()) {
pr.setHeight(pixmap.size().height() / pixmap.devicePixelRatio());
cr.adjust(0, pr.bottom() + 1, 0, 1);

View File

@ -420,25 +420,17 @@ void QMenuPrivate::hideUpToMenuBar()
if (QMenu *m = qobject_cast<QMenu*>(caused)) {
caused = m->d_func()->causedPopup.widget;
if (!m->d_func()->tornoff)
hideMenu(m, fadeMenus);
hideMenu(m);
if (!fadeMenus) // Mac doesn't clear the action until after hidden.
m->d_func()->setCurrentAction(0);
} else { caused = 0;
}
}
#if defined(Q_WS_MAC)
if (fadeMenus) {
QEventLoop eventLoop;
QTimer::singleShot(int(MenuFadeTimeInSec * 1000), &eventLoop, SLOT(quit()));
QMacWindowFader::currentFader()->performFade();
eventLoop.exec();
}
#endif
}
setCurrentAction(0);
}
void QMenuPrivate::hideMenu(QMenu *menu, bool justRegister)
void QMenuPrivate::hideMenu(QMenu *menu)
{
if (!menu)
return;
@ -462,27 +454,10 @@ void QMenuPrivate::hideMenu(QMenu *menu, bool justRegister)
eventLoop.exec();
}
// Fade out.
if (menu->style()->styleHint(QStyle::SH_Menu_FadeOutOnHide)) {
// ### Qt 4.4:
// Should be something like: q->transitionWindow(Qt::FadeOutTransition, MenuFadeTimeInSec);
// Hopefully we'll integrate qt/research/windowtransitions into main before 4.4.
// Talk to Richard, Trenton or Bjoern.
#if defined(Q_WS_MAC)
if (justRegister) {
QMacWindowFader::currentFader()->setFadeDuration(MenuFadeTimeInSec);
QMacWindowFader::currentFader()->registerWindowToFade(menu);
} else {
macWindowFade(qt_mac_window_for(menu), MenuFadeTimeInSec);
}
#endif // Q_WS_MAC
}
aboutToHide = false;
menu->blockSignals(false);
#endif // QT_NO_EFFECTS
if (!justRegister)
menu->close();
menu->close();
}
void QMenuPrivate::popupAction(QAction *action, int delay, bool activateFirst)

View File

@ -189,7 +189,7 @@ public:
virtual QList<QPointer<QWidget> > calcCausedStack() const;
QMenuCaused causedPopup;
void hideUpToMenuBar();
void hideMenu(QMenu *menu, bool justRegister = false);
void hideMenu(QMenu *menu);
//index mappings
inline QAction *actionAt(int i) const { return q_func()->actions().at(i); }