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


C++ AddAction函数代码示例

本文整理汇总了C++中AddAction函数的典型用法代码示例。如果您正苦于以下问题:C++ AddAction函数的具体用法?C++ AddAction怎么用?C++ AddAction使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了AddAction函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: AddAction

void WatchWidget::CreateWidgets()
{
  m_toolbar = new QToolBar;
  m_toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);

  m_table = new QTableWidget;

  m_table->setColumnCount(5);
  m_table->verticalHeader()->setHidden(true);
  m_table->setContextMenuPolicy(Qt::CustomContextMenu);
  m_table->setSelectionMode(QAbstractItemView::SingleSelection);

  m_load = AddAction(m_toolbar, tr("Load"), this, &WatchWidget::OnLoad);
  m_save = AddAction(m_toolbar, tr("Save"), this, &WatchWidget::OnSave);

  m_load->setEnabled(false);
  m_save->setEnabled(false);

  auto* layout = new QVBoxLayout;
  layout->addWidget(m_toolbar);
  layout->addWidget(m_table);

  QWidget* widget = new QWidget;
  widget->setLayout(layout);

  setWidget(widget);
}
开发者ID:MikeRavenelle,项目名称:dolphin,代码行数:27,代码来源:WatchWidget.cpp

示例2: value

void kexInputKey::InitActions(void) {
    kexStr actionDef;
    kexKeyMap *keys;
    kexArray<kexHashKey> *list;
    kexStr name;
    int value;

    if( !gameManager.GameDef()                                      ||
        !gameManager.GameDef()->GetString("actionDef", actionDef)   ||
        !(keys = defManager.FindDefEntry(actionDef))) {
            common.Warning("kexInputKey::InitActions: No input action definition found\n");
            return;
    }

    list = keys->GetHashList();

    for(int i = 0; i < keys->GetHashSize(); i++) {
        for(unsigned int j = 0; j < list[i].Length(); j++) {
            name = list[i][j].GetName();
            if(!keys->GetInt(name, value)) {
                common.Warning("kexInputKey::InitActions: entry %s contains non-integer value (%s)\n",
                    name.c_str(), list[i][j].GetString());
                continue;
            }

            AddAction((byte)value, (kexStr("+") + name).c_str());
            AddAction((byte)value, (kexStr("-") + name).c_str());
        }
    }
}
开发者ID:svkaiser,项目名称:TurokEX,代码行数:30,代码来源:keyinput.cpp

示例3: QMenu

void WatchWidget::ShowContextMenu()
{
  QMenu* menu = new QMenu(this);

  if (m_table->selectedItems().size())
  {
    auto row_variant = m_table->selectedItems()[0]->data(Qt::UserRole);

    if (!row_variant.isNull())
    {
      int row = row_variant.toInt();

      if (row >= 0)
      {
        // i18n: This kind of "watch" is used for watching emulated memory.
        // It's not related to timekeeping devices.
        AddAction(menu, tr("&Delete Watch"), this, [this, row] { DeleteWatch(row); });
        AddAction(menu, tr("&Add Memory Breakpoint"), this,
                  [this, row] { AddWatchBreakpoint(row); });
      }
    }
  }

  menu->addSeparator();

  AddAction(menu, tr("Update"), this, &WatchWidget::Update);

  menu->exec(QCursor::pos());
}
开发者ID:MikeRavenelle,项目名称:dolphin,代码行数:29,代码来源:WatchWidget.cpp

示例4: QWidget

