if (d->m_objectType == ObjectLabel)
createFakeProperty(QLatin1String("buddy"), QVariant(QByteArray()));
- /* We need to create a fake property since the property does not work
- * for non-toplevel windows or on other systems than Mac and only if
- * it is above a certain Mac OS version. */
- if (qobject_cast<const QMainWindow *>(d->m_object))
- createFakeProperty(QLatin1String("unifiedTitleAndToolBarOnMac"), false);
}
if (qobject_cast<const QDialog*>(object)) {
defaultFileTypes(true),
fileNameLabelExplicitlySat(false),
nativeDialogInUse(false),
-#ifdef Q_WS_MAC
- mDelegate(0),
-#ifndef QT_MAC_USE_COCOA
- mDialog(0),
- mDialogStarted(false),
- mDialogClosed(true),
-#endif
-#endif
qFileDialogUi(0)
{
}
QString selectedNameFilter_sys() const;
//////////////////////////////////////////////
-#if defined(Q_WS_MAC)
- void *mDelegate;
-#ifndef QT_MAC_USE_COCOA
- NavDialogRef mDialog;
- bool mDialogStarted;
- bool mDialogClosed;
- QString mCurrentLocation;
- QString mCurrentSelection;
- QStringList mCurrentSelectionList;
-
- struct QtMacFilterName {
- QString description;
- QString regexp;
- QString filter;
- };
- struct QtMacNavFilterInfo {
- QtMacNavFilterInfo() : currentSelection(-1) {}
- int currentSelection;
- QList<QtMacFilterName> filters;
- } filterInfo;
-
- static void qt_mac_filedialog_event_proc(const NavEventCallbackMessage msg, NavCBRecPtr p,
- NavCallBackUserData data);
- static Boolean qt_mac_filedialog_filter_proc(AEDesc *theItem, void *info, void *data,
- NavFilterModes);
- bool showCarbonNavServicesDialog();
- bool hideCarbonNavServicesDialog();
- void createNavServicesDialog();
-#else
- bool showCocoaFilePanel();
- bool hideCocoaFilePanel();
-#endif
- void createNSOpenSavePanelDelegate();
- void QNSOpenSavePanelDelegate_selectionChanged(const QString &newPath);
- void QNSOpenSavePanelDelegate_panelClosed(bool accepted);
- void QNSOpenSavePanelDelegate_directoryEntered(const QString &newDir);
- void QNSOpenSavePanelDelegate_filterSelected(int menuIndex);
- void _q_macRunNativeAppModalPanel();
- void mac_nativeDialogModalHelp();
-#endif
-
QScopedPointer<Ui_QFileDialog> qFileDialogUi;
QString acceptLabel;
QActionGroup *printerGroup;
QAction *printAction;
QAction *pageSetupAction;
-#if defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA)
- QAction *closeAction;
-#endif
QPointer<QObject> receiverToDisconnectOnClose;
QByteArray memberToDisconnectOnClose;
toolbar->addSeparator();
toolbar->addAction(pageSetupAction);
toolbar->addAction(printAction);
-#if defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA)
- toolbar->addAction(closeAction);
-#endif
// Cannot use the actions' triggered signal here, since it doesn't autorepeat
QToolButton *zoomInButton = static_cast<QToolButton *>(toolbar->widgetForAction(zoomInAction));
qt_setupActionIcon(pageSetupAction, QLatin1String("page-setup"));
QObject::connect(printAction, SIGNAL(triggered(bool)), q, SLOT(_q_print()));
QObject::connect(pageSetupAction, SIGNAL(triggered(bool)), q, SLOT(_q_pageSetup()));
-#if defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA)
- closeAction = printerGroup->addAction(QCoreApplication::translate("QPrintPreviewDialog", "Close"));
- QObject::connect(closeAction, SIGNAL(triggered(bool)), q, SLOT(reject()));
-#endif
// Initial state:
fitPageAction->setChecked(true);
d->shown_once = true;
}
}
-#ifdef Q_WS_MAC
- QApplication::flush();
-#endif
}
if (progress == d->bar->maximum() && d->autoReset)
if (QApplicationPrivate::set_pal) {
QApplication::setPalette(*QApplicationPrivate::set_pal);
} else if (QApplicationPrivate::sys_pal) {
- QApplicationPrivate::initializeWidgetPaletteHash();
QApplicationPrivate::setPalette_helper(*QApplicationPrivate::sys_pal, /*className=*/0, /*clearWidgetPaletteHash=*/false);
} else if (!QApplicationPrivate::sys_pal) {
// Initialize the sys_pal if it hasn't happened yet...
break;
}
#endif // QT_NO_GESTURES
-#ifdef QT_MAC_USE_COCOA
- case QEvent::Enter:
- if (receiver->isWidgetType()) {
- QWidget *w = static_cast<QWidget *>(receiver);
- if (w->testAttribute(Qt::WA_AcceptTouchEvents))
- qt_widget_private(w)->registerTouchWindow(true);
- }
- res = d->notify_helper(receiver, e);
- break;
- case QEvent::Leave:
- if (receiver->isWidgetType()) {
- QWidget *w = static_cast<QWidget *>(receiver);
- if (w->testAttribute(Qt::WA_AcceptTouchEvents))
- qt_widget_private(w)->registerTouchWindow(false);
- }
- res = d->notify_helper(receiver, e);
- break;
-#endif
default:
res = d->notify_helper(receiver, e);
break;
static void setSystemPalette(const QPalette &pal);
static void setPalette_helper(const QPalette &palette, const char* className, bool clearWidgetPaletteHash);
- static void initializeWidgetPaletteHash();
static void setSystemFont(const QFont &font);
#if defined(Q_WS_X11)
"DTWM_IS_RUNNING\0"
"ENLIGHTENMENT_DESKTOP\0"
"_DT_SAVE_MODE\0"
- "_SGI_DESKS_MANAGER\0"
// EWMH (aka NETWM)
"_NET_SUPPORTED\0"
X11->desktopEnvironment = DE_CDE;
break;
}
-
- rc = XGetWindowProperty(X11->display, QX11Info::appRootWindow(),
- ATOM(_SGI_DESKS_MANAGER), 0, 1, False, XA_WINDOW,
- &type, &format, &length, &after, &data);
- if (rc == Success && length) {
- X11->desktopEnvironment = DE_4DWM;
- break;
- }
-
- if (XGetWindowProperty(X11->display, QX11Info::appRootWindow(),
- ATOM(_NET_SUPPORTING_WM_CHECK),
- 0, 1024, False, XA_WINDOW, &type,
- &format, &length, &after, &data) == Success) {
- if (type == XA_WINDOW && format == 32) {
- Window windowManagerWindow = *((Window*) data);
- XFree(data);
- data = 0;
-
- if (windowManagerWindow != XNone) {
- Atom utf8atom = ATOM(UTF8_STRING);
- if (XGetWindowProperty(QX11Info::display(), windowManagerWindow, ATOM(_NET_WM_NAME),
- 0, 1024, False, utf8atom, &type,
- &format, &length, &after, &data) == Success) {
- if (type == utf8atom && format == 8) {
- if (qstrcmp((const char *)data, "MCompositor") == 0)
- X11->desktopEnvironment = DE_MEEGO_COMPOSITOR;
- }
- }
- }
- }
- }
-
} while(0);
if (data)
#endif
}
-void QApplicationPrivate::initializeWidgetPaletteHash()
-{
-}
-
/*****************************************************************************
qt_cleanup() - cleans up when the application is finished
*****************************************************************************/
: QObject(parent), state(NotGesture), m_lastCustomGestureId(Qt::CustomGesture)
{
qRegisterMetaType<Qt::GestureState>();
-
-#if defined(Q_WS_MAC)
- registerGestureRecognizer(new QMacSwipeGestureRecognizer);
- registerGestureRecognizer(new QMacPinchGestureRecognizer);
- #if defined(QT_MAC_USE_COCOA)
- registerGestureRecognizer(new QMacPanGestureRecognizer);
- #endif
-#else
registerGestureRecognizer(new QPanGestureRecognizer);
registerGestureRecognizer(new QPinchGestureRecognizer);
registerGestureRecognizer(new QSwipeGestureRecognizer);
registerGestureRecognizer(new QTapGestureRecognizer);
-#endif
-#if defined(Q_OS_WIN)
- #if !defined(QT_NO_NATIVE_GESTURES)
- if (QApplicationPrivate::HasTouchSupport)
- registerGestureRecognizer(new QWinNativePanGestureRecognizer);
- #endif
-#else
registerGestureRecognizer(new QTapAndHoldGestureRecognizer);
-#endif
}
QGestureManager::~QGestureManager()
DE_KDE,
DE_GNOME,
DE_CDE,
- DE_MEEGO_COMPOSITOR,
DE_4DWM
};
DTWM_IS_RUNNING,
ENLIGHTENMENT_DESKTOP,
_DT_SAVE_MODE,
- _SGI_DESKS_MANAGER,
// EWMH (aka NETWM)
_NET_SUPPORTED,
|| e->timerId() == expireTimer.timerId()){
hideTimer.stop();
expireTimer.stop();
-#if defined(Q_WS_MAC) && !defined(QT_NO_EFFECTS)
- if (QApplication::isEffectEnabled(Qt::UI_FadeTooltip)){
- // Fade out tip on mac (makes it invisible).
- // The tip will not be deleted until a new tip is shown.
-
- // DRSWAT - Cocoa
- macWindowFade(qt_mac_window_for(this));
- QTipLabel::instance->fadingOut = true; // will never be false again.
- }
- else
- hideTipImmediately();
-#else
hideTipImmediately();
-#endif
}
}
bool QTipLabel::eventFilter(QObject *o, QEvent *e)
{
switch (e->type()) {
-#ifdef Q_WS_MAC
- case QEvent::KeyPress:
- case QEvent::KeyRelease: {
- int key = static_cast<QKeyEvent *>(e)->key();
- Qt::KeyboardModifiers mody = static_cast<QKeyEvent *>(e)->modifiers();
- if (!(mody & Qt::KeyboardModifierMask)
- && key != Qt::Key_Shift && key != Qt::Key_Control
- && key != Qt::Key_Alt && key != Qt::Key_Meta)
- hideTip();
- break;
- }
-#endif
case QEvent::Leave:
hideTip();
break;
}
#endif //QT_NO_STYLE_STYLESHEET
-
-#ifdef Q_WS_MAC
- // When in full screen mode, there is no Dock nor Menu so we can use
- // the whole screen for displaying the tooltip. However when not in
- // full screen mode we need to save space for the dock, so we use
- // availableGeometry instead.
- extern bool qt_mac_app_fullscreen; //qapplication_mac.mm
- QRect screen;
- if(qt_mac_app_fullscreen)
- screen = QApplication::desktop()->screenGeometry(getTipScreen(pos, w));
- else
- screen = QApplication::desktop()->availableGeometry(getTipScreen(pos, w));
-#else
- QRect screen = QApplication::desktop()->screenGeometry(getTipScreen(pos, w));
-#endif
+ const QRect screen = QApplication::desktop()->screenGeometry(getTipScreen(pos, w));
QPoint p = pos;
p += QPoint(2,
}
if (!text.isEmpty()){ // no tip can be reused, create new tip:
-#ifndef Q_WS_WIN
new QTipLabel(text, w); // sets QTipLabel::instance to itself
-#else
- // On windows, we can't use the widget as parent otherwise the window will be
- // raised when the tooltip will be shown
- new QTipLabel(text, QApplication::desktop()->screen(QTipLabel::getTipScreen(pos, w)));
-#endif
QTipLabel::instance->setTipRect(w, rect);
QTipLabel::instance->placeTip(pos, w);
QTipLabel::instance->setObjectName(QLatin1String("qtooltip_label"));
isWidget = true;
memset(high_attributes, 0, sizeof(high_attributes));
-#ifdef QT_MAC_USE_COCOA
- drawRectOriginalAdded = false;
- originalDrawMethod = true;
- changeMethods = false;
- isInUnifiedToolbar = false;
- unifiedSurface = 0;
- toolbar_ancestor = 0;
- flushRequested = false;
- touchEventsEnabled = false;
-#endif // QT_MAC_USE_COCOA
#ifdef QWIDGET_EXTRA_DEBUG
static int count = 0;
qDebug() << "widgets" << ++count;
d->blockSig = blocked;
-#ifdef QT_MAC_USE_COCOA
- // QCocoaView holds a pointer back to this widget. Clear it now
- // to make sure it's not followed later on. The lifetime of the
- // QCocoaView might exceed the lifetime of this widget in cases
- // where Cocoa itself holds references to it.
- extern void qt_mac_clearCocoaViewQWidgetPointers(QWidget *);
- qt_mac_clearCocoaViewQWidgetPointers(this);
-#endif
-
if (!d->children.isEmpty())
d->deleteChildren();
x->inTopLevelResize = false;
x->inRepaint = false;
x->embedded = 0;
-#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
- x->wasMaximized = false;
-#endif // Q_WS_MAC && QT_MAC_USE_COCOA
+
createTLSysExtra();
#ifdef QWIDGET_EXTRA_DEBUG
static int count = 0;
if (disableSubtractOpaqueSiblings || q->isWindow())
return;
-#ifdef QT_MAC_USE_COCOA
- if (q->d_func()->isInUnifiedToolbar)
- return;
-#endif // QT_MAC_USE_COCOA
-
QRect clipBoundingRect;
bool dirtyClipBoundingRect = true;
*/
void QWidget::showFullScreen()
{
-#ifdef Q_WS_MAC
- // If the unified toolbar is enabled, we have to disable it before going fullscreen.
- QMainWindow *mainWindow = qobject_cast<QMainWindow*>(this);
- if (mainWindow && mainWindow->unifiedTitleAndToolBarOnMac()) {
- mainWindow->setUnifiedTitleAndToolBarOnMac(false);
- QMainWindowLayout *mainLayout = qobject_cast<QMainWindowLayout*>(mainWindow->layout());
- mainLayout->activateUnifiedToolbarAfterFullScreen = true;
- }
-#endif // Q_WS_MAC
ensurePolished();
setWindowState((windowState() & ~(Qt::WindowMinimized | Qt::WindowMaximized))
setWindowState((windowState() & ~(Qt::WindowMinimized | Qt::WindowFullScreen))
| Qt::WindowMaximized);
-#ifdef Q_WS_MAC
- // If the unified toolbar was enabled before going fullscreen, we have to enable it back.
- QMainWindow *mainWindow = qobject_cast<QMainWindow*>(this);
- if (mainWindow)
- {
- QMainWindowLayout *mainLayout = qobject_cast<QMainWindowLayout*>(mainWindow->layout());
- if (mainLayout->activateUnifiedToolbarAfterFullScreen) {
- mainWindow->setUnifiedTitleAndToolBarOnMac(true);
- mainLayout->activateUnifiedToolbarAfterFullScreen = false;
- }
- }
-#endif // Q_WS_MAC
show();
}
setWindowState(windowState() & ~(Qt::WindowMinimized
| Qt::WindowMaximized
| Qt::WindowFullScreen));
-#ifdef Q_WS_MAC
- // If the unified toolbar was enabled before going fullscreen, we have to enable it back.
- QMainWindow *mainWindow = qobject_cast<QMainWindow*>(this);
- if (mainWindow)
- {
- QMainWindowLayout *mainLayout = qobject_cast<QMainWindowLayout*>(mainWindow->layout());
- if (mainLayout->activateUnifiedToolbarAfterFullScreen) {
- mainWindow->setUnifiedTitleAndToolBarOnMac(true);
- mainLayout->activateUnifiedToolbarAfterFullScreen = false;
- }
- }
-#endif // Q_WS_MAC
show();
}
if (rgn.isEmpty())
return;
-#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
- if (qt_mac_clearDirtyOnWidgetInsideDrawWidget)
- dirtyOnWidget = QRegion();
-
- // We disable the rendering of QToolBar in the backingStore if
- // it's supposed to be in the unified toolbar on Mac OS X.
- if (backingStore && isInUnifiedToolbar)
- return;
-#endif // Q_WS_MAC && QT_MAC_USE_COCOA
-
-
Q_Q(QWidget);
-#if !defined(QT_NO_GRAPHICSEFFECT) && !defined(Q_WS_MAC)
+#if !defined(QT_NO_GRAPHICSEFFECT)
if (graphicsEffect && graphicsEffect->isEnabled()) {
QGraphicsEffectSource *source = graphicsEffect->d_func()->source;
QWidgetEffectSourcePrivate *sourced = static_cast<QWidgetEffectSourcePrivate *>
*/
QByteArray QWidget::saveGeometry() const
{
-#ifdef QT_MAC_USE_COCOA
- // We check if the window was maximized during this invocation. If so, we need to record the
- // starting position as 0,0.
- Q_D(const QWidget);
- QRect newFramePosition = frameGeometry();
- QRect newNormalPosition = normalGeometry();
- if(d->topData()->wasMaximized && !(windowState() & Qt::WindowMaximized)) {
- // Change the starting position
- newFramePosition.moveTo(0, 0);
- newNormalPosition.moveTo(0, 0);
- }
-#endif // QT_MAC_USE_COCOA
QByteArray array;
QDataStream stream(&array, QIODevice::WriteOnly);
stream.setVersion(QDataStream::Qt_4_0);
stream << magicNumber
<< majorVersion
<< minorVersion
-#ifdef QT_MAC_USE_COCOA
- << newFramePosition
- << newNormalPosition
-#else
<< frameGeometry()
<< normalGeometry()
-#endif // QT_MAC_USE_COCOA
<< qint32(QApplication::desktop()->screenNumber(this))
<< quint8(windowState() & Qt::WindowMaximized)
<< quint8(windowState() & Qt::WindowFullScreen);
QWidget *widget = qobject_cast<QWidget*>(childList.at(i));
if (!widget || widget->isWindow() || widget->testAttribute(Qt::WA_WState_Hidden))
continue;
-#ifdef QT_MAC_USE_COCOA
- // Before doing anything we need to make sure that we don't leave anything in a non-consistent state.
- // When hiding a widget we need to make sure that no mouse_down events are active, because
- // the mouse_up event will never be received by a hidden widget or one of its descendants.
- // The solution is simple, before going through with this we check if there are any mouse_down events in
- // progress, if so we check if it is related to this widget or not. If so, we just reset the mouse_down and
- // then we continue.
- // In X11 and Windows we send a mouse_release event, however we don't do that here because we were already
- // ignoring that from before. I.e. Carbon did not send the mouse release event, so we will not send the
- // mouse release event. There are two ways to interpret this:
- // 1. If we don't send the mouse release event, the widget might get into an inconsistent state, i.e. it
- // might be waiting for a release event that will never arrive.
- // 2. If we send the mouse release event, then the widget might decide to trigger an action that is not
- // supposed to trigger because it is not visible.
- if(widget == qt_button_down)
- qt_button_down = 0;
-#endif // QT_MAC_USE_COCOA
if (spontaneous)
widget->setAttribute(Qt::WA_Mapped, false);
else
widget->d_func()->hide_sys();
}
}
-#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_MAC)
+#if defined(Q_WS_X11)
qApp->d_func()->sendSyntheticEnterLeave(widget);
#endif
#ifndef QT_NO_ACCESSIBILITY
if (children.isEmpty())
return 0;
-#ifdef Q_WS_MAC
- Q_Q(const QWidget);
- // Unified tool bars on the Mac require special handling since they live outside
- // QMainWindow's geometry(). See commit: 35667fd45ada49269a5987c235fdedfc43e92bb8
- bool includeFrame = q->isWindow() && qobject_cast<const QMainWindow *>(q)
- && static_cast<const QMainWindow *>(q)->unifiedTitleAndToolBarOnMac();
- if (includeFrame)
- return childAtRecursiveHelper(p, ignoreChildrenInDestructor, includeFrame);
-#endif
-
if (!pointInsideRectAndMask(p))
return 0;
return childAtRecursiveHelper(p, ignoreChildrenInDestructor);
}
-QWidget *QWidgetPrivate::childAtRecursiveHelper(const QPoint &p, bool ignoreChildrenInDestructor, bool includeFrame) const
+QWidget *QWidgetPrivate::childAtRecursiveHelper(const QPoint &p, bool ignoreChildrenInDestructor) const
{
-#ifndef Q_WS_MAC
- Q_UNUSED(includeFrame);
-#endif
for (int i = children.size() - 1; i >= 0; --i) {
QWidget *child = qobject_cast<QWidget *>(children.at(i));
if (!child || child->isWindow() || child->isHidden() || child->testAttribute(Qt::WA_TransparentForMouseEvents)
// Map the point 'p' from parent coordinates to child coordinates.
QPoint childPoint = p;
-#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
- // 'includeFrame' is true if the child's parent is a top-level QMainWindow with an unified tool bar.
- // An unified tool bar on the Mac lives outside QMainWindow's geometry(), so a normal
- // QWidget::mapFromParent won't do the trick.
- if (includeFrame && qobject_cast<QToolBar *>(child) && qt_widget_private(child)->isInUnifiedToolbar)
- childPoint = qt_mac_nativeMapFromParent(child, p);
- else
-#endif
childPoint -= child->data->crect.topLeft();
// Check if the point hits the child.
desktopWidget = parent;
bool newParent = (parent != parentWidget()) || !wasCreated || desktopWidget;
-#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_MAC)
+#if defined(Q_WS_X11)
if (newParent && parent && !desktopWidget) {
- if (testAttribute(Qt::WA_NativeWindow) && !qApp->testAttribute(Qt::AA_DontCreateNativeWidgetSiblings)
-#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
- // On Mac, toolbars inside the unified title bar will never overlap with
- // siblings in the content view. So we skip enforce native siblings in that case
- && !d->isInUnifiedToolbar && parentWidget() && parentWidget()->isWindow()
-#endif // Q_WS_MAC && QT_MAC_USE_COCOA
- )
+ if (testAttribute(Qt::WA_NativeWindow) && !qApp->testAttribute(Qt::AA_DontCreateNativeWidgetSiblings))
parent->d_func()->enforceNativeChildren();
else if (parent->d_func()->nativeChildrenForced() || parent->testAttribute(Qt::WA_PaintOnScreen))
setAttribute(Qt::WA_NativeWindow);
ic->setFocusWidget(0);
}
}
- if (!qApp->testAttribute(Qt::AA_DontCreateNativeWidgetSiblings) && parentWidget()
-#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
- // On Mac, toolbars inside the unified title bar will never overlap with
- // siblings in the content view. So we skip enforce native siblings in that case
- && !d->isInUnifiedToolbar && parentWidget()->isWindow()
-#endif // Q_WS_MAC && QT_MAC_USE_COCOA
- )
+ if (!qApp->testAttribute(Qt::AA_DontCreateNativeWidgetSiblings) && parentWidget())
parentWidget()->d_func()->enforceNativeChildren();
if (on && !internalWinId() && testAttribute(Qt::WA_WState_Created))
d->createWinId();
d->extra->mask = newMask;
d->extra->hasMask = !newMask.isEmpty();
-#ifndef QT_MAC_USE_COCOA
if (!testAttribute(Qt::WA_WState_Created))
return;
-#endif
d->setMask_sys(newMask);
handle could not be created.
*/
-
-#ifdef QT_MAC_USE_COCOA
-void QWidgetPrivate::syncUnifiedMode() {
- // The whole purpose of this method is to keep the unifiedToolbar in sync.
- // That means making sure we either exchange the drawing methods or we let
- // the toolbar know that it does not require to draw the baseline.
- Q_Q(QWidget);
- // This function makes sense only if this is a top level
- if(!q->isWindow())
- return;
- OSWindowRef window = qt_mac_window_for(q);
- if(changeMethods) {
- // Ok, we are in documentMode.
- if(originalDrawMethod)
- qt_mac_replaceDrawRect(window, this);
- } else {
- if(!originalDrawMethod)
- qt_mac_replaceDrawRectOriginal(window, this);
- }
-}
-
-#endif // QT_MAC_USE_COCOA
-
QT_END_NAMESPACE
#include "moc_qwidget.h"
void setConstraints_sys();
bool pointInsideRectAndMask(const QPoint &) const;
QWidget *childAt_helper(const QPoint &, bool) const;
- QWidget *childAtRecursiveHelper(const QPoint &p, bool, bool includeFrame = false) const;
+ QWidget *childAtRecursiveHelper(const QPoint &p, bool) const;
void updateGeometry_helper(bool forceUpdate);
void getLayoutItemMargins(int *left, int *top, int *right, int *bottom) const;
int QImageTextureGlyphCache::glyphMargin() const
{
-#if (defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)) || defined(Q_WS_X11)
+#if defined(Q_WS_X11)
return 0;
#else
return m_type == QFontEngineGlyphCache::Raster_RGBMask ? 2 : 0;
****************************************************************************/
#include <qdebug.h>
-
-#include <qglobal.h> // for Q_WS_WIN define (non-PCH)
-#ifdef Q_WS_WIN
-#include <qlibrary.h>
-#include <qt_windows.h>
-#endif
-
-#include <QtGui/qpaintdevice.h>
-#include <QtGui/qwidget.h>
+#include <qpaintdevice.h>
+#include <qwidget.h>
#include "qwindowsurface_raster_p.h"
#include "qimage.h"
#endif
#include "qdrawhelper_p.h"
-#ifdef Q_WS_MAC
-#include <qt_cocoa_helpers_mac_p.h>
-#include <QMainWindow>
-#include <qmainwindowlayout_p.h>
-#include <QToolBar>
-#endif
-
QT_BEGIN_NAMESPACE
class QRasterWindowSurfacePrivate
#endif
d_ptr->image = 0;
d_ptr->inSetGeometry = false;
-
-#ifdef QT_MAC_USE_COCOA
- needsFlush = false;
- regionToFlush = QRegion();
-#endif // QT_MAC_USE_COCOA
}
syncX();
#endif
-#if (defined(Q_WS_X11) && !defined(QT_NO_XRENDER)) || (defined(Q_WS_WIN) && !defined(Q_WS_WINCE))
+#if defined(Q_WS_X11) && !defined(QT_NO_XRENDER)
if (!qt_widget_private(window())->isOpaque && window()->testAttribute(Qt::WA_TranslucentBackground)) {
-#if defined(Q_WS_WIN) && !defined(Q_WS_WINCE)
- if (d_ptr->image->format() != QImage::Format_ARGB32_Premultiplied)
- prepareBuffer(QImage::Format_ARGB32_Premultiplied, window());
-#endif
QPainter p(d_ptr->image);
p.setCompositionMode(QPainter::CompositionMode_Source);
const QVector<QRect> rects = rgn.rects();
if (!d->image || rgn.rectCount() == 0)
return;
-#ifdef Q_WS_WIN
- QRect br = rgn.boundingRect();
-
-#ifndef Q_WS_WINCE
- if (!qt_widget_private(window())->isOpaque
- && window()->testAttribute(Qt::WA_TranslucentBackground)
- && (qt_widget_private(window())->data.window_flags & Qt::FramelessWindowHint))
- {
- QRect r = window()->frameGeometry();
- QPoint frameOffset = qt_widget_private(window())->frameStrut().topLeft();
- QRect dirtyRect = br.translated(offset + frameOffset);
-
- SIZE size = {r.width(), r.height()};
- POINT ptDst = {r.x(), r.y()};
- POINT ptSrc = {0, 0};
- BLENDFUNCTION blend = {AC_SRC_OVER, 0, (BYTE)(255.0 * window()->windowOpacity()), Q_AC_SRC_ALPHA};
- RECT dirty = {dirtyRect.x(), dirtyRect.y(),
- dirtyRect.x() + dirtyRect.width(), dirtyRect.y() + dirtyRect.height()};
- Q_UPDATELAYEREDWINDOWINFO info = {sizeof(info), NULL, &ptDst, &size, d->image->hdc, &ptSrc, 0, &blend, Q_ULW_ALPHA, &dirty};
- ptrUpdateLayeredWindowIndirect(window()->internalWinId(), &info);
- } else
-#endif
- {
- QPoint wOffset = qt_qwidget_data(widget)->wrect.topLeft();
-
- HDC widget_dc = widget->getDC();
-
- QRect wbr = br.translated(-wOffset);
- BitBlt(widget_dc, wbr.x(), wbr.y(), wbr.width(), wbr.height(),
- d->image->hdc, br.x() + offset.x(), br.y() + offset.y(), SRCCOPY);
- widget->releaseDC(widget_dc);
- }
-
-#ifndef QT_NO_DEBUG
- static bool flush = !qgetenv("QT_FLUSH_WINDOWSURFACE").isEmpty();
- if (flush) {
- SelectObject(qt_win_display_dc(), GetStockObject(BLACK_BRUSH));
- Rectangle(qt_win_display_dc(), 0, 0, d->image->width() + 2, d->image->height() + 2);
- BitBlt(qt_win_display_dc(), 1, 1, d->image->width(), d->image->height(),
- d->image->hdc, 0, 0, SRCCOPY);
- }
-#endif
-
-#endif
-
#ifdef Q_WS_X11
extern void *qt_getClipRects(const QRegion &r, int &num); // in qpaintengine_x11.cpp
QPoint wOffset = qt_qwidget_data(widget)->wrect.topLeft();
if (wrgn.rectCount() != 1)
XSetClipMask(X11->display, d_ptr->gc, XNone);
#endif // Q_WS_X11
-
-#ifdef Q_WS_MAC
-
- Q_UNUSED(offset);
-
- // This is mainly done for native components like native "open file" dialog.
- if (widget->testAttribute(Qt::WA_DontShowOnScreen)) {
- return;
- }
-
-#ifdef QT_MAC_USE_COCOA
-
- this->needsFlush = true;
- this->regionToFlush += rgn;
-
- // The actual flushing will be processed in [view drawRect:rect]
- qt_mac_setNeedsDisplay(widget);
-
-#else
- // Get a context for the widget.
- CGContextRef context;
- CGrafPtr port = GetWindowPort(qt_mac_window_for(widget));
- QDBeginCGContext(port, &context);
- CGContextRetain(context);
- CGContextSaveGState(context);
-
- // Flip context.
- CGContextTranslateCTM(context, 0, widget->height());
- CGContextScaleCTM(context, 1, -1);
-
- // Clip to region.
- const QVector<QRect> &rects = rgn.rects();
- for (int i = 0; i < rects.size(); ++i) {
- const QRect &rect = rects.at(i);
- CGContextAddRect(context, CGRectMake(rect.x(), rect.y(), rect.width(), rect.height()));
- }
- CGContextClip(context);
-
- QRect r = rgn.boundingRect().intersected(d->image->rect());
- const CGRect area = CGRectMake(r.x(), r.y(), r.width(), r.height());
- CGImageRef image = CGBitmapContextCreateImage(d->image->cg);
- CGImageRef subImage = CGImageCreateWithImageInRect(image, area);
-
- qt_mac_drawCGImage(context, &area, subImage);
-
- CGImageRelease(subImage);
- CGImageRelease(image);
-
- QDEndCGContext(port, &context);
-
- // Restore context.
- CGContextRestoreGState(context);
- CGContextRelease(context);
-#endif // QT_MAC_USE_COCOA
-
-#endif // Q_WS_MAC
-
}
void QRasterWindowSurface::setGeometry(const QRect &rect)
Q_D(QRasterWindowSurface);
d->inSetGeometry = true;
if (d->image == 0 || d->image->width() < rect.width() || d->image->height() < rect.height()) {
-#if (defined(Q_WS_X11) && !defined(QT_NO_XRENDER)) || (defined(Q_WS_WIN) && !defined(Q_WS_WINCE))
-#ifndef Q_WS_WIN
+#if defined(Q_WS_X11) && !defined(QT_NO_XRENDER)
if (d_ptr->translucentBackground)
-#else
- if (!qt_widget_private(window())->isOpaque)
-#endif
prepareBuffer(QImage::Format_ARGB32_Premultiplied, window());
else
#endif
prepareBuffer(QImage::systemFormat(), window());
}
d->inSetGeometry = false;
-
-#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
- QMainWindow* mWindow = qobject_cast<QMainWindow*>(window());
- if (mWindow) {
- QMainWindowLayout *mLayout = qobject_cast<QMainWindowLayout*>(mWindow->layout());
- QList<QToolBar *> toolbarList = mLayout->qtoolbarsInUnifiedToolbarList;
-
- for (int i = 0; i < toolbarList.size(); ++i) {
- QToolBar* toolbar = toolbarList.at(i);
- if (mLayout->toolBarArea(toolbar) == Qt::TopToolBarArea) {
- QWidget* tbWidget = (QWidget*) toolbar;
- if (tbWidget->d_func()->unifiedSurface) {
- tbWidget->d_func()->unifiedSurface->setGeometry(rect);
- }
- }
- }
- }
-#endif // Q_WS_MAC && QT_MAC_USE_COCOA
-
}
// from qwindowsurface.cpp
bool QRasterWindowSurface::scroll(const QRegion &area, int dx, int dy)
{
-#ifdef Q_WS_WIN
- Q_D(QRasterWindowSurface);
-
- if (!d->image || !d->image->hdc)
- return false;
-
- QRect rect = area.boundingRect();
- BitBlt(d->image->hdc, rect.x()+dx, rect.y()+dy, rect.width(), rect.height(),
- d->image->hdc, rect.x(), rect.y(), SRCCOPY);
-
- return true;
-#else
Q_D(QRasterWindowSurface);
if (!d->image || d->image->isNull())
qt_scrollRectInImage(d->image, rects.at(i), QPoint(dx, dy));
return true;
-#endif
}
QWindowSurface::WindowSurfaceFeatures QRasterWindowSurface::features() const
delete oldImage;
}
-#ifdef QT_MAC_USE_COCOA
-CGContextRef QRasterWindowSurface::imageContext()
-{
- Q_D(QRasterWindowSurface);
- return d->image->cg;
-}
-#endif // QT_MAC_USE_COCOA
-
QT_END_NAMESPACE
#include <qglobal.h>
#include "qwindowsurface_p.h"
-#ifdef QT_MAC_USE_COCOA
-# include <qt_cocoa_helpers_mac_p.h>
-#endif // QT_MAC_USE_COCOA
-
QT_BEGIN_NAMESPACE
-#ifdef Q_WS_WIN
-#define Q_WS_EX_LAYERED 0x00080000 // copied from WS_EX_LAYERED in winuser.h
-#define Q_LWA_ALPHA 0x00000002 // copied from LWA_ALPHA in winuser.h
-#define Q_ULW_ALPHA 0x00000002 // copied from ULW_ALPHA in winuser.h
-#define Q_AC_SRC_ALPHA 0x00000001 // copied from AC_SRC_ALPHA in winuser.h
-
-struct Q_UPDATELAYEREDWINDOWINFO {
- DWORD cbSize;
- HDC hdcDst;
- const POINT *pptDst;
- const SIZE *psize;
- HDC hdcSrc;
- const POINT *pptSrc;
- COLORREF crKey;
- const BLENDFUNCTION *pblend;
- DWORD dwFlags;
- const RECT *prcDirty;
-};
-
-typedef BOOL (WINAPI *PtrUpdateLayeredWindow)(HWND hwnd, HDC hdcDst, const POINT *pptDst,
- const SIZE *psize, HDC hdcSrc, const POINT *pptSrc, COLORREF crKey,
- const BLENDFUNCTION *pblend, DWORD dwflags);
-typedef BOOL (WINAPI *PtrUpdateLayeredWindowIndirect)(HWND hwnd, const Q_UPDATELAYEREDWINDOWINFO *pULWInfo);
-extern PtrUpdateLayeredWindow ptrUpdateLayeredWindow;
-extern PtrUpdateLayeredWindowIndirect ptrUpdateLayeredWindowIndirect;
-#endif
-
class QPaintDevice;
class QPoint;
class QRegion;
bool scroll(const QRegion &area, int dx, int dy);
WindowSurfaceFeatures features() const;
-#ifdef QT_MAC_USE_COCOA
- CGContextRef imageContext();
-
- bool needsFlush;
- QRegion regionToFlush;
-#endif // QT_MAC_USE_COCOA
-
private:
#if defined(Q_WS_X11) && !defined(QT_NO_XSHM)
void syncX();
int length = layoutData->string.length();
if (!length)
return;
-#if defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA)
- // ATSUI requires RTL flags to correctly identify the character stops.
- bool ignore = false;
-#else
- bool ignore = ignoreBidi;
-#endif
+ bool ignore = ignoreBidi;
bool rtl = isRightToLeft();
-
if (!ignore && !rtl) {
ignore = true;
const QChar *start = layoutData->string.unicode();
&& (p->transform().type() > QTransform::TxTranslate);
if (toggleAntialiasing)
p->setRenderHint(QPainter::Antialiasing);
-#if defined(QT_MAC_USE_COCOA)
- // Always draw the cursor aligned to pixel boundary.
- x = qRound(x);
-#endif
p->fillRect(QRectF(x, y, qreal(width), (base + descent + 1).toReal()), p->pen().brush());
if (toggleAntialiasing)
p->setRenderHint(QPainter::Antialiasing, false);
delete d->popup;
if (popup->model() != d->proxy)
popup->setModel(d->proxy);
-#if defined(Q_OS_MAC) && !defined(QT_MAC_USE_COCOA)
- popup->show();
-#else
popup->hide();
-#endif
Qt::FocusPolicy origPolicy = Qt::NoFocus;
if (d->widget)
titleLabel->setText(title);
QFont f = titleLabel->font();
f.setBold(true);
-#ifdef Q_WS_WINCE
- f.setPointSize(f.pointSize() - 2);
-#endif
titleLabel->setFont(f);
titleLabel->setTextFormat(Qt::PlainText); // to maintain compat with windows
-#ifdef Q_WS_WINCE
- const int iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize);
- const int closeButtonSize = style()->pixelMetric(QStyle::PM_SmallIconSize) - 2;
-#else
const int iconSize = 18;
const int closeButtonSize = 15;
-#endif
QPushButton *closeButton = new QPushButton;
closeButton->setIcon(style()->standardIcon(QStyle::SP_TitleBarCloseButton));
QObject::connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));
QLabel *msgLabel = new QLabel;
-#ifdef Q_WS_WINCE
- f.setBold(false);
- msgLabel->setFont(f);
-#endif
msgLabel->installEventFilter(this);
msgLabel->setText(message);
msgLabel->setTextFormat(Qt::PlainText);
msgLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft);
// smart size for the message label
-#ifdef Q_WS_WINCE
- int limit = QApplication::desktop()->availableGeometry(msgLabel).size().width() / 2;
-#else
- int limit = QApplication::desktop()->availableGeometry(msgLabel).size().width() / 3;
-#endif
+ const int limit = QApplication::desktop()->availableGeometry(msgLabel).size().width() / 3;
if (msgLabel->sizeHint().width() > limit) {
msgLabel->setWordWrap(true);
if (msgLabel->sizeHint().width() > limit) {
control->document()->setDefaultTextOption(opt);
}
}
-#ifdef Q_WS_WINCE
- // Make sure that the text isn't wrapped "somewhere" in the balloon widget
- // in the case that we have a long title label.
- setMaximumWidth(limit);
-#else
// Here we allow the text being much smaller than the balloon widget
// to emulate the weird standard windows behavior.
msgLabel->setFixedSize(limit, msgLabel->heightForWidth(limit));
-#endif
}
QIcon si;
painter.drawPixmap(rect(), pixmap);
}
-void QBalloonTip::resizeEvent(QResizeEvent *ev)
-{
- QWidget::resizeEvent(ev);
-}
-
void QBalloonTip::balloon(const QPoint& pos, int msecs, bool showArrow)
{
QRect scr = QApplication::desktop()->screenGeometry(pos);
protected:
void paintEvent(QPaintEvent *);
- void resizeEvent(QResizeEvent *);
void mousePressEvent(QMouseEvent *e);
void timerEvent(QTimerEvent *e);
d->exclusive = exclusive;
}
-
-// TODO: Qt 5: Merge with addButton(QAbstractButton *button, int id)
-void QButtonGroup::addButton(QAbstractButton *button)
-{
- addButton(button, -1);
-}
-
void QButtonGroup::addButton(QAbstractButton *button, int id)
{
Q_D(QButtonGroup);
}
/*!
- \fn void QAbstractButton::paintEvent(QPaintEvent *e)
- \reimp
-*/
-
-/*!
\fn void QAbstractButton::pressed()
This signal is emitted when the button is pressed down.
void toggled(bool checked);
protected:
- virtual void paintEvent(QPaintEvent *e) = 0;
virtual bool hitButton(const QPoint &pos) const;
virtual void checkStateSet();
virtual void nextCheckState();
void setExclusive(bool);
bool exclusive() const;
- void addButton(QAbstractButton *);
- void addButton(QAbstractButton *, int id);
+ void addButton(QAbstractButton *, int id = -1);
void removeButton(QAbstractButton *);
QList<QAbstractButton*> buttons() const;
}
j++;
-#ifndef QT_MAC_USE_COCOA
sepWidget->raise();
-#endif
QRect sepRect = separatorRect(i).adjusted(-2, -2, 2, 2);
sepWidget->setGeometry(sepRect);
sepWidget->setMask( QRegion(separatorRect(i).translated( - sepRect.topLeft())));
}
j++;
-#ifndef QT_MAC_USE_COCOA
sepWidget->raise();
-#endif
QRect sepRect = separatorRect(i).adjusted(-2, -2, 2, 2);
sepWidget->setGeometry(sepRect);
sepWidget->setMask( QRegion(separatorRect(i).translated( - sepRect.topLeft())));
q->setWindowFlags(flags);
-#if defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA)
- if (floating && nativeDeco && (q->features() & QDockWidget::DockWidgetVerticalTitleBar)) {
- ChangeWindowAttributes(HIViewGetWindow(HIViewRef(q->winId())), kWindowSideTitlebarAttribute, 0);
- }
-#endif
-
if (!rect.isNull())
q->setGeometry(rect);
return false;
}
-/*! \reimp */
-bool QFocusFrame::event(QEvent *e)
-{
- return QWidget::event(e);
-}
QT_END_NAMESPACE
QWidget *widget() const;
protected:
- bool event(QEvent *e);
-
bool eventFilter(QObject *, QEvent *);
void paintEvent(QPaintEvent *);
void initStyleOption(QStyleOption *option) const;
/*! \reimp
*/
-void QGroupBox::resizeEvent(QResizeEvent *e)
-{
- QWidget::resizeEvent(e);
-}
-
-/*! \reimp
-*/
void QGroupBox::paintEvent(QPaintEvent *)
{
protected:
bool event(QEvent *event);
void childEvent(QChildEvent *event);
- void resizeEvent(QResizeEvent *event);
void paintEvent(QPaintEvent *event);
void focusInEvent(QFocusEvent *event);
void changeEvent(QEvent *event);
bool event(QEvent *e);
void paintEvent(QPaintEvent *);
-public:
-
private:
Q_DISABLE_COPY(QLCDNumber)
Q_DECLARE_PRIVATE(QLCDNumber)
#endif
}
- if (!d->layout->usesHIToolBar(toolbar)) {
- d->layout->removeWidget(toolbar);
- } else {
- d->layout->removeToolBar(toolbar);
- }
+ d->layout->removeWidget(toolbar);
toolbar->d_func()->_q_updateIconSize(d->iconSize);
toolbar->d_func()->_q_updateToolButtonStyle(d->toolButtonStyle);
if (!d->explicitIconSize)
setIconSize(QSize());
break;
-#ifdef Q_WS_MAC
- case QEvent::Show:
- d->layout->blockVisiblityCheck = false;
- if (unifiedTitleAndToolBarOnMac())
- d->layout->syncUnifiedToolbarVisibility();
- break;
- case QEvent::WindowStateChange:
- {
- if (isHidden()) {
- // We are coming out of a minimize, leave things as is.
- d->layout->blockVisiblityCheck = true;
- }
-# ifdef QT_MAC_USE_COCOA
- // We need to update the HIToolbar status when we go out of or into fullscreen.
- QWindowStateChangeEvent *wce = static_cast<QWindowStateChangeEvent *>(event);
- if ((windowState() & Qt::WindowFullScreen) || (wce->oldState() & Qt::WindowFullScreen)) {
- d->layout->updateHIToolBarStatus();
- }
-# endif // Cocoa
- }
- break;
-#endif // Q_WS_MAC
#if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_CURSOR)
case QEvent::CursorChange:
if (d->cursorAdjusted) {
return QWidget::event(event);
}
-#ifndef QT_NO_TOOLBAR
-
-/*!
- \property QMainWindow::unifiedTitleAndToolBarOnMac
- \brief whether the window uses the unified title and toolbar look on Mac OS X
- \since 4.3
-
- This property is false by default and only has any effect on Mac OS X 10.4 or higher.
-
- If set to true, then the top toolbar area is replaced with a Carbon HIToolbar
- or a Cocoa NSToolbar (depending on whether Qt was built with Carbon or Cocoa).
- All toolbars in the top toolbar area and any toolbars added afterwards are
- moved to that. This means a couple of things.
-
- \list
- \i QToolBars in this toolbar area are not movable and you cannot drag other
- toolbars to it
- \i Toolbar breaks are not respected or preserved
- \i Any custom widgets in the toolbar will not be shown if the toolbar
- becomes too small (only actions will be shown)
- \i Before Qt 4.5, if you called showFullScreen() on the main window, the QToolbar would
- disappear since it is considered to be part of the title bar. Qt 4.5 and up will now work around this by pulling
- the toolbars out and back into the regular toolbar and vice versa when you swap out.
- \endlist
-
- Setting this back to false will remove these restrictions.
-
- The Qt::WA_MacBrushedMetal attribute takes precedence over this property.
-*/
-void QMainWindow::setUnifiedTitleAndToolBarOnMac(bool set)
-{
-#ifdef Q_WS_MAC
- Q_D(QMainWindow);
- if (!isWindow() || d->useHIToolBar == set || QSysInfo::MacintoshVersion < QSysInfo::MV_10_3)
- return;
-
- d->useHIToolBar = set;
- createWinId(); // We need the hiview for down below.
-
-#ifdef QT_MAC_USE_COCOA
- // Activate the unified toolbar with the raster engine.
- if (windowSurface() && set) {
- d->layout->unifiedSurface = new QUnifiedToolbarSurface(this);
- }
-#endif // QT_MAC_USE_COCOA
-
- d->layout->updateHIToolBarStatus();
-
-#ifdef QT_MAC_USE_COCOA
- // Deactivate the unified toolbar with the raster engine.
- if (windowSurface() && !set) {
- if (d->layout->unifiedSurface) {
- delete d->layout->unifiedSurface;
- d->layout->unifiedSurface = 0;
- }
- }
-#endif // QT_MAC_USE_COCOA
-
- // Enabling the unified toolbar clears the opaque size grip setting, update it.
- d->macUpdateOpaqueSizeGrip();
-#else
- Q_UNUSED(set)
-#endif
-}
-
-bool QMainWindow::unifiedTitleAndToolBarOnMac() const
-{
-#ifdef Q_WS_MAC
- return d_func()->useHIToolBar && !testAttribute(Qt::WA_MacBrushedMetal) && !(windowFlags() & Qt::FramelessWindowHint);
-#endif
- return false;
-}
-
-#endif // QT_NO_TOOLBAR
-
/*!
\internal
*/
for (int i = 0; i < toolbars.size(); ++i) {
QToolBar *toolBar = toolbars.at(i);
if (toolBar->parentWidget() == this
- && (!d->layout->layoutState.toolBarAreaLayout.indexOf(toolBar).isEmpty()
- || (unifiedTitleAndToolBarOnMac()
- && toolBarArea(toolBar) == Qt::TopToolBarArea))) {
+ && !d->layout->layoutState.toolBarAreaLayout.indexOf(toolBar).isEmpty()) {
menu->addAction(toolbars.at(i)->toggleViewAction());
}
}
Q_PROPERTY(bool dockNestingEnabled READ isDockNestingEnabled WRITE setDockNestingEnabled)
#endif // QT_NO_DOCKWIDGET
Q_PROPERTY(DockOptions dockOptions READ dockOptions WRITE setDockOptions)
-#ifndef QT_NO_TOOLBAR
- Q_PROPERTY(bool unifiedTitleAndToolBarOnMac READ unifiedTitleAndToolBarOnMac WRITE setUnifiedTitleAndToolBarOnMac)
-#endif
public:
enum DockOption {
void removeToolBar(QToolBar *toolbar);
void removeToolBarBreak(QToolBar *before);
- void setUnifiedTitleAndToolBarOnMac(bool set);
- bool unifiedTitleAndToolBarOnMac() const;
-
Qt::ToolBarArea toolBarArea(QToolBar *toolbar) const;
bool toolBarBreak(QToolBar *toolbar) const;
#endif
QObject::disconnect(parentWidget(), SIGNAL(toolButtonStyleChanged(Qt::ToolButtonStyle)),
toolbar, SLOT(_q_updateToolButtonStyle(Qt::ToolButtonStyle)));
-#ifdef Q_WS_MAC
- if (usesHIToolBar(toolbar)) {
- removeFromMacToolbar(toolbar);
- } else
-#endif // Q_WS_MAC
- {
- removeWidget(toolbar);
- }
+ removeWidget(toolbar);
}
}
bool)
{
validateToolBarArea(area);
-#ifdef Q_WS_MAC
- if ((area == Qt::TopToolBarArea)
- && layoutState.mainWindow->unifiedTitleAndToolBarOnMac()) {
- insertIntoMacToolbar(0, toolbar);
- } else
-#endif
- {
- //let's add the toolbar to the layout
- addChildWidget(toolbar);
- QLayoutItem * item = layoutState.toolBarAreaLayout.addToolBar(toDockPos(area), toolbar);
- if (savedState.isValid() && item) {
- // copy the toolbar also in the saved state
- savedState.toolBarAreaLayout.insertItem(toDockPos(area), item);
- }
- invalidate();
-
- //this ensures that the toolbar has the right window flags (not floating any more)
- toolbar->d_func()->updateWindowFlags(false /*floating*/);
+ //let's add the toolbar to the layout
+ addChildWidget(toolbar);
+ QLayoutItem * item = layoutState.toolBarAreaLayout.addToolBar(toDockPos(area), toolbar);
+ if (savedState.isValid() && item) {
+ // copy the toolbar also in the saved state
+ savedState.toolBarAreaLayout.insertItem(toDockPos(area), item);
}
+ invalidate();
+
+ //this ensures that the toolbar has the right window flags (not floating any more)
+ toolbar->d_func()->updateWindowFlags(false /*floating*/);
}
/*!
*/
void QMainWindowLayout::insertToolBar(QToolBar *before, QToolBar *toolbar)
{
-#ifdef Q_WS_MAC
- if (usesHIToolBar(before)) {
- insertIntoMacToolbar(before, toolbar);
- } else
-#endif // Q_WS_MAC
- {
- addChildWidget(toolbar);
- QLayoutItem * item = layoutState.toolBarAreaLayout.insertToolBar(before, toolbar);
- if (savedState.isValid() && item) {
- // copy the toolbar also in the saved state
- savedState.toolBarAreaLayout.insertItem(before, item);
- }
- if (!currentGapPos.isEmpty() && currentGapPos.first() == 0) {
- currentGapPos = layoutState.toolBarAreaLayout.currentGapIndex();
- if (!currentGapPos.isEmpty()) {
- currentGapPos.prepend(0);
- currentGapRect = layoutState.itemRect(currentGapPos);
- }
+ addChildWidget(toolbar);
+ QLayoutItem * item = layoutState.toolBarAreaLayout.insertToolBar(before, toolbar);
+ if (savedState.isValid() && item) {
+ // copy the toolbar also in the saved state
+ savedState.toolBarAreaLayout.insertItem(before, item);
+ }
+ if (!currentGapPos.isEmpty() && currentGapPos.first() == 0) {
+ currentGapPos = layoutState.toolBarAreaLayout.currentGapIndex();
+ if (!currentGapPos.isEmpty()) {
+ currentGapPos.prepend(0);
+ currentGapRect = layoutState.itemRect(currentGapPos);
}
- invalidate();
}
+ invalidate();
}
Qt::ToolBarArea QMainWindowLayout::toolBarArea(QToolBar *toolbar) const
case QInternal::BottomDock: return Qt::BottomToolBarArea;
default: break;
}
-#ifdef Q_WS_MAC
- if (pos == QInternal::DockCount) {
- if (qtoolbarsInUnifiedToolbarList.contains(toolbar))
- return Qt::TopToolBarArea;
- }
-#endif
return Qt::NoToolBarArea;
}
void QMainWindowLayout::toggleToolBarsVisible()
{
- bool updateNonUnifiedParts = true;
-#ifdef Q_WS_MAC
- if (layoutState.mainWindow->unifiedTitleAndToolBarOnMac()) {
- // If we hit this case, someone has pressed the "toolbar button" which will
- // toggle the unified toolbar visibility, because that's what the user wants.
- // We might be in a situation where someone has hidden all the toolbars
- // beforehand (maybe in construction), but now they've hit this button and
- // and are expecting the items to show. What do we do?
- // 1) Check the visibility of all the toolbars, if one is visible, do nothing, this
- // preserves what people would expect (these toolbars were visible when I clicked last time).
- // 2) If NONE are visible, then show them all. Again, this preserves the user expectation
- // of, "I want to see the toolbars." The user may get more toolbars than expected, but this
- // is better seeing nothing.
- // Don't worry about any of this if we are going invisible. This does mean we may get
- // into issues when switching into and out of fullscreen mode, but this is probably minor.
- // If we ever need to do hiding, that would have to be taken care of after the unified toolbar
- // has finished hiding.
- // People can of course handle the QEvent::ToolBarChange event themselves and do
- // WHATEVER they want if they don't like what we are doing (though the unified toolbar
- // will fire regardless).
-
- // Check if we REALLY need to update the geometry below. If we only have items in the
- // unified toolbar, all the docks will be empty, so there's very little point
- // in doing the geometry as Apple will do it (we also avoid flicker in Cocoa as well).
- // FWIW, layoutState.toolBarAreaLayout.visible and the state of the unified toolbar
- // visibility can get out of sync. I really don't think it's a big issue. It is kept
- // to a minimum because we only change the visibility if we absolutely must.
- // update the "non unified parts."
- updateNonUnifiedParts = !layoutState.toolBarAreaLayout.isEmpty();
-
- // We get this function before the unified toolbar does its thing.
- // So, the value will be opposite of what we expect.
- bool goingVisible = !macWindowToolbarIsVisible(qt_mac_window_for(layoutState.mainWindow));
- if (goingVisible) {
- const int ToolBarCount = qtoolbarsInUnifiedToolbarList.size();
- bool needAllVisible = true;
- for (int i = 0; i < ToolBarCount; ++i) {
- if (!qtoolbarsInUnifiedToolbarList.at(i)->isHidden()) {
- needAllVisible = false;
- break;
- }
- }
- if (needAllVisible) {
- QBoolBlocker blocker(blockVisiblityCheck); // Disable the visibilty check because
- // the toggle has already happened.
- for (int i = 0; i < ToolBarCount; ++i)
- qtoolbarsInUnifiedToolbarList.at(i)->setVisible(true);
- }
- }
- if (!updateNonUnifiedParts)
- layoutState.toolBarAreaLayout.visible = goingVisible;
- }
-#endif
- if (updateNonUnifiedParts) {
- layoutState.toolBarAreaLayout.visible = !layoutState.toolBarAreaLayout.visible;
- if (!layoutState.mainWindow->isMaximized()) {
- QPoint topLeft = parentWidget()->geometry().topLeft();
- QRect r = parentWidget()->geometry();
- r = layoutState.toolBarAreaLayout.rectHint(r);
- r.moveTo(topLeft);
- parentWidget()->setGeometry(r);
- } else {
- update();
- }
+ layoutState.toolBarAreaLayout.visible = !layoutState.toolBarAreaLayout.visible;
+ if (!layoutState.mainWindow->isMaximized()) {
+ QPoint topLeft = parentWidget()->geometry().topLeft();
+ QRect r = parentWidget()->geometry();
+ r = layoutState.toolBarAreaLayout.rectHint(r);
+ r.moveTo(topLeft);
+ parentWidget()->setGeometry(r);
+ } else {
+ update();
}
}
const QSize sbMin = statusbar ? statusbar->minimumSize() : QSize(0, 0);
minSize = QSize(qMax(sbMin.width(), minSize.width()),
sbMin.height() + minSize.height());
-#ifdef Q_WS_MAC
- const QSize storedSize = minSize;
- int minWidth = 0;
- foreach (QToolBar *toolbar, qtoolbarsInUnifiedToolbarList) {
- minWidth += toolbar->sizeHint().width() + 20;
- }
- minSize = QSize(qMax(minWidth, storedSize.width()), storedSize.height());
-#endif
}
return minSize;
}
#ifndef QT_NO_RUBBERBAND
, gapIndicator(new QRubberBand(QRubberBand::Rectangle, mainwindow))
#endif //QT_NO_RUBBERBAND
-#ifdef Q_WS_MAC
- , activateUnifiedToolbarAfterFullScreen(false)
- , blockVisiblityCheck(false)
-#endif
{
if (parentLayout)
setParent(parentLayout);
return true;
}
-
-// Returns if this toolbar *should* be using HIToolbar. Won't work for all in between cases
-// for example, you have a toolbar in the top area and then you suddenly turn on
-// HIToolbar.
-bool QMainWindowLayout::usesHIToolBar(QToolBar *toolbar) const
-{
-#ifndef Q_WS_MAC
- Q_UNUSED(toolbar);
- return false;
-#else
- return qtoolbarsInUnifiedToolbarList.contains(toolbar)
- || ((toolBarArea(toolbar) == Qt::TopToolBarArea)
- && layoutState.mainWindow->unifiedTitleAndToolBarOnMac());
-#endif
-}
-
void QMainWindowLayout::timerEvent(QTimerEvent *e)
{
#ifndef QT_NO_DOCKWIDGET
QMainWindow::DockOptions dockOptions;
void setDockOptions(QMainWindow::DockOptions opts);
- bool usesHIToolBar(QToolBar *toolbar) const;
void timerEvent(QTimerEvent *e);
if (d->tornPopup) // torn-off menu
d->tornPopup->setEnabled(isEnabled());
d->menuAction->setEnabled(isEnabled());
-#if defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA)
- if (d->mac_menu)
- d->setMacMenuEnabled(isEnabled());
-#endif
}
QWidget::changeEvent(e);
}
return QAbstractButton::event(e);
}
-#ifdef Q_WS_MAC
-/*! \reimp */
-bool QPushButton::hitButton(const QPoint &pos) const
-{
- QStyleOptionButton opt;
- initStyleOption(&opt);
- if (qt_mac_buttonIsRenderedFlat(this, &opt))
- return QAbstractButton::hitButton(pos);
-
- // Now that we know we are using the native style, let's proceed.
- Q_D(const QPushButton);
- QPushButtonPrivate *nonConst = const_cast<QPushButtonPrivate *>(d);
- // In OSX buttons are round, which causes the hit method to be special.
- // We cannot simply relay on detecting if something is inside the rect or not,
- // we need to check if it is inside the "rounded area" or not. A point might
- // be inside the rect but not inside the rounded area.
- // Notice this method is only reimplemented for OSX.
- return nonConst->hitButton(pos);
-}
-
-bool QPushButtonPrivate::hitButton(const QPoint &pos)
-{
- Q_Q(QPushButton);
- QRect roundedRect(q->rect().left() + QMacStylePrivate::PushButtonLeftOffset,
- q->rect().top() + QMacStylePrivate::PushButtonContentPadding,
- q->rect().width() - QMacStylePrivate::PushButtonRightOffset,
- q->rect().height() - QMacStylePrivate::PushButtonBottomOffset);
- return roundedRect.contains(pos);
-}
-#endif // Q_WS_MAC
-
-
/*!
\fn void QPushButton::openPopup()
\sa move()
*/
-/*!
- \fn void QRubberBand::setGeometry(const QRect &rect)
-
- Sets the geometry of the rubber band to \a rect, specified in the coordinate system
- of its parent widget.
-
- \sa QWidget::geometry
-*/
-void QRubberBand::setGeometry(const QRect &geom)
-{
- QWidget::setGeometry(geom);
-}
-
-/*!
- \fn void QRubberBand::setGeometry(int x, int y, int width, int height)
- \overload
-
- Sets the geometry of the rubberband to the rectangle whose top-left corner lies at
- the point (\a x, \a y), and with dimensions specified by \a width and \a height.
- The geometry is specified in the parent widget's coordinate system.
-*/
-
-/*! \reimp */
-bool QRubberBand::event(QEvent *e)
-{
- return QWidget::event(e);
-}
-
QT_END_NAMESPACE
#include "moc_qrubberband.h"
Shape shape() const;
- void setGeometry(const QRect &r);
-
- inline void setGeometry(int x, int y, int w, int h);
inline void move(int x, int y);
inline void move(const QPoint &p)
{ move(p.x(), p.y()); }
{ resize(s.width(), s.height()); }
protected:
- bool event(QEvent *e);
void paintEvent(QPaintEvent *);
void changeEvent(QEvent *);
void showEvent(QShowEvent *);
Q_DECLARE_PRIVATE(QRubberBand)
};
-inline void QRubberBand::setGeometry(int ax, int ay, int aw, int ah)
-{ setGeometry(QRect(ax, ay, aw, ah)); }
inline void QRubberBand::move(int ax, int ay)
{ setGeometry(ax, ay, width(), height()); }
return style()->sizeFromContents(QStyle::CT_ScrollBar, &opt, size, this)
.expandedTo(QApplication::globalStrut());
- }
-
-/*!\reimp */
-void QScrollBar::sliderChange(SliderChange change)
-{
- QAbstractSlider::sliderChange(change);
}
/*!
void mouseReleaseEvent(QMouseEvent *);
void mouseMoveEvent(QMouseEvent *);
void hideEvent(QHideEvent*);
- void sliderChange(SliderChange change);
#ifndef QT_NO_CONTEXTMENU
void contextMenuEvent(QContextMenuEvent *);
#endif
#if defined(Q_WS_X11)
#include <qt_x11_p.h>
-#elif defined (Q_WS_WIN)
-#include "qt_windows.h"
-#endif
-#ifdef Q_WS_MAC
-#include <qt_mac_p.h>
#endif
#include <qwidget_p.h>
Qt::Corner m_corner;
bool gotMousePress;
QWidget *tlw;
-#ifdef Q_WS_MAC
- void updateMacSizer(bool hide) const;
-#endif
Qt::Corner corner() const;
inline bool atBottom() const
{
bool showSizeGrip = !(q->isHidden() && q->testAttribute(Qt::WA_WState_ExplicitShowHide));
updateTopLevelWidget();
if (tlw && showSizeGrip) {
- Qt::WindowStates sizeGripNotVisibleState = Qt::WindowFullScreen;
-#ifndef Q_WS_MAC
- sizeGripNotVisibleState |= Qt::WindowMaximized;
-#endif
+ const Qt::WindowStates sizeGripNotVisibleState = Qt::WindowFullScreen | Qt::WindowMaximized;
// Don't show the size grip if the tlw is maximized or in full screen mode.
showSizeGrip = !(tlw->windowState() & sizeGripNotVisibleState);
}
}
};
-#ifdef Q_WS_MAC
-void QSizeGripPrivate::updateMacSizer(bool hide) const
-{
- Q_Q(const QSizeGrip);
- if (QApplication::closingDown() || !parent)
- return;
- QWidget *topLevelWindow = qt_sizegrip_topLevelWidget(const_cast<QSizeGrip *>(q));
- if(topLevelWindow && topLevelWindow->isWindow())
- QWidgetPrivate::qt_mac_update_sizer(topLevelWindow, hide ? -1 : 1);
-}
-#endif
-
Qt::Corner QSizeGripPrivate::corner() const
{
Q_Q(const QSizeGrip);
return;
}
#endif // Q_WS_X11
-#ifdef Q_WS_WIN
- if (tlw->isWindow() && !tlw->testAttribute(Qt::WA_DontShowOnScreen) && !qt_widget_private(tlw)->hasHeightForWidth()) {
- uint orientation = 0;
- if (d->atBottom())
- orientation = d->atLeft() ? SZ_SIZEBOTTOMLEFT : SZ_SIZEBOTTOMRIGHT;
- else
- orientation = d->atLeft() ? SZ_SIZETOPLEFT : SZ_SIZETOPRIGHT;
-
- ReleaseCapture();
- PostMessage(tlw->winId(), WM_SYSCOMMAND, orientation, 0);
- return;
- }
-#endif // Q_WS_WIN
// Find available desktop/workspace geometry.
QRect availableGeometry;
&& !tlw->testAttribute(Qt::WA_DontShowOnScreen) && !qt_widget_private(tlw)->hasHeightForWidth())
return;
#endif
-#ifdef Q_WS_WIN
- if (tlw->isWindow() && GetSystemMenu(tlw->winId(), FALSE) != 0 && internalWinId()
- && !tlw->testAttribute(Qt::WA_DontShowOnScreen) && !qt_widget_private(tlw)->hasHeightForWidth()) {
- MSG msg;
- while(PeekMessage(&msg, winId(), WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE));
- return;
- }
-#endif
QPoint np(e->globalPos());
#endif
}
-/*!
- \reimp
-*/
-void QSizeGrip::showEvent(QShowEvent *showEvent)
-{
-#ifdef Q_WS_MAC
- d_func()->updateMacSizer(false);
-#endif
- QWidget::showEvent(showEvent);
-}
-
-/*!
- \reimp
-*/
-void QSizeGrip::hideEvent(QHideEvent *hideEvent)
-{
-#ifdef Q_WS_MAC
- d_func()->updateMacSizer(true);
-#endif
- QWidget::hideEvent(hideEvent);
-}
-
-/*!
- \reimp
-*/
-void QSizeGrip::setVisible(bool visible)
-{
- QWidget::setVisible(visible);
-}
-
/*! \reimp */
bool QSizeGrip::eventFilter(QObject *o, QEvent *e)
{
|| o != d->tlw) {
return QWidget::eventFilter(o, e);
}
- Qt::WindowStates sizeGripNotVisibleState = Qt::WindowFullScreen;
-#ifndef Q_WS_MAC
- sizeGripNotVisibleState |= Qt::WindowMaximized;
-#endif
+ const Qt::WindowStates sizeGripNotVisibleState = Qt::WindowFullScreen | Qt::WindowMaximized;
// Don't show the size grip if the tlw is maximized or in full screen mode.
setVisible(!(d->tlw->windowState() & sizeGripNotVisibleState));
setAttribute(Qt::WA_WState_ExplicitShowHide, false);
return QWidget::eventFilter(o, e);
}
-/*!
- \reimp
-*/
-bool QSizeGrip::event(QEvent *event)
-{
- return QWidget::event(event);
-}
-
-#ifdef Q_WS_WIN
-/*! \reimp */
-bool QSizeGrip::winEvent( MSG *m, long *result )
-{
- return QWidget::winEvent(m, result);
-}
-#endif
QT_END_NAMESPACE
~QSizeGrip();
QSize sizeHint() const;
- void setVisible(bool);
protected:
void paintEvent(QPaintEvent *);
void mouseMoveEvent(QMouseEvent *);
void mouseReleaseEvent(QMouseEvent *mouseEvent);
void moveEvent(QMoveEvent *moveEvent);
- void showEvent(QShowEvent *showEvent);
- void hideEvent(QHideEvent *hideEvent);
bool eventFilter(QObject *, QEvent *);
- bool event(QEvent *);
-#ifdef Q_WS_WIN
- bool winEvent(MSG *m, long *result);
-#endif
-
-public:
private:
Q_DECLARE_PRIVATE(QSizeGrip)
/*!
\reimp
*/
-void QStatusBar::resizeEvent(QResizeEvent * e)
-{
- QWidget::resizeEvent(e);
-}
-
-/*!
- \reimp
-*/
bool QStatusBar::event(QEvent *e)
{
}
}
}
-
-// On Mac OS X Leopard it is possible to drag the window by clicking
-// on the tool bar on most applications.
-#ifndef Q_WS_MAC
- return QWidget::event(e);
-#else
- if (QSysInfo::MacintoshVersion <= QSysInfo::MV_10_4)
- return QWidget::event(e);
-
- // Enable drag-click only if the status bar is the status bar for a
- // QMainWindow with a unifed toolbar.
- if (parent() == 0 || qobject_cast<QMainWindow *>(parent()) == 0 ||
- qobject_cast<QMainWindow *>(parent())->unifiedTitleAndToolBarOnMac() == false )
- return QWidget::event(e);
-
- // Check for mouse events.
- QMouseEvent *mouseEvent;
- if (e->type() == QEvent::MouseButtonPress ||
- e->type() == QEvent::MouseMove ||
- e->type() == QEvent::MouseButtonRelease) {
- mouseEvent = static_cast <QMouseEvent*>(e);
- } else {
- return QWidget::event(e);
- }
-
- // The following is a standard mouse drag handler.
- if (e->type() == QEvent::MouseButtonPress && (mouseEvent->button() == Qt::LeftButton)) {
- d->dragStart = mouseEvent->pos();
- } else if (e->type() == QEvent::MouseMove){
- if (d->dragStart == QPoint())
- return QWidget::event(e);
- QPoint pos = mouseEvent->pos();
- QPoint delta = (pos - d->dragStart);
- window()->move(window()->pos() + delta);
- } else if (e->type() == QEvent::MouseButtonRelease && (mouseEvent->button() == Qt::LeftButton)){
- d->dragStart = QPoint();
- } else {
- return QWidget::event(e);
- }
- return true;
-#endif
+ return QWidget::event(e);
}
QT_END_NAMESPACE
protected:
void showEvent(QShowEvent *);
void paintEvent(QPaintEvent *);
- void resizeEvent(QResizeEvent *);
// ### Qt 5: consider making reformat() and hideOrShow() private
void reformat();
|| shape == QTabBar::TriangularEast;
}
-void QTabBarPrivate::updateMacBorderMetrics()
-{
-#if (defined Q_WS_MAC) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) {
- Q_Q(QTabBar);
- ::HIContentBorderMetrics metrics;
-
- // TODO: get metrics to preserve the bottom value
- // TODO: test tab bar position
-
- OSWindowRef window = qt_mac_window_for(q);
-
- // push base line separator down to the client are so we can paint over it (Carbon)
- metrics.top = (documentMode && q->isVisible()) ? 1 : 0;
- metrics.bottom = 0;
- metrics.left = 0;
- metrics.right = 0;
- qt_mac_updateContentBorderMetricts(window, metrics);
-#ifdef QT_MAC_USE_COCOA
- // In Cocoa we need to keep track of the drawRect method.
- // If documentMode is enabled we need to change it, unless
- // a toolbar is present.
- // Notice that all the information is kept in the window,
- // that's why we get the private widget for it instead of
- // the private widget for this widget.
- QWidgetPrivate *privateWidget = qt_widget_private(q->window());
- if(privateWidget)
- privateWidget->changeMethods = documentMode;
- // Since in Cocoa there is no simple way to remove the baseline, so we just ask the
- // top level to do the magic for us.
- privateWidget->syncUnifiedMode();
-#endif // QT_MAC_USE_COCOA
- }
-#endif
-}
-
/*!
Initialize \a option with the values from the tab at \a tabIndex. This method
is useful for subclasses when they need a QStyleOptionTab, QStyleOptionTabV2,
d->refresh();
if (!d->validIndex(d->currentIndex))
setCurrentIndex(0);
- d->updateMacBorderMetrics();
-}
-
-/*!\reimp
- */
-void QTabBar::hideEvent(QHideEvent *)
-{
- Q_D(QTabBar);
- d->updateMacBorderMetrics();
}
/*!\reimp
d->moveTabFinished(d->pressedIndex);
d->pressedIndex = d->indexAtPos(event->pos());
-#ifdef Q_WS_MAC
- d->previousPressedIndex = d->pressedIndex;
-#endif
if (d->validIndex(d->pressedIndex)) {
QStyleOptionTabBarBaseV2 optTabBase;
optTabBase.init(this);
if (d->pressedIndex != -1
&& event->buttons() == Qt::NoButton)
d->moveTabFinished(d->pressedIndex);
-
+
// Start drag
if (!d->dragInProgress && d->pressedIndex != -1) {
if ((event->pos() - d->dragStartPosition).manhattanLength() > QApplication::startDragDistance()) {
update();
}
-#ifdef Q_WS_MAC
- } else if (!d->documentMode && event->buttons() == Qt::LeftButton && d->previousPressedIndex != -1) {
- int newPressedIndex = d->indexAtPos(event->pos());
- if (d->pressedIndex == -1 && d->previousPressedIndex == newPressedIndex) {
- d->pressedIndex = d->previousPressedIndex;
- update(tabRect(d->pressedIndex));
- } else if(d->pressedIndex != newPressedIndex) {
- d->pressedIndex = -1;
- update(tabRect(d->previousPressedIndex));
- }
-#endif
}
if (event->buttons() != Qt::LeftButton) {
event->ignore();
return;
}
-#ifdef Q_WS_MAC
- d->previousPressedIndex = -1;
-#endif
if (d->movable && d->dragInProgress && d->validIndex(d->pressedIndex)) {
int length = d->tabList[d->pressedIndex].dragOffset;
int width = verticalTabs(d->shape)
Q_D(QTabBar);
d->documentMode = enabled;
- d->updateMacBorderMetrics();
}
/*!
bool event(QEvent *);
void resizeEvent(QResizeEvent *);
void showEvent(QShowEvent *);
- void hideEvent(QHideEvent *);
void paintEvent(QPaintEvent *);
void mousePressEvent (QMouseEvent *);
void mouseMoveEvent (QMouseEvent *);
void layoutTabs();
void layoutWidgets(int start = 0);
void layoutTab(int index);
- void updateMacBorderMetrics();
void setupMovableTab();
void makeVisible(int index);
/*!
\reimp
*/
-void QTextBrowser::mouseMoveEvent(QMouseEvent *e)
-{
- QTextEdit::mouseMoveEvent(e);
-}
-
-/*!
- \reimp
-*/
-void QTextBrowser::mousePressEvent(QMouseEvent *e)
-{
- QTextEdit::mousePressEvent(e);
-}
-
-/*!
- \reimp
-*/
-void QTextBrowser::mouseReleaseEvent(QMouseEvent *e)
-{
- QTextEdit::mouseReleaseEvent(e);
-}
-
-/*!
- \reimp
-*/
void QTextBrowser::focusOutEvent(QFocusEvent *ev)
{
#ifndef QT_NO_CURSOR
d->openLinks = open;
}
-/*! \reimp */
-bool QTextBrowser::event(QEvent *e)
-{
- return QTextEdit::event(e);
-}
-
QT_END_NAMESPACE
void anchorClicked(const QUrl &);
protected:
- bool event(QEvent *e);
virtual void keyPressEvent(QKeyEvent *ev);
- virtual void mouseMoveEvent(QMouseEvent *ev);
- virtual void mousePressEvent(QMouseEvent *ev);
- virtual void mouseReleaseEvent(QMouseEvent *ev);
virtual void focusOutEvent(QFocusEvent *ev);
virtual bool focusNextPrevChild(bool next);
virtual void paintEvent(QPaintEvent *e);
docks[QInternal::BottomDock].rect = QRect(rect.left(), center.bottom() + 1,
rect.width(), bottom_hint.height());
- if (!mainWindow->unifiedTitleAndToolBarOnMac()) {
- docks[QInternal::TopDock].fitLayout();
- }
+ docks[QInternal::TopDock].fitLayout();
docks[QInternal::LeftDock].fitLayout();
docks[QInternal::RightDock].fitLayout();
docks[QInternal::BottomDock].fitLayout();
QList<QToolBar*> toolBars = _toolBars;
int lines;
stream >> lines;
- if (!testing)
- testing = mainWindow->unifiedTitleAndToolBarOnMac();
for (int j = 0; j < lines; ++j) {
int pos;
stream >> cnt;
QToolBarAreaLayoutInfo &dock = docks[pos];
- const bool applyingLayout = !testing && !(pos == QInternal::TopDock && mainWindow->unifiedTitleAndToolBarOnMac());
+ const bool applyingLayout = !testing && !pos == QInternal::TopDock;
QToolBarAreaLayoutLine line(dock.o);
for (int k = 0; k < cnt; ++k) {
rpick(o, that->hint) += handleExtent;
that->hint += QSize(2*margin, 2*margin);
that->dirty = false;
-#ifdef Q_WS_MAC
- if (QMainWindow *mw = qobject_cast<QMainWindow *>(parentWidget()->parentWidget())) {
- if (mw->unifiedTitleAndToolBarOnMac()
- && mw->toolBarArea(static_cast<QToolBar *>(parentWidget())) == Qt::TopToolBarArea) {
- if (expandFlag) {
- tb->setMaximumSize(0xFFFFFF, 0xFFFFFF);
- } else {
- tb->setMaximumSize(hint);
- }
- }
- }
-#endif
-
- that->dirty = false;
}
static bool defaultWidgetAction(QToolBarItem *item)
if (!extension->isHidden())
extension->hide();
}
-#ifdef Q_WS_MAC
- // Nothing to do for Carbon... probably
-# ifdef QT_MAC_USE_COCOA
- if (QMainWindow *win = qobject_cast<QMainWindow*>(tb->parentWidget())) {
- Qt::ToolBarArea area = win->toolBarArea(tb);
- if (win->unifiedTitleAndToolBarOnMac() && area == Qt::TopToolBarArea) {
- qt_mainwindow_layout(win)->fixSizeInUnifiedToolbar(tb);
- }
- }
-# endif
-#endif
-
}
bool QToolBarLayout::layoutActions(const QSize &size)
\sa setMargin(), QWidget::getContentsMargins()
*/
-/*! \reimp */
-bool QToolBox::event(QEvent *e)
-{
- return QFrame::event(e);
-}
-
QT_END_NAMESPACE
#include "moc_qtoolbox.cpp"
void currentChanged(int index);
protected:
- bool event(QEvent *e);
virtual void itemInserted(int index);
virtual void itemRemoved(int index);
void showEvent(QShowEvent *e);
win->setCentralWidget(central);
win->setWindowTitle(tr("Qt Script Debugger"));
- win->setUnifiedTitleAndToolBarOnMac(true);
QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
QVariant geometry = settings.value(QLatin1String("Qt/scripttools/debugging/mainWindowGeometry"));
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
-
-#ifdef Q_OS_WIN
-#include <windows.h> // for Sleep
-#endif
-#ifdef Q_OS_UNIX
#include <errno.h>
#include <signal.h>
#include <time.h>
-#endif
-
-#ifdef Q_WS_MAC
-#include <Carbon/Carbon.h> // for SetFrontProcess
-#ifdef QT_MAC_USE_COCOA
-#include <IOKit/pwr_mgt/IOPMLib.h>
-#else
-#include <Security/AuthSession.h>
-#endif
-#undef verify
-#endif
QT_BEGIN_NAMESPACE
int callgrindChildExitCode = 0;
#endif
-#ifdef Q_WS_MAC
- bool macNeedsActivate = qApp && (qstrcmp(qApp->metaObject()->className(), "QApplication") == 0);
-#ifdef QT_MAC_USE_COCOA
- IOPMAssertionID powerID;
-#endif
-#endif
#ifndef QT_NO_EXCEPTIONS
try {
#endif
- #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
- SetErrorMode(SetErrorMode(0) | SEM_NOGPFAULTERRORBOX);
- #endif
-
-#ifdef Q_WS_MAC
- // Starting with Qt 4.4, applications launched from the command line
- // no longer get focus automatically. Since some tests might depend
- // on this, call SetFrontProcess here to get the pre 4.4 behavior.
- if (macNeedsActivate) {
- ProcessSerialNumber psn = { 0, kCurrentProcess };
- SetFrontProcess(&psn);
-# ifdef QT_MAC_USE_COCOA
- IOReturn ok = IOPMAssertionCreate(kIOPMAssertionTypeNoDisplaySleep, kIOPMAssertionLevelOn, &powerID);
- if (ok != kIOReturnSuccess)
- macNeedsActivate = false; // no need to release the assertion on exit.
-# else
- UpdateSystemActivity(1); // Wake the display.
-# endif
- }
-#endif
-
-
QTestResult::reset();
QTEST_ASSERT(testObject);
}
#ifndef QT_NO_EXCEPTIONS
- } catch (...) {
- QTestResult::addFailure("Caught unhandled exception", __FILE__, __LINE__);
- if (QTestResult::currentTestFunction()) {
+ } catch (...) {
+ QTestResult::addFailure("Caught unhandled exception", __FILE__, __LINE__);
+ if (QTestResult::currentTestFunction()) {
QTestResult::finishedCurrentTestFunction();
QTestResult::setCurrentTestFunction(0);
- }
+ }
QTestLog::stopLogging();
-#ifdef QT_MAC_USE_COCOA
- if (macNeedsActivate) {
- IOPMAssertionRelease(powerID);
- }
-#endif
- currentTestObject = 0;
+ currentTestObject = 0;
- // Rethrow exception to make debugging easier.
- throw;
- return 1;
- }
+ // Rethrow exception to make debugging easier.
+ throw;
+ return 1;
+ }
# endif
currentTestObject = 0;
-#ifdef QT_MAC_USE_COCOA
- if (macNeedsActivate) {
- IOPMAssertionRelease(powerID);
- }
-#endif
#if defined(QTEST_NOEXITCODE)
return 0;
break;
case MouseMove:
QCursor::setPos(widget->mapToGlobal(pos));
-#ifdef QT_MAC_USE_COCOA
- QTest::qWait(20);
-#else
qApp->processEvents();
-#endif
return;
default:
QTEST_ASSERT(false);
#ifdef Q_WS_X11
QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, false);
#endif
-#ifndef Q_WS_MAC
QDesignerToolWindow *widgetBoxWrapper = widgetBoxToolWindow();
widgetBoxWrapper->action()->setVisible(true);
widgetBoxWrapper->setWindowTitle(tr("Widget Box"));
-#endif
m_mode = DockedMode;
const QDesignerSettings settings(m_core);
m_dockedMainWindow = new DockedMainWindow(this, m_toolbarMenu, m_toolWindows);
- m_dockedMainWindow->setUnifiedTitleAndToolBarOnMac(true);
m_dockedMainWindow->setCloseEventPolicy(MainWindowBase::EmitCloseEventSignal);
connect(m_dockedMainWindow, SIGNAL(closeEventReceived(QCloseEvent*)), this, SLOT(handleCloseEvent(QCloseEvent*)));
connect(m_dockedMainWindow, SIGNAL(fileDropped(QString)), this, SLOT(slotFileDropped(QString)));
m_core->setTopLevel(m_dockedMainWindow);
-#ifndef Q_WS_MAC
m_dockedMainWindow->setMenuBar(m_globalMenuBar);
m_globalMenuBar->show();
-#endif
qDesigner->setMainWindow(m_dockedMainWindow);
foreach (QDesignerFormWindow *fw, m_formWindows) {