本文整理汇总了C++中MarkerItem::marker方法的典型用法代码示例。如果您正苦于以下问题:C++ MarkerItem::marker方法的具体用法?C++ MarkerItem::marker怎么用?C++ MarkerItem::marker使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MarkerItem
的用法示例。
在下文中一共展示了MarkerItem::marker方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deleteMarker
void MarkerView::deleteMarker()
{
MarkerItem* item = (MarkerItem*) table->currentItem();
if (item)
{
table->blockSignals(true);
song->removeMarker(item->marker());
table->blockSignals(false);
// Removed p3.3.43 Let Song::removeMarker emit markerChanged(MARKER_REMOVE)
// and handle it in MarkerView::markerChanged(int)
//delete item;
}
}
示例2: markerChanged
void MarkerView::markerChanged(int val)
{
//if (val != Song::MARKER_CUR)
// return;
// p3.3.43
switch (val)
{
// MARKER_CUR, MARKER_ADD, MARKER_REMOVE, MARKER_NAME,
// MARKER_TICK, MARKER_LOCK
case Song::MARKER_ADD:
case Song::MARKER_REMOVE:
updateList();
break; // Try falling through and let it try to select something. No, let updateList() do it...
case Song::MARKER_CUR:
{
MarkerList* marker = song->marker();
for (iMarker i = marker->begin(); i != marker->end(); ++i)
{
if (i->second.current())
{
MarkerItem* item = (MarkerItem*) table->topLevelItem(0);
while (item)
{
if (item->marker() == &i->second)
{
table->setCurrentItem(item);
return;
}
item = (MarkerItem*) table->itemBelow(item);
}
}
}
}
break;
default:
break;
}
}
示例3: updateList
void MarkerView::updateList()
{
// Added p3.3.43 Manage selected item, due to clearing of table...
MarkerList* marker = song->marker();
MarkerItem* selitem = (MarkerItem*) table->currentItem();
Marker* selm = selitem ? selitem->marker() : 0;
// p3.3.44 Look for removed markers before added markers...
if (selitem)
{
MarkerItem* mitem = (MarkerItem*) table->topLevelItem(0);
while (mitem)
{
bool found = false;
for (iMarker i = marker->begin(); i != marker->end(); ++i)
{
Marker* m = &i->second;
if (m == mitem->marker())
{
found = true;
break;
}
}
// Anything removed from the marker list?
if (!found)
{
// If it is the current selected item, it no longer exists. Make the next item be selected.
if (mitem == selitem)
{
MarkerItem* mi = (MarkerItem*) table->itemBelow(selitem);
if (mi)
{
selitem = mi;
selm = selitem->marker();
}
}
}
mitem = (MarkerItem*) table->itemBelow(mitem);
}
}
// Look for added markers...
for (iMarker i = marker->begin(); i != marker->end(); ++i)
{
Marker* m = &i->second;
bool found = false;
MarkerItem* item = (MarkerItem*) table->topLevelItem(0);
while (item)
{
if (item->marker() == m)
{
found = true;
break;
}
item = (MarkerItem*) table->itemBelow(item);
}
// Anything new found in the marker list?
if (!found)
selm = m;
}
// Block signals added. Triggers itemSelectionChanged() causing crash. Tim.
table->blockSignals(true);
table->clear();
table->blockSignals(false);
//MarkerList* marker = song->marker();
for (iMarker i = marker->begin(); i != marker->end(); ++i)
{
Marker* m = &i->second;
// Changed p3.3.43
//QString tick;
//tick.setNum(i->first);
//new MarkerItem(table, m);
MarkerItem* item = new MarkerItem(table, m);
if (m == selm)
{
m->setCurrent(true);
table->setCurrentItem(item);
}
else
{
m->setCurrent(false);
}
}
}