diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-06-02 14:50:43 (GMT) |
---|---|---|
committer | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2009-06-02 14:50:43 (GMT) |
commit | e40d3cedcf29b89998ffc81f959b2b8523989394 (patch) | |
tree | 9c22c14049d67a9c4dc65675bb732366edb0af28 /src/gui | |
parent | 1a7da7096bbda17197738061902f4489af234bc0 (diff) | |
parent | a5b11b9031f9a2a97b65e9a6134244249845491a (diff) | |
download | Qt-e40d3cedcf29b89998ffc81f959b2b8523989394.zip Qt-e40d3cedcf29b89998ffc81f959b2b8523989394.tar.gz Qt-e40d3cedcf29b89998ffc81f959b2b8523989394.tar.bz2 |
Merge branch '4.5'
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 5 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_mac.mm | 5 | ||||
-rw-r--r-- | src/gui/painting/qpaintengine_raster.cpp | 15 | ||||
-rw-r--r-- | src/gui/text/qfontdatabase.cpp | 2 | ||||
-rw-r--r-- | src/gui/text/qfontdatabase_mac.cpp | 9 |
5 files changed, 12 insertions, 24 deletions
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index d436ffb..451686f 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -5757,8 +5757,9 @@ void QWidget::setFocus(Qt::FocusReason reason) void QWidget::clearFocus() { QWidget *w = this; - while (w && w->d_func()->focus_child == this) { - w->d_func()->focus_child = 0; + while (w) { + if (w->d_func()->focus_child == this) + w->d_func()->focus_child = 0; w = w->parentWidget(); } #ifndef QT_NO_GRAPHICSVIEW diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 8243f32..f389bfd 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -1304,8 +1304,11 @@ OSStatus QWidgetPrivate::qt_widget_event(EventHandlerCallRef er, EventRef event, if(part == kControlFocusNoPart){ if (widget->hasFocus()) QApplicationPrivate::setFocusWidget(0, Qt::OtherFocusReason); - } else + } else if (widget->focusPolicy() != Qt::NoFocus) { widget->setFocus(); + } else { + handled_event = false; + } } if(!HIObjectIsOfClass((HIObjectRef)hiview, kObjectQWidget)) CallNextEventHandler(er, event); diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 578a815..30c454c 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3917,11 +3917,7 @@ static void qt_merge_clip(const QClipData *c1, const QClipData *c2, QClipData *r { Q_ASSERT(c1->clipSpanHeight == c2->clipSpanHeight && c1->clipSpanHeight == result->clipSpanHeight); - // ### buffer overflow possible - const int BUFFER_SIZE = 4096; - int buffer[BUFFER_SIZE]; - int *b = buffer; - int bsize = BUFFER_SIZE; + QVarLengthArray<short, 4096> buffer; QClipData::ClipLine *c1ClipLines = const_cast<QClipData *>(c1)->clipLines(); QClipData::ClipLine *c2ClipLines = const_cast<QClipData *>(c2)->clipLines(); @@ -3948,11 +3944,8 @@ static void qt_merge_clip(const QClipData *c1, const QClipData *c2, QClipData *r // find required length int max = qMax(c1_spans[c1_count - 1].x + c1_spans[c1_count - 1].len, c2_spans[c2_count - 1].x + c2_spans[c2_count - 1].len); - if (max > bsize) { - b = (int *)realloc(bsize == BUFFER_SIZE ? 0 : b, max*sizeof(int)); - bsize = max; - } - memset(buffer, 0, BUFFER_SIZE * sizeof(int)); + buffer.resize(max); + memset(buffer.data(), 0, buffer.size() * sizeof(short)); // Fill with old spans. for (int i = 0; i < c1_count; ++i) { @@ -3988,8 +3981,6 @@ static void qt_merge_clip(const QClipData *c1, const QClipData *c2, QClipData *r result->appendSpan(sx, x - sx, y, coverage); } } - if (b != buffer) - free(b); } void QRasterPaintEnginePrivate::initializeRasterizer(QSpanData *data) diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index d3020b0..9c3c4a4 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -827,6 +827,7 @@ static void getEngineData(const QFontPrivate *d, const QFontCache::Key &key) d->engineData->ref.ref(); } } +#endif static QStringList familyList(const QFontDef &req) { @@ -855,7 +856,6 @@ static QStringList familyList(const QFontDef &req) return family_list; } -#endif Q_GLOBAL_STATIC(QFontDatabasePrivate, privateDb) Q_GLOBAL_STATIC_WITH_ARGS(QMutex, fontDatabaseMutex, (QMutex::Recursive)) diff --git a/src/gui/text/qfontdatabase_mac.cpp b/src/gui/text/qfontdatabase_mac.cpp index 80ddbd5..26d8687 100644 --- a/src/gui/text/qfontdatabase_mac.cpp +++ b/src/gui/text/qfontdatabase_mac.cpp @@ -281,14 +281,7 @@ void QFontDatabase::load(const QFontPrivate *d, int script) } //find the font - QStringList family_list = req.family.split(QLatin1Char(',')); - // append the substitute list for each family in family_list - { - QStringList subs_list; - for(QStringList::ConstIterator it = family_list.constBegin(); it != family_list.constEnd(); ++it) - subs_list += QFont::substitutes(*it); - family_list += subs_list; - } + QStringList family_list = familyList(req); const char *stylehint = styleHint(req); if (stylehint) |