本文整理汇总了C++中QMenu::addSeparator方法的典型用法代码示例。如果您正苦于以下问题:C++ QMenu::addSeparator方法的具体用法?C++ QMenu::addSeparator怎么用?C++ QMenu::addSeparator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMenu
的用法示例。
在下文中一共展示了QMenu::addSeparator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QMenuBar
QMenuBar*
ActionCollection::createMenuBar( QWidget *parent )
{
QMenuBar* menuBar = new QMenuBar( parent );
menuBar->setFont( TomahawkUtils::systemFont() );
QMenu* controlsMenu = new QMenu( tr( "&Controls" ), menuBar );
controlsMenu->setFont( TomahawkUtils::systemFont() );
controlsMenu->addAction( m_actionCollection[ "playPause" ] );
controlsMenu->addAction( m_actionCollection[ "previousTrack" ] );
controlsMenu->addAction( m_actionCollection[ "nextTrack" ] );
controlsMenu->addSeparator();
controlsMenu->addAction( m_actionCollection[ "togglePrivacy" ] );
controlsMenu->addAction( m_actionCollection[ "showOfflineSources" ] );
controlsMenu->addSeparator();
controlsMenu->addAction( m_actionCollection[ "importPlaylist" ] );
controlsMenu->addAction( m_actionCollection[ "updateCollection" ] );
controlsMenu->addAction( m_actionCollection[ "rescanCollection" ] );
controlsMenu->addSeparator();
controlsMenu->addAction( m_actionCollection[ "quit" ] );
QMenu* settingsMenu = new QMenu( tr( "&Settings" ), menuBar );
settingsMenu->setFont( TomahawkUtils::systemFont() );
#ifndef Q_OS_MAC
settingsMenu->addAction( m_actionCollection[ "toggleMenuBar" ] );
#endif
settingsMenu->addAction( m_actionCollection[ "preferences" ] );
QMenu* helpMenu = new QMenu( tr( "&Help" ), menuBar );
helpMenu->setFont( TomahawkUtils::systemFont() );
helpMenu->addAction( m_actionCollection[ "diagnostics" ] );
helpMenu->addAction( m_actionCollection[ "openLogfile" ] );
helpMenu->addAction( m_actionCollection[ "legalInfo" ] );
helpMenu->addAction( m_actionCollection["getSupport"] );
helpMenu->addAction( m_actionCollection["reportBug"] );
helpMenu->addAction( m_actionCollection["helpTranslate"] );
helpMenu->addSeparator();
QMenu* whatsNew = helpMenu->addMenu( ImageRegistry::instance()->icon( RESPATH "images/whatsnew.svg" ), tr( "What's New in ..." ) );
whatsNew->setFont( TomahawkUtils::systemFont() );
whatsNew->addAction( m_actionCollection[ "whatsnew_0_8" ] );
helpMenu->addAction( m_actionCollection[ "aboutTomahawk" ] );
// Setup update check
#ifndef Q_OS_MAC
helpMenu->insertSeparator( m_actionCollection[ "legalInfo" ] );
#endif
#if defined( Q_OS_MAC ) && defined( HAVE_SPARKLE )
helpMenu->addAction( m_actionCollection[ "checkForUpdates" ] );
#elif defined( Q_OS_WIN )
helpMenu->addSeparator();
helpMenu->addAction( m_actionCollection[ "checkForUpdates" ] );
#endif
if ( qApp->arguments().contains( "--debug" ) )
{
helpMenu->addSeparator();
helpMenu->addAction( m_actionCollection[ "crashNow" ] );
}
menuBar->addMenu( controlsMenu );
menuBar->addMenu( settingsMenu );
#if defined( Q_OS_MAC )
QMenu* windowMenu = new QMenu( tr( "&Window" ), menuBar );
windowMenu->setFont( TomahawkUtils::systemFont() );
windowMenu->addAction( m_actionCollection[ "minimize" ] );
windowMenu->addAction( m_actionCollection[ "zoom" ] );
windowMenu->addAction( m_actionCollection[ "fullscreen" ] );
menuBar->addMenu( windowMenu );
#endif
menuBar->addMenu( helpMenu );
return menuBar;
}
示例2: baseBalanceTitle
dspAROpenItems::dspAROpenItems(QWidget* parent, const char*, Qt::WFlags fl)
: display(parent, "dspAROpenItems", fl)
{
setupUi(optionsWidget());
setWindowTitle(tr("Open Receivables"));
setListLabel(tr("Receivables"));
setReportName("AROpenItems");
setMetaSQLOptions("arOpenItems", "detail");
setUseAltId(true);
setNewVisible(true);
connect(_customerSelector, SIGNAL(updated()), list(), SLOT(clear()));
connect(_customerSelector, SIGNAL(updated()), this, SLOT(sHandlePrintGroup()));
connect(_closed, SIGNAL(toggled(bool)), this, SLOT(sClosedToggled(bool)));
_dates->setStartNull(tr("Earliest"), omfgThis->startOfTime(), TRUE);
_dates->setEndNull(tr("Latest"), omfgThis->endOfTime(), TRUE);
QString baseBalanceTitle(tr("Balance"));
QString baseAmountTitle(tr("Amount"));
QString basePaidTitle(tr("Paid"));
if (! omfgThis->singleCurrency())
{
baseBalanceTitle = tr("Balance (in %1)").arg(CurrDisplay::baseCurrAbbr());
baseAmountTitle = tr("Amount (in %1)").arg(CurrDisplay::baseCurrAbbr());
basePaidTitle = tr("Paid (in %1)").arg(CurrDisplay::baseCurrAbbr());
}
list()->setRootIsDecorated(true);
list()->addColumn(tr("Doc. Type"), -1, Qt::AlignLeft, true, "doctype");
list()->addColumn(tr("Posted"), _ynColumn, Qt::AlignCenter, true, "posted");
list()->addColumn(tr("Recurring"), _ynColumn, Qt::AlignCenter, false, "recurring");
list()->addColumn(tr("Open"), _ynColumn, Qt::AlignCenter, false, "open");
list()->addColumn(tr("Doc. #"), _orderColumn, Qt::AlignLeft, true, "docnumber");
list()->addColumn(tr("Cust./Assign To"),_itemColumn, Qt::AlignLeft, false, "cust_number");
list()->addColumn(tr("Name/Desc."), -1, Qt::AlignLeft, true, "cust_name");
list()->addColumn(tr("Order/Incident"),_itemColumn, Qt::AlignRight, false, "ordernumber");
list()->addColumn(tr("Doc. Date"), _dateColumn, Qt::AlignCenter, true, "docdate");
list()->addColumn(tr("Due Date"), _dateColumn, Qt::AlignCenter, true, "aropen_duedate");
list()->addColumn(tr("Amount"), _moneyColumn, Qt::AlignRight, true, "amount");
list()->addColumn(baseAmountTitle, _moneyColumn, Qt::AlignRight, false, "base_amount");
list()->addColumn(tr("Paid"), _moneyColumn, Qt::AlignRight, true, "paid");
list()->addColumn(basePaidTitle, _moneyColumn, Qt::AlignRight, false, "base_paid");
list()->addColumn(tr("Balance"), _moneyColumn, Qt::AlignRight, true, "balance");
list()->addColumn(tr("Currency"), _currencyColumn, Qt::AlignLeft, true, "currAbbr");
list()->addColumn(baseBalanceTitle, _moneyColumn, Qt::AlignRight, true, "base_balance");
list()->addColumn(tr("Credit Card"), -1, Qt::AlignLeft, false, "ccard_number");
list()->addColumn(tr("Notes"), -1, Qt::AlignLeft, false, "notes");
connect(omfgThis, SIGNAL(creditMemosUpdated()), this, SLOT(sFillList()));
connect(omfgThis, SIGNAL(invoicesUpdated(int, bool)), this, SLOT(sFillList()));
if (omfgThis->singleCurrency())
{
list()->hideColumn("currAbbr");
list()->hideColumn("balance");
}
disconnect(newAction(), SIGNAL(triggered()), this, SLOT(sNew()));
connect(newAction(), SIGNAL(triggered()), this, SLOT(sCreateInvoice()));
QToolButton * newBtn = (QToolButton*)toolBar()->widgetForAction(newAction());
newBtn->setPopupMode(QToolButton::MenuButtonPopup);
QAction *menuItem;
QMenu * newMenu = new QMenu;
menuItem = newMenu->addAction(tr("Invoice"), this, SLOT(sCreateInvoice()));
menuItem->setEnabled(_privileges->check("MaintainMiscInvoices"));
menuItem = newMenu->addAction(tr("Misc. Debit Memo"), this, SLOT(sEnterMiscArDebitMemo()));
menuItem->setEnabled(_privileges->check("MaintainARMemos"));
newMenu->addSeparator();
menuItem = newMenu->addAction(tr("Credit Memo"), this, SLOT(sNewCreditMemo()));
menuItem->setEnabled(_privileges->check("MaintainCreditMemos"));
menuItem = newMenu->addAction(tr("Misc. Credit Memo"), this, SLOT(sEnterMiscArCreditMemo()));
menuItem->setEnabled(_privileges->check("MaintainARMemos"));
newBtn->setMenu(newMenu);
_asOf->setDate(omfgThis->dbDate(), true);
_closed->hide();
}
示例3: QMenu
void RenderView3D::TriggerContextMenu( QMouseEvent* event )
{
QMenu* menu = new QMenu(this);
bool bShowBar = this->GetShowScalarBar();
MainWindow* mainwnd = MainWindow::GetMainWindow();
QList<Layer*> layers = mainwnd->GetLayers("Surface");
layers << mainwnd->GetLayers("MRI");
layers << mainwnd->GetLayers("PointSet");
QMenu* submenu = menu->addMenu("Reset View");
QAction* act = new QAction("Right", this);
connect(act, SIGNAL(triggered()), this, SLOT(ResetViewRight()));
submenu->addAction(act);
act = new QAction("Left", this);
connect(act, SIGNAL(triggered()), this, SLOT(ResetViewLeft()));
submenu->addAction(act);
act = new QAction("Anterior", this);
connect(act, SIGNAL(triggered()), this, SLOT(ResetViewAnterior()));
submenu->addAction(act);
act = new QAction("Posterior", this);
connect(act, SIGNAL(triggered()), this, SLOT(ResetViewPosterior()));
submenu->addAction(act);
act = new QAction("Superior", this);
connect(act, SIGNAL(triggered()), this, SLOT(ResetViewSuperior()));
submenu->addAction(act);
act = new QAction("Inferior", this);
connect(act, SIGNAL(triggered()), this, SLOT(ResetViewInferior()));
submenu->addAction(act);
menu->addSeparator();
act = new QAction("Show All Slices", this);
act->setData(3);
menu->addAction(act);
connect(act, SIGNAL(triggered()), this, SLOT(OnShowSlice()));
act = new QAction("Hide All Slices", this);
act->setData(-1);
menu->addAction(act);
connect(act, SIGNAL(triggered()), this, SLOT(OnShowSlice()));
menu->addSeparator();
QStringList slice_names;
slice_names << "Show Sagittal Slice" << "Show Coronal Slice" << "Show Axial Slice";
for (int i = 0; i < 3; i++)
{
act = new QAction(slice_names[i], this);
act->setData(i);
act->setCheckable(true);
act->setChecked(m_bSliceVisibility[i]);
menu->addAction(act);
connect(act, SIGNAL(toggled(bool)), this, SLOT(OnShowSlice(bool)));
}
menu->addSeparator();
if (!mainwnd->GetLayers("MRI").isEmpty())
{
menu->addAction(MainWindow::GetMainWindow()->ui->actionShowSliceFrames);
}
if (!layers.isEmpty())
{
QMenu* menu2 = menu->addMenu("Show Color Bar");
QActionGroup* ag = new QActionGroup(this);
ag->setExclusive(false);
foreach (Layer* layer, layers)
{
QAction* act = new QAction(layer->GetName(), this);
act->setCheckable(true);
act->setChecked(bShowBar && layer == m_layerScalarBar);
act->setData(QVariant::fromValue((QObject*)layer));
menu2->addAction(act);
ag->addAction(act);
}
示例4: extraAreaMouseEvent
void QScriptEdit::extraAreaMouseEvent(QMouseEvent *e)
{
QTextCursor cursor = cursorForPosition(QPoint(0, e->pos().y()));
#ifndef QT_NO_SYNTAXHIGHLIGHTER
cursor.setPosition(cursor.block().position());
#endif
QFontMetrics fm(font());
int markWidth = fm.lineSpacing();
if (e->type() == QEvent::MouseMove && e->buttons() == 0) { // mouse tracking
bool hand = (e->pos().x() <= markWidth);
int lineNumber = cursor.blockNumber() + m_baseLineNumber;
hand = hand && isExecutableLine(lineNumber);
#ifndef QT_NO_CURSOR
if (hand != (m_extraArea->cursor().shape() == Qt::PointingHandCursor))
m_extraArea->setCursor(hand ? Qt::PointingHandCursor : Qt::ArrowCursor);
#endif
}
if (e->type() == QEvent::MouseButtonPress) {
if (e->button() == Qt::LeftButton) {
int lineNumber = cursor.blockNumber() + m_baseLineNumber;
bool executable = isExecutableLine(lineNumber);
if ((e->pos().x() <= markWidth) && executable)
m_extraAreaToggleBlockNumber = cursor.blockNumber();
else
m_extraAreaToggleBlockNumber = -1;
}
} else if (e->type() == QEvent::MouseButtonRelease) {
if (e->button() == Qt::LeftButton) {
if ((m_extraAreaToggleBlockNumber != -1) && (e->pos().x() <= markWidth)) {
int lineNumber = m_extraAreaToggleBlockNumber + m_baseLineNumber;
bool on = !m_breakpoints.contains(lineNumber);
emit breakpointToggleRequest(lineNumber, on);
}
} else if (e->button() == Qt::RightButton) {
int lineNumber = cursor.blockNumber() + m_baseLineNumber;
if (!isExecutableLine(lineNumber))
return;
bool has = m_breakpoints.contains(lineNumber);
QMenu *popup = new QMenu();
QAction *toggleAct = new QAction(tr("Toggle Breakpoint"), popup);
popup->addAction(toggleAct);
QAction *disableAct = new QAction(tr("Disable Breakpoint"), popup);
QAction *enableAct = new QAction(tr("Enable Breakpoint"), popup);
QWidget *conditionWidget = new QWidget();
{
QHBoxLayout *hbox = new QHBoxLayout(conditionWidget);
hbox->addWidget(new QLabel(tr("Breakpoint Condition:")));
hbox->addWidget(new QLineEdit());
}
// QWidgetAction *conditionAct = new QWidgetAction(popup);
// conditionAct->setDefaultWidget(conditionWidget);
if (has) {
popup->addSeparator();
popup->addAction(m_breakpoints[lineNumber].enabled ? disableAct : enableAct);
// popup->addAction(conditionAct);
}
QAction *ret = popup->exec(e->globalPos());
if (ret) {
if (ret == toggleAct) {
emit breakpointToggleRequest(lineNumber, !has);
} else if (ret == disableAct) {
emit breakpointEnableRequest(lineNumber, false);
} else if (ret == enableAct) {
emit breakpointEnableRequest(lineNumber, true);
}// else if (ret == conditionAct) {
//}
}
popup->deleteLater();
}
}
}
示例5: contextMenuEvent
void OverlayEditorScene::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) {
QGraphicsScene::contextMenuEvent(event);
if (event->isAccepted())
return;
if (! event->widget())
return;
QGraphicsPixmapItem *item = childAt(event->scenePos());
QMenu qm(event->widget());
QMenu *qmLayout = qm.addMenu(tr("Layout preset"));
QAction *qaLayoutLargeAvatar = qmLayout->addAction(tr("Large square avatar"));
QAction *qaLayoutText = qmLayout->addAction(tr("Avatar and Name"));
QMenu *qmTrans = qm.addMenu(tr("User Opacity"));
QActionGroup *qagUser = new QActionGroup(&qm);
QAction *userOpacity[8];
for (int i=0;i<8;++i) {
qreal o = (i + 1) / 8.0f;
userOpacity[i] = new QAction(tr("%1%").arg(o * 100.0f, 0, 'f', 1), qagUser);
userOpacity[i]->setCheckable(true);
userOpacity[i]->setData(o);
if (qFuzzyCompare(qgiGroup->opacity(), o))
userOpacity[i]->setChecked(true);
qmTrans->addAction(userOpacity[i]);
}
QAction *color = NULL;
QAction *font = NULL;
QAction *objectOpacity[8];
for (int i=0;i<8;++i)
objectOpacity[i] = NULL;
QAction *boxpen[4] = { NULL, NULL, NULL, NULL};
QAction *boxpad[4] = { NULL, NULL, NULL, NULL};
QAction *boxpencolor = NULL;
QAction *boxfillcolor = NULL;
QAction *align[6];
for (int i=0;i<6;++i)
align[i] = NULL;
if (item) {
qm.addSeparator();
QMenu *qmObjTrans = qm.addMenu(tr("Object Opacity"));
QActionGroup *qagObject = new QActionGroup(&qm);
for (int i=0;i<8;++i) {
qreal o = (i + 1) / 8.0f;
objectOpacity[i] = new QAction(tr("%1%").arg(o * 100.0f, 0, 'f', 1), qagObject);
objectOpacity[i]->setCheckable(true);
objectOpacity[i]->setData(o);
if (qFuzzyCompare(item->opacity(), o))
objectOpacity[i]->setChecked(true);
qmObjTrans->addAction(objectOpacity[i]);
}
QMenu *qmObjAlign = qm.addMenu(tr("Alignment"));
Qt::Alignment a;
if (item == qgpiAvatar)
a = os.qaAvatar;
else if (item == qgpiChannel)
a = os.qaChannel;
else if (item == qgpiMuted)
a = os.qaMutedDeafened;
else
a = os.qaUserName;
align[0] = qmObjAlign->addAction(tr("Left"));
align[0]->setCheckable(true);
align[0]->setData(Qt::AlignLeft);
if (a & Qt::AlignLeft)
align[0]->setChecked(true);
align[1] = qmObjAlign->addAction(tr("Center"));
align[1]->setCheckable(true);
align[1]->setData(Qt::AlignHCenter);
if (a & Qt::AlignHCenter)
align[1]->setChecked(true);
align[2] = qmObjAlign->addAction(tr("Right"));
align[2]->setCheckable(true);
align[2]->setData(Qt::AlignRight);
if (a & Qt::AlignRight)
align[2]->setChecked(true);
qmObjAlign->addSeparator();
align[3] = qmObjAlign->addAction(tr("Top"));
align[3]->setCheckable(true);
align[3]->setData(Qt::AlignTop);
if (a & Qt::AlignTop)
align[3]->setChecked(true);
align[4] = qmObjAlign->addAction(tr("Center"));
align[4]->setCheckable(true);
align[4]->setData(Qt::AlignVCenter);
if (a & Qt::AlignVCenter)
//.........这里部分代码省略.........
示例6: Start
//.........这里部分代码省略.........
//Prepare Worker
ScriptMultiWorker* worker = new ScriptMultiWorker(this);
worker->SetModuleManager(_ModuleManager);
worker->SetAdditionEngineScripts(_ModuleManager->GetModuleEngineCode());
worker->SetPreprocessor(_Preprocessor);
worker->SetBrowserFactory(BrowserFactory);
Output->Clear();
Output->disconnect();
ReportData = new ScriptMultiWorkerReportData(this);
ResVisualizer = new ResourcesVisualizer(this);
connect(ResVisualizer,SIGNAL(ChangedState(bool)),this,SLOT(ResourcesReportStateChanged(bool)));
ResVisualizer->SetReportData(EngineResController->GetWatcherList());
DataVisualizer = new ReportDataVisualizer(this);
DataVisualizer->SetReportData(ReportData);
connect(ui->actionShow_Report,SIGNAL(triggered()),DataVisualizer,SLOT(ShowReport()));
connect(FactorySolver,SIGNAL(UsedSolver(QString)),ReportData,SLOT(CaptchaUsed(QString)));
connect(FactorySolver,SIGNAL(FailedSolver(QString)),ReportData,SLOT(CaptchaFailed(QString)));
connect(ui->actionShow,SIGNAL(triggered()),this,SLOT(show()));
connect(ui->actionExit,SIGNAL(triggered()),this,SLOT(Close()));
connect(ui->actionRestart,SIGNAL(triggered()),this,SLOT(Restart()));
connect(ui->actionRestart,SIGNAL(triggered()),this,SLOT(Close()));
connect(ui->actionData,SIGNAL(triggered()),this,SLOT(ShowDatabase()));
connect(TrayNotifier,SIGNAL(Show()),this,SLOT(show()));
QMenu *Menu = new QMenu(this);
Menu->addAction(ui->actionShow);
Menu->addSeparator();
Menu->addAction(ui->actionExit);
TrayNotifier->SetContextmenu(Menu);
connect(worker,SIGNAL(Success()),Output,SLOT(Success()));
connect(worker,SIGNAL(Failed()),Output,SLOT(Failed()));
connect(worker,SIGNAL(ProgressMaximum(int)),Output,SLOT(ProgressMaximum(int)));
connect(worker,SIGNAL(ProgressValue(int)),Output,SLOT(ProgressValue(int)));
connect(worker,SIGNAL(Finished()),Output,SLOT(Finished()));
//Set Loggers
QDateTime CurrentDateTime = QDateTime::currentDateTime();
QString datestringfile = CurrentDateTime.toString("yyyy.MM.dd.hh.mm.ss");
Output->SetOutputTitle1(loader.GetOutputTitle1());
Output->SetOutputTitle2(loader.GetOutputTitle2());
Output->SetOutputTitle3(loader.GetOutputTitle3());
Output->SetOutputTitle4(loader.GetOutputTitle4());
Output->SetOutputTitle5(loader.GetOutputTitle5());
Output->SetOutputTitle6(loader.GetOutputTitle6());
Output->SetOutputTitle7(loader.GetOutputTitle7());
Output->SetOutputTitle8(loader.GetOutputTitle8());
Output->SetOutputTitle9(loader.GetOutputTitle9());
ComplexLogger *ComplexLoggerResults1 = new ComplexLogger(worker);
FileLogger *FileLoggerResults1 = new FileLogger(ComplexLoggerResults1);
QString FileName1 = QDir::cleanPath(LogLocation + QDir::separator() + QString("%2/%1.txt").arg(datestringfile).arg(Output->GetOutputTitle1().GetTranslation("en").replace(QRegExp("\\s"),".").replace(QRegExp("[^a-zA-Z1-9]"),"")));
Output->SetFileName1(FileName1);
FileLoggerResults1->SetFileName(FileName1);
示例7: QMenu
void SVImageMainWindow::SVImageMainWindowPrivate::setupMenus() {
menuRecentFiles = new QMenu("Open &Recent", mw);
connect(menuRecentFiles, SIGNAL(aboutToShow()),
mw, SLOT(prepareRecentFilesMenu()));
menuExportAs = new QMenu("E&xport As", mw);
menuExportAs->setEnabled(false);
supportedFormatsMap::const_iterator i = exportAsFormat.constBegin();
for ( ; i != exportAsFormat.constEnd(); ++i) {
QAction *action = menuExportAs->addAction(QString("%1 (%2)").arg(i.value()).arg(i.key()));
connect(action, SIGNAL(triggered()),
exportAsFormatMapper, SLOT(map()));
exportAsFormatMapper->setMapping(action, i.key());
}
QMenuBar *menuBar = mw->menuBar();
menuFile = new QMenu("&File", mw);
menuFile->addAction(actionLoad);
menuFile->addMenu(menuRecentFiles);
menuFile->addAction(actionReload);
menuFile->addMenu(menuExportAs);
menuFile->addAction(actionPrint);
menuFile->addSeparator();
menuFile->addAction(actionQuit);
menuBar->addMenu(menuFile);
menuPlot = new QMenu("&Plot", mw);
menuPlot->addAction(actionZoomFit);
menuPlot->addSeparator();
menuPlot->addAction(actionZoom);
menuPlot->addAction(actionMove);
menuBar->addMenu(menuPlot);
menuGo = new QMenu("&Go", mw);
menuGo->addAction(actionGoFirst);
menuGo->addAction(actionGoPrevious);
menuGo->addAction(actionGoNext);
menuGo->addAction(actionGoLast);
menuGo->addSeparator();
menuGo->addAction(actionWatchLatest);
menuBar->addMenu(menuGo);
menuTools = new QMenu("&Tools", mw);
QMenu *menuMaskTools = menuTools->addMenu("Mask");
menuMaskTools->addSeparator();
menuMaskTools->addAction(actionMaskNew);
menuMaskTools->addAction(actionMaskLoad);
menuMaskTools->addAction(actionMaskSaveAs);
menuMaskTools->addSeparator();
menuMaskTools->addAction(actionMaskByThreshold);
menuMaskTools->addAction(actionMaskAddPoint);
menuMaskTools->addAction(actionMaskAddPolygon);
menuMaskTools->addAction(actionMaskRemovePoint);
menuMaskTools->addAction(actionMaskRemovePolygon);
menuBar->addMenu(menuTools);
menuView = new QMenu("&Views", mw);
menuView->addAction(propertyDock->toggleViewAction());
menuView->addSeparator();
menuView->addAction(mainToolBar->toggleViewAction());
menuView->addAction(maskToolBar->toggleViewAction());
menuBar->addMenu(menuView);
menuWindow = new QMenu("&Window", mw);
connect(menuWindow, SIGNAL(aboutToShow()),
mw, SLOT(prepareWindowMenu()));
menuBar->addMenu(menuWindow);
menuHelp = new QMenu("&Help", mw);
menuHelp->addAction(actionAbout);
menuBar->addMenu(menuHelp);
}
示例8: showMenu
//.........这里部分代码省略.........
actions & Util::AllowedActionFlag::MaximizeVert);
maximizeAct->setProperty ("Actor",
QVariant::fromValue<Actor_f> ([this, isMaximized] (const QString& wid)
{
isMaximized ? unmaximizeWindow (wid) : maximizeWindow (wid);
}));
}
auto moreMenu = menu->addMenu (tr ("More"));
{
auto keepAbove = moreMenu->addAction (tr ("Keep above others"));
keepAbove->setEnabled (actions & Util::AllowedActionFlag::MoveToTop);
keepAbove->setCheckable (true);
const bool isTop = state & Util::WinStateFlag::OnTop;
keepAbove->setChecked (isTop);
keepAbove->setProperty ("Actor",
QVariant::fromValue<Actor_f> ([this, isTop] (const QString& wid)
{ moveWindowTo (wid, isTop ? "normal" : "top"); }));
keepAbove->setIcon (Proxy_->GetIconThemeManager ()->GetIcon ("go-top"));
}
{
auto keepBelow = moreMenu->addAction (tr ("Keep below others"));
keepBelow->setEnabled (actions & Util::AllowedActionFlag::MoveToBottom);
keepBelow->setCheckable (true);
const bool isBottom = state & Util::WinStateFlag::OnBottom;
keepBelow->setChecked (isBottom);
keepBelow->setProperty ("Actor",
QVariant::fromValue<Actor_f> ([this, isBottom] (const QString& wid)
{ moveWindowTo (wid, isBottom ? "normal" : "bottom"); }));
keepBelow->setIcon (Proxy_->GetIconThemeManager ()->GetIcon ("go-bottom"));
}
{
auto shadeAct = moreMenu->addAction (tr ("Shade"));
shadeAct->setEnabled (actions & Util::AllowedActionFlag::Shade);
shadeAct->setCheckable (true);
shadeAct->setChecked (state & Util::WinStateFlag::Shaded);
shadeAct->setProperty ("Actor",
QVariant::fromValue<Actor_f> ([this] (const QString& wid)
{ toggleShadeWindow (wid); }));
}
QMenu *desksMenu = 0;
{
const auto numDesks = w.GetDesktopCount ();
if (numDesks > 1)
{
desksMenu = menu->addMenu (tr ("Move to desktop"));
const auto winDesk = w.GetWindowDesktop (wid);
auto addAct = [this, actions, winDesk, desksMenu] (int num, const QString& name)
{
auto act = desksMenu->addAction (name);
act->setEnabled (actions & Util::AllowedActionFlag::ChangeDesktop);
act->setCheckable (true);
act->setChecked (winDesk == num);
act->setProperty ("Actor",
QVariant::fromValue<Actor_f> ([this, num] (const QString& wid)
{ moveToDesktop (wid, num); }));
};
const auto& deskNames = w.GetDesktopNames ();
for (int i = 0; i < numDesks; ++i)
addAct (i, deskNames.value (i, QString::number (i)));
desksMenu->addSeparator ();
addAct (0xFFFFFFFF, tr ("All desktops"));
}
}
menu->addSeparator ();
{
auto closeAct = menu->addAction (tr ("Close"));
closeAct->setEnabled (actions & Util::AllowedActionFlag::Close);
closeAct->setProperty ("Actor",
QVariant::fromValue<Actor_f> ([this] (const QString& wid)
{ closeWindow (wid); }));
closeAct->setIcon (Proxy_->GetIconThemeManager ()->GetIcon ("window-close"));
}
auto allActions = menu->actions () + moreMenu->actions ();
if (desksMenu)
allActions += desksMenu->actions ();
for (auto act : allActions)
{
act->setProperty ("WID", widStr);
connect (act,
SIGNAL (triggered ()),
this,
SLOT (handleAction ()));
}
menu->popup ({ x, y });
}
示例9: createEditMenu
QMenu* KickViewHeaderedWidget::createEditMenu() const
{
QMenu* menu = new QMenu(tr("&KickEdit"));
QAction* undoAct, *redoAct, *singleDraw, *reachedDraw, *show3D, *showEditor,
*show1D, *show2D, *showVelo, *showAccel, *noExtraView, *followMode;
undoAct = new QAction(QIcon(":/Icons/arrow_undo.png"), tr("Undo"), menu);
undoAct->setShortcut(QKeySequence::Undo);
undoAct->setStatusTip(tr("Undo last change"));
undoAct->setEnabled(!undo.empty());
connect(this, SIGNAL(undoAvailable(bool)), undoAct, SLOT(setEnabled(bool)));
redoAct = new QAction(QIcon(":/Icons/arrow_redo.png"), tr("Redo"), menu);
redoAct->setShortcut(QKeySequence::Redo);
redoAct->setStatusTip(tr("Redo last undone change"));
redoAct->setEnabled(!redo.empty());
connect(this, SIGNAL(redoAvailable(bool)), redoAct, SLOT(setEnabled(bool)));
show3D = new QAction(tr("Display Phase Drawings"), menu);
show3D->setStatusTip(tr("Draws curves for every limb either for the current phase or all phases"));
show3D->setCheckable(true);
singleDraw = new QAction(tr("Display Only Current Phase"), menu);
singleDraw->setStatusTip(tr("Draws only curves for the current Phase"));
singleDraw->setCheckable(true);
reachedDraw = new QAction(tr("Display Reached Positions"), menu);
reachedDraw->setStatusTip(tr("Draws the reached positions into the 3D view"));
reachedDraw->setCheckable(true);
showEditor = new QAction(tr("Display Editor View"), menu);
showEditor->setStatusTip(tr("Shows the editor view"));
showEditor->setCheckable(true);
show1D = new QAction(tr("Display 1D Views"), menu);
show1D->setStatusTip(tr("Shows 1D views of one curve for each axis"));
show1D->setCheckable(true);
show2D = new QAction(tr("Display 2D Views"), menu);
show2D->setStatusTip(tr("Shows 2D views of one curve for plane"));
show2D->setCheckable(true);
showVelo = new QAction(tr("Display Velocity Views"), menu);
showVelo->setStatusTip(tr("Shows the velocity of one curve"));
showVelo->setCheckable(true);
showAccel = new QAction(tr("Display Acceleration Views"), menu);
showAccel->setStatusTip(tr("Shows the acceleration of one curve"));
showAccel->setCheckable(true);
noExtraView = new QAction(tr("Display No Extra View"), menu);
noExtraView->setStatusTip(tr("Hides all extra views"));
noExtraView->setCheckable(true);
followMode = new QAction(tr("Enable Follow Mode"), menu);
followMode->setStatusTip(tr("The robot will react to changes directly"));
followMode->setCheckable(true);
connect(undoAct, SIGNAL(triggered()), this, SLOT(undoChanges()));
connect(redoAct, SIGNAL(triggered()), this, SLOT(redoChanges()));
connect(singleDraw, SIGNAL(toggled(bool)), kickViewWidget, SLOT(setSingleDrawing(bool)));
connect(reachedDraw, SIGNAL(toggled(bool)), kickViewWidget, SLOT(setReachedDrawing(bool)));
connect(show3D, SIGNAL(toggled(bool)), kickViewWidget, SLOT(setDrawings(bool)));
connect(showEditor, SIGNAL(toggled(bool)), kickViewWidget, SLOT(setEditor(bool)));
connect(show1D, SIGNAL(toggled(bool)), kickViewWidget, SLOT(setTra1d(bool)));
connect(show2D, SIGNAL(toggled(bool)), kickViewWidget, SLOT(setTra2d(bool)));
connect(showVelo, SIGNAL(toggled(bool)), kickViewWidget, SLOT(setVelocity(bool)));
connect(showAccel, SIGNAL(toggled(bool)), kickViewWidget, SLOT(setAccel(bool)));
connect(followMode, SIGNAL(toggled(bool)), kickViewWidget, SLOT(setFollowMode(bool)));
QActionGroup* showing = new QActionGroup(menu);
showing->addAction(show1D);
showing->addAction(show2D);
showing->addAction(showVelo);
showing->addAction(showAccel);
showing->addAction(noExtraView);
menu->addAction(undoAct);
menu->addAction(redoAct);
menu->addSeparator();
menu->addAction(show3D);
menu->addAction(singleDraw);
menu->addAction(reachedDraw);
menu->addAction(showEditor);
menu->addSeparator();
menu->addAction(noExtraView);
menu->addAction(show1D);
menu->addAction(show2D);
menu->addAction(showVelo);
menu->addAction(showAccel);
menu->addSeparator();
menu->addAction(followMode);
showEditor->setChecked(true);
show3D->setChecked(true);
noExtraView->setChecked(true);
return menu;
//.........这里部分代码省略.........
示例10: createContextMenu
QMenu* QgsAppLayerTreeViewMenuProvider::createContextMenu()
{
QMenu* menu = new QMenu;
QgsLayerTreeViewDefaultActions* actions = mView->defaultActions();
QModelIndex idx = mView->currentIndex();
if ( !idx.isValid() )
{
// global menu
menu->addAction( actions->actionAddGroup( menu ) );
menu->addAction( QgsApplication::getThemeIcon( "/mActionExpandTree.png" ), tr( "&Expand All" ), mView, SLOT( expandAll() ) );
menu->addAction( QgsApplication::getThemeIcon( "/mActionCollapseTree.png" ), tr( "&Collapse All" ), mView, SLOT( collapseAll() ) );
// TODO: update drawing order
}
else if ( QgsLayerTreeNode* node = mView->layerTreeModel()->index2node( idx ) )
{
// layer or group selected
if ( QgsLayerTree::isGroup( node ) )
{
menu->addAction( actions->actionZoomToGroup( mCanvas, menu ) );
menu->addAction( QgsApplication::getThemeIcon( "/mActionRemoveLayer.svg" ), tr( "&Remove" ), QgisApp::instance(), SLOT( removeLayer() ) );
menu->addAction( QgsApplication::getThemeIcon( "/mActionSetCRS.png" ),
tr( "&Set Group CRS" ), QgisApp::instance(), SLOT( legendGroupSetCRS() ) );
menu->addAction( actions->actionRenameGroupOrLayer( menu ) );
if ( mView->selectedNodes( true ).count() >= 2 )
menu->addAction( actions->actionGroupSelected( menu ) );
menu->addAction( tr( "Save As Layer Definition File..." ), QgisApp::instance(), SLOT( saveAsLayerDefinition() ) );
menu->addAction( actions->actionAddGroup( menu ) );
}
else if ( QgsLayerTree::isLayer( node ) )
{
QgsMapLayer* layer = QgsLayerTree::toLayer( node )->layer();
menu->addAction( actions->actionZoomToLayer( mCanvas, menu ) );
menu->addAction( actions->actionShowInOverview( menu ) );
if ( layer && layer->type() == QgsMapLayer::RasterLayer )
{
menu->addAction( tr( "&Zoom to Best Scale (100%)" ), QgisApp::instance(), SLOT( legendLayerZoomNative() ) );
QgsRasterLayer* rasterLayer = qobject_cast<QgsRasterLayer *>( layer );
if ( rasterLayer && rasterLayer->rasterType() != QgsRasterLayer::Palette )
menu->addAction( tr( "&Stretch Using Current Extent" ), QgisApp::instance(), SLOT( legendLayerStretchUsingCurrentExtent() ) );
}
menu->addAction( QgsApplication::getThemeIcon( "/mActionRemoveLayer.svg" ), tr( "&Remove" ), QgisApp::instance(), SLOT( removeLayer() ) );
// duplicate layer
QAction* duplicateLayersAction = menu->addAction( QgsApplication::getThemeIcon( "/mActionDuplicateLayer.svg" ), tr( "&Duplicate" ), QgisApp::instance(), SLOT( duplicateLayers() ) );
// set layer scale visibility
menu->addAction( tr( "&Set Layer Scale Visibility" ), QgisApp::instance(), SLOT( setLayerScaleVisibility() ) );
// set layer crs
menu->addAction( QgsApplication::getThemeIcon( "/mActionSetCRS.png" ), tr( "&Set Layer CRS" ), QgisApp::instance(), SLOT( setLayerCRS() ) );
// assign layer crs to project
menu->addAction( QgsApplication::getThemeIcon( "/mActionSetProjectCRS.png" ), tr( "Set &Project CRS from Layer" ), QgisApp::instance(), SLOT( setProjectCRSFromLayer() ) );
// style-related actions
if ( layer && mView->selectedLayerNodes().count() == 1 )
{
QMenu* menuStyleManager = new QMenu( tr( "Styles" ) );
QgisApp* app = QgisApp::instance();
menuStyleManager->addAction( tr( "Copy Style" ), app, SLOT( copyStyle() ) );
if ( app->clipboard()->hasFormat( QGSCLIPBOARD_STYLE_MIME ) )
{
menuStyleManager->addAction( tr( "Paste Style" ), app, SLOT( pasteStyle() ) );
}
menuStyleManager->addSeparator();
QgsMapLayerStyleGuiUtils::instance()->addStyleManagerActions( menuStyleManager, layer );
menu->addMenu( menuStyleManager );
}
menu->addSeparator();
if ( layer && layer->type() == QgsMapLayer::VectorLayer )
{
QgsVectorLayer* vlayer = qobject_cast<QgsVectorLayer *>( layer );
QAction *toggleEditingAction = QgisApp::instance()->actionToggleEditing();
QAction *saveLayerEditsAction = QgisApp::instance()->actionSaveActiveLayerEdits();
QAction *allEditsAction = QgisApp::instance()->actionAllEdits();
// attribute table
menu->addAction( QgsApplication::getThemeIcon( "/mActionOpenTable.png" ), tr( "&Open Attribute Table" ),
QgisApp::instance(), SLOT( attributeTable() ) );
//.........这里部分代码省略.........
示例11: initialize
//.........这里部分代码省略.........
// __Browser->setFloating(true);
__Browser->hide();
// * View Menu
// - Camera
__ViewMenu = new QMenu( this );
// - ToolBar
QAction * _ViewMenuAction = __ViewMenu->addAction(tr("&Menu Bar"),this,SLOT(displayMenuBar()),Qt::Key_F6);
_ViewMenuAction->setCheckable(true);
_ViewMenuAction->setChecked(true);
_ViewMenuAction = __controlPanel->toggleViewAction();
__ViewMenu->addAction(_ViewMenuAction);
_ViewMenuAction->setShortcut(Qt::Key_F7);
_ViewMenuAction = __FileToolBar->toggleViewAction();
__ViewMenu->addAction(_ViewMenuAction);
_ViewMenuAction->setShortcut(Qt::Key_F8);
_ViewMenuAction = __ViewToolBar->toggleViewAction();
__ViewMenu->addAction(_ViewMenuAction);
// _ViewMenuAction->setShortcut(Qt::Key_F9);
if(__FileMenu->getLocationBar()){
_ViewMenuAction = __FileMenu->getLocationBar()->toggleViewAction();
__ViewMenu->addAction(_ViewMenuAction);
_ViewMenuAction->setShortcut(Qt::Key_F10);
}
__ViewMenu->addSeparator();
// - Browser
_ViewMenuAction = __Browser->toggleViewAction();
__ViewMenu->addAction(_ViewMenuAction);
_ViewMenuAction->setShortcut(Qt::Key_F2);
_ViewMenuAction = __ErrorDialog->toggleViewAction();
__ViewMenu->addAction(_ViewMenuAction);
_ViewMenuAction->setShortcut(Qt::Key_F3);
__ViewMenu->addSeparator();
#ifdef _WIN32
__ViewMenu->addAction(tr("&Debug Log"),this,SLOT(debugLog()));
__ViewMenu->addSeparator();
#endif
QMenu * FrameGLSize = new QMenu(tr("GL Frame Size"),__ViewMenu);
__ViewMenu->addMenu(FrameGLSize);
FrameGLSize->addAction(tr("800x600"),this,SLOT(set800x600FrameGL()));
FrameGLSize->addAction(tr("640x480"),this,SLOT(set640x480FrameGL()));
FrameGLSize->addAction(tr("512x384"),this,SLOT(set512x384FrameGL()));
FrameGLSize->addAction(tr("320x240"),this,SLOT(set320x240FrameGL()));
FrameGLSize->addSeparator();
FrameGLSize->addAction(tr("Customize"),this,SLOT(setCustomFrameGLSize()),Qt::Key_F4);
__ViewMenu->addSeparator();
_ViewMenuAction = __ViewMenu->addAction(tr("GL Frame only"),this,SLOT(displayGLWidgetOnly()), Qt::Key_F10);
QPixmap _fulls(ViewerIcon::getPixmap(ViewerIcon::fullscreen));
__actFullScreen = __ViewMenu->addAction(_fulls,tr("Full Screen"),this,SLOT(displayFullScreen()), Qt::Key_F11);
示例12: contextMenuEvent
void ImageViewer::contextMenuEvent(QContextMenuEvent *event) {
if (!m_flipbook) return;
QAction *action;
if (m_isColorModel) {
event->ignore();
return;
}
QMenu *menu = new QMenu(this);
if (m_flipbook->getPreviewedFx()) {
if (!(windowState() & Qt::WindowFullScreen)) {
action = menu->addAction(tr("Clone Preview"));
action->setShortcut(QKeySequence(
CommandManager::instance()->getKeyFromId(MI_ClonePreview)));
connect(action, SIGNAL(triggered()), m_flipbook, SLOT(clonePreview()));
}
if (m_flipbook->isFreezed()) {
action = menu->addAction(tr("Unfreeze Preview"));
action->setShortcut(QKeySequence(
CommandManager::instance()->getKeyFromId(MI_FreezePreview)));
connect(action, SIGNAL(triggered()), m_flipbook, SLOT(unfreezePreview()));
} else {
action = menu->addAction(tr("Freeze Preview"));
action->setShortcut(QKeySequence(
CommandManager::instance()->getKeyFromId(MI_FreezePreview)));
connect(action, SIGNAL(triggered()), m_flipbook, SLOT(freezePreview()));
}
action = menu->addAction(tr("Regenerate Preview"));
action->setShortcut(QKeySequence(
CommandManager::instance()->getKeyFromId(MI_RegeneratePreview)));
connect(action, SIGNAL(triggered()), m_flipbook, SLOT(regenerate()));
action = menu->addAction(tr("Regenerate Frame Preview"));
action->setShortcut(QKeySequence(
CommandManager::instance()->getKeyFromId(MI_RegenerateFramePr)));
connect(action, SIGNAL(triggered()), m_flipbook, SLOT(regenerateFrame()));
menu->addSeparator();
}
action = menu->addAction(tr("Load / Append Images"));
connect(action, SIGNAL(triggered()), m_flipbook, SLOT(loadImages()));
// history of the loaded paths of flipbook
action = CommandManager::instance()->getAction(MI_LoadRecentImage);
menu->addAction(action);
action->setParent(m_flipbook);
if (m_flipbook->isSavable()) {
action = menu->addAction(tr("Save Images"));
connect(action, SIGNAL(triggered()), m_flipbook, SLOT(saveImages()));
}
menu->addSeparator();
QAction *reset = menu->addAction(tr("Reset View"));
reset->setShortcut(
QKeySequence(CommandManager::instance()->getKeyFromId(V_ZoomReset)));
connect(reset, SIGNAL(triggered()), SLOT(resetView()));
QAction *fit = menu->addAction(tr("Fit To Window"));
fit->setShortcut(
QKeySequence(CommandManager::instance()->getKeyFromId(V_ZoomFit)));
connect(fit, SIGNAL(triggered()), SLOT(fitView()));
#ifdef _WIN32
if (ImageUtils::FullScreenWidget *fsWidget =
dynamic_cast<ImageUtils::FullScreenWidget *>(parentWidget())) {
bool isFullScreen = (fsWidget->windowState() & Qt::WindowFullScreen) != 0;
action = menu->addAction(isFullScreen ? tr("Exit Full Screen Mode")
: tr("Full Screen Mode"));
action->setShortcut(QKeySequence(
CommandManager::instance()->getKeyFromId(V_ShowHideFullScreen)));
connect(action, SIGNAL(triggered()), fsWidget, SLOT(toggleFullScreen()));
}
#endif
bool addedSep = false;
if (m_isHistogramEnable &&
visibleRegion().contains(event->pos() * getDevPixRatio())) {
menu->addSeparator();
addedSep = true;
action = menu->addAction(tr("Show Histogram"));
connect(action, SIGNAL(triggered()), SLOT(showHistogram()));
}
if (m_visualSettings.m_doCompare) {
if (!addedSep) menu->addSeparator();
action = menu->addAction(tr("Swap Compared Images"));
connect(action, SIGNAL(triggered()), SLOT(swapCompared()));
}
//.........这里部分代码省略.........
示例13: QMainWindow
MainWindow::MainWindow()
: QMainWindow()
, m_view(new SvgView)
{
QMenu *fileMenu = new QMenu(tr("&File"), this);
QAction *openAction = fileMenu->addAction(tr("&Open..."));
openAction->setShortcut(QKeySequence(tr("Ctrl+O")));
QAction *quitAction = fileMenu->addAction(tr("E&xit"));
quitAction->setShortcuts(QKeySequence::Quit);
menuBar()->addMenu(fileMenu);
QMenu *viewMenu = new QMenu(tr("&View"), this);
m_backgroundAction = viewMenu->addAction(tr("&Background"));
m_backgroundAction->setEnabled(false);
m_backgroundAction->setCheckable(true);
m_backgroundAction->setChecked(false);
connect(m_backgroundAction, SIGNAL(toggled(bool)), m_view, SLOT(setViewBackground(bool)));
m_outlineAction = viewMenu->addAction(tr("&Outline"));
m_outlineAction->setEnabled(false);
m_outlineAction->setCheckable(true);
m_outlineAction->setChecked(true);
connect(m_outlineAction, SIGNAL(toggled(bool)), m_view, SLOT(setViewOutline(bool)));
menuBar()->addMenu(viewMenu);
QMenu *rendererMenu = new QMenu(tr("&Renderer"), this);
m_nativeAction = rendererMenu->addAction(tr("&Native"));
m_nativeAction->setCheckable(true);
m_nativeAction->setChecked(true);
#ifndef QT_NO_OPENGL
m_glAction = rendererMenu->addAction(tr("&OpenGL"));
m_glAction->setCheckable(true);
#endif
m_imageAction = rendererMenu->addAction(tr("&Image"));
m_imageAction->setCheckable(true);
#ifndef QT_NO_OPENGL
rendererMenu->addSeparator();
m_highQualityAntialiasingAction = rendererMenu->addAction(tr("&High Quality Antialiasing"));
m_highQualityAntialiasingAction->setEnabled(false);
m_highQualityAntialiasingAction->setCheckable(true);
m_highQualityAntialiasingAction->setChecked(false);
connect(m_highQualityAntialiasingAction, SIGNAL(toggled(bool)), m_view, SLOT(setHighQualityAntialiasing(bool)));
#endif
QActionGroup *rendererGroup = new QActionGroup(this);
rendererGroup->addAction(m_nativeAction);
#ifndef QT_NO_OPENGL
rendererGroup->addAction(m_glAction);
#endif
rendererGroup->addAction(m_imageAction);
menuBar()->addMenu(rendererMenu);
connect(openAction, SIGNAL(triggered()), this, SLOT(openFile()));
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
connect(rendererGroup, SIGNAL(triggered(QAction*)),
this, SLOT(setRenderer(QAction*)));
setCentralWidget(m_view);
setWindowTitle(tr("SVG Viewer"));
}
示例14: QMainWindow
/////////////US_Win
US_Win::US_Win( QWidget* parent, Qt::WindowFlags flags )
: QMainWindow( parent, flags )
{
// We need to handle US_Global::g here becuse US_Widgets is not a parent
if ( ! g.isValid() )
{
// Do something for invalid global memory
qDebug( "US_Win: invalid global memory" );
}
g.set_global_position( QPoint( 50, 50 ) ); // Ensure initialization
QPoint p = g.global_position();
setGeometry( QRect( p, p + QPoint( 710, 532 ) ) );
g.set_global_position( p + QPoint( 30, 30 ) );
setWindowTitle( "UltraScan III" );
QIcon us3_icon = US_Images::getIcon( US_Images::US3_ICON );
setWindowIcon( us3_icon );
procs = QList<procData*>(); // Initialize to an empty list
////////////
QMenu* file = new QMenu( tr( "&File" ), this );
//addMenu( P_CONFIG, tr( "&Configuration" ), file );
//addMenu( P_ADMIN , tr( "&Administrator" ), file );
//file->addSeparator();
addMenu( P_EXIT, tr( "E&xit" ), file );
//QMenu* type1 = new QMenu( tr( "&Velocity Data" ), file );
//addMenu( 21, tr( "&Absorbance Data" ), type1 );
//addMenu( 22, tr( "&Interference Data" ), type1 );
//addMenu( 23, tr( "&Fluorescense Data" ), type1 );
//addMenu( 24, tr( "&Edit Cell ID's Data" ), type1 );
///////////////
QMenu* edit = new QMenu( tr( "&Edit" ), this );
//addMenu( 12, tr( "&Equilibrium Data" ) , edit );
//addMenu( 13, tr( "Edit &Wavelength Data" ), edit );
//addMenu( 14, tr( "View/Edit &Multiwavelength Data" ), edit );
addMenu( P_EDIT, tr( "&Edit Data" ) , edit );
edit->addSeparator();
addMenu( P_CONFIG, tr( "&Preferences" ) , edit );
/////////////
QMenu* velocity = new QMenu( tr( "&Velocity" ), this );
addMenu( P_VHWE , tr( "&Enhanced van Holde - Weischet" ), velocity );
addMenu( P_GRIDEDIT , tr( "C&ustom 2-D Grid Editor" ), velocity );
addMenu( P_2DSA , tr( "&2-D Spectrum Analysis" ), velocity );
addMenu( P_PCSA , tr( "&Parametrically Constrained Spectrum Analysis" ),
velocity );
addMenu( P_GAINIT , tr( "&Initialize Genetic Algorithm" ), velocity );
addMenu( P_DMGAINIT , tr( "Initialize Discrete Model &Genetic Algorithm" ),
velocity );
addMenu( P_SECOND , tr( "Second &Moment" ), velocity );
addMenu( P_DCDT , tr( "&Time Derivative" ), velocity );
addMenu( P_FEMA , tr( "&FE Model Viewer" ), velocity );
addMenu( P_FEMSTAT , tr( "FE Model &Statistics" ), velocity );
addMenu( P_PSEUDO3D , tr( "&Combine Pseudo-3D Distributions" ), velocity );
addMenu( P_RAMP , tr( "Speed &Ramp Analysis" ), velocity );
#ifdef EQUI_MENU
QMenu* equilibrium = new QMenu( tr( "E&quilibrium" ), this );
addMenu( P_EQGLOBFIT, tr( "&Global Fit" ), equilibrium );
//addMenu( P_EQTIMEEST, tr( "Estimate Equilibrium &Times", equilibrium );
#endif
// QMenu* fit = new QMenu( tr( "&Global Fit" ), this );
// addMenu( P_GLOBFITEQ, tr( "Global &Equilibrium Fit" ), fit );
//addMenu( P_GLOBFITEX, tr( "Global E&xtinction Fit" ), fit );
//addMenu( P_GLOBFITSP, tr( "Global &Spectrum Fit" ), fit );
QMenu* utilities = new QMenu( tr( "&Utilities" ), this );
QMenu* multiwave = new QMenu( tr( "&Multiwavelength" ), this );
QMenu* spectrum = new QMenu( tr( "Spectral &Analysis" ), this );
addMenu( P_SPECFIT , tr( "&Spectrum Fitter" ), spectrum);
addMenu( P_SPECDEC , tr( "Spectrum &Decomposition" ), spectrum);
addMenu( P_CONVERT , tr( "&Import Experimental Data" ), utilities );
addMenu( P_EXPORT , tr( "&Export OpenAUC Data" ), utilities );
#if 0 // temporarily disable Create Experiment until truly ready
addMenu( P_CEXPERI , tr( "Create E&xperiment" ), utilities );
#endif
addMenu( P_FDSMAN , tr( "FDS File &Manager" ), utilities );
addMenu( P_FITMEN , tr( "&Fit Meniscus" ), utilities );
utilities->addMenu(spectrum);
addMenu( P_COLORGRAD, tr( "Color &Gradient Generator" ), utilities );
addMenu( P_RPTGEN , tr( "&Report Generator" ), utilities );
addMenu( P_ROTORCAL , tr( "Rotor &Calibration" ), utilities );
addMenu( P_LICENSE , tr( "&License Manager" ), utilities );
addMenu( P_VHWCOMB , tr( "Combine Distribution &Plots (vHW)" ), utilities );
addMenu( P_DDCOMB , tr( "Combine &Discrete Distributions" ), utilities );
addMenu( P_GLOMODL , tr( "Create Global &Model" ), utilities );
addMenu( P_VIEWCFA , tr( "View Raw C&FA Data" ), utilities );
addMenu( P_VIEWXPN , tr( "View Raw &Optima Data" ), utilities );
addMenu( P_VIEWTMST, tr( "View &TimeState" ), utilities );
addMenu( P_VIEWMWL , tr( "&View Multiwavelength Data" ), multiwave );
addMenu( P_VIEWMSS , tr( "View MWL &S-Spectra" ), multiwave );
//.........这里部分代码省略.........
示例15: if
void AnnotationDialog::ListSelect::showContextMenu(const QPoint& pos)
{
QMenu* menu = new QMenu( this );
QTreeWidgetItem* item = m_treeWidget->itemAt(pos);
// click on any item
QString title = i18n("No Item Selected");
if ( item )
title = item->text(0);
QLabel* label = new QLabel( i18n("<b>%1</b>",title), menu );
label->setAlignment( Qt::AlignCenter );
QWidgetAction* action = new QWidgetAction(menu);
action->setDefaultWidget( label );
menu->addAction(action);
QAction* deleteAction = menu->addAction( SmallIcon(QString::fromLatin1("edit-delete")), i18n("Delete") );
QAction* renameAction = menu->addAction( i18n("Rename...") );
QLabel* categoryTitle = new QLabel( i18n("<b>Tag Groups</b>"), menu );
categoryTitle->setAlignment( Qt::AlignCenter );
action = new QWidgetAction( menu );
action->setDefaultWidget( categoryTitle );
menu->addAction( action );
// -------------------------------------------------- Add/Remove member group
DB::MemberMap& memberMap = DB::ImageDB::instance()->memberMap();
QMenu* members = new QMenu( i18n( "Tag groups" ) );
menu->addMenu( members );
QAction* newCategoryAction = nullptr;
if ( item ) {
QStringList grps = memberMap.groups( m_category->name() );
for( QStringList::ConstIterator it = grps.constBegin(); it != grps.constEnd(); ++it ) {
if (!memberMap.canAddMemberToGroup(m_category->name(), *it, item->text(0)))
continue;
QAction* action = members->addAction( *it );
action->setCheckable(true);
action->setChecked( (bool) memberMap.members( m_category->name(), *it, false ).contains( item->text(0) ) );
action->setData( *it );
}
if ( !grps.isEmpty() )
members->addSeparator();
newCategoryAction = members->addAction( i18n("Add this tag to a new tag group..." ) );
}
QAction* newSubcategoryAction = menu->addAction( i18n( "Make this tag a tag group and add a tag..." ) );
// -------------------------------------------------- Take item out of category
QTreeWidgetItem* parent = item ? item->parent() : nullptr;
QAction* takeAction = nullptr;
if ( parent )
takeAction = menu->addAction( i18n( "Remove from tag group %1", parent->text(0) ) );
// -------------------------------------------------- sort
QLabel* sortTitle = new QLabel( i18n("<b>Sorting</b>") );
sortTitle->setAlignment( Qt::AlignCenter );
action = new QWidgetAction( menu );
action->setDefaultWidget( sortTitle );
menu->addAction( action );
QAction* usageAction = menu->addAction( i18n("Usage") );
QAction* alphaFlatAction = menu->addAction( i18n("Alphabetical (Flat)") );
QAction* alphaTreeAction = menu->addAction( i18n("Alphabetical (Tree)") );
usageAction->setCheckable(true);
usageAction->setChecked( Settings::SettingsData::instance()->viewSortType() == Settings::SortLastUse);
alphaFlatAction->setCheckable(true);
alphaFlatAction->setChecked( Settings::SettingsData::instance()->viewSortType() == Settings::SortAlphaFlat);
alphaTreeAction->setCheckable(true);
alphaTreeAction->setChecked( Settings::SettingsData::instance()->viewSortType() == Settings::SortAlphaTree);
if ( !item ) {
deleteAction->setEnabled( false );
renameAction->setEnabled( false );
members->setEnabled( false );
newSubcategoryAction->setEnabled( false );
}
// -------------------------------------------------- exec
QAction* which = menu->exec( m_treeWidget->mapToGlobal(pos));
if ( which == nullptr )
return;
else if ( which == deleteAction ) {
Q_ASSERT( item );
int code = KMessageBox::warningContinueCancel( this, i18n("<p>Do you really want to delete \"%1\"?<br/>"
"Deleting the item will remove any information "
"about it from any image containing the item.</p>"
,title),
i18n("Really Delete %1?",item->text(0)),
KGuiItem(i18n("&Delete"),QString::fromLatin1("editdelete")) );
if ( code == KMessageBox::Continue ) {
if (item->checkState(0) == Qt::Checked and m_positionable) {
// An area could be linked against this. We can use positionableTagDeselected
// here, as the procedure is the same as if the tag had been deselected.
emit positionableTagDeselected(m_category->name(), item->text(0));
}
#ifdef HAVE_KFACE
// Also delete this tag from the recognition database (if it's there)
if (m_positionable) {
//.........这里部分代码省略.........