本文整理汇总了C++中ConnectionSettings::getReadableName方法的典型用法代码示例。如果您正苦于以下问题:C++ ConnectionSettings::getReadableName方法的具体用法?C++ ConnectionSettings::getReadableName怎么用?C++ ConnectionSettings::getReadableName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConnectionSettings
的用法示例。
在下文中一共展示了ConnectionSettings::getReadableName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateConnectionsMenu
void MainWindow::updateConnectionsMenu()
{
_connectionsMenu->clear();
int number = 1;
// Populate list with connections
SettingsManager::ConnectionSettingsContainerType connections = AppRegistry::instance().settingsManager()->connections();
for(SettingsManager::ConnectionSettingsContainerType::const_iterator it = connections.begin(); it!= connections.end(); ++it) {
ConnectionSettings *connection = *it;
QAction *action = new QAction(QtUtils::toQString(connection->getReadableName()), this);
action->setData(QVariant::fromValue(connection));
if (number <= 9 && !AppRegistry::instance().settingsManager()->disableConnectionShortcuts()) {
action->setShortcut(QKeySequence(QString("Alt+").append(QString::number(number))));
}
_connectionsMenu->addAction(action);
++number;
}
if (AppRegistry::instance().settingsManager()->connections().size() > 0)
_connectionsMenu->addSeparator();
// Connect action
QAction *connectAction = new QAction("&Manage Connections...", this);
connectAction->setIcon(GuiRegistry::instance().connectIcon());
connectAction->setToolTip("Connect to MongoDB");
VERIFY(connect(connectAction, SIGNAL(triggered()), this, SLOT(manageConnections())));
_connectionsMenu->addAction(connectAction);
}
示例2: remove
/**
* @brief Initiate 'remove' action, usually when user clicked on Remove button
*/
void ConnectionsDialog::remove()
{
ConnectionListWidgetItem *currentItem =
(ConnectionListWidgetItem *)_listWidget->currentItem();
// Do nothing if no item selected
if (currentItem == 0)
return;
ConnectionSettings *connectionModel = currentItem->connection();
// Ask user
int answer = QMessageBox::question(this,
"Connections",
QString("Really delete \"%1\" connection?").arg(QtUtils::toQString(connectionModel->getReadableName())),
QMessageBox::Yes, QMessageBox::No, QMessageBox::NoButton);
if (answer != QMessageBox::Yes)
return;
_settingsManager->removeConnection(connectionModel);
}