IcecastFilterWidget::IcecastFilterWidget(QWidget* parent)
    : QWidget(parent),
      ui_(new Ui_IcecastFilterWidget),
      menu_(new QMenu(tr("Display options"), this)),
      sort_mode_mapper_(new QSignalMapper(this)) {
  ui_->setupUi(this);

  // Icons
  ui_->options->setIcon(IconLoader::Load("configure"));

  // Options actions
  QActionGroup* group = new QActionGroup(this);
  AddAction(group, ui_->action_sort_genre_popularity,
            IcecastModel::SortMode_GenreByPopularity);
  AddAction(group, ui_->action_sort_genre_alphabetically,
            IcecastModel::SortMode_GenreAlphabetical);
  AddAction(group, ui_->action_sort_station,
            IcecastModel::SortMode_StationAlphabetical);

  // Options menu
  menu_->setIcon(ui_->options->icon());
  menu_->addActions(group->actions());
  ui_->options->setMenu(menu_);

  connect(sort_mode_mapper_, SIGNAL(mapped(int)), SLOT(SortModeChanged(int)));
}
开发者ID:Aceler,项目名称:Clementine,代码行数:26,代码来源:icecastfilterwidget.cpp

示例5: QWidget

IcecastFilterWidget::IcecastFilterWidget(QWidget *parent)
  : QWidget(parent),
    ui_(new Ui_IcecastFilterWidget),
    sort_mode_mapper_(new QSignalMapper(this))
{
  ui_->setupUi(this);

  // Icons
  ui_->options->setIcon(IconLoader::Load("configure"));

  // Options actions
  QActionGroup* group = new QActionGroup(this);
  AddAction(group, ui_->action_sort_genre_popularity, IcecastModel::SortMode_GenreByPopularity);
  AddAction(group, ui_->action_sort_genre_alphabetically, IcecastModel::SortMode_GenreAlphabetical);
  AddAction(group, ui_->action_sort_station, IcecastModel::SortMode_StationAlphabetical);

  // Options menu
  QMenu* options_menu = new QMenu(this);
  options_menu->addActions(group->actions());
  ui_->options->setMenu(options_menu);

  connect(sort_mode_mapper_, SIGNAL(mapped(int)), SLOT(SortModeChanged(int)));

#ifdef Q_OS_DARWIN
  delete ui_->filter;
  MacLineEdit* lineedit = new MacLineEdit(this);
  ui_->horizontalLayout->insertWidget(1, lineedit);
  filter_ = lineedit;
#else
  filter_ = ui_->filter;
#endif
}
开发者ID:ximion,项目名称:Clementine-LibDanceTag,代码行数:32,代码来源:icecastfilterwidget.cpp

示例6: addMenu

void MenuBar::AddFileMenu()
{
  QMenu* file_menu = addMenu(tr("&File"));
  m_open_action = AddAction(file_menu, tr("&Open..."), this, &MenuBar::Open,
                            QKeySequence(QStringLiteral("Ctrl+O")));
  m_exit_action = AddAction(file_menu, tr("E&xit"), this, &MenuBar::Exit,
                            QKeySequence(QStringLiteral("Alt+F4")));
}
开发者ID:t27duck,项目名称:dolphin,代码行数:8,代码来源:MenuBar.cpp

示例7: tVesselsSettingsMenuCommon

