本文整理汇总了C++中QValueVector::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ QValueVector::clear方法的具体用法?C++ QValueVector::clear怎么用?C++ QValueVector::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QValueVector
的用法示例。
在下文中一共展示了QValueVector::clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setPageElement
void
PolygonElement::generate(ReportInterp* interp, int offsetX, int offsetY,
QValueVector<PageElement>& elements)
{
PageElement element;
element.type = PageElement::POLYGON;
setPageElement(element, interp, offsetX, offsetY);
element.points = points;
elements.clear();
elements.push_back(element);
}
示例2: openItemContextMenu
//.........这里部分代码省略.........
// libqonq/konq_operations.h of Konqueror.
// (Copyright (C) 2000 David Faure <[email protected]>)
assert(m_fileInfo != 0);
KPopupMenu* popup = new KPopupMenu(m_dolphinView);
Dolphin& dolphin = Dolphin::mainWin();
const KURL::List urls = m_dolphinView->selectedURLs();
const KURL& url = dolphin.activeView()->url();
if (url.protocol() == "trash")
{
popup->insertItem(i18n("&Restore"), restoreID);
}
// insert 'Cut', 'Copy' and 'Paste'
const KStdAction::StdAction actionNames[] = { KStdAction::Cut, KStdAction::Copy, KStdAction::Paste };
const int count = sizeof(actionNames) / sizeof(KStdAction::StdAction);
for (int i = 0; i < count; ++i) {
KAction* action = dolphin.actionCollection()->action(KStdAction::stdName(actionNames[i]));
if (action != 0) {
action->plug(popup);
}
}
popup->insertSeparator();
// insert 'Rename'
KAction* renameAction = dolphin.actionCollection()->action("rename");
renameAction->plug(popup);
// insert 'Move to Trash' for local URLs, otherwise insert 'Delete'
if (url.isLocalFile()) {
KAction* moveToTrashAction = dolphin.actionCollection()->action("move_to_trash");
moveToTrashAction->plug(popup);
}
else {
KAction* deleteAction = dolphin.actionCollection()->action("delete");
deleteAction->plug(popup);
}
// insert 'Bookmark this folder...' entry
// urls is a list of selected items, so insert boolmark menu if
// urls contains only one item, i.e. no multiple selection made
if (m_fileInfo->isDir() && (urls.count() == 1)) {
popup->insertItem(i18n("Bookmark this folder"), bookmarkID);
}
popup->insertSeparator();
// Insert 'Open With...' sub menu
QValueVector<KService::Ptr> openWithVector;
const int openWithID = insertOpenWithItems(popup, openWithVector);
// Insert 'Actions' sub menu
QValueVector<KDEDesktopMimeType::Service> actionsVector;
insertActionItems(popup, actionsVector);
// insert 'Properties...' entry
popup->insertSeparator();
KAction* propertiesAction = dolphin.actionCollection()->action("properties");
propertiesAction->plug(popup);
int id = popup->exec(m_pos);
if (id == restoreID ) {
KonqOperations::restoreTrashedItems(urls);
}
else if (id == bookmarkID) {
const KURL selectedURL(m_fileInfo->url());
KBookmark bookmark = EditBookmarkDialog::getBookmark(i18n("Add folder as bookmark"),
selectedURL.filename(),
selectedURL,
"bookmark");
if (!bookmark.isNull()) {
KBookmarkManager* manager = DolphinSettings::instance().bookmarkManager();
KBookmarkGroup root = manager->root();
root.addBookmark(manager, bookmark);
manager->emitChanged(root);
}
}
else if (id >= actionsIDStart) {
// one of the 'Actions' items has been selected
KDEDesktopMimeType::executeService(urls, actionsVector[id - actionsIDStart]);
}
else if (id >= openWithIDStart) {
// one of the 'Open With' items has been selected
if (id == openWithID) {
// the item 'Other...' has been selected
KRun::displayOpenWithDialog(urls);
}
else {
KService::Ptr servicePtr = openWithVector[id - openWithIDStart];
KRun::run(*servicePtr, urls);
}
}
openWithVector.clear();
actionsVector.clear();
popup->deleteLater();
}