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


C++ QAction::iconText方法代码示例

本文整理汇总了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."));
            }
        }
    }
}
开发者ID:AndroidDev77,项目名称:OpenDDS,代码行数:26,代码来源:Viewer.cpp

示例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;
}
开发者ID:wilbert2000,项目名称:wzplayer,代码行数:60,代码来源:toolbareditor.cpp

示例3: iconText

QString QActionProto::iconText() const
{
  QAction *item = qscriptvalue_cast<QAction*>(thisObject());
  if (item)
    return item->iconText();
  return QString();
}
开发者ID:Wushaowei001,项目名称:xtuple-1,代码行数:7,代码来源:qactionproto.cpp

示例4: loadColorRamp

void QgsColorRampButton::loadColorRamp()
{
  QAction *selectedItem = qobject_cast<QAction *>( sender() );
  if ( selectedItem )
  {
    QString name = selectedItem->iconText();
    setColorRampName( name );
    setColorRampFromName( name );
  }
}
开发者ID:cz172638,项目名称:QGIS,代码行数:10,代码来源:qgscolorrampbutton.cpp

示例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);
}
开发者ID:Aconex,项目名称:pcp,代码行数:16,代码来源:settingsdialog.cpp

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

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

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


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