本文整理汇总了C++中QActionGroup::setExclusive方法的典型用法代码示例。如果您正苦于以下问题:C++ QActionGroup::setExclusive方法的具体用法?C++ QActionGroup::setExclusive怎么用?C++ QActionGroup::setExclusive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QActionGroup
的用法示例。
在下文中一共展示了QActionGroup::setExclusive方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QTextEdit
VBoxDbgConsoleOutput::VBoxDbgConsoleOutput(QWidget *pParent/* = NULL*/, const char *pszName/* = NULL*/)
: QTextEdit(pParent), m_uCurLine(0), m_uCurPos(0), m_hGUIThread(RTThreadNativeSelf())
{
setReadOnly(true);
setUndoRedoEnabled(false);
setOverwriteMode(false);
setPlainText("");
setTextInteractionFlags(Qt::TextBrowserInteraction);
setAutoFormatting(QTextEdit::AutoAll);
setTabChangesFocus(true);
setAcceptRichText(false);
/*
* Font.
* Create actions for font menu items.
*/
m_pCourierFontAction = new QAction(tr("Courier"), this);
m_pCourierFontAction->setCheckable(true);
m_pCourierFontAction->setShortcut(Qt::ControlModifier + Qt::Key_D);
connect(m_pCourierFontAction, SIGNAL(triggered()), this, SLOT(setFontCourier()));
m_pMonospaceFontAction = new QAction(tr("Monospace"), this);
m_pMonospaceFontAction->setCheckable(true);
m_pMonospaceFontAction->setShortcut(Qt::ControlModifier + Qt::Key_M);
connect(m_pMonospaceFontAction, SIGNAL(triggered()), this, SLOT(setFontMonospace()));
/* Create action group for grouping of exclusive font menu items. */
QActionGroup *pActionFontGroup = new QActionGroup(this);
pActionFontGroup->addAction(m_pCourierFontAction);
pActionFontGroup->addAction(m_pMonospaceFontAction);
pActionFontGroup->setExclusive(true);
/*
* Color scheme.
* Create actions for color-scheme menu items.
*/
m_pGreenOnBlackAction = new QAction(tr("Green On Black"), this);
m_pGreenOnBlackAction->setCheckable(true);
m_pGreenOnBlackAction->setShortcut(Qt::ControlModifier + Qt::Key_1);
connect(m_pGreenOnBlackAction, SIGNAL(triggered()), this, SLOT(setColorGreenOnBlack()));
m_pBlackOnWhiteAction = new QAction(tr("Black On White"), this);
m_pBlackOnWhiteAction->setCheckable(true);
m_pBlackOnWhiteAction->setShortcut(Qt::ControlModifier + Qt::Key_2);
connect(m_pBlackOnWhiteAction, SIGNAL(triggered()), this, SLOT(setColorBlackOnWhite()));
/* Create action group for grouping of exclusive color-scheme menu items. */
QActionGroup *pActionColorGroup = new QActionGroup(this);
pActionColorGroup->addAction(m_pGreenOnBlackAction);
pActionColorGroup->addAction(m_pBlackOnWhiteAction);
pActionColorGroup->setExclusive(true);
/*
* Set the defaults (which syncs with the menu item checked state).
*/
setFontCourier();
setColorGreenOnBlack();
NOREF(pszName);
}
示例2: setupDockWidgets
void MainWindow::setupDockWidgets(const QMap<QString, QSize> &customSizeHints)
{
qRegisterMetaType<QDockWidget::DockWidgetFeatures>();
mapper = new QSignalMapper(this);
connect(mapper, SIGNAL(mapped(int)), this, SLOT(setCorner(int)));
QMenu *corner_menu = dockWidgetMenu->addMenu(tr("Top left corner"));
QActionGroup *group = new QActionGroup(this);
group->setExclusive(true);
::addAction(corner_menu, tr("Top dock area"), group, mapper, 0);
::addAction(corner_menu, tr("Left dock area"), group, mapper, 1);
corner_menu = dockWidgetMenu->addMenu(tr("Top right corner"));
group = new QActionGroup(this);
group->setExclusive(true);
::addAction(corner_menu, tr("Top dock area"), group, mapper, 2);
::addAction(corner_menu, tr("Right dock area"), group, mapper, 3);
corner_menu = dockWidgetMenu->addMenu(tr("Bottom left corner"));
group = new QActionGroup(this);
group->setExclusive(true);
::addAction(corner_menu, tr("Bottom dock area"), group, mapper, 4);
::addAction(corner_menu, tr("Left dock area"), group, mapper, 5);
corner_menu = dockWidgetMenu->addMenu(tr("Bottom right corner"));
group = new QActionGroup(this);
group->setExclusive(true);
::addAction(corner_menu, tr("Bottom dock area"), group, mapper, 6);
::addAction(corner_menu, tr("Right dock area"), group, mapper, 7);
dockWidgetMenu->addSeparator();
}
示例3: createSortMenu
void NMainMenuBar::createSortMenu(QMenu *parentMenu) {
sortMenu = parentMenu->addMenu(tr("Sort notes by"));
QFont f = global.getGuiFont(QFont());
QActionGroup *menuActionGroup = new QActionGroup(this);
menuActionGroup->setExclusive(true);
addSortAction(sortMenu, menuActionGroup, f, tr("Relevance, Date updated [desc]"), INI_VALUE_SORTORDER_DEFAULT);
addSortAction(sortMenu, menuActionGroup, f, tr("Relevance, Date updated [asc]"), "relevance desc, dateUpdated asc");
addSortAction(sortMenu, menuActionGroup, f, tr("Relevance, Date created [desc]"), "relevance desc, dateCreated desc");
addSortAction(sortMenu, menuActionGroup, f, tr("Relevance, Date created [asc]"), "relevance desc, dateCreated asc");
addSortAction(sortMenu, menuActionGroup, f, tr("Relevance, Title [desc]"), "relevance desc, title desc");
addSortAction(sortMenu, menuActionGroup, f, tr("Relevance, Title [asc]"), "relevance desc, title asc");
sortMenu->addSeparator();
addSortAction(sortMenu, menuActionGroup, f, tr("Date updated [desc]"), "dateUpdated desc");
addSortAction(sortMenu, menuActionGroup, f, tr("Date updated [asc]"), "dateUpdated asc");
addSortAction(sortMenu, menuActionGroup, f, tr("Date created [desc]"), "dateCreated desc");
addSortAction(sortMenu, menuActionGroup, f, tr("Date created [asc]"), "dateCreated asc");
addSortAction(sortMenu, menuActionGroup, f, tr("Title [desc]"), "title desc");
addSortAction(sortMenu, menuActionGroup, f, tr("Title [asc]"), "title asc");
addSortAction(sortMenu, menuActionGroup, f, tr("Size [desc]"), "size desc, dateUpdated desc");
addSortAction(sortMenu, menuActionGroup, f, tr("Has todo [desc]"), "hasTodo desc, dateUpdated desc");
addSortAction(sortMenu, menuActionGroup, f, tr("Unsynced first"), "isDirty desc, dateUpdated desc");
sortMenu->setFont(f);
}
示例4: initMenuBar
/*
* Inits the menu options and Repository menuItem in menuBar
*/
void MainWindow::initMenuBar()
{
ui->menuTools->insertAction(ui->actionCacheCleaner, m_actionMenuMirrorCheck);
ui->menuTools->addSeparator();
ui->menuTools->addAction(m_actionMenuOptions);
QActionGroup *actionGroupPackages = new QActionGroup(this);
QActionGroup *actionGroupRepositories = new QActionGroup(this);
ui->actionViewAllPackages->setText(StrConstants::getAll());
actionGroupPackages->addAction(ui->actionViewAllPackages);
actionGroupPackages->addAction(ui->actionViewInstalledPackages);
actionGroupPackages->addAction(ui->actionViewNonInstalledPackages);
actionGroupPackages->setExclusive(true);
m_actionMenuRepository = ui->menuView->addAction(StrConstants::getRepository());
QMenu *subMenu = new QMenu(ui->menuView);
connect(subMenu, SIGNAL(triggered(QAction*)), this, SLOT(selectedRepositoryMenu(QAction*)));
m_actionRepositoryAll = subMenu->addAction(StrConstants::getAll());
m_actionRepositoryAll->setCheckable(true);
m_actionRepositoryAll->setChecked(true);
subMenu->addSeparator();
RepoConf *repoConf = new RepoConf();
QStringList repos = repoConf->getRepos();
foreach(QString repo, repos)
{
QAction * createdAction = subMenu->addAction(repo);
createdAction->setCheckable(true);
actionGroupRepositories->addAction(createdAction);
}
示例5: QFrame
VoiceSelector::VoiceSelector(QWidget* parent)
: QFrame(parent)
{
setLineWidth(0);
setFrameStyle(QFrame::Box | QFrame::Plain);
QHBoxLayout* vwl = new QHBoxLayout;
vwl->setSpacing(0);
vwl->setContentsMargins(0, 0, 0, 0);
static const char* sl2[4] = { "voice-1", "voice-2", "voice-3", "voice-4" };
static const int v[4] = { 0, 1, 2, 3 };
QActionGroup* vag = new QActionGroup(this);
vag->setExclusive(true);
for (int i = 0; i < 4; ++i) {
QAction* a = getAction(sl2[i]);
a->setCheckable(true);
vag->addAction(a);
VoiceButton* tb = new VoiceButton(v[i]);
tb->setDefaultAction(a);
vwl->addWidget(tb);
}
setLayout(vwl);
connect(vag, SIGNAL(triggered(QAction*)), this, SIGNAL(triggered(QAction*)));
}
示例6: CreateDisplayToolbarActions
void ObjectWorkspace::CreateDisplayToolbarActions()
{
// The actiongroup is used to make the action behave like radio buttons
QActionGroup *actionGroup = new QActionGroup(this);
actionGroup->setExclusive(true);
QIcon wireframeIcon(":/images/wireframe.png");
QIcon shadedIcon(":/images/shaded.png");
QIcon shadedWireIcon(":/images/shadedwire.png");
QIcon gridIcon(":/images/xygrid.png");
mWireframeAction = actionGroup->addAction(wireframeIcon, "Wireframe");
mShadedAction = actionGroup->addAction(shadedIcon, "Shaded");
mShadedWireAction = actionGroup->addAction(shadedWireIcon, "Shaded Wireframe");
mGridAction = new QAction(gridIcon, "Toggle Grid", this);
connect(mGridAction, SIGNAL(toggled(bool)), this, SLOT(OnToggleGridClicked(bool)));
mWireframeAction->setCheckable(true);
mShadedAction->setCheckable(true);
mShadedWireAction->setCheckable(true);
mGridAction->setCheckable(true);
mShadedAction->setChecked(true);
mGridAction->setChecked(true);
}
示例7: QMainWindow
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
QActionGroup* toolGroup = new QActionGroup(this);
toolGroup->addAction(ui->actionInsertEdge);
toolGroup->addAction(ui->actionInsertVertex);
toolGroup->addAction(ui->actionPointer);
toolGroup->setExclusive(true);
graphicsScene = new GraphicsScene(&graph, this);
emit ui->actionPointer->trigger();
ui->graphicsView->setScene(graphicsScene);
graphicsScene->setSceneRect(0,0,500,500);
bestCostText = graphicsScene->addSimpleText("0");
bestCostText->setPos(10,10);
//connect(graphicsScene, SIGNAL(Inserted(QGraphicsEllipseItem*)), SLOT(addVertex(QGraphicsEllipseItem*)));
connect(graphicsScene, SIGNAL(EdgeInserted(GraphicsEdge*)), SLOT(addEdge(GraphicsEdge*)));
srand(time(NULL));
// Color Cost
colorCost[RED] = 10;
costColor[colorCost[RED]] = RED;
colorCost[BLUE] = 20;
costColor[colorCost[BLUE]] = BLUE;
colorCost[GREEN] = 30;
costColor[colorCost[GREEN]] = GREEN;
colorCost[YELLOW] =40;
costColor[colorCost[YELLOW]] = YELLOW;
}
示例8: createActions
QActionGroup* FilterMessageType::createActions()
{
QActionGroup* actions = new QActionGroup(this);
actions->setExclusive(true);
QAction* allAction = new QAction(QIcon(":/res/msg_all.png"), tr("All messages"), actions);
allAction->setCheckable(true);
allAction->setData(QVariant::fromValue(ALL));
QAction* inboxAction = new QAction(QIcon(":/res/msg_inbox.png"), tr("Inbox"), actions);
inboxAction->setCheckable(true);
inboxAction->setChecked(true);
inboxAction->setData(QVariant::fromValue(INBOX));
QAction* outboxAction = new QAction(QIcon(":/res/msg_outbox.png"), tr("Sent"), actions);
outboxAction->setCheckable(true);
outboxAction->setData(QVariant::fromValue(OUTBOX));
QAction* draftAction = new QAction(QIcon(":/res/drafts.png"), tr("Drafts"), actions);
draftAction->setCheckable(true);
draftAction->setData(QVariant::fromValue(DRAFTS));
connect(actions, SIGNAL(triggered(QAction*)), SLOT(setAllowedTypeAction(QAction*)));
return actions;
}
示例9: QMainWindow
frmSearchReplace::frmSearchReplace(TopEditorContainer *topEditorContainer, QWidget *parent) :
QMainWindow(parent),
ui(new Ui::frmSearchReplace),
m_topEditorContainer(topEditorContainer)
{
ui->setupUi(this);
setWindowFlags( (windowFlags() | Qt::CustomizeWindowHint) & ~Qt::WindowMaximizeButtonHint);
move(
parentWidget()->window()->frameGeometry().topLeft() +
parentWidget()->window()->rect().center() -
rect().center());
ui->cmbSearch->completer()->setCaseSensitivity(Qt::CaseSensitive);
ui->cmbReplace->completer()->setCaseSensitivity(Qt::CaseSensitive);
QSettings s;
ui->cmbSearch->addItems(s.value("Search/searchHistory", QStringList()).toStringList());
ui->cmbSearch->setCurrentText("");
ui->cmbReplace->addItems(s.value("Search/replaceHistory", QStringList()).toStringList());
ui->cmbReplace->setCurrentText("");
ui->cmbLookIn->addItems(s.value("Search/fileHistory", QStringList()).toStringList());
ui->cmbLookIn->setCurrentText("");
ui->cmbFilter->addItems(s.value("Search/filterHistory", QStringList()).toStringList());
ui->cmbFilter->setCurrentText("");
connect(ui->cmbSearch->lineEdit(), &QLineEdit::textEdited, this, &frmSearchReplace::on_searchStringEdited);
connect(ui->cmbSearch->lineEdit(), &QLineEdit::returnPressed, this, [=]() {
if (ui->actionFind_in_files->isChecked()) {
on_btnFindAll_clicked();
} else {
on_btnFindNext_clicked();
}
});
connect(ui->cmbReplace->lineEdit(), &QLineEdit::returnPressed, this, &frmSearchReplace::on_btnFindNext_clicked);
connect(ui->cmbLookIn->lineEdit(), &QLineEdit::returnPressed, this, &frmSearchReplace::on_btnFindAll_clicked);
connect(ui->cmbFilter->lineEdit(), &QLineEdit::returnPressed, this, &frmSearchReplace::on_btnFindAll_clicked);
ui->cmbFilter->lineEdit()->setPlaceholderText("*.ext1, *.ext2, ...");
ui->actionFind->setIcon(IconProvider::fromTheme("edit-find"));
ui->actionReplace->setIcon(IconProvider::fromTheme("edit-find-replace"));
QActionGroup *tabGroup = new QActionGroup(this);
tabGroup->addAction(ui->actionFind);
tabGroup->addAction(ui->actionReplace);
tabGroup->addAction(ui->actionFind_in_files);
tabGroup->setExclusive(true);
// Initialize all the tabs
ui->actionFind->setChecked(true);
ui->actionReplace->setChecked(true);
ui->actionFind_in_files->setChecked(true);
ui->chkShowAdvanced->toggled(ui->chkShowAdvanced->isChecked());
setCurrentTab(TabSearch);
}
示例10: cameras
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
{
ui->setupUi(this);
//QString path = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation) + "/PlanktonTracker/";
ui->delayLineEdit->setEnabled(false);
ui->numPhotoLineEdit->setEnabled(false);
ui->startButton->setEnabled(false);
ui->stopButton->setEnabled(false);
ui->trackButton->setEnabled(false);
Pylon::PylonAutoInitTerm autoInitTerm;
QActionGroup *cameraDevicesGroup = new QActionGroup(this);
cameraDevicesGroup->setExclusive(true);
try {
CTlFactory& tlFactory = CTlFactory::GetInstance();
// Get all attached devices.
DeviceInfoList_t devices;
if (tlFactory.EnumerateDevices(devices) == 0) {
QString status = QString("No camera present.");
ui->statusBar->showMessage(status);
}
// Create an array of instant cameras for the found devices and avoid exceeding a maximum number of devices.
CInstantCameraArray cameras(min(devices.size(), c_maxCamerasToSee));
for (size_t i = 0; i < cameras.GetSize(); ++i) {
cameras[i].Attach(tlFactory.CreateDevice(devices[i]));
QAction *cameraDeviceAction = new QAction((QString)cameras[i].GetDeviceInfo().GetModelName(), cameraDevicesGroup);
cameraDeviceAction->setCheckable(true);
cameraDeviceAction->setData(QVariant::fromValue(cameras[i].GetDeviceInfo()));
if (i == 0) {
cameraDeviceAction->setChecked(true);
// Set as default camera and enable some UI elements
if (setCamera(cameras[i].GetDeviceInfo())) {
ui->delayLineEdit->setEnabled(true);
ui->numPhotoLineEdit->setEnabled(true);
ui->startButton->setEnabled(true);
}
}
ui->menuCamera->addAction(cameraDeviceAction);
}
} catch (GenICam::GenericException &e) {
QString status = QString("An exception occurred: %1").arg((QString)e.GetDescription());
ui->statusBar->showMessage(status);
}
connect(cameraDevicesGroup, SIGNAL(triggered(QAction*)), SLOT(updateCameraDevice(QAction*)));
}
示例11: SeisDoPrivate
SeisDoPrivate( SeisDo* me ) : m_self( me ) {
m_ui.setupUi( m_self );
QActionGroup* actionGroup = new QActionGroup( m_self );
actionGroup->addAction( m_ui.actionChinese );
actionGroup->addAction( m_ui.actionEnglish );
actionGroup->setExclusive( true );
}
示例12: rightClickMenu
QMenu* DragLabel::rightClickMenu()
{
if (!m_RightClickMenu) {
m_RightClickMenu = new QMenu(this);
QMenu* colorMenu = new QMenu("Color", this);
colorMenu->setIcon(QIcon(":/icons/color.svg"));
QActionGroup* colorGroup = new QActionGroup(this);
pRedColorAction = new QAction(QIcon(":/icons/red.svg"), tr("&Red"), this);
pRedColorAction->setCheckable(true);
if(currentColor()== Qt::red)
pRedColorAction->setChecked(true);
pOrangeColorAction = new QAction(QIcon(":/icons/orange.svg"), tr("&Orange"), this);
pOrangeColorAction->setCheckable(true);
if(currentColor() == QColor(254,154,46))
pOrangeColorAction->setChecked(true);
pGreenColorAction = new QAction(QIcon(":/icons/green.svg"), tr("&Green"), this);
pGreenColorAction->setCheckable(true);
if(currentColor()== Qt::green)
pGreenColorAction->setChecked(true);
pWhiteColorAction = new QAction(QIcon(":/icons/white.svg"), tr("&White"), this);
pWhiteColorAction->setCheckable(true);
if(currentColor()== Qt::white)
pWhiteColorAction->setChecked(true);
pGrayColorAction = new QAction(QIcon(":/icons/gray.svg"), tr("&Gray"), this);
pGrayColorAction->setCheckable(true);
if(currentColor()== Qt::lightGray)
pGrayColorAction->setChecked(true);
//group
colorGroup->addAction(pRedColorAction);
colorGroup->addAction(pOrangeColorAction);
colorGroup->addAction(pGreenColorAction);
colorGroup->addAction(pWhiteColorAction);
colorGroup->addAction(pGrayColorAction);
colorGroup->setExclusive(true);
connect(colorGroup,SIGNAL(triggered(QAction *)),this,SLOT(changeColorSlot(QAction*)));
//menu
colorMenu->addAction(pRedColorAction);
colorMenu->addAction(pOrangeColorAction);
colorMenu->addAction(pGreenColorAction);
colorMenu->addSeparator();
colorMenu->addAction(pWhiteColorAction);
colorMenu->addAction(pGrayColorAction);
QAction* pDeleteAction = new QAction(QIcon(":/icons/delete.svg"), tr("&Delete"), this);
connect(pDeleteAction,SIGNAL(triggered()),this,SLOT(deleteItemSlot()));
m_RightClickMenu->addMenu(colorMenu);
m_RightClickMenu->addAction(pDeleteAction);
}
示例13: QToolBar
EditToolBar::EditToolBar(QWidget* parent, int tools, const char*)
: QToolBar(tr("Edit Tools"), parent)
{
setObjectName("Edit Tools");
QActionGroup* action = new QActionGroup(parent); // Parent needed.
action->setExclusive(true);
nactions = 0;
for (unsigned i = 0; i < sizeof(toolList)/sizeof(*toolList); ++i) {
if ((tools & (1 << i))==0)
continue;
++nactions;
}
actions = new Action*[nactions];
bool first = true;
int n = 0;
for (unsigned i = 0; i < sizeof(toolList)/sizeof(*toolList); ++i) {
if ((tools & (1 << i))==0)
continue;
ToolB* t = &toolList[i];
Action* a = new Action(action, 1<<i, tr(t->tip).toLatin1().data(), true);
actions[n] = a;
//a->setIconSet(QIcon(**(t->icon)));
a->setIcon(QIcon(**(t->icon)));
a->setToolTip(tr(t->tip));
a->setWhatsThis(tr(t->ltip));
if (first) {
a->setChecked(true);
first = false;
}
++n;
}
action->setVisible(true);
//action->addTo(this);
// Note: Does not take ownership.
addActions(action->actions());
connect(action, SIGNAL(triggered(QAction*)), SLOT(toolChanged(QAction*)));
toolShortcuts[PointerTool] = SHRT_TOOL_CURSOR;
toolShortcuts[PencilTool] = SHRT_TOOL_PENCIL;
toolShortcuts[RubberTool] = SHRT_TOOL_RUBBER;
toolShortcuts[CutTool] = SHRT_TOOL_SCISSORS;
toolShortcuts[GlueTool] = SHRT_TOOL_GLUE;
toolShortcuts[RangeTool] = SHRT_TOOL_RANGE;
toolShortcuts[PanTool] = SHRT_TOOL_PAN;
toolShortcuts[ZoomTool] = SHRT_TOOL_ZOOM;
//toolShortcuts[ScoreTool] = SHRT_TOOL_
//toolShortcuts[QuantTool] = SHRT_TOOL_
toolShortcuts[DrawTool] = SHRT_TOOL_LINEDRAW;
toolShortcuts[MuteTool] = SHRT_TOOL_MUTE;
toolShortcuts[AutomationTool] = SHRT_TOOL_LINEDRAW;
toolShortcuts[CursorTool] = SHRT_TOOL_CURSOR;
}
示例14: if
UIVMPreviewWindow::UIVMPreviewWindow(QWidget *pParent)
: QIWithRetranslateUI<QWidget>(pParent)
, m_machineState(KMachineState_Null)
, m_pUpdateTimer(new QTimer(this))
, m_vMargin(10)
, m_pbgImage(0)
, m_pPreviewImg(0)
, m_pGlossyImg(0)
{
m_session.createInstance(CLSID_Session);
setContentsMargins(0, 5, 0, 5);
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
/* Connect the update timer */
connect(m_pUpdateTimer, SIGNAL(timeout()),
this, SLOT(sltRecreatePreview()));
/* Connect the machine state event */
connect(gVBoxEvents, SIGNAL(sigMachineStateChange(QString, KMachineState)),
this, SLOT(sltMachineStateChange(QString, KMachineState)));
/* Create the context menu */
setContextMenuPolicy(Qt::DefaultContextMenu);
m_pUpdateTimerMenu = new QMenu(this);
QActionGroup *pUpdateTimeG = new QActionGroup(this);
pUpdateTimeG->setExclusive(true);
for(int i = 0; i < UpdateEnd; ++i)
{
QAction *pUpdateTime = new QAction(pUpdateTimeG);
pUpdateTime->setData(i);
pUpdateTime->setCheckable(true);
pUpdateTimeG->addAction(pUpdateTime);
m_pUpdateTimerMenu->addAction(pUpdateTime);
m_actions[static_cast<UpdateInterval>(i)] = pUpdateTime;
}
m_pUpdateTimerMenu->insertSeparator(m_actions[static_cast<UpdateInterval>(Update500ms)]);
/* Default value */
UpdateInterval interval = Update1000ms;
QString strInterval = vboxGlobal().virtualBox().GetExtraData(VBoxDefs::GUI_PreviewUpdate);
if (strInterval == "disabled")
interval = UpdateDisabled;
else if (strInterval == "500")
interval = Update500ms;
else if (strInterval == "1000")
interval = Update1000ms;
else if (strInterval == "2000")
interval = Update2000ms;
else if (strInterval == "5000")
interval = Update5000ms;
else if (strInterval == "10000")
interval = Update10000ms;
/* Initialize with the new update interval */
setUpdateInterval(interval, false);
/* Retranslate the UI */
retranslateUi();
}
示例15: QDialog
ImportHandler::ImportHandler( QWidget *parent ) : QDialog( parent ), ui( new Ui::ImportHandlerClass )
{
itemModel = NULL;
spriteModel = NULL;
pictureModel = NULL;
ui->setupUi( this );
destItems = NULL;
destOutfits = NULL;
destEffects = NULL;
destProjectiles = NULL;
QMenu *menu = new QMenu( ui->buttonDestination );
QActionGroup* actionGroup = new QActionGroup( menu );
actionGroup->setExclusive( true );
destItems = actionGroup->addAction( tr( "Items" ) );
destOutfits = actionGroup->addAction( tr( "Outfits" ) );
destEffects = actionGroup->addAction( tr( "Effects" ) );
destProjectiles = actionGroup->addAction( tr( "Projectiles" ) );
destItems->setCheckable( true );
destOutfits->setCheckable( true );
destEffects->setCheckable( true );
destProjectiles->setCheckable( true );
menu->addAction( destItems );
menu->addAction( destOutfits );
menu->addAction( destEffects );
menu->addAction( destProjectiles );
ui->buttonDestination->setMenu( menu );
actionDelete = new QAction( this );
actionDelete->setObjectName( QString::fromUtf8( "actionDelete" ) );
actionDelete->setEnabled( true );
QIcon icon;
icon.addPixmap( QPixmap( QString::fromUtf8( ":/TibiaEditor/Resources/minus.png" ) ), QIcon::Normal, QIcon::Off );
actionDelete->setIcon( icon );
actionDelete->setText( QApplication::translate("TibiaEditorClass", "Delete", 0, QApplication::UnicodeUTF8 ) );
actionDelete->setShortcut( QApplication::translate("TibiaEditorClass", "Del", 0, QApplication::UnicodeUTF8 ) );
addAction( actionDelete );
ui->buttonBox->button( QDialogButtonBox::Open )->setText( tr( "Open..." ) );
ui->buttonBox->button( QDialogButtonBox::Apply )->setText( tr( "Import" ) );
ui->buttonBox->button( QDialogButtonBox::Reset )->setText( tr( "Clear" ) );
if( g_tibiaHandler.getItemFile() ){
itemModel = new ItemModel( this );
itemModel->setDropMimeFormats( QStringList() << "text/uri-list" );
ui->itemObjectView->setModel( itemModel );
QObject::connect( itemModel, SIGNAL( decodeMimeDrop( const QMimeData *, int, const QModelIndex & ) ), this, SLOT( onDropFiles( const QMimeData *, int, const QModelIndex & ) ) );
}