summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2009-05-27 23:04:41 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2009-05-27 23:04:41 +0200
commitfcfdccc03b6dd26a82e87a6b6a0ca48d67f78cf6 (patch)
tree2cdd417bc0be39b12674f33052462d19d9e38ef9 /src/gui
parent7b1f8c542bc9f41408f0a54b853d75d0c09a2775 (diff)
parentd0bc0a26f8ac4c2f02819c262b8aa7c3dd1cad3b (diff)
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt
Conflicts: tests/auto/qtreeview/tst_qtreeview.cpp
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/dialogs/qfiledialog.cpp11
-rw-r--r--src/gui/dialogs/qfontdialog.cpp8
-rw-r--r--src/gui/dialogs/qfontdialog_mac.mm40
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp4
-rw-r--r--src/gui/image/qpixmap.cpp95
-rw-r--r--src/gui/image/qpixmap_qws.cpp14
-rw-r--r--src/gui/image/qpixmap_win.cpp45
-rw-r--r--src/gui/image/qpixmap_x11.cpp28
-rw-r--r--src/gui/itemviews/qheaderview.cpp4
-rw-r--r--src/gui/itemviews/qsortfilterproxymodel.cpp3
-rw-r--r--src/gui/itemviews/qtreeview.cpp8
-rw-r--r--src/gui/kernel/qapplication_win.cpp29
-rw-r--r--src/gui/kernel/qcocoaapplicationdelegate_mac.mm2
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm28
-rw-r--r--src/gui/kernel/qcocoaview_mac_p.h1
-rw-r--r--src/gui/kernel/qcursor.cpp4
-rw-r--r--src/gui/kernel/qkeysequence.cpp2
-rw-r--r--src/gui/painting/qcolor.cpp8
-rw-r--r--src/gui/painting/qcolormap_x11.cpp4
-rw-r--r--src/gui/painting/qpainterpath.cpp8
-rw-r--r--src/gui/painting/qtextureglyphcache.cpp8
-rw-r--r--src/gui/styles/qgtkstyle.cpp65
-rw-r--r--src/gui/styles/qstylesheetstyle.cpp9
-rw-r--r--src/gui/text/qfont.cpp14
-rw-r--r--src/gui/text/qfont_x11.cpp11
-rw-r--r--src/gui/text/qfontengine_win.cpp6
-rw-r--r--src/gui/text/qfontmetrics.cpp12
-rw-r--r--src/gui/widgets/qtabbar.cpp11
28 files changed, 282 insertions, 200 deletions
diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp
index 3ccae3aa9c..56b89f09a2 100644
--- a/src/gui/dialogs/qfiledialog.cpp
+++ b/src/gui/dialogs/qfiledialog.cpp
@@ -776,6 +776,7 @@ void QFileDialog::selectFile(const QString &filename)
}
QModelIndex index = d->model->index(filename);
+ QString file;
if (!index.isValid()) {
// save as dialog where we want to input a default value
QString text = filename;
@@ -790,13 +791,13 @@ void QFileDialog::selectFile(const QString &filename)
)
text = text.remove(0,1);
}
- if (!isVisible() || !d->lineEdit()->hasFocus())
- d->lineEdit()->setText(text);
+ file = text;
} else {
- d->qFileDialogUi->listView->selectionModel()->clear();
- if (!isVisible() || !d->lineEdit()->hasFocus())
- d->lineEdit()->setText(index.data().toString());
+ file = index.data().toString();
}
+ d->qFileDialogUi->listView->selectionModel()->clear();
+ if (!isVisible() || !d->lineEdit()->hasFocus())
+ d->lineEdit()->setText(file);
}
/**
diff --git a/src/gui/dialogs/qfontdialog.cpp b/src/gui/dialogs/qfontdialog.cpp
index d8a2c7cfe1..c7484e7147 100644
--- a/src/gui/dialogs/qfontdialog.cpp
+++ b/src/gui/dialogs/qfontdialog.cpp
@@ -337,6 +337,14 @@ void QFontDialogPrivate::init()
QFontDialog::~QFontDialog()
{
+#ifdef Q_WS_MAC
+ Q_D(QFontDialog);
+ if (d->delegate) {
+ QFontDialogPrivate::closeCocoaFontPanel(d->delegate);
+ QFontDialogPrivate::sharedFontPanelAvailable = true;
+ return;
+ }
+#endif
}
/*!
diff --git a/src/gui/dialogs/qfontdialog_mac.mm b/src/gui/dialogs/qfontdialog_mac.mm
index 50917a1614..3be53db3d5 100644
--- a/src/gui/dialogs/qfontdialog_mac.mm
+++ b/src/gui/dialogs/qfontdialog_mac.mm
@@ -47,6 +47,7 @@
#include <private/qapplication_p.h>
#include <private/qfont_p.h>
#include <private/qfontengine_p.h>
+#include <private/qt_cocoa_helpers_mac_p.h>
#include <private/qt_mac_p.h>
#include <qdebug.h>
#import <AppKit/AppKit.h>
@@ -123,16 +124,16 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont)
QFont newFont;
if (cocoaFont) {
int pSize = qRound([cocoaFont pointSize]);
- QString family(QCFString::toQString(reinterpret_cast<CFStringRef>([cocoaFont familyName])));
- QString typeface(QCFString::toQString(reinterpret_cast<CFStringRef>([cocoaFont fontName])));
-// qDebug() << "original family" << family << "typeface" << typeface << "psize" << pSize;
+ QString family(qt_mac_NSStringToQString([cocoaFont familyName]));
+ QString typeface(qt_mac_NSStringToQString([cocoaFont fontName]));
+
int hyphenPos = typeface.indexOf(QLatin1Char('-'));
if (hyphenPos != -1) {
typeface.remove(0, hyphenPos + 1);
} else {
typeface = QLatin1String("Normal");
}
-// qDebug() << " massaged family" << family << "typeface" << typeface << "psize" << pSize;
+
newFont = QFontDatabase().font(family, typeface, pSize);
newFont.setUnderline(resolveFont.underline());
newFont.setStrikeOut(resolveFont.strikeOut());
@@ -566,6 +567,7 @@ void *QFontDialogPrivate::openCocoaFontPanel(const QFont &initial,
void QFontDialogPrivate::closeCocoaFontPanel(void *delegate)
{
+ QMacCocoaAutoReleasePool pool;
QCocoaFontPanelDelegate *theDelegate = static_cast<QCocoaFontPanelDelegate *>(delegate);
NSWindow *ourPanel = [theDelegate actualPanel];
[ourPanel close];
@@ -597,15 +599,37 @@ QFont QFontDialogPrivate::execCocoaFontPanel(bool *ok, const QFont &initial,
}
}
-void QFontDialogPrivate::setFont(void * delegate, const QFont &font)
+void QFontDialogPrivate::setFont(void *delegate, const QFont &font)
{
+ QMacCocoaAutoReleasePool pool;
QFontEngine *fe = font.d->engineForScript(QUnicodeTables::Common);
+ NSFontManager *mgr = [NSFontManager sharedFontManager];
+ NSFont *nsFont = 0;
+
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
if (qstrcmp(fe->name(), "CoreText") == 0) {
- const NSFont *nsFont = reinterpret_cast<const NSFont *>(static_cast<QCoreTextFontEngineMulti *>(fe)->ctfont);
- [[NSFontManager sharedFontManager] setSelectedFont:nsFont isMultiple:NO];
- }
+ nsFont = reinterpret_cast<const NSFont *>(static_cast<QCoreTextFontEngineMulti *>(fe)->ctfont);
+ } else
#endif
+ {
+ int weight = 5;
+ NSFontTraitMask mask = 0;
+ if (font.style() == QFont::StyleItalic) {
+ mask |= NSItalicFontMask;
+ }
+ if (font.weight() == QFont::Bold) {
+ weight = 9;
+ mask |= NSBoldFontMask;
+ }
+
+ NSFontManager *mgr = [NSFontManager sharedFontManager];
+ nsFont = [mgr fontWithFamily:qt_mac_QStringToNSString(font.family())
+ traits:mask
+ weight:weight
+ size:font.pointSize()];
+ }
+
+ [mgr setSelectedFont:nsFont isMultiple:NO];
[static_cast<QCocoaFontPanelDelegate *>(delegate) setQtFont:font];
}
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 58b01cbd7d..b9e462b81b 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -1640,6 +1640,10 @@ void QGraphicsItemPrivate::setVisibleHelper(bool newVisible, bool explicitly, bo
if (visible == quint32(newVisible))
return;
+ // Don't show child if parent is not visible
+ if (parent && newVisible && !parent->d_ptr->visible)
+ return;
+
// Modify the property.
const QVariant newVisibleVariant(q_ptr->itemChange(QGraphicsItem::ItemVisibleChange,
quint32(newVisible)));
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 3ca685c88b..8ed9e931a8 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -2050,4 +2050,99 @@ QPixmapData* QPixmap::pixmapData() const
return data;
}
+/*!
+ \enum QPixmap::HBitmapFormat
+
+ \bold{Win32 only:} This enum defines how the conversion between \c
+ HBITMAP and QPixmap is performed.
+
+ \warning This enum is only available on Windows.
+
+ \value NoAlpha The alpha channel is ignored and always treated as
+ being set to fully opaque. This is preferred if the \c HBITMAP is
+ used with standard GDI calls, such as \c BitBlt().
+
+ \value PremultipliedAlpha The \c HBITMAP is treated as having an
+ alpha channel and premultiplied colors. This is preferred if the
+ \c HBITMAP is accessed through the \c AlphaBlend() GDI function.
+
+ \value Alpha The \c HBITMAP is treated as having a plain alpha
+ channel. This is the preferred format if the \c HBITMAP is going
+ to be used as an application icon or systray icon.
+
+ \sa fromWinHBITMAP(), toWinHBITMAP()
+*/
+
+/*! \fn HBITMAP QPixmap::toWinHBITMAP(HBitmapFormat format) const
+ \bold{Win32 only:} Creates a \c HBITMAP equivalent to the QPixmap,
+ based on the given \a format. Returns the \c HBITMAP handle.
+
+ It is the caller's responsibility to free the \c HBITMAP data
+ after use.
+
+ \warning This function is only available on Windows.
+
+ \sa fromWinHBITMAP()
+*/
+
+/*! \fn QPixmap QPixmap::fromWinHBITMAP(HBITMAP bitmap, HBitmapFormat format)
+ \bold{Win32 only:} Returns a QPixmap that is equivalent to the
+ given \a bitmap. The conversion is based on the specified \a
+ format.
+
+ \warning This function is only available on Windows.
+
+ \sa toWinHBITMAP(), {QPixmap#Pixmap Conversion}{Pixmap Conversion}
+
+*/
+
+/*! \fn const QX11Info &QPixmap::x11Info() const
+ \bold{X11 only:} Returns information about the configuration of
+ the X display used to display the widget.
+
+ \warning This function is only available on X11.
+
+ \sa {QPixmap#Pixmap Information}{Pixmap Information}
+*/
+
+/*! \fn Qt::HANDLE QPixmap::x11PictureHandle() const
+ \bold{X11 only:} Returns the X11 Picture handle of the pixmap for
+ XRender support.
+
+ This function will return 0 if XRender support is not compiled
+ into Qt, if the XRender extension is not supported on the X11
+ display, or if the handle could not be created. Use of this
+ function is not portable.
+
+ \warning This function is only available on X11.
+
+ \sa {QPixmap#Pixmap Information}{Pixmap Information}
+*/
+
+/*! \fn int QPixmap::x11SetDefaultScreen(int screen)
+ \internal
+*/
+
+/*! \fn void QPixmap::x11SetScreen(int screen)
+ \internal
+*/
+
+/*! \fn QRgb* QPixmap::clut() const
+ \internal
+*/
+
+/*! \fn int QPixmap::numCols() const
+ \internal
+*/
+
+/*! \fn const uchar* QPixmap::qwsBits() const
+ \internal
+ \since 4.1
+*/
+
+/*! \fn int QPixmap::qwsBytesPerLine() const
+ \internal
+ \since 4.1
+*/
+
QT_END_NAMESPACE
diff --git a/src/gui/image/qpixmap_qws.cpp b/src/gui/image/qpixmap_qws.cpp
index 6cc79818d5..7e383abead 100644
--- a/src/gui/image/qpixmap_qws.cpp
+++ b/src/gui/image/qpixmap_qws.cpp
@@ -109,9 +109,6 @@ QPixmap QPixmap::grabWindow(WId window, int x, int y, int w, int h)
return QPixmap::fromImage(img);
}
-/*!
- \internal
-*/
QRgb* QPixmap::clut() const
{
if (data->classId() == QPixmapData::RasterClass) {
@@ -122,9 +119,6 @@ QRgb* QPixmap::clut() const
return 0;
}
-/*!
- \internal
-*/
int QPixmap::numCols() const
{
if (data->classId() == QPixmapData::RasterClass) {
@@ -135,10 +129,6 @@ int QPixmap::numCols() const
return 0;
}
-/*!
- \internal
- \since 4.1
-*/
const uchar* QPixmap::qwsBits() const
{
if (data->classId() == QPixmapData::RasterClass) {
@@ -149,10 +139,6 @@ const uchar* QPixmap::qwsBits() const
return 0;
}
-/*!
- \internal
- \since 4.1
-*/
int QPixmap::qwsBytesPerLine() const
{
if (data->classId() == QPixmapData::RasterClass) {
diff --git a/src/gui/image/qpixmap_win.cpp b/src/gui/image/qpixmap_win.cpp
index d4ebef7349..ac02f972c5 100644
--- a/src/gui/image/qpixmap_win.cpp
+++ b/src/gui/image/qpixmap_win.cpp
@@ -119,42 +119,6 @@ QPixmap QPixmap::grabWindow(WId winId, int x, int y, int w, int h )
return pixmap;
}
-
-
-/*!
- \enum QPixmap::HBitmapFormat
-
- This enum defines how the conversion between \c HBITMAP
- and QPixmap is performed.
-
- \warning This enum is only available on Windows.
-
- \value NoAlpha The alpha channel is ignored and always treated as
- being set to fully opaque. This is preferred if the \c HBITMAP is
- used with standard GDI calls, such as \c BitBlt().
-
- \value PremultipliedAlpha The \c HBITMAP is treated as having an
- alpha channel and premultiplied colors. This is preferred if the
- \c HBITMAP is accessed through the \c AlphaBlend() GDI function.
-
- \value Alpha The \c HBITMAP is treated as having a plain alpha
- channel. This is the preferred format if the \c HBITMAP is going
- to be used as an application icon or systray icon.
-
- \sa fromWinHBITMAP(), toWinHBITMAP()
-*/
-
-/*!
- Creates a \c HBITMAP equivalent to the QPixmap, based on the given
- \a format. Returns the \c HBITMAP handle.
-
- It is the caller's responsibility to free the \c HBITMAP data
- after use.
-
- \warning This function is only available on Windows.
-
- \sa fromWinHBITMAP()
-*/
HBITMAP QPixmap::toWinHBITMAP(HBitmapFormat format) const
{
HBITMAP bitmap = 0;
@@ -209,15 +173,6 @@ HBITMAP QPixmap::toWinHBITMAP(HBitmapFormat format) const
return bitmap;
}
-/*!
- Returns a QPixmap that is equivalent to the given \a bitmap. The
- conversion is based on the specified \a format.
-
- \warning This function is only available on Windows.
-
- \sa toWinHBITMAP(), {QPixmap#Pixmap Conversion}{Pixmap Conversion}
-
-*/
QPixmap QPixmap::fromWinHBITMAP(HBITMAP bitmap, HBitmapFormat format)
{
// Verify size
diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp
index d9c10db787..a0ae01fdb4 100644
--- a/src/gui/image/qpixmap_x11.cpp
+++ b/src/gui/image/qpixmap_x11.cpp
@@ -1914,9 +1914,6 @@ QPixmap QX11PixmapData::transformed(const QTransform &transform,
}
}
-/*!
- \internal
-*/
int QPixmap::x11SetDefaultScreen(int screen)
{
int old = defaultScreen;
@@ -1924,9 +1921,6 @@ int QPixmap::x11SetDefaultScreen(int screen)
return old;
}
-/*!
- \internal
-*/
void QPixmap::x11SetScreen(int screen)
{
if (paintingActive()) {
@@ -2034,14 +2028,6 @@ bool QX11PixmapData::hasAlphaChannel() const
return d == 32;
}
-/*!
- Returns information about the configuration of the X display used to display
- the widget.
-
- \warning This function is only available on X11.
-
- \sa {QPixmap#Pixmap Information}{Pixmap Information}
-*/
const QX11Info &QPixmap::x11Info() const
{
if (data->classId() == QPixmapData::X11Class)
@@ -2098,20 +2084,6 @@ QPaintEngine* QX11PixmapData::paintEngine() const
return that->pengine;
}
-/*!
- Returns the X11 Picture handle of the pixmap for XRender
- support.
-
- This function will return 0 if XRender support is not compiled
- into Qt, if the XRender extension is not supported on the X11
- display, or if the handle could not be created. Use of this
- function is not portable.
-
- \warning This function is only available on X11.
-
- \sa {QPixmap#Pixmap Information}{Pixmap Information}
-*/
-
Qt::HANDLE QPixmap::x11PictureHandle() const
{
#ifndef QT_NO_XRENDER
diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp
index 6238df54b2..ad93922458 100644
--- a/src/gui/itemviews/qheaderview.cpp
+++ b/src/gui/itemviews/qheaderview.cpp
@@ -1267,8 +1267,10 @@ void QHeaderView::setSortIndicator(int logicalIndex, Qt::SortOrder order)
d->sortIndicatorSection = logicalIndex;
d->sortIndicatorOrder = order;
- if (logicalIndex >= d->sectionCount)
+ if (logicalIndex >= d->sectionCount) {
+ emit sortIndicatorChanged(logicalIndex, order);
return; // nothing to do
+ }
if (old != logicalIndex
&& ((logicalIndex >= 0 && resizeMode(logicalIndex) == ResizeToContents)
diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp
index 56925b8ffa..96eb6f02e7 100644
--- a/src/gui/itemviews/qsortfilterproxymodel.cpp
+++ b/src/gui/itemviews/qsortfilterproxymodel.cpp
@@ -1539,7 +1539,8 @@ void QSortFilterProxyModel::setSourceModel(QAbstractItemModel *sourceModel)
d->clear_mapping();
reset();
- d->update_source_sort_column();
+ if (d->update_source_sort_column() && d->dynamic_sortfilter)
+ d->sort();
}
/*!
diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp
index d742698e36..c3fca8e061 100644
--- a/src/gui/itemviews/qtreeview.cpp
+++ b/src/gui/itemviews/qtreeview.cpp
@@ -246,7 +246,7 @@ void QTreeView::setModel(QAbstractItemModel *model)
connect(d->model, SIGNAL(modelAboutToBeReset()), SLOT(_q_modelAboutToBeReset()));
if (d->sortingEnabled)
- sortByColumn(header()->sortIndicatorSection(), header()->sortIndicatorOrder());
+ d->_q_sortIndicatorChanged(header()->sortIndicatorSection(), header()->sortIndicatorOrder());
}
/*!
@@ -844,17 +844,19 @@ void QTreeView::setExpanded(const QModelIndex &index, bool expanded)
void QTreeView::setSortingEnabled(bool enable)
{
Q_D(QTreeView);
- d->sortingEnabled = enable;
header()->setSortIndicatorShown(enable);
header()->setClickable(enable);
if (enable) {
+ //sortByColumn has to be called before we connect or set the sortingEnabled flag
+ // because otherwise it will not call sort on the model.
+ sortByColumn(header()->sortIndicatorSection(), header()->sortIndicatorOrder());
connect(header(), SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)),
this, SLOT(_q_sortIndicatorChanged(int, Qt::SortOrder)));
- sortByColumn(header()->sortIndicatorSection(), header()->sortIndicatorOrder());
} else {
disconnect(header(), SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)),
this, SLOT(_q_sortIndicatorChanged(int, Qt::SortOrder)));
}
+ d->sortingEnabled = enable;
}
bool QTreeView::isSortingEnabled() const
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index f264d12fb7..39f7335217 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -1652,20 +1652,23 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
// send the context menu event is a different one
if (!alienWidget->testAttribute(Qt::WA_NativeWindow) && !alienWidget->testAttribute(Qt::WA_PaintOnScreen)) {
alienWidget = QApplication::widgetAt(globalPos);
- pos = alienWidget->mapFromGlobal(globalPos);
+ if (alienWidget)
+ pos = alienWidget->mapFromGlobal(globalPos);
}
- SHRGINFO shrg;
- shrg.cbSize = sizeof(shrg);
- shrg.hwndClient = hwnd;
- shrg.ptDown.x = GET_X_LPARAM(lParam);
- shrg.ptDown.y = GET_Y_LPARAM(lParam);
- shrg.dwFlags = SHRG_RETURNCMD | SHRG_NOANIMATION;
- resolveAygLibs();
- if (ptrRecognizeGesture && (ptrRecognizeGesture(&shrg) == GN_CONTEXTMENU)) {
- if (qApp->activePopupWidget())
- qApp->activePopupWidget()->close();
- QContextMenuEvent e(QContextMenuEvent::Mouse, pos, globalPos);
- result = qt_sendSpontaneousEvent(alienWidget, &e);
+ if (alienWidget) {
+ SHRGINFO shrg;
+ shrg.cbSize = sizeof(shrg);
+ shrg.hwndClient = hwnd;
+ shrg.ptDown.x = GET_X_LPARAM(lParam);
+ shrg.ptDown.y = GET_Y_LPARAM(lParam);
+ shrg.dwFlags = SHRG_RETURNCMD | SHRG_NOANIMATION;
+ resolveAygLibs();
+ if (ptrRecognizeGesture && (ptrRecognizeGesture(&shrg) == GN_CONTEXTMENU)) {
+ if (qApp->activePopupWidget())
+ qApp->activePopupWidget()->close();
+ QContextMenuEvent e(QContextMenuEvent::Mouse, pos, globalPos);
+ result = qt_sendSpontaneousEvent(alienWidget, &e);
+ }
}
}
}
diff --git a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm
index 9a246455c2..2ca6a3de87 100644
--- a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm
+++ b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm
@@ -90,6 +90,7 @@
QT_BEGIN_NAMESPACE
extern void onApplicationChangedActivation(bool); // qapplication_mac.mm
+extern void qt_release_apple_event_handler(); //qapplication_mac.mm
QT_END_NAMESPACE
QT_FORWARD_DECLARE_CLASS(QDesktopWidgetImplementation)
@@ -207,7 +208,6 @@ static void cleanupCocoaApplicationDelegate()
{
Q_UNUSED(aNotification);
inLaunch = false;
- extern void qt_release_apple_event_handler(); //qapplication_mac.mm
qt_release_apple_event_handler();
}
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index 1cbc960b46..838f751b2a 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -791,10 +791,22 @@ extern "C" {
bool wheelOK = false;
Qt::KeyboardModifiers keyMods = qt_cocoaModifiers2QtModifiers([theEvent modifierFlags]);
+ QWidget *widgetToGetMouse = qwidget;
+ if (widgetToGetMouse->testAttribute(Qt::WA_TransparentForMouseEvents)) {
+ // Simulate passing the event through since Cocoa doesn't do that for us.
+ // Start by building a tree up.
+ NSView *candidateView = [self viewUnderTransparentForMouseView:self
+ widget:widgetToGetMouse
+ withWindowPoint:windowPoint];
+ if (candidateView != nil) {
+ widgetToGetMouse = QWidget::find(WId(candidateView));
+ }
+ }
+
// Mouse wheel deltas seem to tick in at increments of 0.1. Qt widgets
- // expect the delta to be a multiple of 120.
+ // expect the delta to be a multiple of 120.
const int ScrollFactor = 10 * 120;
- // The qMax(...) factor reduces the
+ // The qMax(...) factor reduces the
// acceleration for large wheel deltas.
int deltaX = [theEvent deltaX] * ScrollFactor * qMax(0.6, 1.1 - qAbs([theEvent deltaX]));
int deltaY = [theEvent deltaY] * ScrollFactor * qMax(0.6, 1.1 - qAbs([theEvent deltaY]));
@@ -802,10 +814,10 @@ extern "C" {
if (deltaX != 0) {
QWheelEvent qwe(qlocal, qglobal, deltaX, buttons, keyMods, Qt::Horizontal);
- qt_sendSpontaneousEvent(qwidget, &qwe);
+ qt_sendSpontaneousEvent(widgetToGetMouse, &qwe);
wheelOK = qwe.isAccepted();
if (!wheelOK && QApplicationPrivate::focus_widget
- && QApplicationPrivate::focus_widget != qwidget) {
+ && QApplicationPrivate::focus_widget != widgetToGetMouse) {
QWheelEvent qwe2(QApplicationPrivate::focus_widget->mapFromGlobal(qglobal), qglobal,
deltaX, buttons, keyMods, Qt::Horizontal);
qt_sendSpontaneousEvent(QApplicationPrivate::focus_widget, &qwe2);
@@ -815,10 +827,10 @@ extern "C" {
if (deltaY) {
QWheelEvent qwe(qlocal, qglobal, deltaY, buttons, keyMods, Qt::Vertical);
- qt_sendSpontaneousEvent(qwidget, &qwe);
+ qt_sendSpontaneousEvent(widgetToGetMouse, &qwe);
wheelOK = qwe.isAccepted();
if (!wheelOK && QApplicationPrivate::focus_widget
- && QApplicationPrivate::focus_widget != qwidget) {
+ && QApplicationPrivate::focus_widget != widgetToGetMouse) {
QWheelEvent qwe2(QApplicationPrivate::focus_widget->mapFromGlobal(qglobal), qglobal,
deltaY, buttons, keyMods, Qt::Vertical);
qt_sendSpontaneousEvent(QApplicationPrivate::focus_widget, &qwe2);
@@ -830,10 +842,10 @@ extern "C" {
// Qt doesn't explicitly support wheels with a Z component. In a misguided attempt to
// try to be ahead of the pack, I'm adding this extra value.
QWheelEvent qwe(qlocal, qglobal, deltaZ, buttons, keyMods, (Qt::Orientation)3);
- qt_sendSpontaneousEvent(qwidget, &qwe);
+ qt_sendSpontaneousEvent(widgetToGetMouse, &qwe);
wheelOK = qwe.isAccepted();
if (!wheelOK && QApplicationPrivate::focus_widget
- && QApplicationPrivate::focus_widget != qwidget) {
+ && QApplicationPrivate::focus_widget != widgetToGetMouse) {
QWheelEvent qwe2(QApplicationPrivate::focus_widget->mapFromGlobal(qglobal), qglobal,
deltaZ, buttons, keyMods, (Qt::Orientation)3);
qt_sendSpontaneousEvent(QApplicationPrivate::focus_widget, &qwe2);
diff --git a/src/gui/kernel/qcocoaview_mac_p.h b/src/gui/kernel/qcocoaview_mac_p.h
index 1d4e3e40ed..be4501f3ca 100644
--- a/src/gui/kernel/qcocoaview_mac_p.h
+++ b/src/gui/kernel/qcocoaview_mac_p.h
@@ -59,6 +59,7 @@ QT_FORWARD_DECLARE_CLASS(QWidgetPrivate);
QT_FORWARD_DECLARE_CLASS(QWidget);
QT_FORWARD_DECLARE_CLASS(QEvent);
QT_FORWARD_DECLARE_CLASS(QCocoaDropData);
+QT_FORWARD_DECLARE_CLASS(QStringList);
QT_BEGIN_NAMESPACE
struct DnDParams
diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp
index ed7e020d23..598f4bae46 100644
--- a/src/gui/kernel/qcursor.cpp
+++ b/src/gui/kernel/qcursor.cpp
@@ -375,7 +375,9 @@ void QCursorData::cleanup()
return;
for (int shape = 0; shape <= Qt::LastCursor; ++shape) {
- delete qt_cursorTable[shape];
+ // In case someone has a static QCursor defined with this shape
+ if (!qt_cursorTable[shape]->ref.deref())
+ delete qt_cursorTable[shape];
qt_cursorTable[shape] = 0;
}
QCursorData::initialized = false;
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index 21f8859a8a..ee45969ac8 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -652,8 +652,6 @@ const uint QKeySequencePrivate::numberOfKeyBindings = sizeof(QKeySequencePrivate
This enum represent standard key bindings. They can be used to
assign platform dependent keyboard shortcuts to a QAction.
- QKeyEvent also provides the function QKeyEvent::standardKey() to
- query if it matches an existing key binding.
Note that the key bindings are platform dependent. The currently
bound shortcuts can be queried using keyBindings().
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp
index 6b58f14883..b1fe3aa072 100644
--- a/src/gui/painting/qcolor.cpp
+++ b/src/gui/painting/qcolor.cpp
@@ -2241,4 +2241,12 @@ QDataStream &operator>>(QDataStream &stream, QColor &color)
\sa QColor::rgb(), QColor::rgba()
*/
+/*! \fn void QColormap::initialize()
+ \internal
+*/
+
+/*! \fn void QColormap::cleanup()
+ \internal
+*/
+
QT_END_NAMESPACE
diff --git a/src/gui/painting/qcolormap_x11.cpp b/src/gui/painting/qcolormap_x11.cpp
index ccf6955100..c9186b18ef 100644
--- a/src/gui/painting/qcolormap_x11.cpp
+++ b/src/gui/painting/qcolormap_x11.cpp
@@ -337,8 +337,6 @@ static void init_direct(QColormapPrivate *d, bool ownColormap)
static QColormap **cmaps = 0;
-/*! \internal
-*/
void QColormap::initialize()
{
Display *display = QX11Info::display();
@@ -578,8 +576,6 @@ void QColormap::initialize()
}
}
-/*! \internal
-*/
void QColormap::cleanup()
{
Display *display = QX11Info::display();
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp
index 262a033cf2..bd91dfcdb8 100644
--- a/src/gui/painting/qpainterpath.cpp
+++ b/src/gui/painting/qpainterpath.cpp
@@ -2751,7 +2751,7 @@ qreal QPainterPath::length() const
/*!
Returns percentage of the whole path at the specified length \a len.
- Note that similarly to other percent methods, the percentage measurment
+ Note that similarly to other percent methods, the percentage measurement
is not linear with regards to the length, if curves are present
in the path. When curves are present the percentage argument is mapped
to the t parameter of the Bezier equations.
@@ -2868,7 +2868,7 @@ static inline QBezier bezierAtT(const QPainterPath &path, qreal t, qreal *starti
Returns the point at at the percentage \a t of the current path.
The argument \a t has to be between 0 and 1.
- Note that similarly to other percent methods, the percentage measurment
+ Note that similarly to other percent methods, the percentage measurement
is not linear with regards to the length, if curves are present
in the path. When curves are present the percentage argument is mapped
to the t parameter of the Bezier equations.
@@ -2899,7 +2899,7 @@ QPointF QPainterPath::pointAtPercent(qreal t) const
Positive values for the angles mean counter-clockwise while negative values
mean the clockwise direction. Zero degrees is at the 3 o'clock position.
- Note that similarly to the other percent methods, the percentage measurment
+ Note that similarly to the other percent methods, the percentage measurement
is not linear with regards to the length if curves are present
in the path. When curves are present the percentage argument is mapped
to the t parameter of the Bezier equations.
@@ -2931,7 +2931,7 @@ qreal QPainterPath::angleAtPercent(qreal t) const
Returns the slope of the path at the percentage \a t. The
argument \a t has to be between 0 and 1.
- Note that similarly to other percent methods, the percentage measurment
+ Note that similarly to other percent methods, the percentage measurement
is not linear with regards to the length, if curves are present
in the path. When curves are present the percentage argument is mapped
to the t parameter of the Bezier equations.
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp
index 3fd1ffb66e..89df869142 100644
--- a/src/gui/painting/qtextureglyphcache.cpp
+++ b/src/gui/painting/qtextureglyphcache.cpp
@@ -92,8 +92,8 @@ void QTextureGlyphCache::populate(const QTextItemInt &ti,
int glyph_height = metrics.height.ceil().toInt();
if (glyph_height == 0 || glyph_width == 0)
continue;
- glyph_width += margin * 2 + 2;
- glyph_height += margin * 2 + 2;
+ glyph_width += margin * 2 + 4;
+ glyph_height += margin * 2 + 4;
// align to 8-bit boundary
if (m_type == QFontEngineGlyphCache::Raster_Mono)
glyph_width = (glyph_width+7)&~7;
@@ -189,7 +189,11 @@ void QImageTextureGlyphCache::createTextureData(int width, int height)
int QImageTextureGlyphCache::glyphMargin() const
{
+#ifdef Q_WS_MAC
return 2;
+#else
+ return m_type == QFontEngineGlyphCache::Raster_RGBMask ? 2 : 0;
+#endif
}
void QImageTextureGlyphCache::fillTexture(const Coord &c, glyph_t g)
diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp
index 86653df8da..0e54af8dd7 100644
--- a/src/gui/styles/qgtkstyle.cpp
+++ b/src/gui/styles/qgtkstyle.cpp
@@ -940,10 +940,6 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element,
case PE_FrameLineEdit: {
GtkWidget *gtkEntry = QGtk::gtkWidget(QLS("GtkEntry"));
- if (option->state & State_HasFocus)
- GTK_WIDGET_SET_FLAGS(gtkEntry, GTK_HAS_FOCUS);
- else
- GTK_WIDGET_UNSET_FLAGS(gtkEntry, GTK_HAS_FOCUS);
gboolean interior_focus;
gint focus_line_width;
@@ -957,6 +953,9 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element,
if (!interior_focus && option->state & State_HasFocus)
rect.adjust(focus_line_width, focus_line_width, -focus_line_width, -focus_line_width);
+
+ if (option->state & State_HasFocus)
+ GTK_WIDGET_SET_FLAGS(gtkEntry, GTK_HAS_FOCUS);
gtkPainter.paintShadow(gtkEntry, "entry", rect, option->state & State_Enabled ?
GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE,
GTK_SHADOW_IN, gtkEntry->style,
@@ -965,6 +964,9 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element,
gtkPainter.paintShadow(gtkEntry, "entry", option->rect, option->state & State_Enabled ?
GTK_STATE_ACTIVE : GTK_STATE_INSENSITIVE,
GTK_SHADOW_IN, gtkEntry->style, QLS("GtkEntryShadowIn"));
+
+ if (option->state & State_HasFocus)
+ GTK_WIDGET_UNSET_FLAGS(gtkEntry, GTK_HAS_FOCUS);
}
break;
@@ -1050,17 +1052,13 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element,
GTK_WIDGET_SET_FLAGS(gtkButton, GTK_HAS_DEFAULT);
gtkPainter.paintBox(gtkButton, "buttondefault", buttonRect, state, GTK_SHADOW_IN,
style, isDefault ? QLS("d") : QString());
- } else
- GTK_WIDGET_UNSET_FLAGS(gtkButton, GTK_HAS_DEFAULT);
+ }
bool hasFocus = option->state & State_HasFocus;
if (hasFocus) {
key += QLS("def");
GTK_WIDGET_SET_FLAGS(gtkButton, GTK_HAS_FOCUS);
-
- } else {
- GTK_WIDGET_UNSET_FLAGS(gtkButton, GTK_HAS_FOCUS);
}
if (!interiorFocus)
@@ -1071,6 +1069,10 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element,
gtkPainter.paintBox(gtkButton, "button", buttonRect, state, shadow,
style, key);
+ if (isDefault)
+ GTK_WIDGET_UNSET_FLAGS(gtkButton, GTK_HAS_DEFAULT);
+ if (hasFocus)
+ GTK_WIDGET_UNSET_FLAGS(gtkButton, GTK_HAS_FOCUS);
}
break;
@@ -1334,6 +1336,8 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
GtkWidget *gtkToggleButton = QGtk::gtkWidget(buttonPath);
QGtk::gtk_widget_set_direction(gtkToggleButton, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
if (gtkToggleButton && (appears_as_list || comboBox->editable)) {
+ if (focus)
+ GTK_WIDGET_SET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS);
// Draw the combo box as a line edit with a button next to it
if (comboBox->editable || appears_as_list) {
GtkStateType frameState = (state == GTK_STATE_PRELIGHT) ? GTK_STATE_NORMAL : state;
@@ -1347,22 +1351,16 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
else
frameRect.setRight(arrowButtonRect.left());
- // Required for inner blue highlight with clearlooks
- if (focus) {
- GTK_WIDGET_SET_FLAGS(gtkEntry, GTK_HAS_FOCUS);
- GTK_WIDGET_SET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS);
-
- } else {
- GTK_WIDGET_UNSET_FLAGS(gtkEntry, GTK_HAS_FOCUS);
- GTK_WIDGET_UNSET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS);
- }
-
// Fill the line edit background
// We could have used flat_box with "entry_bg" but that is probably not worth the overhead
uint resolve_mask = option->palette.resolve();
int xt = gtkEntry->style->xthickness;
int yt = gtkEntry->style->ythickness;
QRect contentRect = frameRect.adjusted(xt, yt, -xt, -yt);
+ // Required for inner blue highlight with clearlooks
+ if (focus)
+ GTK_WIDGET_SET_FLAGS(gtkEntry, GTK_HAS_FOCUS);
+
if (widget && widget->testAttribute(Qt::WA_SetPalette) &&
resolve_mask & (1 << QPalette::Base)) // Palette overridden by user
p->fillRect(contentRect, option->palette.base().color());
@@ -1376,6 +1374,8 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
GTK_SHADOW_IN, gtkEntry->style, entryPath +
QString::number(focus) + QString::number(comboBox->editable) +
QString::number(option->direction));
+ if (focus)
+ GTK_WIDGET_UNSET_FLAGS(gtkEntry, GTK_HAS_FOCUS);
}
GtkStateType buttonState = GTK_STATE_NORMAL;
@@ -1394,22 +1394,21 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
gtkCachedPainter.paintBox( gtkToggleButton, "button", arrowButtonRect, buttonState,
shadow, gtkToggleButton->style, buttonPath +
QString::number(focus) + QString::number(option->direction));
-
+ if (focus)
+ GTK_WIDGET_UNSET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS);
} else {
// Draw combo box as a button
QRect buttonRect = option->rect;
- if (focus) { // Clearlooks actually check the widget for the default state
+ if (focus) // Clearlooks actually check the widget for the default state
GTK_WIDGET_SET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS);
-
- } else {
- GTK_WIDGET_UNSET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS);
- }
-
gtkCachedPainter.paintBox(gtkToggleButton, "button",
buttonRect, state,
shadow, gtkToggleButton->style,
buttonPath + QString::number(focus));
+ if (focus)
+ GTK_WIDGET_UNSET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS);
+
// Draw the separator between label and arrows
QString vSeparatorPath = buttonPath + QLS(".GtkHBox.GtkVSeparator");
@@ -1775,15 +1774,12 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
shadow = GTK_SHADOW_IN;
style = gtkPainter.getStyle(gtkSpinButton);
- if (option->state & State_HasFocus)
- GTK_WIDGET_SET_FLAGS(gtkSpinButton, GTK_HAS_FOCUS);
- else
- GTK_WIDGET_UNSET_FLAGS(gtkSpinButton, GTK_HAS_FOCUS);
QString key;
-
- if (option->state & State_HasFocus)
+ if (option->state & State_HasFocus) {
key = QLS("f");
+ GTK_WIDGET_SET_FLAGS(gtkSpinButton, GTK_HAS_FOCUS);
+ }
uint resolve_mask = option->palette.resolve();
@@ -1816,6 +1812,9 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
gtkPainter.paintBox( gtkSpinButton, "spinbutton_down", downRect, GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, style, key);
else
gtkPainter.paintBox( gtkSpinButton, "spinbutton_down", downRect, GTK_STATE_NORMAL, GTK_SHADOW_OUT, style, key);
+
+ if (option->state & State_HasFocus)
+ GTK_WIDGET_UNSET_FLAGS(gtkSpinButton, GTK_HAS_FOCUS);
}
if (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus) {
@@ -2344,7 +2343,7 @@ void QGtkStyle::drawControl(ControlElement element,
case CE_SizeGrip: {
GtkWidget *gtkStatusbar = QGtk::gtkWidget(QLS("GtkStatusbar.GtkFrame"));
QRect gripRect = option->rect.adjusted(0, 0, -gtkStatusbar->style->xthickness, -gtkStatusbar->style->ythickness);
- gtkPainter.paintResizeGrip( gtkStatusbar, "window", gripRect, GTK_STATE_NORMAL,
+ gtkPainter.paintResizeGrip( gtkStatusbar, "statusbar", gripRect, GTK_STATE_NORMAL,
GTK_SHADOW_OUT, QApplication::isRightToLeft() ?
GDK_WINDOW_EDGE_SOUTH_WEST : GDK_WINDOW_EDGE_SOUTH_EAST,
gtkStatusbar->style);
diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp
index 1231561ffc..1d6dc8a6e6 100644
--- a/src/gui/styles/qstylesheetstyle.cpp
+++ b/src/gui/styles/qstylesheetstyle.cpp
@@ -5082,9 +5082,12 @@ int QStyleSheetStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWi
#ifndef QT_NO_COMBOBOX
if (qobject_cast<const QComboBox *>(w)) {
QAbstractItemView *view = qFindChild<QAbstractItemView *>(w);
- QRenderRule subRule = renderRule(view, PseudoElement_None);
- if (subRule.hasBox() || !subRule.hasNativeBorder())
- return QFrame::NoFrame;
+ if (view) {
+ view->ensurePolished();
+ QRenderRule subRule = renderRule(view, PseudoElement_None);
+ if (subRule.hasBox() || !subRule.hasNativeBorder())
+ return QFrame::NoFrame;
+ }
}
#endif // QT_NO_COMBOBOX
break;
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index f73ffb5dd6..c5096bf15c 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -1897,6 +1897,20 @@ void QFont::insertSubstitutions(const QString &familyName,
}
}
+/*! \fn void QFont::initialize()
+ \internal
+
+ Internal function that initializes the font system. The font cache
+ and font dict do not alloc the keys. The key is a QString which is
+ shared between QFontPrivate and QXFontName.
+*/
+
+/*! \fn void QFont::cleanup()
+ \internal
+
+ Internal function that cleans up the font system.
+*/
+
// ### mark: should be called removeSubstitutions()
/*!
Removes all the substitutions for \a familyName.
diff --git a/src/gui/text/qfont_x11.cpp b/src/gui/text/qfont_x11.cpp
index 710792c9de..6b0e46cfc3 100644
--- a/src/gui/text/qfont_x11.cpp
+++ b/src/gui/text/qfont_x11.cpp
@@ -129,13 +129,6 @@ Q_GUI_EXPORT void qt_x11_set_fallback_font_family(int script, const QString &fam
int QFontPrivate::defaultEncodingID = -1;
-/*!
- Internal function that initializes the font system.
-
- \internal
- The font cache and font dict do not alloc the keys. The key is a QString
- which is shared between QFontPrivate and QXFontName.
-*/
void QFont::initialize()
{
extern int qt_encoding_id_for_mib(int mib); // from qfontdatabase_x11.cpp
@@ -184,10 +177,6 @@ void QFont::initialize()
QFontPrivate::defaultEncodingID = qt_encoding_id_for_mib(mib);
}
-/*! \internal
-
- Internal function that cleans up the font system.
-*/
void QFont::cleanup()
{
QFontCache::cleanup();
diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp
index feea1f26bd..002e670bdc 100644
--- a/src/gui/text/qfontengine_win.cpp
+++ b/src/gui/text/qfontengine_win.cpp
@@ -1406,8 +1406,8 @@ QNativeImage *QFontEngineWin::drawGDIGlyph(HFONT font, glyph_t glyph, int margin
#endif
#endif
- QNativeImage *ni = new QNativeImage(iw + 2 * margin + 2,
- ih + 2 * margin + 2,
+ QNativeImage *ni = new QNativeImage(iw + 2 * margin + 4,
+ ih + 2 * margin + 4,
QNativeImage::systemFormat(), true);
ni->image.fill(0xffffffff);
@@ -1449,7 +1449,7 @@ QImage QFontEngineWin::alphaMapForGlyph(glyph_t glyph, const QTransform &xform)
font = CreateFontIndirectW(&lf);
}
- QNativeImage *mask = drawGDIGlyph(font, glyph, 2, xform);
+ QNativeImage *mask = drawGDIGlyph(font, glyph, 0, xform);
if (mask == 0)
return QImage();
diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp
index 88d0610f86..87da6283cb 100644
--- a/src/gui/text/qfontmetrics.cpp
+++ b/src/gui/text/qfontmetrics.cpp
@@ -670,8 +670,8 @@ QRect QFontMetrics::boundingRect(const QString &text) const
Returns the rectangle that is covered by ink if character \a ch
were to be drawn at the origin of the coordinate system.
- Note that the bounding rectangle may extend to the left of (0, 0),
- e.g. for italicized fonts, and that the text output may cover \e
+ Note that the bounding rectangle may extend to the left of (0, 0)
+ (e.g., for italicized fonts), and that the text output may cover \e
all pixels in the bounding rectangle. For a space character the rectangle
will usually be empty.
@@ -724,7 +724,7 @@ QRect QFontMetrics::boundingRect(QChar ch) const
\o Qt::AlignCenter (== \c{Qt::AlignHCenter | Qt::AlignVCenter})
\o Qt::TextSingleLine ignores newline characters in the text.
\o Qt::TextExpandTabs expands tabs (see below)
- \o Qt::TextShowMnemonic interprets "&amp;x" as \underline{x}, i.e. underlined.
+ \o Qt::TextShowMnemonic interprets "&x" as \underline{x}; i.e., underlined.
\o Qt::TextWordWrap breaks the text to fit the rectangle.
\endlist
@@ -781,7 +781,7 @@ QRect QFontMetrics::boundingRect(const QRect &rect, int flags, const QString &te
\list
\o Qt::TextSingleLine ignores newline characters.
\o Qt::TextExpandTabs expands tabs (see below)
- \o Qt::TextShowMnemonic interprets "&amp;x" as \underline{x}, i.e. underlined.
+ \o Qt::TextShowMnemonic interprets "&x" as \underline{x}; i.e., underlined.
\o Qt::TextWordBreak breaks the text to fit the rectangle.
\endlist
@@ -1500,7 +1500,7 @@ QRectF QFontMetricsF::boundingRect(QChar ch) const
\o Qt::AlignCenter (== \c{Qt::AlignHCenter | Qt::AlignVCenter})
\o Qt::TextSingleLine ignores newline characters in the text.
\o Qt::TextExpandTabs expands tabs (see below)
- \o Qt::TextShowMnemonic interprets "&amp;x" as \underline{x}, i.e. underlined.
+ \o Qt::TextShowMnemonic interprets "&x" as \underline{x}; i.e., underlined.
\o Qt::TextWordWrap breaks the text to fit the rectangle.
\endlist
@@ -1559,7 +1559,7 @@ QRectF QFontMetricsF::boundingRect(const QRectF &rect, int flags, const QString&
\list
\o Qt::TextSingleLine ignores newline characters.
\o Qt::TextExpandTabs expands tabs (see below)
- \o Qt::TextShowMnemonic interprets "&amp;x" as \underline{x}, i.e. underlined.
+ \o Qt::TextShowMnemonic interprets "&x" as \underline{x}; i.e., underlined.
\o Qt::TextWordBreak breaks the text to fit the rectangle.
\endlist
diff --git a/src/gui/widgets/qtabbar.cpp b/src/gui/widgets/qtabbar.cpp
index 0b4ce9d0ac..bd8a1b0e64 100644
--- a/src/gui/widgets/qtabbar.cpp
+++ b/src/gui/widgets/qtabbar.cpp
@@ -1535,9 +1535,10 @@ void QTabBar::paintEvent(QPaintEvent *)
}
if (!d->dragInProgress)
p.drawControl(QStyle::CE_TabBarTab, tab);
- else
- d->movingTab->setGeometry(tab.rect);
-
+ else {
+ int taboverlap = style()->pixelMetric(QStyle::PM_TabBarTabOverlap, 0, this);
+ d->movingTab->setGeometry(tab.rect.adjusted(-taboverlap, 0, taboverlap, 0));
+ }
}
// Only draw the tear indicator if necessary. Most of the time we don't need too.
@@ -1804,7 +1805,9 @@ void QTabBarPrivate::setupMovableTab()
if (!movingTab)
movingTab = new QWidget(q);
+ int taboverlap = q->style()->pixelMetric(QStyle::PM_TabBarTabOverlap, 0 ,q);
QRect grabRect = q->tabRect(pressedIndex);
+ grabRect.adjust(-taboverlap, 0, taboverlap, 0);
QPixmap grabImage(grabRect.size());
grabImage.fill(Qt::transparent);
@@ -1812,7 +1815,7 @@ void QTabBarPrivate::setupMovableTab()
QStyleOptionTabV3 tab;
q->initStyleOption(&tab, pressedIndex);
- tab.rect.moveTopLeft(QPoint(0, 0));
+ tab.rect.moveTopLeft(QPoint(taboverlap, 0));
p.drawControl(QStyle::CE_TabBarTab, tab);
p.end();