void MainWindow::createActions(){ // Allows the user to return to menu returnAct = new QAction(tr("&Back to Main Menu"), this); returnAct->setShortcut(tr("Ctrl+Z")); returnAct->setStatusTip(tr("Return to main menu")); connect(returnAct, SIGNAL(triggered()), this, SLOT(backToMainMenu())); // Allows the user to exit the game through the menu bar exitAct = new QAction(tr("&Exit Game"), this); exitAct->setShortcut(tr("Ctrl+Q")); exitAct->setStatusTip(tr("Exit the application")); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); // Allows the user to see the About info about the application aboutAct = new QAction(tr("&About Game"), this); aboutAct->setStatusTip(tr("Show info about game")); connect(aboutAct, SIGNAL(triggered()), this, SLOT(aboutGame())); // Brings up a note dialog box noteAct = new QAction(tr("&Notes"), this); noteAct->setShortcut(tr("Ctrl+N")); noteAct->setStatusTip(tr("Create a note text file")); connect(noteAct, SIGNAL(triggered()), this, SLOT(takeNotes())); // Brings up global scores dialog box globalScoresAct = new QAction(tr("&Global Scores"), this); globalScoresAct->setShortcut(tr("Ctrl+V")); globalScoresAct->setStatusTip(tr("View Brick Breaker global high scores")); connect(globalScoresAct, SIGNAL(triggered()), this, SLOT(viewGlobalScores())); }
void Game::gameButtonClicked( Button* button ){ std::string name = button->getName(); if( name == "GameMenuButton" ) { backToMainMenu(); } else if( name == "HelpButton" ) { helpWindow->showTopic("help"); } else if( name == "StatButton" ) { if( !blockingDialogIsOpen ){ new Dialog( GAME_STATS ); } } else { std::cerr << " Game::gameButtonClicked unknown button '" << name << "'.\n"; } }
void MainWindow::createActions() { // Allows the user to return to menu returnAct = new QAction(tr("&Back to Main Menu"), this); returnAct->setShortcut(tr("Ctrl+Z")); returnAct->setStatusTip(tr("Return to main menu")); connect(returnAct, SIGNAL(triggered()), this, SLOT(backToMainMenu())); // Allows the user to exit the app through the menu bar exitAct = new QAction(tr("&Exit Guess Who"), this); exitAct->setShortcut(tr("Ctrl+Q")); exitAct->setStatusTip(tr("Exit the application")); connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); // Allows the user to see the About info about the application aboutAct = new QAction(tr("About Guess &Who"), this); aboutAct->setStatusTip(tr("Shows info about game")); connect(aboutAct, SIGNAL(triggered()), this, SLOT(aboutButtonClicked())); // Allows the user to create a new text file for character selection createAct = new QAction(tr("Edit characters text"), this); createAct->setStatusTip(tr("Create/Edit text file for character selection")); connect(createAct, SIGNAL(triggered()), this, SLOT(createText())); }
void GameScene::backToMainMenu() { backToMainMenu(NULL); }
void MusicWebDJRadioInfoWidget::createLabels() { initFirstWidget(); m_container->show(); layout()->removeWidget(m_mainWindow); QScrollArea *scrollArea = new QScrollArea(this); scrollArea->verticalScrollBar()->setStyleSheet(MusicUIObject::MScrollBarStyle01); scrollArea->setWidgetResizable(true); scrollArea->setFrameShape(QFrame::NoFrame); scrollArea->setAlignment(Qt::AlignLeft); scrollArea->setWidget(m_mainWindow); layout()->addWidget(scrollArea); QWidget *function = new QWidget(m_mainWindow); function->setStyleSheet(MusicUIObject::MCheckBoxStyle01 + MusicUIObject::MPushButtonStyle03); QVBoxLayout *grid = new QVBoxLayout(function); QWidget *firstTopFuncWidget = new QWidget(function); QHBoxLayout *firstTopFuncLayout = new QHBoxLayout(firstTopFuncWidget); QLabel *firstLabel = new QLabel(function); firstLabel->setText(tr("<font color=#158FE1> DJRadio > %1 </font>").arg(m_currentPlaylistItem.m_name)); QPushButton *backButton = new QPushButton(tr("Back")); backButton->setFixedSize(90, 30); backButton->setStyleSheet(MusicUIObject::MPushButtonStyle03); backButton->setCursor(QCursor(Qt::PointingHandCursor)); connect(backButton, SIGNAL(clicked()), this, SIGNAL(backToMainMenu())); firstTopFuncLayout->addWidget(firstLabel); firstTopFuncLayout->addWidget(backButton); grid->addWidget(firstTopFuncWidget); //////////////////////////////////////////////////////////////////////////// QWidget *topFuncWidget = new QWidget(function); QHBoxLayout *topFuncLayout = new QHBoxLayout(topFuncWidget); m_iconLabel = new QLabel(topFuncWidget); m_iconLabel->setPixmap(QPixmap(":/image/lb_warning").scaled(180, 180)); m_iconLabel->setFixedSize(210, 180); //////////////////////////////////////////////////////////////////////////// QWidget *topLineWidget = new QWidget(topFuncWidget); QVBoxLayout *topLineLayout = new QVBoxLayout(topLineWidget); topLineLayout->setContentsMargins(10, 5, 5, 0); QLabel *nameLabel = new QLabel(topLineWidget); QFont nameFont = nameLabel->font(); nameFont.setPixelSize(20); nameLabel->setFont(nameFont); nameLabel->setStyleSheet(MusicUIObject::MFontStyle01); nameLabel->setText("-"); QLabel *singerLabel = new QLabel(topLineWidget); singerLabel->setStyleSheet(MusicUIObject::MColorStyle04 + MusicUIObject::MFontStyle03); singerLabel->setText("-"); QLabel *playCountLabel = new QLabel(topLineWidget); playCountLabel->setStyleSheet(MusicUIObject::MColorStyle04 + MusicUIObject::MFontStyle03); QLabel *updateTimeLabel = new QLabel(topLineWidget); updateTimeLabel->setStyleSheet(MusicUIObject::MColorStyle04 + MusicUIObject::MFontStyle03); updateTimeLabel->setText("-"); topLineLayout->addWidget(nameLabel); topLineLayout->addWidget(singerLabel); topLineLayout->addWidget(playCountLabel); topLineLayout->addWidget(updateTimeLabel); topLineWidget->setLayout(topLineLayout); topFuncLayout->addWidget(m_iconLabel); topFuncLayout->addWidget(topLineWidget); topFuncWidget->setLayout(topFuncLayout); grid->addWidget(topFuncWidget); //////////////////////////////////////////////////////////////////////////// QWidget *functionWidget = new QWidget(this); functionWidget->setStyleSheet(MusicUIObject::MPushButtonStyle03); QHBoxLayout *hlayout = new QHBoxLayout(functionWidget); m_songButton = new QPushButton(functionWidget); m_songButton->setText(tr("songItems")); m_songButton->setFixedSize(100, 25); m_songButton->setCursor(QCursor(Qt::PointingHandCursor)); hlayout->addWidget(m_songButton); hlayout->addStretch(1); functionWidget->setLayout(hlayout); QButtonGroup *group = new QButtonGroup(this); group->addButton(m_songButton, 0); connect(group, SIGNAL(buttonClicked(int)), m_container, SLOT(setCurrentIndex(int))); #ifdef Q_OS_UNIX m_songButton->setFocusPolicy(Qt::NoFocus); #endif grid->addWidget(functionWidget); ////////////////////////////////////////////////////////////////////// grid->addWidget(m_container); grid->addStretch(1); function->setLayout(grid); m_mainWindow->layout()->addWidget(function); m_resizeWidgets << nameLabel << singerLabel << playCountLabel << updateTimeLabel; }