mostly Q_WS_MAC leftovers removal

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
Ivailo Monev 2017-08-06 07:44:53 +00:00
parent ca5aa4a2d3
commit 612e6fc142
33 changed files with 61 additions and 561 deletions

View file

@ -919,24 +919,6 @@ QT_BEGIN_NAMESPACE
\sa QSysInfo
*/
/*!
\fn int qWinVersion()
\relates <QtGlobal>
Use QSysInfo::WindowsVersion instead.
\sa QSysInfo
*/
/*!
\fn int qMacVersion()
\relates <QtGlobal>
Use QSysInfo::MacintoshVersion instead.
\sa QSysInfo
*/
/*!
\macro QT_VERSION_CHECK
\relates <QtGlobal>
@ -1015,10 +997,6 @@ bool qSharedBuild()
on which the application is compiled.
\o \l ByteOrder specifies whether the platform is big-endian or
little-endian.
\o \l WindowsVersion specifies the version of the Windows operating
system on which the application is run (Windows only)
\o \l MacintoshVersion specifies the version of the Macintosh
operating system on which the application is run (Mac only).
\endlist
Some constants are defined only on certain platforms. You can use

View file

@ -1183,13 +1183,6 @@ void QObject::moveToThread(QThread *targetThread)
qWarning("QObject::moveToThread: Current thread (%p) is not the object's thread (%p).\n"
"Cannot move to target thread (%p)\n",
currentData->thread, d->threadData->thread, targetData->thread);
#ifdef Q_WS_MAC
qWarning("On Mac OS X, you might be loading two sets of Qt binaries into the same process. "
"Check that all plugins are compiled against the right Qt binaries. Export "
"DYLD_PRINT_LIBRARIES=1 and check that only one set of binaries are being loaded.");
#endif
return;
}

View file

@ -66,9 +66,6 @@ void SheetDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option,
QStyleOptionButton buttonOption;
buttonOption.state = option.state;
#ifdef Q_WS_MAC
buttonOption.state |= QStyle::State_Raised;
#endif
buttonOption.state &= ~QStyle::State_HasFocus;
buttonOption.rect = option.rect;

View file

@ -330,20 +330,18 @@ inline QString QFileDialogPrivate::rootPath() const {
return model->rootPath();
}
#ifndef Q_WS_MAC
// Dummies for platforms that don't use native dialogs:
inline void QFileDialogPrivate::deleteNativeDialog_sys() { qt_guiPlatformPlugin()->fileDialogDelete(q_func()); }
inline bool QFileDialogPrivate::setVisible_sys(bool visible) { return qt_guiPlatformPlugin()->fileDialogSetVisible(q_func(), visible); }
inline QDialog::DialogCode QFileDialogPrivate::dialogResultCode_sys(){ return qt_guiPlatformPlugin()->fileDialogResultCode(q_func()); }
inline void QFileDialogPrivate::setDirectory_sys(const QString &directory) { qt_guiPlatformPlugin()->fileDialogSetDirectory(q_func(), directory); }
inline QString QFileDialogPrivate::directory_sys() const { return qt_guiPlatformPlugin()->fileDialogDirectory(q_func()); }
inline void QFileDialogPrivate::selectFile_sys(const QString &filename) { qt_guiPlatformPlugin()->fileDialogSelectFile(q_func(), filename); }
inline QStringList QFileDialogPrivate::selectedFiles_sys() const { return qt_guiPlatformPlugin()->fileDialogSelectedFiles(q_func()); }
inline void QFileDialogPrivate::setFilter_sys() { qt_guiPlatformPlugin()->fileDialogSetFilter(q_func()); }
inline void QFileDialogPrivate::setNameFilters_sys(const QStringList &filters) { qt_guiPlatformPlugin()->fileDialogSetNameFilters(q_func(), filters); }
inline void QFileDialogPrivate::selectNameFilter_sys(const QString &filter) { qt_guiPlatformPlugin()->fileDialogSelectNameFilter(q_func(), filter); }
inline QString QFileDialogPrivate::selectedNameFilter_sys() const { return qt_guiPlatformPlugin()->fileDialogSelectedNameFilter(q_func()); }
#endif
// Dummies for platforms that don't use native dialogs:
inline void QFileDialogPrivate::deleteNativeDialog_sys() { qt_guiPlatformPlugin()->fileDialogDelete(q_func()); }
inline bool QFileDialogPrivate::setVisible_sys(bool visible) { return qt_guiPlatformPlugin()->fileDialogSetVisible(q_func(), visible); }
inline QDialog::DialogCode QFileDialogPrivate::dialogResultCode_sys(){ return qt_guiPlatformPlugin()->fileDialogResultCode(q_func()); }
inline void QFileDialogPrivate::setDirectory_sys(const QString &directory) { qt_guiPlatformPlugin()->fileDialogSetDirectory(q_func(), directory); }
inline QString QFileDialogPrivate::directory_sys() const { return qt_guiPlatformPlugin()->fileDialogDirectory(q_func()); }
inline void QFileDialogPrivate::selectFile_sys(const QString &filename) { qt_guiPlatformPlugin()->fileDialogSelectFile(q_func(), filename); }
inline QStringList QFileDialogPrivate::selectedFiles_sys() const { return qt_guiPlatformPlugin()->fileDialogSelectedFiles(q_func()); }
inline void QFileDialogPrivate::setFilter_sys() { qt_guiPlatformPlugin()->fileDialogSetFilter(q_func()); }
inline void QFileDialogPrivate::setNameFilters_sys(const QStringList &filters) { qt_guiPlatformPlugin()->fileDialogSetNameFilters(q_func(), filters); }
inline void QFileDialogPrivate::selectNameFilter_sys(const QString &filter) { qt_guiPlatformPlugin()->fileDialogSelectNameFilter(q_func(), filter); }
inline QString QFileDialogPrivate::selectedNameFilter_sys() const { return qt_guiPlatformPlugin()->fileDialogSelectedNameFilter(q_func()); }
QT_END_NAMESPACE

View file

@ -778,11 +778,6 @@ void QFontDialog::setCurrentFont(const QFont &font)
d->strikeout->setChecked(font.strikeOut());
d->underline->setChecked(font.underline());
d->updateFamilies();
#ifdef Q_WS_MAC
if (d->delegate)
QFontDialogPrivate::setFont(d->delegate, font);
#endif
}
/*!
@ -880,11 +875,6 @@ QFontDialog::FontDialogOptions QFontDialog::options() const
return d->opts;
}
#ifdef Q_WS_MAC
// can only have one Cocoa font panel active
bool QFontDialogPrivate::sharedFontPanelAvailable = true;
#endif
/*!
\since 4.5
\overload

View file

@ -270,20 +270,8 @@ void QPrintPreviewDialogPrivate::init(QPrinter *_printer)
QWidget *pageEdit = new QWidget(toolbar);
QVBoxLayout *vboxLayout = new QVBoxLayout;
vboxLayout->setContentsMargins(0, 0, 0, 0);
#ifdef Q_WS_MAC
// We query the widgets about their size and then we fix the size.
// This should do the trick for the laying out part...
QSize pageNumEditSize, pageNumLabelSize;
pageNumEditSize = pageNumEdit->minimumSizeHint();
pageNumLabelSize = pageNumLabel->minimumSizeHint();
pageNumEdit->resize(pageNumEditSize);
pageNumLabel->resize(pageNumLabelSize);
#endif
QFormLayout *formLayout = new QFormLayout;
#ifdef Q_WS_MAC
// We have to change the growth policy in Mac.
formLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
#endif
formLayout->setWidget(0, QFormLayout::LabelRole, pageNumEdit);
formLayout->setWidget(0, QFormLayout::FieldRole, pageNumLabel);
vboxLayout->addLayout(formLayout);
@ -329,11 +317,7 @@ void QPrintPreviewDialogPrivate::init(QPrinter *_printer)
caption += QString::fromLatin1(": ") + printer->docName();
q->setWindowTitle(caption);
if (!printer->isValid()
#if defined(Q_WS_WIN) || defined(Q_WS_MAC)
|| printer->outputFormat() != QPrinter::NativeFormat
#endif
)
if (!printer->isValid())
pageSetupAction->setEnabled(false);
preview->setFocus();
}
@ -559,31 +543,6 @@ void QPrintPreviewDialogPrivate::_q_print()
{
Q_Q(QPrintPreviewDialog);
#if defined(Q_WS_WIN) || defined(Q_WS_MAC)
if (printer->outputFormat() != QPrinter::NativeFormat) {
QString title;
QString suffix;
if (printer->outputFormat() == QPrinter::PdfFormat) {
title = QCoreApplication::translate("QPrintPreviewDialog", "Export to PDF");
suffix = QLatin1String(".pdf");
} else {
title = QCoreApplication::translate("QPrintPreviewDialog", "Export to PostScript");
suffix = QLatin1String(".ps");
}
QString fileName = QFileDialog::getSaveFileName(q, title, printer->outputFileName(),
QLatin1Char('*') + suffix);
if (!fileName.isEmpty()) {
if (QFileInfo(fileName).suffix().isEmpty())
fileName.append(suffix);
printer->setOutputFileName(fileName);
}
if (!printer->outputFileName().isEmpty())
preview->print();
q->accept();
return;
}
#endif
if (!printDialog)
printDialog = new QPrintDialog(printer, q);
if (printDialog->exec() == QDialog::Accepted) {

View file

@ -1285,9 +1285,6 @@ bool QWizardPrivate::ensureButton(QWizard::WizardButton which) const
if (style != QApplication::style()) // Propagate style
pushButton->setStyle(style);
pushButton->setObjectName(object_name_for_button(which));
#ifdef Q_WS_MAC
pushButton->setAutoDefault(false);
#endif
pushButton->hide();
#ifdef Q_CC_HPACC
const_cast<QWizardPrivate *>(this)->btns[which] = pushButton;
@ -1520,41 +1517,10 @@ void QWizardPrivate::setStyle(QStyle *style)
for (int i = 0; i < QWizard::NButtons; i++)
if (btns[i])
btns[i]->setStyle(style);
const PageMap::const_iterator pcend = pageMap.constEnd();
for (PageMap::const_iterator it = pageMap.constBegin(); it != pcend; ++it)
for (PageMap::const_iterator it = pageMap.constBegin(); it != pageMap.constEnd(); ++it)
it.value()->setStyle(style);
}
#ifdef Q_WS_MAC
QPixmap QWizardPrivate::findDefaultBackgroundPixmap()
{
QCFType<CFURLRef> url;
const int ExpectedImageWidth = 242;
const int ExpectedImageHeight = 414;
if (LSFindApplicationForInfo(kLSUnknownCreator, CFSTR("com.apple.KeyboardSetupAssistant"),
0, 0, &url) == noErr) {
QCFType<CFBundleRef> bundle = CFBundleCreate(kCFAllocatorDefault, url);
if (bundle) {
url = CFBundleCopyResourceURL(bundle, CFSTR("Background"), CFSTR("tif"), 0);
if (url) {
QCFType<CGImageSourceRef> imageSource = CGImageSourceCreateWithURL(url, 0);
QCFType<CGImageRef> image = CGImageSourceCreateImageAtIndex(imageSource, 0, 0);
if (image) {
int width = CGImageGetWidth(image);
int height = CGImageGetHeight(image);
if (width == ExpectedImageWidth && height == ExpectedImageHeight)
return QPixmap::fromMacCGImageRef(image);
}
}
}
}
return QPixmap();
}
#endif
/*!
\class QWizard
\since 4.3
@ -2613,10 +2579,6 @@ QPixmap QWizard::pixmap(WizardPixmap which) const
{
Q_D(const QWizard);
Q_ASSERT(uint(which) < NPixmaps);
#ifdef Q_WS_MAC
if (which == BackgroundPixmap && d->defaultPixmaps[BackgroundPixmap].isNull())
d->defaultPixmaps[BackgroundPixmap] = d->findDefaultBackgroundPixmap();
#endif
return d->defaultPixmaps[which];
}

View file

@ -4096,14 +4096,6 @@ void QGraphicsScene::wheelEvent(QGraphicsSceneWheelEvent *wheelEvent)
wheelEvent->scenePos(),
wheelEvent->widget());
#ifdef Q_WS_MAC
// On Mac, ignore the event if the first item under the mouse is not the last opened
// popup (or one of its descendant)
if (!d->popupWidgets.isEmpty() && !wheelCandidates.isEmpty() && wheelCandidates.first() != d->popupWidgets.back() && !d->popupWidgets.back()->isAncestorOf(wheelCandidates.first())) {
wheelEvent->accept();
return;
}
#else
// Find the first popup under the mouse (including the popup's descendants) starting from the last.
// Remove all popups after the one found, or all or them if no popup is under the mouse.
// Then continue with the event.
@ -4113,7 +4105,6 @@ void QGraphicsScene::wheelEvent(QGraphicsSceneWheelEvent *wheelEvent)
break;
d->removePopup(*iter);
}
#endif
bool hasSetFocus = false;
foreach (QGraphicsItem *item, wheelCandidates) {

View file

@ -698,13 +698,6 @@ void QGraphicsWidgetPrivate::windowFrameHoverMoveEvent(QGraphicsSceneHoverEvent
case Qt::TitleBarArea:
windowData->buttonRect = q->style()->subControlRect(
QStyle::CC_TitleBar, &bar, QStyle::SC_TitleBarCloseButton, 0);
#ifdef Q_WS_MAC
// On mac we should hover if we are in the 'area' of the buttons
windowData->buttonRect |= q->style()->subControlRect(
QStyle::CC_TitleBar, &bar, QStyle::SC_TitleBarMinButton, 0);
windowData->buttonRect |= q->style()->subControlRect(
QStyle::CC_TitleBar, &bar, QStyle::SC_TitleBarMaxButton, 0);
#endif
if (windowData->buttonRect.contains(pos.toPoint()))
windowData->buttonMouseOver = true;
event->ignore();

View file

@ -350,11 +350,7 @@ void QIconLoaderEngine::ensureLoaded()
void QIconLoaderEngine::paint(QPainter *painter, const QRect &rect,
QIcon::Mode mode, QIcon::State state)
{
QSize pixmapSize = rect.size();
#if defined(Q_WS_MAC)
pixmapSize *= qt_mac_get_scalefactor();
#endif
painter->drawPixmap(rect, pixmap(pixmapSize, mode, state));
painter->drawPixmap(rect, pixmap(rect.size(), mode, state));
}
/*

View file

@ -2213,15 +2213,8 @@ void QHeaderView::mouseMoveEvent(QMouseEvent *e)
if (pos < 0 && d->state != QHeaderViewPrivate::SelectSections)
return;
if (e->buttons() == Qt::NoButton) {
#if !defined(Q_WS_MAC)
// Under Cocoa, when the mouse button is released, may include an extra
// simulated mouse moved event. The state of the buttons when this event
// is generated is already "no button" and the code below gets executed
// just before the mouseReleaseEvent and resets the state. This prevents
// column dragging from working. So this code is disabled under Cocoa.
d->state = QHeaderViewPrivate::NoState;
d->pressed = -1;
#endif
}
switch (d->state) {
case QHeaderViewPrivate::ResizeSection: {

View file

@ -2110,38 +2110,7 @@ QModelIndex QTreeView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie
}
return QModelIndex();
}
int vi = -1;
#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
// Selection behavior is slightly different on the Mac.
if (d->selectionMode == QAbstractItemView::ExtendedSelection
&& d->selectionModel
&& d->selectionModel->hasSelection()) {
const bool moveUpDown = (cursorAction == MoveUp || cursorAction == MoveDown);
const bool moveNextPrev = (cursorAction == MoveNext || cursorAction == MovePrevious);
const bool contiguousSelection = moveUpDown && (modifiers & Qt::ShiftModifier);
// Use the outermost index in the selection as the current index
if (!contiguousSelection && (moveUpDown || moveNextPrev)) {
// Find outermost index.
const bool useTopIndex = (cursorAction == MoveUp || cursorAction == MovePrevious);
int index = useTopIndex ? INT_MAX : INT_MIN;
const QItemSelection selection = d->selectionModel->selection();
for (int i = 0; i < selection.count(); ++i) {
const QItemSelectionRange &range = selection.at(i);
int candidate = d->viewIndex(useTopIndex ? range.topLeft() : range.bottomRight());
if (candidate >= 0)
index = useTopIndex ? qMin(index, candidate) : qMax(index, candidate);
}
if (index >= 0 && index < INT_MAX)
vi = index;
}
}
#endif
if (vi < 0)
vi = qMax(0, d->viewIndex(current));
const int vi = qMax(0, d->viewIndex(current));
if (isRightToLeft()) {
if (cursorAction == MoveRight)

View file

@ -2067,12 +2067,6 @@ void QApplication::syncX() {} // do nothing
#endif
/*!
\fn Qt::WindowsVersion QApplication::winVersion()
Use \l QSysInfo::WindowsVersion instead.
*/
/*!
\fn void QApplication::setActiveWindow(QWidget* active)
@ -4794,17 +4788,6 @@ bool QApplicationPrivate::shouldSetFocus(QWidget *w, Qt::FocusPolicy policy)
\sa x11ProcessEvent()
*/
/*! \fn void QApplication::winFocus(QWidget *widget, bool gotFocus)
\internal
\since 4.1
If \a gotFocus is true, \a widget will become the active window.
Otherwise the active window is reset to 0.
*/
/*! \fn void QApplication::winMouseButtonUp()
\internal
*/
/*! \fn void QApplication::syncX()
Synchronizes with the X server in the X11 implementation.

View file

@ -202,21 +202,9 @@ Qt::DropAction QDragManager::defaultAction(Qt::DropActions possibleActions,
if (defaultAction == Qt::IgnoreAction) {
//This means that the drag was initiated by QDrag::start and we need to
//preserve the old behavior
#ifdef Q_WS_MAC
defaultAction = Qt::MoveAction;
#else
defaultAction = Qt::CopyAction;
#endif
}
#ifdef Q_WS_MAC
if (modifiers & Qt::ControlModifier && modifiers & Qt::AltModifier)
defaultAction = Qt::LinkAction;
else if (modifiers & Qt::AltModifier)
defaultAction = Qt::CopyAction;
else if (modifiers & Qt::ControlModifier)
defaultAction = Qt::MoveAction;
#else
if (modifiers & Qt::ControlModifier && modifiers & Qt::ShiftModifier)
defaultAction = Qt::LinkAction;
else if (modifiers & Qt::ControlModifier)
@ -225,7 +213,6 @@ Qt::DropAction QDragManager::defaultAction(Qt::DropActions possibleActions,
defaultAction = Qt::MoveAction;
else if (modifiers & Qt::AltModifier)
defaultAction = Qt::LinkAction;
#endif
// if the object is set take the list of possibles from it
if (object)

View file

@ -88,9 +88,6 @@ Q_SIGNALS:
void targetChanged(QWidget *newTarget);
private:
#ifdef Q_WS_MAC
friend class QWidgetPrivate;
#endif
friend class QDragManager;
Q_DISABLE_COPY(QDrag)
};

View file

@ -783,17 +783,6 @@ bool QKeyEvent::matches(QKeySequence::StandardKey matchKey) const
uint searchkey = (modifiers() | key()) & ~(Qt::KeypadModifier); //The keypad modifier should not make a difference
uint platform = QApplicationPrivate::currentPlatform();
#ifdef Q_WS_MAC
if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) {
uint oldSearchKey = searchkey;
searchkey &= ~(Qt::ControlModifier | Qt::MetaModifier);
if (oldSearchKey & Qt::ControlModifier)
searchkey |= Qt::MetaModifier;
if (oldSearchKey & Qt::MetaModifier)
searchkey |= Qt::ControlModifier;
}
#endif
uint N = QKeySequencePrivate::numberOfKeyBindings;
int first = 0;
int last = N - 1;

View file

@ -232,97 +232,14 @@ private:
void QGridLayoutPrivate::effectiveMargins(int *left, int *top, int *right, int *bottom) const
{
int l = leftMargin;
int t = topMargin;
int r = rightMargin;
int b = bottomMargin;
#ifdef Q_WS_MAC
int leftMost = INT_MAX;
int topMost = INT_MAX;
int rightMost = 0;
int bottomMost = 0;
QWidget *w = 0;
const int n = things.count();
for (int i = 0; i < n; ++i) {
QGridBox *box = things.at(i);
QLayoutItem *itm = box->item();
w = itm->widget();
if (w) {
bool visualHReversed = hReversed != (w->layoutDirection() == Qt::RightToLeft);
QRect lir = itm->geometry();
QRect wr = w->geometry();
if (box->col <= leftMost) {
if (box->col < leftMost) {
// we found an item even closer to the margin, discard.
leftMost = box->col;
if (visualHReversed)
r = rightMargin;
else
l = leftMargin;
}
if (visualHReversed) {
r = qMax(r, wr.right() - lir.right());
} else {
l = qMax(l, lir.left() - wr.left());
}
}
if (box->row <= topMost) {
if (box->row < topMost) {
// we found an item even closer to the margin, discard.
topMost = box->row;
if (vReversed)
b = bottomMargin;
else
t = topMargin;
}
if (vReversed)
b = qMax(b, wr.bottom() - lir.bottom());
else
t = qMax(t, lir.top() - wr.top());
}
if (box->toCol(cc) >= rightMost) {
if (box->toCol(cc) > rightMost) {
// we found an item even closer to the margin, discard.
rightMost = box->toCol(cc);
if (visualHReversed)
l = leftMargin;
else
r = rightMargin;
}
if (visualHReversed) {
l = qMax(l, lir.left() - wr.left());
} else {
r = qMax(r, wr.right() - lir.right());
}
}
if (box->toRow(rr) >= bottomMost) {
if (box->toRow(rr) > bottomMost) {
// we found an item even closer to the margin, discard.
bottomMost = box->toRow(rr);
if (vReversed)
t = topMargin;
else
b = bottomMargin;
}
if (vReversed)
t = qMax(t, lir.top() - wr.top());
else
b = qMax(b, wr.bottom() - lir.bottom());
}
}
}
#endif
if (left)
*left = l;
*left = leftMargin;
if (top)
*top = t;
*top = topMargin;
if (right)
*right = r;
*right = rightMargin;
if (bottom)
*bottom = b;
*bottom = bottomMargin;
}
QGridLayoutPrivate::QGridLayoutPrivate()

View file

@ -413,7 +413,7 @@ void QToolTip::showText(const QPoint &pos, const QString &text, QWidget *w, cons
QTipLabel::instance->setObjectName(QLatin1String("qtooltip_label"));
#if !defined(QT_NO_EFFECTS) && !defined(Q_WS_MAC)
#if !defined(QT_NO_EFFECTS)
if (QApplication::isEffectEnabled(Qt::UI_FadeTooltip))
qFadeEffect(QTipLabel::instance);
else if (QApplication::isEffectEnabled(Qt::UI_AnimateTooltip))

View file

@ -1008,16 +1008,10 @@ void QWidgetPrivate::adjustFlags(Qt::WindowFlags &flags, QWidget *w)
if (flags & Qt::CustomizeWindowHint) {
// modify window flags to make them consistent.
// Only enable this on non-Mac platforms. Since the old way of doing this would
// interpret WindowSystemMenuHint as a close button and we can't change that behavior
// we can't just add this in.
#ifndef Q_WS_MAC
// Since the old way of doing this would interpret WindowSystemMenuHint as a
// close button and we can't change that behavior we can't just add this in.
if (flags & (Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint | Qt::WindowContextHelpButtonHint)) {
flags |= Qt::WindowSystemMenuHint;
#else
if (flags & (Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint
| Qt::WindowSystemMenuHint)) {
#endif
flags |= Qt::WindowTitleHint;
flags &= ~Qt::FramelessWindowHint;
}
@ -2048,11 +2042,7 @@ void QWidgetPrivate::paintBackground(QPainter *painter, const QRegion &rgn, int
visible widgets.
*/
#ifdef Q_WS_MAC
extern QPointer<QWidget> qt_button_down;
#else
extern QWidget *qt_button_down;
#endif
extern QWidget *qt_button_down;
void QWidgetPrivate::deactivateWidgetCleanup()
{
@ -2325,11 +2315,7 @@ void QWidget::setStyle(QStyle *style)
d->setStyle_helper(style, false);
}
void QWidgetPrivate::setStyle_helper(QStyle *newStyle, bool propagate, bool
#ifdef Q_WS_MAC
metalHack
#endif
)
void QWidgetPrivate::setStyle_helper(QStyle *newStyle, bool propagate)
{
Q_Q(QWidget);
QStyle *oldStyle = q->style();
@ -2337,35 +2323,18 @@ void QWidgetPrivate::setStyle_helper(QStyle *newStyle, bool propagate, bool
QWeakPointer<QStyle> origStyle;
#endif
#ifdef Q_WS_MAC
// the metalhack boolean allows Qt/Mac to do a proper re-polish depending
// on how the Qt::WA_MacBrushedMetal attribute is set. It is only ever
// set when changing that attribute and passes the widget's CURRENT style.
// therefore no need to do a reassignment.
if (!metalHack)
#endif
{
createExtra();
createExtra();
#ifndef QT_NO_STYLE_STYLESHEET
origStyle = extra->style.data();
origStyle = extra->style.data();
#endif
extra->style = newStyle;
}
extra->style = newStyle;
// repolish
if (q->windowType() != Qt::Desktop) {
if (polished) {
oldStyle->unpolish(q);
#ifdef Q_WS_MAC
if (metalHack)
macUpdateMetalAttribute();
#endif
q->style()->polish(q);
#ifdef Q_WS_MAC
} else if (metalHack) {
macUpdateMetalAttribute();
#endif
}
}
@ -4426,12 +4395,7 @@ QCursor QWidget::cursor() const
void QWidget::setCursor(const QCursor &cursor)
{
Q_D(QWidget);
// On Mac we must set the cursor even if it is the ArrowCursor.
#if !defined(Q_WS_MAC)
if (cursor.shape() != Qt::ArrowCursor
|| (d->extra && d->extra->curs))
#endif
{
if (cursor.shape() != Qt::ArrowCursor || (d->extra && d->extra->curs)) {
d->createExtra();
QCursor *newCursor = new QCursor(cursor);
delete d->extra->curs;
@ -4543,9 +4507,6 @@ void QWidget::render(QPainter *painter, const QPoint &targetOffset,
d->createExtra();
d->extra->inRenderWithPainter = true;
#ifdef Q_WS_MAC
d->render_helper(painter, targetOffset, toBePainted, renderFlags);
#else
QPaintEngine *engine = painter->paintEngine();
Q_ASSERT(engine);
QPaintEnginePrivate *enginePriv = engine->d_func();
@ -4586,7 +4547,6 @@ void QWidget::render(QPainter *painter, const QPoint &targetOffset,
// Restore shared painter.
d->setSharedPainter(oldPainter);
#endif
d->extra->inRenderWithPainter = false;
}
@ -4736,11 +4696,8 @@ void QWidgetPrivate::render_helper(QPainter *painter, const QPoint &targetOffset
Q_ASSERT(!toBePainted.isEmpty());
Q_Q(QWidget);
#ifndef Q_WS_MAC
const QTransform originalTransform = painter->worldTransform();
const bool useDeviceCoordinates = originalTransform.isScaling();
if (!useDeviceCoordinates) {
#endif
if (!originalTransform.isScaling()) {
// Render via a pixmap.
const QRect rect = toBePainted.boundingRect();
const QSize size = rect.size();
@ -4754,7 +4711,6 @@ void QWidgetPrivate::render_helper(QPainter *painter, const QPoint &targetOffset
painter->drawPixmap(targetOffset, pixmap);
#ifndef Q_WS_MAC
} else {
// Render via a pixmap in device coordinates (to avoid pixmap scaling).
QTransform transform = originalTransform;
@ -4785,7 +4741,6 @@ void QWidgetPrivate::render_helper(QPainter *painter, const QPoint &targetOffset
painter->drawPixmap(deviceRect.topLeft(), pixmap);
painter->setTransform(originalTransform);
}
#endif
}
void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QPoint &offset, int flags,
@ -4857,15 +4812,6 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
if (paintEngine) {
setRedirected(pdev, -offset);
#ifdef Q_WS_MAC
// (Alien support) Special case for Mac when redirecting: If the paint device
// is of the Widget type we need to set WA_WState_InPaintEvent since painting
// outside the paint event is not supported on QWidgets. The attributeis
// restored further down.
if (pdev->devType() == QInternal::Widget)
static_cast<QWidget *>(pdev)->setAttribute(Qt::WA_WState_InPaintEvent);
#endif
if (sharedPainter)
paintEngine->d_func()->systemClip = toBePainted;
else
@ -4903,10 +4849,6 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP
//restore
if (paintEngine) {
#ifdef Q_WS_MAC
if (pdev->devType() == QInternal::Widget)
static_cast<QWidget *>(pdev)->setAttribute(Qt::WA_WState_InPaintEvent, false);
#endif
restoreRedirected();
if (!sharedPainter)
paintEngine->d_func()->systemRect = QRect();
@ -5266,13 +5208,12 @@ void QWidget::unsetLocale()
static QString constructWindowTitleFromFilePath(const QString &filePath)
{
QFileInfo fi(filePath);
const QFileInfo fi(filePath);
QString windowTitle = fi.fileName() + QLatin1String("[*]");
#ifndef Q_WS_MAC
QString appName = QApplication::applicationName();
const QString appName = QApplication::applicationName();
if (!appName.isEmpty())
// 0x2014 is UTF-8 character
windowTitle += QLatin1Char(' ') + QChar(0x2014) + QLatin1Char(' ') + appName;
#endif
return windowTitle;
}
@ -5495,10 +5436,6 @@ QString QWidget::windowIconText() const
If the window title is set at any point, then the window title takes precedence and
will be shown instead of the file path string.
Additionally, on Mac OS X, this has an added benefit that it sets the
\l{http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/XHIGWindows/chapter_17_section_3.html}{proxy icon}
for the window, assuming that the file path exists.
If no file path is set, this property contains an empty string.
By default, this property contains an empty string.
@ -5521,23 +5458,10 @@ void QWidget::setWindowFilePath(const QString &filePath)
d->createTLExtra();
d->extra->topextra->filePath = filePath;
d->setWindowFilePath_helper(filePath);
}
void QWidgetPrivate::setWindowFilePath_helper(const QString &filePath)
{
if (extra->topextra && extra->topextra->caption.isEmpty()) {
#ifdef Q_WS_MAC
setWindowTitle_helper(QFileInfo(filePath).fileName());
#else
Q_Q(QWidget);
Q_UNUSED(filePath);
setWindowTitle_helper(q->windowTitle());
#endif
if (d->extra->topextra->caption.isEmpty()) {
d->setWindowTitle_helper(windowTitle());
}
#ifdef Q_WS_MAC
setWindowFilePath_sys(filePath);
#endif
}
/*!
@ -5943,16 +5867,6 @@ bool QWidget::isActiveWindow() const
}
#endif
#ifdef Q_WS_MAC
extern bool qt_mac_is_macdrawer(const QWidget *); //qwidget_mac.cpp
if(qt_mac_is_macdrawer(tlw) &&
tlw->parentWidget() && tlw->parentWidget()->isActiveWindow())
return true;
extern bool qt_mac_insideKeyWindow(const QWidget *); //qwidget_mac.cpp
if (QApplication::testAttribute(Qt::AA_MacPluginApplication) && qt_mac_insideKeyWindow(tlw))
return true;
#endif
if(style()->styleHint(QStyle::SH_Widget_ShareActivation, 0, this)) {
if(tlw->windowType() == Qt::Tool &&
!tlw->isModal() &&
@ -6350,13 +6264,6 @@ bool QWidget::restoreGeometry(const QByteArray &geometry)
// that would make the window "lost". This happens if:
// - The restored geometry is completely oustside the available geometry
// - The title bar is outside the available geometry.
// - (Mac only) The window is higher than the available geometry. It must
// be possible to bring the size grip on screen by moving the window.
#ifdef Q_WS_MAC
restoredFrameGeometry.setHeight(qMin(restoredFrameGeometry.height(), availableGeometry.height()));
restoredNormalGeometry.setHeight(qMin(restoredNormalGeometry.height(), availableGeometry.height() - frameHeight));
#endif
if (!restoredFrameGeometry.intersects(availableGeometry)) {
restoredFrameGeometry.moveBottom(qMin(restoredFrameGeometry.bottom(), availableGeometry.bottom()));
restoredFrameGeometry.moveLeft(qMax(restoredFrameGeometry.left(), availableGeometry.left()));
@ -7941,16 +7848,6 @@ void QWidget::changeEvent(QEvent * event)
update();
break;
#ifdef Q_WS_MAC
case QEvent::MacSizeChange:
updateGeometry();
break;
case QEvent::ToolTipChange:
case QEvent::MouseTrackingChange:
qt_mac_update_mouseTracking(this);
break;
#endif
default:
break;
}
@ -9706,15 +9603,11 @@ void QWidget::setWindowModified(bool mod)
Q_D(QWidget);
setAttribute(Qt::WA_WindowModified, mod);
#ifndef Q_WS_MAC
if (!windowTitle().contains(QLatin1String("[*]")) && mod)
qWarning("QWidget::setWindowModified: The window title does not contain a '[*]' placeholder");
#endif
d->setWindowTitle_helper(windowTitle());
d->setWindowIconText_helper(windowIconText());
#ifdef Q_WS_MAC
d->setWindowModified_sys(mod);
#endif
QEvent e(QEvent::ModifiedChange);
QApplication::sendEvent(this, &e);

View file

@ -320,7 +320,7 @@ public:
void setLocale_helper(const QLocale &l, bool forceUpdate = false);
void resolveLocale();
void setStyle_helper(QStyle *newStyle, bool propagate, bool metalHack = false);
void setStyle_helper(QStyle *newStyle, bool propagate);
void inheritStyle();
void setUpdatesEnabled_helper(bool );
@ -432,7 +432,6 @@ public:
#endif
void setWindowTitle_helper(const QString &cap);
void setWindowFilePath_helper(const QString &filePath);
bool setMinimumSize_helper(int &minw, int &minh);
bool setMaximumSize_helper(int &maxw, int &maxh);

View file

@ -722,9 +722,7 @@ void QPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem)
const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem);
QPainterPath path;
#ifndef Q_WS_MAC
path.setFillRule(Qt::WindingFill);
#endif
if (ti.glyphs.numGlyphs)
ti.fontEngine->addOutlineToPath(0, 0, ti.glyphs, &path, ti.flags);
if (!path.isEmpty()) {

View file

@ -1702,17 +1702,10 @@ void QRasterPaintEngine::drawPolygon(const QPoint *points, int pointCount, Polyg
// Do the outline...
if (s->penData.blend) {
int count = pointCount * 2;
const int count = pointCount * 2;
QVarLengthArray<qreal> fpoints(count);
#ifdef Q_WS_MAC
for (int i=0; i<count; i+=2) {
fpoints[i] = ((int *) points)[i+1];
fpoints[i+1] = ((int *) points)[i];
}
#else
for (int i=0; i<count; ++i)
fpoints[i] = ((int *) points)[i];
#endif
QVectorPath vp((qreal *) fpoints.data(), pointCount, 0, QVectorPath::polygonFlags(mode));
QPaintEngineEx::stroke(vp, s->lastPen);

View file

@ -782,19 +782,12 @@ void QPaintEngineEx::drawLines(const QLine *lines, int lineCount)
{
int elementCount = lineCount << 1;
while (elementCount > 0) {
int count = qMin(elementCount, 32);
const int count = qMin(elementCount, 32);
qreal pts[64];
int count2 = count<<1;
#ifdef Q_WS_MAC
for (int i=0; i<count2; i+=2) {
pts[i] = ((int *) lines)[i+1];
pts[i+1] = ((int *) lines)[i];
}
#else
const int count2 = count<<1;
for (int i=0; i<count2; ++i)
pts[i] = ((int *) lines)[i];
#endif
QVectorPath path(pts, count, qpaintengineex_line_types_16, QVectorPath::LinesHint);
stroke(path, state()->pen);
@ -922,18 +915,10 @@ void QPaintEngineEx::drawPolygon(const QPointF *points, int pointCount, PolygonD
void QPaintEngineEx::drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode)
{
int count = pointCount<<1;
const int count = pointCount<<1;
QVarLengthArray<qreal> pts(count);
#ifdef Q_WS_MAC
for (int i=0; i<count; i+=2) {
pts[i] = ((int *) points)[i+1];
pts[i+1] = ((int *) points)[i];
}
#else
for (int i=0; i<count; ++i)
pts[i] = ((int *) points)[i];
#endif
QVectorPath path(pts.data(), pointCount, 0, QVectorPath::polygonFlags(mode));

View file

@ -2568,17 +2568,11 @@ void QFontCache::clear()
end = engineDataCache.end();
while (it != end) {
QFontEngineData *data = it.value();
#if !defined(Q_WS_MAC)
for (int i = 0; i < QUnicodeTables::ScriptCount; ++i) {
if (data->engines[i] && !data->engines[i]->ref.deref())
delete data->engines[i];
data->engines[i] = 0;
}
#else
if (data->engine && !data->engine->ref.deref())
delete data->engine;
data->engine = 0;
#endif
++it;
}
}

View file

@ -739,7 +739,6 @@ struct QtFontDesc
int familyIndex;
};
#if !defined(Q_WS_MAC)
static void match(int script, const QFontDef &request,
const QString &family_name, const QString &foundry_name, int force_encoding_id,
QtFontDesc *desc, const QList<int> &blacklistedFamilies = QList<int>(), bool forceXLFD=false);
@ -771,9 +770,8 @@ static void initFontDef(const QtFontDesc &desc, const QFontDef &request, QFontDe
fontDef->ignorePitch = false;
}
#endif
#endif
#if defined(Q_WS_X11) || defined(Q_WS_WIN)
#if defined(Q_WS_X11)
static void getEngineData(const QFontPrivate *d, const QFontCache::Key &key)
{
// look for the requested font in the engine data cache
@ -922,7 +920,6 @@ static QtFontEncoding *findEncoding(int script, int styleStrategy,
}
#endif // Q_WS_X11
#if !defined(Q_WS_MAC)
static
unsigned int bestFoundry(int script, unsigned int score, int styleStrategy,
const QtFontFamily *family, const QString &foundry_name,
@ -1098,9 +1095,7 @@ unsigned int bestFoundry(int script, unsigned int score, int styleStrategy,
return score;
}
#endif
#if !defined(Q_WS_MAC)
/*!
\internal
@ -1203,7 +1198,6 @@ static void match(int script, const QFontDef &request,
break;
}
}
#endif
static QString styleStringHelper(int weight, QFont::Style style)
{

View file

@ -421,22 +421,11 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
break;
}
case QTextCursor::PreviousCharacter:
#ifdef Q_WS_MAC
if (mode == QTextCursor::MoveAnchor && position != adjusted_anchor)
newPosition = qMin(position, adjusted_anchor);
else
#endif
newPosition = priv->previousCursorPosition(position, QTextLayout::SkipCharacters);
newPosition = priv->previousCursorPosition(position, QTextLayout::SkipCharacters);
break;
case QTextCursor::Left:
#ifdef Q_WS_MAC
if (mode == QTextCursor::MoveAnchor && position != adjusted_anchor)
newPosition = visualMovement ? qMax(position, adjusted_anchor)
: qMin(position, adjusted_anchor);
else
#endif
newPosition = visualMovement ? priv->leftCursorPosition(position)
: priv->previousCursorPosition(position, QTextLayout::SkipCharacters);
newPosition = visualMovement ? priv->leftCursorPosition(position)
: priv->previousCursorPosition(position, QTextLayout::SkipCharacters);
break;
case QTextCursor::StartOfWord: {
if (relativePos == 0)
@ -546,22 +535,11 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
break;
}
case QTextCursor::NextCharacter:
#ifdef Q_WS_MAC
if (mode == QTextCursor::MoveAnchor && position != adjusted_anchor)
newPosition = qMax(position, adjusted_anchor);
else
#endif
newPosition = priv->nextCursorPosition(position, QTextLayout::SkipCharacters);
newPosition = priv->nextCursorPosition(position, QTextLayout::SkipCharacters);
break;
case QTextCursor::Right:
#ifdef Q_WS_MAC
if (mode == QTextCursor::MoveAnchor && position != adjusted_anchor)
newPosition = visualMovement ? qMin(position, adjusted_anchor)
: qMax(position, adjusted_anchor);
else
#endif
newPosition = visualMovement ? priv->rightCursorPosition(position)
: priv->nextCursorPosition(position, QTextLayout::SkipCharacters);
newPosition = visualMovement ? priv->rightCursorPosition(position)
: priv->nextCursorPosition(position, QTextLayout::SkipCharacters);
break;
case QTextCursor::NextWord:
case QTextCursor::WordRight:

View file

@ -833,8 +833,6 @@ QT_BEGIN_INCLUDE_NAMESPACE
#if defined(Q_WS_X11)
# include "qfontengine_ft_p.h"
#elif defined(Q_WS_MAC)
# include "qtextengine_mac.cpp"
#endif
#include <qharfbuzz_p.h>

View file

@ -1593,10 +1593,6 @@ QMainWindowLayout::~QMainWindowLayout()
layoutState.deleteAllLayoutItems();
layoutState.deleteCentralWidgetItem();
#ifdef Q_WS_MAC
cleanUpMacToolbarItems();
#endif
delete statusbar;
}

View file

@ -2513,11 +2513,7 @@ bool QMdiArea::eventFilter(QObject *object, QEvent *event)
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
// Ingore key events without a Ctrl modifier (except for press/release on the modifier itself).
#ifdef Q_WS_MAC
if (!(keyEvent->modifiers() & Qt::MetaModifier) && keyEvent->key() != Qt::Key_Meta)
#else
if (!(keyEvent->modifiers() & Qt::ControlModifier) && keyEvent->key() != Qt::Key_Control)
#endif
return QAbstractScrollArea::eventFilter(object, event);
// Find closest mdi area (in case we have a nested workspace).
@ -2532,11 +2528,7 @@ bool QMdiArea::eventFilter(QObject *object, QEvent *event)
// 3) Ctrl-Shift-Tab (Tab, Tab, ...) -> iterate through all windows in the opposite
// direction (activatePreviousSubWindow())
switch (keyEvent->key()) {
#ifdef Q_WS_MAC
case Qt::Key_Meta:
#else
case Qt::Key_Control:
#endif
if (keyPress)
area->d_func()->startTabToPreviousTimer();
else

View file

@ -203,7 +203,7 @@ void QSizeGripPrivate::init()
m_corner = q->isLeftToRight() ? Qt::BottomRightCorner : Qt::BottomLeftCorner;
gotMousePress = false;
#if !defined(QT_NO_CURSOR) && !defined(Q_WS_MAC)
#if !defined(QT_NO_CURSOR)
q->setCursor(m_corner == Qt::TopLeftCorner || m_corner == Qt::BottomRightCorner
? Qt::SizeFDiagCursor : Qt::SizeBDiagCursor);
#endif

View file

@ -326,22 +326,14 @@ void QDesignerWorkbench::addFormWindow(QDesignerFormWindow *formWindow)
m_actionManager->editWidgets()->trigger();
}
Qt::WindowFlags QDesignerWorkbench::magicalWindowFlags(const QWidget *widgetForFlags) const
Qt::WindowFlags QDesignerWorkbench::magicalWindowFlags() const
{
switch (m_mode) {
case TopLevelMode: {
#ifdef Q_WS_MAC
if (qobject_cast<const QDesignerToolWindow *>(widgetForFlags))
return Qt::Tool;
#else
Q_UNUSED(widgetForFlags);
#endif
return Qt::Window;
}
case DockedMode:
return Qt::Window | Qt::WindowShadeButtonHint | Qt::WindowSystemMenuHint | Qt::WindowTitleHint;
case TopLevelMode:
case NeutralMode:
return Qt::Window;
case DockedMode:
return Qt::Window | Qt::WindowShadeButtonHint | Qt::WindowSystemMenuHint | Qt::WindowTitleHint;
default:
Q_ASSERT(0);
return 0;
@ -430,7 +422,7 @@ void QDesignerWorkbench::switchToDockedMode()
qDesigner->setMainWindow(m_dockedMainWindow);
foreach (QDesignerFormWindow *fw, m_formWindows) {
QMdiSubWindow *subwin = m_dockedMainWindow->createMdiSubWindow(fw, magicalWindowFlags(fw),
QMdiSubWindow *subwin = m_dockedMainWindow->createMdiSubWindow(fw, magicalWindowFlags(),
m_actionManager->closeFormAction()->shortcut());
subwin->hide();
if (QWidget *mainContainer = fw->editor()->mainContainer())
@ -493,7 +485,7 @@ void QDesignerWorkbench::switchToTopLevelMode()
bool found_visible_window = false;
foreach (QDesignerToolWindow *tw, m_toolWindows) {
tw->setParent(magicalParent(tw), magicalWindowFlags(tw));
tw->setParent(magicalParent(tw), magicalWindowFlags());
settings.restoreGeometry(tw, tw->geometryHint());
tw->action()->setChecked(tw->isVisible());
found_visible_window |= tw->isVisible();
@ -505,7 +497,7 @@ void QDesignerWorkbench::switchToTopLevelMode()
m_actionManager->setBringAllToFrontVisible(true);
foreach (QDesignerFormWindow *fw, m_formWindows) {
fw->setParent(magicalParent(fw), magicalWindowFlags(fw));
fw->setParent(magicalParent(fw), magicalWindowFlags());
fw->setAttribute(Qt::WA_DeleteOnClose, true);
const PositionMap::const_iterator pit = m_Positions.constFind(fw);
if (pit != m_Positions.constEnd()) pit->applyTo(fw, desktopOffset);
@ -933,14 +925,14 @@ QDesignerFormWindow * QDesignerWorkbench::loadForm(const QString &fileName,
// below code must be after above call to setContents(), because setContents() may popup warning dialogs which would cause
// mdi sub window activation (because of dialogs internal call to processEvent or such)
// That activation could have worse consequences, e.g. NULL resource set for active form) before the form is loaded
QMdiSubWindow *subWin = m_dockedMainWindow->createMdiSubWindow(formWindow, magicalWindowFlags(formWindow), m_actionManager->closeFormAction()->shortcut());
QMdiSubWindow *subWin = m_dockedMainWindow->createMdiSubWindow(formWindow, magicalWindowFlags(), m_actionManager->closeFormAction()->shortcut());
m_dockedMainWindow->mdiArea()->setActiveSubWindow(subWin);
}
break;
case TopLevelMode: {
const QRect formWindowGeometryHint = formWindow->geometryHint();
formWindow->setAttribute(Qt::WA_DeleteOnClose, true);
formWindow->setParent(magicalParent(formWindow), magicalWindowFlags(formWindow));
formWindow->setParent(magicalParent(formWindow), magicalWindowFlags());
formWindow->resize(formWindowGeometryHint.size());
formWindow->move(availableGeometry().center() - formWindowGeometryHint.center());
}

View file

@ -144,7 +144,7 @@ private slots:
private:
QWidget *magicalParent(const QWidget *w) const;
Qt::WindowFlags magicalWindowFlags(const QWidget *widgetForFlags) const;
Qt::WindowFlags magicalWindowFlags() const;
QDesignerFormWindowManagerInterface *formWindowManager() const;
void closeAllToolWindows();
QDesignerToolWindow *widgetBoxToolWindow() const;

View file

@ -157,11 +157,7 @@ void VersionLabel::paintEvent(QPaintEvent *pe)
}
VersionDialog::VersionDialog(QWidget *parent)
: QDialog(parent
#ifdef Q_WS_MAC
, Qt::Tool
#endif
)
: QDialog(parent)
{
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QGridLayout *layout = new QGridLayout(this);