summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2009-06-25 06:35:41 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2009-06-25 06:35:41 (GMT)
commita1ac8f5f657665a53855f085c6c03e0d5eff5f39 (patch)
treec89fa4e0b2920adf2db2fd75c51d5a47f941be1b /src
parent86b92bdef3dbf471662d0a65a21a3fb02424e0af (diff)
parent4e701b138de18491e43ede295aa41696f0751152 (diff)
downloadQt-a1ac8f5f657665a53855f085c6c03e0d5eff5f39.zip
Qt-a1ac8f5f657665a53855f085c6c03e0d5eff5f39.tar.gz
Qt-a1ac8f5f657665a53855f085c6c03e0d5eff5f39.tar.bz2
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'src')
-rw-r--r--src/corelib/arch/macosx/arch.pri7
-rw-r--r--src/corelib/concurrent/qtconcurrentthreadengine.h2
-rw-r--r--src/corelib/tools/qstring.cpp2
-rw-r--r--src/gui/dialogs/qcolordialog.cpp2
-rw-r--r--src/gui/text/qtextengine.cpp1
-rw-r--r--src/gui/widgets/qdockarealayout.cpp125
-rw-r--r--src/gui/widgets/qdockarealayout_p.h38
-rw-r--r--src/gui/widgets/qtoolbararealayout.cpp36
-rw-r--r--src/gui/widgets/qtoolbararealayout_p.h20
-rw-r--r--src/sql/drivers/ibase/qsql_ibase.cpp52
10 files changed, 153 insertions, 132 deletions
diff --git a/src/corelib/arch/macosx/arch.pri b/src/corelib/arch/macosx/arch.pri
index e42a962..a2b1bf7 100644
--- a/src/corelib/arch/macosx/arch.pri
+++ b/src/corelib/arch/macosx/arch.pri
@@ -1,7 +1,6 @@
#
# Mac OS X architecture
#
-!*-icc*:!*-g++* {
- contains($$list($$system(uname -m)), .*86):SOURCES += $$QT_ARCH_CPP/../i386/qatomic.s
- else:SOURCES += $$QT_ARCH_CPP/../powerpc/qatomic32.s
-}
+
+# Left blank intentionally since all the current compilers that we support can
+# handle in-line assembly.
diff --git a/src/corelib/concurrent/qtconcurrentthreadengine.h b/src/corelib/concurrent/qtconcurrentthreadengine.h
index 286c2b8..896b193 100644
--- a/src/corelib/concurrent/qtconcurrentthreadengine.h
+++ b/src/corelib/concurrent/qtconcurrentthreadengine.h
@@ -66,7 +66,7 @@ namespace QtConcurrent {
// The ThreadEngineBarrier counts worker threads, and allows one
// thread to wait for all others to finish. Tested for its use in
// QtConcurrent, requires more testing for use as a general class.
-class ThreadEngineBarrier
+class Q_CORE_EXPORT ThreadEngineBarrier
{
private:
// The thread count is maintained as an integer in the count atomic
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 3ff263d..71482f5 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -169,7 +169,7 @@ static int ucstricmp(const ushort *a, const ushort *ae, const uchar *b)
// Unicode case-insensitive comparison
static int ucstrcmp(const QChar *a, int alen, const QChar *b, int blen)
{
- if (a == b)
+ if (a == b && alen == blen)
return 0;
int l = qMin(alen, blen);
while (l-- && *a == *b)
diff --git a/src/gui/dialogs/qcolordialog.cpp b/src/gui/dialogs/qcolordialog.cpp
index 416e14a..42d3a9a 100644
--- a/src/gui/dialogs/qcolordialog.cpp
+++ b/src/gui/dialogs/qcolordialog.cpp
@@ -1262,7 +1262,7 @@ void QColorShower::retranslateStrings()
void QColorShower::updateQColor()
{
QColor oldQColor(curQColor);
- curQColor.setRgba(qRgba(qRed(curCol), qGreen(curCol), qBlue(curCol), qAlpha(curCol)));
+ curQColor.setRgba(qRgba(qRed(curCol), qGreen(curCol), qBlue(curCol), currentAlpha()));
if (curQColor != oldQColor)
emit currentColorChanged(curQColor);
}
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 829ac12..407fcb6 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -2210,6 +2210,7 @@ bool QTextEngine::atWordSeparator(int position) const
case '\'':
case '"':
case '~':
+ case '|':
return true;
default:
return false;
diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/gui/widgets/qdockarealayout.cpp
index cbfa5bf..ea5e323 100644
--- a/src/gui/widgets/qdockarealayout.cpp
+++ b/src/gui/widgets/qdockarealayout.cpp
@@ -994,15 +994,15 @@ void QDockAreaLayoutInfo::unnest(int index)
}
}
-void QDockAreaLayoutInfo::remove(QList<int> path)
+void QDockAreaLayoutInfo::remove(const QList<int> &path)
{
Q_ASSERT(!path.isEmpty());
if (path.count() > 1) {
- int index = path.takeFirst();
+ const int index = path.first();
QDockAreaLayoutItem &item = item_list[index];
Q_ASSERT(item.subinfo != 0);
- item.subinfo->remove(path);
+ item.subinfo->remove(path.mid(1));
unnest(index);
} else {
int index = path.first();
@@ -1010,18 +1010,18 @@ void QDockAreaLayoutInfo::remove(QList<int> path)
}
}
-QLayoutItem *QDockAreaLayoutInfo::plug(QList<int> path)
+QLayoutItem *QDockAreaLayoutInfo::plug(const QList<int> &path)
{
Q_ASSERT(!path.isEmpty());
- int index = path.takeFirst();
+ int index = path.first();
if (index < 0)
index = -index - 1;
- if (!path.isEmpty()) {
+ if (path.count() > 1) {
const QDockAreaLayoutItem &item = item_list.at(index);
Q_ASSERT(item.subinfo != 0);
- return item.subinfo->plug(path);
+ return item.subinfo->plug(path.mid(1));
}
QDockAreaLayoutItem &item = item_list[index];
@@ -1059,18 +1059,17 @@ QLayoutItem *QDockAreaLayoutInfo::plug(QList<int> path)
return item.widgetItem;
}
-QLayoutItem *QDockAreaLayoutInfo::unplug(QList<int> path)
+QLayoutItem *QDockAreaLayoutInfo::unplug(const QList<int> &path)
{
Q_ASSERT(!path.isEmpty());
+ const int index = path.first();
if (path.count() > 1) {
- int index = path.takeFirst();
const QDockAreaLayoutItem &item = item_list.at(index);
Q_ASSERT(item.subinfo != 0);
- return item.subinfo->unplug(path);
+ return item.subinfo->unplug(path.mid(1));
}
- int index = path.first();
QDockAreaLayoutItem &item = item_list[index];
int prev = this->prev(index);
int next = this->next(index);
@@ -1142,12 +1141,12 @@ static QRect dockedGeometry(QWidget *widget)
return result;
}
-bool QDockAreaLayoutInfo::insertGap(QList<int> path, QLayoutItem *dockWidgetItem)
+bool QDockAreaLayoutInfo::insertGap(const QList<int> &path, QLayoutItem *dockWidgetItem)
{
Q_ASSERT(!path.isEmpty());
bool insert_tabbed = false;
- int index = path.takeFirst();
+ int index = path.first();
if (index < 0) {
insert_tabbed = true;
index = -index - 1;
@@ -1155,7 +1154,7 @@ bool QDockAreaLayoutInfo::insertGap(QList<int> path, QLayoutItem *dockWidgetItem
// dump(qDebug() << "insertGap() before:" << index << tabIndex, *this, QString());
- if (!path.isEmpty()) {
+ if (path.count() > 1) {
QDockAreaLayoutItem &item = item_list[index];
if (item.subinfo == 0
@@ -1194,8 +1193,7 @@ bool QDockAreaLayoutInfo::insertGap(QList<int> path, QLayoutItem *dockWidgetItem
#endif
}
- bool result = item.subinfo->insertGap(path, dockWidgetItem);
- return result;
+ return item.subinfo->insertGap(path.mid(1), dockWidgetItem);
}
// create the gap item
@@ -1295,16 +1293,16 @@ QDockAreaLayoutInfo *QDockAreaLayoutInfo::info(QWidget *widget)
return 0;
}
-QDockAreaLayoutInfo *QDockAreaLayoutInfo::info(QList<int> path)
+QDockAreaLayoutInfo *QDockAreaLayoutInfo::info(const QList<int> &path)
{
- int index = path.takeFirst();
+ int index = path.first();
if (index < 0)
index = -index - 1;
if (index >= item_list.count())
return this;
- if (path.isEmpty() || item_list.at(index).subinfo == 0)
+ if (path.count() == 1 || item_list.at(index).subinfo == 0)
return this;
- return item_list.at(index).subinfo->info(path);
+ return item_list.at(index).subinfo->info(path.mid(1));
}
QRect QDockAreaLayoutInfo::itemRect(int index) const
@@ -1335,17 +1333,18 @@ QRect QDockAreaLayoutInfo::itemRect(int index) const
return result;
}
-QRect QDockAreaLayoutInfo::itemRect(QList<int> path) const
+QRect QDockAreaLayoutInfo::itemRect(const QList<int> &path) const
{
Q_ASSERT(!path.isEmpty());
+ const int index = path.first();
if (path.count() > 1) {
- const QDockAreaLayoutItem &item = item_list.at(path.takeFirst());
+ const QDockAreaLayoutItem &item = item_list.at(index);
Q_ASSERT(item.subinfo != 0);
- return item.subinfo->itemRect(path);
+ return item.subinfo->itemRect(path.mid(1));
}
- return itemRect(path.first());
+ return itemRect(index);
}
QRect QDockAreaLayoutInfo::separatorRect(int index) const
@@ -1367,16 +1366,17 @@ QRect QDockAreaLayoutInfo::separatorRect(int index) const
return QRect(pos, s);
}
-QRect QDockAreaLayoutInfo::separatorRect(QList<int> path) const
+QRect QDockAreaLayoutInfo::separatorRect(const QList<int> &path) const
{
Q_ASSERT(!path.isEmpty());
+ const int index = path.first();
if (path.count() > 1) {
- const QDockAreaLayoutItem &item = item_list.at(path.takeFirst());
+ const QDockAreaLayoutItem &item = item_list.at(index);
Q_ASSERT(item.subinfo != 0);
- return item.subinfo->separatorRect(path);
+ return item.subinfo->separatorRect(path.mid(1));
}
- return separatorRect(path.first());
+ return separatorRect(index);
}
QList<int> QDockAreaLayoutInfo::findSeparator(const QPoint &_pos) const
@@ -1702,15 +1702,16 @@ void QDockAreaLayoutInfo::split(int index, Qt::Orientation orientation,
}
}
-QDockAreaLayoutItem &QDockAreaLayoutInfo::item(QList<int> path)
+QDockAreaLayoutItem &QDockAreaLayoutInfo::item(const QList<int> &path)
{
Q_ASSERT(!path.isEmpty());
+ const int index = path.first();
if (path.count() > 1) {
- QDockAreaLayoutItem &item = item_list[path.takeFirst()];
+ const QDockAreaLayoutItem &item = item_list.at(index);
Q_ASSERT(item.subinfo != 0);
- return item.subinfo->item(path);
+ return item.subinfo->item(path.mid(1));
}
- return item_list[path.first()];
+ return item_list[index];
}
QLayoutItem *QDockAreaLayoutInfo::itemAt(int *x, int index) const
@@ -2474,37 +2475,37 @@ QDockAreaLayoutInfo *QDockAreaLayout::info(QWidget *widget)
return 0;
}
-QDockAreaLayoutInfo *QDockAreaLayout::info(QList<int> path)
+QDockAreaLayoutInfo *QDockAreaLayout::info(const QList<int> &path)
{
Q_ASSERT(!path.isEmpty());
- int index = path.takeFirst();
+ const int index = path.first();
Q_ASSERT(index >= 0 && index < QInternal::DockCount);
- if (path.isEmpty())
+ if (path.count() == 1)
return &docks[index];
- return docks[index].info(path);
+ return docks[index].info(path.mid(1));
}
-const QDockAreaLayoutInfo *QDockAreaLayout::info(QList<int> path) const
+const QDockAreaLayoutInfo *QDockAreaLayout::info(const QList<int> &path) const
{
return const_cast<QDockAreaLayout*>(this)->info(path);
}
-QDockAreaLayoutItem &QDockAreaLayout::item(QList<int> path)
+QDockAreaLayoutItem &QDockAreaLayout::item(const QList<int> &path)
{
Q_ASSERT(!path.isEmpty());
- int index = path.takeFirst();
+ const int index = path.first();
Q_ASSERT(index >= 0 && index < QInternal::DockCount);
- return docks[index].item(path);
+ return docks[index].item(path.mid(1));
}
-QRect QDockAreaLayout::itemRect(QList<int> path) const
+QRect QDockAreaLayout::itemRect(const QList<int> &path) const
{
Q_ASSERT(!path.isEmpty());
- int index = path.takeFirst();
+ const int index = path.first();
Q_ASSERT(index >= 0 && index < QInternal::DockCount);
- return docks[index].itemRect(path);
+ return docks[index].itemRect(path.mid(1));
}
QRect QDockAreaLayout::separatorRect(int index) const
@@ -2528,49 +2529,49 @@ QRect QDockAreaLayout::separatorRect(int index) const
return QRect();
}
-QRect QDockAreaLayout::separatorRect(QList<int> path) const
+QRect QDockAreaLayout::separatorRect(const QList<int> &path) const
{
Q_ASSERT(!path.isEmpty());
- int index = path.takeFirst();
+ const int index = path.first();
Q_ASSERT(index >= 0 && index < QInternal::DockCount);
- if (path.isEmpty())
+ if (path.count() == 1)
return separatorRect(index);
else
- return docks[index].separatorRect(path);
+ return docks[index].separatorRect(path.mid(1));
}
-bool QDockAreaLayout::insertGap(QList<int> path, QLayoutItem *dockWidgetItem)
+bool QDockAreaLayout::insertGap(const QList<int> &path, QLayoutItem *dockWidgetItem)
{
Q_ASSERT(!path.isEmpty());
- int index = path.takeFirst();
+ const int index = path.first();
Q_ASSERT(index >= 0 && index < QInternal::DockCount);
- return docks[index].insertGap(path, dockWidgetItem);
+ return docks[index].insertGap(path.mid(1), dockWidgetItem);
}
-QLayoutItem *QDockAreaLayout::plug(QList<int> path)
+QLayoutItem *QDockAreaLayout::plug(const QList<int> &path)
{
Q_ASSERT(!path.isEmpty());
- int index = path.takeFirst();
+ const int index = path.first();
Q_ASSERT(index >= 0 && index < QInternal::DockCount);
- return docks[index].plug(path);
+ return docks[index].plug(path.mid(1));
}
-QLayoutItem *QDockAreaLayout::unplug(QList<int> path)
+QLayoutItem *QDockAreaLayout::unplug(const QList<int> &path)
{
Q_ASSERT(!path.isEmpty());
- int index = path.takeFirst();
+ const int index = path.first();
Q_ASSERT(index >= 0 && index < QInternal::DockCount);
- return docks[index].unplug(path);
+ return docks[index].unplug(path.mid(1));
}
-void QDockAreaLayout::remove(QList<int> path)
+void QDockAreaLayout::remove(const QList<int> &path)
{
Q_ASSERT(!path.isEmpty());
- int index = path.takeFirst();
+ const int index = path.first();
Q_ASSERT(index >= 0 && index < QInternal::DockCount);
- docks[index].remove(path);
+ docks[index].remove(path.mid(1));
}
static inline int qMin(int i1, int i2, int i3) { return qMin(i1, qMin(i2, i3)); }
@@ -3111,14 +3112,12 @@ QRegion QDockAreaLayout::separatorRegion() const
return result;
}
-int QDockAreaLayout::separatorMove(QList<int> separator, const QPoint &origin,
+int QDockAreaLayout::separatorMove(const QList<int> &separator, const QPoint &origin,
const QPoint &dest)
{
int delta = 0;
int index = separator.last();
-
-
if (separator.count() > 1) {
QDockAreaLayoutInfo *info = this->info(separator);
delta = pick(info->o, dest - origin);
@@ -3255,7 +3254,7 @@ QSet<QWidget*> QDockAreaLayout::usedSeparatorWidgets() const
return result;
}
-QRect QDockAreaLayout::gapRect(QList<int> path) const
+QRect QDockAreaLayout::gapRect(const QList<int> &path) const
{
const QDockAreaLayoutInfo *info = this->info(path);
if (info == 0)
diff --git a/src/gui/widgets/qdockarealayout_p.h b/src/gui/widgets/qdockarealayout_p.h
index 771aa52..543a201 100644
--- a/src/gui/widgets/qdockarealayout_p.h
+++ b/src/gui/widgets/qdockarealayout_p.h
@@ -136,18 +136,18 @@ public:
QSize sizeHint() const;
QSize size() const;
- bool insertGap(QList<int> path, QLayoutItem *dockWidgetItem);
- QLayoutItem *plug(QList<int> path);
- QLayoutItem *unplug(QList<int> path);
+ bool insertGap(const QList<int> &path, QLayoutItem *dockWidgetItem);
+ QLayoutItem *plug(const QList<int> &path);
+ QLayoutItem *unplug(const QList<int> &path);
enum TabMode { NoTabs, AllowTabs, ForceTabs };
QList<int> gapIndex(const QPoint &pos, bool nestingEnabled,
TabMode tabMode) const;
- void remove(QList<int> path);
+ void remove(const QList<int> &path);
void unnest(int index);
void split(int index, Qt::Orientation orientation, QLayoutItem *dockWidgetItem);
void tab(int index, QLayoutItem *dockWidgetItem);
- QDockAreaLayoutItem &item(QList<int> path);
- QDockAreaLayoutInfo *info(QList<int> path);
+ QDockAreaLayoutItem &item(const QList<int> &path);
+ QDockAreaLayoutInfo *info(const QList<int> &path);
QDockAreaLayoutInfo *info(QWidget *widget);
enum { // sentinel values used to validate state data
@@ -162,9 +162,9 @@ public:
bool expansive(Qt::Orientation o) const;
int changeSize(int index, int size, bool below);
QRect itemRect(int index) const;
- QRect itemRect(QList<int> path) const;
+ QRect itemRect(const QList<int> &path) const;
QRect separatorRect(int index) const;
- QRect separatorRect(QList<int> path) const;
+ QRect separatorRect(const QList<int> &path) const;
void clear();
bool isEmpty() const;
@@ -246,18 +246,18 @@ public:
QList<int> gapIndex(const QPoint &pos) const;
QList<int> findSeparator(const QPoint &pos) const;
- QDockAreaLayoutItem &item(QList<int> path);
- QDockAreaLayoutInfo *info(QList<int> path);
- const QDockAreaLayoutInfo *info(QList<int> path) const;
+ QDockAreaLayoutItem &item(const QList<int> &path);
+ QDockAreaLayoutInfo *info(const QList<int> &path);
+ const QDockAreaLayoutInfo *info(const QList<int> &path) const;
QDockAreaLayoutInfo *info(QWidget *widget);
- QRect itemRect(QList<int> path) const;
+ QRect itemRect(const QList<int> &path) const;
QRect separatorRect(int index) const;
- QRect separatorRect(QList<int> path) const;
+ QRect separatorRect(const QList<int> &path) const;
- bool insertGap(QList<int> path, QLayoutItem *dockWidgetItem);
- QLayoutItem *plug(QList<int> path);
- QLayoutItem *unplug(QList<int> path);
- void remove(QList<int> path);
+ bool insertGap(const QList<int> &path, QLayoutItem *dockWidgetItem);
+ QLayoutItem *plug(const QList<int> &path);
+ QLayoutItem *unplug(const QList<int> &path);
+ void remove(const QList<int> &path);
void fitLayout();
@@ -277,7 +277,7 @@ public:
void paintSeparators(QPainter *p, QWidget *widget, const QRegion &clip,
const QPoint &mouse) const;
QRegion separatorRegion() const;
- int separatorMove(QList<int> separator, const QPoint &origin, const QPoint &dest);
+ int separatorMove(const QList<int> &separator, const QPoint &origin, const QPoint &dest);
void updateSeparatorWidgets() const;
QLayoutItem *itemAt(int *x, int index) const;
@@ -289,7 +289,7 @@ public:
void setGrid(QVector<QLayoutStruct> *ver_struct_list,
QVector<QLayoutStruct> *hor_struct_list);
- QRect gapRect(QList<int> path) const;
+ QRect gapRect(const QList<int> &path) const;
void keepSize(QDockWidget *w);
diff --git a/src/gui/widgets/qtoolbararealayout.cpp b/src/gui/widgets/qtoolbararealayout.cpp
index 8a10355..db2afd6 100644
--- a/src/gui/widgets/qtoolbararealayout.cpp
+++ b/src/gui/widgets/qtoolbararealayout.cpp
@@ -526,9 +526,10 @@ QList<int> QToolBarAreaLayoutInfo::gapIndex(const QPoint &pos) const
return QList<int>();
}
-bool QToolBarAreaLayoutInfo::insertGap(QList<int> path, QLayoutItem *item)
+bool QToolBarAreaLayoutInfo::insertGap(const QList<int> &path, QLayoutItem *item)
{
- int j = path.at(0);
+ Q_ASSERT(path.count() == 2);
+ int j = path.first();
if (j == lines.count())
lines.append(QToolBarAreaLayoutLine(o));
@@ -570,8 +571,9 @@ void QToolBarAreaLayoutInfo::clear()
rect = QRect();
}
-QRect QToolBarAreaLayoutInfo::itemRect(QList<int> path) const
+QRect QToolBarAreaLayoutInfo::itemRect(const QList<int> &path) const
{
+ Q_ASSERT(path.count() == 2);
int j = path.at(0);
int k = path.at(1);
@@ -623,10 +625,8 @@ QRect QToolBarAreaLayoutInfo::appendLineDropRect() const
** QToolBarAreaLayout
*/
-QToolBarAreaLayout::QToolBarAreaLayout(QMainWindow *win)
+QToolBarAreaLayout::QToolBarAreaLayout(const QMainWindow *win) : mainWindow(win), visible(true)
{
- visible = true;
- mainWindow = win;
for (int i = 0; i < QInternal::DockCount; ++i) {
QInternal::DockPosition pos = static_cast<QInternal::DockPosition>(i);
docks[i] = QToolBarAreaLayoutInfo(pos);
@@ -1064,16 +1064,17 @@ QList<int> QToolBarAreaLayout::currentGapIndex() const
return QList<int>();
}
-bool QToolBarAreaLayout::insertGap(QList<int> path, QLayoutItem *item)
+bool QToolBarAreaLayout::insertGap(const QList<int> &path, QLayoutItem *item)
{
- Q_ASSERT(!path.isEmpty());
- int i = path.takeFirst();
+ Q_ASSERT(path.count() == 3);
+ const int i = path.first();
Q_ASSERT(i >= 0 && i < QInternal::DockCount);
- return docks[i].insertGap(path, item);
+ return docks[i].insertGap(path.mid(1), item);
}
-void QToolBarAreaLayout::remove(QList<int> path)
+void QToolBarAreaLayout::remove(const QList<int> &path)
{
+ Q_ASSERT(path.count() == 3);
docks[path.at(0)].lines[path.at(1)].toolBarItems.removeAt(path.at(2));
}
@@ -1104,7 +1105,7 @@ void QToolBarAreaLayout::clear()
rect = QRect();
}
-QToolBarAreaLayoutItem &QToolBarAreaLayout::item(QList<int> path)
+QToolBarAreaLayoutItem &QToolBarAreaLayout::item(const QList<int> &path)
{
Q_ASSERT(path.count() == 3);
@@ -1116,18 +1117,18 @@ QToolBarAreaLayoutItem &QToolBarAreaLayout::item(QList<int> path)
return line.toolBarItems[path.at(2)];
}
-QRect QToolBarAreaLayout::itemRect(QList<int> path) const
+QRect QToolBarAreaLayout::itemRect(const QList<int> &path) const
{
- int i = path.takeFirst();
+ const int i = path.first();
- QRect r = docks[i].itemRect(path);
+ QRect r = docks[i].itemRect(path.mid(1));
if (docks[i].o == Qt::Horizontal)
r = QStyle::visualRect(mainWindow->layoutDirection(),
docks[i].rect, r);
return r;
}
-QLayoutItem *QToolBarAreaLayout::plug(QList<int> path)
+QLayoutItem *QToolBarAreaLayout::plug(const QList<int> &path)
{
QToolBarAreaLayoutItem &item = this->item(path);
Q_ASSERT(item.gap);
@@ -1136,9 +1137,10 @@ QLayoutItem *QToolBarAreaLayout::plug(QList<int> path)
return item.widgetItem;
}
-QLayoutItem *QToolBarAreaLayout::unplug(QList<int> path, QToolBarAreaLayout *other)
+QLayoutItem *QToolBarAreaLayout::unplug(const QList<int> &path, QToolBarAreaLayout *other)
{
//other needs to be update as well
+ Q_ASSERT(path.count() == 3);
QToolBarAreaLayoutItem &item = this->item(path);
//update the leading space here
diff --git a/src/gui/widgets/qtoolbararealayout_p.h b/src/gui/widgets/qtoolbararealayout_p.h
index a44fbc7..636c9ca 100644
--- a/src/gui/widgets/qtoolbararealayout_p.h
+++ b/src/gui/widgets/qtoolbararealayout_p.h
@@ -174,9 +174,9 @@ public:
void moveToolBar(QToolBar *toolbar, int pos);
QList<int> gapIndex(const QPoint &pos) const;
- bool insertGap(QList<int> path, QLayoutItem *item);
+ bool insertGap(const QList<int> &path, QLayoutItem *item);
void clear();
- QRect itemRect(QList<int> path) const;
+ QRect itemRect(const QList<int> &path) const;
QRect appendLineDropRect() const;
QRect rect;
@@ -194,11 +194,11 @@ public:
};
QRect rect;
- QMainWindow *mainWindow;
+ const QMainWindow *mainWindow;
QToolBarAreaLayoutInfo docks[4];
bool visible;
- QToolBarAreaLayout(QMainWindow *win);
+ QToolBarAreaLayout(const QMainWindow *win);
QRect fitLayout();
@@ -230,14 +230,14 @@ public:
QList<int> indexOf(QWidget *toolBar) const;
QList<int> gapIndex(const QPoint &pos) const;
QList<int> currentGapIndex() const;
- bool insertGap(QList<int> path, QLayoutItem *item);
- void remove(QList<int> path);
+ bool insertGap(const QList<int> &path, QLayoutItem *item);
+ void remove(const QList<int> &path);
void remove(QLayoutItem *item);
void clear();
- QToolBarAreaLayoutItem &item(QList<int> path);
- QRect itemRect(QList<int> path) const;
- QLayoutItem *plug(QList<int> path);
- QLayoutItem *unplug(QList<int> path, QToolBarAreaLayout *other);
+ QToolBarAreaLayoutItem &item(const QList<int> &path);
+ QRect itemRect(const QList<int> &path) const;
+ QLayoutItem *plug(const QList<int> &path);
+ QLayoutItem *unplug(const QList<int> &path, QToolBarAreaLayout *other);
void saveState(QDataStream &stream) const;
bool restoreState(QDataStream &stream, const QList<QToolBar*> &toolBars, uchar tmarker, bool pre43, bool testing = false);
diff --git a/src/sql/drivers/ibase/qsql_ibase.cpp b/src/sql/drivers/ibase/qsql_ibase.cpp
index d714327..893c98c 100644
--- a/src/sql/drivers/ibase/qsql_ibase.cpp
+++ b/src/sql/drivers/ibase/qsql_ibase.cpp
@@ -97,6 +97,7 @@ static bool getIBaseError(QString& msg, ISC_STATUS* status, ISC_LONG &sqlcode, Q
static void createDA(XSQLDA *&sqlda)
{
sqlda = (XSQLDA *) malloc(XSQLDA_LENGTH(1));
+ if (sqlda == (XSQLDA*)0) return;
sqlda->sqln = 1;
sqlda->sqld = 0;
sqlda->version = SQLDA_CURRENT_VERSION;
@@ -106,8 +107,10 @@ static void createDA(XSQLDA *&sqlda)
static void enlargeDA(XSQLDA *&sqlda, int n)
{
- free(sqlda);
+ if (sqlda != (XSQLDA*)0)
+ free(sqlda);
sqlda = (XSQLDA *) malloc(XSQLDA_LENGTH(n));
+ if (sqlda == (XSQLDA*)0) return;
sqlda->sqln = n;
sqlda->version = SQLDA_CURRENT_VERSION;
}
@@ -126,14 +129,14 @@ static void initDA(XSQLDA *sqlda)
case SQL_TYPE_DATE:
case SQL_TEXT:
case SQL_BLOB:
- sqlda->sqlvar[i].sqldata = (char*)malloc(sqlda->sqlvar[i].sqllen);
+ sqlda->sqlvar[i].sqldata = new char[sqlda->sqlvar[i].sqllen];
break;
case SQL_ARRAY:
- sqlda->sqlvar[i].sqldata = (char*)malloc(sizeof(ISC_QUAD));
+ sqlda->sqlvar[i].sqldata = new char[sizeof(ISC_QUAD)];
memset(sqlda->sqlvar[i].sqldata, 0, sizeof(ISC_QUAD));
break;
case SQL_VARYING:
- sqlda->sqlvar[i].sqldata = (char*)malloc(sqlda->sqlvar[i].sqllen + sizeof(short));
+ sqlda->sqlvar[i].sqldata = new char[sqlda->sqlvar[i].sqllen + sizeof(short)];
break;
default:
// not supported - do not bind.
@@ -141,7 +144,7 @@ static void initDA(XSQLDA *sqlda)
break;
}
if (sqlda->sqlvar[i].sqltype & 1) {
- sqlda->sqlvar[i].sqlind = (short*)malloc(sizeof(short));
+ sqlda->sqlvar[i].sqlind = new short[1];
*(sqlda->sqlvar[i].sqlind) = 0;
} else {
sqlda->sqlvar[i].sqlind = 0;
@@ -154,8 +157,8 @@ static void delDA(XSQLDA *&sqlda)
if (!sqlda)
return;
for (int i = 0; i < sqlda->sqld; ++i) {
- free(sqlda->sqlvar[i].sqlind);
- free(sqlda->sqlvar[i].sqldata);
+ delete sqlda->sqlvar[i].sqlind;
+ delete sqlda->sqlvar[i].sqldata;
}
free(sqlda);
sqlda = 0;
@@ -300,7 +303,7 @@ struct QIBaseEventBuffer {
#endif
ISC_LONG bufferLength;
ISC_LONG eventId;
-
+
enum QIBaseSubscriptionState { Starting, Subscribed, Finished };
QIBaseSubscriptionState subscriptionState;
};
@@ -451,8 +454,8 @@ QVariant QIBaseResultPrivate::fetchBlob(ISC_QUAD *bId)
}
ba.resize(read);
- bool isErr = (status[1] == isc_segstr_eof ? false :
- isError(QT_TRANSLATE_NOOP("QIBaseResult",
+ bool isErr = (status[1] == isc_segstr_eof ? false :
+ isError(QT_TRANSLATE_NOOP("QIBaseResult",
"Unable to read BLOB"),
QSqlError::StatementError));
@@ -519,7 +522,7 @@ static char* readArrayBuffer(QList<QVariant>& list, char *buffer, short curDim,
valList.append(tc->toUnicode(buffer, o));
else
valList.append(QString::fromUtf8(buffer, o));
-
+
buffer += strLen;
}
break; }
@@ -644,8 +647,8 @@ char* fillList<float>(char *buffer, const QList<QVariant> &list, float*)
return buffer;
}
-static char* qFillBufferWithString(char *buffer, const QString& string,
- short buflen, bool varying, bool array,
+static char* qFillBufferWithString(char *buffer, const QString& string,
+ short buflen, bool varying, bool array,
QTextCodec *tc)
{
QByteArray str = encodeString(tc, string); // keep a copy of the string alive in this scope
@@ -885,7 +888,16 @@ bool QIBaseResult::prepare(const QString& query)
setAt(QSql::BeforeFirstRow);
createDA(d->sqlda);
+ if (d->sqlda == (XSQLDA*)0) {
+ qWarning()<<"QIOBaseResult: createDA(): failed to allocate memory";
+ return false;
+ }
+
createDA(d->inda);
+ if (d->inda == (XSQLDA*)0){
+ qWarning()<<"QIOBaseResult: createDA(): failed to allocate memory";
+ return false;
+ }
if (!d->transaction())
return false;
@@ -906,6 +918,10 @@ bool QIBaseResult::prepare(const QString& query)
return false;
if (d->inda->sqld > d->inda->sqln) {
enlargeDA(d->inda, d->inda->sqld);
+ if (d->inda == (XSQLDA*)0) {
+ qWarning()<<"QIOBaseResult: enlargeDA(): failed to allocate memory";
+ return false;
+ }
isc_dsql_describe_bind(d->status, &d->stmt, FBVERSION, d->inda);
if (d->isError(QT_TRANSLATE_NOOP("QIBaseResult",
@@ -916,6 +932,10 @@ bool QIBaseResult::prepare(const QString& query)
if (d->sqlda->sqld > d->sqlda->sqln) {
// need more field descriptors
enlargeDA(d->sqlda, d->sqlda->sqld);
+ if (d->sqlda == (XSQLDA*)0) {
+ qWarning()<<"QIOBaseResult: enlargeDA(): failed to allocate memory";
+ return false;
+ }
isc_dsql_describe(d->status, &d->stmt, FBVERSION, d->sqlda);
if (d->isError(QT_TRANSLATE_NOOP("QIBaseResult", "Could not describe statement"),
@@ -983,14 +1003,14 @@ bool QIBaseResult::exec()
break;
case SQL_LONG:
if (d->inda->sqlvar[para].sqlscale < 0)
- *((long*)d->inda->sqlvar[para].sqldata) =
+ *((long*)d->inda->sqlvar[para].sqldata) =
(long)floor(0.5 + val.toDouble() * pow(10.0, d->inda->sqlvar[para].sqlscale * -1));
else
*((long*)d->inda->sqlvar[para].sqldata) = (long)val.toLongLong();
break;
case SQL_SHORT:
if (d->inda->sqlvar[para].sqlscale < 0)
- *((short*)d->inda->sqlvar[para].sqldata) =
+ *((short*)d->inda->sqlvar[para].sqldata) =
(short)floor(0.5 + val.toDouble() * pow(10.0, d->inda->sqlvar[para].sqlscale * -1));
else
*((short*)d->inda->sqlvar[para].sqldata) = (short)val.toInt();
@@ -1717,7 +1737,7 @@ static isc_callback qEventCallback(char *result, short length, char *updated)
qMutex()->lock();
QIBaseDriver *driver = qBufferDriverMap()->value(result);
qMutex()->unlock();
-
+
// We use an asynchronous call (i.e., queued connection) because the event callback
// is executed in a different thread than the one in which the driver lives.
if (driver)