本文整理汇总了C++中QAction::iconText方法的典型用法代码示例。如果您正苦于以下问题:C++ QAction::iconText方法的具体用法?C++ QAction::iconText怎么用?C++ QAction::iconText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAction
的用法示例。
在下文中一共展示了QAction::iconText方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void
Viewer::graphContextMenu(const QPoint& pos)
{
QPoint globalPos = this->ui.scrollArea->mapToGlobal(pos);
QAction* selectedItem = graphMenu.exec(globalPos);
if (selectedItem) {
if (selectedItem->iconText() == GRAPH_UPDATE_ACTION)
{
updateGraphView();
}
else if (selectedItem->iconText() == GRAPH_OPTIONS_ACTION)
{
showGraphOptions();
}
else if (selectedItem->iconText() == GRAPH_VIEW_TO_FILE)
{
if (graphView != 0) {
saveImage(graphView->pixmap());
}
else {
this->ui.statusbar->showMessage( tr("No image to save."));
}
}
}
}
示例2: saveActions
QStringList TToolbarEditor::saveActions() {
logger()->debug("saveActions");
QStringList list;
for (int row = 0; row < active_actions_table->rowCount(); row++) {
QTableWidgetItem* item = active_actions_table->item(row, COL_NAME);
if (item) {
QString action_name = item->text();
if (action_name.startsWith("separator")) {
action_name = "separator";
}
QString s = action_name;
bool ns = getVis(row, COL_NS);
bool fs = getVis(row, COL_FS);
if (ns) {
if (!fs) {
s += "|1|0";
}
} else if (fs) {
s += "|0|1";
} else {
s += "|0|0";
}
list << s;
if (action_name != "separator") {
// Update icon text
QAction* action = findAction(action_name, *all_actions);
if (action) {
item = active_actions_table->item(row, COL_DESC);
if (item) {
QString action_icon_text = TActionsEditor::actionTextToDescription(
item->text(), action_name).trimmed();
if (!action_icon_text.isEmpty()) {
QString action_text = TActionsEditor::actionTextToDescription(action->text(), action_name);
if (action_text != action_icon_text) {
action->setIconText(action_icon_text);
action->setProperty("modified", true);
logger()->debug("saveActions: updated icon text '"
+ action_name + "' to '" + action_icon_text
+ "'");
} else {
action_icon_text = TActionsEditor::actionTextToDescription(action->iconText(), action_name);
if (action_icon_text != action_text) {
action->setIconText(action_text);
logger()->debug("saveActions: cleared icon text "
+ action_name);
}
}
}
}
}
}
}
}
return list;
}
示例3: iconText
QString QActionProto::iconText() const
{
QAction *item = qscriptvalue_cast<QAction*>(thisObject());
if (item)
return item->iconText();
return QString();
}
示例4: loadColorRamp
void QgsColorRampButton::loadColorRamp()
{
QAction *selectedItem = qobject_cast<QAction *>( sender() );
if ( selectedItem )
{
QString name = selectedItem->iconText();
setColorRampName( name );
setColorRampFromName( name );
}
}
示例5: setupActionsList
void SettingsDialog::setupActionsList()
{
QList<QAction*> actionsList = pmchart->toolbarActionsList();
QList<QAction*> enabledList = pmchart->enabledActionsList();
actionListWidget->blockSignals(true);
actionListWidget->clear();
for (int i = 0; i < actionsList.size(); i++) {
QAction *action = actionsList.at(i);
QListWidgetItem *item = new QListWidgetItem(action->icon(), action->iconText());
actionListWidget->insertItem(i, item);
if (enabledList.contains(action) == false)
item->setBackground(disabled);
}
actionListWidget->blockSignals(false);
}
示例6: setEnabledActionsList
void PmView::setEnabledActionsList(QStringList tools, bool redisplay)
{
my.enabledActionsList.clear();
for (int i = 0; i < my.toolbarActionsList.size(); i++) {
QAction *action = my.toolbarActionsList.at(i);
if (tools.contains(action->iconText()))
my.enabledActionsList.append(action);
}
if (redisplay) {
my.toolbarHidden = (my.enabledActionsList.size() == 0);
toolbarAction->setChecked(my.toolbarHidden);
if (my.toolbarHidden)
toolBar->hide();
else
toolBar->show();
}
}
示例7: contextMenuEvent
void CustomLabel::contextMenuEvent(QContextMenuEvent* e) {
if (editable_) {
QMenu* men = new QMenu(this);
men->addAction("Rename");
men->addAction("Set Default");
QAction* ac = men->exec(e->globalPos());
if(ac != 0) {
if(ac->iconText().compare("Rename") == 0) {
edit_->setText(text());
edit_->setFocus();
edit_->setCursorPosition(edit_->text().length());
edit_->resize(size());
edit_->show();
} else {
propertyWidget_->getProperty()->reset();
if(dynamic_cast<TransFuncProperty*>(propertyWidget_->getProperty()))
propertyWidget_->getProperty()->invalidate();
}
}
}
}
示例8: keyPressEvent
void ShortcutViewer::keyPressEvent(QKeyEvent *event)
{
int key = event->key();
if (key == Qt::Key_Control || key == Qt::Key_Shift || key == Qt::Key_Alt) {
event->ignore();
return;
}
Qt::KeyboardModifiers modifiers = event->modifiers();
// Tasti che non possono essere utilizzati come shortcut
if ((modifiers | (Qt::CTRL | Qt::SHIFT | Qt::ALT)) != (Qt::CTRL | Qt::SHIFT | Qt::ALT) || key == Qt::Key_Home || key == Qt::Key_End || key == Qt::Key_PageDown || key == Qt::Key_PageUp || key == Qt::Key_Escape || key == Qt::Key_Print || key == Qt::Key_Pause || key == Qt::Key_ScrollLock) {
if (key != Qt::Key_Plus && key != Qt::Key_Minus && key != Qt::Key_Asterisk && key != Qt::Key_Slash) {
event->ignore();
return;
} else
modifiers = 0;
}
if (m_action) {
CommandManager *cm = CommandManager::instance();
QKeySequence keySequence(key + modifiers);
std::string shortcutString = keySequence.toString().toStdString();
QAction *oldAction = cm->getActionFromShortcut(keySequence.toString().toStdString());
if (oldAction == m_action)
return;
if (oldAction) {
QString msg = tr("%1 is already assigned to '%2'\nAssign to '%3'?").arg(keySequence.toString()).arg(oldAction->iconText()).arg(m_action->iconText());
int ret = DVGui::MsgBox(msg, tr("Yes"), tr("No"), 1);
activateWindow();
if (ret == 2 || ret == 0)
return;
}
CommandManager::instance()->setShortcut(m_action, shortcutString);
emit shortcutChanged();
}
event->accept();
update();
}