本文整理汇总了C++中ExplorerCollectionTreeItem::collection方法的典型用法代码示例。如果您正苦于以下问题:C++ ExplorerCollectionTreeItem::collection方法的具体用法?C++ ExplorerCollectionTreeItem::collection怎么用?C++ ExplorerCollectionTreeItem::collection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExplorerCollectionTreeItem
的用法示例。
在下文中一共展示了ExplorerCollectionTreeItem::collection方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ui_renameCollection
void ExplorerTreeWidget::ui_renameCollection()
{
ExplorerCollectionTreeItem *collectionItem = selectedCollectionItem();
if (!collectionItem)
return;
MongoCollection *collection = collectionItem->collection();
MongoDatabase *database = collection->database();
MongoServer *server = database->server();
ConnectionSettings *settings = server->connectionRecord();
CreateDatabaseDialog dlg(settings->getFullAddress(),
database->name(),
collection->name());
dlg.setWindowTitle("Rename Collection");
dlg.setOkButtonText("&Rename");
dlg.setInputLabelText("New Collection Name:");
dlg.setInputText(collection->name());
int result = dlg.exec();
if (result == QDialog::Accepted) {
database->renameCollection(collection->name(), dlg.databaseName());
// refresh list of collections
database->loadCollections();
}
}
示例2: ui_itemDoubleClicked
void ExplorerWidget::ui_itemDoubleClicked(QTreeWidgetItem *item, int column)
{
ExplorerCollectionTreeItem *collectionItem = dynamic_cast<ExplorerCollectionTreeItem *>(item);
if (collectionItem) {
AppRegistry::instance().app()->openShell(collectionItem->collection());
}
}
示例3: ui_dropCollection
void ExplorerTreeWidget::ui_dropCollection()
{
ExplorerCollectionTreeItem *collectionItem = selectedCollectionItem();
if (!collectionItem)
return;
MongoCollection *collection = collectionItem->collection();
MongoDatabase *database = collection->database();
MongoServer *server = database->server();
ConnectionSettings *settings = server->connectionRecord();
// Ask user
int answer = QMessageBox::question(this,
"Drop Collection",
QString("Drop <b>%1</b> collection?").arg(collection->name()),
QMessageBox::Yes, QMessageBox::No, QMessageBox::NoButton);
if (answer != QMessageBox::Yes)
return;
database->dropCollection(collection->name());
database->loadCollections();
//openCurrentCollectionShell("db.%1.drop()", false);
}
示例4: ui_removeAllDocuments
void ExplorerTreeWidget::ui_removeAllDocuments()
{
ExplorerCollectionTreeItem *collectionItem = selectedCollectionItem();
if (!collectionItem)
return;
MongoCollection *collection = collectionItem->collection();
MongoDatabase *database = collection->database();
MongoServer *server = database->server();
ConnectionSettings *settings = server->connectionRecord();
// Ask user
int answer = QMessageBox::question(this,
"Remove All Documents",
QString("Remove all documents from <b>%1</b> collection?").arg(collection->name()),
QMessageBox::Yes, QMessageBox::No, QMessageBox::NoButton);
if (answer != QMessageBox::Yes)
return;
mongo::BSONObjBuilder builder;
mongo::BSONObj bsonQuery = builder.obj();
mongo::Query query(bsonQuery);
server->removeDocuments(query, database->name(), collection->name(), false);
}
示例5: ui_addDocument
void ExplorerTreeWidget::ui_addDocument()
{
ExplorerCollectionTreeItem *collectionItem = selectedCollectionItem();
if (!collectionItem)
return;
MongoCollection *collection = collectionItem->collection();
MongoDatabase *database = collection->database();
MongoServer *server = database->server();
ConnectionSettings *settings = server->connectionRecord();
DocumentTextEditor editor(settings->getFullAddress(), database->name(),
collection->name(), "{\n \n}");
editor.setCursorPosition(1, 4);
editor.setWindowTitle("Insert Document");
int result = editor.exec();
activateWindow();
if (result == QDialog::Accepted) {
mongo::BSONObj obj = editor.bsonObj();
server->insertDocument(obj, database->name(), collection->name());
}
/*
openCurrentCollectionShell(
"db.%1.insert({\n"
" '' : '',\n"
"})"
, false, CursorPosition(1, 5));
*/
}
示例6: ui_itemClicked
void ExplorerWidget::ui_itemClicked(QTreeWidgetItem *item, int cloumn)
{
if (!AppRegistry::instance().settingsManager()->useTabbar()) {
ExplorerCollectionTreeItem *collectionItem = dynamic_cast<ExplorerCollectionTreeItem *>(item);
if (collectionItem) {
AppRegistry::instance().app()->openShell(collectionItem->collection());
}
}
}
示例7: openCurrentCollectionShell
void ExplorerTreeWidget::openCurrentCollectionShell(const QString &script, bool execute,
const CursorPosition &cursor)
{
ExplorerCollectionTreeItem *collectionItem = selectedCollectionItem();
if (!collectionItem)
return;
MongoCollection *collection = collectionItem->collection();
QString query = QString(script).arg(collection->name());
AppRegistry::instance().app()->
openShell(collection->database(), query, execute, collection->name(), cursor);
}
示例8: ui_addIndexGui
void ExplorerCollectionDirIndexesTreeItem::ui_addIndexGui()
{
ExplorerCollectionTreeItem *par = dynamic_cast<ExplorerCollectionTreeItem *const>(parent());
if (!par)
return;
EnsureIndexInfo fakeInfo(par->collection()->info(),"");
EditIndexDialog dlg(fakeInfo , QtUtils::toQString(par->databaseItem()->database()->name()),QtUtils::toQString(par->databaseItem()->database()->server()->connectionRecord()->getFullAddress()), treeWidget());
int result = dlg.exec();
if (result != QDialog::Accepted)
return;
ExplorerDatabaseTreeItem *databaseTreeItem = static_cast<ExplorerDatabaseTreeItem *>(par->databaseItem());
if (!databaseTreeItem)
return;
databaseTreeItem->enshureIndex(par,fakeInfo, dlg.info());
}