summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-06-04 17:24:49 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-06-04 17:24:49 (GMT)
commit5c17f3abe1c43539db613da78414bc0b27928814 (patch)
treeaeda95c710a5dd597d4e45a94f57729f0dc1a6dc /src
parentb70c535fb096652def0c4f6df6f9cd2827fa9c97 (diff)
parent398c022e8adefc6e71a6048da40c19f6169be831 (diff)
downloadQt-5c17f3abe1c43539db613da78414bc0b27928814.zip
Qt-5c17f3abe1c43539db613da78414bc0b27928814.tar.gz
Qt-5c17f3abe1c43539db613da78414bc0b27928814.tar.bz2
Merge commit 'origin/4.5'
Diffstat (limited to 'src')
-rw-r--r--src/corelib/codecs/qutfcodec.cpp2
-rw-r--r--src/corelib/kernel/qeventdispatcher_unix.cpp14
-rw-r--r--src/corelib/kernel/qobject.cpp3
-rw-r--r--src/corelib/kernel/qtranslator.cpp3
-rw-r--r--src/corelib/kernel/qtranslator_p.h1
-rw-r--r--src/dbus/qdbusmessage.cpp1
-rw-r--r--src/gui/dialogs/qcolordialog.cpp2
-rw-r--r--src/gui/dialogs/qfiledialog.cpp5
-rw-r--r--src/gui/dialogs/qfontdialog.cpp2
-rw-r--r--src/gui/dialogs/qinputdialog.cpp12
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp4
-rw-r--r--src/gui/painting/qpaintengine_x11.cpp17
-rw-r--r--src/gui/styles/qmotifstyle.cpp5
-rw-r--r--src/gui/widgets/qmenu_mac.mm52
-rw-r--r--src/gui/widgets/qprogressbar.cpp2
-rw-r--r--src/network/socket/qlocalsocket_win.cpp4
16 files changed, 90 insertions, 39 deletions
diff --git a/src/corelib/codecs/qutfcodec.cpp b/src/corelib/codecs/qutfcodec.cpp
index 1ac592e..d9defe1 100644
--- a/src/corelib/codecs/qutfcodec.cpp
+++ b/src/corelib/codecs/qutfcodec.cpp
@@ -478,7 +478,7 @@ QByteArray QUtf32Codec::convertFromUnicode(const QChar *uc, int len, ConverterSt
data[2] = 0;
data[3] = 0;
}
- data += 2;
+ data += 4;
}
if (endian == BE) {
for (int i = 0; i < len; ++i) {
diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp
index 1b9cb93..033225b 100644
--- a/src/corelib/kernel/qeventdispatcher_unix.cpp
+++ b/src/corelib/kernel/qeventdispatcher_unix.cpp
@@ -420,10 +420,18 @@ bool QTimerInfoList::timerWait(timeval &tm)
timeval currentTime = updateCurrentTime();
repairTimersIfNeeded();
- if (isEmpty())
- return false;
+ // Find first waiting timer not already active
+ QTimerInfo *t = 0;
+ for (QTimerInfoList::const_iterator it = constBegin(); it != constEnd(); ++it) {
+ if (!(*it)->inTimerEvent) {
+ t = *it;
+ break;
+ }
+ }
+
+ if (!t)
+ return false;
- QTimerInfo *t = first(); // first waiting timer
if (currentTime < t->timeout) {
// time to wait
tm = t->timeout - currentTime;
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 543422c..1501351 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -897,7 +897,8 @@ QObjectPrivate::Connection::~Connection()
\relates QObject
Returns the given \a object cast to type T if the object is of type
- T (or of a subclass); otherwise returns 0.
+ T (or of a subclass); otherwise returns 0. If \a object is 0 then
+ it will also return 0.
The class T must inherit (directly or indirectly) QObject and be
declared with the \l Q_OBJECT macro.
diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp
index 5ba9898..38fa216 100644
--- a/src/corelib/kernel/qtranslator.cpp
+++ b/src/corelib/kernel/qtranslator.cpp
@@ -149,6 +149,9 @@ static int numerusHelper(int n, const uchar *rules, int rulesSize)
leftOperand %= 10;
} else if (opcode & Q_MOD_100) {
leftOperand %= 100;
+ } else if (opcode & Q_LEAD_1000) {
+ while (leftOperand >= 1000)
+ leftOperand /= 1000;
}
int op = opcode & Q_OP_MASK;
diff --git a/src/corelib/kernel/qtranslator_p.h b/src/corelib/kernel/qtranslator_p.h
index 77ec8f5..a7d58c5 100644
--- a/src/corelib/kernel/qtranslator_p.h
+++ b/src/corelib/kernel/qtranslator_p.h
@@ -62,6 +62,7 @@ enum {
Q_NOT = 0x08,
Q_MOD_10 = 0x10,
Q_MOD_100 = 0x20,
+ Q_LEAD_1000 = 0x40,
Q_AND = 0xFD,
Q_OR = 0xFE,
diff --git a/src/dbus/qdbusmessage.cpp b/src/dbus/qdbusmessage.cpp
index 19f0b04..96dcd3b 100644
--- a/src/dbus/qdbusmessage.cpp
+++ b/src/dbus/qdbusmessage.cpp
@@ -161,7 +161,6 @@ DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message)
// not ok;
q_dbus_message_unref(msg);
- Q_ASSERT(false);
return 0;
}
diff --git a/src/gui/dialogs/qcolordialog.cpp b/src/gui/dialogs/qcolordialog.cpp
index 7e885da..dc7e3cc 100644
--- a/src/gui/dialogs/qcolordialog.cpp
+++ b/src/gui/dialogs/qcolordialog.cpp
@@ -1750,7 +1750,7 @@ void QColorDialog::setVisible(bool visible)
\overload
\since 4.5
- Opens the dialog and connects its accepted() signal to the slot specified
+ Opens the dialog and connects its colorSelected() signal to the slot specified
by \a receiver and \a member.
The signal will be disconnected from the slot when the dialog is closed.
diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp
index 76f0309..493cec5 100644
--- a/src/gui/dialogs/qfiledialog.cpp
+++ b/src/gui/dialogs/qfiledialog.cpp
@@ -638,8 +638,9 @@ QFileDialog::Options QFileDialog::options() const
\since 4.5
- Opens the dialog and connects its accepted() signal to the slot specified
- by \a receiver and \a member.
+ This function connects one of its signals to the slot specified by \a receiver
+ and \a member. The specific signal depends is filesSelected() if fileMode is
+ ExistingFiles and fileSelected() if fileMode is anything else.
The signal will be disconnected from the slot when the dialog is closed.
*/
diff --git a/src/gui/dialogs/qfontdialog.cpp b/src/gui/dialogs/qfontdialog.cpp
index c7484e7..3384132 100644
--- a/src/gui/dialogs/qfontdialog.cpp
+++ b/src/gui/dialogs/qfontdialog.cpp
@@ -940,7 +940,7 @@ bool QFontDialogPrivate::sharedFontPanelAvailable = true;
\since 4.5
\overload
- Opens the dialog and connects its accepted() signal to the slot specified
+ Opens the dialog and connects its fontSelected() signal to the slot specified
by \a receiver and \a member.
The signal will be disconnected from the slot when the dialog is closed.
diff --git a/src/gui/dialogs/qinputdialog.cpp b/src/gui/dialogs/qinputdialog.cpp
index 8608334..30f3151 100644
--- a/src/gui/dialogs/qinputdialog.cpp
+++ b/src/gui/dialogs/qinputdialog.cpp
@@ -1019,8 +1019,16 @@ QString QInputDialog::cancelButtonText() const
\since 4.5
\overload
- Opens the dialog and connects its accepted() signal to the slot specified
- by \a receiver and \a member.
+ This function connects one of its signals to the slot specified by \a receiver
+ and \a member. The specific signal depends on the arguments that are specified
+ in \a member. These are:
+
+ \list
+ \o textValueSelected() if \a member has a QString for its first argument.
+ \o intValueSelected() if \a member has an int for its first argument.
+ \o doubleValueSelected() if \a member has a double for its first argument.
+ \o accepted() if \a member has NO arguments.
+ \endlist
The signal will be disconnected from the slot when the dialog is closed.
*/
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 30c454c..0810bb9 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -1058,7 +1058,7 @@ void QRasterPaintEnginePrivate::drawImage(const QPointF &pt,
int d = x + iw - cx2;
iw -= d;
}
- if (iw < 0)
+ if (iw <= 0)
return;
// adapt the y paremeters...
@@ -1075,7 +1075,7 @@ void QRasterPaintEnginePrivate::drawImage(const QPointF &pt,
int d = y + ih - cy2;
ih -= d;
}
- if (ih < 0)
+ if (ih <= 0)
return;
// call the blend function...
diff --git a/src/gui/painting/qpaintengine_x11.cpp b/src/gui/painting/qpaintengine_x11.cpp
index 9cc9683..2e6d593 100644
--- a/src/gui/painting/qpaintengine_x11.cpp
+++ b/src/gui/painting/qpaintengine_x11.cpp
@@ -1826,9 +1826,10 @@ Q_GUI_EXPORT void qt_x11_drawImage(const QRect &rect, const QPoint &pos, const Q
const int h = rect.height();
QImage im;
- if ((QSysInfo::ByteOrder == QSysInfo::BigEndian
- && ((ImageByteOrder(X11->display) == LSBFirst) || bgr_layout))
- || (ImageByteOrder(X11->display) == MSBFirst && QSysInfo::ByteOrder == QSysInfo::LittleEndian))
+ int image_byte_order = ImageByteOrder(X11->display);
+ if ((QSysInfo::ByteOrder == QSysInfo::BigEndian && ((image_byte_order == LSBFirst) || bgr_layout))
+ || (image_byte_order == MSBFirst && QSysInfo::ByteOrder == QSysInfo::LittleEndian)
+ || (image_byte_order == LSBFirst && bgr_layout))
{
im = image.copy(rect);
const int iw = im.bytesPerLine() / 4;
@@ -1836,19 +1837,21 @@ Q_GUI_EXPORT void qt_x11_drawImage(const QRect &rect, const QPoint &pos, const Q
for (int i=0; i < h; i++) {
uint *p = data;
uint *end = p + w;
- if (bgr_layout && ImageByteOrder(X11->display) == MSBFirst && QSysInfo::ByteOrder == QSysInfo::LittleEndian) {
+ if (bgr_layout && image_byte_order == MSBFirst && QSysInfo::ByteOrder == QSysInfo::LittleEndian) {
while (p < end) {
*p = ((*p << 8) & 0xffffff00) | ((*p >> 24) & 0x000000ff);
p++;
}
- } else if ((ImageByteOrder(X11->display) == LSBFirst && QSysInfo::ByteOrder == QSysInfo::BigEndian)
- || (ImageByteOrder(X11->display) == MSBFirst && QSysInfo::ByteOrder == QSysInfo::LittleEndian)) {
+ } else if ((image_byte_order == LSBFirst && QSysInfo::ByteOrder == QSysInfo::BigEndian)
+ || (image_byte_order == MSBFirst && QSysInfo::ByteOrder == QSysInfo::LittleEndian)) {
while (p < end) {
*p = ((*p << 24) & 0xff000000) | ((*p << 8) & 0x00ff0000)
| ((*p >> 8) & 0x0000ff00) | ((*p >> 24) & 0x000000ff);
p++;
}
- } else if (ImageByteOrder(X11->display) == MSBFirst && QSysInfo::ByteOrder == QSysInfo::BigEndian) {
+ } else if ((image_byte_order == MSBFirst && QSysInfo::ByteOrder == QSysInfo::BigEndian)
+ || (image_byte_order == LSBFirst && bgr_layout))
+ {
while (p < end) {
*p = ((*p << 16) & 0x00ff0000) | ((*p >> 16) & 0x000000ff)
| ((*p ) & 0xff00ff00);
diff --git a/src/gui/styles/qmotifstyle.cpp b/src/gui/styles/qmotifstyle.cpp
index be0e3eb..d6b8a7a 100644
--- a/src/gui/styles/qmotifstyle.cpp
+++ b/src/gui/styles/qmotifstyle.cpp
@@ -298,8 +298,11 @@ void QMotifStyle::unpolish(QWidget* widget)
{
QCommonStyle::unpolish(widget);
#ifndef QT_NO_PROGRESSBAR
- if (qobject_cast<QProgressBar *>(widget))
+ if (qobject_cast<QProgressBar *>(widget)) {
+ Q_D(QMotifStyle);
widget->removeEventFilter(this);
+ d->bars.removeAll(static_cast<QProgressBar*>(widget));
+ }
#endif
}
diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm
index 786633c..67656b4 100644
--- a/src/gui/widgets/qmenu_mac.mm
+++ b/src/gui/widgets/qmenu_mac.mm
@@ -907,8 +907,6 @@ static NSMenuItem *qt_mac_menu_merge_action(OSMenuRef merge, QMacMenuAction *act
}
}
- if ([ret tag] != 0)
- ret = 0; // already taken
#endif
return ret;
}
@@ -1168,15 +1166,15 @@ QMenuPrivate::QMacMenuPrivate::addAction(QMacMenuAction *action, QMacMenuAction
GetMenuItemAttributes(action->menu, itemCount , &testattr);
if (mergedItems.contains(action->command)
&& (testattr & kMenuItemAttrSeparator)) {
- InsertMenuItemTextWithCFString(action->menu, 0, qMax(itemCount - 1, 0), attr, action->command);
- index = itemCount;
- } else {
- MenuItemIndex tmpIndex;
- AppendMenuItemTextWithCFString(action->menu, 0, attr, action->command, &tmpIndex);
- index = tmpIndex;
- if (mergedItems.contains(action->command))
- AppendMenuItemTextWithCFString(action->menu, 0, kMenuItemAttrSeparator, 0, &tmpIndex);
- }
+ InsertMenuItemTextWithCFString(action->menu, 0, qMax(itemCount - 1, 0), attr, action->command);
+ index = itemCount;
+ } else {
+ MenuItemIndex tmpIndex;
+ AppendMenuItemTextWithCFString(action->menu, 0, attr, action->command, &tmpIndex);
+ index = tmpIndex;
+ if (mergedItems.contains(action->command))
+ AppendMenuItemTextWithCFString(action->menu, 0, kMenuItemAttrSeparator, 0, &tmpIndex);
+ }
#else
[menu addItem:newItem];
#endif
@@ -1477,11 +1475,18 @@ QMenuPrivate::QMacMenuPrivate::removeAction(QMacMenuAction *action)
DeleteMenuItem(action->menu, qt_mac_menu_find_action(action->menu, action));
#else
QMacCocoaAutoReleasePool pool;
- QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader();
- if (action->menuItem == [loader quitMenuItem] || action->menuItem == [loader preferencesMenuItem])
- [action->menuItem setEnabled:false];
- else
+ if (action->merged) {
+ if (reinterpret_cast<QAction *>([action->menuItem tag]) == action->action) {
+ QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader();
+ [action->menuItem setEnabled:false];
+ if (action->menuItem != [loader quitMenuItem]
+ && action->menuItem != [loader preferencesMenuItem]) {
+ [[action->menuItem menu] removeItem:action->menuItem];
+ }
+ }
+ } else {
[[action->menuItem menu] removeItem:action->menuItem];
+ }
#endif
actionItems.removeAll(action);
}
@@ -1936,6 +1941,23 @@ bool QMenuBar::macUpdateMenuBar()
[loader ensureAppMenuInMenu:menu];
[NSApp setMainMenu:menu];
syncMenuBarItemsVisiblity(mb->d_func()->mac_menubar);
+
+ if (OSMenuRef tmpMerge = QMenuPrivate::mergeMenuHash.value(menu)) {
+ if (QMenuMergeList *mergeList
+ = QMenuPrivate::mergeMenuItemsHash.value(tmpMerge)) {
+ const int mergeListSize = mergeList->size();
+
+ for (int i = 0; i < mergeListSize; ++i) {
+ const QMenuMergeItem &mergeItem = mergeList->at(i);
+ // Ideally we would call QMenuPrivate::syncAction, but that requires finding
+ // the original QMen and likely doing more work than we need.
+ // For example, enabled is handled below.
+ [mergeItem.menuItem setTag:reinterpret_cast<long>(
+ static_cast<QAction *>(mergeItem.action->action))];
+ [mergeItem.menuItem setHidden:!(mergeItem.action->action->isVisible())];
+ }
+ }
+ }
#endif
QWidget *modalWidget = qApp->activeModalWidget();
if (mb != menubars()->value(modalWidget)) {
diff --git a/src/gui/widgets/qprogressbar.cpp b/src/gui/widgets/qprogressbar.cpp
index 804220d..adc3582 100644
--- a/src/gui/widgets/qprogressbar.cpp
+++ b/src/gui/widgets/qprogressbar.cpp
@@ -349,6 +349,8 @@ void QProgressBar::setRange(int minimum, int maximum)
\property QProgressBar::textVisible
\brief whether the current completed percentage should be displayed
+ This property may be ignored by the style (e.g., QMacStyle never draws the text).
+
\sa textDirection
*/
void QProgressBar::setTextVisible(bool visible)
diff --git a/src/network/socket/qlocalsocket_win.cpp b/src/network/socket/qlocalsocket_win.cpp
index 39c9284..ace3bc5 100644
--- a/src/network/socket/qlocalsocket_win.cpp
+++ b/src/network/socket/qlocalsocket_win.cpp
@@ -144,7 +144,7 @@ void QLocalSocket::connectToServer(const QString &name, OpenMode openMode)
0, // no sharing
NULL, // default security attributes
OPEN_EXISTING, // opens existing pipe
- 0, // default attributes
+ FILE_FLAG_OVERLAPPED,
NULL); // no template file
}, {
localSocket = CreateFileA(
@@ -153,7 +153,7 @@ void QLocalSocket::connectToServer(const QString &name, OpenMode openMode)
0, // no sharing
NULL, // default security attributes
OPEN_EXISTING, // opens existing pipe
- 0, // default attributes
+ FILE_FLAG_OVERLAPPED,
NULL); // no template file
});
if (localSocket != INVALID_HANDLE_VALUE)