本文整理汇总了C++中CustomItem类的典型用法代码示例。如果您正苦于以下问题:C++ CustomItem类的具体用法?C++ CustomItem怎么用?C++ CustomItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CustomItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: new
Tizen::Ui::Controls::ListItemBase*
SelectCalendarPopup::CreateItem(int index, int itemWidth)
{
CustomItem* pItem = new (std::nothrow) CustomItem();
Calendar* pCalendar = null;
String calendarName;
pCalendar = static_cast< Calendar* >(__pCalendarList->GetAt(index));
TryReturn(pCalendar != null, null, "Failed to get a calendar");
calendarName = pCalendar->GetName();
if (calendarName.IsEmpty() == true)
{
calendarName = L"(Calendar ID: ";
calendarName.Append(pCalendar->GetRecordId());
calendarName.Append(L")");
}
pItem->Construct(Dimension(itemWidth, 100), LIST_ANNEX_STYLE_NORMAL);
pItem->AddElement(Rectangle(32, 0, GetClientAreaBounds().width - 64, 112), 1, calendarName, true);
if (__selectedCalendarId == pCalendar->GetRecordId())
{
__pListView->SetItemChecked(index, true);
}
return pItem;
}
示例2: CustomItem
CustomItem *Dictionary::CreateCustomWordItem(int itemWidth)
{
ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL;
CustomItem *pItem = new CustomItem();
pItem->Construct(Osp::Graphics::Dimension(itemWidth, ITEM_HEIGHT), style);
pItem->SetBackgroundColor(LIST_ITEM_DRAWING_STATUS_NORMAL, LangSetting::CUSTOM_WORD);
String examples = L"";
ArrayList *words = __WCtrl->GetWordsN(WordCtrl::CUSTOM_WORD_LESSON_ID);
if (words && words->GetCount() > 0)
{
int cnt = words->GetCount();
for (int i = 0; i != cnt; i++)
{
Word * w = static_cast<Word*> (words->GetAt(i));
if (i > 0)
examples.Append(",");
examples.Append(w->__lern);
}
words->RemoveAll(true);
delete words;
}
else examples = Utils::GetString("IDS_EMPTY_CUSTOM_LIST");
String name = Utils::GetString("IDS_CUSTOM_WORD_ITEM");
AddItemTitle(pItem, name, itemWidth);
AddItemExamples(pItem, itemWidth, examples);
return pItem;
}
示例3: QGraphicsRectItem
void tst_QGraphicsEffect::inheritOpacity()
{
QGraphicsScene scene;
QGraphicsRectItem *rectItem = new QGraphicsRectItem(0, 0, 10, 10);
CustomItem *item = new CustomItem(0, 0, 10, 10, rectItem);
scene.addItem(rectItem);
item->setGraphicsEffect(new DeviceEffect);
item->setPen(Qt::NoPen);
item->setBrush(Qt::red);
rectItem->setOpacity(0.5);
QGraphicsView view(&scene);
view.show();
QTest::qWaitForWindowShown(&view);
QTRY_VERIFY(item->numRepaints >= 1);
int numRepaints = item->numRepaints;
rectItem->setOpacity(1);
// item should have been rerendered due to opacity changing
QTRY_VERIFY(item->numRepaints > numRepaints);
}
示例4: CustomItem
//Shows image on view.
void CustomGraphicsView::addItemToScene(QString strEmfFile)
{
//Calculate maximum column to be displayed in a view.
m_nMaxColumn = (m_nWidth - (m_nOffsetX + (m_nOffsetX / 2))) / (nItemWidth + m_nItemSpace);
CustomItem* pImageLabel = new CustomItem(strEmfFile, ++nViewItem);
pImageLabel->setPos(m_nOffsetX + (m_nColoumn * (nItemWidth + m_nItemSpace)), m_nOffsetY + (m_nRow * (nItemHeight + m_nItemSpace)));
pImageLabel->setAcceptHoverEvents(true);
m_graphicsScene.addItem(pImageLabel);
if ((0 == m_nRow)
&&
(0 == m_nColoumn))
{
m_sceneRect.setX(0);
m_sceneRect.setY(0);
//m_sceneRect.setWidth(m_nOffsetX + (m_nOffsetX / 2) + nItemWidth);
m_sceneRect.setHeight(m_nOffsetY + (m_nOffsetY / 2) + nItemHeight);
}
else if (0 == m_nColoumn)
{
m_sceneRect.setHeight(m_sceneRect.height() + nItemHeight + m_nItemSpace);
}
m_graphicsScene.setSceneRect(m_sceneRect);
if (m_nColoumn < (m_nMaxColumn - 1))
{
m_nColoumn++;
}
else
{
m_nRow++;
m_nColoumn = 0;
}
if (m_sceneRect.height() < m_nHeight)
{
m_sceneRect.setHeight(m_nHeight);
m_graphicsScene.setSceneRect(m_sceneRect);
}
QList<QGraphicsItem*> visibleItems = this->items(viewport()->rect());
if ((visibleItems.contains(pImageLabel))
&&
(false == timer->isActive()))
{
emit loadImage(visibleItems);
}
}
示例5: new
Tizen::Ui::Controls::ListItemBase*
Lanking::CreateItem(int index, int itemWidth)
{
String* pItemText = null;
pItemText = static_cast<String *>(__pRankingTextList->GetAt(index));
CustomItem* pItem = new (std::nothrow) CustomItem();
pItem->Construct(Tizen::Graphics::Dimension(itemWidth,74), LIST_ANNEX_STYLE_NORMAL);
pItem->AddElement(Rectangle(10, 10, 460, 74), 300, *pItemText, true);
return pItem;
}
示例6: new
ListItemBase*
PartnerListForm::CreateItem(int groupIndex, int itemIndex, float itemWidth)
{
ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL;
CustomItem* pItem = new (std::nothrow) CustomItem();
pItem->Construct(Tizen::Graphics::FloatDimension(itemWidth, 210.0f), style);
PartnerItem *p;
p= new PartnerItem;
ArrPartnerItem.GetAt(ITEM_CREATE_CNT++, *p);
pItem->AddElement(Rectangle(0, 0, itemWidth, 210.0f), 0, *(static_cast<ICustomElement *>(p)));
return pItem;
}
示例7: updateView
void CustomGraphicsView::updateView()
{
int nRow = 0;
int nColoumn = 0;
QList<QGraphicsItem *> items = this->items();
m_nMaxColumn = (m_nWidth - (m_nOffsetX + (m_nOffsetX / 2))) / (nItemWidth + m_nItemSpace);
if (0 == m_nMaxColumn)
{
m_nMaxColumn = 1;
}
m_sceneRect.setWidth(m_nWidth);
m_sceneRect.setHeight(m_nOffsetY + (m_nOffsetY / 2) + (ceil(float(items.count()) / m_nMaxColumn) * (nItemHeight + m_nItemSpace)));
if (m_sceneRect.height() < m_nHeight)
{
m_sceneRect.setHeight(m_nHeight);
}
m_graphicsScene.setSceneRect(m_sceneRect);
for (INT index = items.count() - 1; index >= 0; index--)
{
CustomItem* item = dynamic_cast<CustomItem*> (items[index]);
item->setPos(m_nOffsetX + (nColoumn * (nItemWidth + m_nItemSpace)), m_nOffsetY + (nRow * (nItemHeight + m_nItemSpace)));
if (nColoumn < (m_nMaxColumn - 1))
{
nColoumn++;
}
else
{
nRow++;
nColoumn = 0;
}
}
m_nRow = nRow;
m_nColoumn = nColoumn;
timer->start(500);
}
示例8: CustomItem
void tst_QGraphicsEffect::opacity()
{
// Make sure the painter's opacity is correct in QGraphicsEffect::draw.
QGraphicsScene scene;
CustomItem *item = new CustomItem(0, 0, 100, 100);
item->setOpacity(0.5);
CustomEffect *effect = new CustomEffect;
item->setGraphicsEffect(effect);
scene.addItem(item);
QGraphicsView view(&scene);
view.show();
QTest::qWaitForWindowShown(&view);
QTRY_VERIFY(effect->numRepaints > 0);
QCOMPARE(effect->m_opacity, qreal(0.5));
}
示例9: ofRandom
void Item::createItem()
{
int rndItemIndex = ofRandom(0,3);
//int rndItemIndex = 1;
if (rndItemIndex ==0)
GlobalData::itemType = "letter";
if (rndItemIndex==1)
GlobalData::itemType = "health";
if (rndItemIndex ==2 || rndItemIndex ==3)
GlobalData::itemType ="multiplier";
CustomItem p;
p.setPhysics(1.0, 0.5, 0.3);
p.setup(GlobalData::box2dworld.getWorld(), 10, 500, 1);
if (GlobalData::itemType == "letter")
{
if (GlobalData::itemIndex ==0)
p. setupTheCustomData("S");
else if (GlobalData::itemIndex ==1)
p. setupTheCustomData("P");
else if (GlobalData::itemIndex ==2)
p. setupTheCustomData("E");
else if (GlobalData::itemIndex ==3)
p. setupTheCustomData("E");
else if (GlobalData::itemIndex ==4)
p. setupTheCustomData("C");
else if (GlobalData::itemIndex ==5)
p. setupTheCustomData("H");
else
GlobalData::itemType = "health";
}
if (GlobalData::itemType == "health")
{
p.setupTheCustomData("health");
}
if (GlobalData::itemType =="multiplier")
p.setupTheCustomData("multiplier");
GlobalData::items.push_back(p);
//GlobalData::box2dworld.getWorld()->SetContactListener(&contactListener);
//ofAddListener(GlobalData::box2dworld.contactStartEvents, this, &Item::contactStart);
//ofAddListener(GlobalData::box2dworld.contactEndEvents, this, &Item::contactEnd);
}
示例10: GetWidth
Tizen::Ui::Controls::ListItemBase *
ShoppingListTab1::CreateItem(int index, int itemWidth)
{
String* pvalueText;
DbRow* pRow = theTableLists.GetRow(index);
if (pRow)
{
pRow->GetText(1, pvalueText);
}
String strName = *pvalueText;
int textWidth = GetWidth() - INDENT*2;
EnrichedText enrichedText;
enrichedText.Construct(FloatDimension(textWidth, 112));
enrichedText.SetVerticalAlignment(TEXT_ALIGNMENT_MIDDLE);
enrichedText.SetHorizontalAlignment(TEXT_ALIGNMENT_LEFT);
enrichedText.SetTextWrapStyle(TEXT_WRAP_WORD_WRAP);
Font pFont;
pFont.Construct(FONT_STYLE_BOLD, 44.0f);
TextElement* pTextElement = new (std::nothrow) TextElement();
pTextElement->Construct(strName + "\n");
pTextElement->SetFont(pFont);
enrichedText.Add(*pTextElement);
int textHeight = enrichedText.GetTotalLineHeight();
CustomItem* pItem = new CustomItem();
pItem->Construct(Dimension(GetWidth(), textHeight + INDENT*2), LIST_ANNEX_STYLE_NORMAL);
pItem->AddElement(Rectangle(INDENT, INDENT, textWidth, textHeight), 0, enrichedText);
AppAssert(pItemContext);
pItem->SetContextItem(pItemContext);
return pItem;
}
示例11: new
ListItemBase*
SettingForm::CreateItem(int index, float itemWidth)
{
ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL;
CustomItem* pItem = new (std::nothrow) CustomItem;
pItem->Construct(CoordinateSystem::AlignToDevice(Tizen::Graphics::FloatDimension(itemWidth, 112.0f)), style);
FloatRectangle mainListItemRect(26.0f, 32.0f, GetClientAreaBoundsF().width, 60.0f);
switch(index)
{
case 0:
pItem->AddElement(mainListItemRect, ID_FORMAT_STRING, L"Chatting1", true);
break;
case 1:
pItem->AddElement(mainListItemRect, ID_FORMAT_STRING, L"Chatting2", true);
break;
case 2:
pItem->AddElement(mainListItemRect, ID_FORMAT_STRING, L"Chatting3", true);
break;
default:
break;
}
return pItem;
}
示例12: CustomItem
ListItemBase * BMCategoriesForm::CreateItem (int index, float itemWidth)
{
CustomItem * pItem = new CustomItem();
BookMarkManager & mngr = GetBMManager();
pItem->Construct(FloatDimension(itemWidth, lstItmHght), LIST_ANNEX_STYLE_NORMAL);
int addWdth = 0;
bool bShowDelete = index == m_categoryToDelete;
if (m_bEditState)
{
FloatRectangle imgRect(btwWdth, topHght, imgWdth, imgHght);
pItem->AddElement(imgRect, ID_DELETE, *GetBitmap(bShowDelete ? IDB_BOOKMARK_DELETE_CUR : IDB_BOOKMARK_DELETE), null, null);
addWdth = btwWdth + imgWdth;
}
FloatRectangle imgRect(addWdth + btwWdth, topHght, imgWdth, imgHght);
pItem->AddElement(imgRect, ID_EYE, *GetBitmap(mngr.IsCategoryVisible(index) ? IDB_EYE : IDB_EMPTY), null, null);
int beg = addWdth + btwWdth + imgWdth + btwWdth;
int end = 2 * btwWdth + (bShowDelete ? deleteWidth : imgWdth);
String itemText = mngr.GetCategoryName(index);
pItem->AddElement(FloatRectangle(beg, topHght, itemWidth - beg - end, imgHght), ID_NAME, itemText, mainFontSz, gray, gray, gray);
if (bShowDelete)
{
pItem->AddElement(FloatRectangle(itemWidth - end + btwWdth, topHght, deleteWidth, imgHght), ID_DELETE_TXT, "Delete", mainFontSz, red, red, red);
}
else
{
int count = mngr.GetCategorySize(index);
String sz;
sz.Append(count);
pItem->AddElement(FloatRectangle(itemWidth - btwWdth - imgWdth, topHght, imgWdth, imgHght), ID_SIZE, sz, mainFontSz, gray, gray, gray);
}
return pItem;
}
示例13: new
Controls::ListItemBase *
EnrichedTextForm::CreateItem(int index, int itemWidth)
{
// TODO: Add your implementation codes here
ListAnnexStyle style = LIST_ANNEX_STYLE_NORMAL;
CustomItem* pItem = new (std::nothrow) CustomItem();
pItem->Construct(Tizen::Graphics::Dimension(itemWidth, 112), style);
Rectangle mainListItemRect(26, 32, GetClientAreaBounds().width, 50);
switch(index)
{
case 0:
pItem->AddElement(mainListItemRect, TEXT_WRAP_NONE_INDEX, L"Text Wrap None", true);
break;
case 1:
pItem->AddElement(mainListItemRect, TEXT_WRAP_WORD_WRAP_INDEX, L"Text Wrap Word", true);
break;
case 2:
pItem->AddElement(mainListItemRect, TEXT_WRAP_CHARACTER_WRAP_INDEX, L"Text Wrap Character Wrap", true);
break;
case 3:
pItem->AddElement(mainListItemRect, TEXT_ALIGNMENT_LEFT_INDEX, L"Text Alignment Left", true);
break;
case 4:
pItem->AddElement(mainListItemRect, TEXT_ALIGNMENT_CENTER_INDEX, L"Text Alignment Center", true);
break;
case 5:
pItem->AddElement(mainListItemRect, TEXT_ALIGNMENT_RIGHT_INDEX, L"Text Alignment Right", true);
break;
case 6:
pItem->AddElement(mainListItemRect, TEXT_ALIGNMENT_TOP_INDEX, L"Text Alignment Top", true);
break;
case 7:
pItem->AddElement(mainListItemRect, TEXT_ALIGNMENT_MIDDLE_INDEX, L"Text Alignment Middle", true);
break;
case 8:
pItem->AddElement(mainListItemRect, TEXT_ALIGNMENT_BOTTOM_INDEX, L"Text Alignment Bottom", true);
break;
case 9:
pItem->AddElement(mainListItemRect, ABBREVIATION_ENABLED_TRUE, L"Abbreviation Enabled", true);
break;
case 10:
pItem->AddElement(mainListItemRect, ABBREVIATION_ENABLED_FALSE, L"Abbreviation Disabled", true);
break;
default:
break;
}
return pItem;
}
示例14: QCOMPARE
void tst_QStandardItem::subclassing()
{
qMetaTypeId<QStandardItem*>();
CustomItem *item = new CustomItem;
QCOMPARE(item->type(), int(QStandardItem::UserType + 1));
item->setText(QString::fromLatin1("foo"));
QCOMPARE(item->text(), QString::fromLatin1("foo"));
item->emitDataChanged(); // does nothing
QStandardItemModel model;
model.appendRow(item);
QSignalSpy itemChangedSpy(&model, SIGNAL(itemChanged(QStandardItem*)));
item->emitDataChanged();
QCOMPARE(itemChangedSpy.count(), 1);
QCOMPARE(itemChangedSpy.at(0).count(), 1);
QCOMPARE(qvariant_cast<QStandardItem*>(itemChangedSpy.at(0).at(0)), (QStandardItem*)item);
CustomItem *child0 = new CustomItem("cc");
CustomItem *child1 = new CustomItem("bbb");
CustomItem *child2 = new CustomItem("a");
item->appendRow(child0);
item->appendRow(child1);
item->appendRow(child2);
item->sortChildren(0);
QCOMPARE(item->child(0), (QStandardItem*)child2);
QCOMPARE(item->child(1), (QStandardItem*)child0);
QCOMPARE(item->child(2), (QStandardItem*)child1);
}
示例15: GetClientAreaBounds
ListItemBase*
DeviceInfoForm::CreateItem(int groupIndex, int itemIndex, int itemWidth)
{
static const int LIST_ITEM_HEIGHT = 60;
static const int ID_LIST_VALUE = 101;
static const int LIST_DATA_HEIGHT = 50;
static const int DEFAULT_MARGIN = 20;
static const int ELEMENT_X = 26;
static const int ELEMENT_Y = 0;
int clientAreaWidth = GetClientAreaBounds().width;
const IListT<WifiWpsConfigurationMode>* pWifiWpsConfigurationModes = null;
CustomItem* pItem = new CustomItem();
// skip IP addrss and SSID
if ((groupIndex >= DeviceInfoType::IP_ADDRESS) && (__pLocalDeviceInfo->GetGroupMemberType() == WIFI_DIRECT_GROUP_MEMBER_TYPE_NONE))
{
groupIndex += 2;
}
if (groupIndex == DeviceInfoType::WPS_MODE)
{
pWifiWpsConfigurationModes = static_cast<const IListT<WifiWpsConfigurationMode>*>(__pLocalDeviceInfo->GetSupportedWpsConfigurationModeList());
int wpsModeCount = pWifiWpsConfigurationModes->GetCount();
if (wpsModeCount == 0)
{
// set default value to display "Unknown"
wpsModeCount = 1;
}
if (pWifiWpsConfigurationModes != null)
{
pItem->Construct(Dimension(clientAreaWidth, ELEMENT_Y + (LIST_DATA_HEIGHT * wpsModeCount)), LIST_ANNEX_STYLE_NORMAL);
for (int i = 0; i < wpsModeCount; i++)
{
WifiWpsConfigurationMode wpsConfigurationMode = WIFI_WPS_CONFIG_MODE_NONE;
pWifiWpsConfigurationModes->GetAt(i, wpsConfigurationMode);
pItem->AddElement(Rectangle(ELEMENT_X, ELEMENT_Y + (LIST_DATA_HEIGHT * i), clientAreaWidth - DEFAULT_MARGIN, LIST_DATA_HEIGHT), ID_LIST_VALUE + i,
GetDeviceWpsConfigurationMode(wpsConfigurationMode));
}
}
}
else
{
pItem->Construct(Tizen::Graphics::Dimension(GetClientAreaBounds().width, LIST_ITEM_HEIGHT), LIST_ANNEX_STYLE_NORMAL);
switch (groupIndex)
{
case DeviceInfoType::DEVICE_NAME:
pItem->AddElement(Rectangle(ELEMENT_X, ELEMENT_Y, clientAreaWidth - DEFAULT_MARGIN, LIST_DATA_HEIGHT), ID_LIST_VALUE,
__pLocalDeviceInfo->GetDeviceName());
break;
case DeviceInfoType::MAC_ADDRESS:
{
String macAddress = __pLocalDeviceInfo->GetMacAddress();
if (macAddress.GetLength() == 0)
{
macAddress = L"xx-xx-xx-xx-xx-xx";
}
pItem->AddElement(Rectangle(ELEMENT_X, ELEMENT_Y, clientAreaWidth - DEFAULT_MARGIN, LIST_DATA_HEIGHT), ID_LIST_VALUE,
macAddress);
}
break;
case DeviceInfoType::IP_ADDRESS:
if (__pLocalDeviceInfo->GetIpAddress() != null)
{
pItem->AddElement(Rectangle(ELEMENT_X, ELEMENT_Y, clientAreaWidth - DEFAULT_MARGIN, LIST_DATA_HEIGHT), ID_LIST_VALUE,
__pLocalDeviceInfo->GetIpAddress()->ToString());
}
break;
case DeviceInfoType::SSID:
pItem->AddElement(Rectangle(ELEMENT_X, ELEMENT_Y, clientAreaWidth - DEFAULT_MARGIN, LIST_DATA_HEIGHT), ID_LIST_VALUE,
__pLocalDeviceInfo->GetSsid());
break;
case DeviceInfoType::DEVICE_STATUS:
pItem->AddElement(Rectangle(ELEMENT_X, ELEMENT_Y, clientAreaWidth - DEFAULT_MARGIN, LIST_DATA_HEIGHT), ID_LIST_VALUE,
GetDeviceStatus());
break;
case DeviceInfoType::MEMBER_TYPE:
pItem->AddElement(Rectangle(ELEMENT_X, ELEMENT_Y, clientAreaWidth - DEFAULT_MARGIN, LIST_DATA_HEIGHT), ID_LIST_VALUE,
GetGroupMemberType());
break;
case DeviceInfoType::DEVICE_TYPE:
pItem->AddElement(Rectangle(ELEMENT_X, ELEMENT_Y, clientAreaWidth - DEFAULT_MARGIN, LIST_DATA_HEIGHT), ID_LIST_VALUE,
GetDeviceTypeCategory());
break;
default:
break;
}
}
return pItem;
//.........这里部分代码省略.........