summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-03-19 17:56:25 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-03-19 17:56:25 (GMT)
commit7706b14fbca90a339a4ed1e55549f100462f9df4 (patch)
tree21caee47118965b8bcfd8533f4581df398cd9546 /src
parent54839932adbddf68c78fd79d1b824ff1ad3f83b8 (diff)
parent695071d6ca899378afe1fcfa5c54fdbd840d7bce (diff)
downloadQt-7706b14fbca90a339a4ed1e55549f100462f9df4.zip
Qt-7706b14fbca90a339a4ed1e55549f100462f9df4.tar.gz
Qt-7706b14fbca90a339a4ed1e55549f100462f9df4.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2: fix QTabBar scroll button arrow position in Windows mobile style Revert "Optimize getting bearings of a glyph on Windows for true type fonts" stabilize tst_QAccessibility::comboBoxTest Better handling for NOTIFY in QGraphicsWidget regarding geometry changes Add NOTIFY to size property so QML bindings are working fine. Implement Q_PRIVATE_PROPERTY that allows you to declare properties fix PM_TabBarScrollButtonWidth pixel metric in Windows mobile style Stabilize taskQTBUG_7863_paintIntoCacheWithTransparentParts auto-test. Optimize getting bearings of a glyph on Windows for true type fonts Fixes blending problem when paiting non-opaque items with cache enabled. Optimize speed of QTextLayout and QPainter::drawText Fix a crash in animation groups when deleting uncontrolled animations
Diffstat (limited to 'src')
-rw-r--r--src/corelib/animation/qanimationgroup.cpp4
-rw-r--r--src/corelib/animation/qanimationgroup_p.h15
-rw-r--r--src/corelib/animation/qparallelanimationgroup.cpp15
-rw-r--r--src/corelib/animation/qparallelanimationgroup_p.h2
-rw-r--r--src/corelib/animation/qsequentialanimationgroup.cpp13
-rw-r--r--src/corelib/animation/qsequentialanimationgroup_p.h2
-rw-r--r--src/corelib/kernel/qobjectdefs.h2
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp6
-rw-r--r--src/gui/graphicsview/qgraphicswidget.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicswidget.h8
-rw-r--r--src/gui/styles/qwindowsmobilestyle.cpp17
-rw-r--r--src/gui/text/qtextlayout.cpp122
-rw-r--r--src/tools/moc/generator.cpp43
-rw-r--r--src/tools/moc/keywords.cpp30
-rw-r--r--src/tools/moc/moc.cpp44
-rw-r--r--src/tools/moc/moc.h4
-rw-r--r--src/tools/moc/token.cpp1
-rw-r--r--src/tools/moc/token.h1
-rw-r--r--src/tools/moc/util/generate_keywords.cpp2
19 files changed, 239 insertions, 94 deletions
diff --git a/src/corelib/animation/qanimationgroup.cpp b/src/corelib/animation/qanimationgroup.cpp
index a89f949..2decda3 100644
--- a/src/corelib/animation/qanimationgroup.cpp
+++ b/src/corelib/animation/qanimationgroup.cpp
@@ -244,7 +244,7 @@ QAbstractAnimation *QAnimationGroup::takeAnimation(int index)
// in ChildRemoved event
d->animations.removeAt(index);
animation->setParent(0);
- d->animationRemovedAt(index);
+ d->animationRemoved(index, animation);
return animation;
}
@@ -285,7 +285,7 @@ bool QAnimationGroup::event(QEvent *event)
}
-void QAnimationGroupPrivate::animationRemovedAt(int index)
+void QAnimationGroupPrivate::animationRemoved(int index, QAbstractAnimation *)
{
Q_Q(QAnimationGroup);
Q_UNUSED(index);
diff --git a/src/corelib/animation/qanimationgroup_p.h b/src/corelib/animation/qanimationgroup_p.h
index 394773b..45603b3 100644
--- a/src/corelib/animation/qanimationgroup_p.h
+++ b/src/corelib/animation/qanimationgroup_p.h
@@ -72,8 +72,19 @@ public:
isGroup = true;
}
- virtual void animationInsertedAt(int index) { Q_UNUSED(index) };
- virtual void animationRemovedAt(int index);
+ virtual void animationInsertedAt(int) { }
+ virtual void animationRemoved(int, QAbstractAnimation *);
+
+ void disconnectUncontrolledAnimation(QAbstractAnimation *anim)
+ {
+ //0 for the signal here because we might be called from the animation destructor
+ QObject::disconnect(anim, 0, q_func(), SLOT(_q_uncontrolledAnimationFinished()));
+ }
+
+ void connectUncontrolledAnimation(QAbstractAnimation *anim)
+ {
+ QObject::connect(anim, SIGNAL(finished()), q_func(), SLOT(_q_uncontrolledAnimationFinished()));
+ }
QList<QAbstractAnimation *> animations;
};
diff --git a/src/corelib/animation/qparallelanimationgroup.cpp b/src/corelib/animation/qparallelanimationgroup.cpp
index eaa0364..280afed 100644
--- a/src/corelib/animation/qparallelanimationgroup.cpp
+++ b/src/corelib/animation/qparallelanimationgroup.cpp
@@ -246,11 +246,9 @@ void QParallelAnimationGroupPrivate::_q_uncontrolledAnimationFinished()
void QParallelAnimationGroupPrivate::disconnectUncontrolledAnimations()
{
- Q_Q(QParallelAnimationGroup);
-
QHash<QAbstractAnimation *, int>::iterator it = uncontrolledFinishTime.begin();
while (it != uncontrolledFinishTime.end()) {
- QObject::disconnect(it.key(), SIGNAL(finished()), q, SLOT(_q_uncontrolledAnimationFinished()));
+ disconnectUncontrolledAnimation(it.key());
++it;
}
@@ -259,13 +257,11 @@ void QParallelAnimationGroupPrivate::disconnectUncontrolledAnimations()
void QParallelAnimationGroupPrivate::connectUncontrolledAnimations()
{
- Q_Q(QParallelAnimationGroup);
-
for (int i = 0; i < animations.size(); ++i) {
QAbstractAnimation *animation = animations.at(i);
if (animation->duration() == -1 || animation->loopCount() < 0) {
uncontrolledFinishTime[animation] = -1;
- QObject::connect(animation, SIGNAL(finished()), q, SLOT(_q_uncontrolledAnimationFinished()));
+ connectUncontrolledAnimation(animation);
}
}
}
@@ -305,6 +301,13 @@ bool QParallelAnimationGroupPrivate::isUncontrolledAnimationFinished(QAbstractAn
return uncontrolledFinishTime.value(anim, -1) >= 0;
}
+void QParallelAnimationGroupPrivate::animationRemoved(int index, QAbstractAnimation *anim)
+{
+ QAnimationGroupPrivate::animationRemoved(index, anim);
+ disconnectUncontrolledAnimation(anim);
+ uncontrolledFinishTime.remove(anim);
+}
+
/*!
\reimp
*/
diff --git a/src/corelib/animation/qparallelanimationgroup_p.h b/src/corelib/animation/qparallelanimationgroup_p.h
index a74d496..cab4fa9 100644
--- a/src/corelib/animation/qparallelanimationgroup_p.h
+++ b/src/corelib/animation/qparallelanimationgroup_p.h
@@ -80,6 +80,8 @@ public:
void connectUncontrolledAnimations();
void disconnectUncontrolledAnimations();
+ void animationRemoved(int index, QAbstractAnimation *);
+
// private slot
void _q_uncontrolledAnimationFinished();
};
diff --git a/src/corelib/animation/qsequentialanimationgroup.cpp b/src/corelib/animation/qsequentialanimationgroup.cpp
index 8ab084a..7617c1f 100644
--- a/src/corelib/animation/qsequentialanimationgroup.cpp
+++ b/src/corelib/animation/qsequentialanimationgroup.cpp
@@ -479,7 +479,7 @@ void QSequentialAnimationGroupPrivate::activateCurrentAnimation(bool intermediat
// connects to the finish signal of uncontrolled animations
if (currentAnimation->totalDuration() == -1)
- QObject::connect(currentAnimation, SIGNAL(finished()), q, SLOT(_q_uncontrolledAnimationFinished()));
+ connectUncontrolledAnimation(currentAnimation);
currentAnimation->start();
if (!intermediate && state == QSequentialAnimationGroup::Paused)
@@ -496,7 +496,7 @@ void QSequentialAnimationGroupPrivate::_q_uncontrolledAnimationFinished()
actualDuration.append(-1);
actualDuration[currentAnimationIndex] = currentAnimation->currentTime();
- QObject::disconnect(currentAnimation, SIGNAL(finished()), q, SLOT(_q_uncontrolledAnimationFinished()));
+ disconnectUncontrolledAnimation(currentAnimation);
if ((direction == QAbstractAnimation::Forward && currentAnimation == animations.last())
|| (direction == QAbstractAnimation::Backward && currentAnimationIndex == 0)) {
@@ -543,10 +543,10 @@ void QSequentialAnimationGroupPrivate::animationInsertedAt(int index)
the group at index \a index. The animation is no more listed when this
method is called.
*/
-void QSequentialAnimationGroupPrivate::animationRemovedAt(int index)
+void QSequentialAnimationGroupPrivate::animationRemoved(int index, QAbstractAnimation *anim)
{
Q_Q(QSequentialAnimationGroup);
- QAnimationGroupPrivate::animationRemovedAt(index);
+ QAnimationGroupPrivate::animationRemoved(index, anim);
Q_ASSERT(currentAnimation); // currentAnimation should always be set
@@ -555,7 +555,10 @@ void QSequentialAnimationGroupPrivate::animationRemovedAt(int index)
const int currentIndex = animations.indexOf(currentAnimation);
if (currentIndex == -1) {
- //we're removing the current animation, let's update it to another one
+ //we're removing the current animation
+
+ disconnectUncontrolledAnimation(currentAnimation);
+
if (index < animations.count())
setCurrentAnimation(index); //let's try to take the next one
else if (index > 0)
diff --git a/src/corelib/animation/qsequentialanimationgroup_p.h b/src/corelib/animation/qsequentialanimationgroup_p.h
index a55e136..de69916 100644
--- a/src/corelib/animation/qsequentialanimationgroup_p.h
+++ b/src/corelib/animation/qsequentialanimationgroup_p.h
@@ -85,7 +85,7 @@ public:
void activateCurrentAnimation(bool intermediate = false);
void animationInsertedAt(int index);
- void animationRemovedAt(int index);
+ void animationRemoved(int index, QAbstractAnimation *anim);
bool atEnd() const;
diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h
index 8ed7f3f..f496354 100644
--- a/src/corelib/kernel/qobjectdefs.h
+++ b/src/corelib/kernel/qobjectdefs.h
@@ -78,6 +78,7 @@ class QString;
#define Q_CLASSINFO(name, value)
#define Q_INTERFACES(x)
#define Q_PROPERTY(text)
+#define Q_PRIVATE_PROPERTY(d, text)
#define Q_OVERRIDE(text)
#define Q_ENUMS(x)
#define Q_FLAGS(x)
@@ -178,6 +179,7 @@ private:
#define Q_CLASSINFO(name, value) Q_CLASSINFO(name, value)
#define Q_INTERFACES(x) Q_INTERFACES(x)
#define Q_PROPERTY(text) Q_PROPERTY(text)
+#define Q_PRIVATE_PROPERTY(d, text) Q_PRIVATE_PROPERTY(d, text)
#define Q_OVERRIDE(text) Q_OVERRIDE(text)
#define Q_ENUMS(x) Q_ENUMS(x)
#define Q_FLAGS(x) Q_FLAGS(x)
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 4ee2301..6934abc 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -4285,6 +4285,12 @@ static void _q_paintIntoCache(QPixmap *pix, QGraphicsItem *item, const QRegion &
if (!subPix.isNull()) {
// Blit the subpixmap into the main pixmap.
pixmapPainter.begin(pix);
+ if (item->cacheMode() == QGraphicsItem::DeviceCoordinateCache
+ && itemToPixmap.type() > QTransform::TxTranslate) {
+ pixmapPainter.setCompositionMode(QPainter::CompositionMode_SourceAtop);
+ } else {
+ pixmapPainter.setCompositionMode(QPainter::CompositionMode_Source);
+ }
pixmapPainter.setClipRegion(pixmapExposed);
pixmapPainter.drawPixmap(br.topLeft(), subPix);
pixmapPainter.end();
diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp
index 5e01785..f42fe4f 100644
--- a/src/gui/graphicsview/qgraphicswidget.cpp
+++ b/src/gui/graphicsview/qgraphicswidget.cpp
@@ -384,7 +384,7 @@ void QGraphicsWidget::setGeometry(const QRectF &rect)
}
QSizeF oldSize = size();
QGraphicsLayoutItem::setGeometry(newGeom);
-
+ emit geometryChanged();
// Send resize event
bool resized = newGeom.size() != oldSize;
if (resized) {
diff --git a/src/gui/graphicsview/qgraphicswidget.h b/src/gui/graphicsview/qgraphicswidget.h
index f1d382b..468a134 100644
--- a/src/gui/graphicsview/qgraphicswidget.h
+++ b/src/gui/graphicsview/qgraphicswidget.h
@@ -73,7 +73,7 @@ class Q_GUI_EXPORT QGraphicsWidget : public QGraphicsObject, public QGraphicsLay
Q_PROPERTY(QPalette palette READ palette WRITE setPalette)
Q_PROPERTY(QFont font READ font WRITE setFont)
Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection RESET unsetLayoutDirection)
- Q_PROPERTY(QSizeF size READ size WRITE resize)
+ Q_PROPERTY(QSizeF size READ size WRITE resize NOTIFY geometryChanged)
Q_PROPERTY(QSizeF minimumSize READ minimumSize WRITE setMinimumSize)
Q_PROPERTY(QSizeF preferredSize READ preferredSize WRITE setPreferredSize)
Q_PROPERTY(QSizeF maximumSize READ maximumSize WRITE setMaximumSize)
@@ -81,11 +81,10 @@ class Q_GUI_EXPORT QGraphicsWidget : public QGraphicsObject, public QGraphicsLay
Q_PROPERTY(Qt::FocusPolicy focusPolicy READ focusPolicy WRITE setFocusPolicy)
Q_PROPERTY(Qt::WindowFlags windowFlags READ windowFlags WRITE setWindowFlags)
Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle)
- Q_PROPERTY(QRectF geometry READ geometry WRITE setGeometry)
+ Q_PROPERTY(QRectF geometry READ geometry WRITE setGeometry NOTIFY geometryChanged)
public:
QGraphicsWidget(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0);
~QGraphicsWidget();
-
QGraphicsLayout *layout() const;
void setLayout(QGraphicsLayout *layout);
void adjustSize();
@@ -175,6 +174,9 @@ public:
using QObject::children;
#endif
+Q_SIGNALS:
+ void geometryChanged();
+
public Q_SLOTS:
bool close();
diff --git a/src/gui/styles/qwindowsmobilestyle.cpp b/src/gui/styles/qwindowsmobilestyle.cpp
index 6e77409..5f939d0 100644
--- a/src/gui/styles/qwindowsmobilestyle.cpp
+++ b/src/gui/styles/qwindowsmobilestyle.cpp
@@ -5076,6 +5076,10 @@ void QWindowsMobileStyle::drawPrimitive(PrimitiveElement element, const QStyleOp
color = option->palette.buttonText().color();
QImage image;
int xoffset, yoffset;
+ bool isTabBarArrow = widget && widget->parent()
+ && widget->inherits("QToolButton")
+ && widget->parent()->inherits("QTabBar");
+
switch (element) {
case PE_IndicatorArrowUp:
image = d->imageArrowUp;
@@ -5090,12 +5094,12 @@ void QWindowsMobileStyle::drawPrimitive(PrimitiveElement element, const QStyleOp
case PE_IndicatorArrowLeft:
image = d->imageArrowLeft;
xoffset = 8;
- yoffset = 2;
+ yoffset = isTabBarArrow ? 12 : 2;
break;
case PE_IndicatorArrowRight:
image = d->imageArrowRight;
xoffset = 8;
- yoffset = 2;
+ yoffset = isTabBarArrow ? 12 : 2;
break;
case PE_IndicatorArrowUpBig:
image = d->imageArrowUpBig;
@@ -6949,10 +6953,11 @@ int QWindowsMobileStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, co
case PM_SliderThickness:
ret = d->doubleControls ? windowsMobileSliderThickness * 2: windowsMobileSliderThickness;
break;
- case PM_TabBarScrollButtonWidth:
- ret = d->doubleControls ? 14 * 2 : 18;
- case PM_CheckBoxLabelSpacing:
- case PM_RadioButtonLabelSpacing:
+ case PM_TabBarScrollButtonWidth:
+ ret = d->doubleControls ? 14 * 2 : 18;
+ break;
+ case PM_CheckBoxLabelSpacing:
+ case PM_RadioButtonLabelSpacing:
ret = d->doubleControls ? 6 * 2 : 6;
break;
// Returns the number of pixels to use for the business part of the
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index af91603..204effa 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -1644,28 +1644,67 @@ namespace {
struct LineBreakHelper
{
- LineBreakHelper() : glyphCount(0), maxGlyphs(0), manualWrap(false) {}
+ LineBreakHelper()
+ : glyphCount(0), maxGlyphs(0), currentPosition(0), fontEngine(0), logClusters(0),
+ manualWrap(false)
+ {
+ }
+
QScriptLine tmpData;
QScriptLine spaceData;
+ QGlyphLayout glyphs;
+
int glyphCount;
int maxGlyphs;
+ int currentPosition;
QFixed minw;
QFixed softHyphenWidth;
QFixed rightBearing;
+ QFixed minimumRightBearing;
+
+ QFontEngine *fontEngine;
+ const unsigned short *logClusters;
bool manualWrap;
bool checkFullOtherwiseExtend(QScriptLine &line);
+
+ QFixed calculateNewWidth(const QScriptLine &line) const {
+ return line.textWidth + tmpData.textWidth + spaceData.textWidth + softHyphenWidth
+ - qMin(rightBearing, QFixed());
+ }
+
+ inline glyph_t currentGlyph() const
+ {
+ Q_ASSERT(currentPosition > 0);
+ return glyphs.glyphs[logClusters[currentPosition - 1]];
+ }
+
+ inline void adjustRightBearing()
+ {
+ if (currentPosition <= 0)
+ return;
+
+ glyph_metrics_t gi = fontEngine->boundingBox(currentGlyph());
+ if (gi.isValid())
+ rightBearing = qMin(QFixed(), gi.xoff - gi.x - gi.width);
+ }
+
+ inline void resetRightBearing()
+ {
+ rightBearing = QFixed(1); // Any positive number is defined as invalid since only
+ // negative right bearings are interesting to us.
+ }
};
inline bool LineBreakHelper::checkFullOtherwiseExtend(QScriptLine &line)
{
LB_DEBUG("possible break width %f, spacew=%f", tmpData.textWidth.toReal(), spaceData.textWidth.toReal());
- QFixed newWidth = line.textWidth + tmpData.textWidth + spaceData.textWidth + softHyphenWidth + rightBearing;
+ QFixed newWidth = calculateNewWidth(line);
if (line.length && !manualWrap && (newWidth > line.width || glyphCount > maxGlyphs))
return true;
@@ -1741,13 +1780,12 @@ void QTextLine::layout_helper(int maxGlyphs)
Qt::Alignment alignment = eng->option.alignment();
const HB_CharAttributes *attributes = eng->attributes();
- int pos = line.from;
+ lbh.currentPosition = line.from;
int end = 0;
- QGlyphLayout glyphs;
- const unsigned short *logClusters = eng->layoutData->logClustersPtr;
+ lbh.logClusters = eng->layoutData->logClustersPtr;
while (newItem < eng->layoutData->items.size()) {
- lbh.rightBearing = 0;
+ lbh.resetRightBearing();
lbh.softHyphenWidth = 0;
if (newItem != item) {
item = newItem;
@@ -1755,13 +1793,19 @@ void QTextLine::layout_helper(int maxGlyphs)
if (!current.num_glyphs) {
eng->shape(item);
attributes = eng->attributes();
- logClusters = eng->layoutData->logClustersPtr;
+ lbh.logClusters = eng->layoutData->logClustersPtr;
}
- pos = qMax(line.from, current.position);
+ lbh.currentPosition = qMax(line.from, current.position);
end = current.position + eng->length(item);
- glyphs = eng->shapedGlyphs(&current);
+ lbh.glyphs = eng->shapedGlyphs(&current);
}
const QScriptItem &current = eng->layoutData->items[item];
+ QFontEngine *fontEngine = eng->fontEngine(current);
+ if (lbh.fontEngine != fontEngine) {
+ lbh.fontEngine = fontEngine;
+ lbh.minimumRightBearing = qMin(QFixed(),
+ QFixed::fromReal(fontEngine->minRightBearing()));
+ }
lbh.tmpData.leading = qMax(lbh.tmpData.leading + lbh.tmpData.ascent,
current.leading + current.ascent) - qMax(lbh.tmpData.ascent,
@@ -1791,8 +1835,8 @@ void QTextLine::layout_helper(int maxGlyphs)
if (!line.length && !lbh.tmpData.length)
line.setDefaultHeight(eng);
if (eng->option.flags() & QTextOption::ShowLineAndParagraphSeparators) {
- addNextCluster(pos, end, lbh.tmpData, lbh.glyphCount,
- current, logClusters, glyphs);
+ addNextCluster(lbh.currentPosition, end, lbh.tmpData, lbh.glyphCount,
+ current, lbh.logClusters, lbh.glyphs);
} else {
lbh.tmpData.length++;
}
@@ -1811,10 +1855,10 @@ void QTextLine::layout_helper(int maxGlyphs)
++lbh.glyphCount;
if (lbh.checkFullOtherwiseExtend(line))
goto found;
- } else if (attributes[pos].whiteSpace) {
- while (pos < end && attributes[pos].whiteSpace)
- addNextCluster(pos, end, lbh.spaceData, lbh.glyphCount,
- current, logClusters, glyphs);
+ } else if (attributes[lbh.currentPosition].whiteSpace) {
+ while (lbh.currentPosition < end && attributes[lbh.currentPosition].whiteSpace)
+ addNextCluster(lbh.currentPosition, end, lbh.spaceData, lbh.glyphCount,
+ current, lbh.logClusters, lbh.glyphs);
if (!lbh.manualWrap && lbh.spaceData.textWidth > line.width) {
lbh.spaceData.textWidth = line.width; // ignore spaces that fall out of the line.
@@ -1823,19 +1867,19 @@ void QTextLine::layout_helper(int maxGlyphs)
} else {
bool sb_or_ws = false;
do {
- addNextCluster(pos, end, lbh.tmpData, lbh.glyphCount,
- current, logClusters, glyphs);
+ addNextCluster(lbh.currentPosition, end, lbh.tmpData, lbh.glyphCount,
+ current, lbh.logClusters, lbh.glyphs);
- if (attributes[pos].whiteSpace || attributes[pos-1].lineBreakType != HB_NoBreak) {
+ if (attributes[lbh.currentPosition].whiteSpace || attributes[lbh.currentPosition-1].lineBreakType != HB_NoBreak) {
sb_or_ws = true;
break;
- } else if (breakany && attributes[pos].charStop) {
+ } else if (breakany && attributes[lbh.currentPosition].charStop) {
break;
}
- } while (pos < end);
+ } while (lbh.currentPosition < end);
lbh.minw = qMax(lbh.tmpData.textWidth, lbh.minw);
- if (pos && attributes[pos - 1].lineBreakType == HB_SoftHyphen) {
+ if (lbh.currentPosition && attributes[lbh.currentPosition - 1].lineBreakType == HB_SoftHyphen) {
// if we are splitting up a word because of
// a soft hyphen then we ...
//
@@ -1853,41 +1897,39 @@ void QTextLine::layout_helper(int maxGlyphs)
// and thus become invisible again.
//
if (line.length)
- lbh.softHyphenWidth = glyphs.advances_x[logClusters[pos - 1]];
+ lbh.softHyphenWidth = lbh.glyphs.advances_x[lbh.logClusters[lbh.currentPosition - 1]];
else if (breakany)
- lbh.tmpData.textWidth += glyphs.advances_x[logClusters[pos - 1]];
+ lbh.tmpData.textWidth += lbh.glyphs.advances_x[lbh.logClusters[lbh.currentPosition - 1]];
}
// The actual width of the text needs to take the right bearing into account. The
// right bearing is left-ward, which means that if the rightmost pixel is to the right
// of the advance of the glyph, the bearing will be negative. We flip the sign
// for the code to be more readable. Logic borrowed from qfontmetrics.cpp.
- if (pos) {
- QFontEngine *fontEngine = eng->fontEngine(current);
- glyph_t glyph = glyphs.glyphs[logClusters[pos - 1]];
- glyph_metrics_t gi = fontEngine->boundingBox(glyph);
- if (gi.isValid())
- lbh.rightBearing = qMax(QFixed(), -(gi.xoff - gi.x - gi.width));
- }
+ // We ignore the right bearing if the minimum negative bearing is too little to
+ // expand the text beyond the edge.
+ if (sb_or_ws|breakany) {
+ if (lbh.calculateNewWidth(line) + lbh.minimumRightBearing > line.width)
+ lbh.adjustRightBearing();
+ if (lbh.checkFullOtherwiseExtend(line)) {
+ if (!breakany) {
+ line.textWidth += lbh.softHyphenWidth;
+ }
- if ((sb_or_ws|breakany) && lbh.checkFullOtherwiseExtend(line)) {
- if (!breakany) {
- line.textWidth += lbh.softHyphenWidth;
+ goto found;
}
-
- line.textWidth += lbh.rightBearing;
-
- goto found;
}
}
- if (pos == end)
+ if (lbh.currentPosition == end)
newItem = item + 1;
}
LB_DEBUG("reached end of line");
lbh.checkFullOtherwiseExtend(line);
- line.textWidth += lbh.rightBearing;
-
found:
+ if (lbh.rightBearing > 0) // If right bearing has not yet been adjusted
+ lbh.adjustRightBearing();
+ line.textWidth -= qMin(QFixed(), lbh.rightBearing);
+
if (line.length == 0) {
LB_DEBUG("no break available in line, adding temp: length %d, width %f, space: length %d, width %f",
lbh.tmpData.length, lbh.tmpData.textWidth.toReal(),
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp
index 982d95f5..ff8029b 100644
--- a/src/tools/moc/generator.cpp
+++ b/src/tools/moc/generator.cpp
@@ -738,18 +738,23 @@ void Generator::generateMetacall()
const PropertyDef &p = cdef->propertyList.at(propindex);
if (p.read.isEmpty())
continue;
+ QByteArray prefix;
+ if (p.inPrivateClass.size()) {
+ prefix = p.inPrivateClass;
+ prefix.append("->");
+ }
if (p.gspec == PropertyDef::PointerSpec)
- fprintf(out, " case %d: _a[0] = const_cast<void*>(reinterpret_cast<const void*>(%s())); break;\n",
- propindex, p.read.constData());
+ fprintf(out, " case %d: _a[0] = const_cast<void*>(reinterpret_cast<const void*>(%s%s())); break;\n",
+ propindex, prefix.constData(), p.read.constData());
else if (p.gspec == PropertyDef::ReferenceSpec)
- fprintf(out, " case %d: _a[0] = const_cast<void*>(reinterpret_cast<const void*>(&%s())); break;\n",
- propindex, p.read.constData());
+ fprintf(out, " case %d: _a[0] = const_cast<void*>(reinterpret_cast<const void*>(&%s%s())); break;\n",
+ propindex, prefix.constData(), p.read.constData());
else if (cdef->enumDeclarations.value(p.type, false))
- fprintf(out, " case %d: *reinterpret_cast<int*>(_v) = QFlag(%s()); break;\n",
- propindex, p.read.constData());
+ fprintf(out, " case %d: *reinterpret_cast<int*>(_v) = QFlag(%s%s()); break;\n",
+ propindex, prefix.constData(), p.read.constData());
else
- fprintf(out, " case %d: *reinterpret_cast< %s*>(_v) = %s(); break;\n",
- propindex, p.type.constData(), p.read.constData());
+ fprintf(out, " case %d: *reinterpret_cast< %s*>(_v) = %s%s(); break;\n",
+ propindex, p.type.constData(), prefix.constData(), p.read.constData());
}
fprintf(out, " }\n");
}
@@ -768,12 +773,17 @@ void Generator::generateMetacall()
const PropertyDef &p = cdef->propertyList.at(propindex);
if (p.write.isEmpty())
continue;
+ QByteArray prefix;
+ if (p.inPrivateClass.size()) {
+ prefix = p.inPrivateClass;
+ prefix.append("->");
+ }
if (cdef->enumDeclarations.value(p.type, false)) {
- fprintf(out, " case %d: %s(QFlag(*reinterpret_cast<int*>(_v))); break;\n",
- propindex, p.write.constData());
+ fprintf(out, " case %d: %s%s(QFlag(*reinterpret_cast<int*>(_v))); break;\n",
+ propindex, prefix.constData(), p.write.constData());
} else {
- fprintf(out, " case %d: %s(*reinterpret_cast< %s*>(_v)); break;\n",
- propindex, p.write.constData(), p.type.constData());
+ fprintf(out, " case %d: %s%s(*reinterpret_cast< %s*>(_v)); break;\n",
+ propindex, prefix.constData(), p.write.constData(), p.type.constData());
}
}
fprintf(out, " }\n");
@@ -791,8 +801,13 @@ void Generator::generateMetacall()
const PropertyDef &p = cdef->propertyList.at(propindex);
if (!p.reset.endsWith(')'))
continue;
- fprintf(out, " case %d: %s; break;\n",
- propindex, p.reset.constData());
+ QByteArray prefix;
+ if (p.inPrivateClass.size()) {
+ prefix = p.inPrivateClass;
+ prefix.append("->");
+ }
+ fprintf(out, " case %d: %s%s; break;\n",
+ propindex, prefix.constData(), p.reset.constData());
}
fprintf(out, " }\n");
}
diff --git a/src/tools/moc/keywords.cpp b/src/tools/moc/keywords.cpp
index abc6be0..df1ba0d 100644
--- a/src/tools/moc/keywords.cpp
+++ b/src/tools/moc/keywords.cpp
@@ -43,12 +43,12 @@
// DO NOT EDIT.
static const short keyword_trans[][128] = {
- {0,0,0,0,0,0,0,0,0,525,522,0,0,0,0,0,
+ {0,0,0,0,0,0,0,0,0,533,530,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 525,252,523,526,0,38,239,524,25,26,236,234,30,235,27,237,
+ 533,252,531,534,0,38,239,532,25,26,236,234,30,235,27,237,
22,22,22,22,22,22,22,22,22,22,34,41,23,39,24,43,
0,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
- 8,21,8,8,8,8,8,8,8,8,8,31,527,32,238,8,
+ 8,21,8,8,8,8,8,8,8,8,8,31,535,32,238,8,
0,1,2,3,4,5,6,7,8,9,8,8,10,11,12,13,
14,8,15,16,17,18,19,20,8,8,8,36,245,37,248,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -190,7 +190,7 @@ static const short keyword_trans[][128] = {
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,42,0,0,0,28,0,
- 530,530,530,530,530,530,530,530,530,530,0,0,0,0,0,0,
+ 538,538,538,538,538,538,538,538,538,538,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -349,7 +349,7 @@ static const short keyword_trans[][128] = {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,529,0,0,0,0,528,
+ 0,0,0,0,0,0,0,0,0,0,537,0,0,0,0,536,
0,0,0,0,0,0,0,0,0,0,0,0,0,258,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -430,6 +430,14 @@ static const short keyword_trans[][128] = {
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 522,0,0,481,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
+ {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,497,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,486,
@@ -925,12 +933,12 @@ static const struct
{CHARACTER, 0, 84, 478, CHARACTER},
{CHARACTER, 0, 69, 479, CHARACTER},
{CHARACTER, 0, 95, 480, CHARACTER},
- {CHARACTER, 0, 83, 481, CHARACTER},
+ {CHARACTER, 48, 0, 0, CHARACTER},
{CHARACTER, 0, 76, 482, CHARACTER},
{CHARACTER, 0, 79, 483, CHARACTER},
{CHARACTER, 0, 84, 484, CHARACTER},
{Q_PRIVATE_SLOT_TOKEN, 0, 0, 0, CHARACTER},
- {CHARACTER, 48, 0, 0, CHARACTER},
+ {CHARACTER, 49, 0, 0, CHARACTER},
{CHARACTER, 0, 77, 487, CHARACTER},
{CHARACTER, 0, 79, 488, CHARACTER},
{CHARACTER, 0, 67, 489, CHARACTER},
@@ -967,6 +975,14 @@ static const struct
{CHARACTER, 0, 76, 520, CHARACTER},
{CHARACTER, 0, 69, 521, CHARACTER},
{Q_SCRIPTABLE_TOKEN, 0, 0, 0, CHARACTER},
+ {CHARACTER, 0, 82, 523, CHARACTER},
+ {CHARACTER, 0, 79, 524, CHARACTER},
+ {CHARACTER, 0, 80, 525, CHARACTER},
+ {CHARACTER, 0, 69, 526, CHARACTER},
+ {CHARACTER, 0, 82, 527, CHARACTER},
+ {CHARACTER, 0, 84, 528, CHARACTER},
+ {CHARACTER, 0, 89, 529, CHARACTER},
+ {Q_PRIVATE_PROPERTY_TOKEN, 0, 0, 0, CHARACTER},
{NEWLINE, 0, 0, 0, NOTOKEN},
{QUOTE, 0, 0, 0, NOTOKEN},
{SINGLEQUOTE, 0, 0, 0, NOTOKEN},
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp
index 94ad56f..680b8a5 100644
--- a/src/tools/moc/moc.cpp
+++ b/src/tools/moc/moc.cpp
@@ -658,6 +658,9 @@ void Moc::parse()
case Q_PRIVATE_SLOT_TOKEN:
parseSlotInPrivate(&def, access);
break;
+ case Q_PRIVATE_PROPERTY_TOKEN:
+ parsePrivateProperty(&def);
+ break;
case ENUM: {
EnumDef enumDef;
if (parseEnum(&enumDef))
@@ -872,11 +875,8 @@ void Moc::parseSignals(ClassDef *def)
}
}
-
-void Moc::parseProperty(ClassDef *def)
+void Moc::createPropertyDef(PropertyDef &propDef)
{
- next(LPAREN);
- PropertyDef propDef;
QByteArray type = parseType().name;
if (type.isEmpty())
error();
@@ -964,7 +964,6 @@ void Moc::parseProperty(ClassDef *def)
error(2);
}
}
- next(RPAREN);
if (propDef.read.isNull()) {
QByteArray msg;
msg += "Property declaration ";
@@ -988,6 +987,41 @@ void Moc::parseProperty(ClassDef *def)
propDef.constant = false;
warning(msg.constData());
}
+}
+
+void Moc::parseProperty(ClassDef *def)
+{
+ next(LPAREN);
+ PropertyDef propDef;
+ createPropertyDef(propDef);
+ next(RPAREN);
+
+
+ if(!propDef.notify.isEmpty())
+ def->notifyableProperties++;
+ def->propertyList += propDef;
+}
+
+void Moc::parsePrivateProperty(ClassDef *def)
+{
+ next(LPAREN);
+ PropertyDef propDef;
+ next(IDENTIFIER);
+ propDef.inPrivateClass = lexem();
+ while (test(SCOPE)) {
+ propDef.inPrivateClass += lexem();
+ next(IDENTIFIER);
+ propDef.inPrivateClass += lexem();
+ }
+ // also allow void functions
+ if (test(LPAREN)) {
+ next(RPAREN);
+ propDef.inPrivateClass += "()";
+ }
+
+ next(COMMA);
+
+ createPropertyDef(propDef);
if(!propDef.notify.isEmpty())
def->notifyableProperties++;
diff --git a/src/tools/moc/moc.h b/src/tools/moc/moc.h
index 10abfc6..d365ed5 100644
--- a/src/tools/moc/moc.h
+++ b/src/tools/moc/moc.h
@@ -116,7 +116,7 @@ struct FunctionDef
struct PropertyDef
{
PropertyDef():notifyId(-1), constant(false), final(false), gspec(ValueSpec){}
- QByteArray name, type, read, write, reset, designable, scriptable, editable, stored, user, notify;
+ QByteArray name, type, read, write, reset, designable, scriptable, editable, stored, user, notify, inPrivateClass;
int notifyId;
bool constant;
bool final;
@@ -217,6 +217,7 @@ public:
void parseSlots(ClassDef *def, FunctionDef::Access access);
void parseSignals(ClassDef *def);
void parseProperty(ClassDef *def);
+ void createPropertyDef(PropertyDef &def);
void parseEnumOrFlag(ClassDef *def, bool isFlag);
void parseFlag(ClassDef *def);
void parseClassInfo(ClassDef *def);
@@ -224,6 +225,7 @@ public:
void parseDeclareInterface();
void parseDeclareMetatype();
void parseSlotInPrivate(ClassDef *def, FunctionDef::Access access);
+ void parsePrivateProperty(ClassDef *def);
void parseFunctionArguments(FunctionDef *def);
diff --git a/src/tools/moc/token.cpp b/src/tools/moc/token.cpp
index 98307a1..3da9446 100644
--- a/src/tools/moc/token.cpp
+++ b/src/tools/moc/token.cpp
@@ -179,6 +179,7 @@ const char *tokenTypeName(Token t)
case Q_SIGNAL_TOKEN: return "Q_SIGNAL_TOKEN";
case Q_SLOT_TOKEN: return "Q_SLOT_TOKEN";
case Q_PRIVATE_SLOT_TOKEN: return "Q_PRIVATE_SLOT_TOKEN";
+ case Q_PRIVATE_PROPERTY_TOKEN: return "Q_PRIVATE_PROPERTY_TOKEN";
case SPECIAL_TREATMENT_MARK: return "SPECIAL_TREATMENT_MARK";
case MOC_INCLUDE_BEGIN: return "MOC_INCLUDE_BEGIN";
case MOC_INCLUDE_END: return "MOC_INCLUDE_END";
diff --git a/src/tools/moc/token.h b/src/tools/moc/token.h
index 6b1ad7d..6ca3d84 100644
--- a/src/tools/moc/token.h
+++ b/src/tools/moc/token.h
@@ -185,6 +185,7 @@ enum Token {
Q_QT3_SUPPORT_TOKEN,
Q_INVOKABLE_TOKEN,
Q_SCRIPTABLE_TOKEN,
+ Q_PRIVATE_PROPERTY_TOKEN,
Q_META_TOKEN_END,
SPECIAL_TREATMENT_MARK = Q_META_TOKEN_END,
MOC_INCLUDE_BEGIN,
diff --git a/src/tools/moc/util/generate_keywords.cpp b/src/tools/moc/util/generate_keywords.cpp
index 0641b40..88f187d 100644
--- a/src/tools/moc/util/generate_keywords.cpp
+++ b/src/tools/moc/util/generate_keywords.cpp
@@ -248,7 +248,7 @@ static const Keyword keywords[] = {
{ "Q_SIGNAL", "Q_SIGNAL_TOKEN" },
{ "Q_SLOT", "Q_SLOT_TOKEN" },
{ "Q_SCRIPTABLE", "Q_SCRIPTABLE_TOKEN" },
-
+ { "Q_PRIVATE_PROPERTY", "Q_PRIVATE_PROPERTY_TOKEN" },
{ "\n", "NEWLINE" },
{ "\"", "QUOTE" },
{ "\'", "SINGLEQUOTE" },