summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/src/classes/qnamespace.qdoc5
-rw-r--r--doc/src/examples/googlechat.qdoc1
-rw-r--r--doc/src/examples/googlesuggest.qdoc1
-rw-r--r--doc/src/images/cursor-hsplit.pngbin161 -> 155 bytes
-rw-r--r--doc/src/images/cursor-vsplit.pngbin155 -> 161 bytes
-rw-r--r--examples/phonon/musicplayer/mainwindow.cpp5
-rw-r--r--src/corelib/global/qglobal.cpp4
-rw-r--r--src/gui/dialogs/qcolordialog.cpp22
-rw-r--r--src/gui/dialogs/qcolordialog_mac.mm221
-rw-r--r--src/gui/dialogs/qcolordialog_p.h13
-rw-r--r--src/gui/dialogs/qfilesystemmodel.cpp1
-rw-r--r--src/gui/kernel/qapplication_mac.mm49
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm4
-rw-r--r--src/gui/kernel/qcursor.cpp4
-rw-r--r--src/gui/kernel/qwidget.cpp4
-rw-r--r--src/gui/kernel/qwidget_mac.mm52
-rw-r--r--src/gui/kernel/qwidget_win.cpp5
-rw-r--r--src/gui/painting/qblendfunctions.cpp8
-rw-r--r--src/gui/painting/qwindowsurface_raster.cpp4
-rw-r--r--src/gui/text/qfontengine_mac.mm9
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp7
-rw-r--r--src/network/access/qnetworkreply.cpp9
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp29
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp13
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h21
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp288
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp13
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h3
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp21
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.h3
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp20
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h7
-rw-r--r--src/sql/drivers/mysql/qsql_mysql.cpp6
-rw-r--r--tests/arthur/data/qps/pixmap_scaling.qps346
-rw-r--r--tests/auto/moc/os9-newlines.h2
-rw-r--r--tests/auto/q3socket/tst_qsocket.cpp14
-rw-r--r--tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp6
-rw-r--r--tests/auto/q3urloperator/tst_q3urloperator.cpp12
-rw-r--r--tests/auto/qlocale/tst_qlocale.cpp16
-rw-r--r--tests/auto/qmake/testdata/simple_app_build/README1
-rw-r--r--tests/auto/qsharedpointer/tst_qsharedpointer.cpp2
-rw-r--r--tests/auto/qsqldatabase/tst_qsqldatabase.cpp4
-rw-r--r--tests/auto/selftests/tst_selftests.cpp7
-rw-r--r--tests/auto/uic3/uic3.pro3
-rw-r--r--tools/assistant/tools/assistant/centralwidget.cpp6
45 files changed, 867 insertions, 404 deletions
diff --git a/doc/src/classes/qnamespace.qdoc b/doc/src/classes/qnamespace.qdoc
index 2d40fdd..59e0a95 100644
--- a/doc/src/classes/qnamespace.qdoc
+++ b/doc/src/classes/qnamespace.qdoc
@@ -1884,7 +1884,10 @@
We refer to a top-level window that has a parent
as a \e secondary window.
- \value Sheet Indicates that the widget is a Macintosh sheet.
+ \value Sheet Indicates that the window is a Macintosh sheet. Since
+ using a sheet implies window modality, the recommended
+ way is to use QWidget::setWindowModality(), or
+ QDialog::open(), instead.
\value Drawer Indicates that the widget is a Macintosh drawer.
diff --git a/doc/src/examples/googlechat.qdoc b/doc/src/examples/googlechat.qdoc
index 42a0198..7c9d7db 100644
--- a/doc/src/examples/googlechat.qdoc
+++ b/doc/src/examples/googlechat.qdoc
@@ -48,4 +48,5 @@
\image googlechat-example.png
+ \note The Google Talk instant messaging service is a registered trademark of Google Inc.
*/
diff --git a/doc/src/examples/googlesuggest.qdoc b/doc/src/examples/googlesuggest.qdoc
index 1752420..e3d2b1f 100644
--- a/doc/src/examples/googlesuggest.qdoc
+++ b/doc/src/examples/googlesuggest.qdoc
@@ -48,4 +48,5 @@
\image googlesuggest-example.png
+ \note The Google Suggest suggestion service is a registered trademark of Google Inc.
*/
diff --git a/doc/src/images/cursor-hsplit.png b/doc/src/images/cursor-hsplit.png
index 1beda25..a5667e3 100644
--- a/doc/src/images/cursor-hsplit.png
+++ b/doc/src/images/cursor-hsplit.png
Binary files differ
diff --git a/doc/src/images/cursor-vsplit.png b/doc/src/images/cursor-vsplit.png
index a5667e3..1beda25 100644
--- a/doc/src/images/cursor-vsplit.png
+++ b/doc/src/images/cursor-vsplit.png
Binary files differ
diff --git a/examples/phonon/musicplayer/mainwindow.cpp b/examples/phonon/musicplayer/mainwindow.cpp
index af2b637..a587b07 100644
--- a/examples/phonon/musicplayer/mainwindow.cpp
+++ b/examples/phonon/musicplayer/mainwindow.cpp
@@ -157,9 +157,12 @@ void MainWindow::tableClicked(int row, int /* column */)
mediaObject->stop();
mediaObject->clearQueue();
+ if (row >= sources.size())
+ return;
+
mediaObject->setCurrentSource(sources[row]);
- if (wasPlaying)
+ if (wasPlaying)
mediaObject->play();
else
mediaObject->stop();
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 776a740..63941ef 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -1083,7 +1083,7 @@ bool qSharedBuild()
\value WV_XP Windows XP (operating system version 5.1)
\value WV_2003 Windows Server 2003, Windows Server 2003 R2, Windows Home Server, Windows XP Professional x64 Edition (operating system version 5.2)
\value WV_VISTA Windows Vista, Windows Server 2008 (operating system version 6.0)
- \value WV_WINDOWS7 Windows 7 (operating system version 6.1)
+ \value WV_WINDOWS7 Windows 7, Windows Server 2008 R2 (operating system version 6.1)
Alternatively, you may use the following macros which correspond directly to the Windows operating system version number:
@@ -1092,7 +1092,7 @@ bool qSharedBuild()
\value WV_5_1 Operating system version 5.1, corresponds to Windows XP
\value WV_5_2 Operating system version 5.2, corresponds to Windows Server 2003, Windows Server 2003 R2, Windows Home Server, and Windows XP Professional x64 Edition
\value WV_6_0 Operating system version 6.0, corresponds to Windows Vista and Windows Server 2008
- \value WV_6_1 Operating system version 6.1, corresponds to Windows 7
+ \value WV_6_1 Operating system version 6.1, corresponds to Windows 7 and Windows Server 2008 R2
CE-based versions:
diff --git a/src/gui/dialogs/qcolordialog.cpp b/src/gui/dialogs/qcolordialog.cpp
index 42d3a9a..aee592c 100644
--- a/src/gui/dialogs/qcolordialog.cpp
+++ b/src/gui/dialogs/qcolordialog.cpp
@@ -1583,8 +1583,7 @@ void QColorDialog::setCurrentColor(const QColor &color)
#ifdef Q_WS_MAC
d->setCurrentQColor(color);
- if (d->delegate)
- QColorDialogPrivate::setColor(d->delegate, color);
+ d->setCocoaPanelColor(color);
#endif
}
@@ -1725,19 +1724,16 @@ void QColorDialog::setVisible(bool visible)
#if defined(Q_WS_MAC)
if (visible) {
- if (!d->delegate && QColorDialogPrivate::sharedColorPanelAvailable &&
- !(testAttribute(Qt::WA_DontShowOnScreen) || (d->opts & DontUseNativeDialog))){
- d->delegate = QColorDialogPrivate::openCocoaColorPanel(
- currentColor(), parentWidget(), windowTitle(), options(), d);
+ if (d->delegate || (QColorDialogPrivate::sharedColorPanelAvailable &&
+ !(testAttribute(Qt::WA_DontShowOnScreen) || (d->opts & DontUseNativeDialog)))){
+ d->openCocoaColorPanel(currentColor(), parentWidget(), windowTitle(), options());
QColorDialogPrivate::sharedColorPanelAvailable = false;
setAttribute(Qt::WA_DontShowOnScreen);
}
setWindowFlags(windowModality() == Qt::WindowModal ? Qt::Sheet : DefaultWindowFlags);
} else {
if (d->delegate) {
- QColorDialogPrivate::closeCocoaColorPanel(d->delegate);
- d->delegate = 0;
- QColorDialogPrivate::sharedColorPanelAvailable = true;
+ d->closeCocoaColorPanel();
setAttribute(Qt::WA_DontShowOnScreen, false);
}
}
@@ -1840,6 +1836,14 @@ QRgb QColorDialog::getRgba(QRgb initial, bool *ok, QWidget *parent)
QColorDialog::~QColorDialog()
{
+ Q_D(QColorDialog);
+#if defined(Q_WS_MAC)
+ if (d->delegate) {
+ d->releaseCocoaColorPanelDelegate();
+ QColorDialogPrivate::sharedColorPanelAvailable = true;
+ }
+#endif
+
#ifndef QT_NO_SETTINGS
if (!customSet) {
QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
diff --git a/src/gui/dialogs/qcolordialog_mac.mm b/src/gui/dialogs/qcolordialog_mac.mm
index 1936de5..6cdb7ee 100644
--- a/src/gui/dialogs/qcolordialog_mac.mm
+++ b/src/gui/dialogs/qcolordialog_mac.mm
@@ -76,6 +76,8 @@ QT_USE_NAMESPACE
CGFloat mMinWidth; // currently unused
CGFloat mExtraHeight; // currently unused
BOOL mHackedPanel;
+ NSInteger mResultCode;
+ BOOL mDialogIsExecuting;
}
- (id)initWithColorPanel:(NSColorPanel *)panel
stolenContentView:(NSView *)stolenContentView
@@ -90,7 +92,8 @@ QT_USE_NAMESPACE
- (NSColorPanel *)colorPanel;
- (QColor)qtColor;
- (void)finishOffWithCode:(NSInteger)result;
-- (void)cleanUpAfterMyself;
+- (void)showColorPanel;
+- (void)exec;
@end
@implementation QCocoaColorPanelDelegate
@@ -110,6 +113,8 @@ QT_USE_NAMESPACE
mMinWidth = 0.0;
mExtraHeight = 0.0;
mHackedPanel = (okButton != 0);
+ mResultCode = NSCancelButton;
+ mDialogIsExecuting = false;
if (mHackedPanel) {
[self relayout];
@@ -121,19 +126,31 @@ QT_USE_NAMESPACE
[cancelButton setTarget:self];
}
- if (mPriv)
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(colorChanged:)
- name:NSColorPanelColorDidChangeNotification
- object:mColorPanel];
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(colorChanged:)
+ name:NSColorPanelColorDidChangeNotification
+ object:mColorPanel];
+
mQtColor = new QColor();
return self;
}
- (void)dealloc
{
- if (mPriv)
- [[NSNotificationCenter defaultCenter] removeObserver:self];
+ QMacCocoaAutoReleasePool pool;
+ if (mHackedPanel) {
+ NSView *ourContentView = [mColorPanel contentView];
+
+ // return stolen stuff to its rightful owner
+ [mStolenContentView removeFromSuperview];
+ [mColorPanel setContentView:mStolenContentView];
+
+ [mOkButton release];
+ [mCancelButton release];
+ [ourContentView release];
+ }
+ [mColorPanel setDelegate:nil];
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
delete mQtColor;
[super dealloc];
}
@@ -160,8 +177,7 @@ QT_USE_NAMESPACE
- (void)colorChanged:(NSNotification *)notification;
{
Q_UNUSED(notification);
- if (mPriv)
- [self updateQtColor];
+ [self updateQtColor];
}
- (void)relayout
@@ -258,8 +274,7 @@ QT_USE_NAMESPACE
}
}
- if (mPriv)
- mPriv->setCurrentQColor(*mQtColor);
+ mPriv->setCurrentQColor(*mQtColor);
}
- (NSColorPanel *)colorPanel
@@ -274,36 +289,42 @@ QT_USE_NAMESPACE
- (void)finishOffWithCode:(NSInteger)code
{
- if (mPriv) {
- // Finish the QColorDialog as well. But since a call to accept or reject will
- // close down the QEventLoop found in QDialog, we need to make sure that the
- // current thread has exited the native dialogs modal session/run loop first.
- // We ensure this by posting the call:
+ mResultCode = code;
+ if (mDialogIsExecuting) {
+ // We stop the current modal event loop. The control
+ // will then return inside -(void)exec below.
+ // It's important that the modal event loop is stopped before
+ // we accept/reject QColorDialog, since QColorDialog has its
+ // own event loop that needs to be stopped last.
[NSApp stopModalWithCode:code];
- if (code == NSOKButton)
- QMetaObject::invokeMethod(mPriv->colorDialog(), "accept", Qt::QueuedConnection);
- else
- QMetaObject::invokeMethod(mPriv->colorDialog(), "reject", Qt::QueuedConnection);
} else {
- [NSApp stopModalWithCode:code];
+ // Since we are not in a modal event loop, we can safely close
+ // down QColorDialog
+ if (mResultCode == NSCancelButton)
+ mPriv->colorDialog()->reject();
+ else
+ mPriv->colorDialog()->accept();
}
}
-- (void)cleanUpAfterMyself
+- (void)showColorPanel
{
- if (mHackedPanel) {
- NSView *ourContentView = [mColorPanel contentView];
-
- // return stolen stuff to its rightful owner
- [mStolenContentView removeFromSuperview];
- [mColorPanel setContentView:mStolenContentView];
+ mDialogIsExecuting = false;
+ [mColorPanel makeKeyAndOrderFront:mColorPanel];
+}
- [mOkButton release];
- [mCancelButton release];
- [ourContentView release];
- }
- [mColorPanel setDelegate:nil];
+- (void)exec
+{
+ QBoolBlocker nativeDialogOnTop(QApplicationPrivate::native_modal_dialog_active);
+ QMacCocoaAutoReleasePool pool;
+ mDialogIsExecuting = true;
+ [NSApp runModalForWindow:mColorPanel];
+ if (mResultCode == NSCancelButton)
+ mPriv->colorDialog()->reject();
+ else
+ mPriv->colorDialog()->accept();
}
+
@end
QT_BEGIN_NAMESPACE
@@ -312,91 +333,90 @@ extern void macStartInterceptNSPanelCtor();
extern void macStopInterceptNSPanelCtor();
extern NSButton *macCreateButton(const char *text, NSView *superview);
-void *QColorDialogPrivate::openCocoaColorPanel(const QColor &initial,
- QWidget *parent, const QString &title, QColorDialog::ColorDialogOptions options,
- QColorDialogPrivate *priv)
+void QColorDialogPrivate::openCocoaColorPanel(const QColor &initial,
+ QWidget *parent, const QString &title, QColorDialog::ColorDialogOptions options)
{
Q_UNUSED(parent); // we would use the parent if only NSColorPanel could be a sheet
QMacCocoaAutoReleasePool pool;
- /*
- The standard Cocoa color panel has no OK or Cancel button and
- is created as a utility window, whereas we want something like
- the Carbon color panel. We need to take the following steps:
+ if (!delegate) {
+ /*
+ The standard Cocoa color panel has no OK or Cancel button and
+ is created as a utility window, whereas we want something like
+ the Carbon color panel. We need to take the following steps:
+
+ 1. Intercept the color panel constructor to turn off the
+ NSUtilityWindowMask flag. This is done by temporarily
+ replacing initWithContentRect:styleMask:backing:defer:
+ in NSPanel by our own method.
- 1. Intercept the color panel constructor to turn off the
- NSUtilityWindowMask flag. This is done by temporarily
- replacing initWithContentRect:styleMask:backing:defer:
- in NSPanel by our own method.
+ 2. Modify the color panel so that its content view is part
+ of a new content view that contains it as well as two
+ buttons (OK and Cancel).
- 2. Modify the color panel so that its content view is part
- of a new content view that contains it as well as two
- buttons (OK and Cancel).
+ 3. Lay out the original content view and the buttons when
+ the color panel is shown and whenever it is resized.
- 3. Lay out the original content view and the buttons when
- the color panel is shown and whenever it is resized.
+ 4. Clean up after ourselves.
+ */
- 4. Clean up after ourselves.
- */
+ bool hackColorPanel = !(options & QColorDialog::NoButtons);
- bool hackColorPanel = !(options & QColorDialog::NoButtons);
+ if (hackColorPanel)
+ macStartInterceptNSPanelCtor();
+ NSColorPanel *colorPanel = [NSColorPanel sharedColorPanel];
+ if (hackColorPanel)
+ macStopInterceptNSPanelCtor();
- if (hackColorPanel)
- macStartInterceptNSPanelCtor();
- NSColorPanel *colorPanel = [NSColorPanel sharedColorPanel];
- if (hackColorPanel)
- macStopInterceptNSPanelCtor();
+ [colorPanel setHidesOnDeactivate:false];
- [colorPanel setHidesOnDeactivate:false];
+ // set up the Cocoa color panel
+ [colorPanel setShowsAlpha:options & QColorDialog::ShowAlphaChannel];
+ [colorPanel setTitle:(NSString*)(CFStringRef)QCFString(title)];
- // set up the Cocoa color panel
- [colorPanel setShowsAlpha:options & QColorDialog::ShowAlphaChannel];
- [colorPanel setTitle:(NSString*)(CFStringRef)QCFString(title)];
+ NSView *stolenContentView = 0;
+ NSButton *okButton = 0;
+ NSButton *cancelButton = 0;
- NSView *stolenContentView = 0;
- NSButton *okButton = 0;
- NSButton *cancelButton = 0;
+ if (hackColorPanel) {
+ // steal the color panel's contents view
+ stolenContentView = [colorPanel contentView];
+ [stolenContentView retain];
+ [colorPanel setContentView:0];
- if (hackColorPanel) {
- // steal the color panel's contents view
- stolenContentView = [colorPanel contentView];
- [stolenContentView retain];
- [colorPanel setContentView:0];
+ // create a new content view and add the stolen one as a subview
+ NSRect frameRect = { { 0.0, 0.0 }, { 0.0, 0.0 } };
+ NSView *ourContentView = [[NSView alloc] initWithFrame:frameRect];
+ [ourContentView addSubview:stolenContentView];
- // create a new content view and add the stolen one as a subview
- NSRect frameRect = { { 0.0, 0.0 }, { 0.0, 0.0 } };
- NSView *ourContentView = [[NSView alloc] initWithFrame:frameRect];
- [ourContentView addSubview:stolenContentView];
+ // create OK and Cancel buttons and add these as subviews
+ okButton = macCreateButton("&OK", ourContentView);
+ cancelButton = macCreateButton("Cancel", ourContentView);
- // create OK and Cancel buttons and add these as subviews
- okButton = macCreateButton("&OK", ourContentView);
- cancelButton = macCreateButton("Cancel", ourContentView);
+ [colorPanel setContentView:ourContentView];
+ [colorPanel setDefaultButtonCell:[okButton cell]];
+ }
- [colorPanel setContentView:ourContentView];
- [colorPanel setDefaultButtonCell:[okButton cell]];
+ delegate = [[QCocoaColorPanelDelegate alloc] initWithColorPanel:colorPanel
+ stolenContentView:stolenContentView
+ okButton:okButton
+ cancelButton:cancelButton
+ priv:this];
+ [colorPanel setDelegate:static_cast<QCocoaColorPanelDelegate *>(delegate)];
}
- // create a delegate and set it
- QCocoaColorPanelDelegate *delegate =
- [[QCocoaColorPanelDelegate alloc] initWithColorPanel:colorPanel
- stolenContentView:stolenContentView
- okButton:okButton
- cancelButton:cancelButton
- priv:priv];
- [colorPanel setDelegate:delegate];
- setColor(delegate, initial);
- [colorPanel makeKeyAndOrderFront:colorPanel];
-
- return delegate;
+ setCocoaPanelColor(initial);
+ [static_cast<QCocoaColorPanelDelegate *>(delegate) showColorPanel];
}
-void QColorDialogPrivate::closeCocoaColorPanel(void *delegate)
+void QColorDialogPrivate::closeCocoaColorPanel()
{
- QMacCocoaAutoReleasePool pool;
- QCocoaColorPanelDelegate *theDelegate = static_cast<QCocoaColorPanelDelegate *>(delegate);
- [[theDelegate colorPanel] close];
- [theDelegate cleanUpAfterMyself];
- [theDelegate autorelease];
+ [[static_cast<QCocoaColorPanelDelegate *>(delegate) colorPanel] close];
+}
+
+void QColorDialogPrivate::releaseCocoaColorPanelDelegate()
+{
+ [static_cast<QCocoaColorPanelDelegate *>(delegate) release];
}
void QColorDialogPrivate::mac_nativeDialogModalHelp()
@@ -416,13 +436,10 @@ void QColorDialogPrivate::mac_nativeDialogModalHelp()
void QColorDialogPrivate::_q_macRunNativeAppModalPanel()
{
- QBoolBlocker nativeDialogOnTop(QApplicationPrivate::native_modal_dialog_active);
- QMacCocoaAutoReleasePool pool;
- QCocoaColorPanelDelegate *delegateCasted = static_cast<QCocoaColorPanelDelegate *>(delegate);
- [NSApp runModalForWindow:[delegateCasted colorPanel]];
+ [static_cast<QCocoaColorPanelDelegate *>(delegate) exec];
}
-void QColorDialogPrivate::setColor(void *delegate, const QColor &color)
+void QColorDialogPrivate::setCocoaPanelColor(const QColor &color)
{
QMacCocoaAutoReleasePool pool;
QCocoaColorPanelDelegate *theDelegate = static_cast<QCocoaColorPanelDelegate *>(delegate);
diff --git a/src/gui/dialogs/qcolordialog_p.h b/src/gui/dialogs/qcolordialog_p.h
index ea66d4a..00d40b6 100644
--- a/src/gui/dialogs/qcolordialog_p.h
+++ b/src/gui/dialogs/qcolordialog_p.h
@@ -116,14 +116,11 @@ public:
QByteArray memberToDisconnectOnClose;
#ifdef Q_WS_MAC
- static void *openCocoaColorPanel(const QColor &initial,
- QWidget *parent, const QString &title,
- QColorDialog::ColorDialogOptions options,
- QColorDialogPrivate *priv = 0);
- static void closeCocoaColorPanel(void *delegate);
- static QColor execCocoaColorPanel(const QColor &initial, QWidget *parent,
- const QString &title, QColorDialog::ColorDialogOptions options);
- static void setColor(void *delegate, const QColor &color);
+ void openCocoaColorPanel(const QColor &initial,
+ QWidget *parent, const QString &title, QColorDialog::ColorDialogOptions options);
+ void closeCocoaColorPanel();
+ void releaseCocoaColorPanelDelegate();
+ void setCocoaPanelColor(const QColor &color);
inline void done(int result) { q_func()->done(result); }
inline QColorDialog *colorDialog() { return q_func(); }
diff --git a/src/gui/dialogs/qfilesystemmodel.cpp b/src/gui/dialogs/qfilesystemmodel.cpp
index 5a5d845..b8e12b4 100644
--- a/src/gui/dialogs/qfilesystemmodel.cpp
+++ b/src/gui/dialogs/qfilesystemmodel.cpp
@@ -872,6 +872,7 @@ QVariant QFileSystemModel::headerData(int section, Qt::Orientation orientation,
pixmap.setAlphaChannel(pixmap.createAlphaMask());
return pixmap;
}
+ break;
case Qt::TextAlignmentRole:
return Qt::AlignLeft;
}
diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm
index beccfb0..ac132aa 100644
--- a/src/gui/kernel/qapplication_mac.mm
+++ b/src/gui/kernel/qapplication_mac.mm
@@ -1480,6 +1480,7 @@ QWidget *QApplicationPrivate::tryModalHelper_sys(QWidget *top)
return top;
}
+#ifndef QT_MAC_USE_COCOA
static bool qt_try_modal(QWidget *widget, EventRef event)
{
QWidget * top = 0;
@@ -1513,6 +1514,7 @@ static bool qt_try_modal(QWidget *widget, EventRef event)
#endif
return !block_event;
}
+#endif
OSStatus QApplicationPrivate::tabletProximityCallback(EventHandlerCallRef, EventRef carbonEvent,
void *)
@@ -2890,52 +2892,25 @@ bool QApplicationPrivate::canQuit()
#endif
}
-void onApplicationWindowChangedActivation( QWidget*widget, bool activated )
+void onApplicationWindowChangedActivation(QWidget *widget, bool activated)
{
#if QT_MAC_USE_COCOA
- QApplication *app = qApp;
+ if (!widget)
+ return;
- if ( activated )
- {
- if (QApplicationPrivate::app_style)
- {
+ if (activated) {
+ if (QApplicationPrivate::app_style) {
QEvent ev(QEvent::Style);
qt_sendSpontaneousEvent(QApplicationPrivate::app_style, &ev);
}
-
- if (widget && app_do_modal && !qt_try_modal(widget, NULL))
- return;
-
- if (widget && widget->window()->isVisible())
- {
- QWidget *tlw = widget->window();
-
- if (tlw->isWindow() && !(tlw->windowType() == Qt::Popup)
- && !qt_mac_is_macdrawer(tlw)
- && (!tlw->parentWidget() || tlw->isModal() || !(tlw->windowType() == Qt::Tool))) {
- bool just_send_event = false;
-#if 0
- WindowActivationScope scope;
- if ( GetWindowActivationScope((OSWindowRef)wid, &scope) == noErr &&
- scope == kWindowActivationScopeIndependent)
- {
- if ( GetFrontWindowOfClass(kAllWindowClasses, true) != wid )
- just_send_event = true;
- }
-#endif
- if (just_send_event) {
- QEvent e(QEvent::WindowActivate);
- qt_sendSpontaneousEvent(widget, &e);
- } else {
- app->setActiveWindow(tlw);
- }
- }
- }
+ qApp->setActiveWindow(widget);
} else { // deactivated
- if (widget && QApplicationPrivate::active_window == widget)
- app->setActiveWindow(0);
+ if (QApplicationPrivate::active_window == widget)
+ qApp->setActiveWindow(0);
}
+
QMenuBar::macUpdateMenuBar();
+
#else
Q_UNUSED(widget);
Q_UNUSED(activated);
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index 57c9117..1d352cb 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -327,7 +327,7 @@ extern "C" {
return NSDragOperationNone;
} else {
// save the mouse position, used by draggingExited handler.
- DnDParams *dndParams = [QCocoaView currentMouseEvent];
+ DnDParams *dndParams = [QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent];
dndParams->activeDragEnterPos = windowPoint;
// send a drag move event immediately after a drag enter event (as per documentation).
QDragMoveEvent qDMEvent(posDrag, qtAllowed, mimeData, QApplication::mouseButtons(), modifiers);
@@ -406,7 +406,7 @@ extern "C" {
dragEnterSequence = -1;
if (qwidget->testAttribute(Qt::WA_TransparentForMouseEvents)) {
// try sending the leave event to the last view which accepted drag enter.
- DnDParams *dndParams = [QCocoaView currentMouseEvent];
+ DnDParams *dndParams = [QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent];
NSView *candidateView = [[[self window] contentView] hitTest:dndParams->activeDragEnterPos];
if (candidateView && candidateView != self)
return [candidateView draggingExited:sender];
diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp
index 9cca0d6..0b47b6f 100644
--- a/src/gui/kernel/qcursor.cpp
+++ b/src/gui/kernel/qcursor.cpp
@@ -127,11 +127,11 @@ QT_BEGIN_NAMESPACE
\o Qt::SizeAllCursor \o \c size_all
\row \o \inlineimage cursor-busy.png
\o Qt::BusyCursor \o \c left_ptr_watch
- \o \inlineimage cursor-hsplit.png
+ \o \inlineimage cursor-vsplit.png
\o Qt::SplitVCursor \o \c split_v
\row \o \inlineimage cursor-forbidden.png
\o Qt::ForbiddenCursor \o \c forbidden
- \o \inlineimage cursor-vsplit.png
+ \o \inlineimage cursor-hsplit.png
\o Qt::SplitHCursor \o \c split_h
\row \o \inlineimage cursor-hand.png
\o Qt::PointingHandCursor \o \c pointing_hand
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 6ee229a..43ac37d 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -9865,6 +9865,10 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
data->window_modality = (w && w->testAttribute(Qt::WA_GroupLeader))
? Qt::WindowModal
: Qt::ApplicationModal;
+ // Some window managers does not allow us to enter modal after the
+ // window is showing. Therefore, to be consistent, we cannot call
+ // QApplicationPrivate::enterModal(this) here. The window must be
+ // hidden before changing modality.
}
if (testAttribute(Qt::WA_WState_Created)) {
// don't call setModal_sys() before create_sys()
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 3bbf5d4..78df09d 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -4589,6 +4589,7 @@ void QWidgetPrivate::setModal_sys()
OSWindowRef windowRef = qt_mac_window_for(q);
#ifdef QT_MAC_USE_COCOA
+ QMacCocoaAutoReleasePool pool;
bool alreadySheet = [windowRef styleMask] & NSDocModalWindowMask;
if (windowParent && q->windowModality() == Qt::WindowModal){
@@ -4665,31 +4666,40 @@ void QWidgetPrivate::setModal_sys()
|| (primaryWindow && primaryWindow->windowModality() == Qt::WindowModal)){
// Window should be window-modal (which implies a sheet).
if (old_wclass != kSheetWindowClass){
- // We cannot convert a created window to a sheet. So we recreate the window:
+ // We cannot convert a created window to a sheet.
+ // So we recreate the window:
recreateMacWindow();
return;
}
- } else if (!(q->data->window_flags & Qt::CustomizeWindowHint)) {
- if (old_wclass == kDocumentWindowClass || old_wclass == kFloatingWindowClass || old_wclass == kUtilityWindowClass){
- // Only change the class to kMovableModalWindowClass if the no explicit jewels
- // are set (kMovableModalWindowClass can't contain them), and the current window class
- // can be converted to modal (according to carbon doc). Mind the order of
- // HIWindowChangeClass and ChangeWindowAttributes.
- WindowGroupRef group = GetWindowGroup(windowRef);
- HIWindowChangeClass(windowRef, kMovableModalWindowClass);
- quint32 tmpWattr = kWindowCloseBoxAttribute | kWindowHorizontalZoomAttribute;
- ChangeWindowAttributes(windowRef, tmpWattr, kWindowNoAttributes);
- ChangeWindowAttributes(windowRef, kWindowNoAttributes, tmpWattr);
- // If the window belongs to a qt-created group, set that group once more:
- if (data.window_flags & Qt::WindowStaysOnTopHint
- || q->windowType() == Qt::Popup
- || q->windowType() == Qt::ToolTip)
- SetWindowGroup(windowRef, group);
+ } else {
+ // Window should be application-modal (which implies NOT using a sheet).
+ if (old_wclass == kSheetWindowClass){
+ // We cannot convert a sheet to a window.
+ // So we recreate the window:
+ recreateMacWindow();
+ return;
+ } else if (!(q->data->window_flags & Qt::CustomizeWindowHint)) {
+ if (old_wclass == kDocumentWindowClass || old_wclass == kFloatingWindowClass || old_wclass == kUtilityWindowClass){
+ // Only change the class to kMovableModalWindowClass if the no explicit jewels
+ // are set (kMovableModalWindowClass can't contain them), and the current window class
+ // can be converted to modal (according to carbon doc). Mind the order of
+ // HIWindowChangeClass and ChangeWindowAttributes.
+ WindowGroupRef group = GetWindowGroup(windowRef);
+ HIWindowChangeClass(windowRef, kMovableModalWindowClass);
+ quint32 tmpWattr = kWindowCloseBoxAttribute | kWindowHorizontalZoomAttribute;
+ ChangeWindowAttributes(windowRef, tmpWattr, kWindowNoAttributes);
+ ChangeWindowAttributes(windowRef, kWindowNoAttributes, tmpWattr);
+ // If the window belongs to a qt-created group, set that group once more:
+ if (data.window_flags & Qt::WindowStaysOnTopHint
+ || q->windowType() == Qt::Popup
+ || q->windowType() == Qt::ToolTip)
+ SetWindowGroup(windowRef, group);
+ }
+ // Popups are usually handled "special" and are never modal.
+ Qt::WindowType winType = q->windowType();
+ if (winType != Qt::Popup && winType != Qt::ToolTip)
+ SetWindowModality(windowRef, kWindowModalityAppModal, 0);
}
- // Popups are usually handled "special" and are never modal.
- Qt::WindowType winType = q->windowType();
- if (winType != Qt::Popup && winType != Qt::ToolTip)
- SetWindowModality(windowRef, kWindowModalityAppModal, 0);
}
} else if (windowRef) {
if (old_wclass == kSheetWindowClass){
diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp
index 2f230d7..b11b661 100644
--- a/src/gui/kernel/qwidget_win.cpp
+++ b/src/gui/kernel/qwidget_win.cpp
@@ -1432,10 +1432,7 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
qt_wince_maximize(q);
} else {
#endif
- if (!isTranslucentWindow)
- MoveWindow(q->internalWinId(), fs.x(), fs.y(), fs.width(), fs.height(), true);
- else if (isMove && !isResize)
- SetWindowPos(q->internalWinId(), 0, fs.x(), fs.y(), 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOZORDER);
+ MoveWindow(q->internalWinId(), fs.x(), fs.y(), fs.width(), fs.height(), true);
}
if (!q->isVisible())
InvalidateRect(q->internalWinId(), 0, FALSE);
diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp
index 831d389..fc2eb60 100644
--- a/src/gui/painting/qblendfunctions.cpp
+++ b/src/gui/painting/qblendfunctions.cpp
@@ -223,8 +223,8 @@ void qt_scale_image_16bit(uchar *destPixels, int dbpl,
int h = ty2 - ty1;
int w = tx2 - tx1;
- const int dstx = int((tx1 + 0.5 - qMin(targetRect.left(), targetRect.right())) * ix);
- const int dsty = int((ty1 + 0.5 - qMin(targetRect.top(), targetRect.bottom())) * iy);
+ const int dstx = qCeil((tx1 + 0.5 - qMin(targetRect.left(), targetRect.right())) * ix) - 1;
+ const int dsty = qCeil((ty1 + 0.5 - qMin(targetRect.top(), targetRect.bottom())) * iy) - 1;
quint32 basex = quint32((sx < 0 ? srcRect.right() : srcRect.left()) * 65536) + dstx;
quint32 srcy = quint32((sy < 0 ? srcRect.bottom() : srcRect.top()) * 65536) + dsty;
@@ -723,8 +723,8 @@ template <typename T> void qt_scale_image_32bit(uchar *destPixels, int dbpl,
int h = ty2 - ty1;
int w = tx2 - tx1;
- const int dstx = int((tx1 + 0.5 - qMin(targetRect.left(), targetRect.right())) * ix);
- const int dsty = int((ty1 + 0.5 - qMin(targetRect.top(), targetRect.bottom())) * iy);
+ const int dstx = qCeil((tx1 + 0.5 - qMin(targetRect.left(), targetRect.right())) * ix) - 1;
+ const int dsty = qCeil((ty1 + 0.5 - qMin(targetRect.top(), targetRect.bottom())) * iy) - 1;
quint32 basex = quint32((sx < 0 ? srcRect.right() : srcRect.left()) * 65536) + dstx;
quint32 srcy = quint32((sy < 0 ? srcRect.bottom() : srcRect.top()) * 65536) + dsty;
diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp
index 22433dd..330a33f 100644
--- a/src/gui/painting/qwindowsurface_raster.cpp
+++ b/src/gui/painting/qwindowsurface_raster.cpp
@@ -118,7 +118,7 @@ QPaintDevice *QRasterWindowSurface::paintDevice()
void QRasterWindowSurface::beginPaint(const QRegion &rgn)
{
#if (defined(Q_WS_X11) && !defined(QT_NO_XRENDER)) || (defined(Q_WS_WIN) && !defined(Q_WS_WINCE))
- if (!qt_widget_private(window())->isOpaque) {
+ if (!qt_widget_private(window())->isOpaque && window()->testAttribute(Qt::WA_TranslucentBackground)) {
#if defined(Q_WS_WIN) && !defined(Q_WS_WINCE)
if (d_ptr->image->image.format() != QImage::Format_ARGB32_Premultiplied)
prepareBuffer(QImage::Format_ARGB32_Premultiplied, window());
@@ -149,7 +149,7 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi
QRect br = rgn.boundingRect();
#ifndef Q_WS_WINCE
- if (!qt_widget_private(window())->isOpaque) {
+ if (!qt_widget_private(window())->isOpaque && d->canUseLayeredWindow && window()->testAttribute(Qt::WA_TranslucentBackground)) {
QRect r = window()->frameGeometry();
QPoint frameOffset = qt_widget_private(window())->frameStrut().topLeft();
QRect dirtyRect = br.translated(offset + frameOffset);
diff --git a/src/gui/text/qfontengine_mac.mm b/src/gui/text/qfontengine_mac.mm
index 76132df..dbf3015 100644
--- a/src/gui/text/qfontengine_mac.mm
+++ b/src/gui/text/qfontengine_mac.mm
@@ -156,7 +156,7 @@ QCoreTextFontEngineMulti::QCoreTextFontEngineMulti(const ATSFontFamilyRef &, con
if (!kerning) {
float zero = 0.0;
QCFType<CFNumberRef> noKern = CFNumberCreate(kCFAllocatorDefault, kCFNumberFloatType, &zero);
- CFDictionaryAddValue(attributeDict, kCTKernAttributeName, &noKern);
+ CFDictionaryAddValue(attributeDict, kCTKernAttributeName, noKern);
}
QCoreTextFontEngine *fe = new QCoreTextFontEngine(ctfont, fontDef, this);
@@ -1588,6 +1588,7 @@ QFontEngine::FaceId QFontEngineMac::faceId() const
{
FaceId ret;
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
+if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) {
// CTFontGetPlatformFont
FSRef ref;
if (ATSFontGetFileReference(FMGetATSFontRefFromFont(fontID), &ref) != noErr)
@@ -1595,7 +1596,9 @@ QFontEngine::FaceId QFontEngineMac::faceId() const
ret.filename = QByteArray(128, 0);
ret.index = fontID;
FSRefMakePath(&ref, (UInt8 *)ret.filename.data(), ret.filename.size());
-#else
+}else
+#endif
+{
FSSpec spec;
if (ATSFontGetFileSpecification(FMGetATSFontRefFromFont(fontID), &spec) != noErr)
return ret;
@@ -1605,7 +1608,7 @@ QFontEngine::FaceId QFontEngineMac::faceId() const
ret.filename = QByteArray(128, 0);
ret.index = fontID;
FSRefMakePath(&ref, (UInt8 *)ret.filename.data(), ret.filename.size());
-#endif
+}
return ret;
}
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp
index 61e5601..e1d6634 100644
--- a/src/network/access/qnetworkaccessmanager.cpp
+++ b/src/network/access/qnetworkaccessmanager.cpp
@@ -121,7 +121,9 @@ static void ensureInitialized()
as well as meta-data (headers, etc.).
\note After the request has finished, it is the responsibility of the user
- to delete the QNetworkReply object at an appropriate time.
+ to delete the QNetworkReply object at an appropriate time. Do not directly
+ delete it inside the slot connected to finished(). You can use the
+ deleteLater() function.
A more involved example, assuming the manager is already existent,
can be:
@@ -202,6 +204,9 @@ static void ensureInitialized()
See QNetworkReply::finished() for information on the status that
the object will be in.
+ \note Do not delete the \a reply object in the slot connected to this
+ signal. Use deleteLater().
+
\sa QNetworkReply::finished(), QNetworkReply::error()
*/
diff --git a/src/network/access/qnetworkreply.cpp b/src/network/access/qnetworkreply.cpp
index 3abf927..f6649b6 100644
--- a/src/network/access/qnetworkreply.cpp
+++ b/src/network/access/qnetworkreply.cpp
@@ -87,6 +87,9 @@ QNetworkReplyPrivate::QNetworkReplyPrivate()
indicates the progress of the upload for operations that have such
content.
+ \note Do not delete the object in the slot connected to the
+ error() or finished() signal. Use deleteLater().
+
\sa QNetworkRequest, QNetworkAccessManager
*/
@@ -232,6 +235,9 @@ QNetworkReplyPrivate::QNetworkReplyPrivate()
QNetworkAccessManager::finished() where that signal's reply
parameter is this object.
+ \note Do not delete the object in the slot connected to this
+ signal. Use deleteLater().
+
\sa QNetworkAccessManager::finished()
*/
@@ -246,6 +252,9 @@ QNetworkReplyPrivate::QNetworkReplyPrivate()
detected. Call errorString() to obtain a textual representation of
the error condition.
+ \note Do not delete the object in the slot connected to this
+ signal. Use deleteLater().
+
\sa error(), errorString()
*/
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp
index b5376b1..13c4053 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp
@@ -77,13 +77,15 @@ private:
QSocketNotifier *keyboardNotifier;
DFBEvent event;
int bytesRead;
-
+ int lastUnicode, lastKeycode;
+ Qt::KeyboardModifiers lastModifiers;
private Q_SLOTS:
void readKeyboardData();
};
QDirectFBKeyboardHandlerPrivate::QDirectFBKeyboardHandlerPrivate(QDirectFBKeyboardHandler *h)
- : handler(h), eventBuffer(0)
+ : handler(h), eventBuffer(0), keyboardNotifier(0), bytesRead(0),
+ lastUnicode(0), lastKeycode(0), lastModifiers(0)
{
Q_ASSERT(qt_screen);
@@ -114,8 +116,6 @@ QDirectFBKeyboardHandlerPrivate::QDirectFBKeyboardHandlerPrivate(QDirectFBKeyboa
::fcntl(fd, F_SETFL, flags | O_NONBLOCK);
memset(&event, 0, sizeof(event));
- bytesRead = 0;
-
keyboardNotifier = new QSocketNotifier(fd, QSocketNotifier::Read, this);
connect(keyboardNotifier, SIGNAL(activated(int)),
@@ -213,8 +213,27 @@ void QDirectFBKeyboardHandlerPrivate::readKeyboardData()
unicode = symbol;
if (unicode != -1 || keycode != 0) {
+ bool autoRepeat = false;
+ if (press) {
+ if (unicode == lastUnicode && keycode == lastKeycode && modifiers == lastModifiers) {
+ autoRepeat = true;
+ } else {
+ lastUnicode = unicode;
+ lastKeycode = keycode;
+ lastModifiers = modifiers;
+ }
+ } else {
+ lastUnicode = lastKeycode = -1;
+ lastModifiers = 0;
+ }
+ if (autoRepeat) {
+ handler->processKeyEvent(unicode, keycode,
+ modifiers, false, autoRepeat);
+
+ }
+
handler->processKeyEvent(unicode, keycode,
- modifiers, press, false);
+ modifiers, press, autoRepeat);
}
}
}
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp
index 86e92f7..2075799 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp
@@ -43,10 +43,17 @@
#include "qdirectfbscreen.h"
#include "qdirectfbpaintdevice.h"
+#include "qdirectfbpaintengine.h"
+
+QDirectFBPaintDevice::QDirectFBPaintDevice(QDirectFBScreen *scr)
+ : QCustomRasterPaintDevice(0), dfbSurface(0), lockedImage(0), screen(scr),
+ lock(DFBSurfaceLockFlags(0)), mem(0), engine(0)
+{}
QDirectFBPaintDevice::~QDirectFBPaintDevice()
{
delete lockedImage;
+ delete engine;
}
@@ -164,4 +171,10 @@ int QDirectFBPaintDevice::metric(QPaintDevice::PaintDeviceMetric metric) const
}
}
+QPaintEngine *QDirectFBPaintDevice::paintEngine() const
+{
+ return engine;
+}
+
#endif
+
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h
index 248a15b..c4aeb70 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h
@@ -51,7 +51,8 @@ QT_BEGIN_HEADER
QT_MODULE(Gui)
// Inherited by both window surface and pixmap
- class QDirectFBPaintDevice : public QCustomRasterPaintDevice
+class QDirectFBPaintEngine;
+class QDirectFBPaintDevice : public QCustomRasterPaintDevice
{
public:
~QDirectFBPaintDevice();
@@ -62,19 +63,16 @@ public:
void unlockDirectFB();
// Reimplemented from QCustomRasterPaintDevice:
- void* memory() const;
+ void *memory() const;
QImage::Format format() const;
int bytesPerLine() const;
QSize size() const;
int metric(QPaintDevice::PaintDeviceMetric metric) const;
DFBSurfaceLockFlags lockFlags() const { return lock; }
-protected:
- // Shouldn't create QDirectFBPaintDevice by itself but only sub-class it:
- QDirectFBPaintDevice(QDirectFBScreen *scr = QDirectFBScreen::instance())
- : QCustomRasterPaintDevice(0), dfbSurface(0), lockedImage(0), screen(scr),
- lock(DFBSurfaceLockFlags(0)), mem(0)
- {}
+ QPaintEngine *paintEngine() const;
+protected:
+ QDirectFBPaintDevice(QDirectFBScreen *scr);
inline int dotsPerMeterX() const
{
return (screen->deviceWidth() * 1000) / screen->physicalWidth();
@@ -83,16 +81,17 @@ protected:
{
return (screen->deviceHeight() * 1000) / screen->physicalHeight();
}
-
+protected:
IDirectFBSurface *dfbSurface;
QImage *lockedImage;
QDirectFBScreen *screen;
int bpl;
DFBSurfaceLockFlags lock;
uchar *mem;
+ QDirectFBPaintEngine *engine;
private:
- Q_DISABLE_COPY(QDirectFBPaintDevice)
- };
+ Q_DISABLE_COPY(QDirectFBPaintDevice);
+};
QT_END_HEADER
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
index 2ed890b..58c8a58 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
@@ -60,10 +60,25 @@ class QDirectFBPaintEnginePrivate : public QRasterPaintEnginePrivate
{
public:
enum TransformationTypeFlags {
- NegativeScale = 0x100,
- RectsUnsupported = (QTransform::TxRotate|QTransform::TxShear|QTransform::TxProject),
- BlitUnsupported = (NegativeScale|RectsUnsupported)
+ Matrix_NegativeScale = 0x100,
+ Matrix_RectsUnsupported = (QTransform::TxRotate|QTransform::TxShear|QTransform::TxProject),
+ Matrix_BlitsUnsupported = (Matrix_NegativeScale|Matrix_RectsUnsupported)
};
+
+ enum CompositionModeStatus {
+ PorterDuff_None = 0x0,
+ PorterDuff_SupportedBlits = 0x1,
+ PorterDuff_SupportedPrimitives = 0x2
+ };
+
+ enum ClipType {
+ ClipUnset,
+ NoClip,
+ RectClip,
+ RegionClip,
+ ComplexClip
+ };
+
QDirectFBPaintEnginePrivate(QDirectFBPaintEngine *p);
~QDirectFBPaintEnginePrivate();
@@ -77,9 +92,6 @@ public:
inline void lock();
inline void unlock();
- inline bool dfbCanHandleClip(const QRect &rect) const;
- inline bool dfbCanHandleClip(const QRectF &rect) const;
- inline bool dfbCanHandleClip() const;
inline bool isSimpleBrush(const QBrush &brush) const;
void drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap, const QPointF &pos);
@@ -101,19 +113,16 @@ private:
bool antialiased;
bool simplePen;
- uint transformationType; // this is QTransform::type() + NegativeScale if qMin(transform.m11(), transform.m22()) < 0
+ uint transformationType; // this is QTransform::type() + Matrix_NegativeScale if qMin(transform.m11(), transform.m22()) < 0
SurfaceCache *surfaceCache;
-
IDirectFB *fb;
-
quint8 opacity;
bool dirtyClip;
- bool dfbHandledClip;
- bool ignoreSystemClip;
+ ClipType clipType;
QDirectFBPaintDevice *dfbDevice;
- bool unsupportedCompositionMode;
+ uint compositionModeStatus;
QDirectFBPaintEngine *q;
QRect currentClip;
@@ -162,8 +171,12 @@ enum PaintOperation {
#ifdef QT_DIRECTFB_WARN_ON_RASTERFALLBACKS
template <typename device, typename T1, typename T2, typename T3>
-static void rasterFallbackWarn(const char *msg, const char *, const device *, uint, bool, bool, bool,
- const char *, const T1 &, const char *, const T2 &, const char *, const T3 &);
+static void rasterFallbackWarn(const char *msg, const char *func, const device *dev,
+ uint transformationType, bool simplePen,
+ uint clipType, uint compositionModeStatus,
+ const char *nameOne, const T1 &one,
+ const char *nameTwo, const T2 &two,
+ const char *nameThree, const T3 &three);
#endif
#if defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS && defined QT_DIRECTFB_DISABLE_RASTERFALLBACKS
@@ -173,8 +186,8 @@ static void rasterFallbackWarn(const char *msg, const char *, const device *, ui
__FUNCTION__, state()->painter->device(), \
d_func()->transformationType, \
d_func()->simplePen, \
- d_func()->dfbCanHandleClip(), \
- d_func()->unsupportedCompositionMode, \
+ d_func()->clipType, \
+ d_func()->compositionModeStatus, \
#one, one, #two, two, #three, three); \
if (op & (QT_DIRECTFB_DISABLE_RASTERFALLBACKS)) \
return;
@@ -189,14 +202,13 @@ static void rasterFallbackWarn(const char *msg, const char *, const device *, ui
__FUNCTION__, state()->painter->device(), \
d_func()->transformationType, \
d_func()->simplePen, \
- d_func()->dfbCanHandleClip(), \
- d_func()->unsupportedCompositionMode, \
+ d_func()->clipType, \
+ d_func()->compositionModeStatus, \
#one, one, #two, two, #three, three);
#else
#define RASTERFALLBACK(op, one, two, three)
#endif
-
template <class T>
static inline void drawLines(const T *lines, int n, const QTransform &transform, IDirectFBSurface *surface);
template <class T>
@@ -204,6 +216,36 @@ static inline void fillRects(const T *rects, int n, const QTransform &transform,
template <class T>
static inline void drawRects(const T *rects, int n, const QTransform &transform, IDirectFBSurface *surface);
+#define CLIPPED_PAINT(operation) { \
+ DFBRegion clipRegion; \
+ switch (d->clipType) { \
+ case QDirectFBPaintEnginePrivate::NoClip: \
+ case QDirectFBPaintEnginePrivate::RectClip: \
+ operation; \
+ break; \
+ case QDirectFBPaintEnginePrivate::RegionClip: { \
+ Q_ASSERT(d->clip()); \
+ const QVector<QRect> cr = d->clip()->clipRegion.rects(); \
+ const int size = cr.size(); \
+ for (int i=0; i<size; ++i) { \
+ d->currentClip = cr.at(i); \
+ clipRegion.x1 = d->currentClip.x(); \
+ clipRegion.y1 = d->currentClip.y(); \
+ clipRegion.x2 = d->currentClip.right(); \
+ clipRegion.y2 = d->currentClip.bottom(); \
+ d->surface->SetClip(d->surface, &clipRegion); \
+ operation; \
+ } \
+ d->dirtyClip = true; \
+ break; } \
+ case QDirectFBPaintEnginePrivate::ComplexClip: \
+ case QDirectFBPaintEnginePrivate::ClipUnset: \
+ qFatal("CLIPPED_PAINT internal error %d", d->clipType); \
+ break; \
+ } \
+ }
+
+
QDirectFBPaintEngine::QDirectFBPaintEngine(QPaintDevice *device)
: QRasterPaintEngine(*(new QDirectFBPaintEnginePrivate(this)), device)
{
@@ -234,7 +276,7 @@ bool QDirectFBPaintEngine::begin(QPaintDevice *device)
}
d->prepare(d->dfbDevice);
-
+ d->setCompositionMode(state()->composition_mode);
return QRasterPaintEngine::begin(device);
}
@@ -324,58 +366,60 @@ void QDirectFBPaintEngine::clip(const QRect &rect, Qt::ClipOperation op)
void QDirectFBPaintEngine::drawRects(const QRect *rects, int rectCount)
{
Q_D(QDirectFBPaintEngine);
- d->updateClip();
+ const QPen &pen = state()->pen;
const QBrush &brush = state()->brush;
- if (d->unsupportedCompositionMode
- || (d->transformationType & QDirectFBPaintEnginePrivate::RectsUnsupported)
+ if (brush == Qt::NoBrush && pen == Qt::NoPen)
+ return;
+
+ d->updateClip();
+ if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedPrimitives)
+ || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported)
|| !d->simplePen
- || !d->dfbCanHandleClip()
+ || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip
|| !d->isSimpleBrush(brush)) {
RASTERFALLBACK(DRAW_RECTS, rectCount, VOID_ARG(), VOID_ARG());
d->lock();
QRasterPaintEngine::drawRects(rects, rectCount);
return;
}
-
d->unlock();
-
if (brush != Qt::NoBrush) {
d->setDFBColor(brush.color());
- ::fillRects<QRect>(rects, rectCount, state()->matrix, d->surface);
+ CLIPPED_PAINT(::fillRects<QRect>(rects, rectCount, state()->matrix, d->surface));
}
- const QPen &pen = state()->pen;
if (pen != Qt::NoPen) {
d->setDFBColor(pen.color());
- ::drawRects<QRect>(rects, rectCount, state()->matrix, d->surface);
+ CLIPPED_PAINT(::drawRects<QRect>(rects, rectCount, state()->matrix, d->surface));
}
}
void QDirectFBPaintEngine::drawRects(const QRectF *rects, int rectCount)
{
Q_D(QDirectFBPaintEngine);
- d->updateClip();
+ const QPen &pen = state()->pen;
const QBrush &brush = state()->brush;
- if (d->unsupportedCompositionMode
- || (d->transformationType & QDirectFBPaintEnginePrivate::RectsUnsupported)
+ if (brush == Qt::NoBrush && pen == Qt::NoPen)
+ return;
+
+ d->updateClip();
+ if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedPrimitives)
+ || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported)
|| !d->simplePen
- || !d->dfbCanHandleClip()
+ || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip
|| !d->isSimpleBrush(brush)) {
RASTERFALLBACK(DRAW_RECTS, rectCount, VOID_ARG(), VOID_ARG());
d->lock();
QRasterPaintEngine::drawRects(rects, rectCount);
return;
}
-
d->unlock();
-
if (brush != Qt::NoBrush) {
d->setDFBColor(brush.color());
- ::fillRects<QRectF>(rects, rectCount, state()->matrix, d->surface);
+ CLIPPED_PAINT(::fillRects<QRectF>(rects, rectCount, state()->matrix, d->surface));
}
- const QPen &pen = state()->pen;
if (pen != Qt::NoPen) {
d->setDFBColor(pen.color());
- ::drawRects<QRectF>(rects, rectCount, state()->matrix, d->surface);
+ CLIPPED_PAINT(::drawRects<QRectF>(rects, rectCount, state()->matrix, d->surface));
}
}
@@ -383,7 +427,10 @@ void QDirectFBPaintEngine::drawLines(const QLine *lines, int lineCount)
{
Q_D(QDirectFBPaintEngine);
d->updateClip();
- if (d->unsupportedCompositionMode || !d->simplePen || !d->dfbCanHandleClip()) {
+
+ if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedPrimitives)
+ || !d->simplePen
+ || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip) {
RASTERFALLBACK(DRAW_LINES, lineCount, VOID_ARG(), VOID_ARG());
d->lock();
QRasterPaintEngine::drawLines(lines, lineCount);
@@ -394,7 +441,7 @@ void QDirectFBPaintEngine::drawLines(const QLine *lines, int lineCount)
if (pen != Qt::NoPen) {
d->unlock();
d->setDFBColor(pen.color());
- ::drawLines<QLine>(lines, lineCount, state()->matrix, d->surface);
+ CLIPPED_PAINT(::drawLines<QLine>(lines, lineCount, state()->matrix, d->surface));
}
}
@@ -402,7 +449,10 @@ void QDirectFBPaintEngine::drawLines(const QLineF *lines, int lineCount)
{
Q_D(QDirectFBPaintEngine);
d->updateClip();
- if (d->unsupportedCompositionMode || !d->simplePen || !d->dfbCanHandleClip()) {
+
+ if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedPrimitives)
+ || !d->simplePen
+ || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip) {
RASTERFALLBACK(DRAW_LINES, lineCount, VOID_ARG(), VOID_ARG());
d->lock();
QRasterPaintEngine::drawLines(lines, lineCount);
@@ -413,7 +463,7 @@ void QDirectFBPaintEngine::drawLines(const QLineF *lines, int lineCount)
if (pen != Qt::NoPen) {
d->unlock();
d->setDFBColor(pen.color());
- ::drawLines<QLineF>(lines, lineCount, state()->matrix, d->surface);
+ CLIPPED_PAINT(::drawLines<QLineF>(lines, lineCount, state()->matrix, d->surface));
}
}
@@ -443,9 +493,9 @@ void QDirectFBPaintEngine::drawImage(const QRectF &r, const QImage &image,
d->updateClip();
#if !defined QT_NO_DIRECTFB_PREALLOCATED || defined QT_DIRECTFB_IMAGECACHE
- if (d->unsupportedCompositionMode
- || (d->transformationType & QDirectFBPaintEnginePrivate::BlitUnsupported)
- || !d->dfbCanHandleClip(r)
+ if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedBlits)
+ || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported)
+ || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip
#ifndef QT_DIRECTFB_IMAGECACHE
|| QDirectFBScreen::getSurfacePixelFormat(image.format()) == DSPF_UNKNOWN
#elif defined QT_NO_DIRECTFB_PREALLOCATED
@@ -464,7 +514,7 @@ void QDirectFBPaintEngine::drawImage(const QRectF &r, const QImage &image,
bool release;
IDirectFBSurface *imgSurface = d->getSurface(image, &release);
d->prepareForBlit(QDirectFBScreen::hasAlpha(imgSurface));
- d->blit(r, imgSurface, sr);
+ CLIPPED_PAINT(d->blit(r, imgSurface, sr));
if (release) {
#if (Q_DIRECTFB_VERSION >= 0x010000)
d->surface->ReleaseSource(d->surface);
@@ -483,15 +533,15 @@ void QDirectFBPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap,
const QRectF &sr)
{
Q_D(QDirectFBPaintEngine);
- d->updateClip();
+ d->updateClip();
if (pixmap.pixmapData()->classId() != QPixmapData::DirectFBClass) {
RASTERFALLBACK(DRAW_PIXMAP, r, pixmap.size(), sr);
d->lock();
QRasterPaintEngine::drawPixmap(r, pixmap, sr);
- } else if (d->unsupportedCompositionMode
- || (d->transformationType & QDirectFBPaintEnginePrivate::BlitUnsupported)
- || !d->dfbCanHandleClip(r)) {
+ } else if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedBlits)
+ || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported)
+ || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip) {
RASTERFALLBACK(DRAW_PIXMAP, r, pixmap.size(), sr);
const QImage *img = static_cast<QDirectFBPixmapData*>(pixmap.pixmapData())->buffer(DSLF_READ);
d->lock();
@@ -504,7 +554,8 @@ void QDirectFBPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap,
QDirectFBPixmapData *dfbData = static_cast<QDirectFBPixmapData*>(data);
dfbData->unlockDirectFB();
IDirectFBSurface *s = dfbData->directFBSurface();
- d->blit(r, s, sr);
+
+ CLIPPED_PAINT(d->blit(r, s, sr));
}
}
@@ -523,9 +574,9 @@ void QDirectFBPaintEngine::drawTiledPixmap(const QRectF &r,
RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), offset);
d->lock();
QRasterPaintEngine::drawTiledPixmap(r, pixmap, offset);
- } else if (d->unsupportedCompositionMode
- || (d->transformationType & QDirectFBPaintEnginePrivate::BlitUnsupported)
- || !d->dfbCanHandleClip(r)) {
+ } else if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedBlits)
+ || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported)
+ || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip) {
RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), offset);
const QImage *img = static_cast<QDirectFBPixmapData*>(pixmap.pixmapData())->buffer(DSLF_READ);
d->lock();
@@ -624,30 +675,34 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush)
if (brush.style() == Qt::NoBrush)
return;
d->updateClip();
- if (!d->unsupportedCompositionMode
- && !(d->transformationType & (QDirectFBPaintEnginePrivate::RectsUnsupported))
- && d->dfbCanHandleClip(rect)) {
+ if (d->clipType != QDirectFBPaintEnginePrivate::ComplexClip) {
switch (brush.style()) {
case Qt::SolidPattern: {
+ if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedPrimitives)
+ || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported)) {
+ break;
+ }
const QColor color = brush.color();
if (!color.isValid())
return;
d->unlock();
d->setDFBColor(color);
const QRect r = state()->matrix.mapRect(rect).toRect();
- d->surface->FillRectangle(d->surface, r.x(), r.y(),
- r.width(), r.height());
+ CLIPPED_PAINT(d->surface->FillRectangle(d->surface, r.x(), r.y(), r.width(), r.height()));
return; }
+
case Qt::TexturePattern: {
- if (d->transformationType & QDirectFBPaintEnginePrivate::NegativeScale)
+ if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedBlits)
+ || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported)) {
break;
+ }
const QPixmap texture = brush.texture();
if (texture.pixmapData()->classId() != QPixmapData::DirectFBClass)
break;
d->unlock();
- d->drawTiledPixmap(rect, texture, rect.topLeft() - state()->brushOrigin);
+ CLIPPED_PAINT(d->drawTiledPixmap(rect, texture, rect.topLeft() - state()->brushOrigin));
return; }
default:
break;
@@ -664,9 +719,9 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QColor &color)
return;
Q_D(QDirectFBPaintEngine);
d->updateClip();
- if (d->unsupportedCompositionMode
- || (d->transformationType & QDirectFBPaintEnginePrivate::RectsUnsupported)
- || !d->dfbCanHandleClip()) {
+ if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedPrimitives)
+ || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported)
+ || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip) {
RASTERFALLBACK(FILL_RECT, rect, color, VOID_ARG());
d->lock();
QRasterPaintEngine::fillRect(rect, color);
@@ -711,11 +766,10 @@ void QDirectFBPaintEngine::initImageCache(int size)
QDirectFBPaintEnginePrivate::QDirectFBPaintEnginePrivate(QDirectFBPaintEngine *p)
: surface(0), antialiased(false), simplePen(false),
transformationType(0), opacity(255), dirtyClip(true),
- dfbHandledClip(false), dfbDevice(0),
- unsupportedCompositionMode(false), q(p)
+ clipType(ClipUnset), dfbDevice(0),
+ compositionModeStatus(0), q(p)
{
fb = QDirectFBScreen::instance()->dfb();
- ignoreSystemClip = QDirectFBScreen::instance()->directFBFlags() & QDirectFBScreen::IgnoreSystemClip;
surfaceCache = new SurfaceCache;
}
@@ -724,23 +778,6 @@ QDirectFBPaintEnginePrivate::~QDirectFBPaintEnginePrivate()
delete surfaceCache;
}
-bool QDirectFBPaintEnginePrivate::dfbCanHandleClip(const QRect &) const
-{
- // TODO: Check to see if DirectFB can handle the clip for the given rect
- return dfbHandledClip;
-}
-
-bool QDirectFBPaintEnginePrivate::dfbCanHandleClip(const QRectF &) const
-{
- // TODO: Check to see if DirectFB can handle the clip for the given rect
- return dfbHandledClip;
-}
-
-bool QDirectFBPaintEnginePrivate::dfbCanHandleClip() const
-{
- return dfbHandledClip;
-}
-
bool QDirectFBPaintEnginePrivate::isSimpleBrush(const QBrush &brush) const
{
return (brush.style() == Qt::NoBrush) || (brush.style() == Qt::SolidPattern && !antialiased);
@@ -768,7 +805,7 @@ void QDirectFBPaintEnginePrivate::setTransform(const QTransform &transform)
{
transformationType = transform.type();
if (qMin(transform.m11(), transform.m22()) < 0) {
- transformationType |= QDirectFBPaintEnginePrivate::NegativeScale;
+ transformationType |= QDirectFBPaintEnginePrivate::Matrix_NegativeScale;
}
setPen(q->state()->pen);
}
@@ -790,7 +827,53 @@ void QDirectFBPaintEnginePrivate::setPen(const QPen &pen)
void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode mode)
{
- unsupportedCompositionMode = (mode != QPainter::CompositionMode_SourceOver);
+ if (!surface)
+ return;
+ compositionModeStatus = PorterDuff_SupportedBlits;
+ switch (mode) {
+ case QPainter::CompositionMode_Clear:
+ surface->SetPorterDuff(surface, DSPD_CLEAR);
+ break;
+ case QPainter::CompositionMode_Source:
+ surface->SetPorterDuff(surface, DSPD_SRC);
+ break;
+ case QPainter::CompositionMode_SourceOver:
+ compositionModeStatus |= PorterDuff_SupportedPrimitives;
+ surface->SetPorterDuff(surface, DSPD_SRC_OVER);
+ break;
+ case QPainter::CompositionMode_DestinationOver:
+ surface->SetPorterDuff(surface, DSPD_DST_OVER);
+ break;
+ case QPainter::CompositionMode_SourceIn:
+ surface->SetPorterDuff(surface, DSPD_SRC_IN);
+ break;
+ case QPainter::CompositionMode_DestinationIn:
+ surface->SetPorterDuff(surface, DSPD_DST_IN);
+ break;
+ case QPainter::CompositionMode_SourceOut:
+ surface->SetPorterDuff(surface, DSPD_SRC_OUT);
+ break;
+ case QPainter::CompositionMode_DestinationOut:
+ surface->SetPorterDuff(surface, DSPD_DST_OUT);
+ break;
+#if (Q_DIRECTFB_VERSION >= 0x010000)
+ case QPainter::CompositionMode_SourceAtop:
+ surface->SetPorterDuff(surface, DSPD_SRC_ATOP);
+ break;
+ case QPainter::CompositionMode_DestinationAtop:
+ surface->SetPorterDuff(surface, DSPD_DST_ATOP);
+ break;
+ case QPainter::CompositionMode_Plus:
+ surface->SetPorterDuff(surface, DSPD_ADD);
+ break;
+#endif
+ case QPainter::CompositionMode_Xor:
+ surface->SetPorterDuff(surface, DSPD_XOR);
+ break;
+ default:
+ compositionModeStatus = 0;
+ break;
+ }
}
void QDirectFBPaintEnginePrivate::setRenderHints(QPainter::RenderHints hints)
@@ -896,7 +979,7 @@ static inline qreal fixCoord(qreal rect_pos, qreal pixmapSize, qreal offset)
void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPixmap &pixmap, const QPointF &off)
{
Q_ASSERT(!dirtyClip);
- Q_ASSERT(!(transformationType & BlitUnsupported));
+ Q_ASSERT(!(transformationType & Matrix_BlitsUnsupported));
const QTransform &transform = q->state()->matrix;
const QRect destinationRect = transform.mapRect(dest).toRect().normalized();
QRect newClip = destinationRect;
@@ -909,8 +992,8 @@ void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPix
const DFBRegion clip = {
newClip.x(),
newClip.y(),
- newClip.x() + newClip.width() - 1,
- newClip.y() + newClip.height() - 1
+ newClip.right(),
+ newClip.bottom()
};
surface->SetClip(surface, &clip);
@@ -979,8 +1062,8 @@ void QDirectFBPaintEnginePrivate::drawTiledPixmap(const QRectF &dest, const QPix
const DFBRegion clip = {
currentClip.x(),
currentClip.y(),
- currentClip.x() + currentClip.width(),
- currentClip.y() + currentClip.height()
+ currentClip.right(),
+ currentClip.bottom()
};
surface->SetClip(surface, &clip);
}
@@ -995,22 +1078,22 @@ void QDirectFBPaintEnginePrivate::updateClip()
const QClipData *clipData = clip();
if (!clipData || !clipData->enabled) {
surface->SetClip(surface, NULL);
- dfbHandledClip = true;
+ clipType = NoClip;
} else if (clipData->hasRectClip) {
const DFBRegion r = {
clipData->clipRect.x(),
clipData->clipRect.y(),
- clipData->clipRect.x() + clipData->clipRect.width(),
- clipData->clipRect.y() + clipData->clipRect.height()
+ clipData->clipRect.right(),
+ clipData->clipRect.bottom()
};
surface->SetClip(surface, &r);
currentClip = clipData->clipRect.normalized();
// ### is this guaranteed to always be normalized?
- dfbHandledClip = true;
- } else if (clipData->hasRegionClip && ignoreSystemClip && clipData->clipRegion == systemClip) {
- dfbHandledClip = true;
+ clipType = RectClip;
+ } else if (clipData->hasRegionClip) {
+ clipType = RegionClip;
} else {
- dfbHandledClip = false;
+ clipType = ComplexClip;
}
dirtyClip = false;
@@ -1107,7 +1190,7 @@ template <> inline const bool* ptr<bool>(const bool &) { return 0; }
template <typename device, typename T1, typename T2, typename T3>
static void rasterFallbackWarn(const char *msg, const char *func, const device *dev,
uint transformationType, bool simplePen,
- bool dfbHandledClip, bool unsupportedCompositionMode,
+ uint clipType, uint compositionModeStatus,
const char *nameOne, const T1 &one,
const char *nameTwo, const T2 &two,
const char *nameThree, const T3 &three)
@@ -1123,8 +1206,8 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device *
dbg << QString("transformationType 0x%1").arg(transformationType, 3, 16, QLatin1Char('0'))
<< "simplePen" << simplePen
- << "dfbHandledClip" << dfbHandledClip
- << "unsupportedCompositionMode" << unsupportedCompositionMode;
+ << "clipType" << clipType
+ << "compositionModeStatus" << compositionModeStatus;
const T1 *t1 = ptr(one);
const T2 *t2 = ptr(two);
@@ -1141,7 +1224,6 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device *
}
qWarning("%s", qPrintable(out));
}
-#endif
-
+#endif // QT_DIRECTFB_WARN_ON_RASTERFALLBACKS
#endif // QT_NO_DIRECTFB
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
index 52e85ba..bedd9e5 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
@@ -49,9 +49,9 @@
static int global_ser_no = 0;
-QDirectFBPixmapData::QDirectFBPixmapData(PixelType pixelType)
- : QPixmapData(pixelType, DirectFBClass),
- engine(0), format(QImage::Format_Invalid), alpha(false)
+QDirectFBPixmapData::QDirectFBPixmapData(QDirectFBScreen *screen, PixelType pixelType)
+ : QPixmapData(pixelType, DirectFBClass), QDirectFBPaintDevice(screen),
+ format(QImage::Format_Invalid), alpha(false)
{
setSerialNumber(0);
}
@@ -61,7 +61,6 @@ QDirectFBPixmapData::~QDirectFBPixmapData()
unlockDirectFB();
if (dfbSurface && QDirectFBScreen::instance())
screen->releaseDFBSurface(dfbSurface);
- delete engine;
}
void QDirectFBPixmapData::resize(int width, int height)
@@ -304,7 +303,7 @@ QPixmap QDirectFBPixmapData::transformed(const QTransform &transform,
Q_ASSERT(image);
const QImage transformed = image->transformed(transform, mode);
that->unlockDirectFB();
- QDirectFBPixmapData *data = new QDirectFBPixmapData(QPixmapData::PixmapType);
+ QDirectFBPixmapData *data = new QDirectFBPixmapData(screen, QPixmapData::PixmapType);
data->fromImage(transformed, Qt::AutoColor);
return QPixmap(data);
}
@@ -314,7 +313,7 @@ QPixmap QDirectFBPixmapData::transformed(const QTransform &transform,
if (size.isEmpty())
return QPixmap();
- QDirectFBPixmapData *data = new QDirectFBPixmapData(QPixmapData::PixmapType);
+ QDirectFBPixmapData *data = new QDirectFBPixmapData(screen, QPixmapData::PixmapType);
DFBSurfaceBlittingFlags flags = DSBLIT_NOFX;
data->alpha = alpha;
if (alpha) {
@@ -373,6 +372,8 @@ QImage QDirectFBPixmapData::toImage() const
return img->copy();
}
+/* This is QPixmapData::paintEngine(), not QPaintDevice::paintEngine() */
+
QPaintEngine *QDirectFBPixmapData::paintEngine() const
{
if (!engine) {
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h
index 0204061..df3c679 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h
@@ -56,7 +56,7 @@ class QDirectFBPaintEngine;
class QDirectFBPixmapData : public QPixmapData, public QDirectFBPaintDevice
{
public:
- QDirectFBPixmapData(PixelType pixelType);
+ QDirectFBPixmapData(QDirectFBScreen *screen, PixelType pixelType);
~QDirectFBPixmapData();
// Re-implemented from QPixmapData:
@@ -79,7 +79,6 @@ public:
inline bool hasAlphaChannel() const { return alpha; }
private:
void invalidate();
- QDirectFBPaintEngine *engine;
QImage::Format format;
bool alpha;
};
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
index 030e51f..4f8fa2f 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
@@ -57,7 +57,7 @@
class QDirectFBScreenPrivate : public QObject, public QWSGraphicsSystem
{
public:
- QDirectFBScreenPrivate(QDirectFBScreen*);
+ QDirectFBScreenPrivate(QDirectFBScreen *qptr);
~QDirectFBScreenPrivate();
void setFlipFlags(const QStringList &args);
@@ -82,10 +82,11 @@ public:
QDirectFBScreen::DirectFBFlags directFBFlags;
QImage::Format alphaPixmapFormat;
QColor backgroundColor;
+ QDirectFBScreen *q;
};
-QDirectFBScreenPrivate::QDirectFBScreenPrivate(QDirectFBScreen *screen)
- : QWSGraphicsSystem(screen), dfb(0), dfbSurface(0), flipFlags(DSFLIP_NONE)
+QDirectFBScreenPrivate::QDirectFBScreenPrivate(QDirectFBScreen *qptr)
+ : QWSGraphicsSystem(qptr), dfb(0), dfbSurface(0), flipFlags(DSFLIP_NONE)
#ifndef QT_NO_DIRECTFB_LAYER
, dfbLayer(0)
#endif
@@ -98,6 +99,7 @@ QDirectFBScreenPrivate::QDirectFBScreenPrivate(QDirectFBScreen *screen)
#endif
, directFBFlags(QDirectFBScreen::NoFlags)
, alphaPixmapFormat(QImage::Format_Invalid)
+ , q(qptr)
{
#ifndef QT_NO_QWS_SIGNALHANDLER
QWSSignalHandler::instance()->addObject(this);
@@ -742,7 +744,7 @@ QPixmapData *QDirectFBScreenPrivate::createPixmapData(QPixmapData::PixelType typ
if (type == QPixmapData::BitmapType)
return QWSGraphicsSystem::createPixmapData(type);
- return new QDirectFBPixmapData(type);
+ return new QDirectFBPixmapData(q, type);
}
#if (Q_DIRECTFB_VERSION >= 0x000923)
@@ -914,9 +916,6 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
QDirectFBPaintEngine::initImageCache(imageCacheSize);
#endif
- if (displayArgs.contains(QLatin1String("ignoresystemclip"), Qt::CaseInsensitive))
- d_ptr->directFBFlags |= IgnoreSystemClip;
-
#ifndef QT_NO_DIRECTFB_WM
if (displayArgs.contains(QLatin1String("fullscreen")))
#endif
@@ -1328,15 +1327,15 @@ void QDirectFBScreen::flipSurface(IDirectFBSurface *surface, DFBSurfaceFlipFlags
for (int i=0; i<rects.size(); ++i) {
const QRect &r = rects.at(i);
const DFBRegion dfbReg = { r.x() + offset.x(), r.y() + offset.y(),
- r.x() + r.width() + offset.x(),
- r.y() + r.height() + offset.y() };
+ r.right() + offset.x(),
+ r.bottom() + offset.y() };
surface->Flip(surface, &dfbReg, i + 1 < rects.size() ? nonWaitFlags : flipFlags);
}
} else {
const QRect r = region.boundingRect();
const DFBRegion dfbReg = { r.x() + offset.x(), r.y() + offset.y(),
- r.x() + r.width() + offset.x(),
- r.y() + r.height() + offset.y() };
+ r.right() + offset.x(),
+ r.bottom() + offset.y() };
surface->Flip(surface, &dfbReg, flipFlags);
}
}
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
index 63c608e..8884a06 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
@@ -79,8 +79,7 @@ public:
NoFlags = 0x00,
VideoOnly = 0x01,
SystemOnly = 0x02,
- IgnoreSystemClip = 0x04,
- BoundingRectFlip = 0x08
+ BoundingRectFlip = 0x04
};
Q_DECLARE_FLAGS(DirectFBFlags, DirectFBFlag);
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
index 8cddc76..34168bc 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
@@ -55,7 +55,7 @@ QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirect
#ifndef QT_NO_DIRECTFB_WM
, dfbWindow(0)
#endif
- , engine(0)
+ , engineHeight(-1)
, flipFlags(flip)
, boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip)
{
@@ -76,7 +76,7 @@ QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirect
#ifndef QT_NO_DIRECTFB_WM
, dfbWindow(0)
#endif
- , engine(0)
+ , engineHeight(-1)
, flipFlags(flip)
, boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip)
{
@@ -295,16 +295,6 @@ bool QDirectFBWindowSurface::move(const QPoint &moveBy)
return true;
}
-QPaintEngine *QDirectFBWindowSurface::paintEngine() const
-{
- if (!engine) {
- QDirectFBWindowSurface *that = const_cast<QDirectFBWindowSurface*>(this);
- that->engine = new QDirectFBPaintEngine(that);
- return that->engine;
- }
- return engine;
-}
-
// hw: XXX: copied from QWidgetPrivate::isOpaque()
inline bool isWidgetOpaque(const QWidget *w)
{
@@ -429,6 +419,12 @@ void QDirectFBWindowSurface::flush(QWidget *, const QRegion &region,
void QDirectFBWindowSurface::beginPaint(const QRegion &)
{
+ const int h = height();
+ if (h > engineHeight) {
+ engineHeight = h;
+ delete engine;
+ engine = new QDirectFBPaintEngine(this);
+ }
}
void QDirectFBWindowSurface::endPaint(const QRegion &)
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h
index c46d93b..fefe9f3 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h
@@ -61,8 +61,8 @@ QT_MODULE(Gui)
class QDirectFBWindowSurface : public QWSWindowSurface, public QDirectFBPaintDevice
{
public:
- QDirectFBWindowSurface(DFBSurfaceFlipFlags flipFlags, QDirectFBScreen* scr);
- QDirectFBWindowSurface(DFBSurfaceFlipFlags flipFlags, QDirectFBScreen* scr, QWidget *widget);
+ QDirectFBWindowSurface(DFBSurfaceFlipFlags flipFlags, QDirectFBScreen *scr);
+ QDirectFBWindowSurface(DFBSurfaceFlipFlags flipFlags, QDirectFBScreen *scr, QWidget *widget);
~QDirectFBWindowSurface();
bool isValid() const;
@@ -79,7 +79,6 @@ public:
QImage image() const { return QImage(); }
QPaintDevice *paintDevice() { return this; }
- QPaintEngine *paintEngine() const;
void flush(QWidget *widget, const QRegion &region, const QPoint &offset);
@@ -92,7 +91,7 @@ private:
void createWindow();
IDirectFBWindow *dfbWindow;
#endif
- QDirectFBPaintEngine *engine;
+ int engineHeight;
enum Mode {
Primary,
diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/sql/drivers/mysql/qsql_mysql.cpp
index bfd65fc..bd6f7b9 100644
--- a/src/sql/drivers/mysql/qsql_mysql.cpp
+++ b/src/sql/drivers/mysql/qsql_mysql.cpp
@@ -1338,8 +1338,8 @@ QSqlIndex QMYSQLDriver::primaryIndex(const QString& tablename) const
if (!isOpen())
return idx;
- prepQ = d->preparedQuerys;
- d->preparedQuerys = false;
+ prepQ = d->preparedQuerysEnabled;
+ d->preparedQuerysEnabled = false;
QSqlQuery i(createResult());
QString stmt(QLatin1String("show index from %1;"));
@@ -1353,7 +1353,7 @@ QSqlIndex QMYSQLDriver::primaryIndex(const QString& tablename) const
}
}
- d->preparedQuerys = prepQ;
+ d->preparedQuerysEnabled = prepQ;
return idx;
}
diff --git a/tests/arthur/data/qps/pixmap_scaling.qps b/tests/arthur/data/qps/pixmap_scaling.qps
index 81b8fae..c5053ad 100644
--- a/tests/arthur/data/qps/pixmap_scaling.qps
+++ b/tests/arthur/data/qps/pixmap_scaling.qps
@@ -3,8 +3,8 @@
translate 5 25
setFont "arial" 8
-save
- drawText 15 0 "opaque image"
+save
+ drawText 15 0 "opaque image"
translate 50 50
save
translate 1 1
@@ -16,23 +16,23 @@ save
scale -20 20
drawImage solid2x2.png 0 0
restore
- save
+ save
translate 1 -1
scale 20 -20
drawImage solid2x2.png 0 0
restore
- save
+ save
translate -1 -1
scale -20 -20
drawImage solid2x2.png 0 0
restore
-
-restore
+
+restore
save
translate 150 0
- drawText 15 0 "alpha image"
+ drawText 15 0 "alpha image"
translate 50 50
save
translate 1 1
@@ -44,12 +44,12 @@ save
scale -20 20
drawImage alpha2x2.png 0 0
restore
- save
+ save
translate 1 -1
scale 20 -20
drawImage alpha2x2.png 0 0
restore
- save
+ save
translate -1 -1
scale -20 -20
drawImage alpha2x2.png 0 0
@@ -59,7 +59,7 @@ restore
save
translate 0 150
- drawText 15 0 "solid pixmap"
+ drawText 15 0 "solid pixmap"
translate 50 50
save
translate 1 1
@@ -71,12 +71,12 @@ save
scale -20 20
drawPixmap solid2x2.png 0 0
restore
- save
+ save
translate 1 -1
scale 20 -20
drawPixmap solid2x2.png 0 0
restore
- save
+ save
translate -1 -1
scale -20 -20
drawPixmap solid2x2.png 0 0
@@ -85,9 +85,9 @@ restore
save
- translate 150 150
+ translate 150 150
drawText 15 0 "alpha pixmap"
- translate 50 50
+ translate 50 50
save
translate 1 1
scale 20 20
@@ -98,12 +98,12 @@ save
scale -20 20
drawPixmap alpha2x2.png 0 0
restore
- save
+ save
translate 1 -1
scale 20 -20
drawPixmap alpha2x2.png 0 0
restore
- save
+ save
translate -1 -1
scale -20 -20
drawPixmap alpha2x2.png 0 0
@@ -111,7 +111,7 @@ save
restore
-save
+save
translate 300 10
save
drawText 0 -10 "subrect solid image"
@@ -138,7 +138,7 @@ save
drawImage solid2x2.png 45 0 5 50 1.8 0 0.2 2
restore
- save
+ save
translate 150 0
drawText 0 -10 "subrect solid image"
drawImage alpha2x2.png 0 0 50 5 0 0.0 2 0.2
@@ -151,7 +151,7 @@ save
drawImage alpha2x2.png 0 35 50 5 0 1.4 2 0.2
drawImage alpha2x2.png 0 40 50 5 0 1.6 2 0.2
drawImage alpha2x2.png 0 45 50 5 0 1.8 2 0.2
- translate 60 0
+ translate 60 0
drawImage alpha2x2.png 0 0 5 50 0.0 0 0.2 2
drawImage alpha2x2.png 5 0 5 50 0.2 0 0.2 2
drawImage alpha2x2.png 10 0 5 50 0.4 0 0.2 2
@@ -217,3 +217,311 @@ save
restore
restore
+
+
+
+image_load alpha2x2.png alpha2x2
+image_convertToFormat alpha2x2 alpha2x2_argb32 ARGB32
+image_convertToFormat alpha2x2 alpha2x2_argb32pre ARGB32_Premultiplied
+image_convertToFormat alpha2x2 alpha2x2_rgb888 Format_RGB888
+image_convertToFormat alpha2x2 alpha2x2_rgb32 RGB32
+image_convertToFormat alpha2x2 alpha2x2_rgb16 Format_RGB16
+
+save
+ translate 0 300
+ drawText 15 0 "drawImage - argb32"
+ translate 50 50
+ save
+ translate 0.5 0.5
+ scale 20 20
+ drawImage alpha2x2_argb32 0 0
+ restore
+ save
+ translate -0.5 0.5
+ scale -20 20
+ drawImage alpha2x2_argb32 0 0
+ restore
+ save
+ translate 0.5 -0.5
+ scale 20 -20
+ drawImage alpha2x2_argb32 0 0
+ restore
+ save
+ translate -0.5 -0.5
+ scale -20 -20
+ drawImage alpha2x2_argb32 0 0
+ restore
+restore
+
+save
+ translate 150 300
+ drawText 15 0 "drawImage - argb32premul"
+ translate 50 50
+ save
+ translate 0.5 0.5
+ scale 20 20
+ drawImage alpha2x2_argb32pre 0 0
+ restore
+ save
+ translate -0.5 0.5
+ scale -20 20
+ drawImage alpha2x2_argb32pre 0 0
+ restore
+ save
+ translate 0.5 -0.5
+ scale 20 -20
+ drawImage alpha2x2_argb32pre 0 0
+ restore
+ save
+ translate -0.5 -0.5
+ scale -20 -20
+ drawImage alpha2x2_argb32pre 0 0
+ restore
+restore
+
+
+
+save
+ translate 0 450
+ drawText 15 0 "drawImage - rgb888"
+ translate 50 50
+ save
+ translate 0.5 0.5
+ scale 20 20
+ drawImage alpha2x2_rgb888 0 0
+ restore
+ save
+ translate -0.5 0.5
+ scale -20 20
+ drawImage alpha2x2_rgb888 0 0
+ restore
+ save
+ translate 0.5 -0.5
+ scale 20 -20
+ drawImage alpha2x2_rgb888 0 0
+ restore
+ save
+ translate -0.5 -0.5
+ scale -20 -20
+ drawImage alpha2x2_rgb888 0 0
+ restore
+restore
+
+save
+ translate 150 450
+ drawText 15 0 "drawImage - rgb32"
+ translate 50 50
+ save
+ translate 0.5 0.5
+ scale 20 20
+ drawImage alpha2x2_rgb32 0 0
+ restore
+ save
+ translate -0.5 0.5
+ scale -20 20
+ drawImage alpha2x2_rgb32 0 0
+ restore
+ save
+ translate 0.5 -0.5
+ scale 20 -20
+ drawImage alpha2x2_rgb32 0 0
+ restore
+ save
+ translate -0.5 -0.5
+ scale -20 -20
+ drawImage alpha2x2_rgb32 0 0
+ restore
+restore
+
+save
+ translate 300 450
+ drawText 15 0 "drawImage - rgb16"
+ translate 50 50
+ save
+ translate 0.5 0.5
+ scale 20 20
+ drawImage alpha2x2_rgb16 0 0
+ restore
+ save
+ translate -0.5 0.5
+ scale -20 20
+ drawImage alpha2x2_rgb16 0 0
+ restore
+ save
+ translate 0.5 -0.5
+ scale 20 -20
+ drawImage alpha2x2_rgb16 0 0
+ restore
+ save
+ translate -0.5 -0.5
+ scale -20 -20
+ drawImage alpha2x2_rgb16 0 0
+ restore
+restore
+
+
+
+save
+ translate 0 600
+ drawText 15 0 "clipping - argb32"
+ translate 50 50
+ setClipRect -30 -30 60 60 ReplaceClip
+ save
+ translate 0.5 0.5
+ scale 20 20
+ drawImage alpha2x2_argb32 0 0
+ restore
+ save
+ translate -0.5 0.5
+ scale -20 20
+ drawImage alpha2x2_argb32 0 0
+ restore
+ save
+ translate 0.5 -0.5
+ scale 20 -20
+ drawImage alpha2x2_argb32 0 0
+ restore
+ save
+ translate -0.5 -0.5
+ scale -20 -20
+ drawImage alpha2x2_argb32 0 0
+ restore
+restore
+
+save
+ translate 150 600
+ drawText 15 0 "clipping - argb32premul"
+ translate 50 50
+ setClipRect -30 -30 60 60 ReplaceClip
+ save
+ translate 0.5 0.5
+ scale 20 20
+ drawImage alpha2x2_argb32pre 0 0
+ restore
+ save
+ translate -0.5 0.5
+ scale -20 20
+ drawImage alpha2x2_argb32pre 0 0
+ restore
+ save
+ translate 0.5 -0.5
+ scale 20 -20
+ drawImage alpha2x2_argb32pre 0 0
+ restore
+ save
+ translate -0.5 -0.5
+ scale -20 -20
+ drawImage alpha2x2_argb32pre 0 0
+ restore
+restore
+
+save
+ translate 300 600
+ drawText 15 0 "clipping - rgb16"
+ translate 50 50
+ setClipRect -30 -30 60 60 ReplaceClip
+ save
+ translate 0.5 0.5
+ scale 20 20
+ drawImage alpha2x2_rgb16 0 0
+ restore
+ save
+ translate -0.5 0.5
+ scale -20 20
+ drawImage alpha2x2_rgb16 0 0
+ restore
+ save
+ translate 0.5 -0.5
+ scale 20 -20
+ drawImage alpha2x2_rgb16 0 0
+ restore
+ save
+ translate -0.5 -0.5
+ scale -20 -20
+ drawImage alpha2x2_rgb16 0 0
+ restore
+restore
+
+
+path_addEllipse ellipse -30 -30 60 60
+
+save
+ translate 0 750
+ drawText 15 0 "clipping - argb32"
+ translate 50 50
+ setClipPath ellipse ReplaceClip
+ save
+ translate 0.5 0.5
+ scale 20 20
+ drawImage alpha2x2_argb32 0 0
+ restore
+ save
+ translate -0.5 0.5
+ scale -20 20
+ drawImage alpha2x2_argb32 0 0
+ restore
+ save
+ translate 0.5 -0.5
+ scale 20 -20
+ drawImage alpha2x2_argb32 0 0
+ restore
+ save
+ translate -0.5 -0.5
+ scale -20 -20
+ drawImage alpha2x2_argb32 0 0
+ restore
+restore
+
+save
+ translate 150 750
+ drawText 15 0 "clipping - argb32premul"
+ translate 50 50
+ setClipPath ellipse ReplaceClip
+ save
+ translate 0.5 0.5
+ scale 20 20
+ drawImage alpha2x2_argb32pre 0 0
+ restore
+ save
+ translate -0.5 0.5
+ scale -20 20
+ drawImage alpha2x2_argb32pre 0 0
+ restore
+ save
+ translate 0.5 -0.5
+ scale 20 -20
+ drawImage alpha2x2_argb32pre 0 0
+ restore
+ save
+ translate -0.5 -0.5
+ scale -20 -20
+ drawImage alpha2x2_argb32pre 0 0
+ restore
+restore
+
+save
+ translate 300 750
+ drawText 15 0 "clipping - rgb16"
+ translate 50 50
+ setClipPath ellipse ReplaceClip
+ save
+ translate 0.5 0.5
+ scale 20 20
+ drawImage alpha2x2_rgb16 0 0
+ restore
+ save
+ translate -0.5 0.5
+ scale -20 20
+ drawImage alpha2x2_rgb16 0 0
+ restore
+ save
+ translate 0.5 -0.5
+ scale 20 -20
+ drawImage alpha2x2_rgb16 0 0
+ restore
+ save
+ translate -0.5 -0.5
+ scale -20 -20
+ drawImage alpha2x2_rgb16 0 0
+ restore
+restore
diff --git a/tests/auto/moc/os9-newlines.h b/tests/auto/moc/os9-newlines.h
index fb9bbe4..85fa671 100644
--- a/tests/auto/moc/os9-newlines.h
+++ b/tests/auto/moc/os9-newlines.h
@@ -1 +1 @@
-/**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage ** This file contains pre-release code and may not be distributed. ** You may use this file in accordance with the terms and conditions ** contained in the either Technology Preview License Agreement or the ** Beta Release License Agreement. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain ** additional rights. These rights are described in the Nokia Qt LGPL ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this ** package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please ** contact the sales department at http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ #include <QObject> class Os9Newlines : public QObject { Q_OBJECT public Q_SLOTS: inline void testSlot() {} };
+/**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage ** This file contains pre-release code and may not be distributed. ** You may use this file in accordance with the terms and conditions ** contained in the either Technology Preview License Agreement or the ** Beta Release License Agreement. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain ** additional rights. These rights are described in the Nokia Qt LGPL ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this ** package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please ** contact the sales department at http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ #include <QObject> class Os9Newlines : public QObject { Q_OBJECT public Q_SLOTS: inline void testSlot() {} }; \ No newline at end of file
diff --git a/tests/auto/q3socket/tst_qsocket.cpp b/tests/auto/q3socket/tst_qsocket.cpp
index b07fa2f..854cc75 100644
--- a/tests/auto/q3socket/tst_qsocket.cpp
+++ b/tests/auto/q3socket/tst_qsocket.cpp
@@ -124,8 +124,10 @@ void tst_Q3Socket::peerAddress_data()
QTest::addColumn<bool>("peerClosesConnection");
QTest::addColumn<QString>("peerAddr");
- QTest::newRow( "echo" ) << QString("qt-test-server.troll.no") << (uint)7 << false << QString("10.3.3.69");
- QTest::newRow( "daytime" ) << QString("qt-test-server.troll.no") << (uint)13 << true << QString("10.3.3.69");
+ QTest::newRow( "echo" ) << QtNetworkSettings::serverLocalName() << (uint)7 << false
+ << QtNetworkSettings::serverIP().toString();
+ QTest::newRow( "daytime" ) << QtNetworkSettings::serverLocalName() << (uint)13 << true
+ << QtNetworkSettings::serverIP().toString();
}
void tst_Q3Socket::peerAddress()
@@ -191,7 +193,7 @@ void tst_Q3Socket::emitConnectionRefused()
{
Q3Socket sock;
connect( &sock, SIGNAL(error(int)), SLOT(emitConnectionRefused_error(int)) );
- sock.connectToHost( "ares.troll.no", 12331 );
+ sock.connectToHost( QtNetworkSettings::serverLocalName(), 12331 );
emitConnectionRefused_errorReceived = false;
QTestEventLoop::instance().enterLoop( 30 );
@@ -225,8 +227,8 @@ void tst_Q3Socket::connectionAttempts_data()
QTest::addColumn<int>("port");
QTest::addColumn<bool>("expectedResult");
- QTest::newRow("fluke port 80") << QString("qt-test-server.troll.no") << 80 << true;
- QTest::newRow("fluke port 79") << QString("qt-test-server.troll.no") << 79 << false;
+ QTest::newRow("fluke port 80") << QtNetworkSettings::serverLocalName() << 80 << true;
+ QTest::newRow("fluke port 79") << QtNetworkSettings::serverLocalName() << 79 << false;
}
void tst_Q3Socket::connectionAttempts()
@@ -266,7 +268,7 @@ void tst_Q3Socket::canReadLine()
connect(&socket, SIGNAL(connected()), &loop, SLOT(quit()));
// timeout error will fail in #238
connect(&socket, SIGNAL(error(int)), &loop, SLOT(quit()));
- socket.connectToHost("qt-test-server.troll.no", 143);
+ socket.connectToHost(QtNetworkSettings::serverLocalName(), 143);
loop.exec();
diff --git a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
index e4b1a55..e5a9b01 100644
--- a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
+++ b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
@@ -548,7 +548,7 @@ void tst_Q3SqlCursor::unicode()
else
QFAIL( QString( "Strings differ at position %1: orig: %2, db: %3" ).arg( i ).arg( utf8str[ i ].unicode(), 0, 16 ).arg( res[ i ].unicode(), 0, 16 ) );
}
- if(db.driverName().startsWith("QMYSQL") || db.driverName().startsWith("QDB2"))
+ if((db.driverName().startsWith("QMYSQL") || db.driverName().startsWith("QDB2")) && res != utf8str)
QEXPECT_FAIL("", "See above message", Continue);
QVERIFY( res == utf8str );
}
@@ -721,7 +721,9 @@ void tst_Q3SqlCursor::updateNoPK()
// Sqlite returns 2, don't ask why.
QVERIFY(cur.update() != 0);
QString expect = "update " + qTableName("qtestPK") +
- " set id = 1 , name = NULL , num = NULL where " + qTableName("qtestPK") + ".id"
+ " set "+db.driver()->escapeIdentifier("id", QSqlDriver::FieldName)+" = 1 , "
+ +db.driver()->escapeIdentifier("name", QSqlDriver::FieldName)+" = NULL , "
+ +db.driver()->escapeIdentifier("num", QSqlDriver::FieldName)+" = NULL where " + qTableName("qtestPK") + ".id"
" IS NULL and " + qTableName("qtestPK") + ".name IS NULL and " +
qTableName("qtestPK") + ".num IS NULL";
if (!db.driver()->hasFeature(QSqlDriver::PreparedQueries)) {
diff --git a/tests/auto/q3urloperator/tst_q3urloperator.cpp b/tests/auto/q3urloperator/tst_q3urloperator.cpp
index f1e1059..a9e5096 100644
--- a/tests/auto/q3urloperator/tst_q3urloperator.cpp
+++ b/tests/auto/q3urloperator/tst_q3urloperator.cpp
@@ -55,6 +55,8 @@
#include <q3valuelist.h>
#include <qlist.h>
+#include "../network-settings.h"
+
//TESTED_CLASS=
//TESTED_FILES=
@@ -150,7 +152,7 @@ void tst_Q3UrlOperator::initTestCase()
// prepare: make sure that there is a unique directory for FTP upload
// testing (to avoid parallel executed tests interfere with each other)
- ftpQtestUpload = "ftp://qt-test-server.troll.no/";
+ ftpQtestUpload = QString("ftp://%1/").arg(QtNetworkSettings::serverLocalName());
QString dir = QString( "qtest/upload/%1" ).arg( (ulong)this );
Q3UrlOperator opMkdir( ftpQtestUpload );
@@ -218,8 +220,8 @@ void tst_Q3UrlOperator::cleanup()
void tst_Q3UrlOperator::copy_data()
{
- const QString ftpQtest( "ftp://qt-test-server.troll.no/qtest" );
- const QString httpQtest( "http://qt-test-server.troll.no/qtest" );
+ const QString ftpQtest( QString("ftp://%1/qtest").arg(QtNetworkSettings::serverLocalName()) );
+ const QString httpQtest( QString("http://%1/qtest").arg(QtNetworkSettings::serverLocalName()) );
// argument for the constructor
QTest::addColumn<QString>("url");
@@ -339,8 +341,8 @@ void tst_Q3UrlOperator::slotFinished_copy( Q3NetworkOperation *op )
void tst_Q3UrlOperator::put_data()
{
- const QString httpQtest( "http://qt-test-server.troll.no/qtest/cgi-bin" );
- const QString httpQtestGet( "http://qt-test-server.troll.no/qtest/cgi-bin/retrieve_testfile.cgi" );
+ const QString httpQtest( QString("http://%1/qtest/cgi-bin").arg(QtNetworkSettings::serverLocalName()) );
+ const QString httpQtestGet( QString("http://%1/qtest/cgi-bin/retrieve_testfile.cgi").arg(QtNetworkSettings::serverLocalName()) );
QByteArray putData_1( 5 );
putData_1[0] = 'a';
diff --git a/tests/auto/qlocale/tst_qlocale.cpp b/tests/auto/qlocale/tst_qlocale.cpp
index 9ef7f1d..9a5c549 100644
--- a/tests/auto/qlocale/tst_qlocale.cpp
+++ b/tests/auto/qlocale/tst_qlocale.cpp
@@ -327,9 +327,8 @@ void tst_QLocale::emptyCtor()
{ \
/* Test constructor without arguments. Needs separate process */ \
/* because of caching of the system locale. */ \
- QString oldEnv = QString::fromLocal8Bit(qgetenv("LANG")); \
- qputenv("LANG", QString(req_lc).toLocal8Bit()); \
QProcess process; \
+ process.setEnvironment(QStringList(env) << QString("LANG=%1").arg(req_lc)); \
process.start("syslocaleapp/syslocaleapp"); \
process.waitForReadyRead(); \
QString ret = QString(process.readAll()); \
@@ -337,18 +336,23 @@ void tst_QLocale::emptyCtor()
QVERIFY2(!ret.isEmpty(), "Cannot launch external process"); \
QVERIFY2(QString(exp_str) == ret, QString("Expected: " + QString(exp_str) + ", got: " \
+ ret + ". Requested: " + QString(req_lc)).toLatin1().constData()); \
- qputenv("LANG", oldEnv.toLocal8Bit()); \
+ }
+
+ // Get an environment free of any locale-related variables
+ QStringList env;
+ foreach (QString const& entry, QProcess::systemEnvironment()) {
+ if (entry.startsWith("LANG=") || entry.startsWith("LC_"))
+ continue;
+ env << entry;
}
// Get default locale.
- QString old = QString::fromLocal8Bit(qgetenv("LANG"));
- qputenv("LANG", "");
QProcess p;
+ p.setEnvironment(env);
p.start("syslocaleapp/syslocaleapp");
p.waitForReadyRead();
QString defaultLoc = QString(p.readAll());
p.waitForFinished();
- qputenv("LANG", old.toLocal8Bit());
TEST_CTOR("C", "C")
TEST_CTOR("bla", "C")
diff --git a/tests/auto/qmake/testdata/simple_app_build/README b/tests/auto/qmake/testdata/simple_app_build/README
new file mode 100644
index 0000000..81dc596
--- /dev/null
+++ b/tests/auto/qmake/testdata/simple_app_build/README
@@ -0,0 +1 @@
+Placeholder file to ensure this directory exists
diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
index ae5155e..e001eab 100644
--- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
+++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
@@ -1195,6 +1195,7 @@ void tst_QSharedPointer::invalidConstructs_data()
"QSharedPointer<Data> b;\n"
"if (a + b) return;";
+#if QT_VERSION >= 0x040600
// two objects with the same pointer
QTest::newRow("same-pointer")
<< &QTest::QExternalTest::tryRunFail
@@ -1208,6 +1209,7 @@ void tst_QSharedPointer::invalidConstructs_data()
<< "Data *aData = new Data;\n"
"QSharedPointer<Data> ptr1 = QSharedPointer<Data>(aData);"
"ptr1 = QSharedPointer<Data>(aData);";
+#endif
// any type of cast for unrelated types:
// (we have no reinterpret_cast)
diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
index e1f1d3c..4cf8d56 100644
--- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
+++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
@@ -2028,8 +2028,8 @@ void tst_QSqlDatabase::mysql_multiselect()
QVERIFY_SQL(q, exec("select version()"));
QVERIFY_SQL(q, next());
QString version=tst_Databases::getMySqlVersion( db );
- int ver=version.section(QChar::fromLatin1('.'),0,1).toDouble();
- if (ver >= 4.1)
+ double ver=version.section(QChar::fromLatin1('.'),0,1).toDouble();
+ if (ver < 4.1)
QSKIP("Test requires MySQL >= 4.1", SkipSingle);
QVERIFY_SQL(q, exec("SELECT * FROM " + qTableName("qtest") + "; SELECT * FROM " + qTableName("qtest")));
diff --git a/tests/auto/selftests/tst_selftests.cpp b/tests/auto/selftests/tst_selftests.cpp
index 69b84e2..76a005b 100644
--- a/tests/auto/selftests/tst_selftests.cpp
+++ b/tests/auto/selftests/tst_selftests.cpp
@@ -184,9 +184,10 @@ void tst_Selftests::runSubTest_data()
QTest::newRow("benchliboptions") << "benchliboptions" << QStringList("-eventcounter");
QTest::newRow("benchlibwalltime") << "benchlibwalltime" << QStringList();
- //### QWS tests are currently run on a virtual machine, where ticks are not
- //### monotonously increasing
-#if defined(HAVE_TICK_COUNTER) && !defined(Q_WS_QWS)
+ //### This test is affected by the speed of the CPU and whether the tick counter is
+ //### monotonically increasing. It won't work on some machines so leave it off by default.
+ //### Feel free to uncomment for your own testing.
+#if 0
QTest::newRow("benchlibtickcounter") << "benchlibtickcounter" << QStringList("-tickcounter");
#endif
diff --git a/tests/auto/uic3/uic3.pro b/tests/auto/uic3/uic3.pro
index 520f95a..72a1304 100644
--- a/tests/auto/uic3/uic3.pro
+++ b/tests/auto/uic3/uic3.pro
@@ -6,3 +6,6 @@ TARGET = tst_uic3
# This test is not run on wince (I think)
DEFINES += SRCDIR=\\\"$$PWD\\\"
+
+requires(contains(QT_CONFIG,qt3support))
+
diff --git a/tools/assistant/tools/assistant/centralwidget.cpp b/tools/assistant/tools/assistant/centralwidget.cpp
index a384544..00a8893 100644
--- a/tools/assistant/tools/assistant/centralwidget.cpp
+++ b/tools/assistant/tools/assistant/centralwidget.cpp
@@ -739,8 +739,10 @@ void CentralWidget::setTabTitle(const QUrl &url)
QTabBar *tabBar = qFindChild<QTabBar*>(tabWidget);
for (int tab = 0; tab < tabBar->count(); ++tab) {
HelpViewer *viewer = qobject_cast<HelpViewer*>(tabWidget->widget(tab));
- if (viewer)
- tabWidget->setTabText(tab, viewer->documentTitle().trimmed());
+ if (viewer) {
+ tabWidget->setTabText(tab,
+ quoteTabTitle(viewer->documentTitle().trimmed()));
+ }
}
#else
HelpViewer *viewer = currentHelpViewer();