本文整理汇总了C++中QActionGroup::actions方法的典型用法代码示例。如果您正苦于以下问题:C++ QActionGroup::actions方法的具体用法?C++ QActionGroup::actions怎么用?C++ QActionGroup::actions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QActionGroup
的用法示例。
在下文中一共展示了QActionGroup::actions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QWidget
FormEditorWidget::FormEditorWidget(FormEditorView *view)
: QWidget(),
m_formEditorView(view)
{
setStyleSheet(QLatin1String(Utils::FileReader::fetchQrc(":/qmldesigner/formeditorstylesheet.css")));
QVBoxLayout *fillLayout = new QVBoxLayout(this);
fillLayout->setMargin(0);
fillLayout->setSpacing(0);
setLayout(fillLayout);
QList<QAction*> upperActions;
m_toolActionGroup = new QActionGroup(this);
m_transformToolAction = m_toolActionGroup->addAction("Transform Tool (Press Key Q)");
m_transformToolAction->setShortcut(Qt::Key_Q);
m_transformToolAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
m_transformToolAction->setCheckable(true);
m_transformToolAction->setChecked(true);
m_transformToolAction->setIcon(QPixmap(":/icon/tool/transform.png"));
connect(m_transformToolAction.data(), SIGNAL(triggered(bool)), SLOT(changeTransformTool(bool)));
m_anchorToolAction = m_toolActionGroup->addAction("Anchor Tool (Press Key W)");
m_anchorToolAction->setShortcut(Qt::Key_W);
m_anchorToolAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
m_anchorToolAction->setCheckable(true);
m_anchorToolAction->setIcon(QPixmap(":/icon/tool/anchor.png"));
connect(m_anchorToolAction.data(), SIGNAL(triggered(bool)), SLOT(changeAnchorTool(bool)));
// addActions(m_toolActionGroup->actions());
// upperActions.append(m_toolActionGroup->actions());
QActionGroup *layoutActionGroup = new QActionGroup(this);
layoutActionGroup->setExclusive(false);
m_snappingAction = layoutActionGroup->addAction(tr("Snap to guides (E)"));
m_snappingAction->setShortcut(Qt::Key_E);
m_snappingAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
m_snappingAction->setCheckable(true);
m_snappingAction->setChecked(true);
m_snappingAction->setIcon(QPixmap(":/icon/layout/snapping.png"));
m_snappingAndAnchoringAction = layoutActionGroup->addAction("Toogle Snapping And Anchoring (Press Key R)");
m_snappingAndAnchoringAction->setShortcut(Qt::Key_R);
m_snappingAndAnchoringAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
m_snappingAndAnchoringAction->setCheckable(true);
m_snappingAndAnchoringAction->setChecked(false);
m_snappingAndAnchoringAction->setEnabled(false);
m_snappingAndAnchoringAction->setVisible(false);
m_snappingAndAnchoringAction->setIcon(QPixmap(":/icon/layout/snapping_and_anchoring.png"));
addActions(layoutActionGroup->actions());
upperActions.append(layoutActionGroup->actions());
QAction *separatorAction = new QAction(this);
separatorAction->setSeparator(true);
addAction(separatorAction);
upperActions.append(separatorAction);
m_showBoundingRectAction = new QAction(tr("Show bounding rectangles and stripes for empty items (Press Key A)"), this);
m_showBoundingRectAction->setShortcut(Qt::Key_A);
m_showBoundingRectAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
m_showBoundingRectAction->setCheckable(true);
m_showBoundingRectAction->setChecked(true);
m_showBoundingRectAction->setIcon(QPixmap(":/icon/layout/boundingrect.png"));
addAction(m_showBoundingRectAction.data());
upperActions.append(m_showBoundingRectAction.data());
m_selectOnlyContentItemsAction = new QAction(tr("Only select items with content (S)"), this);
m_selectOnlyContentItemsAction->setShortcut(Qt::Key_S);
m_selectOnlyContentItemsAction->setShortcutContext(Qt::WidgetWithChildrenShortcut);
m_selectOnlyContentItemsAction->setCheckable(true);
m_selectOnlyContentItemsAction->setChecked(false);
m_selectOnlyContentItemsAction->setIcon(QPixmap(":/icon/selection/selectonlycontentitems.png"));
addAction(m_selectOnlyContentItemsAction.data());
upperActions.append(m_selectOnlyContentItemsAction.data());
m_rootWidthAction = new LineEditAction("width", this);
connect(m_rootWidthAction.data(), SIGNAL(textChanged(QString)), this, SLOT(changeRootItemWidth(QString)));
addAction(m_rootWidthAction.data());
upperActions.append(m_rootWidthAction.data());
m_rootHeightAction = new LineEditAction("height", this);
connect(m_rootHeightAction.data(), SIGNAL(textChanged(QString)), this, SLOT(changeRootItemHeight(QString)));
addAction(m_rootHeightAction.data());
upperActions.append(m_rootHeightAction.data());
m_snappingAndAnchoringAction = layoutActionGroup->addAction("Toogle Snapping And Anchoring (Press Key R)");
m_toolBox = new ToolBox(this);
fillLayout->addWidget(m_toolBox.data());
m_toolBox->setLeftSideActions(upperActions);
m_graphicsView = new FormEditorGraphicsView(this);
fillLayout->addWidget(m_graphicsView.data());
m_graphicsView.data()->setStyleSheet(
QLatin1String(Utils::FileReader::fetchQrc(":/qmldesigner/scrollbar.css")));
//.........这里部分代码省略.........
示例2: QFrame
DasmWindow::DasmWindow(running_machine* machine, QWidget* parent) :
WindowQt(machine, nullptr)
{
setWindowTitle("Debug: Disassembly View");
if (parent != nullptr)
{
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, &QLineEdit::returnPressed, this, &DasmWindow::expressionSubmitted);
// The cpu combo box
m_cpuComboBox = new QComboBox(topSubFrame);
m_cpuComboBox->setObjectName("cpu");
m_cpuComboBox->setMinimumWidth(300);
connect(m_cpuComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &DasmWindow::cpuChanged);
// The main disasm window
m_dasmView = new DebuggerView(DVT_DISASSEMBLY, m_machine, this);
connect(m_dasmView, &DebuggerView::updated, this, &DasmWindow::dasmViewUpdated);
// 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 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, &DasmWindow::toggleBreakpointAtCursor);
connect(m_breakpointEnableAct, &QAction::triggered, this, &DasmWindow::enableBreakpointAtCursor);
connect(m_runToCursorAct, &QAction::triggered, this, &DasmWindow::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, &DasmWindow::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());
}
示例3: QDockWidget
TextTools::TextTools(QWidget* parent)
: QDockWidget(parent)
{
_textElement = 0;
setObjectName("text-tools");
setWindowTitle(tr("Text Tools"));
setAllowedAreas(Qt::DockWidgetAreas(Qt::TopDockWidgetArea | Qt::BottomDockWidgetArea));
QToolBar* tb = new QToolBar(tr("Text Edit"));
tb->setIconSize(QSize(preferences.iconWidth, preferences.iconHeight));
textStyles = new QComboBox;
tb->addWidget(textStyles);
showKeyboard = getAction("show-keys");
showKeyboard->setCheckable(true);
tb->addAction(showKeyboard);
typefaceBold = tb->addAction(*icons[textBold_ICON], "");
typefaceBold->setToolTip(tr("bold"));
typefaceBold->setCheckable(true);
typefaceItalic = tb->addAction(*icons[textItalic_ICON], "");
typefaceItalic->setToolTip(tr("italic"));
typefaceItalic->setCheckable(true);
typefaceUnderline = tb->addAction(*icons[textUnderline_ICON], "");
typefaceUnderline->setToolTip(tr("underline"));
typefaceUnderline->setCheckable(true);
tb->addSeparator();
QActionGroup* ha = new QActionGroup(tb);
leftAlign = new QAction(*icons[textLeft_ICON], "", ha);
leftAlign->setToolTip(tr("align left"));
leftAlign->setCheckable(true);
leftAlign->setData(ALIGN_LEFT);
hcenterAlign = new QAction(*icons[textCenter_ICON], "", ha);
hcenterAlign->setToolTip(tr("align horizontal center"));
hcenterAlign->setCheckable(true);
hcenterAlign->setData(ALIGN_HCENTER);
rightAlign = new QAction(*icons[textRight_ICON], "", ha);
rightAlign->setToolTip(tr("align right"));
rightAlign->setCheckable(true);
rightAlign->setData(ALIGN_RIGHT);
tb->addActions(ha->actions());
QActionGroup* va = new QActionGroup(tb);
topAlign = new QAction(*icons[textTop_ICON], "", va);
topAlign->setToolTip(tr("align top"));
topAlign->setCheckable(true);
topAlign->setData(ALIGN_TOP);
bottomAlign = new QAction(*icons[textBottom_ICON], "", va);
bottomAlign->setToolTip(tr("align bottom"));
bottomAlign->setCheckable(true);
bottomAlign->setData(ALIGN_BOTTOM);
baselineAlign = new QAction(*icons[textBaseline_ICON], "", va);
baselineAlign->setToolTip(tr("align vertical baseline"));
baselineAlign->setCheckable(true);
baselineAlign->setData(ALIGN_BASELINE);
vcenterAlign = new QAction(*icons[textVCenter_ICON], "", va);
vcenterAlign->setToolTip(tr("align vertical center"));
vcenterAlign->setCheckable(true);
vcenterAlign->setData(ALIGN_VCENTER);
tb->addActions(va->actions());
typefaceSubscript = tb->addAction(*icons[textSub_ICON], "");
typefaceSubscript->setToolTip(tr("subscript"));
typefaceSubscript->setCheckable(true);
typefaceSuperscript = tb->addAction(*icons[textSuper_ICON], "");
typefaceSuperscript->setToolTip(tr("superscript"));
typefaceSuperscript->setCheckable(true);
// unorderedList = tb->addAction(*icons[formatListUnordered_ICON], "");
// unorderedList->setToolTip(tr("unordered list"));
// orderedList = tb->addAction(*icons[formatListOrdered_ICON], "");
// orderedList->setToolTip(tr("ordered list"));
// indentMore = tb->addAction(*icons[formatIndentMore_ICON], "");
// indentMore->setToolTip(tr("indent more"));
// indentLess = tb->addAction(*icons[formatIndentLess_ICON], "");
// indentLess->setToolTip(tr("indent less"));
tb->addSeparator();
typefaceFamily = new QFontComboBox(this);
tb->addWidget(typefaceFamily);
typefaceSize = new QDoubleSpinBox(this);
typefaceSize->setFocusPolicy(Qt::ClickFocus);
tb->addWidget(typefaceSize);
setWidget(tb);
QWidget* w = new QWidget(this);
//.........这里部分代码省略.........
示例4: QFrame
//.........这里部分代码省略.........
m_inputEdit = new QLineEdit(topSubFrame);
connect(m_inputEdit, SIGNAL(returnPressed()), this, SLOT(expressionSubmitted()));
// The memory space combo box
m_memoryComboBox = new QComboBox(topSubFrame);
m_memoryComboBox->setObjectName("memoryregion");
m_memoryComboBox->setMinimumWidth(300);
connect(m_memoryComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(memoryRegionChanged(int)));
// The main memory window
m_memTable = new DebuggerMemView(DVT_MEMORY, m_machine, this);
// Layout
QHBoxLayout* subLayout = new QHBoxLayout(topSubFrame);
subLayout->addWidget(m_inputEdit);
subLayout->addWidget(m_memoryComboBox);
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_memTable);
setCentralWidget(mainWindowFrame);
//
// Menu bars
//
// Create a byte-chunk group
QActionGroup* chunkGroup = new QActionGroup(this);
chunkGroup->setObjectName("chunkgroup");
QAction* chunkActOne = new QAction("1-byte chunks", this);
chunkActOne->setObjectName("chunkActOne");
QAction* chunkActTwo = new QAction("2-byte chunks", this);
chunkActTwo->setObjectName("chunkActTwo");
QAction* chunkActFour = new QAction("4-byte chunks", this);
chunkActFour->setObjectName("chunkActFour");
chunkActOne->setCheckable(true);
chunkActTwo->setCheckable(true);
chunkActFour->setCheckable(true);
chunkActOne->setActionGroup(chunkGroup);
chunkActTwo->setActionGroup(chunkGroup);
chunkActFour->setActionGroup(chunkGroup);
chunkActOne->setShortcut(QKeySequence("Ctrl+1"));
chunkActTwo->setShortcut(QKeySequence("Ctrl+2"));
chunkActFour->setShortcut(QKeySequence("Ctrl+4"));
chunkActOne->setChecked(true);
connect(chunkGroup, SIGNAL(triggered(QAction*)), this, SLOT(chunkChanged(QAction*)));
// 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, SIGNAL(triggered(QAction*)), this, SLOT(addressChanged(QAction*)));
// 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, SIGNAL(toggled(bool)), this, SLOT(reverseChanged(bool)));
// 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, SIGNAL(triggered(bool)), this, SLOT(increaseBytesPerLine(bool)));
connect(decreaseBplAct, SIGNAL(triggered(bool)), this, SLOT(decreaseBytesPerLine(bool)));
// Assemble the options menu
QMenu* optionsMenu = menuBar()->addMenu("&Options");
optionsMenu->addActions(chunkGroup->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();
}
示例5: imageIterTest
MainWindow::MainWindow(running_machine* machine, QWidget* parent) :
WindowQt(machine, NULL),
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, SIGNAL(returnPressed()), this, SLOT(executeCommand()));
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, SIGNAL(triggered(bool)), this, SLOT(toggleBreakpointAtCursor(bool)));
connect(m_breakpointEnableAct, SIGNAL(triggered(bool)), this, SLOT(enableBreakpointAtCursor(bool)));
connect(m_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(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() != NULL)
{
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());
//.........这里部分代码省略.........
示例6: PostWindowCreate
//.........这里部分代码省略.........
QActionGroup* perspGroup = new QActionGroup(menuBar);
std::vector<berry::IPerspectiveDescriptor::Pointer> perspectives(
perspRegistry->GetPerspectives());
bool skip = false;
for (std::vector<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 (unsigned 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(std::make_pair((*perspIt)->GetId(), perspAction));
}
perspMenu->addActions(perspGroup->actions());
// sort elements (converting vector to map...)
std::vector<berry::IViewDescriptor::Pointer>::const_iterator iter;
std::map<std::string, berry::IViewDescriptor::Pointer> VDMap;
skip = false;
for (iter = viewDescriptors.begin(); iter != viewDescriptors.end(); ++iter)
{
// if viewExcludeList is set, it contains the id-strings of view, which
// should not appear as an menu-entry in the menu
if (viewExcludeList.size() > 0)
{
for (unsigned int i=0; i<viewExcludeList.size(); i++)
{
if (viewExcludeList.at(i) == (*iter)->GetId())
{
skip = true;
break;
}
}
if (skip)
{
skip = false;
continue;
}
}
if ((*iter)->GetId() == "org.blueberry.ui.internal.introview")
continue;
if ((*iter)->GetId() == "org.mitk.views.imagenavigator")
continue;
示例7: 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(const QString&)), SLOT(addToCustomSearch(const QString&)) );
connect( breadcrumb, SIGNAL(albumClicked(const QString&)), SLOT(addToCustomSearch(const 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 *yahooAct = new QAction( i18n( "Yahoo!" ), sourceMenu );
QAction *discogsAct = new QAction( i18n( "Discogs" ), sourceMenu );
lastFmAct->setCheckable( true );
googleAct->setCheckable( true );
yahooAct->setCheckable( true );
discogsAct->setCheckable( true );
connect( lastFmAct, SIGNAL(triggered()), this, SLOT(selectLastFm()) );
connect( googleAct, SIGNAL(triggered()), this, SLOT(selectGoogle()) );
connect( yahooAct, SIGNAL(triggered()), this, SLOT(selectYahoo()) );
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( yahooAct );
ag->addAction( discogsAct );
sourceMenu->addActions( ag->actions() );
sourceMenu->addSeparator();
sourceMenu->addAction( m_sortAction );
sourceButton->setMenu( sourceMenu );
//.........这里部分代码省略.........
示例8: KAction
NavigatorConfigAction::NavigatorConfigAction( QWidget * parent )
: KAction( parent )
{
KMenu * navigatorMenu = new KMenu( 0 );
setMenu( navigatorMenu );
setText( i18n( "Track Progression" ) );
QActionGroup * navigatorActions = new QActionGroup( navigatorMenu );
navigatorActions->setExclusive( true );
m_standardNavigatorAction = navigatorActions->addAction( i18n( "Standard" ) );
m_standardNavigatorAction->setIcon( KIcon( "media-standard-track-progression-amarok" ) );
m_standardNavigatorAction->setCheckable( true );
//action->setIcon( true );
m_onlyQueueNavigatorAction = navigatorActions->addAction( i18n( "Only Queue" ) );
m_onlyQueueNavigatorAction->setIcon( KIcon( "media-standard-track-progression-amarok" ) );
m_onlyQueueNavigatorAction->setCheckable( true );
QAction * action = new QAction( parent );
action->setSeparator( true );
navigatorActions->addAction( action );
m_repeatTrackNavigatorAction = navigatorActions->addAction( i18n( "Repeat Track" ) );
m_repeatTrackNavigatorAction->setIcon( KIcon( "media-repeat-track-amarok" ) );
m_repeatTrackNavigatorAction->setCheckable( true );
m_repeatAlbumNavigatorAction = navigatorActions->addAction( i18n( "Repeat Album" ) );
m_repeatAlbumNavigatorAction->setIcon( KIcon( "media-repeat-album-amarok" ) );
m_repeatAlbumNavigatorAction->setCheckable( true );
m_repeatPlaylistNavigatorAction = navigatorActions->addAction( i18n( "Repeat Playlist" ) );
m_repeatPlaylistNavigatorAction->setIcon( KIcon( "media-repeat-playlist-amarok" ) );
m_repeatPlaylistNavigatorAction->setCheckable( true );
action = new QAction( parent );
action->setSeparator( true );
navigatorActions->addAction( action );
m_randomTrackNavigatorAction = navigatorActions->addAction( i18n( "Random Tracks" ) );
m_randomTrackNavigatorAction->setIcon( KIcon( "media-random-tracks-amarok" ) );
m_randomTrackNavigatorAction->setCheckable( true );
m_randomAlbumNavigatorAction = navigatorActions->addAction( i18n( "Random Albums" ) );
m_randomAlbumNavigatorAction->setIcon( KIcon( "media-random-albums-amarok" ) );
m_randomAlbumNavigatorAction->setCheckable( true );
navigatorMenu->addActions( navigatorActions->actions() );
QMenu * favorMenu = navigatorMenu->addMenu( i18n( "Favor" ) );
QActionGroup * favorActions = new QActionGroup( favorMenu );
m_favorNoneAction = favorActions->addAction( i18n( "None" ) );
m_favorNoneAction->setCheckable( true );
m_favorScoresAction = favorActions->addAction( i18n( "Higher Scores" ) );
m_favorScoresAction->setCheckable( true );
m_favorRatingsAction = favorActions->addAction( i18n( "Higher Ratings" ) );
m_favorRatingsAction->setCheckable( true );
m_favorLastPlayedAction = favorActions->addAction( i18n( "Not Recently Played" ) );
m_favorLastPlayedAction->setCheckable( true );
favorMenu->addActions( favorActions->actions() );
//make sure the correct entry is selected from start:
switch( AmarokConfig::trackProgression() )
{
case AmarokConfig::EnumTrackProgression::OnlyQueue:
m_onlyQueueNavigatorAction->setChecked( true );
setIcon( m_onlyQueueNavigatorAction->icon() );
break;
case AmarokConfig::EnumTrackProgression::RepeatTrack:
m_repeatTrackNavigatorAction->setChecked( true );
setIcon( m_repeatTrackNavigatorAction->icon() );
break;
case AmarokConfig::EnumTrackProgression::RepeatAlbum:
m_repeatAlbumNavigatorAction->setChecked( true );
setIcon( m_repeatAlbumNavigatorAction->icon() );
break;
case AmarokConfig::EnumTrackProgression::RepeatPlaylist:
m_repeatPlaylistNavigatorAction->setChecked( true );
setIcon( m_repeatPlaylistNavigatorAction->icon() );
break;
case AmarokConfig::EnumTrackProgression::RandomTrack:
m_randomTrackNavigatorAction->setChecked( true );
setIcon( m_randomTrackNavigatorAction->icon() );
break;
case AmarokConfig::EnumTrackProgression::RandomAlbum:
m_randomAlbumNavigatorAction->setChecked( true );
setIcon( m_randomAlbumNavigatorAction->icon() );
break;
//.........这里部分代码省略.........
示例9: setupActions
void RichTextEdit::setupActions()
{
EditMenu *menu = Controller::create()->getEditMenu();
toolbar->setWindowTitle(tr("Edit Actions"));
actionSave = toolbar->addAction(QIcon("icons/document-save.png"), tr("Save"));
actionSave->setShortcut(QKeySequence::Save);
toolbar->addSeparator();
actionUndo = toolbar->addAction(QIcon("icons/edit-undo.png"), tr("Undo"));
menu->addAction(actionUndo);
actionUndo->setShortcut(QKeySequence::Undo);
actionRedo = toolbar->addAction(QIcon("icons/edit-redo.png"), tr("Redo"));
menu->addAction(actionRedo);
actionRedo->setShortcut(QKeySequence::Redo);
actionCut = toolbar->addAction(QIcon("icons/edit-cut.png"), tr("Cut"));
menu->addAction(actionCut);
actionCut->setShortcut(QKeySequence::Cut);
actionCopy = toolbar->addAction(QIcon("icons/edit-copy.png"), tr("Copy"));
menu->addAction(actionCopy);
actionCopy->setShortcut(QKeySequence::Copy);
actionPaste = toolbar->addAction(QIcon("icons/edit-paste.png"), tr("Paste"));
menu->addAction(actionPaste);
actionPaste->setShortcut(QKeySequence::Paste);
toolbar->addSeparator();
actionTextBold = toolbar->addAction(QIcon("icons/format-text-bold.png"), tr("Bold"));
menu->addAction(actionTextBold);
actionTextBold->setShortcut(Qt::CTRL + Qt::Key_B);
QFont bold;
bold.setBold(true);
actionTextBold->setFont(bold);
connect(actionTextBold, SIGNAL(triggered()), this, SLOT(textBold()));
actionTextBold->setCheckable(true);
actionTextItalic = toolbar->addAction(QIcon("icons/format-text-italic.png"), tr("Italic"));
menu->addAction(actionTextItalic);
actionTextItalic->setShortcut(Qt::CTRL + Qt::Key_I);
QFont italic;
italic.setItalic(true);
actionTextItalic->setFont(italic);
connect(actionTextItalic, SIGNAL(triggered()), this, SLOT(textItalic()));
actionTextItalic->setCheckable(true);
actionTextUnderline = toolbar->addAction(QIcon("icons/format-text-underline.png"), tr("Underline"));
menu->addAction(actionTextUnderline);
actionTextUnderline->setShortcut(Qt::CTRL + Qt::Key_U);
QFont underline;
underline.setUnderline(true);
actionTextUnderline->setFont(underline);
connect(actionTextUnderline, SIGNAL(triggered()), this, SLOT(textUnderline()));
actionTextUnderline->setCheckable(true);
toolbar->addSeparator();
QActionGroup *grp = new QActionGroup(this);
connect(grp, SIGNAL(triggered(QAction *)), this, SLOT(textAlign(QAction *)));
actionAlignLeft = new QAction(QIcon("icons/format-justify-left.png"), tr("&Left"), grp);
actionAlignLeft->setShortcut(Qt::CTRL + Qt::Key_L);
actionAlignLeft->setCheckable(true);
actionAlignCenter = new QAction(QIcon("icons/format-justify-center.png"), tr("C&enter"), grp);
actionAlignCenter->setShortcut(Qt::CTRL + Qt::Key_E);
actionAlignCenter->setCheckable(true);
actionAlignRight = new QAction(QIcon("icons/format-justify-right.png"), tr("&Right"), grp);
actionAlignRight->setShortcut(Qt::CTRL + Qt::Key_R);
actionAlignRight->setCheckable(true);
actionAlignJustify = new QAction(QIcon("icons/format-justify-fill.png"), tr("&Justify"), grp);
actionAlignJustify->setShortcut(Qt::CTRL + Qt::Key_J);
actionAlignJustify->setCheckable(true);
toolbar->addActions(grp->actions());
menu->addActions(grp->actions());
toolbar->addSeparator();
// color
QPixmap pix(16, 16);
pix.fill(Qt::black);
actionTextColor = new QAction(pix, tr("&Color..."), this);
connect(actionTextColor, SIGNAL(triggered()), this, SLOT(textColor()));
toolbar->addAction(actionTextColor);
menu->addAction(actionTextColor);
actionFind = toolbar->addAction(QIcon("icons/edit-find.png"), tr("Find"));
actionFind->setShortcut(QKeySequence::Find);
menu->addAction(actionFind);
}
示例10: QMainWindow
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
color_ranges_(),
palettes_(),
user_color_ranges_(),
user_palettes_(),
ui(new Ui::MainWindow),
img_path_(),
img_original_(),
img_transview_(),
zoom_(1.0),
ignore_drops_(false),
drag_use_rc_(false),
drag_start_(false),
drag_start_pos_(),
recent_file_acts_(),
zoom_factors_({ 0.5, 1.0, 2.0, 4.0, 8.0 })
{
ui->setupUi(this);
mos_config_load(user_color_ranges_, user_palettes_);
const QSize& lastWindowSize = mos_get_main_window_size();
if(lastWindowSize.isValid()) {
resize(lastWindowSize);
}
generateMergedRcDefinitions();
processRcDefinitions();
QAction* const act_whatsthis = QWhatsThis::createAction(this);
ui->menu_Help->insertAction(ui->actionAbout_Morning_Star, act_whatsthis);
ui->menu_Help->insertSeparator(ui->actionAbout_Morning_Star);
QPushButton* const save = ui->buttonBox->button(QDialogButtonBox::Save);
QPushButton* const close = ui->buttonBox->button(QDialogButtonBox::Close);
save->setWhatsThis(tr("Saves the current recolor job."));
close->setWhatsThis(tr("Abandons the current job and exits."));
ui->action_Open->setIcon(this->style()->standardIcon(QStyle::SP_DialogOpenButton, nullptr, dynamic_cast<QWidget*>(ui->action_Open)));
ui->action_Save->setIcon(this->style()->standardIcon(QStyle::SP_DialogSaveButton, nullptr, dynamic_cast<QWidget*>(ui->action_Save)));
ui->action_Reload->setIcon(this->style()->standardIcon(QStyle::SP_BrowserReload, nullptr, dynamic_cast<QWidget*>(ui->action_Reload)));
ui->action_Quit->setIcon(this->style()->standardIcon(QStyle::SP_DialogCloseButton, nullptr, dynamic_cast<QWidget*>(ui->action_Quit)));
// Use theme icons for some buttons on X11. This is not
// in the .ui file for Qt 4.6 - 4.7 compatibility.
ui->tbZoomIn->setIcon(QIcon::fromTheme("zoom-in", QIcon(":/zoom-in-16.png")));
ui->tbZoomOut->setIcon(QIcon::fromTheme("zoom-out", QIcon(":/zoom-out-16.png")));
for(unsigned k = 0; k < mos_max_recent_files(); ++k) {
QAction* act = new QAction(this);
act->setVisible(false);
connect(act, SIGNAL(triggered()), this, SLOT(handleRecent()));
ui->menu_File->insertAction(ui->action_RecentPlaceholder, act);
recent_file_acts_.push_back(act);
}
ui->action_RecentPlaceholder->setVisible(false);
update_recent_files_menu();
const QString& bgColorName = mos_get_preview_background_color_name();
QActionGroup* bgColorActs = new QActionGroup(this);
// The Custom Color entry goes into the list first so that it is preemptively
// selected first on the next loop in case the color saved in preferences isn't
// any of the predefined ones.
bgColorActs->addAction(ui->actionPreviewBgCustom);
ui->actionPreviewBgCustom->setData(bgColorName);
do_custom_preview_color_icon();
bgColorActs->addAction(ui->actionPreviewBgBlack);
ui->actionPreviewBgBlack->setData(QColor(Qt::black).name());
bgColorActs->addAction(ui->actionPreviewBgDark);
ui->actionPreviewBgDark->setData(QColor(Qt::darkGray).name());
bgColorActs->addAction(ui->actionPreviewBgDefault);
ui->actionPreviewBgDefault->setData("");
bgColorActs->addAction(ui->actionPreviewBgLight);
ui->actionPreviewBgLight->setData(QColor(Qt::lightGray).name());
bgColorActs->addAction(ui->actionPreviewBgWhite);
ui->actionPreviewBgWhite->setData(QColor(Qt::white).name());
QList<QAction*> bgColorActList = bgColorActs->actions();
for(auto* act : bgColorActList) {
connect(act, SIGNAL(triggered(bool)), this, SLOT(handlePreviewBgOption(bool)));
// We must find the menu item for the color we read from the app
// config and mark it as checked, and update the preview background
// color manually since setChecked() won't raise the triggered()
// signal.
//.........这里部分代码省略.........
示例11: mouseReleaseEvent
void QRibbonButtonBar::mouseReleaseEvent(QMouseEvent* evt)
{
QPoint cursor(evt->pos());
if (m_active_button)
{
QRibbonButtonBarButtonSizeInfo& size = m_active_button->base->sizes[m_active_button->size];
QRect btn_rect;
btn_rect.setTopLeft(m_layout_offset + m_active_button->position);
btn_rect.setSize(size.size);
if (btn_rect.contains(cursor))
{
int id = m_active_button->base->id;
cursor -= btn_rect.topLeft();
QAction* pAction = m_active_button->base->m_pAction;
if (pAction)
{
do
{
if (size.normal_region.contains(cursor))
{
int nKind = m_active_button->base->kind;
if (nKind == QRIBBON_BUTTON_NORMAL)
{
pAction->triggered();
}
else if (nKind == QRIBBON_BUTTON_TOGGLE)
{
pAction->triggered(true);
}
else if (nKind == QRIBBON_BUTTON_HYBRID || nKind == QRIBBON_BUTTON_DROPDOWN)
{
QActionGroup* pGroup = pAction->actionGroup();
if (pGroup)
{
QList<QAction*> lsActions = pGroup->actions();
Q_ASSERT(lsActions.size() == 3);
QAction* pAction1 = lsActions.at(0);
QAction* pAction2 = lsActions.at(1);
if (pAction1 && pAction2)
{
pAction1->triggered();
pAction2->triggered();
}
}
}
}
m_lock_active_state = true;
m_lock_active_state = false;
} while (false);
}
if (m_active_button) // may have been NULLed by event handler
{
m_active_button->base->state &= ~QRIBBON_BUTTONBAR_BUTTON_ACTIVE_MASK;
m_active_button = NULL;
}
update();
}
}
}
示例12: initStackedPage
/** Initialyse Stacked Page*/
void MainWindow::initStackedPage()
{
/* WORK OUT IF WE"RE IN ADVANCED MODE OR NOT */
bool advancedMode = false;
std::string advsetting;
if (rsConfig->getConfigurationOption(RS_CONFIG_ADVANCED, advsetting) && (advsetting == "YES")) {
advancedMode = true;
}
QList<QPair<MainPage*, QPair<QAction*, QListWidgetItem*> > > notify;
/* Create the Main pages and actions */
QActionGroup *grp = new QActionGroup(this);
addPage(newsFeed = new NewsFeed(ui->stackPages), grp, ¬ify);
addPage(friendsDialog = new FriendsDialog(ui->stackPages), grp, ¬ify);
#ifdef RS_USE_CIRCLES
PeopleDialog *peopleDialog = NULL;
addPage(peopleDialog = new PeopleDialog(ui->stackPages), grp, ¬ify);
#endif
IdDialog *idDialog = NULL;
addPage(idDialog = new IdDialog(ui->stackPages), grp, ¬ify);
#ifdef RS_USE_CIRCLES
CirclesDialog *circlesDialog = NULL;
addPage(circlesDialog = new CirclesDialog(ui->stackPages), grp, ¬ify);
#endif
addPage(transfersDialog = new TransfersDialog(ui->stackPages), grp, ¬ify);
addPage(chatLobbyDialog = new ChatLobbyWidget(ui->stackPages), grp, ¬ify);
addPage(messagesDialog = new MessagesDialog(ui->stackPages), grp, ¬ify);
addPage(gxschannelDialog = new GxsChannelDialog(ui->stackPages), grp, ¬ify);
addPage(gxsforumDialog = new GxsForumsDialog(ui->stackPages), grp, ¬ify);
addPage(postedDialog = new PostedDialog(ui->stackPages), grp, ¬ify);
#ifdef RS_USE_WIKI
WikiDialog *wikiDialog = NULL;
addPage(wikiDialog = new WikiDialog(ui->stackPages), grp, ¬ify);
#endif
#ifdef BLOGS
addPage(blogsFeed = new BlogsDialog(ui->stackPages), grp, NULL);
#endif
std::cerr << "Looking for interfaces in existing plugins:" << std::endl;
for(int i = 0;i<rsPlugins->nbPlugins();++i)
{
QIcon icon ;
if(rsPlugins->plugin(i) != NULL && rsPlugins->plugin(i)->qt_page() != NULL)
{
if(rsPlugins->plugin(i)->qt_icon() != NULL)
icon = *rsPlugins->plugin(i)->qt_icon() ;
else
icon = QIcon(":images/extension_48.png") ;
std::cerr << " Addign widget page for plugin " << rsPlugins->plugin(i)->getPluginName() << std::endl;
MainPage *pluginPage = rsPlugins->plugin(i)->qt_page();
pluginPage->setIconPixmap(icon);
pluginPage->setPageName(QString::fromUtf8(rsPlugins->plugin(i)->getPluginName().c_str()));
addPage(pluginPage, grp, ¬ify);
}
else if(rsPlugins->plugin(i) == NULL)
std::cerr << " No plugin object !" << std::endl;
else
std::cerr << " No plugin page !" << std::endl;
}
#ifndef RS_RELEASE_VERSION
#ifdef PLUGINMGR
addPage(pluginsPage = new PluginsPage(ui->stackPages), grp, NULL);
#endif
#endif
#ifdef GETSTARTED_GUI
MainPage *getStartedPage = NULL;
if (!advancedMode)
{
//ui->stackPages->add(getStartedPage = new GetStartedDialog(ui->stackPages),
// createPageAction(QIcon(IMG_HELP), tr("Getting Started"), grp));
addPage(getStartedPage = new GetStartedDialog(ui->stackPages), grp, NULL);
}
#endif
/* Create the toolbar */
ui->toolBarPage->addActions(grp->actions());
connect(grp, SIGNAL(triggered(QAction *)), ui->stackPages, SLOT(showPage(QAction *)));
#ifdef UNFINISHED
addAction(new QAction(QIcon(IMAGE_UNFINISHED), tr("Unfinished"), ui->toolBar), &MainWindow::showApplWindow, SLOT(showApplWindow()));
ui->toolBarAction->addSeparator();
notify += applicationWindow->getNotify();
#endif
//.........这里部分代码省略.........
示例13: QActionGroup
MainWindow::MainWindow( QWidget *parent )
: QWidget( parent )
, cardsGroup( new QActionGroup( this ) )
{
setAttribute( Qt::WA_DeleteOnClose, true );
setupUi( this );
cards->hide();
cards->hack();
languages->hack();
setWindowFlags( Qt::Window | Qt::CustomizeWindowHint | Qt::WindowMinimizeButtonHint );
#if QT_VERSION >= 0x040500
setWindowFlags( windowFlags() | Qt::WindowCloseButtonHint );
#else
setWindowFlags( windowFlags() | Qt::WindowSystemMenuHint );
#endif
// Buttons
QButtonGroup *buttonGroup = new QButtonGroup( this );
buttonGroup->addButton( settings, HeadSettings );
buttonGroup->addButton( help, HeadHelp );
buttonGroup->addButton( about, HeadAbout );
buttonGroup->addButton( homeCreate, HomeCreate );
buttonGroup->addButton( homeView, HomeView );
introNext = introButtons->addButton( tr( "Next" ), QDialogButtonBox::ActionRole );
buttonGroup->addButton( introNext, IntroNext );
buttonGroup->addButton( introButtons->button( QDialogButtonBox::Cancel ), IntroBack );
viewCrypt = viewButtons->addButton( tr("Encrypt"), QDialogButtonBox::ActionRole );
buttonGroup->addButton( viewCrypt, ViewCrypt );
buttonGroup->addButton( viewButtons->button( QDialogButtonBox::Close ), ViewClose );
connect( buttonGroup, SIGNAL(buttonClicked(int)),
SLOT(buttonClicked(int)) );
connect( cards, SIGNAL(activated(QString)), qApp->poller(), SLOT(selectCard(QString)), Qt::QueuedConnection );
connect( qApp->poller(), SIGNAL(dataChanged()), SLOT(showCardStatus()) );
// Cryptodoc
doc = new CryptoDoc( this );
// Translations
lang << "et" << "en" << "ru";
retranslate();
QActionGroup *langGroup = new QActionGroup( this );
for( int i = 0; i < lang.size(); ++i )
{
QAction *a = langGroup->addAction( new QAction( langGroup ) );
a->setData( lang[i] );
a->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_0 + i );
}
addActions( langGroup->actions() );
connect( langGroup, SIGNAL(triggered(QAction*)), SLOT(changeLang(QAction*)) );
connect( cardsGroup, SIGNAL(triggered(QAction*)), SLOT(changeCard(QAction*)) );
// Views
connect( viewContentView, SIGNAL(remove(int)),
SLOT(removeDocument(int)) );
connect( viewContentView, SIGNAL(save(int,QString)),
doc, SLOT(saveDocument(int,QString)) );
}
示例14: QMenu
/******************************************************************************
* Initializes the menu.
******************************************************************************/
ViewportMenu::ViewportMenu(Viewport* vp) : QMenu(vp->widget()), _viewport(vp)
{
QAction* action;
// Build menu.
action = addAction(tr("Preview Mode"), this, SLOT(onRenderPreviewMode(bool)));
action->setCheckable(true);
action->setChecked(_viewport->renderPreviewMode());
action = addAction(tr("Show Grid"), this, SLOT(onShowGrid(bool)));
action->setCheckable(true);
action->setChecked(_viewport->isGridVisible());
#ifdef OVITO_DEBUG
action = addAction(tr("Stereoscopic Mode (anaglyphs)"), this, SLOT(onStereoscopicMode(bool)));
action->setCheckable(true);
action->setChecked(_viewport->stereoscopicMode());
#endif
addSeparator();
_viewTypeMenu = addMenu(tr("View Type"));
connect(_viewTypeMenu, &QMenu::aboutToShow, this, &ViewportMenu::onShowViewTypeMenu);
QActionGroup* viewTypeGroup = new QActionGroup(this);
action = viewTypeGroup->addAction(tr("Top"));
action->setCheckable(true);
action->setChecked(_viewport->viewType() == Viewport::VIEW_TOP);
action->setData((int)Viewport::VIEW_TOP);
action = viewTypeGroup->addAction(tr("Bottom"));
action->setCheckable(true);
action->setChecked(_viewport->viewType() == Viewport::VIEW_BOTTOM);
action->setData((int)Viewport::VIEW_BOTTOM);
action = viewTypeGroup->addAction(tr("Front"));
action->setCheckable(true);
action->setChecked(_viewport->viewType() == Viewport::VIEW_FRONT);
action->setData((int)Viewport::VIEW_FRONT);
action = viewTypeGroup->addAction(tr("Back"));
action->setCheckable(true);
action->setChecked(_viewport->viewType() == Viewport::VIEW_BACK);
action->setData((int)Viewport::VIEW_BACK);
action = viewTypeGroup->addAction(tr("Left"));
action->setCheckable(true);
action->setChecked(_viewport->viewType() == Viewport::VIEW_LEFT);
action->setData((int)Viewport::VIEW_LEFT);
action = viewTypeGroup->addAction(tr("Right"));
action->setCheckable(true);
action->setChecked(_viewport->viewType() == Viewport::VIEW_RIGHT);
action->setData((int)Viewport::VIEW_RIGHT);
action = viewTypeGroup->addAction(tr("Ortho"));
action->setCheckable(true);
action->setChecked(_viewport->viewType() == Viewport::VIEW_ORTHO);
action->setData((int)Viewport::VIEW_ORTHO);
action = viewTypeGroup->addAction(tr("Perspective"));
action->setCheckable(true);
action->setChecked(_viewport->viewType() == Viewport::VIEW_PERSPECTIVE);
action->setData((int)Viewport::VIEW_PERSPECTIVE);
_viewTypeMenu->addActions(viewTypeGroup->actions());
connect(viewTypeGroup, &QActionGroup::triggered, this, &ViewportMenu::onViewType);
addSeparator();
addAction(tr("Adjust View..."), this, SLOT(onAdjustView()))->setEnabled(_viewport->viewType() != Viewport::VIEW_SCENENODE);
#if QT_VERSION < QT_VERSION_CHECK(5, 4, 0) && defined(Q_OS_MACX)
connect(static_cast<QGuiApplication*>(QGuiApplication::instance()), &QGuiApplication::focusWindowChanged, this, &ViewportMenu::onWindowFocusChanged);
#endif
}
示例15: QWidget
// Constructor
MakeRT::MakeRT(QWidget *parent):
QWidget(parent),
_ui(new Ui::MakeRT),
_audioOutput(new Phonon::AudioOutput(Phonon::MusicCategory, this)),
_player(new Phonon::MediaObject(this)),
_timer(new QTimer(this)),
_settings(new QSettings(this)),
_textNotificationWidget(new TextNotificationWidget(this)),
_soundNotificationWidget(new SoundNotificationWidget(this, _player)),
_timerSettingsWidget(new TimerSettingsWidget(this)),
_messageBox(new QMessageBox(QMessageBox::Information, tr("Make reality test!"), "", QMessageBox::Ok, this))
#ifndef Q_OS_SYMBIAN
, _trayIcon(new QSystemTrayIcon(QIcon(":/icon.png"), this))
#else
, _textNotificationAction(new QAction(tr("Text notifications"), this)),
_soundNotificationAction(new QAction(tr("Sound notification"), this)),
_timerSettingsAction(new QAction(tr("Timer settings"), this)),
_vibrationsMenu(new QMenu(tr("Vibrations"), this)),
_vibrationsOnAction(new QAction(tr("On"), this)),
_vibrationsOffAction(new QAction(tr("Off"), this)),
_aboutQtAction(new QAction(tr("About Qt4"), this)),
_quitAction(new QAction(tr("Quit"), this)),
_menu(new QMenu(this)),
_menuAction(new QAction(tr("Menu"), this)),
_hideAction(new QAction(tr("Hide"), this))
#endif // Q_OS_SYMBIAN
{
if (!_instance)
_instance = this;
else return;
_ui->setupUi(this);
#ifdef Q_OS_SYMBIAN
_vibrator = CHWRMVibra::NewL();
_vibrationsOnAction->setCheckable(true);
//_vibrationsOnAction->setChecked(true);
_vibrationsOffAction->setCheckable(true);
QActionGroup *group = new QActionGroup(this);
group->addAction(_vibrationsOnAction);
group->addAction(_vibrationsOffAction);
_vibrationsMenu->addActions(group->actions());
addAction(_menuAction);
addAction(_hideAction);
_menu->addAction(_textNotificationAction);
_menu->addAction(_soundNotificationAction);
_menu->addAction(_timerSettingsAction);
_menu->addMenu(_vibrationsMenu);
_menu->addAction(_aboutQtAction);
_menu->addAction(_quitAction);
_menuAction->setMenu(_menu);
_menuAction->setSoftKeyRole(QAction::PositiveSoftKey);
_hideAction->setSoftKeyRole(QAction::NegativeSoftKey);
connect(_textNotificationAction, SIGNAL(triggered()), _textNotificationWidget, SLOT(showMaximized()));
connect(_soundNotificationAction, SIGNAL(triggered()), _soundNotificationWidget, SLOT(showMaximized()));
connect(_timerSettingsAction, SIGNAL(triggered()), _timerSettingsWidget, SLOT(showMaximized()));
connect(_vibrationsOnAction, SIGNAL(triggered()), this, SLOT(VibrationsEnabled()));
connect(_vibrationsOffAction, SIGNAL(triggered()), this, SLOT(VibrationsEnabled()));
connect(_aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
connect(_quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
connect(_hideAction, SIGNAL(triggered()), this, SLOT(lower()));
_ui->about->setFocus();
#else
_ui->tabWidget->addTab(_textNotificationWidget, tr("Text notifications settings"));
_ui->tabWidget->addTab(_soundNotificationWidget, tr("Sound notification settigns"));
_ui->tabWidget->addTab(_timerSettingsWidget, tr("Timer settings"));
connect(_ui->quit, SIGNAL(clicked()), qApp, SLOT(quit()));
connect(_trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(TrayIconClicked()));
connect(_ui->startup, SIGNAL(toggled(bool)), this, SLOT(RunAtStartupEnabled(bool)));
connect(_ui->tray, SIGNAL(toggled(bool)), this, SLOT(RunInTrayEnabled(bool)));
_trayIcon->show();
#endif // Q_OS_SYMBIAN
connect(_textNotificationWidget, SIGNAL(ActivationChanged(bool)), this, SLOT(TextMessageActivationChanged(bool)));
connect(_textNotificationWidget, SIGNAL(TextMessageChanged(QString)), this, SLOT(TextMessageChanged(QString)));
connect(_textNotificationWidget, SIGNAL(MessageListChanged(QStringList&)), this, SLOT(MessageListChanged(QStringList&)));
connect(_textNotificationWidget, SIGNAL(ModeChanged(TextNotificationWidget::Mode)), this, SLOT(TextMessageModeChanged(TextNotificationWidget::Mode)));
connect(_soundNotificationWidget, SIGNAL(ActivationChanged(bool)), this, SLOT(SoundNotificationActivationChanged(bool)));
connect(_soundNotificationWidget, SIGNAL(FileNameChanged(QString)), this, SLOT(AudioFileNameChanged(QString)));
connect(_timerSettingsWidget, SIGNAL(ModeChanged(TimerSettingsWidget::Mode)), this, SLOT(TimerModeChanged(TimerSettingsWidget::Mode)));
connect(_timerSettingsWidget, SIGNAL(FixedIntervalChanged(int)), this, SLOT(FixedIntervalChanged(int)));
connect(_timerSettingsWidget, SIGNAL(RandomIntervalChanged(int,int)), this, SLOT(RandomIntervalChanged(int,int)));
connect(_timerSettingsWidget, SIGNAL(ModeChanged(TimerSettingsWidget::Mode)), this, SLOT(SetTimer()));
connect(_timerSettingsWidget, SIGNAL(FixedIntervalChanged(int)), this, SLOT(SetTimer()));
connect(_timerSettingsWidget, SIGNAL(RandomIntervalChanged(int,int)), this, SLOT(SetTimer()));
connect(_audioOutput, SIGNAL(volumeChanged(qreal)), this, SLOT(VolumeChanged(qreal)));
connect(_timer, SIGNAL(timeout()), this, SLOT(Alarm()));
Phonon::createPath(_player, _audioOutput);
SetTimer();
_soundNotificationWidget->SetAudioOutput(_audioOutput);
//.........这里部分代码省略.........