本文整理汇总了C++中QMenu::addAction方法的典型用法代码示例。如果您正苦于以下问题:C++ QMenu::addAction方法的具体用法?C++ QMenu::addAction怎么用?C++ QMenu::addAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMenu
的用法示例。
在下文中一共展示了QMenu::addAction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: metrics
IncrementalSearchBar::IncrementalSearchBar(QWidget* aParent)
: QWidget(aParent)
, _foundMatch(false)
, _searchEdit(0)
, _caseSensitive(0)
, _regExpression(0)
, _highlightMatches(0)
{
QHBoxLayout* barLayout = new QHBoxLayout(this);
QToolButton* closeButton = new QToolButton(this);
closeButton->setObjectName(QLatin1String("close-button"));
closeButton->setToolTip(i18n("Close the search bar"));
closeButton->setAutoRaise(true);
closeButton->setIcon(KIcon("dialog-close"));
connect(closeButton , SIGNAL(clicked()) , this , SIGNAL(closeClicked()));
QLabel* findLabel = new QLabel(i18n("Find:"), this);
_searchEdit = new KLineEdit(this);
_searchEdit->setClearButtonShown(true);
_searchEdit->installEventFilter(this);
_searchEdit->setObjectName(QLatin1String("search-edit"));
_searchEdit->setToolTip(i18n("Enter the text to search for here"));
// text box may be a minimum of 6 characters wide and a maximum of 10 characters wide
// (since the maxWidth metric is used here, more characters probably will fit in than 6
// and 10)
QFontMetrics metrics(_searchEdit->font());
int maxWidth = metrics.maxWidth();
_searchEdit->setMinimumWidth(maxWidth * 6);
_searchEdit->setMaximumWidth(maxWidth * 10);
_searchTimer = new QTimer(this);
_searchTimer->setInterval(250);
_searchTimer->setSingleShot(true);
connect(_searchTimer , SIGNAL(timeout()) , this , SLOT(notifySearchChanged()));
connect(_searchEdit , SIGNAL(clearButtonClicked()) , this , SLOT(clearLineEdit()));
connect(_searchEdit , SIGNAL(textChanged(QString)) , _searchTimer , SLOT(start()));
QToolButton* findNext = new QToolButton(this);
findNext->setObjectName(QLatin1String("find-next-button"));
findNext->setText(i18nc("@action:button Go to the next phrase", "Next"));
findNext->setIcon(KIcon("go-down-search"));
findNext->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
findNext->setToolTip(i18n("Find the next match for the current search phrase"));
connect(findNext , SIGNAL(clicked()) , this , SIGNAL(findNextClicked()));
QToolButton* findPrev = new QToolButton(this);
findPrev->setObjectName(QLatin1String("find-previous-button"));
findPrev->setText(i18nc("@action:button Go to the previous phrase", "Previous"));
findPrev->setIcon(KIcon("go-up-search"));
findPrev->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
findPrev->setToolTip(i18n("Find the previous match for the current search phrase"));
connect(findPrev , SIGNAL(clicked()) , this , SIGNAL(findPreviousClicked()));
QToolButton* optionsButton = new QToolButton(this);
optionsButton->setObjectName(QLatin1String("find-options-button"));
optionsButton->setText(i18nc("@action:button Display options menu", "Options"));
optionsButton->setCheckable(false);
optionsButton->setPopupMode(QToolButton::InstantPopup);
optionsButton->setArrowType(Qt::DownArrow);
optionsButton->setToolButtonStyle(Qt::ToolButtonTextOnly);
optionsButton->setToolTip(i18n("Display the options menu"));
barLayout->addWidget(closeButton);
barLayout->addWidget(findLabel);
barLayout->addWidget(_searchEdit);
barLayout->addWidget(findNext);
barLayout->addWidget(findPrev);
barLayout->addWidget(optionsButton);
// Fill the options menu
QMenu* optionsMenu = new QMenu(this);
optionsButton->setMenu(optionsMenu);
_caseSensitive = optionsMenu->addAction(i18n("Case sensitive"));
_caseSensitive->setCheckable(true);
_caseSensitive->setToolTip(i18n("Sets whether the search is case sensitive"));
connect(_caseSensitive, SIGNAL(toggled(bool)),
this, SIGNAL(matchCaseToggled(bool)));
_regExpression = optionsMenu->addAction(i18n("Match regular expression"));
_regExpression->setCheckable(true);
connect(_regExpression, SIGNAL(toggled(bool)),
this, SIGNAL(matchRegExpToggled(bool)));
_highlightMatches = optionsMenu->addAction(i18n("Highlight all matches"));
_highlightMatches->setCheckable(true);
_highlightMatches->setToolTip(i18n("Sets whether matching text should be highlighted"));
_highlightMatches->setChecked(true);
connect(_highlightMatches, SIGNAL(toggled(bool)),
this, SIGNAL(highlightMatchesToggled(bool)));
barLayout->addStretch();
barLayout->setContentsMargins(4, 4, 4, 4);
setLayout(barLayout);
}
示例2: ATopLevelWindow
MailEditorMainWindow::MailEditorMainWindow(ATopLevelWindowsContainer* parent, AddressBookModel& abModel,
IMailProcessor& mailProcessor, bool editMode) :
ATopLevelWindow(parent),
ui(new Ui::MailEditorWindow()),
ABModel(abModel),
MailProcessor(mailProcessor),
FontCombo(nullptr),
EditMode(editMode)
{
ui->setupUi(this);
/** Disable these toolbars by default. They should be showed up on demand, when given action will
be trigerred.
*/
ui->fileAttachementToolBar->hide();
ui->moneyAttachementToolBar->hide();
ui->editToolBar->hide();
ui->adjustToolbar->hide();
ui->formatToolBar->hide();
MoneyAttachement = new TMoneyAttachementWidget(ui->moneyAttachementToolBar);
ui->moneyAttachementToolBar->addWidget(MoneyAttachement);
FileAttachment = new TFileAttachmentWidget(ui->fileAttachementToolBar, editMode);
ui->fileAttachementToolBar->addWidget(FileAttachment);
MailFields = new MailFieldsWidget(*this, *ui->actionSend, abModel, editMode);
/// Initially only basic mail fields (To: and Subject:) should be visible
MailFields->showFromControls(false);
MailFields->showCcControls(false);
MailFields->showBccControls(false);
ui->mailFieldsToolBar->addWidget(MailFields);
connect(MailFields, SIGNAL(subjectChanged(QString)), this, SLOT(onSubjectChanged(QString)));
connect(MailFields, SIGNAL(recipientListChanged()), this, SLOT(onRecipientListChanged()));
connect(FileAttachment, SIGNAL(attachmentListChanged()), this, SLOT(onAttachmentListChanged()));
if(editMode)
{
/** Supplement definition of mailFieldSelectorToolbar since Qt Creator doesn't support putting
into its context dedicated controls (like preconfigured toolbutton).
Setup local menu for 'actionMailFields' toolButton (used to enable/disable additional mail
field selection).
*/
QMenu* mailFieldsMenu = new QMenu(this);
mailFieldsMenu->addAction(ui->actionFrom);
mailFieldsMenu->addAction(ui->actionCC);
mailFieldsMenu->addAction(ui->actionBCC);
ui->actionMailFields->setMenu(mailFieldsMenu);
ui->mainToolBar->insertAction(ui->actionShowFormatOptions, ui->actionMailFields);
}
setupEditorCommands();
ui->messageEdit->setFocus();
fontChanged(ui->messageEdit->font());
colorChanged(ui->messageEdit->textColor());
alignmentChanged(ui->messageEdit->alignment());
QString subject = MailFields->getSubject();
onSubjectChanged(subject);
/// Clear modified flag
ui->messageEdit->document()->setModified(false);
setWindowModified(ui->messageEdit->document()->isModified());
ui->actionSave->setEnabled(ui->messageEdit->document()->isModified());
ui->actionUndo->setEnabled(ui->messageEdit->document()->isUndoAvailable());
ui->actionRedo->setEnabled(ui->messageEdit->document()->isRedoAvailable());
/// Setup command update ui related to 'save' option activity control and window modify marker.
connect(ui->messageEdit->document(), SIGNAL(modificationChanged(bool)), ui->actionSave,
SLOT(setEnabled(bool)));
connect(ui->messageEdit->document(), SIGNAL(modificationChanged(bool)), this,
SLOT(setWindowModified(bool)));
#ifndef QT_NO_CLIPBOARD
connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(onClipboardDataChanged()));
#endif
toggleReadOnlyMode();
}
示例3: eventFilter
bool HelpIndexView::eventFilter(QObject *obj, QEvent *e)
{
if (obj == m_SearchLineEdit && e->type() == QEvent::KeyPress)
{
QKeyEvent *ke = static_cast<QKeyEvent*>(e);
QModelIndex idx = m_IndexWidget->currentIndex();
switch (ke->key())
{
case Qt::Key_Up:
idx = m_IndexWidget->model()->index(idx.row()-1,
idx.column(), idx.parent());
if (idx.isValid())
{
m_IndexWidget->setCurrentIndex(idx);
return true;
}
break;
case Qt::Key_Down:
idx = m_IndexWidget->model()->index(idx.row()+1,
idx.column(), idx.parent());
if (idx.isValid())
{
m_IndexWidget->setCurrentIndex(idx);
return true;
}
break;
default: ; // stop complaining
}
}
else if (obj == m_IndexWidget && e->type() == QEvent::ContextMenu)
{
QContextMenuEvent *ctxtEvent = static_cast<QContextMenuEvent*>(e);
QModelIndex idx = m_IndexWidget->indexAt(ctxtEvent->pos());
if (idx.isValid())
{
QMenu menu;
QAction *curTab = menu.addAction(tr("Open Link"));
QAction *newTab = menu.addAction(tr("Open Link in New Tab"));
menu.move(m_IndexWidget->mapToGlobal(ctxtEvent->pos()));
QAction *action = menu.exec();
if (curTab == action)
m_IndexWidget->activateCurrentItem();
else if (newTab == action)
{
open(m_IndexWidget, idx);
}
}
}
else if (m_IndexWidget && obj == m_IndexWidget->viewport()
&& e->type() == QEvent::MouseButtonRelease)
{
QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(e);
QModelIndex idx = m_IndexWidget->indexAt(mouseEvent->pos());
if (idx.isValid())
{
Qt::MouseButtons button = mouseEvent->button();
if (((button == Qt::LeftButton) && (mouseEvent->modifiers() & Qt::ControlModifier))
|| (button == Qt::MidButton))
{
open(m_IndexWidget, idx);
}
}
}
#ifdef Q_OS_MAC
else if (obj == m_IndexWidget && e->type() == QEvent::KeyPress)
{
QKeyEvent *ke = static_cast<QKeyEvent*>(e);
if (ke->key() == Qt::Key_Return || ke->key() == Qt::Key_Enter)
m_IndexWidget->activateCurrentItem();
}
#endif
return QObject::eventFilter(obj, e);
}
示例4: createElements
void MainWindow::createElements()
{
QMenu *fileMenu = new QMenu(tr("&File"), this);
menuBar()->addMenu(fileMenu);
QMenu *viewMenu = new QMenu(tr("&View"), this);
menuBar()->addMenu(viewMenu);
QMenu *selectMenu = new QMenu(tr("&Selection"), this);
menuBar()->addMenu(selectMenu);
QMenu *helpMenu = new QMenu(tr("&Help"), this);
menuBar()->addMenu(helpMenu);
QAction *openAct = new QAction(tr("&Open..."), this);
openAct->setShortcut(tr("Ctrl+O"));
connect(openAct, SIGNAL(triggered()), this, SLOT(open()));
fileMenu->addAction(openAct);
QAction *exitAct = new QAction(tr("E&xit"), this);
exitAct->setShortcut(tr("Ctrl+Q"));
connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
fileMenu->addAction(exitAct);
QAction *zoomInAct = new QAction(tr("Zoom &In (25%)"), this);
zoomInAct->setShortcut(tr("Ctrl++"));
connect(zoomInAct, SIGNAL(triggered()), this, SLOT(zoomIn()));
viewMenu->addAction(zoomInAct);
QAction *zoomOutAct = new QAction(tr("Zoom &Out (25%)"), this);
zoomOutAct->setShortcut(tr("Ctrl+-"));
connect(zoomOutAct, SIGNAL(triggered()), this, SLOT(zoomOut()));
viewMenu->addAction(zoomOutAct);
QAction *normalSizeAct = new QAction(tr("&Normal Size"), this);
normalSizeAct->setShortcut(tr("Ctrl+0"));
connect(normalSizeAct, SIGNAL(triggered()), this, SLOT(normalSize()));
viewMenu->addAction(normalSizeAct);
QAction *flipSectAct = new QAction(tr("&Show/Hide Section"), this);
flipSectAct->setShortcut(tr("Ctrl+J"));
connect(flipSectAct, SIGNAL(triggered()), this, SLOT(flipSectWin()));
viewMenu->addAction(flipSectAct);
QAction *flipSpecAct = new QAction(tr("&Show/Hide Spectrum"), this);
flipSpecAct->setShortcut(tr("Ctrl+K"));
connect(flipSpecAct, SIGNAL(triggered()), this, SLOT(flipSpecWin()));
viewMenu->addAction(flipSpecAct);
QAction *flipMainOptAct = new QAction(tr("&Show/Hide Image Viewer Options"), this);
flipMainOptAct->setShortcut(tr("Ctrl+L"));
connect(flipMainOptAct, SIGNAL(triggered()), this, SLOT(flipMainOpt()));
viewMenu->addAction(flipMainOptAct);
QAction *flipSectOptAct = new QAction(tr("&Show/Hide Section Viewer Options"), this);
flipSectOptAct->setShortcut(tr("Ctrl+L"));
connect(flipSectOptAct, SIGNAL(triggered()), this, SLOT(flipSectOpt()));
viewMenu->addAction(flipSectOptAct);
QAction *popAct = new QAction(tr("&Delete Last Point"), this);
popAct->setShortcut(tr("Ctrl+N"));
connect(popAct, SIGNAL(triggered()), this, SLOT(popPoint()));
selectMenu->addAction(popAct);
QAction *clearAct = new QAction(tr("&Delete All Points"), this);
clearAct->setShortcut(tr("Ctrl+M"));
connect(clearAct, SIGNAL(triggered()), this, SLOT(clearPoints()));
selectMenu->addAction(clearAct);
QAction *aboutAct = new QAction(tr("&About"), this);
connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));
helpMenu->addAction(aboutAct);
connect(m_maincan, SIGNAL(sample()), this, SLOT(sample()));
connect(m_maincan, SIGNAL(moved(float, float)), this, SLOT(showMainPixel(float, float)));
connect(m_sectwin, SIGNAL(moved(float, float)), this, SLOT(mapSect(float, float)));
}
示例5: QMainWindow
QgsComposer::QgsComposer( QgisApp *qgis, const QString& title )
: QMainWindow()
, mTitle( title )
, mUndoView( 0 )
{
setupUi( this );
setWindowTitle( mTitle );
setupTheme();
connect( mButtonBox, SIGNAL( rejected() ), this, SLOT( close() ) );
QSettings settings;
int size = settings.value( "/IconSize", QGIS_ICON_SIZE ).toInt();
setIconSize( QSize( size, size ) );
#ifndef Q_WS_MAC
setFontSize( settings.value( "/fontPointSize", QGIS_DEFAULT_FONTSIZE ).toInt() );
#endif
QToolButton* orderingToolButton = new QToolButton( this );
orderingToolButton->setPopupMode( QToolButton::InstantPopup );
orderingToolButton->setAutoRaise( true );
orderingToolButton->setToolButtonStyle( Qt::ToolButtonIconOnly );
orderingToolButton->addAction( mActionRaiseItems );
orderingToolButton->addAction( mActionLowerItems );
orderingToolButton->addAction( mActionMoveItemsToTop );
orderingToolButton->addAction( mActionMoveItemsToBottom );
orderingToolButton->setDefaultAction( mActionRaiseItems );
toolBar->addWidget( orderingToolButton );
QToolButton* alignToolButton = new QToolButton( this );
alignToolButton->setPopupMode( QToolButton::InstantPopup );
alignToolButton->setAutoRaise( true );
alignToolButton->setToolButtonStyle( Qt::ToolButtonIconOnly );
alignToolButton->addAction( mActionAlignLeft );
alignToolButton->addAction( mActionAlignHCenter );
alignToolButton->addAction( mActionAlignRight );
alignToolButton->addAction( mActionAlignTop );
alignToolButton->addAction( mActionAlignVCenter );
alignToolButton->addAction( mActionAlignBottom );
alignToolButton->setDefaultAction( mActionAlignLeft );
toolBar->addWidget( alignToolButton );
QToolButton* shapeToolButton = new QToolButton( toolBar );
shapeToolButton->setCheckable( true );
shapeToolButton->setPopupMode( QToolButton::InstantPopup );
shapeToolButton->setAutoRaise( true );
shapeToolButton->setToolButtonStyle( Qt::ToolButtonIconOnly );
shapeToolButton->addAction( mActionAddRectangle );
shapeToolButton->addAction( mActionAddTriangle );
shapeToolButton->addAction( mActionAddEllipse );
shapeToolButton->setDefaultAction( mActionAddEllipse );
toolBar->insertWidget( mActionAddArrow, shapeToolButton );
QActionGroup* toggleActionGroup = new QActionGroup( this );
toggleActionGroup->addAction( mActionMoveItemContent );
toggleActionGroup->addAction( mActionAddNewMap );
toggleActionGroup->addAction( mActionAddNewLabel );
toggleActionGroup->addAction( mActionAddNewLegend );
toggleActionGroup->addAction( mActionAddNewScalebar );
toggleActionGroup->addAction( mActionAddImage );
toggleActionGroup->addAction( mActionSelectMoveItem );
toggleActionGroup->addAction( mActionAddRectangle );
toggleActionGroup->addAction( mActionAddTriangle );
toggleActionGroup->addAction( mActionAddEllipse );
toggleActionGroup->addAction( mActionAddArrow );
toggleActionGroup->addAction( mActionAddTable );
toggleActionGroup->setExclusive( true );
mActionAddNewMap->setCheckable( true );
mActionAddNewLabel->setCheckable( true );
mActionAddNewLegend->setCheckable( true );
mActionSelectMoveItem->setCheckable( true );
mActionAddNewScalebar->setCheckable( true );
mActionAddImage->setCheckable( true );
mActionMoveItemContent->setCheckable( true );
mActionAddArrow->setCheckable( true );
#ifdef Q_WS_MAC
QMenu *appMenu = menuBar()->addMenu( tr( "QGIS" ) );
appMenu->addAction( QgisApp::instance()->actionAbout() );
appMenu->addAction( QgisApp::instance()->actionOptions() );
#endif
QMenu *fileMenu = menuBar()->addMenu( tr( "File" ) );
fileMenu->addAction( mActionLoadFromTemplate );
fileMenu->addAction( mActionSaveAsTemplate );
fileMenu->addSeparator();
fileMenu->addAction( mActionExportAsImage );
fileMenu->addAction( mActionExportAsPDF );
fileMenu->addAction( mActionExportAsSVG );
fileMenu->addSeparator();
fileMenu->addAction( mActionPageSetup );
fileMenu->addAction( mActionPrint );
fileMenu->addSeparator();
fileMenu->addAction( mActionQuit );
QObject::connect( mActionQuit, SIGNAL( triggered() ), this, SLOT( close() ) );
QMenu *viewMenu = menuBar()->addMenu( tr( "View" ) );
//.........这里部分代码省略.........
示例6: idx
void
ChartView::selected( const QRectF& rc )
{
QMenu menu;
double x0 = this->transform( QwtPlot::xBottom, rc.left() );
double x1 = this->transform( QwtPlot::xBottom, rc.right() );
bool hasRange = int( std::abs( x1 - x0 ) ) > 2;
int idx(0);
if ( auto action = menu.addAction( tr( "Unzoom" ) ) ) {
action->setData( idx++ ); // 0
action->setEnabled( !hasRange );
}
if ( auto action = menu.addAction( tr( "Copy x-coordinate" ) ) ) {
action->setData( idx++ ); // 1
action->setEnabled( !hasRange );
}
if ( auto action = menu.addAction( tr( "Copy x,y-coordinate" ) ) ) {
action->setData( idx++ ); // 2
action->setEnabled( !hasRange );
}
menu.addAction( tr( "Copy image" ) )->setData( idx++ ); // 3
menu.addAction( tr( "Copy SVG" ) )->setData( idx++ ); // 4
menu.addAction( tr( "Save as SVG File..." ) )->setData( idx++ ); // 5
if ( auto zoomer = findChild< adplot::Zoomer * >() ) {
auto action = menu.addAction( tr( "Auto Y-Scale" ) );
action->setData( idx++ ); // 6
action->setCheckable( true );
action->setChecked( zoomer->autoYScale() );
}
if ( auto action = menu.addAction( tr( "y-zoom" ) ) ) {
action->setData( idx++ ); // 7
action->setEnabled( hasRange );
}
if ( auto action = menu.addAction( tr( "Add time range to query" ) ) ) {
action->setData( idx++ ); // 8
action->setEnabled( hasRange );
}
if ( auto action = menu.addAction( tr( "Show query ranges" ) ) ) {
action->setData( idx++ ); // 9
}
QPointF pos = QPointF( rc.left(), rc.top() );
if ( auto selected = menu.exec( QCursor::pos() ) ) {
switch ( selected->data().toInt() ) {
case 0:
if ( auto zoomer = findChild< QwtPlotZoomer * >() )
zoomer->setZoomStack( zoomer->zoomStack(), 0 );
break;
case 1:
QApplication::clipboard()->setText( QString::number( pos.x(), 'g', 14 ) );
break;
case 2:
QApplication::clipboard()->setText( QString( "%1, %2" ).arg( QString::number( pos.x(), 'g', 14 )
, QString::number( pos.y(), 'g', 14 ) ) );
break;
case 3:
copyToClipboard();
break;
case 4:
saveImage( true );
break;
case 5:
saveImage( false );
break;
case 6:
findChild< adplot::Zoomer * >()->autoYScale( selected->isChecked() );
break;
case 7:
yZoom( rc );
break;
case 8:
emit makeQuery( "COUNTING", rc, bool( axisTitle( QwtPlot::xBottom ).text().contains( "m/z" ) ) );
break;
case 9:
emit makeQuery( "", rc, false ); // show
break;
}
}
}
示例7: GetTabMenu
QMenu* SeparateTabWidget::GetTabMenu (int index)
{
QMenu *menu = new QMenu ();
const auto widget = Widget (index);
const auto imtw = qobject_cast<ITabWidget*> (widget);
if (XmlSettingsManager::Instance ()->
property ("ShowPluginMenuInTabs").toBool ())
{
bool asSub = XmlSettingsManager::Instance ()->
property ("ShowPluginMenuInTabsAsSubmenu").toBool ();
if (imtw)
{
const auto& tabActions = imtw->GetTabBarContextMenuActions ();
QMenu *subMenu = asSub ?
new QMenu (TabText (index), menu) :
nullptr;
for (auto act : tabActions)
(asSub ? subMenu : menu)->addAction (act);
if (asSub)
menu->addMenu (subMenu);
if (tabActions.size ())
menu->addSeparator ();
}
}
auto rootWM = Core::Instance ().GetRootWindowsManager ();
const int windowIndex = rootWM->GetWindowIndex (Window_);
auto moveMenu = menu->addMenu (tr ("Move tab to"));
auto toNew = moveMenu->addAction (tr ("New window"),
rootWM, SLOT (moveTabToNewWindow ()));
toNew->setProperty ("TabIndex", index);
toNew->setProperty ("FromWindowIndex", windowIndex);
if (rootWM->GetWindowsCount () > 1)
{
moveMenu->addSeparator ();
for (int i = 0; i < rootWM->GetWindowsCount (); ++i)
{
auto thatWin = rootWM->GetMainWindow (i);
if (thatWin == Window_)
continue;
const auto& actTitle = tr ("To window %1 (%2)")
.arg (i + 1)
.arg (thatWin->windowTitle ());
auto toExisting = moveMenu->addAction (actTitle,
rootWM, SLOT (moveTabToExistingWindow ()));
toExisting->setProperty ("TabIndex", index);
toExisting->setProperty ("FromWindowIndex", windowIndex);
toExisting->setProperty ("ToWindowIndex", i);
}
}
const auto irt = qobject_cast<IRecoverableTab*> (widget);
if (imtw &&
irt &&
(imtw->GetTabClassInfo ().Features_ & TabFeature::TFOpenableByRequest) &&
!(imtw->GetTabClassInfo ().Features_ & TabFeature::TFSingle))
{
const auto cloneAct = menu->addAction (tr ("Clone tab"),
this, SLOT (handleCloneTab ()));
cloneAct->setProperty ("TabIndex", index);
cloneAct->setProperty ("ActionIcon", "tab-duplicate");
}
for (auto act : TabBarActions_)
{
if (!act)
{
qWarning () << Q_FUNC_INFO
<< "detected null pointer";
continue;
}
menu->addAction (act);
}
Util::DefaultHookProxy_ptr proxy (new Util::DefaultHookProxy);
emit hookTabContextMenuFill (proxy, menu, index,
Core::Instance ().GetRootWindowsManager ()->GetWindowIndex (Window_));
return menu;
}
示例8: palette
XmlConsole::XmlConsole(Client* client, QWidget *parent) :
QWidget(parent),
m_ui(new Ui::XmlConsole),
m_client(client), m_filter(0x1f)
{
m_ui->setupUi(this);
m_client->addXmlStreamHandler(this);
QPalette pal = palette();
pal.setColor(QPalette::Base, Qt::black);
pal.setColor(QPalette::Text, Qt::white);
m_ui->xmlBrowser->viewport()->setPalette(pal);
QTextDocument *doc = m_ui->xmlBrowser->document();
doc->setDocumentLayout(new QPlainTextDocumentLayout(doc));
doc->clear();
QTextFrameFormat format = doc->rootFrame()->frameFormat();
format.setBackground(QColor(Qt::black));
format.setMargin(0);
doc->rootFrame()->setFrameFormat(format);
QMenu *menu = new QMenu(m_ui->filterButton);
menu->setSeparatorsCollapsible(false);
menu->addSeparator()->setText(tr("Filter"));
QActionGroup *group = new QActionGroup(menu);
QAction *disabled = group->addAction(menu->addAction(tr("Disabled")));
disabled->setCheckable(true);
disabled->setData(Disabled);
QAction *jid = group->addAction(menu->addAction(tr("By JID")));
jid->setCheckable(true);
jid->setData(ByJid);
QAction *xmlns = group->addAction(menu->addAction(tr("By namespace uri")));
xmlns->setCheckable(true);
xmlns->setData(ByXmlns);
QAction *attrb = group->addAction(menu->addAction(tr("By all attributes")));
attrb->setCheckable(true);
attrb->setData(ByAllAttributes);
disabled->setChecked(true);
connect(group, SIGNAL(triggered(QAction*)), this, SLOT(onActionGroupTriggered(QAction*)));
menu->addSeparator()->setText(tr("Visible stanzas"));
group = new QActionGroup(menu);
group->setExclusive(false);
QAction *iq = group->addAction(menu->addAction(tr("Information query")));
iq->setCheckable(true);
iq->setData(XmlNode::Iq);
iq->setChecked(true);
QAction *message = group->addAction(menu->addAction(tr("Message")));
message->setCheckable(true);
message->setData(XmlNode::Message);
message->setChecked(true);
QAction *presence = group->addAction(menu->addAction(tr("Presence")));
presence->setCheckable(true);
presence->setData(XmlNode::Presence);
presence->setChecked(true);
QAction *custom = group->addAction(menu->addAction(tr("Custom")));
custom->setCheckable(true);
custom->setData(XmlNode::Custom);
custom->setChecked(true);
connect(group, SIGNAL(triggered(QAction*)), this, SLOT(onActionGroupTriggered(QAction*)));
m_ui->filterButton->setMenu(menu);
m_stackBracketsColor = QColor(0x666666);
m_stackIncoming.bodyColor = QColor(0xbb66bb);
m_stackIncoming.tagColor = QColor(0x006666);
m_stackIncoming.attributeColor = QColor(0x009933);
m_stackIncoming.paramColor = QColor(0xcc0000);
m_stackOutgoing.bodyColor = QColor(0x999999);
m_stackOutgoing.tagColor = QColor(0x22aa22);
m_stackOutgoing.attributeColor = QColor(0xffff33);
m_stackOutgoing.paramColor = QColor(0xdd8811);
QAction *action = new QAction(tr("Close"),this);
action->setSoftKeyRole(QAction::NegativeSoftKey);
connect(action, SIGNAL(triggered()), SLOT(close()));
addAction(action);
}
示例9: createMenuBar
void BitcoinGUI::createMenuBar()
{
#ifdef Q_OS_MAC
// Create a decoupled menu bar on Mac which stays even if the window is closed
appMenuBar = new QMenuBar();
#else
// Get the main window's menu bar on other platforms
appMenuBar = menuBar();
#endif
// Configure the menus
QMenu *file = appMenuBar->addMenu(tr("&File"));
if(walletFrame)
{
file->addAction(openAction);
file->addAction(backupWalletAction);
file->addAction(signMessageAction);
file->addAction(verifyMessageAction);
file->addSeparator();
file->addAction(usedSendingAddressesAction);
file->addAction(usedReceivingAddressesAction);
file->addSeparator();
}
file->addAction(quitAction);
QMenu *settings = appMenuBar->addMenu(tr("&Settings"));
if(walletFrame)
{
settings->addAction(encryptWalletAction);
settings->addAction(changePassphraseAction);
settings->addSeparator();
}
settings->addAction(optionsAction);
QMenu *help = appMenuBar->addMenu(tr("&Help"));
if(walletFrame)
{
help->addAction(openRPCConsoleAction);
}
help->addAction(showHelpMessageAction);
help->addSeparator();
help->addAction(aboutAction);
help->addAction(aboutQtAction);
}
示例10: JsInterface
MainWindow::MainWindow(const QUrl& url) : m_dongle(new mobot_t)
{
progress = 0;
QFile file;
file.setFileName(":/jquery.min.js");
file.open(QIODevice::ReadOnly);
jQuery = file.readAll();
jQuery.append("\nvar qt = { 'jQuery': jQuery.noConflict(true) };");
file.close();
//! [1]
QNetworkProxyFactory::setUseSystemConfiguration(true);
m_interface = new JsInterface(this);
//! [2]
view = new QWebView(this);
view->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
view->load(url);
connect(view, SIGNAL(loadFinished(bool)), SLOT(adjustLocation()));
connect(view, SIGNAL(titleChanged(QString)), SLOT(adjustTitle()));
connect(view, SIGNAL(loadProgress(int)), SLOT(setProgress(int)));
connect(view, SIGNAL(loadFinished(bool)), SLOT(finishLoading(bool)));
connect(view->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()),
this, SLOT(populateJavaScriptWindowObject()));
locationEdit = new QLineEdit(this);
locationEdit->setSizePolicy(QSizePolicy::Expanding, locationEdit->sizePolicy().verticalPolicy());
connect(locationEdit, SIGNAL(returnPressed()), SLOT(changeLocation()));
QToolBar *toolBar = addToolBar(tr("Navigation"));
toolBar->addAction(view->pageAction(QWebPage::Back));
toolBar->addAction(view->pageAction(QWebPage::Forward));
toolBar->addAction(view->pageAction(QWebPage::Reload));
toolBar->addAction(view->pageAction(QWebPage::Stop));
toolBar->addWidget(locationEdit);
//! [2]
QMenu *viewMenu = menuBar()->addMenu(tr("&View"));
QAction* viewSourceAction = new QAction("Page Source", this);
connect(viewSourceAction, SIGNAL(triggered()), SLOT(viewSource()));
viewMenu->addAction(viewSourceAction);
//! [3]
QMenu *effectMenu = menuBar()->addMenu(tr("&Effect"));
effectMenu->addAction("Highlight all links", this, SLOT(highlightAllLinks()));
rotateAction = new QAction(this);
rotateAction->setIcon(style()->standardIcon(QStyle::SP_FileDialogDetailedView));
rotateAction->setCheckable(true);
rotateAction->setText(tr("Turn images upside down"));
connect(rotateAction, SIGNAL(toggled(bool)), this, SLOT(rotateImages(bool)));
effectMenu->addAction(rotateAction);
QMenu *toolsMenu = menuBar()->addMenu(tr("&Tools"));
toolsMenu->addAction(tr("Remove GIF images"), this, SLOT(removeGifImages()));
toolsMenu->addAction(tr("Remove all inline frames"), this, SLOT(removeInlineFrames()));
toolsMenu->addAction(tr("Remove all object elements"), this, SLOT(removeObjectElements()));
toolsMenu->addAction(tr("Remove all embedded elements"), this, SLOT(removeEmbeddedElements()));
setCentralWidget(view);
setUnifiedTitleAndToolBarOnMac(true);
baroboInit();
qDebug() << "App path : " << qApp->applicationDirPath();
}
示例11: QDialog
QgsStyleV2ManagerDialog::QgsStyleV2ManagerDialog( QgsStyleV2* style, QWidget* parent )
: QDialog( parent ), mStyle( style ), mModified( false )
{
setupUi( this );
#ifdef Q_WS_MAC
setWindowModality( Qt::WindowModal );
#endif
QSettings settings;
restoreGeometry( settings.value( "/Windows/StyleV2Manager/geometry" ).toByteArray() );
mSplitter->setSizes( QList<int>() << 170 << 540 );
mSplitter->restoreState( settings.value( "/Windows/StyleV2Manager/splitter" ).toByteArray() );
tabItemType->setDocumentMode( true );
searchBox->setPlaceholderText( tr( "Type here to filter symbols..." ) );
// setup icons
btnAddItem->setIcon( QIcon( QgsApplication::iconPath( "symbologyAdd.png" ) ) );
btnEditItem->setIcon( QIcon( QgsApplication::iconPath( "symbologyEdit.png" ) ) );
btnRemoveItem->setIcon( QIcon( QgsApplication::iconPath( "symbologyRemove.png" ) ) );
btnShare->setIcon( QIcon( QgsApplication::iconPath( "user.png" ) ) );
connect( this, SIGNAL( finished( int ) ), this, SLOT( onFinished() ) );
connect( listItems, SIGNAL( doubleClicked( const QModelIndex & ) ), this, SLOT( editItem() ) );
connect( btnAddItem, SIGNAL( clicked() ), this, SLOT( addItem() ) );
connect( btnEditItem, SIGNAL( clicked() ), this, SLOT( editItem() ) );
connect( btnRemoveItem, SIGNAL( clicked() ), this, SLOT( removeItem() ) );
QMenu *shareMenu = new QMenu( tr( "Share Menu" ), this );
QAction *exportAction = shareMenu->addAction( tr( "Export" ) );
QAction *importAction = shareMenu->addAction( tr( "Import" ) );
connect( exportAction, SIGNAL( triggered() ), this, SLOT( exportItems() ) );
connect( importAction, SIGNAL( triggered() ), this, SLOT( importItems() ) );
btnShare->setMenu( shareMenu );
// Set editing mode off by default
mGrouppingMode = false;
QStandardItemModel* model = new QStandardItemModel( listItems );
listItems->setModel( model );
listItems->setSelectionMode( QAbstractItemView::ExtendedSelection );
connect( model, SIGNAL( itemChanged( QStandardItem* ) ), this, SLOT( itemChanged( QStandardItem* ) ) );
connect( listItems->selectionModel(), SIGNAL( currentChanged( const QModelIndex&, const QModelIndex& ) ),
this, SLOT( symbolSelected( const QModelIndex& ) ) );
populateTypes();
QStandardItemModel* groupModel = new QStandardItemModel( groupTree );
groupTree->setModel( groupModel );
groupTree->setHeaderHidden( true );
populateGroups();
connect( groupTree->selectionModel(), SIGNAL( currentChanged( const QModelIndex&, const QModelIndex& ) ),
this, SLOT( groupChanged( const QModelIndex& ) ) );
connect( groupModel, SIGNAL( itemChanged( QStandardItem* ) ),
this, SLOT( groupRenamed( QStandardItem* ) ) );
QMenu *groupMenu = new QMenu( tr( "Group Actions" ), this );
QAction *groupSymbols = groupMenu->addAction( tr( "Group Symbols" ) );
QAction *editSmartgroup = groupMenu->addAction( tr( "Edit Smart Group" ) );
btnManageGroups->setMenu( groupMenu );
connect( groupSymbols, SIGNAL( triggered() ), this, SLOT( groupSymbolsAction() ) );
connect( editSmartgroup, SIGNAL( triggered() ), this, SLOT( editSmartgroupAction() ) );
connect( btnAddGroup, SIGNAL( clicked() ), this, SLOT( addGroup() ) );
connect( btnRemoveGroup, SIGNAL( clicked() ), this, SLOT( removeGroup() ) );
on_tabItemType_currentChanged( 0 );
connect( searchBox, SIGNAL( textChanged( QString ) ), this, SLOT( filterSymbols( QString ) ) );
tagsLineEdit->installEventFilter( this );
// Context menu for groupTree
groupTree->setContextMenuPolicy( Qt::CustomContextMenu );
connect( groupTree, SIGNAL( customContextMenuRequested( const QPoint& ) ),
this, SLOT( grouptreeContextMenu( const QPoint& ) ) );
// Context menu for listItems
listItems->setContextMenuPolicy( Qt::CustomContextMenu );
connect( listItems, SIGNAL( customContextMenuRequested( const QPoint& ) ),
this, SLOT( listitemsContextMenu( const QPoint& ) ) );
}
示例12: setupUi
void setupUi(QMainWindow *MainWindow)
{
if (MainWindow->objectName().isEmpty())
MainWindow->setObjectName(QString::fromUtf8("MainWindow"));
MainWindow->resize(999, 913);
actionAbout = new QAction(MainWindow);
actionAbout->setObjectName(QString::fromUtf8("actionAbout"));
actionAtlas = new QAction(MainWindow);
actionAtlas->setObjectName(QString::fromUtf8("actionAtlas"));
actionMapping = new QAction(MainWindow);
actionMapping->setObjectName(QString::fromUtf8("actionMapping"));
actionLibrary = new QAction(MainWindow);
actionLibrary->setObjectName(QString::fromUtf8("actionLibrary"));
actionToolbox = new QAction(MainWindow);
actionToolbox->setObjectName(QString::fromUtf8("actionToolbox"));
centralwidget = new QWidget(MainWindow);
centralwidget->setObjectName(QString::fromUtf8("centralwidget"));
gridLayout = new QGridLayout(centralwidget);
gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
mainSizer = new QGridLayout();
mainSizer->setObjectName(QString::fromUtf8("mainSizer"));
mainSizer->setVerticalSpacing(14);
mainSizer->setContentsMargins(0, -1, -1, -1);
renderFrame = new QFrame(centralwidget);
renderFrame->setObjectName(QString::fromUtf8("renderFrame"));
renderFrame->setMinimumSize(QSize(800, 600));
renderFrame->setFrameShape(QFrame::Box);
renderFrame->setFrameShadow(QFrame::Raised);
mainSizer->addWidget(renderFrame, 0, 0, 1, 1);
gridLayout->addLayout(mainSizer, 0, 0, 1, 1);
MainWindow->setCentralWidget(centralwidget);
menubar = new QMenuBar(MainWindow);
menubar->setObjectName(QString::fromUtf8("menubar"));
menubar->setGeometry(QRect(0, 0, 999, 21));
menuFile = new QMenu(menubar);
menuFile->setObjectName(QString::fromUtf8("menuFile"));
menuTools = new QMenu(menubar);
menuTools->setObjectName(QString::fromUtf8("menuTools"));
menuAbout = new QMenu(menubar);
menuAbout->setObjectName(QString::fromUtf8("menuAbout"));
menuWindows = new QMenu(menubar);
menuWindows->setObjectName(QString::fromUtf8("menuWindows"));
MainWindow->setMenuBar(menubar);
statusbar = new QStatusBar(MainWindow);
statusbar->setObjectName(QString::fromUtf8("statusbar"));
MainWindow->setStatusBar(statusbar);
menubar->addAction(menuFile->menuAction());
menubar->addAction(menuTools->menuAction());
menubar->addAction(menuWindows->menuAction());
menubar->addAction(menuAbout->menuAction());
menuTools->addAction(actionAtlas);
menuTools->addAction(actionMapping);
menuAbout->addAction(actionAbout);
menuWindows->addAction(actionLibrary);
menuWindows->addAction(actionToolbox);
retranslateUi(MainWindow);
QMetaObject::connectSlotsByName(MainWindow);
} // setupUi
示例13: showPopup
void DataTreeView::showPopup(const QPoint & pos)
{
DataTreeViewItem * item = 0 ;
auto items = selectedItems ();
if(items.count() == 0)
return;
QMenu menu(this);
QMenu addMenu(this);
vector<Action*> actions;
if(items.count() == 1)
{
item = static_cast<DataTreeViewItem*>(items.back());
uint guid = item->getGuid();
serialization::Node* pNode = m_pDataBase->getNode(guid);
if(pNode == nullptr)
{
const phantom::data& d = m_pDataBase->getData(guid);
reflection::Class* pClass = d.type()->asClass();
const phantom::data& owner = m_pDataBase->getComponentDataOwner(d);
if(owner.isNull())
{
// Data directly removed from a Node
//menu.addAction(new RemoveDataAction(&menu, m_pDataBase->getNode(d), d));
}
else
{
// Data first removed from its owner
o_assert(owner.type()->asClass());
}
// Display/Hide action
/*if (d.type()->isKindOf(phantom::typeOf<physic::CollisionShape>()))
{
menu.addAction(new DisplayDataAction(&menu, d, this));
menu.addAction(new HideDataAction(&menu, d, this));
}*/
}
else
{
if(pNode->getState() == serialization::Node::e_Loaded)
{
addMenu.setTitle("add");
addMenu.setIcon(QIcon("resources/icons/famfamfam/add.png"));
menu.addMenu(&addMenu);
Action* pAction = o_new(AddNodeAction)(this, pNode, m_AddNodeActionDelegate, this);
addMenu.addAction(pAction);
actions.push_back(pAction);
if(pNode != m_pDataBase->rootNode())
{
addMenu.addSeparator();
for(auto it = phantom::beginModules(); it != phantom::endModules(); ++it)
{
reflection::Module* pModule = it->second;
for(auto it = pModule->beginPackages(); it != pModule->endPackages(); ++it)
{
QMenu* packageMenu = new QMenu;
reflection::Package* pPackage = *it;
for(auto it = pPackage->beginSources(); it != pPackage->endSources(); ++it)
{
reflection::Source* pSource = *it;
for(auto it = pSource->beginElements(); it != pSource->endElements(); ++it)
{
packageMenu->setTitle(pPackage->getName().c_str());
reflection::Class* pClass = (*it)->asClass();
if(pClass
AND pClass->isPublic()
AND NOT(pClass->testModifiers(o_private_visibility))
AND NOT(pClass->isAbstract())
AND pClass->isDefaultConstructible()
AND pClass->getSingleton() == nullptr)
{
Action* pAction = o_new(AddDataAction)(this, pNode, pClass, m_AddDataActionDelegate, packageMenu);
packageMenu->addAction(pAction);
actions.push_back(pAction);
}
}
}
if(!packageMenu->isEmpty())
{
addMenu.addMenu(packageMenu);
}
}
}
menu.addSeparator();
if(pNode->getParentNode()) // If it's not the root node
{
Action* pAction = o_new(UnloadNodeAction)(this, pNode, m_UnloadNodeActionDelegate, &menu);
menu.addAction(pAction);
actions.push_back(pAction);
}
}
}
else if(pNode->getState() == serialization::Node::e_Unloaded)
{
Action* pAction = o_new(LoadNodeAction)(this, pNode, m_LoadNodeActionDelegate, &menu);
//.........这里部分代码省略.........
示例14: 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);
示例15: ui_companion_qt_init
static void* ui_companion_qt_init(void)
{
ui_companion_qt_t *handle = (ui_companion_qt_t*)calloc(1, sizeof(*handle));
MainWindow *mainwindow = NULL;
QHBoxLayout *browserButtonsHBoxLayout = NULL;
QVBoxLayout *layout = NULL;
QVBoxLayout *launchWithWidgetLayout = NULL;
QHBoxLayout *coreComboBoxLayout = NULL;
QMenuBar *menu = NULL;
QDesktopWidget *desktop = NULL;
QMenu *fileMenu = NULL;
QMenu *editMenu = NULL;
QMenu *viewMenu = NULL;
QMenu *viewClosedDocksMenu = NULL;
QMenu *toolsMenu = NULL;
QMenu *updaterMenu = NULL;
QMenu *helpMenu = NULL;
QRect desktopRect;
QDockWidget *thumbnailDock = NULL;
QDockWidget *thumbnail2Dock = NULL;
QDockWidget *thumbnail3Dock = NULL;
QDockWidget *browserAndPlaylistTabDock = NULL;
QDockWidget *coreSelectionDock = NULL;
QTabWidget *browserAndPlaylistTabWidget = NULL;
QWidget *widget = NULL;
QWidget *browserWidget = NULL;
QWidget *playlistWidget = NULL;
QWidget *coreSelectionWidget = NULL;
QWidget *launchWithWidget = NULL;
ThumbnailWidget *thumbnailWidget = NULL;
ThumbnailWidget *thumbnail2Widget = NULL;
ThumbnailWidget *thumbnail3Widget = NULL;
QPushButton *browserDownloadsButton = NULL;
QPushButton *browserUpButton = NULL;
QPushButton *browserStartButton = NULL;
ThumbnailLabel *thumbnail = NULL;
ThumbnailLabel *thumbnail2 = NULL;
ThumbnailLabel *thumbnail3 = NULL;
QAction *editSearchAction = NULL;
QAction *loadCoreAction = NULL;
QAction *unloadCoreAction = NULL;
QAction *exitAction = NULL;
QComboBox *launchWithComboBox = NULL;
QSettings *qsettings = NULL;
QListWidget *listWidget = NULL;
int i = 0;
if (!handle)
return NULL;
handle->app = static_cast<ui_application_qt_t*>(ui_application_qt.initialize());
handle->window = static_cast<ui_window_qt_t*>(ui_window_qt.init());
desktop = qApp->desktop();
desktopRect = desktop->availableGeometry();
mainwindow = handle->window->qtWindow;
qsettings = mainwindow->settings();
mainwindow->resize(qMin(desktopRect.width(), INITIAL_WIDTH), qMin(desktopRect.height(), INITIAL_HEIGHT));
mainwindow->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, mainwindow->size(), desktopRect));
mainwindow->setWindowTitle("RetroArch");
mainwindow->setDockOptions(QMainWindow::AnimatedDocks | QMainWindow::AllowNestedDocks | QMainWindow::AllowTabbedDocks | GROUPED_DRAGGING);
listWidget = mainwindow->playlistListWidget();
widget = new FileDropWidget(mainwindow);
widget->setObjectName("tableWidget");
widget->setContextMenuPolicy(Qt::CustomContextMenu);
QObject::connect(widget, SIGNAL(filesDropped(QStringList)), mainwindow, SLOT(onPlaylistFilesDropped(QStringList)));
QObject::connect(widget, SIGNAL(deletePressed()), mainwindow, SLOT(deleteCurrentPlaylistItem()));
QObject::connect(widget, SIGNAL(customContextMenuRequested(const QPoint&)), mainwindow, SLOT(onFileDropWidgetContextMenuRequested(const QPoint&)));
layout = new QVBoxLayout();
layout->addWidget(mainwindow->contentTableWidget());
layout->addWidget(mainwindow->contentGridWidget());
widget->setLayout(layout);
mainwindow->setCentralWidget(widget);
menu = mainwindow->menuBar();
fileMenu = menu->addMenu(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_FILE));
loadCoreAction = fileMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_FILE_LOAD_CORE), mainwindow, SLOT(onLoadCoreClicked()));
loadCoreAction->setShortcut(QKeySequence("Ctrl+L"));
unloadCoreAction = fileMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_FILE_UNLOAD_CORE), mainwindow, SLOT(onUnloadCoreMenuAction()));
unloadCoreAction->setObjectName("unloadCoreAction");
unloadCoreAction->setEnabled(false);
unloadCoreAction->setShortcut(QKeySequence("Ctrl+U"));
exitAction = fileMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_FILE_EXIT), mainwindow, SLOT(close()));
exitAction->setShortcut(QKeySequence::Quit);
editMenu = menu->addMenu(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_EDIT));
//.........这里部分代码省略.........