Passing an integer to a string to a method having QString as a parameter signature
Gopalakrishna Bhat
gopalakbhat at gmail.com
Tue Feb 8 12:59:47 GMT 2011
I was looking as this piece of code in KoTextEditor.cpp
void KoTextEditor::newLine()
{
d->updateState(KoTextEditor::Private::Custom, i18n("Line Break"));
if (d->caret.hasSelection())
d->deleteInlineObjects();
KoTextDocument koDocument(d->document);
KoStyleManager *styleManager = koDocument.styleManager();
KoParagraphStyle *nextStyle = 0;
KoParagraphStyle *currentStyle = 0;
if (styleManager) {
int id =
d->caret.blockFormat().intProperty(KoParagraphStyle::StyleId);
currentStyle = styleManager->paragraphStyle(id);
if (currentStyle == 0) // not a style based parag. Lets make the
next one correct.
nextStyle = styleManager->defaultParagraphStyle();
else
nextStyle =
styleManager->paragraphStyle(currentStyle->nextStyle());
Q_ASSERT(nextStyle);
if (currentStyle == nextStyle)
nextStyle = 0;
}
.
.
.
}
Here the parameter passed to styleManager->paragraphStyle(id) is a integer
whereas its signature shows that it is a const QString....Is this the right
way to call or am I missing something?
//snippet from KoStyleManager.cpp
KoParagraphStyle *KoStyleManager::paragraphStyle(const QString &name) const
{
foreach(KoParagraphStyle *style, d->paragStyles) {
qDebug()<<Q_FUNC_INFO<<" name "<<name<<"style->name
"<<style->name();
if (style->name() == name)
return style;
}
return 0;
}
--
My blog http://gkbhat.blogspot.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/calligra-devel/attachments/20110208/8ca89ba8/attachment.htm>
More information about the calligra-devel
mailing list