本文整理汇总了C++中QMenuBar类的典型用法代码示例。如果您正苦于以下问题:C++ QMenuBar类的具体用法?C++ QMenuBar怎么用?C++ QMenuBar使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QMenuBar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
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;
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);
widget = new QWidget(mainwindow);
widget->setObjectName("tableWidget");
layout = new QVBoxLayout();
layout->addWidget(mainwindow->contentTableWidget());
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));
editSearchAction = editMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_EDIT_SEARCH), mainwindow->searchLineEdit(), SLOT(setFocus()));
editSearchAction->setShortcut(QKeySequence::Find);
viewMenu = menu->addMenu(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW));
viewClosedDocksMenu = viewMenu->addMenu(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_CLOSED_DOCKS));
viewClosedDocksMenu->setObjectName("viewClosedDocksMenu");
QObject::connect(viewClosedDocksMenu, SIGNAL(aboutToShow()), mainwindow, SLOT(onViewClosedDocksAboutToShow()));
viewMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS), mainwindow->viewOptionsDialog(), SLOT(showDialog()));
playlistWidget = new QWidget();
playlistWidget->setLayout(new QVBoxLayout());
//.........这里部分代码省略.........
示例2: QMainWindow
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
// Setup this MainWindow with the parameters mainwindow.ui:
// Definition of size, creation of widgets inside etc..
ui->setupUi(this);
// Retrieve pointers of widgets already created by the up operation
// Those who will be used again outside the creator are saved at class variables
QMenuBar * menuBar = ui->menuBar;
QSlider *slider_color = ui->verticalSlider;
QSlider *slider_style = ui->verticalSlider_2;
QToolBar * toolbar = ui->toolBar;
mydrawzone = ui->widget;
// Declaration of menus and adition inside menubar
QMenu * openMenu = menuBar->addMenu( tr("&Open"));
QMenu * saveMenu = menuBar->addMenu( tr("&Save"));
QMenu * quitMenu = menuBar->addMenu( tr("&Quit"));
QMenu * penMenu = menuBar->addMenu( tr("&Pen Settings"));
QMenu * colorMenu = menuBar->addMenu( tr("&Color Settings"));
QMenu * styleMenu = menuBar->addMenu( tr("&Style Settings"));
QMenu * formMenu = menuBar->addMenu( tr("&Form Settings"));
// Declaration of principal actions
// Those that will be shown at the toolbar
QAction * openAction = new QAction( QIcon(":/icons/open.png"), tr("&Open"), this);
QAction * saveAction = new QAction( QIcon(":/icons/save.png"), tr("&Save"), this);
QAction * quitAction = new QAction( QIcon(":/icons/quit.png"), tr("&Quit"), this);
QAction * paintAction = new QAction( QIcon(":/icons/paint.png"), tr("&Paint"), this);
QAction * editAction = new QAction( QIcon(":/icons/edit.png"), tr("&Edit"), this);
QAction * moveAction = new QAction( QIcon(":/icons/move.png"), tr("&Edit"), this);
// Declaration of some other actions
// Those that will have shortcuts as well but wont be shown in the toolbar
QAction *set_pen_color =new QAction(tr("Alternate Color Pen"), this);
QAction *set_pen_width_larger =new QAction(tr("&Pen Width +"), this);
QAction *set_pen_width_shorter =new QAction(tr("&Pen Width -"), this);
QAction *set_pen_style =new QAction(tr("&Alternate Style Pen"), this);
QAction *set_figure_form =new QAction(tr("&Alternate Figure Form"), this);
QAction *undo =new QAction(tr("&Undo"), this);
// Declaration of action groups
// The pointers for the actions are saved inside class variables
// to be used outside the class creator
QActionGroup *action_group_color = new QActionGroup(this);
color0 = action_group_color->addAction(tr("Black Pen"));
color1 = action_group_color->addAction(tr("White Pen"));
color2 = action_group_color->addAction(tr("Dark Gray Pen"));
color3 = action_group_color->addAction(tr("Gray Pen"));
color4 = action_group_color->addAction(tr("Light Gray Pen"));
color5 = action_group_color->addAction(tr("Red Pen"));
color6 = action_group_color->addAction(tr("Green Pen"));
color7 = action_group_color->addAction(tr("Blue Pen"));
color8 = action_group_color->addAction(tr("Cyan Pen"));
color9 = action_group_color->addAction(tr("Magenta Pen"));
color10 = action_group_color->addAction(tr("Yellow Pen"));
color11 = action_group_color->addAction(tr("Dark Red Pen"));
color12 = action_group_color->addAction(tr("Dark Green Pen"));
color13 = action_group_color->addAction(tr("Dark Blue Pen"));
color14 = action_group_color->addAction(tr("Dark Cyan Pen"));
color15 = action_group_color->addAction(tr("Dark Magenta Pen"));
color16 = action_group_color->addAction(tr("Dark Yellow Pen"));
color17 = action_group_color->addAction(tr("Transparent"));
QActionGroup *action_group_style = new QActionGroup(this);
style0 = action_group_style->addAction(tr("Solid Pen"));
style1 = action_group_style->addAction(tr("Dash Line Pen"));
style2 = action_group_style->addAction(tr("Dot Line Pen"));
style3 = action_group_style->addAction(tr("Dash dot Line Pen"));
style4 = action_group_style->addAction(tr("Dash Dot Dot Line Pen"));
style5 = action_group_style->addAction(tr("Custom Dash Line Pen"));
QActionGroup *action_group_form = new QActionGroup(this);
form0 = action_group_form->addAction(tr("Line Form"));
form1 = action_group_form->addAction(tr("Rectangle Form"));
form2 = action_group_form->addAction(tr("Elipse Form"));
// Adition of shortcuts for principal actions
openAction->setShortcut( tr("Ctrl+O"));
saveAction->setShortcut( tr("Ctrl+S"));
quitAction->setShortcut( tr("Ctrl+Q"));
paintAction->setShortcut( tr("Ctrl+P"));
editAction->setShortcut( tr("Ctrl+E"));
moveAction->setShortcut( tr("Ctrl+M"));
// Adition of shortcuts for those other actions
set_pen_color->setShortcut( tr("Ctrl+C"));
set_pen_style->setShortcut( tr("Ctrl+Space"));
set_pen_width_larger->setShortcut( tr("Ctrl++"));
set_pen_width_shorter->setShortcut( tr("Ctrl+-"));
set_figure_form->setShortcut( tr("Ctrl+F"));
undo->setShortcut(tr ("Ctrl+Z"));
// Adition of tool tips for principal actions
openAction->setToolTip( tr("Open file"));
saveAction->setToolTip( tr("Save file"));
quitAction->setToolTip( tr("Quit file"));
//.........这里部分代码省略.........
示例3: resize
void ProgramWindow::setup()
{
if (parentWidget() == NULL) {
resize(500,700);
setAttribute(Qt::WA_DeleteOnClose, true);
}
QFrame * mainFrame = new QFrame(this);
QFrame * headerFrame = createHeader();
QFrame * centerFrame = createCenter();
layout()->setMargin(0);
layout()->setSpacing(0);
QGridLayout *layout = new QGridLayout(mainFrame);
layout->setMargin(0);
layout->setSpacing(0);
layout->addWidget(headerFrame,0,0);
layout->addWidget(centerFrame,1,0);
setCentralWidget(mainFrame);
setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
QSettings settings;
if (!settings.value("programwindow/state").isNull()) {
restoreState(settings.value("programwindow/state").toByteArray());
}
if (!settings.value("programwindow/geometry").isNull()) {
restoreGeometry(settings.value("programwindow/geometry").toByteArray());
}
installEventFilter(this);
// Setup new menu bar for the programming window
QMenuBar * menubar = NULL;
if (parentWidget()) {
QMainWindow * mainWindow = qobject_cast<QMainWindow *>(parentWidget());
if (mainWindow) menubar = mainWindow->menuBar();
}
if (menubar == NULL) menubar = menuBar();
m_fileMenu = menubar->addMenu(tr("&File"));
QAction *currentAction = new QAction(tr("New Code File"), this);
currentAction->setShortcut(tr("Ctrl+N"));
currentAction->setStatusTip(tr("Create a new program"));
connect(currentAction, SIGNAL(triggered()), this, SLOT(addTab()));
m_fileMenu->addAction(currentAction);
currentAction = new QAction(tr("&Open Code File..."), this);
currentAction->setShortcut(tr("Ctrl+O"));
currentAction->setStatusTip(tr("Open a program"));
connect(currentAction, SIGNAL(triggered()), this, SLOT(loadProgramFile()));
m_fileMenu->addAction(currentAction);
m_fileMenu->addSeparator();
m_saveAction = new QAction(tr("&Save Code File"), this);
m_saveAction->setShortcut(tr("Ctrl+S"));
m_saveAction->setStatusTip(tr("Save the current program"));
connect(m_saveAction, SIGNAL(triggered()), this, SLOT(save()));
m_fileMenu->addAction(m_saveAction);
currentAction = new QAction(tr("Rename Code File"), this);
currentAction->setStatusTip(tr("Rename the current program"));
connect(currentAction, SIGNAL(triggered()), this, SLOT(rename()));
m_fileMenu->addAction(currentAction);
currentAction = new QAction(tr("Duplicate tab"), this);
currentAction->setStatusTip(tr("Copies the current program into a new tab"));
connect(currentAction, SIGNAL(triggered()), this, SLOT(duplicateTab()));
m_fileMenu->addAction(currentAction);
m_fileMenu->addSeparator();
currentAction = new QAction(tr("Remove tab"), this);
currentAction->setShortcut(tr("Ctrl+W"));
currentAction->setStatusTip(tr("Remove the current program from the sketch"));
connect(currentAction, SIGNAL(triggered()), this, SLOT(closeCurrentTab()));
m_fileMenu->addAction(currentAction);
m_fileMenu->addSeparator();
m_printAction = new QAction(tr("&Print..."), this);
m_printAction->setShortcut(tr("Ctrl+P"));
m_printAction->setStatusTip(tr("Print the current program"));
connect(m_printAction, SIGNAL(triggered()), this, SLOT(print()));
m_fileMenu->addAction(m_printAction);
m_fileMenu->addSeparator();
currentAction = new QAction(tr("&Quit"), this);
currentAction->setShortcut(tr("Ctrl+Q"));
currentAction->setStatusTip(tr("Quit the application"));
currentAction->setMenuRole(QAction::QuitRole);
connect(currentAction, SIGNAL(triggered()), qApp, SLOT(closeAllWindows2()));
m_fileMenu->addAction(currentAction);
//.........这里部分代码省略.........
示例4: QMainWindow
DrawPad::DrawPad(QWidget* parent, const char* name, WFlags /*fl*/ )
: QMainWindow(parent, name, WStyle_ContextHelp)
{
// init members
connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)),
this, SLOT(slotAppMessage(const QCString&, const QByteArray&)) );
m_pDrawPadCanvas = new DrawPadCanvas(this, this);
connect(m_pDrawPadCanvas, SIGNAL(pagesChanged()), this, SLOT(updateView()));
setCentralWidget(m_pDrawPadCanvas);
// init menu
setToolBarsMovable(false);
QToolBar* menuToolBar = new QToolBar(this);
QMenuBar* menuBar = new QMenuBar(menuToolBar);
QPopupMenu* toolsPopupMenu = new QPopupMenu(menuBar);
QAction* deleteAllAction = new QAction(tr("Delete All"), QString::null, 0, this);
connect(deleteAllAction, SIGNAL(activated()), this, SLOT(deleteAll()));
deleteAllAction->addTo(toolsPopupMenu);
toolsPopupMenu->insertSeparator();
QAction* importPageAction = new QAction(tr("Import"), tr("Import..."), 0, this);
connect(importPageAction, SIGNAL(activated()), this, SLOT(importPage()));
importPageAction->addTo(toolsPopupMenu);
QAction* exportPageAction = new QAction(tr("Export"), tr("Export..."), 0, this);
connect(exportPageAction, SIGNAL(activated()), this, SLOT(exportPage()));
exportPageAction->addTo(toolsPopupMenu);
toolsPopupMenu->insertSeparator();
QAction* thumbnailViewAction = new QAction(tr("Thumbnail View"), tr("Thumbnail View..."), 0, this);
connect(thumbnailViewAction, SIGNAL(activated()), this, SLOT(thumbnailView()));
thumbnailViewAction->addTo(toolsPopupMenu);
QAction* pageInformationAction = new QAction(tr("Page Information"), tr("Page Information..."), 0, this);
connect(pageInformationAction, SIGNAL(activated()), this, SLOT(pageInformation()));
pageInformationAction->addTo(toolsPopupMenu);
toolsPopupMenu->insertSeparator();
m_pAntiAliasingAction = new QAction(tr("Anti-Aliasing"), QString::null, 0, this);
m_pAntiAliasingAction->setToggleAction(true);
m_pAntiAliasingAction->addTo(toolsPopupMenu);
menuBar->insertItem(tr("Tools"), toolsPopupMenu);
// init page toolbar
QToolBar* pageToolBar = new QToolBar(this);
QAction* newPageAction = new QAction(tr("New Page"), Opie::Core::OResource::loadPixmap("new", Opie::Core::OResource::SmallIcon),
QString::null, 0, this);
connect(newPageAction, SIGNAL(activated()), this, SLOT(newPage()));
newPageAction->addTo(pageToolBar);
newPageAction->setWhatsThis( tr( "Click here to add a new sheet." ) );
QAction* clearPageAction = new QAction(tr("Clear Page"),
Opie::Core::OResource::loadPixmap("drawpad/clear", Opie::Core::OResource::SmallIcon),
QString::null, 0, this);
connect(clearPageAction, SIGNAL(activated()), this, SLOT(clearPage()));
clearPageAction->addTo(pageToolBar);
clearPageAction->setWhatsThis( tr( "Click here to erase the current sheet." ) );
QAction* deletePageAction = new QAction(tr("Delete Page"),
Opie::Core::OResource::loadPixmap("trash", Opie::Core::OResource::SmallIcon),
QString::null, 0, this);
connect(deletePageAction, SIGNAL(activated()), this, SLOT(deletePage()));
deletePageAction->addTo(pageToolBar);
deletePageAction->setWhatsThis( tr( "Click here to remove the current sheet." ) );
QToolBar* emptyToolBar = new QToolBar(this);
emptyToolBar->setHorizontalStretchable(true);
// init navigation toolbar
QToolBar* navigationToolBar = new QToolBar(this);
m_pUndoAction = new QAction(tr("Undo"), Opie::Core::OResource::loadPixmap("undo", Opie::Core::OResource::SmallIcon),
QString::null, 0, this);
connect(m_pUndoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(undo()));
m_pUndoAction->addTo(navigationToolBar);
m_pUndoAction->setWhatsThis( tr( "Click here to undo the last action." ) );
m_pRedoAction = new QAction(tr("Redo"), Opie::Core::OResource::loadPixmap("redo", Opie::Core::OResource::SmallIcon),
QString::null, 0, this);
connect(m_pRedoAction, SIGNAL(activated()), m_pDrawPadCanvas, SLOT(redo()));
m_pRedoAction->addTo(navigationToolBar);
m_pRedoAction->setWhatsThis( tr( "Click here to re-perform the last action." ) );
m_pFirstPageAction = new QAction(tr("First Page"),
Opie::Core::OResource::loadPixmap("fastback", Opie::Core::OResource::SmallIcon),
QString::null, 0, this);
//.........这里部分代码省略.........
示例5: 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
示例6: setWindowIcon
void EditorMainWindow::SetupUI(QMainWindow *MainWindow) {
setWindowIcon(*QtConfig::GetIcon("colorwheel.png"));
MainWindow->setWindowTitle("Sound Engine v0.2.3");
MainWindow->resize(1280, 720);
MainWindow->setDockOptions(QMainWindow::AnimatedDocks |
QMainWindow::AllowNestedDocks |
QMainWindow::AllowTabbedDocks);
MainWindow->setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::TabPosition::North);
// ************************************************************************
// Load styling
ReloadStyleSheets();
// ************************************************************************
// File Picker
auto *picker = new FilePicker();
picker->setNameFilter("*.xml");
GUI::Set(QT_INSTACE::FILE_PICKER, (void*) picker);
// ************************************************************************
// Menu Bar
QMenuBar *menuBar = new QMenuBar(MainWindow);
menuBar->setObjectName(QStringLiteral("menuBar"));
menuBar->setGeometry(QRect(0, 0, 1051, 21));
MainWindow->setMenuBar(menuBar);
// Menu Entry
{
QMenu *menuEngine = new QMenu(menuBar);
menuEngine->setObjectName(QStringLiteral("menuEngine"));
menuEngine->setTitle("File");
menuBar->addAction(menuEngine->menuAction());
{
QAction *action = new QAction(MainWindow);
action->setText("Exit");
action->setIcon(*QtConfig::GetIcon("power.png"));
menuEngine->addAction(action);
QObject::connect(action, &QAction::triggered, this, &EditorMainWindow::close);
}
{
QAction *action = new QAction(MainWindow);
action->setText("Save As...");
action->setIcon(*QtConfig::GetIcon("memorycard.png"));
menuEngine->addAction(action);
QObject::connect(action, &QAction::triggered, this, [picker]() {
picker->OpenForSave();
});
QObject::connect(picker, &QFileDialog::fileSelected, this, [picker] (const QString & file) {
if (picker->IsSaving()) {
CSoundEditor::GetScene()->SaveSceneAs(file.toStdString().c_str());
}
});
}
}
// Menu Entry
{
QMenu *menu = new QMenu(menuBar);
menu->setTitle("Scene");
menuBar->addAction(menu->menuAction());
// Submenu buttons
QAction *action = new QAction(MainWindow);
action->setText("Clear Scene");
action->setIcon(*QtConfig::GetIcon("denied.png"));
menu->addAction(action);
QObject::connect(action, &QAction::triggered, this, []() {
CSoundEditor::GetScene()->Clear();
GUI::Get<SceneWindow>(QT_INSTACE::SCENE_EDITOR)->Clear();
});
}
// Menu Entry
{
QMenu *menu = new QMenu(menuBar);
menu->setTitle("Tools");
menuBar->addAction(menu->menuAction());
// Submenu buttons
{
QAction *action = new QAction(MainWindow);
action->setText("Reload StyleSheets");
action->setIcon(*QtConfig::GetIcon("cmyk.png"));
menu->addAction(action);
QObject::connect(action, &QAction::triggered, this, &EditorMainWindow::ReloadStyleSheets);
}
//.........这里部分代码省略.........
示例7: QMainWindow
ViewerWindow::ViewerWindow(QWidget* parent, Qt::WindowFlags flags)
: QMainWindow(parent, flags), gameData(nullptr), gameWorld(nullptr), renderer(nullptr)
{
setMinimumSize(640, 480);
QMenuBar* mb = this->menuBar();
QMenu* file = mb->addMenu("&File");
file->addAction("Open &Game", this, SLOT(loadGame()));
file->addSeparator();
for(int i = 0; i < MaxRecentGames; ++i) {
QAction* r = file->addAction("");
recentGames.append(r);
connect(r, SIGNAL(triggered()), SLOT(openRecent()));
}
recentSep = file->addSeparator();
auto ex = file->addAction("E&xit");
ex->setShortcut(QKeySequence::Quit);
connect(ex, SIGNAL(triggered()), QApplication::instance(), SLOT(closeAllWindows()));
viewerWidget = new ViewerWidget;
viewerWidget->context()->makeCurrent();
glewExperimental = 1;
glewInit();
objectViewer = new ObjectViewer(viewerWidget);
connect(this, SIGNAL(loadedData(GameWorld*)), objectViewer, SLOT(showData(GameWorld*)));
connect(this, SIGNAL(loadedData(GameWorld*)), viewerWidget, SLOT(dataLoaded(GameWorld*)));
modelViewer = new ModelViewer(viewerWidget);
connect(this, SIGNAL(loadedData(GameWorld*)), modelViewer, SLOT(showData(GameWorld*)));
viewSwitcher = new QStackedWidget;
viewSwitcher->addWidget(objectViewer);
viewSwitcher->addWidget(modelViewer);
//connect(objectViewer, SIGNAL(modelChanged(Model*)), modelViewer, SLOT(showModel(Model*)));
connect(objectViewer, SIGNAL(showObjectModel(uint16_t)), this, SLOT(showObjectModel(uint16_t)));
objectViewer->setViewerWidget( viewerWidget );
QMenu* view = mb->addMenu("&View");
QAction* objectAction = view->addAction("&Object");
QAction* modelAction = view->addAction("&Model");
objectAction->setData(0);
modelAction->setData(1);
connect(objectAction, SIGNAL(triggered()), this, SLOT(switchWidget()));
connect(modelAction, SIGNAL(triggered()), this, SLOT(switchWidget()));
QMenu* data = mb->addMenu("&Data");
//data->addAction("Export &Model", objectViewer, SLOT(exportModel()));
QMenu* anim = mb->addMenu("&Animation");
anim->addAction("Load &Animations", this, SLOT(openAnimations()));
this->setCentralWidget(viewSwitcher);
updateRecentGames();
}
示例8: MultipleWindowWidget
MultipleParameterWindowWidget::MultipleParameterWindowWidget(const QString &name, QWidget *parent)
: MultipleWindowWidget(name, parent), mCounter(1)
{
setWindowTitle("Object Properties");
resize(200, 500);
addButtonPressed();
connect(this, SIGNAL(initPhaseCompleted()), this, SLOT(handleInitPhase()));
connect(this, SIGNAL(shutDownPhaseStarted()), this, SLOT(handleShutDownPhase()));
QMenuBar *localMenuBar = menuBar();
QMenu *fileMenu = localMenuBar->addMenu("File");
QAction *saveSinglePanelsAction = fileMenu->addAction("Save Panel");
connect(saveSinglePanelsAction, SIGNAL(triggered()),
this, SLOT(saveSinglePanelToFile()));
QAction *loadSinglePanelsAction = fileMenu->addAction("Load Panel");
connect(loadSinglePanelsAction, SIGNAL(triggered()),
this, SLOT(loadSinglePanelFromFile()));
fileMenu->addSeparator();
QAction *saveAllPanelsAction = fileMenu->addAction("Save All Panels");
connect(saveAllPanelsAction, SIGNAL(triggered()),
this, SLOT(saveAllPanelsToFile()));
QAction *loadAllPanelsAction = fileMenu->addAction("Load All Panels");
connect(loadAllPanelsAction, SIGNAL(triggered()),
this, SLOT(loadAllPanelsFromFile()));
QMenu *editMenu = localMenuBar->addMenu("Edit");
QAction *selectSingleAction = editMenu->addAction("Select Panel");
connect(selectSingleAction, SIGNAL(triggered()),
this, SLOT(selectSinglePanel()));
QAction *applySingleAction = editMenu->addAction("Apply Panel");
connect(applySingleAction, SIGNAL(triggered()),
this, SLOT(applySinglePanel()));
QAction *clearSingleAction = editMenu->addAction("Clear Panel");
connect(clearSingleAction, SIGNAL(triggered()),
this, SLOT(clearSinglePanel()));
editMenu->addSeparator();
QAction *applyAllAction = editMenu->addAction("Apply All in All Panels");
connect(applyAllAction, SIGNAL(triggered()),
this, SLOT(applyAllProperties()));
QAction *applyAndSelectAllAction = editMenu->addAction("Apply and Select All in All Panels");
connect(applyAndSelectAllAction, SIGNAL(triggered()),
this, SLOT(applyAndSelectAllProperties()));
QAction *selectAllAction = editMenu->addAction("Select All in All Panels");
connect(selectAllAction, SIGNAL(triggered()),
this, SLOT(selectAllProperties()));
QAction *deselectAllAction = editMenu->addAction("Deselect All in All Panels");
connect(deselectAllAction, SIGNAL(triggered()),
this, SLOT(deselectAllProperties()));
editMenu->addSeparator();
QAction *copyToAllValuesAction = editMenu->addAction("Copy First To All");
connect(copyToAllValuesAction, SIGNAL(triggered()),
this, SLOT(copyFirstValueToAllOtherValues()));
QAction *setInitForAllValuesAction = editMenu->addAction("Set Init To All");
connect(setInitForAllValuesAction, SIGNAL(triggered()),
this, SLOT(setInitToAllValues()));
QMenu *plotterMenu = localMenuBar->addMenu("Plotter");
QAction *activateHistoryPlotter = plotterMenu->addAction("History Plotter");
connect(activateHistoryPlotter, SIGNAL(triggered()),
this, SLOT(activateHistoryPlotter()));
//QAction *activateXYPlotter = plotterMenu->addAction("X/Y Plotter");
//connect(activateXYPlotter, SIGNAL(triggered()),
// this, SLOT(activateXYPlotter()));
QMenu *helpMenu = localMenuBar->addMenu("Help");
helpMenu->addAction(QWhatsThis::createAction());
}
示例9: QToolBar
void MainWindow::makeMenu()
{
QToolBar *toolBar = new QToolBar( this );
QToolBar *searchBar = new QToolBar(this);
QMenuBar *menuBar = new QMenuBar( toolBar );
QPopupMenu *searchMenu = new QPopupMenu( menuBar );
// QPopupMenu *viewMenu = new QPopupMenu( menuBar );
QPopupMenu *cfgMenu = new QPopupMenu( menuBar );
QPopupMenu *searchOptions = new QPopupMenu( cfgMenu );
setToolBarsMovable( false );
toolBar->setHorizontalStretchable( true );
menuBar->insertItem( tr( "Search" ), searchMenu );
menuBar->insertItem( tr( "Settings" ), cfgMenu );
//SETTINGS MENU
cfgMenu->insertItem( tr( "Search" ), searchOptions );
QPopupMenu *pop;
for (SearchGroup *s = searches.first(); s != 0; s = searches.next() ){
pop = s->popupMenu();
if (pop){
cfgMenu->insertItem( s->text(0), pop );
}
}
//SEARCH
SearchAllAction = new QAction( tr("Search all"),QString::null, 0, this, 0 );
SearchAllAction->setIconSet( Opie::Core::OResource::loadPixmap( "find", Opie::Core::OResource::SmallIcon ) );
// QWhatsThis::add( SearchAllAction, tr("Search everything...") );
connect( SearchAllAction, SIGNAL(activated()), this, SLOT(searchAll()) );
SearchAllAction->addTo( searchMenu );
searchMenu->insertItem( tr( "Options" ), searchOptions );
//SEARCH OPTIONS
//actionWholeWordsOnly = new QAction( tr("Whole words only"),QString::null, 0, this, 0, true );
//actionWholeWordsOnly->addTo( searchOptions );
actionCaseSensitiv = new QAction( tr("Case sensitive"),QString::null, 0, this, 0, true );
actionCaseSensitiv->addTo( searchOptions );
actionWildcards = new QAction( tr("Use wildcards"),QString::null, 0, this, 0, true );
actionWildcards->addTo( searchOptions );
//SEARCH BAR
LabelEnterText = new QLabel( searchBar, "Label" );
LabelEnterText->setAutoMask( FALSE );
LabelEnterText->setText( tr( "Search for: " ) );
LabelEnterText->setFrameStyle( QFrame::NoFrame );
LabelEnterText->setBackgroundMode( PaletteButton );
addToolBar( searchBar, "Search", QMainWindow::Top, TRUE );
QLineEdit *searchEdit = new QLineEdit( searchBar, "seachEdit" );
QWhatsThis::add( searchEdit, tr("Enter your search terms here") );
searchEdit->setFocus();
searchBar->setHorizontalStretchable( TRUE );
searchBar->setStretchableWidget( searchEdit );
//Search button
SearchAllAction->addTo( searchBar );
//Clear text
ClearSearchText = new QToolButton( searchBar, "ClearSearchText");
ClearSearchText->setText( "" );
ClearSearchText->setPixmap( Opie::Core::OResource::loadPixmap( "close", Opie::Core::OResource::SmallIcon ) );
connect( searchEdit, SIGNAL( textChanged(const QString&) ),this, SLOT( setSearch(const QString&) ) );
connect( ClearSearchText, SIGNAL( clicked() ), searchEdit, SLOT( clear() ) );
}
示例10: QMainWindow
MainWindow::MainWindow()
: QMainWindow()
{
_scene.reset();
if (!QGLFormat::hasOpenGL()) {
QMessageBox::critical(this,
"No OpenGL Support",
"This system does not appear to support OpenGL.\n\n"
"The Tungsten scene editor requires OpenGL "
"to work properly. The editor will now terminate.\n\n"
"Please install any available updates for your graphics card driver and try again");
std::exit(0);
}
QGLFormat qglFormat;
qglFormat.setVersion(3, 2);
qglFormat.setProfile(QGLFormat::CoreProfile);
qglFormat.setAlpha(true);
qglFormat.setSampleBuffers(true);
qglFormat.setSamples(16);
_windowSplit = new QSplitter(this);
_stackWidget = new QStackedWidget(_windowSplit);
_renderWindow = new RenderWindow(_stackWidget, this);
_previewWindow = new PreviewWindow(_stackWidget, this, qglFormat);
_propertyWindow = new PropertyWindow(_windowSplit, this);
_stackWidget->addWidget(_renderWindow);
_stackWidget->addWidget(_previewWindow);
_windowSplit->addWidget(_stackWidget);
_windowSplit->addWidget(_propertyWindow);
_windowSplit->setStretchFactor(0, 1);
_windowSplit->setStretchFactor(1, 0);
setCentralWidget(_windowSplit);
_previewWindow->addStatusWidgets(statusBar());
_renderWindow->addStatusWidgets(statusBar());
connect(this, SIGNAL(sceneChanged()), _previewWindow, SLOT(sceneChanged()));
connect(this, SIGNAL(sceneChanged()), _renderWindow, SLOT(sceneChanged()));
connect(this, SIGNAL(sceneChanged()), _propertyWindow, SLOT(sceneChanged()));
connect( _previewWindow, SIGNAL(primitiveListChanged()), _propertyWindow, SLOT(primitiveListChanged()));
connect( _previewWindow, SIGNAL(selectionChanged()), _propertyWindow, SLOT(changeSelection()));
connect(_propertyWindow, SIGNAL(selectionChanged()), _previewWindow, SLOT(changeSelection()));
showPreview(true);
QMenu *fileMenu = new QMenu("&File");
fileMenu->addAction("New", this, SLOT(newScene()), QKeySequence("Ctrl+N"));
fileMenu->addAction("Open File...", this, SLOT(openScene()), QKeySequence("Ctrl+O"));
fileMenu->addAction("Reload File...", this, SLOT(reloadScene()), QKeySequence("Shift+R"));
fileMenu->addSeparator();
fileMenu->addAction("Close", this, SLOT(closeScene()), QKeySequence("Ctrl+W"));
fileMenu->addSeparator();
fileMenu->addAction("Save", this, SLOT(saveScene()), QKeySequence("Ctrl+S"));
fileMenu->addAction("Save as...", this, SLOT(saveSceneAs()), QKeySequence("Ctrl+Shift+S"));
fileMenu->addSeparator();
fileMenu->addAction("Exit", this, SLOT(close()));
QMenuBar *menuBar = new QMenuBar();
menuBar->addMenu(fileMenu);
setMenuBar(menuBar);
newScene();
}
示例11: setCaption
void AdvancedFm::init() {
b = false;
setCaption( tr( "AdvancedFm" ) );
// QFrame* frame = new QFrame(this);
// setCentralWidget(frame);
// QVBoxLayout *layout = new QVBoxLayout( frame );
QVBoxLayout *layout = new QVBoxLayout( this);
layout->setSpacing( 2);
layout->setMargin( 0); // squeeze
QMenuBar *menuBar = new QMenuBar(this);
menuBar->setMargin( 0 ); // squeeze
fileMenu = new QPopupMenu( this );
viewMenu = new QPopupMenu( this );
// customDirMenu = new QPopupMenu( this );
layout->addWidget( menuBar );
menuBar->insertItem( tr( "File" ), fileMenu);
menuBar->insertItem( tr( "View" ), viewMenu);
connect(fileMenu,SIGNAL(aboutToShow()),this,SLOT(enableDisableMenu()));
bool useBigIcon = qApp->desktop()->size().width() > 330;
cdUpButton = new QToolButton( 0,"cdUpButton");
cdUpButton->setUsesBigPixmap( useBigIcon );
cdUpButton->setPixmap( Opie::Core::OResource::loadPixmap( "up", Opie::Core::OResource::SmallIcon ) );
cdUpButton->setAutoRaise( true );
menuBar->insertItem( cdUpButton );
qpeDirButton= new QToolButton( 0,"QPEButton");
qpeDirButton->setUsesBigPixmap( useBigIcon );
qpeDirButton->setPixmap( Opie::Core::OResource::loadPixmap( "logo/opielogo", Opie::Core::OResource::SmallIcon ) );
qpeDirButton->setAutoRaise( true );
menuBar->insertItem( qpeDirButton );
fsButton = new OFileSystemButton( 0 );
fsButton->setUsesBigPixmap( useBigIcon );
fsButton->setAutoRaise( true );
menuBar->insertItem( fsButton );
docButton = new QToolButton( 0,"docsButton");
docButton->setUsesBigPixmap( useBigIcon );
docButton->setPixmap( Opie::Core::OResource::loadPixmap( "DocsIcon", Opie::Core::OResource::SmallIcon ) );
docButton->setAutoRaise( true );
menuBar->insertItem( docButton );
homeButton = new QToolButton( 0, "homeButton");
homeButton->setUsesBigPixmap( useBigIcon );
homeButton->setPixmap( Opie::Core::OResource::loadPixmap( "home", Opie::Core::OResource::SmallIcon ) );
homeButton->setAutoRaise( true );
menuBar->insertItem( homeButton );
// fileMenu->insertItem( tr( "File Search" ), this, SLOT( openSearch() ));
// fileMenu->insertSeparator();
fileMenu->insertItem( tr( "Make Directory" ), this, SLOT( mkDir() ), 0, 101);
fileMenu->insertItem( tr( "Select All" ), this, SLOT( selectAll() ), 0, 102);
fileMenu->insertSeparator();
fileMenu->insertItem( tr( "Make Symlink" ), this, SLOT( mkSym() ), 0, 103);
fileMenu->insertItem( tr( "Add To Documents" ), this, SLOT( addToDocs() ), 0, 104);
fileMenu->insertItem( tr( "Run Command" ), this, SLOT( runCommandStd() ), 0, 105);
fileMenu->insertItem( tr( "Run Command with Output" ), this, SLOT( runCommand() ), 0, 106);
fileMenu->insertItem( tr( "Rename" ), this, SLOT( rn() ), 0, 107);
fileMenu->insertItem( tr( "Delete" ), this, SLOT( del() ), 0, 108);
viewMenu->insertItem( tr( "Switch to View 1" ), this, SLOT( switchToLocalTab()));
viewMenu->insertItem( tr( "Switch to View 2" ), this, SLOT( switchToRemoteTab()));
viewMenu->insertSeparator();
viewMenu->insertItem( tr( "Refresh" ), this, SLOT( refreshCurrentTab()));
viewMenu->insertSeparator();
viewMenu->insertItem( tr( "Show Hidden Files" ), this, SLOT( showMenuHidden() ));
// viewMenu->insertSeparator();
// viewMenu->insertItem( tr( "About" ), this, SLOT( doAbout() ));
viewMenu->setCheckable(true);
viewMenu->setItemChecked( viewMenu->idAt(0), true);
viewMenu->setItemChecked( viewMenu->idAt(1), false);
viewMenu->setItemChecked( viewMenu->idAt(5), false);
s_addBookmark = tr("Bookmark Directory");
s_removeBookmark = tr("Remove Current Directory from Bookmarks");
// menuButton->insertItem("");
// customDirMenu->insertItem(tr("Add This Directory"));
// customDirMenu->insertItem(tr("Remove This Directory"));
// customDirMenu->insertSeparator();
QHBoxLayout *CBHB = new QHBoxLayout(); // parent layout will be set later
CBHB->setMargin( 0 );
CBHB->setSpacing( 1 );
menuButton = new MenuButton( this );
menuButton->setUseLabel(false);
menuButton->setMaximumWidth( 20 );
menuButton->insertItem( s_addBookmark);
menuButton->insertItem( s_removeBookmark);
menuButton->insertSeparator();
//.........这里部分代码省略.........
示例12: QMainWindow
JoCASSViewer::JoCASSViewer(QWidget *parent, Qt::WindowFlags flags)
: QMainWindow(parent,flags),
_updateInProgress(false)
{
QSettings settings;
TCPClient *client(new TCPClient);
/** set up the window */
// Add a menu to the window
QMenuBar *menu = menuBar();
// Add file menu
QMenu *fmenu = menu->addMenu(tr("&File"));
fmenu->addAction(QIcon::fromTheme("document-open"),tr("Load Data"),this,
SLOT(openFile()),QKeySequence(QKeySequence::Open))->setShortcutContext(Qt::ApplicationShortcut);
fmenu->addAction(QIcon::fromTheme("document-save"),tr("Save"),this,
SLOT(autoSave()),QKeySequence(tr("F10")))->setShortcutContext(Qt::ApplicationShortcut);
fmenu->addAction(QIcon::fromTheme("document-save-as"),tr("Save as..."),this,
SLOT(saveFile()),QKeySequence(QKeySequence::SaveAs))->setShortcutContext(Qt::ApplicationShortcut);
fmenu->addAction(QIcon::fromTheme("document-print"),tr("Print"),this,
SLOT(print()),QKeySequence(QKeySequence::Print))->setShortcutContext(Qt::ApplicationShortcut);
fmenu->addSeparator();
fmenu->addAction(QIcon::fromTheme("application-exit"),tr("Quit"),qApp,
SLOT(closeAllWindows()),QKeySequence("Ctrl+q"))->setShortcutContext(Qt::ApplicationShortcut);
// Add control menu
QMenu *cmenu = menu->addMenu(tr("&Control"));
cmenu->addAction(tr("Refresh List"),this,
SLOT(refreshDisplayableItemsList()),QKeySequence(tr("F5")))->setShortcutContext(Qt::ApplicationShortcut);
cmenu->addAction(tr("Get Data"),this,
SLOT(updateViewers()),QKeySequence(tr("Ctrl+i")))->setShortcutContext(Qt::ApplicationShortcut);
cmenu->addAction(tr("Clear Histogram"),this,
SLOT(clearHistogram()));
cmenu->addAction(tr("Send custom Command"),this,
SLOT(sendCustomCommand()));
cmenu->addAction(tr("Broadcast darkcal command"),this,
SLOT(broadcastDarkcalCommand()),QKeySequence(tr("Ctrl+d")))->setShortcutContext(Qt::ApplicationShortcut);
cmenu->addAction(tr("Broadcast gaincal command"),this,
SLOT(broadcastGaincalCommand()),QKeySequence(tr("Ctrl+g")))->setShortcutContext(Qt::ApplicationShortcut);
cmenu->addSeparator()->setText("Server Control");
cmenu->addAction(tr("Reload ini File"),client,
SLOT(reloadIni()),QKeySequence(tr("Ctrl+r")))->setShortcutContext(Qt::ApplicationShortcut);
cmenu->addAction(tr("Quit Server"),client,SLOT(quitServer()));
// Add the source menu
DataSourceManager::setMenu(menu->addMenu(tr("&Sources")));
// Add help menu
QMenu *hmenu = menu->addMenu(tr("&Help"));
hmenu->addAction(tr("About"),this,SLOT(about()));
hmenu->addAction(tr("About Qt"),qApp,SLOT(aboutQt()));
// Add a toolbar where we can add the general tools
_serverToolBar = addToolBar(tr("Display control"));
_serverToolBar->setContextMenuPolicy(Qt::PreventContextMenu);
// Add servername and port to toolbar.
_servername = new QLineEdit(settings.value("Servername", "localhost").toString());
_servername->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
_servername->setToolTip(tr("Name of the server to connect to."));
connect(_servername,SIGNAL(textEdited(QString)),this,SLOT(changeServerAddress()));
_serverToolBar->addWidget(_servername);
_serverport = new QSpinBox();
_serverport->setKeyboardTracking(false);
_serverport->setRange(1000, 50000);
_serverport->setValue(settings.value("Serverport", 12321).toInt());
_serverport->setToolTip(tr("Port of the server to connect to."));
connect(_serverport,SIGNAL(valueChanged(int)),this,SLOT(changeServerAddress()));
_serverToolBar->addWidget(_serverport);
// Add spacer to toolbar.
QWidget *spacer1(new QWidget());
spacer1->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
_serverToolBar->addWidget(spacer1);
// Add a separator
_serverToolBar->addSeparator();
// Add spacer to toolbar.
QWidget *spacer2(new QWidget());
spacer2->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
_serverToolBar->addWidget(spacer2);
// Add run control to toolbar.
_autoUpdate = new QAction(QIcon(":images/auto_update.png"),tr("Toggle auto update"),_serverToolBar);
_autoUpdate->setCheckable(true);
_autoUpdate->setChecked(settings.value("AutoUpdateOn",false).toBool());
_autoUpdate->setToolTip(tr("If checked, continuously retrieve and display images."));
connect(_autoUpdate,SIGNAL(triggered()),
this,SLOT(changeAutoUpdate()));
_serverToolBar->addAction(_autoUpdate);
// Add status LED to toolbar.
_statusLED = new StatusLED();
_statusLED->setToolTip("Status indicator (green = Data retrieved ok, red = communciation Problems, yellow = busy).");
_statusLED->setStatus(StatusLED::off);
_serverToolBar->addWidget(_statusLED);
// Add rate to toolbar.
//.........这里部分代码省略.........
示例13: QWidget
ExampleWidget::ExampleWidget( QWidget *parent, const char *name )
: QWidget( parent, name )
{
// Make the top-level layout; a vertical box to contain all widgets
// and sub-layouts.
QBoxLayout *topLayout = new QVBoxLayout( this, 5 );
// Create a menubar...
QMenuBar *menubar = new QMenuBar( this );
menubar->setSeparator( QMenuBar::InWindowsStyle );
QPopupMenu* popup;
popup = new QPopupMenu( this );
popup->insertItem( "&Quit", qApp, SLOT(quit()) );
menubar->insertItem( "&File", popup );
// ...and tell the layout about it.
topLayout->setMenuBar( menubar );
// Make an hbox that will hold a row of buttons.
QBoxLayout *buttons = new QHBoxLayout( topLayout );
int i;
for ( i = 1; i <= 4; i++ ) {
QPushButton* but = new QPushButton( this );
QString s;
s.sprintf( "Button %d", i );
but->setText( s );
// Set horizontal stretch factor to 10 to let the buttons
// stretch horizontally. The buttons will not stretch
// vertically, since bigWidget below will take up vertical
// stretch.
buttons->addWidget( but, 10 );
// (Actually, the result would have been the same with a
// stretch factor of 0; if no items in a layout have non-zero
// stretch, the space is divided equally between members.)
}
// Make another hbox that will hold a left-justified row of buttons.
QBoxLayout *buttons2 = new QHBoxLayout( topLayout );
QPushButton* but = new QPushButton( "Button five", this );
buttons2->addWidget( but );
but = new QPushButton( "Button 6", this );
buttons2->addWidget( but );
// Fill up the rest of the hbox with stretchable space, so that
// the buttons get their minimum width and are pushed to the left.
buttons2->addStretch( 10 );
// Make a big widget that will grab all space in the middle.
QMultiLineEdit *bigWidget = new QMultiLineEdit( this );
bigWidget->setText( "This widget will get all the remaining space" );
bigWidget->setFrameStyle( QFrame::Panel | QFrame::Plain );
// Set vertical stretch factor to 10 to let the bigWidget stretch
// vertically. It will stretch horizontally because there are no
// widgets beside it to take up horizontal stretch.
// topLayout->addWidget( bigWidget, 10 );
topLayout->addWidget( bigWidget );
// Make a grid that will hold a vertical table of QLabel/QLineEdit
// pairs next to a large QMultiLineEdit.
// Don't use hard-coded row/column numbers in QGridLayout, you'll
// regret it when you have to change the layout.
const int numRows = 3;
const int labelCol = 0;
const int linedCol = 1;
const int multiCol = 2;
// Let the grid-layout have a spacing of 10 pixels between
// widgets, overriding the default from topLayout.
QGridLayout *grid = new QGridLayout( topLayout, 0, 0, 10 );
int row;
for ( row = 0; row < numRows; row++ ) {
QLineEdit *ed = new QLineEdit( this );
// The line edit goes in the second column
grid->addWidget( ed, row, linedCol );
// Make a label that is a buddy of the line edit
QString s;
s.sprintf( "Line &%d", row+1 );
QLabel *label = new QLabel( ed, s, this );
// The label goes in the first column.
grid->addWidget( label, row, labelCol );
}
// The multiline edit will cover the entire vertical range of the
// grid (rows 0 to numRows) and stay in column 2.
QMultiLineEdit *med = new QMultiLineEdit( this );
grid->addMultiCellWidget( med, 0, -1, multiCol, multiCol );
// The labels will take the space they need. Let the remaining
// horizontal space be shared so that the multiline edit gets
// twice as much as the line edit.
grid->setColStretch( linedCol, 10 );
grid->setColStretch( multiCol, 20 );
//.........这里部分代码省略.........
示例14: QString
void QmitkExtWorkbenchWindowAdvisor::PostWindowCreate()
{
// very bad hack...
berry::IWorkbenchWindow::Pointer window =
this->GetWindowConfigurer()->GetWindow();
QMainWindow* mainWindow =
qobject_cast<QMainWindow*> (window->GetShell()->GetControl());
if (!windowIcon.isEmpty())
{
mainWindow->setWindowIcon(QIcon(windowIcon));
}
mainWindow->setContextMenuPolicy(Qt::PreventContextMenu);
/*mainWindow->setStyleSheet("color: white;"
"background-color: #808080;"
"selection-color: #659EC7;"
"selection-background-color: #808080;"
" QMenuBar {"
"background-color: #808080; }");*/
// Load selected icon theme
QStringList searchPaths = QIcon::themeSearchPaths();
searchPaths.push_front( QString(":/org_mitk_icons/icons/") );
QIcon::setThemeSearchPaths( searchPaths );
berry::IPreferencesService* prefService = berry::Platform::GetPreferencesService();
berry::IPreferences::Pointer stylePref = prefService->GetSystemPreferences()->Node(berry::QtPreferences::QT_STYLES_NODE);
QString iconTheme = stylePref->Get(berry::QtPreferences::QT_ICON_THEME, "<<default>>");
if( iconTheme == QString( "<<default>>" ) )
{
iconTheme = QString( "tango" );
}
QIcon::setThemeName( iconTheme );
// ==== Application menu ============================
QMenuBar* menuBar = mainWindow->menuBar();
menuBar->setContextMenuPolicy(Qt::PreventContextMenu);
#ifdef __APPLE__
menuBar->setNativeMenuBar(true);
#else
menuBar->setNativeMenuBar(false);
#endif
QAction* fileOpenAction = new QmitkFileOpenAction(QIcon::fromTheme("document-open",QIcon(":/org_mitk_icons/icons/tango/scalable/actions/document-open.svg")), window);
fileOpenAction->setShortcut(QKeySequence::Open);
QAction* fileSaveAction = new QmitkFileSaveAction(QIcon(":/org.mitk.gui.qt.ext/Save_48.png"), window);
fileSaveAction->setShortcut(QKeySequence::Save);
fileSaveProjectAction = new QmitkExtFileSaveProjectAction(window);
fileSaveProjectAction->setIcon(QIcon::fromTheme("document-save",QIcon(":/org_mitk_icons/icons/tango/scalable/actions/document-save.svg")));
closeProjectAction = new QmitkCloseProjectAction(window);
closeProjectAction->setIcon(QIcon::fromTheme("edit-delete",QIcon(":/org_mitk_icons/icons/tango/scalable/actions/edit-delete.svg")));
auto perspGroup = new QActionGroup(menuBar);
std::map<QString, berry::IViewDescriptor::Pointer> VDMap;
// sort elements (converting vector to map...)
QList<berry::IViewDescriptor::Pointer>::const_iterator iter;
berry::IViewRegistry* viewRegistry =
berry::PlatformUI::GetWorkbench()->GetViewRegistry();
const QList<berry::IViewDescriptor::Pointer> viewDescriptors = viewRegistry->GetViews();
bool skip = false;
for (iter = viewDescriptors.begin(); iter != viewDescriptors.end(); ++iter)
{
// if viewExcludeList is set, it contains the id-strings of view, which
// should not appear as an menu-entry in the menu
if (viewExcludeList.size() > 0)
{
for (int i=0; i<viewExcludeList.size(); i++)
{
if (viewExcludeList.at(i) == (*iter)->GetId())
{
skip = true;
break;
}
}
if (skip)
{
skip = false;
continue;
}
}
if ((*iter)->GetId() == "org.blueberry.ui.internal.introview")
continue;
if ((*iter)->GetId() == "org.mitk.views.imagenavigator")
continue;
if ((*iter)->GetId() == "org.mitk.views.viewnavigatorview")
continue;
std::pair<QString, berry::IViewDescriptor::Pointer> p(
(*iter)->GetLabel(), (*iter));
VDMap.insert(p);
}
//.........这里部分代码省略.........
示例15: tabWidget
/* Konstruktor */
MainWindow::MainWindow(): tabWidget(new QTabWidget(this)) {
setWindowIcon(QIcon(":/icon.png"));
#ifdef ADMIN_VERSION
setWindowTitle(tr("Absencoid [správce]"));
#else
setWindowTitle(tr("Absencoid [uživatel]"));
#endif
/* Menu */
QMenuBar* menu = new QMenuBar();
/* Menu Soubor */
QMenu* fileMenu = menu->addMenu(tr("Soubor"));
QAction* quitAction = fileMenu->addAction(Style::style()->icon(Style::ExitIcon), tr("Ukončit"));
connect(quitAction, SIGNAL(triggered(bool)), this, SLOT(close()));
/* Menu Nápověda */
QMenu* helpMenu = menu->addMenu(tr("Nápověda"));
QAction* helpAction = helpMenu->addAction(Style::style()->icon(Style::HelpIcon), tr("Nápověda"));
helpAction->setDisabled(true);
QAction* aboutAction = helpMenu->addAction(QIcon(":/icon.png"), tr("O programu"));
helpMenu->addSeparator();
QAction* aboutQtAction = helpMenu->addAction(QIcon(":/qt.png"), tr("O Qt"));
connect(aboutAction, SIGNAL(triggered(bool)), this, SLOT(about()));
connect(aboutQtAction, SIGNAL(triggered(bool)), qApp, SLOT(aboutQt()));
setMenuBar(menu);
/* Taby */
tabWidget->setTabPosition(QTabWidget::South);
tabWidget->setUsesScrollButtons(false);
/* Učitelé */
TeachersTab* teachersTab = new TeachersTab(tabWidget);
tabWidget->addTab(teachersTab, Style::style()->icon(Style::TeachersTab), tr("Učitelé"));
/* Předměty */
ClassesTab* classesTab = new ClassesTab(teachersTab->getTeachersModel(), tabWidget);
tabWidget->addTab(classesTab, Style::style()->icon(Style::ClassesTab), tr("Předměty"));
/* Rozvrh hodin */
TimetableTab* timetableTab = new TimetableTab(classesTab->getClassesModel(), tabWidget);
tabWidget->addTab(timetableTab, Style::style()->icon(Style::TimetableTab), tr("Rozvrhy hodin"));
/* Změny */
ChangesTab* changesTab =
new ChangesTab(timetableTab->getTimetableModel(), classesTab->getClassesModel());
tabWidget->addTab(changesTab, Style::style()->icon(Style::ChangesTab), tr("Změny"));
/* Absence */
AbsencesTab* absencesTab = new AbsencesTab(teachersTab->getTeachersModel(), classesTab->getClassesModel(), timetableTab->getTimetableModel(), changesTab->getChangesModel());
tabWidget->addTab(absencesTab, Style::style()->icon(Style::AbsencesTab), tr("Absence"));
/* Souhrn - potřebuje data rozvrhu, ale absence potřebují jeho aktuální
rozvrh, proto je zde */
SummaryTab* summaryTab = new SummaryTab(teachersTab->getTeachersModel(), classesTab->getClassesModel(), timetableTab, changesTab->getChangesModel(), absencesTab->getAbsencesModel());
tabWidget->insertTab(0, summaryTab, Style::style()->icon(Style::SummaryTab), tr("Souhrn"));
tabWidget->setCurrentIndex(0);
/* Propojení signálu o aktualizaci databáze s reload funkcemi modelů.
Bacha, pořadí je důležité! ConfigurationModel potřebuje aktualizovaná
data z TimetableTab */
connect(summaryTab, SIGNAL(updated()), teachersTab->getTeachersModel(), SLOT(reload()));
connect(summaryTab, SIGNAL(updated()), classesTab->getClassesModel(), SLOT(reload()));
connect(summaryTab, SIGNAL(updated()), timetableTab->getTimetableModel(), SLOT(reload()));
connect(summaryTab, SIGNAL(updated()), changesTab->getChangesModel(), SLOT(reload()));
connect(summaryTab, SIGNAL(updated()), absencesTab->getAbsencesModel(), SLOT(reload()));
connect(summaryTab, SIGNAL(updated()), summaryTab, SLOT(reload()));
setCentralWidget(tabWidget);
/* Stavový řádek */
setStatusBar(new QStatusBar(this));
statusBar()->addWidget(new QLabel(tr("Absencoid k vašim službám.")), 1);
statusBar()->addWidget(new QLabel(tr("%1").arg(APP_VERSION_LONG)));
/* Změna velikosti na nejmenší možnou v poměru 16:10 */
resize(480*8/5, 480);
}