当前位置: 首页>>代码示例>>C++>>正文


C++ ExplorerCollectionTreeItem::collection方法代码示例

本文整理汇总了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();
    }
}
开发者ID:AlPatsino,项目名称:robomongo,代码行数:27,代码来源:ExplorerTreeWidget.cpp

示例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());
     }
 }
开发者ID:PixelPirate,项目名称:robomongo,代码行数:7,代码来源:ExplorerWidget.cpp

示例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);
}
开发者ID:AlPatsino,项目名称:robomongo,代码行数:25,代码来源:ExplorerTreeWidget.cpp

示例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);
}
开发者ID:AlPatsino,项目名称:robomongo,代码行数:26,代码来源:ExplorerTreeWidget.cpp

示例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));
    */
}
开发者ID:AlPatsino,项目名称:robomongo,代码行数:32,代码来源:ExplorerTreeWidget.cpp

示例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());
         }
     }
 }
开发者ID:PixelPirate,项目名称:robomongo,代码行数:9,代码来源:ExplorerWidget.cpp

示例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);
}
开发者ID:AlPatsino,项目名称:robomongo,代码行数:13,代码来源:ExplorerTreeWidget.cpp

示例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());
    }
开发者ID:2812140729,项目名称:robomongo,代码行数:17,代码来源:ExplorerCollectionTreeItem.cpp


注:本文中的ExplorerCollectionTreeItem::collection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。