static void navigateElevationMenu(int inputResult) { switch (inputResult) { case 1: // Go to elevation angle setMenu(ElGoto); break; case 2: // Set elevation minimum setMenu(ElMin); break; case 3: // Set elevation maximum setMenu(ElMax); break; case 4: if (m_userMode == FACTORY) { // Calibrate the elevation servo } else { m_currentMenu.returnToPrevious(); // Go back one level } break; case 5: if (m_userMode == FACTORY) { // Calibrate the elevation servo break; } // If not in factory mode, this is an error; default: if (m_userMode == FACTORY) errOutOfRange(1, 5); else errOutOfRange(1, 4); break; } }
void MainMenuBar::reload() { setMenu(NULL); // Reload all menus. AppMenus::instance()->reload(); setMenu(AppMenus::instance()->getRootMenu()); }
void BookmarkWidget::updateBookmark(BookmarksItem *bookmark) { if (bookmark != m_bookmark) { return; } const QString title(m_bookmark->data(BookmarksModel::TitleRole).toString().isEmpty() ? tr("(Untitled)") : m_bookmark->data(BookmarksModel::TitleRole).toString()); const BookmarksModel::BookmarkType type(static_cast<BookmarksModel::BookmarkType>(m_bookmark->data(BookmarksModel::TypeRole).toInt())); if (type == BookmarksModel::RootBookmark || type == BookmarksModel::TrashBookmark || type == BookmarksModel::FolderBookmark) { Menu *menu(new Menu(Menu::BookmarksMenuRole, this)); menu->menuAction()->setData(m_bookmark->index()); setPopupMode(QToolButton::InstantPopup); setToolTip(title); setMenu(menu); setEnabled(m_bookmark->rowCount() > 0); } else { QStringList toolTip; toolTip.append(tr("Title: %1").arg(title)); if (!m_bookmark->data(BookmarksModel::UrlRole).toString().isEmpty()) { toolTip.append(tr("Address: %1").arg(m_bookmark->data(BookmarksModel::UrlRole).toString())); } if (m_bookmark->data(BookmarksModel::DescriptionRole).isValid()) { toolTip.append(tr("Description: %1").arg(m_bookmark->data(BookmarksModel::DescriptionRole).toString())); } if (!m_bookmark->data(BookmarksModel::TimeAddedRole).toDateTime().isNull()) { toolTip.append(tr("Created: %1").arg(m_bookmark->data(BookmarksModel::TimeAddedRole).toDateTime().toString())); } if (!m_bookmark->data(BookmarksModel::TimeVisitedRole).toDateTime().isNull()) { toolTip.append(tr("Visited: %1").arg(m_bookmark->data(BookmarksModel::TimeVisitedRole).toDateTime().toString())); } setToolTip(QLatin1String("<div style=\"white-space:pre;\">") + toolTip.join(QLatin1Char('\n')) + QLatin1String("</div>")); setMenu(nullptr); } setText(title); setStatusTip(m_bookmark->data(BookmarksModel::UrlRole).toString()); setIcon(m_bookmark->data(Qt::DecorationRole).value<QIcon>()); }
void CustomColorButton::usePopupGrid(bool bGrid) { if (bGrid == true) { setMenu(mpMenu); setPopupMode(QToolButton::MenuButtonPopup); } else { setMenu(NULL); setPopupMode(QToolButton::DelayedPopup); } }
UserList::UserList(QWidget *parent) : UserListBase(parent) { m_bInit = true; setMenu(0); fill(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), localServer(0) { QPixmapCache::setCacheLimit(200000); client = new RemoteClient; connect(client, SIGNAL(connectionClosedEventReceived(const Event_ConnectionClosed &)), this, SLOT(processConnectionClosedEvent(const Event_ConnectionClosed &))); connect(client, SIGNAL(serverShutdownEventReceived(const Event_ServerShutdown &)), this, SLOT(processServerShutdownEvent(const Event_ServerShutdown &))); connect(client, SIGNAL(loginError(Response::ResponseCode, QString, quint32)), this, SLOT(loginError(Response::ResponseCode, QString, quint32))); connect(client, SIGNAL(socketError(const QString &)), this, SLOT(socketError(const QString &))); connect(client, SIGNAL(serverTimeout()), this, SLOT(serverTimeout())); connect(client, SIGNAL(statusChanged(ClientStatus)), this, SLOT(statusChanged(ClientStatus))); connect(client, SIGNAL(protocolVersionMismatch(int, int)), this, SLOT(protocolVersionMismatch(int, int))); connect(client, SIGNAL(userInfoChanged(const ServerInfo_User &)), this, SLOT(userInfoReceived(const ServerInfo_User &)), Qt::BlockingQueuedConnection); clientThread = new QThread(this); client->moveToThread(clientThread); clientThread->start(); createActions(); createMenus(); tabSupervisor = new TabSupervisor(client); connect(tabSupervisor, SIGNAL(setMenu(QList<QMenu *>)), this, SLOT(updateTabMenu(QList<QMenu *>))); connect(tabSupervisor, SIGNAL(localGameEnded()), this, SLOT(localGameEnded())); tabSupervisor->addDeckEditorTab(0); setCentralWidget(tabSupervisor); retranslateUi(); resize(900, 700); restoreGeometry(settingsCache->getMainWindowGeometry()); aFullScreen->setChecked(windowState() & Qt::WindowFullScreen); }
QgsColorButton::QgsColorButton( QWidget *parent, const QString &cdt, QgsColorSchemeRegistry *registry ) : QToolButton( parent ) , mBehavior( QgsColorButton::ShowDialog ) , mColorDialogTitle( cdt.isEmpty() ? tr( "Select Color" ) : cdt ) , mColor( QColor() ) , mDefaultColor( QColor() ) //default to invalid color , mAllowOpacity( false ) , mAcceptLiveUpdates( true ) , mColorSet( false ) , mShowNoColorOption( false ) , mNoColorString( tr( "No color" ) ) , mShowNull( false ) , mPickingColor( false ) , mMenu( nullptr ) { //if a color scheme registry was specified, use it, otherwise use the global instance mColorSchemeRegistry = registry ? registry : QgsApplication::colorSchemeRegistry(); setAcceptDrops( true ); setMinimumSize( QSize( 24, 16 ) ); connect( this, &QAbstractButton::clicked, this, &QgsColorButton::buttonClicked ); //setup dropdown menu mMenu = new QMenu( this ); connect( mMenu, &QMenu::aboutToShow, this, &QgsColorButton::prepareMenu ); setMenu( mMenu ); setPopupMode( QToolButton::MenuButtonPopup ); }
servercontroller::servercontroller /*FOLD00*/ ( QWidget*, const char* name ) : KTopLevelWidget( name ) { MenuBar = new("KMenuBar") KMenuBar(this, QString(name) + "_menu"); setMenu(MenuBar); if(kSircConfig->DisplayMode == 0){ SDI: displayMgr = new("DisplayMgrSDI") DisplayMgrSDI(); sci = new("scInside") scInside(this, QString(name) + "_mainview"); setView(sci, TRUE); } else if(kSircConfig->DisplayMode == 1){ DisplayMgrMDI *displayMgrMDI = new("DisplayMgrMDI") DisplayMgrMDI(this); sci = new("scInside") scInside(this, QString(name) + "_mainview"); displayMgrMDI->newTopLevel(sci, TRUE); displayMgrMDI->setCaption(sci, "Server Controller"); KMDIMgrBase *mgr = (KMDIMgrBase *)displayMgrMDI->getMGR(); KMDIWindow *km = mgr->getWindowByName((char *) sci->name()); if(km != 0) connect(km, SIGNAL(minimized(KMDIWindow *)), this, SLOT(MDIMinimized(KMDIWindow *))); else
UIActionMenu::UIActionMenu(QObject *pParent, const QIcon &icon) : UIAction(pParent, UIActionType_Menu) { if (!icon.isNull()) setIcon(icon); setMenu(new UIMenu); }
MenuButtonWidget::MenuButtonWidget(const ToolBarsManager::ToolBarDefinition::Entry &definition, QWidget *parent) : ToolButtonWidget(definition, parent), m_menu(new Menu(Menu::NoMenuRole, this)), m_isHidden(false) { setIcon(ThemesManager::createIcon(QLatin1String("otter-browser"), false)); setText(definition.options.value(QLatin1String("text"), tr("Menu")).toString()); setMenu(m_menu); setPopupMode(QToolButton::InstantPopup); setButtonStyle(Qt::ToolButtonTextBesideIcon); handleActionsStateChanged({ActionsManager::ShowToolBarAction}); const MainWindow *mainWindow(MainWindow::findMainWindow(this)); const ToolBarWidget *toolBar(qobject_cast<ToolBarWidget*>(parent)); if (mainWindow) { connect(mainWindow, &MainWindow::arbitraryActionsStateChanged, this, &MenuButtonWidget::handleActionsStateChanged); } if (toolBar) { disconnect(toolBar, &ToolBarWidget::buttonStyleChanged, this, &MenuButtonWidget::setButtonStyle); } connect(m_menu, &Menu::aboutToShow, this, &MenuButtonWidget::updateMenu); }
wxQtAction::wxQtAction( wxMenu *parent, int id, const wxString &text, const wxString &help, wxItemKind kind, wxMenu *subMenu, wxMenuItem *handler ) : QAction( wxQtConvertString( text ), parent->GetHandle() ), wxQtSignalHandler< wxMenuItem >( handler ) { setStatusTip( wxQtConvertString( help )); if ( subMenu != NULL ) setMenu( subMenu->GetHandle() ); if ( id == wxID_SEPARATOR ) setSeparator( true ); switch ( kind ) { case wxITEM_SEPARATOR: setSeparator( true ); break; case wxITEM_CHECK: case wxITEM_RADIO: setCheckable( true ); break; case wxITEM_NORMAL: // Normal for a menu item. break; case wxITEM_DROPDOWN: case wxITEM_MAX: // Not applicable for menu items. break; } connect( this, &QAction::triggered, this, &wxQtAction::onActionTriggered ); }
void clearCompare(void) { if (pCurHexEdit->GetHexProp().pCmpResult->hFile != NULL) { pCurHexEdit->SetCompareResult(NULL); setMenu(); } }
void toggleHexEdit(void) { GetShortCuts(nppData._nppHandle); pCurHexEdit->doDialog(TRUE); DialogUpdate(); setMenu(); }
UIMenuAction::UIMenuAction(QObject *pParent, const QIcon &icon) : UIActionInterface(pParent, UIActionType_Menu) { if (!icon.isNull()) setIcon(icon); setMenu(new UIMenuInterface); }
void TopLevel::setupMenuBar() { file = new QPopupMenu(); options = new QPopupMenu(); file->insertItem(klocale->translate("E&xit"), KApplication::getKApplication(), SLOT(quit())); options->setCheckable(TRUE); swallowID = options->insertItem(klocale->translate("&Swallow modules"), this, SLOT(swallowChanged())); QPopupMenu *helpMenu = kapp->getHelpMenu(true, klocale->translate("KDE Control Center - " "Version 1.0\n\n" "Written by Matthias Hölzer\n" "([email protected])\n\n" "Thanks to:\n" "S. Kulow, P. Dowler, M. Wuebben & M. Jones.")); menubar = new KMenuBar(this); menubar->insertItem(klocale->translate("&File"), file); menubar->insertItem(klocale->translate("&Options"), options); menubar->insertSeparator(-1); menubar->insertItem(klocale->translate("&Help"), helpMenu); setMenu(menubar); }
TopWidget::TopWidget() : KTopLevelWidget("") { // scan command line args for "-kppp" bool kpppmode = FALSE; for(int i = 1; i < kapp->argc(); i++) if(strcmp(kapp->argv()[i], "-kppp") == 0) kpppmode = TRUE; setCaption(i18n("kPPP log viewer")); td = new QTabDialog(this, "", FALSE); // remove buttons if(!kpppmode) { td->setOkButton(0); td->setCancelButton(0); // create menu mb = new KMenuBar(this); fm = new QPopupMenu; fm->insertItem(i18n("E&xit"), F_EXIT); mb->insertItem(i18n("&File"), fm); setMenu(mb); mb->setAccel(CTRL + Key_X, F_EXIT); connect(mb, SIGNAL(activated(int)), this, SLOT(menuCallback(int))); } else {
/* UIActionMenu stuff: */ UIActionMenu::UIActionMenu(QObject *pParent, const QString &strIcon, const QString &strIconDis) : UIAction(pParent, UIActionType_Menu) { if (!strIcon.isNull()) setIcon(UIIconPool::iconSet(strIcon, strIconDis)); setMenu(new UIMenu); }
LocationEditor::LocationEditor(QWidget *parent) : QToolButton(parent) { QPalette pal; pal.setColor(backgroundRole(), QPalette::Base); setPalette(pal); this->setFont(global.getGuiFont(font())); inactiveColor = "QToolButton {background-color: transparent; border-radius: 0px; border:none; margin 0px; padding: 4px} "; this->setCursor(Qt::PointingHandCursor); this->setStyleSheet(inactiveColor); defaultText = QString(tr("Click to set location...")); this->setText(defaultText); actionMenu = new QMenu(); editAction = actionMenu->addAction(tr("Edit...")); clearAction = actionMenu->addAction(tr("Clear")); viewAction = actionMenu->addAction(tr("View on map")); connect(editAction, SIGNAL(triggered()), this, SLOT(buttonClicked())); connect(viewAction, SIGNAL(triggered()), this, SLOT(viewClicked())); connect(clearAction, SIGNAL(triggered()), this, SLOT(clearClicked())); setAutoRaise(false); setMenu(actionMenu); this->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); this->reloadIcons(); connect(this, SIGNAL(clicked()), this, SLOT(buttonClicked())); hide(); }
void Menu::selectMenu() { int menu_sel; while (true) { cout << endl; cout << "(프로그램을 종료하시려면 -1을 입력해주세요.) \n무슨 함수를 실행해보시겠습니까? "; try { cin >> menu_sel; } catch (...) { cout << "이상한거 입력하지마라.. " << endl; } if (menu_sel < MENU_LIST || menu_sel > GCD) { if (menu_sel == -1) { cout << "프로그램을 종료합니다." << endl; break; } cout << "잘못 입력하셨습니다." << endl; } else { setMenu((MENU_CL)menu_sel); cout << "\n함수를 실행합니다." << endl; executeAlgorithm((MENU_CL)menu_sel); } } }
QgsColorButton::QgsColorButton( QWidget *parent, const QString &cdt, QgsColorSchemeRegistry *registry ) : QToolButton( parent ) , mColorDialogTitle( cdt.isEmpty() ? tr( "Select Color" ) : cdt ) , mNoColorString( tr( "No color" ) ) { //if a color scheme registry was specified, use it, otherwise use the global instance mColorSchemeRegistry = registry ? registry : QgsApplication::colorSchemeRegistry(); setAcceptDrops( true ); setMinimumSize( QSize( 24, 16 ) ); connect( this, &QAbstractButton::clicked, this, &QgsColorButton::buttonClicked ); //setup drop-down menu mMenu = new QMenu( this ); connect( mMenu, &QMenu::aboutToShow, this, &QgsColorButton::prepareMenu ); setMenu( mMenu ); setPopupMode( QToolButton::MenuButtonPopup ); #ifdef Q_OS_WIN mMinimumSize = QSize( 120, 22 ); #else mMinimumSize = QSize( 120, 28 ); #endif mMinimumSize.setHeight( std::max( static_cast<int>( fontMetrics().height() * 1.1 ), mMinimumSize.height() ) ); }
Game::Game() : KTopLevelWidget() { setCaption( kapp->getCaption() ); setIcon(klocale->translate("Snake Race")); conf = kapp->getConfig(); if(conf == NULL) { printf(klocale->translate("KConfig error ??\n")); kapp->quit(); } levels = new Levels(); score = new Score; menu(); checkMenuItems(); View *view = new View(this); rattler = view->rattler; rattler->setFocus(); connect(rattler, SIGNAL(setPoints(int)), view->lcd, SLOT(display(int))); connect(rattler, SIGNAL(setTrys(int)), view->trys, SLOT(set(int))); connect(rattler, SIGNAL(rewind()), view->pg, SLOT(rewind())); connect(rattler, SIGNAL(advance()), view->pg, SLOT(advance())); connect(view->pg, SIGNAL(restart()), rattler, SLOT(restartTimer())); connect(rattler, SIGNAL(togglePaused()), this, SLOT(togglePaused())); connect(rattler, SIGNAL(setScore(int)), score, SLOT(setScore(int))); menubar->show(); setMenu(menubar); view->show(); setView(view); }
void ActionButton::onActionChanged() { if (FAction) { setIcon(FAction->icon()); setText(FAction->text()); setMenu(FAction->menu()); } else { setIcon(QIcon()); setText(QString::null); setMenu(NULL); } emit buttonChanged(); }
VolumeButton::VolumeButton(QWidget *parent) : QToolButton(parent), menu(0), label(0), slider(0) { setIcon(style()->standardIcon(QStyle::SP_MediaVolume)); setPopupMode(QToolButton::InstantPopup); QWidget *popup = new QWidget(this); slider = new QSlider(Qt::Horizontal, popup); slider->setRange(0, 100); connect(slider, SIGNAL(valueChanged(int)), this, SIGNAL(volumeChanged(int))); label = new QLabel(popup); label->setAlignment(Qt::AlignCenter); label->setNum(100); label->setMinimumWidth(label->sizeHint().width()); connect(slider, SIGNAL(valueChanged(int)), label, SLOT(setNum(int))); QBoxLayout *popupLayout = new QHBoxLayout(popup); popupLayout->setMargin(2); popupLayout->addWidget(slider); popupLayout->addWidget(label); QWidgetAction *action = new QWidgetAction(this); action->setDefaultWidget(popup); menu = new QMenu(this); menu->addAction(action); setMenu(menu); stylize(); }
OutPatternButton::OutPatternButton(QWidget * parent): QToolButton(parent) { setPopupMode(QToolButton::InstantPopup); setMenu(new QMenu(this)); mSeparator = menu()->addSeparator(); }
UIGuestOSTypeSelectionButton::UIGuestOSTypeSelectionButton(QWidget *pParent) : QIWithRetranslateUI<QPushButton>(pParent) { /* Determine icon metric: */ const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize); setIconSize(QSize(iIconMetric, iIconMetric)); /* We have to make sure that the button has strong focus, otherwise * the editing is ended when the menu is shown: */ setFocusPolicy(Qt::StrongFocus); /* Create a signal mapper so that we not have to react to * every single menu activation ourself: */ m_pSignalMapper = new QSignalMapper(this); if (m_pSignalMapper) connect(m_pSignalMapper, static_cast<void(QSignalMapper::*)(const QString &)>(&QSignalMapper::mapped), this, &UIGuestOSTypeSelectionButton::setOSTypeId); /* Create main menu: */ m_pMainMenu = new QMenu(pParent); if (m_pMainMenu) setMenu(m_pMainMenu); /* Apply language settings: */ retranslateUi(); }
void StatusButton::setUserMenu(QMenu *menu) { setMenu(menu); connect(menu, SIGNAL(aboutToShow()), this, SLOT(onMenuAboutToShow())); connect(menu, SIGNAL(aboutToHide()), this, SLOT(onMenuAboutToHide())); }
void PHIAComboButton::setItems( const QStringList &list, int selected ) { if ( _popup ) delete _popup; _popup=new QMenu(); QActionGroup *group=new QActionGroup( _popup ); group->setExclusive( true ); QList <QAction*> actions; for ( int i=0; i<list.count();i++ ) { QAction *action=new QAction( list.at( i ), 0 ); action->setCheckable( true ); action->setData( i ); group->addAction( action ); if ( i==selected ) action->setChecked( true ); actions << action; } _popup->addActions( actions ); _popup->setMinimumWidth( 100 ); if ( actions.count() > selected ) setDefaultAction( actions.at( selected ) ); setMenu( _popup ); connect( _popup, SIGNAL( triggered( QAction* ) ), this, SIGNAL( selectedAction( QAction* ) ) ); }
QgsColorButtonV2::QgsColorButtonV2( QWidget *parent, QString cdt, QColorDialog::ColorDialogOptions cdo, QgsColorSchemeRegistry* registry ) : QToolButton( parent ) , mBehaviour( QgsColorButtonV2::ShowDialog ) , mColorDialogTitle( cdt.isEmpty() ? tr( "Select Color" ) : cdt ) , mColor( QColor() ) , mDefaultColor( QColor() ) //default to invalid color , mColorDialogOptions( cdo ) , mAcceptLiveUpdates( true ) , mColorSet( false ) , mShowNoColorOption( false ) , mNoColorString( tr( "No color" ) ) , mPickingColor( false ) , mMenu( 0 ) { //if a color scheme registry was specified, use it, otherwise use the global instance mColorSchemeRegistry = registry ? registry : QgsColorSchemeRegistry::instance(); setAcceptDrops( true ); setMinimumSize( QSize( 24, 16 ) ); connect( this, SIGNAL( clicked() ), this, SLOT( buttonClicked() ) ); //setup dropdown menu mMenu = new QMenu( this ); connect( mMenu, SIGNAL( aboutToShow() ), this, SLOT( prepareMenu() ) ); setMenu( mMenu ); setPopupMode( QToolButton::MenuButtonPopup ); }
KisMouseInputEditor::KisMouseInputEditor(QWidget *parent) : KPushButton(parent), d(new Private) { QWidget *popup = new QWidget(); d->ui = new Ui::KisMouseInputEditor; d->ui->setupUi(popup); d->ui->mouseButton->setType(KisInputButton::MouseType); d->ui->clearModifiersButton->setIcon(KisIconUtils::loadIcon("edit-clear")); d->ui->clearMouseButton->setIcon(KisIconUtils::loadIcon("edit-clear")); QWidgetAction *action = new QWidgetAction(this); action->setDefaultWidget(popup); QMenu *menu = new QMenu(this); menu->addAction(action); setMenu(menu); QTimer::singleShot(0, this, SLOT(showMenu())); connect(d->ui->mouseButton, SIGNAL(dataChanged()), SLOT(updateLabel())); connect(d->ui->modifiersButton, SIGNAL(dataChanged()), SLOT(updateLabel())); connect(d->ui->clearMouseButton, SIGNAL(clicked(bool)), d->ui->mouseButton, SLOT(clear())); connect(d->ui->clearModifiersButton, SIGNAL(clicked(bool)), d->ui->modifiersButton, SLOT(clear())); }
void Action::setMenu(Menu *menu) { FCITX_D(); if (menu) { menu->connect<DynamicTrackableObject::Destroyed>([this](void *) { setMenu(nullptr); }); } d->menu_ = menu; }