本文整理汇总了C++中QMenu::addActions方法的典型用法代码示例。如果您正苦于以下问题:C++ QMenu::addActions方法的具体用法?C++ QMenu::addActions怎么用?C++ QMenu::addActions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMenu
的用法示例。
在下文中一共展示了QMenu::addActions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: firstRunQuery
CoverFoundDialog::CoverFoundDialog( const CoverFetchUnit::Ptr unit,
const CoverFetch::Metadata &data,
QWidget *parent )
: KDialog( parent )
, m_album( unit->album() )
, m_isSorted( false )
, m_sortEnabled( false )
, m_unit( unit )
, m_queryPage( 0 )
{
DEBUG_BLOCK
setButtons( KDialog::Ok | KDialog::Cancel |
KDialog::User1 ); // User1: clear icon view
setButtonGuiItem( KDialog::User1, KStandardGuiItem::clear() );
connect( button( KDialog::User1 ), SIGNAL(clicked()), SLOT(clearView()) );
m_save = button( KDialog::Ok );
QSplitter *splitter = new QSplitter( this );
m_sideBar = new CoverFoundSideBar( m_album, splitter );
KVBox *vbox = new KVBox( splitter );
vbox->setSpacing( 4 );
KHBox *breadcrumbBox = new KHBox( vbox );
QLabel *breadcrumbLabel = new QLabel( i18n( "Finding cover for" ), breadcrumbBox );
AlbumBreadcrumbWidget *breadcrumb = new AlbumBreadcrumbWidget( m_album, breadcrumbBox );
QFont breadcrumbLabelFont;
breadcrumbLabelFont.setBold( true );
breadcrumbLabel->setFont( breadcrumbLabelFont );
breadcrumbLabel->setIndent( 4 );
connect( breadcrumb, SIGNAL(artistClicked(QString)), SLOT(addToCustomSearch(QString)) );
connect( breadcrumb, SIGNAL(albumClicked(QString)), SLOT(addToCustomSearch(QString)) );
KHBox *searchBox = new KHBox( vbox );
vbox->setSpacing( 4 );
QStringList completionNames;
QString firstRunQuery( m_album->name() );
completionNames << firstRunQuery;
if( m_album->hasAlbumArtist() )
{
const QString &name = m_album->albumArtist()->name();
completionNames << name;
firstRunQuery += ' ' + name;
}
m_query = firstRunQuery;
m_album->setSuppressImageAutoFetch( true );
m_search = new KComboBox( searchBox );
m_search->setEditable( true ); // creates a KLineEdit for the combobox
m_search->setTrapReturnKey( true );
m_search->setInsertPolicy( QComboBox::NoInsert ); // insertion is handled by us
m_search->setCompletionMode( KGlobalSettings::CompletionPopup );
m_search->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed );
qobject_cast<KLineEdit*>( m_search->lineEdit() )->setClickMessage( i18n( "Enter Custom Search" ) );
m_search->completionObject()->setOrder( KCompletion::Insertion );
m_search->completionObject()->setIgnoreCase( true );
m_search->completionObject()->setItems( completionNames );
m_search->insertItem( 0, KStandardGuiItem::find().icon(), QString() );
m_search->insertSeparator( 1 );
m_search->insertItem( 2, KIcon("filename-album-amarok"), m_album->name() );
if( m_album->hasAlbumArtist() )
m_search->insertItem( 3, KIcon("filename-artist-amarok"), m_album->albumArtist()->name() );
m_searchButton = new KPushButton( KStandardGuiItem::find(), searchBox );
KPushButton *sourceButton = new KPushButton( KStandardGuiItem::configure(), searchBox );
updateSearchButton( firstRunQuery );
QMenu *sourceMenu = new QMenu( sourceButton );
QAction *lastFmAct = new QAction( i18n( "Last.fm" ), sourceMenu );
QAction *googleAct = new QAction( i18n( "Google" ), sourceMenu );
QAction *discogsAct = new QAction( i18n( "Discogs" ), sourceMenu );
lastFmAct->setCheckable( true );
googleAct->setCheckable( true );
discogsAct->setCheckable( true );
connect( lastFmAct, SIGNAL(triggered()), this, SLOT(selectLastFm()) );
connect( googleAct, SIGNAL(triggered()), this, SLOT(selectGoogle()) );
connect( discogsAct, SIGNAL(triggered()), this, SLOT(selectDiscogs()) );
m_sortAction = new QAction( i18n( "Sort by size" ), sourceMenu );
m_sortAction->setCheckable( true );
connect( m_sortAction, SIGNAL(triggered(bool)), this, SLOT(sortingTriggered(bool)) );
QActionGroup *ag = new QActionGroup( sourceButton );
ag->addAction( lastFmAct );
ag->addAction( googleAct );
ag->addAction( discogsAct );
sourceMenu->addActions( ag->actions() );
sourceMenu->addSeparator();
sourceMenu->addAction( m_sortAction );
sourceButton->setMenu( sourceMenu );
connect( m_search, SIGNAL(returnPressed(QString)), SLOT(insertComboText(QString)) );
connect( m_search, SIGNAL(returnPressed(QString)), SLOT(processQuery(QString)) );
connect( m_search, SIGNAL(returnPressed(QString)), SLOT(updateSearchButton(QString)) );
connect( m_search, SIGNAL(editTextChanged(QString)), SLOT(updateSearchButton(QString)) );
//.........这里部分代码省略.........
示例2: QWidget
PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QWidget *_par )
: QWidget( _par ), p_intf ( _p_i )
{
setContentsMargins( 0, 3, 0, 3 );
QGridLayout *layout = new QGridLayout( this );
layout->setMargin( 0 ); layout->setSpacing( 0 );
/*******************
* Left *
*******************/
/* We use a QSplitter for the left part */
leftSplitter = new QSplitter( Qt::Vertical, this );
/* Source Selector */
selector = new PLSelector( this, p_intf );
leftSplitter->addWidget( selector );
/* Create a Container for the Art Label
in order to have a beautiful resizing for the selector above it */
artContainer = new QStackedWidget;
artContainer->setMaximumHeight( 128 );
/* Art label */
CoverArtLabel *art = new CoverArtLabel( artContainer, p_intf );
art->setToolTip( qtr( "Double click to get media information" ) );
artContainer->addWidget( art );
CONNECT( THEMIM->getIM(), artChanged( QString ),
art, showArtUpdate( const QString& ) );
leftSplitter->addWidget( artContainer );
/*******************
* Right *
*******************/
/* Initialisation of the playlist */
playlist_t * p_playlist = THEPL;
PL_LOCK;
playlist_item_t *p_root = p_playlist->p_playing;
PL_UNLOCK;
setMinimumWidth( 400 );
PLModel *model = PLModel::getPLModel( p_intf );
#ifdef MEDIA_LIBRARY
MLModel *mlmodel = new MLModel( p_intf, this );
mainView = new StandardPLPanel( this, p_intf, p_root, selector, model, mlmodel );
#else
mainView = new StandardPLPanel( this, p_intf, p_root, selector, model, NULL );
#endif
/* Location Bar */
locationBar = new LocationBar( model );
locationBar->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Preferred );
layout->addWidget( locationBar, 0, 0, 1, 2 );
layout->setColumnStretch( 0, 5 );
CONNECT( locationBar, invoked( const QModelIndex & ),
mainView, browseInto( const QModelIndex & ) );
QHBoxLayout *topbarLayout = new QHBoxLayout();
layout->addLayout( topbarLayout, 0, 1 );
topbarLayout->setSpacing( 10 );
/* Button to switch views */
QToolButton *viewButton = new QToolButton( this );
viewButton->setIcon( style()->standardIcon( QStyle::SP_FileDialogDetailedView ) );
viewButton->setToolTip( qtr("Change playlistview") );
topbarLayout->addWidget( viewButton );
/* View selection menu */
QSignalMapper *viewSelectionMapper = new QSignalMapper( this );
CONNECT( viewSelectionMapper, mapped( int ), mainView, showView( int ) );
QActionGroup *actionGroup = new QActionGroup( this );
#ifndef NDEBUG
# define MAX_VIEW StandardPLPanel::VIEW_COUNT
#else
# define MAX_VIEW StandardPLPanel::VIEW_COUNT - 1
#endif
for( int i = 0; i < MAX_VIEW; i++ )
{
viewActions[i] = actionGroup->addAction( viewNames[i] );
viewActions[i]->setCheckable( true );
viewSelectionMapper->setMapping( viewActions[i], i );
CONNECT( viewActions[i], triggered(), viewSelectionMapper, map() );
}
viewActions[mainView->currentViewIndex()]->setChecked( true );
QMenu *viewMenu = new QMenu( viewButton );
viewMenu->addActions( actionGroup->actions() );
viewButton->setMenu( viewMenu );
CONNECT( viewButton, clicked(), mainView, cycleViews() );
/* Search */
searchEdit = new SearchLineEdit( this );
searchEdit->setMaximumWidth( 250 );
searchEdit->setMinimumWidth( 80 );
//.........这里部分代码省略.........
示例3: QFrame
//.........这里部分代码省略.........
QVBoxLayout* vLayout = new QVBoxLayout(mainWindowFrame);
vLayout->setSpacing(3);
vLayout->setContentsMargins(2,2,2,2);
vLayout->addWidget(topSubFrame);
vLayout->addWidget(m_memTable);
setCentralWidget(mainWindowFrame);
//
// Menu bars
//
// Create a data format group
QActionGroup* dataFormat = new QActionGroup(this);
dataFormat->setObjectName("dataformat");
QAction* formatActOne = new QAction("1-byte chunks", this);
QAction* formatActTwo = new QAction("2-byte chunks", this);
QAction* formatActFour = new QAction("4-byte chunks", this);
QAction* formatActEight = new QAction("8-byte chunks", this);
QAction* formatAct32bitFloat = new QAction("32 bit floating point", this);
QAction* formatAct64bitFloat = new QAction("64 bit floating point", this);
QAction* formatAct80bitFloat = new QAction("80 bit floating point", this);
formatActOne->setObjectName("formatActOne");
formatActTwo->setObjectName("formatActTwo");
formatActFour->setObjectName("formatActFour");
formatActEight->setObjectName("formatActEight");
formatAct32bitFloat->setObjectName("formatAct32bitFloat");
formatAct64bitFloat->setObjectName("formatAct64bitFloat");
formatAct80bitFloat->setObjectName("formatAct80bitFloat");
formatActOne->setCheckable(true);
formatActTwo->setCheckable(true);
formatActFour->setCheckable(true);
formatActEight->setCheckable(true);
formatAct32bitFloat->setCheckable(true);
formatAct64bitFloat->setCheckable(true);
formatAct80bitFloat->setCheckable(true);
formatActOne->setActionGroup(dataFormat);
formatActTwo->setActionGroup(dataFormat);
formatActFour->setActionGroup(dataFormat);
formatActEight->setActionGroup(dataFormat);
formatAct32bitFloat->setActionGroup(dataFormat);
formatAct64bitFloat->setActionGroup(dataFormat);
formatAct80bitFloat->setActionGroup(dataFormat);
formatActOne->setShortcut(QKeySequence("Ctrl+1"));
formatActTwo->setShortcut(QKeySequence("Ctrl+2"));
formatActFour->setShortcut(QKeySequence("Ctrl+4"));
formatActEight->setShortcut(QKeySequence("Ctrl+8"));
formatAct32bitFloat->setShortcut(QKeySequence("Ctrl+9"));
formatActOne->setChecked(true);
connect(dataFormat, &QActionGroup::triggered, this, &MemoryWindow::formatChanged);
// Create a address display group
QActionGroup* addressGroup = new QActionGroup(this);
addressGroup->setObjectName("addressgroup");
QAction* addressActLogical = new QAction("Logical Addresses", this);
QAction* addressActPhysical = new QAction("Physical Addresses", this);
addressActLogical->setCheckable(true);
addressActPhysical->setCheckable(true);
addressActLogical->setActionGroup(addressGroup);
addressActPhysical->setActionGroup(addressGroup);
addressActLogical->setShortcut(QKeySequence("Ctrl+G"));
addressActPhysical->setShortcut(QKeySequence("Ctrl+Y"));
addressActLogical->setChecked(true);
connect(addressGroup, &QActionGroup::triggered, this, &MemoryWindow::addressChanged);
// Create a reverse view radio
QAction* reverseAct = new QAction("Reverse View", this);
reverseAct->setObjectName("reverse");
reverseAct->setCheckable(true);
reverseAct->setShortcut(QKeySequence("Ctrl+R"));
connect(reverseAct, &QAction::toggled, this, &MemoryWindow::reverseChanged);
// Create increase and decrease bytes-per-line actions
QAction* increaseBplAct = new QAction("Increase Bytes Per Line", this);
QAction* decreaseBplAct = new QAction("Decrease Bytes Per Line", this);
increaseBplAct->setShortcut(QKeySequence("Ctrl+P"));
decreaseBplAct->setShortcut(QKeySequence("Ctrl+O"));
connect(increaseBplAct, &QAction::triggered, this, &MemoryWindow::increaseBytesPerLine);
connect(decreaseBplAct, &QAction::triggered, this, &MemoryWindow::decreaseBytesPerLine);
// Assemble the options menu
QMenu* optionsMenu = menuBar()->addMenu("&Options");
optionsMenu->addActions(dataFormat->actions());
optionsMenu->addSeparator();
optionsMenu->addActions(addressGroup->actions());
optionsMenu->addSeparator();
optionsMenu->addAction(reverseAct);
optionsMenu->addSeparator();
optionsMenu->addAction(increaseBplAct);
optionsMenu->addAction(decreaseBplAct);
//
// Initialize
//
populateComboBox();
// Set to the current CPU's memory view
setToCurrentCpu();
}
示例4: setupTextActions
void TextEdit::setupTextActions()
{
QToolBar *tb = new QToolBar(this);
tb->setWindowTitle(tr("Format Actions"));
addToolBar(tb);
QMenu *menu = new QMenu(tr("F&ormat"), this);
menuBar()->addMenu(menu);
actionTextBold = new QAction(QIcon::fromTheme("format-text-bold", QIcon(rsrcPath + "/textbold.png")),
tr("&Bold"), this);
actionTextBold->setShortcut(Qt::CTRL + Qt::Key_B);
actionTextBold->setPriority(QAction::LowPriority);
QFont bold;
bold.setBold(true);
actionTextBold->setFont(bold);
connect(actionTextBold, SIGNAL(triggered()), this, SLOT(textBold()));
tb->addAction(actionTextBold);
menu->addAction(actionTextBold);
actionTextBold->setCheckable(true);
actionTextItalic = new QAction(QIcon::fromTheme("format-text-italic", QIcon(rsrcPath + "/textitalic.png")),
tr("&Italic"), this);
actionTextItalic->setPriority(QAction::LowPriority);
actionTextItalic->setShortcut(Qt::CTRL + Qt::Key_I);
QFont italic;
italic.setItalic(true);
actionTextItalic->setFont(italic);
connect(actionTextItalic, SIGNAL(triggered()), this, SLOT(textItalic()));
tb->addAction(actionTextItalic);
menu->addAction(actionTextItalic);
actionTextItalic->setCheckable(true);
actionTextUnderline = new QAction(QIcon::fromTheme("format-text-underline", QIcon(rsrcPath + "/textunder.png")),
tr("&Underline"), this);
actionTextUnderline->setShortcut(Qt::CTRL + Qt::Key_U);
actionTextUnderline->setPriority(QAction::LowPriority);
QFont underline;
underline.setUnderline(true);
actionTextUnderline->setFont(underline);
connect(actionTextUnderline, SIGNAL(triggered()), this, SLOT(textUnderline()));
tb->addAction(actionTextUnderline);
menu->addAction(actionTextUnderline);
actionTextUnderline->setCheckable(true);
menu->addSeparator();
QActionGroup *grp = new QActionGroup(this);
connect(grp, SIGNAL(triggered(QAction*)), this, SLOT(textAlign(QAction*)));
// Make sure the alignLeft is always left of the alignRight
if (QApplication::isLeftToRight()) {
actionAlignLeft = new QAction(QIcon::fromTheme("format-justify-left", QIcon(rsrcPath + "/textleft.png")),
tr("&Left"), grp);
actionAlignCenter = new QAction(QIcon::fromTheme("format-justify-center", QIcon(rsrcPath + "/textcenter.png")), tr("C&enter"), grp);
actionAlignRight = new QAction(QIcon::fromTheme("format-justify-right", QIcon(rsrcPath + "/textright.png")), tr("&Right"), grp);
} else {
actionAlignRight = new QAction(QIcon::fromTheme("format-justify-right", QIcon(rsrcPath + "/textright.png")), tr("&Right"), grp);
actionAlignCenter = new QAction(QIcon::fromTheme("format-justify-center", QIcon(rsrcPath + "/textcenter.png")), tr("C&enter"), grp);
actionAlignLeft = new QAction(QIcon::fromTheme("format-justify-left", QIcon(rsrcPath + "/textleft.png")), tr("&Left"), grp);
}
actionAlignJustify = new QAction(QIcon::fromTheme("format-justify-fill", QIcon(rsrcPath + "/textjustify.png")), tr("&Justify"), grp);
actionAlignLeft->setShortcut(Qt::CTRL + Qt::Key_L);
actionAlignLeft->setCheckable(true);
actionAlignLeft->setPriority(QAction::LowPriority);
actionAlignCenter->setShortcut(Qt::CTRL + Qt::Key_E);
actionAlignCenter->setCheckable(true);
actionAlignCenter->setPriority(QAction::LowPriority);
actionAlignRight->setShortcut(Qt::CTRL + Qt::Key_R);
actionAlignRight->setCheckable(true);
actionAlignRight->setPriority(QAction::LowPriority);
actionAlignJustify->setShortcut(Qt::CTRL + Qt::Key_J);
actionAlignJustify->setCheckable(true);
actionAlignJustify->setPriority(QAction::LowPriority);
tb->addActions(grp->actions());
menu->addActions(grp->actions());
menu->addSeparator();
QPixmap pix(16, 16);
pix.fill(Qt::black);
actionTextColor = new QAction(pix, tr("&Color..."), this);
connect(actionTextColor, SIGNAL(triggered()), this, SLOT(textColor()));
tb->addAction(actionTextColor);
menu->addAction(actionTextColor);
tb = new QToolBar(this);
tb->setAllowedAreas(Qt::TopToolBarArea | Qt::BottomToolBarArea);
tb->setWindowTitle(tr("Format Actions"));
addToolBarBreak(Qt::TopToolBarArea);
addToolBar(tb);
comboStyle = new QComboBox(tb);
tb->addWidget(comboStyle);
comboStyle->addItem("Standard");
comboStyle->addItem("Bullet List (Disc)");
comboStyle->addItem("Bullet List (Circle)");
//.........这里部分代码省略.........
示例5: TopWin
//.........这里部分代码省略.........
scoreSubmenu->addMenu(scoreOneStaffPerTrackSubsubmenu);
updateScoreMenus();
startScoreEditAction = new QAction(*scoreIconSet, tr("New score window"), this);
startPianoEditAction = new QAction(*pianoIconSet, tr("Pianoroll"), this);
startDrumEditAction = new QAction(QIcon(*edit_drummsIcon), tr("Drums"), this);
startListEditAction = new QAction(QIcon(*edit_listIcon), tr("List"), this);
startWaveEditAction = new QAction(QIcon(*edit_waveIcon), tr("Wave"), this);
master = new QMenu(tr("Mastertrack"), this);
master->setIcon(QIcon(*edit_mastertrackIcon));
masterGraphicAction = new QAction(QIcon(*mastertrack_graphicIcon),tr("Graphic"), this);
masterListAction = new QAction(QIcon(*mastertrack_listIcon),tr("List"), this);
midiTransformerAction = new QAction(QIcon(*midi_transformIcon), tr("Midi &Transform"), this);
//-------- Structure Actions
strGlobalCutAction = new QAction(tr("Global Cut"), this);
strGlobalInsertAction = new QAction(tr("Global Insert"), this);
strGlobalSplitAction = new QAction(tr("Global Split"), this);
strGlobalCutSelAction = new QAction(tr("Global Cut - selected tracks"), this);
strGlobalInsertSelAction = new QAction(tr("Global Insert - selected tracks"), this);
strGlobalSplitSelAction = new QAction(tr("Global Split - selected tracks"), this);
//-------------------------------------------------------------
// popup Edit
//-------------------------------------------------------------
QMenu* menuEdit = menuBar()->addMenu(tr("&Edit"));
menuEdit->addActions(MusEGlobal::undoRedo->actions());
menuEdit->addSeparator();
menuEdit->addAction(editDeleteAction);
menuEdit->addAction(editCutAction);
menuEdit->addAction(editCopyAction);
menuEdit->addAction(editCopyRangeAction);
menuEdit->addAction(editPasteAction);
menuEdit->addAction(editPasteToTrackAction);
menuEdit->addAction(editPasteCloneAction);
menuEdit->addAction(editPasteCloneToTrackAction);
menuEdit->addAction(editPasteDialogAction);
menuEdit->addAction(editInsertEMAction);
menuEdit->addSeparator();
menuEdit->addAction(editShrinkPartsAction);
menuEdit->addAction(editExpandPartsAction);
menuEdit->addAction(editCleanPartsAction);
menuEdit->addSeparator();
menuEdit->addAction(editDeleteSelectedAction);
menuEdit->addMenu(addTrack);
menuEdit->addAction(editDuplicateSelTrackAction);
menuEdit->addMenu(select);
select->addAction(editSelectAllAction);
select->addAction(editDeselectAllAction);
select->addAction(editInvertSelectionAction);
select->addAction(editInsideLoopAction);
select->addAction(editOutsideLoopAction);
select->addAction(editAllPartsAction);
menuEdit->addSeparator();
menuEdit->addAction(startPianoEditAction);
menuEdit->addMenu(scoreSubmenu);
示例6: RequestListModeActSet
//.........这里部分代码省略.........
m_categoryActs->addAction(m_catActGameData.action);
m_categoryActs->addAction(m_catActUnknown.action);
m_categoryActs->setEnabled(m_isListLayout);
m_modeActList = { new QAction(""), QIcon(":/Icons/list_blue.png"), QIcon(":/Icons/list_gray.png") };
m_modeActList.action->setIcon(m_isListLayout ? m_modeActList.colored : m_modeActList.gray);
m_modeActList.action->setToolTip(tr("Enable List Mode"));
m_modeActGrid = { new QAction(""), QIcon(":/Icons/grid_blue.png"), QIcon(":/Icons/grid_gray.png") };
m_modeActGrid.action->setIcon(m_isListLayout ? m_modeActGrid.gray : m_modeActGrid.colored);
m_modeActGrid.action->setToolTip(tr("Enable Grid Mode"));
m_modeActs = new QActionGroup(m_Tool_Bar);
m_modeActs->addAction(m_modeActList.action);
m_modeActs->addAction(m_modeActGrid.action);
// Search Bar
m_Search_Bar = new QLineEdit(m_Tool_Bar);
m_Search_Bar->setPlaceholderText(tr("Search games ..."));
connect(m_Search_Bar, &QLineEdit::textChanged, [this]() {
Refresh();
});
// Icon Size Slider
m_Slider_Size = new QSlider(Qt::Horizontal , m_Tool_Bar);
m_Slider_Size->setRange(0, GUI::gl_icon_size.size() - 1);
m_Slider_Size->setSliderPosition(icon_size_index);
m_Slider_Size->setFixedWidth(100);
m_Tool_Bar->addWidget(m_Search_Bar);
m_Tool_Bar->addWidget(new QLabel(" "));
m_Tool_Bar->addSeparator();
m_Tool_Bar->addWidget(new QLabel(" "));
m_Tool_Bar->addActions(m_categoryActs->actions());
m_Tool_Bar->addWidget(new QLabel(" "));
m_Tool_Bar->addSeparator();
m_Tool_Bar->addWidget(new QLabel(tr(" View Mode ")));
m_Tool_Bar->addAction(m_modeActList.action);
m_Tool_Bar->addAction(m_modeActGrid.action);
m_Tool_Bar->addWidget(new QLabel(tr(" ")));
m_Tool_Bar->addSeparator();
m_Tool_Bar->addWidget(new QLabel(tr(" Tiny "))); // Can this be any easier?
m_Tool_Bar->addWidget(m_Slider_Size);
m_Tool_Bar->addWidget(new QLabel(tr(" Large ")));
m_Game_Dock->addToolBar(m_Tool_Bar);
setWidget(m_Game_Dock);
bool showText = (m_Icon_Size_Str != GUI::gl_icon_key_small && m_Icon_Size_Str != GUI::gl_icon_key_tiny);
m_xgrid = new game_list_grid(m_Icon_Size, m_Margin_Factor, m_Text_Factor, showText);
gameList = new QTableWidget();
gameList->setShowGrid(false);
gameList->setItemDelegate(new table_item_delegate(this));
gameList->setSelectionBehavior(QAbstractItemView::SelectRows);
gameList->setSelectionMode(QAbstractItemView::SingleSelection);
gameList->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
gameList->verticalHeader()->setSectionResizeMode(QHeaderView::Fixed);
gameList->verticalHeader()->setMinimumSectionSize(m_Icon_Size.height());
gameList->verticalHeader()->setMaximumSectionSize(m_Icon_Size.height());
gameList->verticalHeader()->setVisible(false);
gameList->horizontalHeader()->setContextMenuPolicy(Qt::CustomContextMenu);
gameList->setContextMenuPolicy(Qt::CustomContextMenu);
gameList->setColumnCount(7);
gameList->setHorizontalHeaderItem(0, new QTableWidgetItem(tr("Icon")));
示例7: CreateAndConnectActions
void log_frame::CreateAndConnectActions()
{
// I, for one, welcome our lambda overlord
// It's either this or a signal mapper
// Then, probably making a list of these actions so that it's easier to iterate to generate the mapper.
auto l_initAct = [this](QAction* act, logs::level logLevel)
{
act->setCheckable(true);
// This sets the log level properly when the action is triggered.
connect(act, &QAction::triggered, [this, logLevel]()
{
s_gui_listener.enabled = std::max(logLevel, logs::level::fatal);
xgui_settings->SetValue(gui::l_level, static_cast<uint>(logLevel));
});
};
m_clearAct = new QAction(tr("Clear"), this);
connect(m_clearAct, &QAction::triggered, m_log, &QTextEdit::clear);
m_clearTTYAct = new QAction(tr("Clear"), this);
connect(m_clearTTYAct, &QAction::triggered, m_tty, &QTextEdit::clear);
// Action groups make these actions mutually exclusive.
m_logLevels = new QActionGroup(this);
m_nothingAct = new QAction(tr("Nothing"), m_logLevels);
m_nothingAct->setVisible(false);
m_fatalAct = new QAction(tr("Fatal"), m_logLevels);
m_errorAct = new QAction(tr("Error"), m_logLevels);
m_todoAct = new QAction(tr("Todo"), m_logLevels);
m_successAct = new QAction(tr("Success"), m_logLevels);
m_warningAct = new QAction(tr("Warning"), m_logLevels);
m_noticeAct = new QAction(tr("Notice"), m_logLevels);
m_traceAct = new QAction(tr("Trace"), m_logLevels);
m_stackAct = new QAction(tr("Stack Mode"), this);
m_stackAct->setCheckable(true);
connect(m_stackAct, &QAction::toggled, xgui_settings.get(), [=](bool checked)
{
xgui_settings->SetValue(gui::l_stack, checked);
m_stack_log = checked;
});
m_TTYAct = new QAction(tr("TTY"), this);
m_TTYAct->setCheckable(true);
connect(m_TTYAct, &QAction::triggered, xgui_settings.get(), [=](bool checked)
{
xgui_settings->SetValue(gui::l_tty, checked);
});
l_initAct(m_nothingAct, logs::level::fatal);
l_initAct(m_fatalAct, logs::level::fatal);
l_initAct(m_errorAct, logs::level::error);
l_initAct(m_todoAct, logs::level::todo);
l_initAct(m_successAct, logs::level::success);
l_initAct(m_warningAct, logs::level::warning);
l_initAct(m_noticeAct, logs::level::notice);
l_initAct(m_traceAct, logs::level::trace);
connect(m_log, &QWidget::customContextMenuRequested, [=](const QPoint& pos)
{
QMenu* menu = m_log->createStandardContextMenu();
menu->addAction(m_clearAct);
menu->addSeparator();
menu->addActions({ m_nothingAct, m_fatalAct, m_errorAct, m_todoAct, m_successAct, m_warningAct, m_noticeAct, m_traceAct });
menu->addSeparator();
menu->addAction(m_stackAct);
menu->addSeparator();
menu->addAction(m_TTYAct);
menu->exec(mapToGlobal(pos));
});
connect(m_tty, &QWidget::customContextMenuRequested, [=](const QPoint& pos)
{
QMenu* menu = m_tty->createStandardContextMenu();
menu->addAction(m_clearTTYAct);
menu->exec(mapToGlobal(pos));
});
connect(m_tabWidget, &QTabWidget::currentChanged, [this](int/* index*/)
{
if (m_find_dialog)
m_find_dialog->close();
});
LoadSettings();
}
示例8: populate
//.........这里部分代码省略.........
if (!isCurrentTrash && !isIntoTrash && (m_popupFlags & KonqPopupMenu::ShowBookmark)) {
QString caption;
if (currentDir) {
const bool httpPage = m_sViewURL.scheme().startsWith(QLatin1String("http"), Qt::CaseInsensitive);
if (httpPage) {
caption = i18n("&Bookmark This Page");
} else {
caption = i18n("&Bookmark This Location");
}
} else if (isDirectory) {
caption = i18n("&Bookmark This Folder");
} else if (bIsLink) {
caption = i18n("&Bookmark This Link");
} else {
caption = i18n("&Bookmark This File");
}
act = new QAction(m_parentWidget);
m_ownActions.append(act);
act->setObjectName(QLatin1String("bookmark_add")); // for unittest
act->setIcon(QIcon::fromTheme(QStringLiteral("bookmark-new")));
act->setText(caption);
QObject::connect(act, &QAction::triggered, [this]() {
slotPopupAddToBookmark();
});
if (lstItems.count() > 1) {
act->setEnabled(false);
}
if (KAuthorized::authorizeKAction(QStringLiteral("bookmarks"))) {
q->addAction(act);
}
if (bIsLink) {
addGroup(KonqPopupMenu::LinkActions); // see khtml
}
}
// "Open With" actions
m_menuActions.setItemListProperties(m_popupItemProperties);
if (sReading) {
m_menuActions.addOpenWithActionsTo(q, QStringLiteral("DesktopEntryName != 'kfmclient' and DesktopEntryName != 'kfmclient_dir' and DesktopEntryName != 'kfmclient_html'"));
QList<QAction *> previewActions = m_actionGroups.value(KonqPopupMenu::PreviewActions);
if (!previewActions.isEmpty()) {
if (previewActions.count() == 1) {
q->addAction(previewActions.first());
} else {
QMenu *subMenu = new QMenu(i18n("Preview In"), q);
subMenu->menuAction()->setObjectName(QLatin1String("preview_submenu")); // for the unittest
q->addMenu(subMenu);
subMenu->addActions(previewActions);
}
}
}
// Second block, builtin + user
m_menuActions.addServiceActionsTo(q);
q->addSeparator();
// Use the Dolphin setting for showing the "Copy To" and "Move To" actions
KSharedConfig::Ptr dolphin = KSharedConfig::openConfig(QStringLiteral("dolphinrc"));
// CopyTo/MoveTo menus
if (m_popupFlags & KonqPopupMenu::ShowUrlOperations &&
KConfigGroup(dolphin, "General").readEntry("ShowCopyMoveMenu", false)) {
m_copyToMenu.setItems(lstItems);
m_copyToMenu.setReadOnly(sMoving == false);
m_copyToMenu.addActionsTo(q);
q->addSeparator();
}
if (!isCurrentTrash && !isIntoTrash && sReading &&
(m_popupFlags & KonqPopupMenu::NoPlugins) == 0) {
addPlugins(); // now it's time to add plugins
}
if ((m_popupFlags & KonqPopupMenu::ShowProperties) && KPropertiesDialog::canDisplay(lstItems)) {
act = new QAction(m_parentWidget);
m_ownActions.append(act);
act->setObjectName(QLatin1String("properties")); // for unittest
act->setText(i18n("&Properties"));
QObject::connect(act, &QAction::triggered, [this]() {
slotPopupProperties();
});
q->addAction(act);
}
while (!q->actions().isEmpty() &&
q->actions().last()->isSeparator()) {
delete q->actions().last();
}
// Anything else that is provided by the part
addGroup(KonqPopupMenu::CustomActions);
QObject::connect(&m_menuActions, &KFileItemActions::openWithDialogAboutToBeShown, q, &KonqPopupMenu::openWithDialogAboutToBeShown);
}
示例9: contextMenuEvent
void ThingRulesView::contextMenuEvent(QContextMenuEvent * e)
{
Q_UNUSED(e)
QMenu* popup = new QMenu(this);
QList<QAction *> actions;
actions <<new QAction(QString::fromUtf8("Добавить"), popup)
<<new QAction(PluginHosts::psiIcon->getIcon("psi/action_templates_edit"), QString::fromUtf8("Редактировать"), popup)
<<new QAction(PluginHosts::psiIcon->getIcon("psi/remove"), QString::fromUtf8("Удалить"), popup)
<<new QAction(PluginHosts::psiIcon->getIcon("psi/arrowUp"), QString::fromUtf8("Выше"), popup)
<<new QAction(PluginHosts::psiIcon->getIcon("psi/arrowDown"), QString::fromUtf8("Ниже"), popup);
popup->addActions(actions);
QAction *result = popup->exec(e->globalPos());
int iresult;
if (result) {
iresult = actions.indexOf(result);
int row = currentIndex().row();
switch (iresult) {
case 0: // add
if (true) {
struct ThingFilter::thing_rule_ex new_rule;
new_rule.param = ThingFilter::NoParamRole;
new_rule.negative = false;
new_rule.operand = ThingFilter::NoOperRole;
new_rule.int_value = 0;
new_rule.value = "";
new_rule.action = ThingFilter::NoActionRole;
ThingRuleEditDialog* dlg = new ThingRuleEditDialog(this, &new_rule);
if (dlg) {
if (dlg->exec() == QDialog::Accepted) {
if (thingRulesTableModel->appendRule(new_rule.param, new_rule.negative, new_rule.operand, new_rule.value, new_rule.action)) {
if (row >= 0 && row < model()->rowCount()) {
selectionModel()->select(model()->index(row, 0), QItemSelectionModel::Deselect | QItemSelectionModel::Rows);
}
selectionModel()->select(model()->index(model()->rowCount() - 1, 0), QItemSelectionModel::Select | QItemSelectionModel::Rows);
} else {
QMessageBox::warning(this, QString::fromUtf8("Добавление правила"), QString::fromUtf8("Произошла ошибка при добавлении правила"), QMessageBox::Ok, QMessageBox::Ok);
}
}
delete dlg;
}
}
break;
case 1: // edit
if (row >= 0 && row < model()->rowCount()) {
struct ThingFilter::thing_rule_ex rule;
const struct ThingFilter::thing_rule_ex* curr_rule = thingRulesTableModel->getRule(row);
if (curr_rule) {
rule = *curr_rule;
ThingRuleEditDialog* dlg = new ThingRuleEditDialog(this, &rule);
if (dlg) {
if (dlg->exec() == QDialog::Accepted) {
thingRulesTableModel->modifyRule(row, &rule);
}
delete dlg;
}
}
}
break;
case 2: // delete
if (row >= 0 && row < model()->rowCount()) {
if (QMessageBox::question(this, QString::fromUtf8("Удаление правила"), QString::fromUtf8("Вы действительно хотите удалить правило?"), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
model()->removeRows(row, 1);
int cnt = model()->rowCount();
if (cnt > 0) {
if (row >= cnt)
row--;
selectionModel()->select(model()->index(row, 0), QItemSelectionModel::Select | QItemSelectionModel::Rows);
}
}
}
break;
case 3: // up
if (row > 0 && row < model()->rowCount()) {
thingRulesTableModel->upRow(row);
selectionModel()->select(model()->index(row, 0), QItemSelectionModel::Deselect | QItemSelectionModel::Rows);
selectionModel()->select(model()->index(row - 1, 0), QItemSelectionModel::Select | QItemSelectionModel::Rows);
}
break;
case 4: // down
if (row >= 0 && row < model()->rowCount() - 1) {
thingRulesTableModel->downRow(row);
selectionModel()->select(model()->index(row, 0), QItemSelectionModel::Deselect | QItemSelectionModel::Rows);
selectionModel()->select(model()->index(row + 1, 0), QItemSelectionModel::Select | QItemSelectionModel::Rows);
}
break;
}
}
delete popup;
}
示例10: setupTextActions
void CreateBlogMsg::setupTextActions()
{
QMenu *menu = new QMenu(tr("F&ormat"), this);
menuBar()->addMenu(menu);
actionTextBold = new QAction(QIcon(":/images/textedit/textbold.png"),tr("&Bold"), this);
actionTextBold->setShortcut(Qt::CTRL + Qt::Key_B);
//actionTextBold->setPriority(QAction::LowPriority);
QFont bold;
bold.setBold(true);
actionTextBold->setFont(bold);
connect(actionTextBold, SIGNAL(triggered()), this, SLOT(textBold()));
ui.toolBar_2->addAction(actionTextBold);
menu->addAction(actionTextBold);
actionTextBold->setCheckable(true);
actionTextItalic = new QAction(QIcon(":/images/textedit/textitalic.png"),tr("&Italic"), this);
//actionTextItalic->setPriority(QAction::LowPriority);
actionTextItalic->setShortcut(Qt::CTRL + Qt::Key_I);
QFont italic;
italic.setItalic(true);
actionTextItalic->setFont(italic);
connect(actionTextItalic, SIGNAL(triggered()), this, SLOT(textItalic()));
ui.toolBar_2->addAction(actionTextItalic);
menu->addAction(actionTextItalic);
actionTextItalic->setCheckable(true);
actionTextUnderline = new QAction(QIcon(":/images/textedit/textunder.png"),tr("&Underline"), this);
actionTextUnderline->setShortcut(Qt::CTRL + Qt::Key_U);
//actionTextUnderline->setPriority(QAction::LowPriority);
QFont underline;
underline.setUnderline(true);
actionTextUnderline->setFont(underline);
connect(actionTextUnderline, SIGNAL(triggered()), this, SLOT(textUnderline()));
ui.toolBar_2->addAction(actionTextUnderline);
menu->addAction(actionTextUnderline);
actionTextUnderline->setCheckable(true);
menu->addSeparator();
QActionGroup *grp = new QActionGroup(this);
connect(grp, SIGNAL(triggered(QAction*)), this, SLOT(textAlign(QAction*)));
// Make sure the alignLeft is always left of the alignRight
if (QApplication::isLeftToRight()) {
actionAlignLeft = new QAction(QIcon(":/images/textedit/textleft.png"),tr("&Left"), grp);
actionAlignCenter = new QAction(QIcon(":/images/textedit/textcenter.png"), tr("C&enter"), grp);
actionAlignRight = new QAction(QIcon(":/images/textedit/textright.png"), tr("&Right"), grp);
} else {
actionAlignRight = new QAction(QIcon(":/images/textedit/textright.png"), tr("&Right"), grp);
actionAlignCenter = new QAction(QIcon(":/images/textedit/textcenter.png"), tr("C&enter"), grp);
actionAlignLeft = new QAction(QIcon(":/images/textedit/textleft.png"), tr("&Left"), grp);
}
actionAlignJustify = new QAction(QIcon(":/images/textedit/textjustify.png"), tr("&Justify"), grp);
actionAlignLeft->setShortcut(Qt::CTRL + Qt::Key_L);
actionAlignLeft->setCheckable(true);
//actionAlignLeft->setPriority(QAction::LowPriority);
actionAlignCenter->setShortcut(Qt::CTRL + Qt::Key_E);
actionAlignCenter->setCheckable(true);
//actionAlignCenter->setPriority(QAction::LowPriority);
actionAlignRight->setShortcut(Qt::CTRL + Qt::Key_R);
actionAlignRight->setCheckable(true);
//actionAlignRight->setPriority(QAction::LowPriority);
actionAlignJustify->setShortcut(Qt::CTRL + Qt::Key_J);
actionAlignJustify->setCheckable(true);
//actionAlignJustify->setPriority(QAction::LowPriority);
ui.toolBar_2->addActions(grp->actions());
menu->addActions(grp->actions());
menu->addSeparator();
QPixmap pix(16, 16);
pix.fill(Qt::black);
actionTextColor = new QAction(pix, tr("&Text Color..."), this);
connect(actionTextColor, SIGNAL(triggered()), this, SLOT(textColor()));
ui.toolBar_2->addAction(actionTextColor);
menu->addAction(actionTextColor);
menu->addAction(ui.actionOrderedlist);
menu->addAction(ui.actionUnorderedlist);
menu->addAction(ui.actionBlockquoute);
/*comboStyle = new QComboBox(ui.toolBar_2);
ui.toolBar_2->addWidget(comboStyle);
comboStyle->addItem("Paragraph");
comboStyle->addItem("Heading 1");
comboStyle->addItem("Heading 2");
comboStyle->addItem("Heading 3");
comboStyle->addItem("Heading 4");
comboStyle->addItem("Heading 5");
comboStyle->addItem("Heading 6");
//.........这里部分代码省略.........
示例11: QDialog
Dialog::Dialog(QWidget *parent) :
QDialog(parent, Qt::Tool | Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint),
ui(new Ui::Dialog),
mSettings(new LxQt::Settings("lxqt-runner", this)),
mGlobalShortcut(0),
mLockCascadeChanges(false),
mConfigureDialog(0)
{
ui->setupUi(this);
setWindowTitle("LXQt Runner");
setAttribute(Qt::WA_TranslucentBackground);
connect(LxQt::Settings::globalSettings(), SIGNAL(iconThemeChanged()), this, SLOT(update()));
connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(hide()));
connect(mSettings, SIGNAL(settingsChanged()), this, SLOT(applySettings()));
ui->commandEd->installEventFilter(this);
connect(ui->commandEd, SIGNAL(textChanged(QString)), this, SLOT(setFilter(QString)));
connect(ui->commandEd, SIGNAL(returnPressed()), this, SLOT(runCommand()));
mCommandItemModel = new CommandItemModel(this);
ui->commandList->installEventFilter(this);
ui->commandList->setModel(mCommandItemModel);
ui->commandList->setEditTriggers(QAbstractItemView::NoEditTriggers);
connect(ui->commandList, SIGNAL(clicked(QModelIndex)), this, SLOT(runCommand()));
setFilter("");
dataChanged();
ui->commandList->setItemDelegate(new LxQt::HtmlDelegate(QSize(32, 32), ui->commandList));
// Popup menu ...............................
QAction *a = new QAction(XdgIcon::fromTheme("configure"), tr("Configure"), this);
connect(a, SIGNAL(triggered()), this, SLOT(showConfigDialog()));
addAction(a);
a = new QAction(XdgIcon::fromTheme("edit-clear-history"), tr("Clear History"), this);
connect(a, SIGNAL(triggered()), mCommandItemModel, SLOT(clearHistory()));
addAction(a);
mPowerManager = new LxQt::PowerManager(this);
addActions(mPowerManager->availableActions());
mScreenSaver = new LxQt::ScreenSaver(this);
addActions(mScreenSaver->availableActions());
setContextMenuPolicy(Qt::ActionsContextMenu);
QMenu *menu = new QMenu(this);
menu->addActions(actions());
ui->actionButton->setMenu(menu);
ui->actionButton->setIcon(XdgIcon::fromTheme("configure"));
// End of popup menu ........................
applySettings();
connect(QApplication::desktop(), SIGNAL(screenCountChanged(int)), SLOT(realign()));
connect(QApplication::desktop(), SIGNAL(workAreaResized(int)), SLOT(realign()));
connect(mGlobalShortcut, SIGNAL(activated()), this, SLOT(showHide()));
connect(mGlobalShortcut, SIGNAL(shortcutChanged(QString,QString)), this, SLOT(shortcutChanged(QString,QString)));
resize(mSettings->value("dialog/width", 400).toInt(), size().height());
// TEST
connect(mCommandItemModel, SIGNAL(layoutChanged()), this, SLOT(dataChanged()));
}
示例12: PostWindowCreate
//.........这里部分代码省略.........
window->GetWorkbench()->GetPerspectiveRegistry();
QList<berry::IPerspectiveDescriptor::Pointer> perspectives(
perspRegistry->GetPerspectives());
skip = false;
for (QList<berry::IPerspectiveDescriptor::Pointer>::iterator perspIt =
perspectives.begin(); perspIt != perspectives.end(); ++perspIt)
{
// if perspectiveExcludeList is set, it contains the id-strings of perspectives, which
// should not appear as an menu-entry in the perspective menu
if (perspectiveExcludeList.size() > 0)
{
for (int i=0; i<perspectiveExcludeList.size(); i++)
{
if (perspectiveExcludeList.at(i) == (*perspIt)->GetId())
{
skip = true;
break;
}
}
if (skip)
{
skip = false;
continue;
}
}
QAction* perspAction = new berry::QtOpenPerspectiveAction(window,
*perspIt, perspGroup);
mapPerspIdToAction.insert((*perspIt)->GetId(), perspAction);
}
perspMenu->addActions(perspGroup->actions());
if (showViewMenuItem)
{
for (auto viewAction : viewActions)
{
viewMenu->addAction(viewAction);
}
}
// ===== Help menu ====================================
QMenu* helpMenu = menuBar->addMenu("&Help");
helpMenu->addAction("&Welcome",this, SLOT(onIntro()));
helpMenu->addAction("&Open Help Perspective", this, SLOT(onHelpOpenHelpPerspective()));
helpMenu->addAction("&Context Help",this, SLOT(onHelp()), QKeySequence("F1"));
helpMenu->addAction("&About",this, SLOT(onAbout()));
// =====================================================
}
else
{
undoAction = new QAction(QIcon::fromTheme("edit-undo",QIcon(":/org_mitk_icons/icons/tango/scalable/actions/edit-undo.svg")),
"&Undo", nullptr);
undoAction->setToolTip("Undo the last action (not supported by all modules)");
redoAction = new QAction(QIcon::fromTheme("edit-redo",QIcon(":/org_mitk_icons/icons/tango/scalable/actions/edit-redo.svg"))
, "&Redo", nullptr);
redoAction->setToolTip("execute the last action that was undone again (not supported by all modules)");
}
示例13: QFrame
DasmWindow::DasmWindow(running_machine* machine, QWidget* parent) :
WindowQt(machine, NULL)
{
setWindowTitle("Debug: Disassembly View");
if (parent != NULL)
{
QPoint parentPos = parent->pos();
setGeometry(parentPos.x()+100, parentPos.y()+100, 800, 400);
}
//
// The main frame and its input and log widgets
//
QFrame* mainWindowFrame = new QFrame(this);
// The top frame & groupbox that contains the input widgets
QFrame* topSubFrame = new QFrame(mainWindowFrame);
// The input edit
m_inputEdit = new QLineEdit(topSubFrame);
connect(m_inputEdit, SIGNAL(returnPressed()), this, SLOT(expressionSubmitted()));
// The cpu combo box
m_cpuComboBox = new QComboBox(topSubFrame);
m_cpuComboBox->setObjectName("cpu");
m_cpuComboBox->setMinimumWidth(300);
connect(m_cpuComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(cpuChanged(int)));
// The main disasm window
m_dasmView = new DebuggerView(DVT_DISASSEMBLY,
m_machine,
this);
// Force a recompute of the disassembly region
downcast<debug_view_disasm*>(m_dasmView->view())->set_expression("curpc");
// Populate the combo box & set the proper cpu
populateComboBox();
//const debug_view_source *source = mem->views[0]->view->source_for_device(curcpu);
//gtk_combo_box_set_active(zone_w, mem->views[0]->view->source_list().indexof(*source));
//mem->views[0]->view->set_source(*source);
// Layout
QHBoxLayout* subLayout = new QHBoxLayout(topSubFrame);
subLayout->addWidget(m_inputEdit);
subLayout->addWidget(m_cpuComboBox);
subLayout->setSpacing(3);
subLayout->setContentsMargins(2,2,2,2);
QVBoxLayout* vLayout = new QVBoxLayout(mainWindowFrame);
vLayout->setSpacing(3);
vLayout->setContentsMargins(2,2,2,2);
vLayout->addWidget(topSubFrame);
vLayout->addWidget(m_dasmView);
setCentralWidget(mainWindowFrame);
//
// Menu bars
//
// Create two commands
QAction* breakpointSetAct = new QAction("Toggle Breakpoint At Cursor", this);
QAction* runToCursorAct = new QAction("Run To Cursor", this);
breakpointSetAct->setShortcut(Qt::Key_F9);
runToCursorAct->setShortcut(Qt::Key_F4);
connect(breakpointSetAct, SIGNAL(triggered(bool)), this, SLOT(toggleBreakpointAtCursor(bool)));
connect(runToCursorAct, SIGNAL(triggered(bool)), this, SLOT(runToCursor(bool)));
// Right bar options
QActionGroup* rightBarGroup = new QActionGroup(this);
rightBarGroup->setObjectName("rightbargroup");
QAction* rightActRaw = new QAction("Raw Opcodes", this);
QAction* rightActEncrypted = new QAction("Encrypted Opcodes", this);
QAction* rightActComments = new QAction("Comments", this);
rightActRaw->setCheckable(true);
rightActEncrypted->setCheckable(true);
rightActComments->setCheckable(true);
rightActRaw->setActionGroup(rightBarGroup);
rightActEncrypted->setActionGroup(rightBarGroup);
rightActComments->setActionGroup(rightBarGroup);
rightActRaw->setShortcut(QKeySequence("Ctrl+R"));
rightActEncrypted->setShortcut(QKeySequence("Ctrl+E"));
rightActComments->setShortcut(QKeySequence("Ctrl+C"));
rightActRaw->setChecked(true);
connect(rightBarGroup, SIGNAL(triggered(QAction*)), this, SLOT(rightBarChanged(QAction*)));
// Assemble the options menu
QMenu* optionsMenu = menuBar()->addMenu("&Options");
optionsMenu->addAction(breakpointSetAct);
optionsMenu->addAction(runToCursorAct);
optionsMenu->addSeparator();
optionsMenu->addActions(rightBarGroup->actions());
}
示例14: slotContexMenu
void FavoriteHubs::slotContexMenu(const QPoint &){
QItemSelectionModel *s_model = treeView->selectionModel();
QModelIndexList list = s_model->selectedRows(0);
WulforUtil *WU = WulforUtil::getInstance();
bool empty = list.empty();
QMenu *menu = new QMenu(this);
if (empty){
QAction *add_new = new QAction(WU->getPixmap(WulforUtil::eiBOOKMARK_ADD), tr("Add new"), menu);
menu->addAction(add_new);
QAction *res = menu->exec(QCursor::pos());
if (res){
FavoriteHubEditor editor;
initHubEditor(editor);
if (editor.exec() == QDialog::Accepted){
StrMap map;
FavoriteHubEntry entry;
getParams(editor, map);
updateEntry(entry, map);
FavoriteManager::getInstance()->addFavorite(entry);
}
}
}
else {
FavoriteHubItem *item = static_cast<FavoriteHubItem*>(list.at(0).internalPointer());
if (!item){
delete menu;
return;
}
QAction *add_new = new QAction(WU->getPixmap(WulforUtil::eiBOOKMARK_ADD), tr("Add new"), menu);
QAction *change = new QAction(WU->getPixmap(WulforUtil::eiEDIT), tr("Change"), menu);
QAction *remove = new QAction(WU->getPixmap(WulforUtil::eiEDITDELETE), tr("Delete"), menu);
QAction *conn = new QAction(WU->getPixmap(WulforUtil::eiCONNECT), tr("Connect"), menu);
QAction *sep1 = new QAction(menu);
QAction *sep2 = new QAction(menu);
sep1->setSeparator(true);
sep2->setSeparator(true);
menu->addActions(QList<QAction*>() << change
<< remove
<< sep1
<< conn
<< sep2
<< add_new);
QAction *res = menu->exec(QCursor::pos());
if (res == change)
slotChangeButtonClicked();
else if (res == remove)
slotRemoveButtonClicked();
else if (res == conn)
slotDblClicked();
else if (res == add_new)
slotAdd_newButtonClicked();
}
delete menu;
}
示例15: imageIterTest
MainWindow::MainWindow(running_machine* machine, QWidget* parent) :
WindowQt(machine, nullptr),
m_historyIndex(0),
m_inputHistory()
{
setGeometry(300, 300, 1000, 600);
//
// The main frame and its input and log widgets
//
QFrame* mainWindowFrame = new QFrame(this);
// The input line
m_inputEdit = new QLineEdit(mainWindowFrame);
connect(m_inputEdit, &QLineEdit::returnPressed, this, &MainWindow::executeCommandSlot);
m_inputEdit->installEventFilter(this);
// The log view
m_consoleView = new DebuggerView(DVT_CONSOLE,
m_machine,
mainWindowFrame);
m_consoleView->setFocusPolicy(Qt::NoFocus);
m_consoleView->setPreferBottom(true);
QVBoxLayout* vLayout = new QVBoxLayout(mainWindowFrame);
vLayout->addWidget(m_consoleView);
vLayout->addWidget(m_inputEdit);
vLayout->setSpacing(3);
vLayout->setContentsMargins(4,0,4,2);
setCentralWidget(mainWindowFrame);
//
// Options Menu
//
// Create three commands
m_breakpointToggleAct = new QAction("Toggle Breakpoint at Cursor", this);
m_breakpointEnableAct = new QAction("Disable Breakpoint at Cursor", this);
m_runToCursorAct = new QAction("Run to Cursor", this);
m_breakpointToggleAct->setShortcut(Qt::Key_F9);
m_breakpointEnableAct->setShortcut(Qt::SHIFT + Qt::Key_F9);
m_runToCursorAct->setShortcut(Qt::Key_F4);
connect(m_breakpointToggleAct, &QAction::triggered, this, &MainWindow::toggleBreakpointAtCursor);
connect(m_breakpointEnableAct, &QAction::triggered, this, &MainWindow::enableBreakpointAtCursor);
connect(m_runToCursorAct, &QAction::triggered, this, &MainWindow::runToCursor);
// Right bar options
QActionGroup* rightBarGroup = new QActionGroup(this);
rightBarGroup->setObjectName("rightbargroup");
QAction* rightActRaw = new QAction("Raw Opcodes", this);
QAction* rightActEncrypted = new QAction("Encrypted Opcodes", this);
QAction* rightActComments = new QAction("Comments", this);
rightActRaw->setCheckable(true);
rightActEncrypted->setCheckable(true);
rightActComments->setCheckable(true);
rightActRaw->setActionGroup(rightBarGroup);
rightActEncrypted->setActionGroup(rightBarGroup);
rightActComments->setActionGroup(rightBarGroup);
rightActRaw->setShortcut(QKeySequence("Ctrl+R"));
rightActEncrypted->setShortcut(QKeySequence("Ctrl+E"));
rightActComments->setShortcut(QKeySequence("Ctrl+N"));
rightActRaw->setChecked(true);
connect(rightBarGroup, &QActionGroup::triggered, this, &MainWindow::rightBarChanged);
// Assemble the options menu
QMenu* optionsMenu = menuBar()->addMenu("&Options");
optionsMenu->addAction(m_breakpointToggleAct);
optionsMenu->addAction(m_breakpointEnableAct);
optionsMenu->addAction(m_runToCursorAct);
optionsMenu->addSeparator();
optionsMenu->addActions(rightBarGroup->actions());
//
// Images menu
//
image_interface_iterator imageIterTest(m_machine->root_device());
if (imageIterTest.first() != nullptr)
{
createImagesMenu();
}
//
// Dock window menu
//
QMenu* dockMenu = menuBar()->addMenu("Doc&ks");
setCorner(Qt::TopRightCorner, Qt::TopDockWidgetArea);
setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
// The processor dock
QDockWidget* cpuDock = new QDockWidget("processor", this);
cpuDock->setObjectName("cpudock");
cpuDock->setAllowedAreas(Qt::LeftDockWidgetArea);
m_procFrame = new ProcessorDockWidget(m_machine, cpuDock);
cpuDock->setWidget(dynamic_cast<QWidget*>(m_procFrame));
addDockWidget(Qt::LeftDockWidgetArea, cpuDock);
dockMenu->addAction(cpuDock->toggleViewAction());
//.........这里部分代码省略.........