//-----------------------------------------------------------------------------
//! Create menu from common actions 
//-----------------------------------------------------------------------------
tVesselsSettingsMenuLowrance::tVesselsSettingsMenuLowrance( QWidget* parent )
: tVesselsSettingsMenuCommon( parent )
{
    SetTitle( tr( "Vessels", "TITLE" ) );

    tDistanceUnits distanceUnits = (tDistanceUnits)tUnitsSettings::Instance()->Units( UNITS_DISTANCE );

    // Must match tVesselsSettings.cpp
    QStringList lengthOptions;
    lengthOptions << tr( "Off" );
    if ( distanceUnits == UNITS_DISTANCE_NAUTICAL_MILES )
    {            
        lengthOptions << tr( "1 NM", "nautical miles" );
        lengthOptions << tr( "10 NM", "nautical miles" );
        lengthOptions << tr( "100 NM", "nautical miles" );
    }

    else if ( distanceUnits == UNITS_DISTANCE_KILOMETERS )
    {        
        lengthOptions << tr( "1 km", "kilometers" );
        lengthOptions << tr( "10 km", "kilometers" );
        lengthOptions << tr( "100 km", "kilometers" );
    }

    else if ( distanceUnits == UNITS_DISTANCE_MILES )
    {        
        lengthOptions << tr( "1 mile", "miles" );
        lengthOptions << tr( "10 miles", "miles" );
        lengthOptions << tr( "100 miles", "miles" );
    }

    lengthOptions << tr( "1 min", "minutes" ) 
                  << tr( "2 min", "minutes" )
                  << tr( "10 min", "minutes" )
                  << tr( "30 min", "minutes" )
                  << tr( "60 min", "minutes" )
                  << tr( "120 min", "minutes" );

    int initialIndex = 0;
    if ( m_VesselsSettings.ExtensionLines() &&
         m_VesselsSettings.CourseExtensionConfig() != tVesselsSettings::Extension_Infinite )
    {
        initialIndex = static_cast<int>( m_VesselsSettings.CourseExtensionConfig() ) + 1; //Plus one to step over "Off"
    }

    m_pCourseExtensionAct = new tListAction( tr( "Course extension" ), lengthOptions, initialIndex );
    Connect( m_pCourseExtensionAct, SIGNAL( ValueFinalised( int ) ), this, SLOT( OnCourseExtensionFinalised( int ) ) );

    // HDS 5x (sonar-only) doesn't fully expose AIS, but does have MARPA
    //  MARPA only really needs the course extension and dangerous vessels menu items
    if( tProductSettings::Instance().AISAllowed() )
    {
        AddAction( m_pSetMMSIAct );
        AddAction( m_pHideIconsAct );
    }
    AddAction( m_pCourseExtensionAct );
    AddAction( m_pDangerousVesselsAct );
}
开发者ID:dulton,项目名称:53_hero,代码行数:61,代码来源:tVesselsSettingsMenuLowrance.cpp

示例8: AddAction

void __fastcall TReconcileErrorForm::InitReconcileActions() {
  AddAction(raSkip);
  AddAction(raCancel);
  AddAction(raCorrect);
  if (FCurColIdx > 0) {
    AddAction(raRefresh);
    AddAction(raMerge);
  }
  ActionGroup->ItemIndex = 0;
}
开发者ID:SkylineNando,项目名称:Delphi,代码行数:10,代码来源:RecError.cpp

示例9: SetTitle

DemoOcclusion::DemoOcclusion()
{
  SetTitle("Occlusion Demo");
  AddAction('1', "Increase Occlusion", std::bind(&DemoOcclusion::OcclusionInc, this));
  AddAction('2', "Decrease Occlusion", std::bind(&DemoOcclusion::OcclusionDec, this));

  OccludeValue = 0;

  YSE::System().occlusionCallback(OcclusionFunction);
	sound.create("..\\TestResources\\pulse1.ogg", nullptr, true);
	sound.occlusion(true);
  sound.play();
}
开发者ID:yvanvds,项目名称:yse-soundengine,代码行数:13,代码来源:Demo08_Occlusion.cpp

示例10: tCZoneSettingsMenuCommon

//-----------------------------------------------------------------------------
//! Create menu from common actions 
//-----------------------------------------------------------------------------
tCZoneSettingsMenuSimrad::tCZoneSettingsMenuSimrad( QWidget* parent )
: tCZoneSettingsMenuCommon( parent )
{
    SetTitle( "CZone" );   // don't need to translate brand name

    AddAction( m_pSetBatteryFullAction );
    AddAction( m_pShowOnStartupAction );
    AddAction( m_pBacklightAction );
    AddSeparator();
    AddAction( m_pSetDipswitchAction );
//    AddAction( m_pReclaimAction );

}
开发者ID:dulton,项目名称:53_hero,代码行数:16,代码来源:tCZoneSettingsMenuSimrad.cpp

示例11: AddAction

