First of all, which Qt version you're talking about? I assume it is 4.8 since QAccessibleTextWidget has been reworked alot in 5.0 and the problem you've described seems to gone there (see QAccessibleTextWidget::characterRect() impl). If it is 5.0, then you're probably subclassing the accessibility widgets, are you?
Briefly: the QTextDocumentLayout sets the leadingIncluded to true for every line in a blocks (re-)layouting code and thus the line's height equals to QFontMetrics::lineSpacing(), whilst QFontMetrics::height() better suites to what characterRect() should return as a rect's height. Anyways, more info required... Konstantin 2012/10/4 Rafael Roquetto <[email protected]>: > Hello, > > I am trying to fix tst_QAccessibility for QNX, and I have a problem on line > 2750: > > QCOMPARE(iface->textInterface()->characterRect(0, > QAccessible2::RelativeToParent).size(), QSize(fm.width("h"), fm.height())); > > This comparison is failing, because the caracter rect height is bigger than > the height returned by QFontMetrics. And...? > > Well, ultimately the height of the character rect comes from > QScriptLine::height(). Here is how it is calculated (simplified): > > height = ascent + descent + 1 (leadingIncluded ? leading : QFixed()) > > While QFontMetrics does not use 'leading' to compute 'height' (simplified): > > height = ascent + descent + 1 > > > Which leads to a few questions: > > 1. Is this meant to be like that or is either class implementation incorrect? > > 2. If this is correct, then is the test erroneusly assuming that > QFontMetrics::height() == QScriptLine::height() for every use case? Or... > > 3. Should the 'leading' be '0' in the context of the test (what happens in Qt > built for Linux, but not for QNX)? > > Well, I will continue to investigate it, but since I do not know much about > this corner of Qt, I thought it wouldn't hurt to ask :) > > Thanks a lot in advance, > Rafael > > -- > ** Qt Developer Conference: http://qtconference.kdab.com/ ** > > Rafael Roquetto | [email protected] | Software Engineer > Klarälvdalens Datakonsult AB, a KDAB Group company > Tel. Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322) > KDAB - Qt Experts - Platform-independent software solutions > > > _______________________________________________ > Development mailing list > [email protected] > http://lists.qt-project.org/mailman/listinfo/development > _______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
