當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。