void MenuBar::AddStateLoadMenu(QMenu* emu_menu)
{
  m_state_load_menu = emu_menu->addMenu(tr("&Load State"));
  AddAction(m_state_load_menu, tr("Load State from File"), this, &MenuBar::StateLoad);
  AddAction(m_state_load_menu, tr("Load State from Selected Slot"), this, &MenuBar::StateLoadSlot);
  m_state_load_slots_menu = m_state_load_menu->addMenu(tr("Load State from Slot"));
  AddAction(m_state_load_menu, tr("Undo Load State"), this, &MenuBar::StateLoadUndo);

  for (int i = 1; i <= 10; i++)
  {
    QAction* action = m_state_load_slots_menu->addAction(QStringLiteral(""));

    connect(action, &QAction::triggered, this, [=]() { emit StateLoadSlotAt(i); });
  }
}
开发者ID:t27duck,项目名称:dolphin,代码行数:15,代码来源:MenuBar.cpp

示例12: GetNode

bool CCharShape::RotateNode (size_t node_name, int axis, ETR_DOUBLE angle) {
	TCharNode *node = GetNode (node_name);
	if (node == NULL) return false;

	if (axis > 3) return false;

	TMatrix<4, 4> rotMatrix;
	char caxis = '0';
	switch (axis) {
		case 1:
			caxis = 'x';
			break;
		case 2:
			caxis = 'y';
			break;
		case 3:
			caxis = 'z';
			break;
	}

	rotMatrix.SetRotationMatrix(angle, caxis);
	node->trans = node->trans * rotMatrix;
	rotMatrix.SetRotationMatrix(-angle, caxis);
	node->invtrans = rotMatrix * node->invtrans;

	if (newActions && useActions) AddAction (node_name, axis, NullVec3, angle);
	return true;
}
开发者ID:dbluelle,项目名称:pandora-extremetuxracer,代码行数:28,代码来源:tux.cpp

示例13: StartupPlugin

/* Handles startup.
*/
static AIErr StartupPlugin ( SPInterfaceMessage* message )
{
	AIErr error = kNoErr;
	error = AcquireSuites( message->d.basic );
	if (!error) {
		// Allocate our globals - Illustrator will keep track of these.
		error = message->d.basic->AllocateBlock( sizeof(Globals), (void **) &g );
		if ( !error ) { 
			message->d.globals = g;
		}
	}
	if (!error) {
		error = AddMenu(message);
	}
	if (!error) {	
		error = AddFilter(message);
	}
	if (!error) {
		error = AddTool(message);
	}
	if (!error) {
		error = AddAction(message);
	}
	ReleaseSuites( message->d.basic );
	return error;
}
开发者ID:btempleton,项目名称:sg-aics3mac-plugins,代码行数:28,代码来源:Tutorial.cpp

示例14: AddAction

QAction* NodeInstanceWidget::AddActionDelete()
{
	return AddAction( tr("Delete"), [this](){
		deleteLater();
		emit DeleteNodeInstance(mNodeInstance);
	});
}
开发者ID:jschmidt42,项目名称:nim,代码行数:7,代码来源:NodeInstanceWidget.cpp

示例15: GetNode

bool CCharShape::RotateNode (size_t node_name, int axis, double angle) {
    TCharNode *node = GetNode (node_name);
    if (node == NULL) return false;

    if (axis > 3) return false;

    TMatrix rotMatrix;
    char caxis = '0';
    switch (axis) {
    case 1:
        caxis = 'x';
        break;
    case 2:
        caxis = 'y';
        break;
    case 3:
        caxis = 'z';
        break;
    }

    MakeRotationMatrix (rotMatrix, angle, caxis);
    MultiplyMatrices (node->trans, node->trans, rotMatrix);
    MakeRotationMatrix (rotMatrix, -angle, caxis);
    MultiplyMatrices (node->invtrans, rotMatrix, node->invtrans);

    if (newActions && useActions) AddAction (node_name, axis, NullVec, angle);
    return true;
}
开发者ID:ktan2020,项目名称:extremetuxracer-win32,代码行数:28,代码来源:tux.cpp


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