本文整理汇总了C++中kabc::Addressee::formattedNameLabel方法的典型用法代码示例。如果您正苦于以下问题:C++ Addressee::formattedNameLabel方法的具体用法?C++ Addressee::formattedNameLabel怎么用?C++ Addressee::formattedNameLabel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kabc::Addressee
的用法示例。
在下文中一共展示了Addressee::formattedNameLabel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: event
bool ContactListView::event( QEvent *e )
{
if( e->type() != QEvent::ToolTip )
return K3ListView::event( e );
if ( !tooltips() )
return true;
QHelpEvent * he = static_cast< QHelpEvent * >( e );
QPoint pnt = viewport()->mapFromGlobal( mapToGlobal( he->pos() ) );
Q3ListViewItem * item = itemAt ( pnt );
if ( item )
{
ContactListViewItem *plvi = static_cast<ContactListViewItem *>( item );
QString s;
//kDebug(5720) <<"Tip rec:" << r.x() <<"," << r.y() <<"," << r.width()
// << "," << r.height();
KABC::Addressee a = plvi->addressee();
if (a.isEmpty())
return true;
s += i18nc("label: value", "%1: %2", a.formattedNameLabel(),
a.formattedName());
s += '\n';
s += i18nc("label: value", "%1: %2", a.organizationLabel(),
a.organization());
QString notes = a.note().trimmed();
if ( !notes.isEmpty() ) {
notes += '\n';
s += '\n' + i18nc("label: value", "%1: \n", a.noteLabel());
QFontMetrics fm( font() );
// Begin word wrap code based on QMultiLineEdit code
int i = 0;
bool doBreak = false;
int linew = 0;
int lastSpace = -1;
int a = 0;
int lastw = 0;
while ( i < int(notes.length()) ) {
doBreak = false;
if ( notes[i] != '\n' )
linew += fm.width( notes[i] );
if ( lastSpace >= a && notes[i] != '\n' )
if (linew >= parentWidget()->width()) {
doBreak = true;
if ( lastSpace > a ) {
i = lastSpace;
linew = lastw;
}
else
i = qMax( a, i-1 );
}
if ( notes[i] == '\n' || doBreak ) {
s += notes.mid( a, i - a + (doBreak?1:0) ) +'\n';
a = i + 1;
lastSpace = a;
linew = 0;
}
if ( notes[i].isSpace() ) {
lastSpace = i;
lastw = linew;
}
if ( lastSpace <= a ) {
lastw = linew;
}
++i;
}
}
if ( s.isEmpty() )
QToolTip::hideText();
else
QToolTip::showText( he->globalPos(), s );
}
return true;
}