本文整理汇总了C++中ListItem::icon方法的典型用法代码示例。如果您正苦于以下问题:C++ ListItem::icon方法的具体用法?C++ ListItem::icon怎么用?C++ ListItem::icon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListItem
的用法示例。
在下文中一共展示了ListItem::icon方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateListContents
void updateListContents()
{
Q_Q(SimpleListView);
const bool caching = q->listItemCaching();
q->setListItemCaching(false);
const QString defaultIcon = Theme::p()->pixmapPath()+"contact_default_icon.svg";
const int itemCount = m_layout->count();
for (int i=0; i<itemCount; ++i) {
ListItem* item = static_cast<ListItem*>(m_layout->itemAt(i));
// Update default icons
const QString filename = item->icon(ListItem::LeftIcon)->fileName();
if (filename.contains("contact_default_icon")) {
item->icon(ListItem::LeftIcon)->setFileName(defaultIcon);
}
// Update status icons
QString statusIcon = item->icon(ListItem::RightIcon)->fileName();
const int index = statusIcon.indexOf("contact_status");
if (index != -1) {
statusIcon.remove(0, index);
item->icon(ListItem::RightIcon)->setFileName(Theme::p()->pixmapPath()+statusIcon);
}
// Update fonts
item->setFont(Theme::p()->font(Theme::ContactName), ListItem::FirstPos);
item->setFont(Theme::p()->font(Theme::ContactNumber), ListItem::SecondPos);
item->setFont(Theme::p()->font(Theme::ContactEmail), ListItem::ThirdPos);
// Update list dividers
if (i%2) {
item->setBackgroundBrush(Theme::p()->listItemBackgroundBrushOdd());
item->setBackgroundOpacity(Theme::p()->listItemBackgroundOpacityOdd());
}
else {
item->setBackgroundBrush(Theme::p()->listItemBackgroundBrushEven());
item->setBackgroundOpacity(Theme::p()->listItemBackgroundOpacityEven());
}
// Update borders
item->setBorderPen(Theme::p()->listItemBorderPen());
item->setRounding(Theme::p()->listItemRounding());
// Update icons
item->icon(ListItem::LeftIcon)->setRotation(Theme::p()->iconRotation(ListItem::LeftIcon));
item->icon(ListItem::RightIcon)->setRotation(Theme::p()->iconRotation(ListItem::RightIcon));
item->icon(ListItem::LeftIcon)->setOpacityEffectEnabled(Theme::p()->isIconOpacityEffectEnabled(ListItem::LeftIcon));
item->icon(ListItem::RightIcon)->setOpacityEffectEnabled(Theme::p()->isIconOpacityEffectEnabled(ListItem::RightIcon));
item->icon(ListItem::LeftIcon)->setSmoothTransformationEnabled(Theme::p()->isIconSmoothTransformationEnabled(ListItem::LeftIcon));
item->icon(ListItem::RightIcon)->setSmoothTransformationEnabled(Theme::p()->isIconSmoothTransformationEnabled(ListItem::RightIcon));
}
q->setListItemCaching(caching);
}
示例2: startDrag
void NotesWidget::startDrag( Qt::DropActions supportedActions )
{
ListItem* l = reinterpret_cast<ListItem*>(currentItem());
if (l == NULL)
return;
QMimeData *data = new QMimeData;
data->setData("qevernote/note", l->encode());
QDrag *drag = new QDrag(this);
drag->setPixmap(l->icon().pixmap(24, 24));
drag->setHotSpot(QPoint(12,12));
drag->setMimeData(data);
drag->exec(supportedActions, Qt::MoveAction);
}