khtml - render_text: Q3PtrVector->QVector

Peter Kümmel syntheticpp at gmx.net
Wed Jun 28 07:55:22 BST 2006


David Faure wrote:
> On Tuesday 27 June 2006 22:29, Peter Kümmel wrote:
>> I get a strange linker error when compiling
>> khtml with msvc: it could not find Q3GVector::at,
>> even though this function is an inline function.
>> Maybe this is because of the debug mode, but trying
>> to force the inlining doesn't work.
>>
>> Before fiddling around with this Q3Support code
>> I've used QVector instead, which solves the linker
>> error.
>>
>> Is it possible to apply the attached patch? The
>> only point where I'm not sure is the replacement
>> of the 'compareItems' function:
> 
> You need to get rid of the QVector subclass and move the comparison
> code to a static method which you then pass to qSort (third argument).
> Which also means calling qSort from the code...
> 

OK, I've removed the QVector and now InlineTextBoxArray is
a typedef of RenderText:

typedef QVector<InlineTextBox*> InlineTextBoxArray;

Also findFirstMatching is now a (static) member of RenderText.

But I don't understand where I should use qSort,
in the old code

int InlineTextBoxArray::compareItems( Item d1, Item d2 )

was never used because always the Q3GVector version is used:

(Q3GVector*)this)->compareItems( d, (*this)[mid] );

and this function does only a != comparison.
So I've dropped InlineTextBoxArray::compareItems

Attached the new patch.

Peter

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: qvector2.diff
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20060628/a16de997/attachment.ksh>


More information about the kde-core-devel mailing list