void WenliBackWidget::initConnect() { connect(m_groupButton, SIGNAL(playVideo()), this, SIGNAL(playVideo())); connect(m_groupButton, SIGNAL(showSkin()), this, SIGNAL(showSkin())); connect(m_groupButton, SIGNAL(showMenu()), this, SIGNAL(showMenu())); connect(m_groupButton, SIGNAL(showMin()), this, SIGNAL(showMin())); connect(m_groupButton, SIGNAL(closeWidget()), this, SIGNAL(closeWidget())); connect(m_button, SIGNAL(buttonClicked()), this, SIGNAL(buttonClicked())); }
SysButtonGroup::SysButtonGroup(QWidget *parent) : QWidget(parent) { QHBoxLayout *hLayout = new QHBoxLayout; StaticButton *playButton = new StaticButton(":/main/playvideo"); connect(playButton, SIGNAL(buttonClicked()), this, SIGNAL(playVideo())); StaticButton *skinButton = new StaticButton(":/main/skin"); connect(skinButton, SIGNAL(buttonClicked()), this, SIGNAL(showSkin())); StaticButton *menuButton = new StaticButton(":/main/menu"); connect(menuButton, SIGNAL(buttonClicked()), this, SIGNAL(showMenu())); StaticButton *minButton = new StaticButton(":/main/sys_min"); connect(minButton, SIGNAL(buttonClicked()), this, SIGNAL(showMin())); StaticButton *closeButton = new StaticButton(":/main/sys_close"); connect(closeButton, SIGNAL(buttonClicked()), this, SIGNAL(closeWidget())); hLayout->addWidget(playButton); hLayout->addWidget(skinButton); hLayout->addWidget(menuButton); hLayout->addWidget(minButton); hLayout->addWidget(closeButton); hLayout->setContentsMargins(5, 0, 5, 0); hLayout->setSpacing(0); this->setLayout(hLayout); }
mainWidget::mainWidget(QWidget *parent) : QWidget(parent) { resize(850,600); setWindowFlags(Qt::FramelessWindowHint); bkPicName=":/img/skin/oldWood.jpg"; titleWidget *titleW=new titleWidget; connect(titleW,SIGNAL(showMax()),this,SLOT(showMax())); connect(titleW,SIGNAL(showMin()),this,SLOT(showMin())); connect(titleW,SIGNAL(showSkin()),this,SLOT(showSkinWidget())); toolWidget *toolW=new toolWidget; toolW->setFocus(); contentWidget *contentW=new contentWidget; statusWidget *statusW=new statusWidget; QVBoxLayout *mainLayout=new QVBoxLayout; mainLayout->setSpacing(0); mainLayout->setContentsMargins(0,0,0,0); mainLayout->addWidget(titleW); mainLayout->addWidget(toolW); mainLayout->addWidget(contentW); contentW->setContentsMargins(1,5,1,0); mainLayout->addWidget(statusW); setLayout(mainLayout); }
void TitleWidget::initUi(const bool &isMainTitle) { QLabel *logoLabel = new QLabel; QPixmap pix(":/title_images/logo"); QSize s(25, 25); // 将图标缩小 logoLabel->setPixmap(pix.scaled(s, Qt::KeepAspectRatio)); QLabel *titleLabel = new QLabel(APP_NAME + " " + APP_VERSION); titleLabel->setObjectName("TitleLabel"); ImageButton *upButton = new ImageButton(":/title_images/update_btn"); upButton->setCursorEnable(true); connect(upButton, SIGNAL(clicked()), this, SIGNAL(updateClicked())); QWidget *titleWidget = new QWidget(this); QHBoxLayout *titleLayout = new QHBoxLayout(titleWidget); titleLayout->addWidget(logoLabel, 0, Qt::AlignVCenter); titleLayout->addWidget(titleLabel, 0, Qt::AlignVCenter); titleLayout->addWidget(upButton, 0, Qt::AlignVCenter); titleLayout->setContentsMargins(0, 0, 0, 0); ImageButton *closeButton = new ImageButton(":/title_images/close_btn"); closeButton->setCursorEnable(true); connect(closeButton, SIGNAL(clicked()), this, SIGNAL(closeClicked())); QWidget *buttonWidget = new QWidget; QHBoxLayout *buttnLayout = new QHBoxLayout(buttonWidget); if (isMainTitle) { ImageButton *miniButton = new ImageButton(":/title_images/mini_btn"); miniButton->setCursorEnable(true); connect(miniButton, SIGNAL(clicked()), this, SIGNAL(showMini())); ImageButton *menuButton = new ImageButton(":/title_images/menu_btn"); menuButton->setCursorEnable(true); //connect(menuButton, SIGNAL(clicked()), this, SIGNAL(showMenu())); connect(menuButton, SIGNAL(clicked()), this, SLOT(menuVisiable())); ImageButton *skinButton = new ImageButton(":/title_images/skin_btn"); skinButton->setCursorEnable(true); connect(skinButton, SIGNAL(clicked()), this, SIGNAL(showSkin())); buttnLayout->addWidget(skinButton, 0, Qt::AlignVCenter); buttnLayout->addWidget(miniButton, 0, Qt::AlignVCenter); buttnLayout->addWidget(menuButton, 0, Qt::AlignVCenter); } buttnLayout->addWidget(closeButton, 0, Qt::AlignVCenter); buttnLayout->setContentsMargins(0, 0, 0, 0); QHBoxLayout *mainLayout = new QHBoxLayout(this); mainLayout->addWidget(titleWidget, 0, Qt::AlignLeft | Qt::AlignTop); mainLayout->addStretch(); mainLayout->addWidget(buttonWidget, 0, Qt::AlignRight | Qt::AlignVCenter); mainLayout->setContentsMargins(5, 5, 5, 5); }
void MainWindow::initConnect() { connect(m_topWidget, SIGNAL(goExamine()), m_bottomWidget, SLOT(goExamine()));//绑定top一键测评信号 connect(m_topWidget, SIGNAL(goExamine()), this, SLOT(goSetinformation())); connect(m_topWidget, SIGNAL(reexamine()), m_bottomWidget, SLOT(clearInfo())); connect(m_topWidget, SIGNAL(reexamine()), this, SLOT(goSetinformation())); connect(m_topWidget, SIGNAL(goView()), m_bottomWidget, SLOT(goToview())); connect(m_topWidget, SIGNAL(goMain()), m_bottomWidget, SLOT(goMain()));//绑定top第二界面返回信号 connect(m_topWidget, SIGNAL(closeWidget()), this, SLOT(closeWidget())); connect(m_topWidget, SIGNAL(showSkin()), this, SLOT(showSkin())); connect(m_safeWidget, SIGNAL(goToMain()), this, SLOT(goToMain())); connect(m_thionetWidget, SIGNAL(goToMain()), this, SLOT(goToMain())); connect(m_kbmWidget, SIGNAL(goToMain()), this, SLOT(goToMain())); connect(m_bottomWidget, SIGNAL(safeClicked()), this, SLOT(goToSafe())); connect(m_bottomWidget, SIGNAL(KBMClicked()), this, SLOT(goToKBM())); connect(m_bottomWidget, SIGNAL(TIONClicked()), this, SLOT(goToTion())); connect(m_upGroup, SIGNAL(finished()), this, SLOT(upAnimFinished())); connect(m_bottomWidget, SIGNAL(doClick(int)), this , SLOT(goToinfo(int))); }
MainWidget::MainWidget(QWidget *parent) : DropShadowWidget(parent) { initLocalConnection(); setMinimumSize(900, 600); setWindowIcon(QIcon(":/img/safe")); statked_widget = new QStackedWidget(); title_widget = new TitleWidget(); content_widget = new ContentWidget(); kill_mummy_widget = new KillMummyWidget(); main_menu = new MainMenu(); character_widget = new CharacterWidget(); about_us_dialog = new AboutUsDialog(this); setting_dialog = new SettingDialog(this); login_dialog = new LoginDialog(this); register_widget = new RegisterWidget(this); skin_widget = new SkinWidget(this); system_tray = new SystemTray(this); QPalette palette; palette.setBrush(QPalette::Window, QBrush(Qt::white)); statked_widget->setPalette(palette); statked_widget->setAutoFillBackground(true); statked_widget->addWidget(content_widget); statked_widget->addWidget(kill_mummy_widget); QVBoxLayout *center_layout = new QVBoxLayout(); center_layout->addWidget(statked_widget); center_layout->setSpacing(0); center_layout->setContentsMargins(0, 0, 0, 0); QVBoxLayout *main_layout = new QVBoxLayout(); main_layout->addWidget(title_widget); main_layout->addLayout(center_layout); main_layout->setSpacing(0); main_layout->setContentsMargins(SHADOW_WIDTH, SHADOW_WIDTH, SHADOW_WIDTH, SHADOW_WIDTH); setLayout(main_layout); connect(title_widget, SIGNAL(showSkin()), this, SLOT(showSkinWidget())); connect(title_widget, SIGNAL(showMainMenu()), this, SLOT(showMainMenu())); connect(title_widget, SIGNAL(showMin()), this, SLOT(showMinimized())); connect(title_widget, SIGNAL(closeWidget()), this, SLOT(hide())); connect(title_widget, SIGNAL(turnPage(int)), this, SLOT(turnPage(int))); connect(main_menu, SIGNAL(showSettingDialog()), this, SLOT(showSettingDialog())); connect(main_menu, SIGNAL(showNewCharacter()), this, SLOT(showNewCharacter())); connect(main_menu, SIGNAL(showAboutUs()), this, SLOT(showAboutUs())); connect(content_widget, SIGNAL(showLoginDialog()), this, SLOT(showLoginDialog())); connect(content_widget, SIGNAL(showRegisterDialog()), this, SLOT(showRegisterDialog())); connect(setting_dialog, SIGNAL(changeLanguage(LANGUAGE)), this, SLOT(changeLanguage(LANGUAGE))); connect(skin_widget, SIGNAL(changeSkin(QString)), this, SLOT(changeSkin(QString))); connect(system_tray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(iconIsActived(QSystemTrayIcon::ActivationReason))); connect(system_tray, SIGNAL(showWidget()), this, SLOT(showWidget())); system_tray->show(); title_widget->turnPage("0"); skin_name = Util::getSkinName(); if( QString::compare(skin_name, QString("")) == 0) { this->changeSkin(DEFAULT_SKIN); } }
void SkinWidget::initBottom() { QSignalMapper *signal_mapper = new QSignalMapper(this); QList<QPushButton *> *button_list = new QList<QPushButton *>(); for(int i=0; i<page_count; i++) { QPushButton *page_button = new QPushButton(); page_button->setFixedWidth(20); page_button->setText(QString::number(i+1, 10)); page_button->setObjectName("blueButton"); page_button->setCursor(Qt::PointingHandCursor); connect(page_button, SIGNAL(clicked()), signal_mapper, SLOT(map())); signal_mapper->setMapping(page_button, page_button->text()); button_list->push_back(page_button); } first_page_button = new QPushButton(); previous_page_button = new QPushButton(); next_page_button = new QPushButton(); last_page_button = new QPushButton(); first_page_button->setFixedWidth(50); previous_page_button->setFixedWidth(50); next_page_button->setFixedWidth(50); last_page_button->setFixedWidth(50); first_page_button->setCursor(Qt::PointingHandCursor); previous_page_button->setCursor(Qt::PointingHandCursor); next_page_button->setCursor(Qt::PointingHandCursor); last_page_button->setCursor(Qt::PointingHandCursor); first_page_button->setObjectName("blueButton"); previous_page_button->setObjectName("blueButton"); next_page_button->setObjectName("blueButton"); last_page_button->setObjectName("blueButton"); connect(first_page_button, SIGNAL(clicked()), signal_mapper, SLOT(map())); connect(previous_page_button, SIGNAL(clicked()), signal_mapper, SLOT(map())); connect(next_page_button, SIGNAL(clicked()), signal_mapper, SLOT(map())); connect(last_page_button, SIGNAL(clicked()), signal_mapper, SLOT(map())); signal_mapper->setMapping(first_page_button, "first"); signal_mapper->setMapping(previous_page_button, "previous"); signal_mapper->setMapping(next_page_button, "next"); signal_mapper->setMapping(last_page_button, "last"); connect(signal_mapper, SIGNAL(mapped(QString)), this, SLOT(showSkin(QString))); bottom_layout = new QHBoxLayout(); bottom_layout->addStretch(); bottom_layout->addWidget(first_page_button, 0, Qt::AlignVCenter); bottom_layout->addWidget(previous_page_button, 0, Qt::AlignVCenter); for(int i=0; i<button_list->count(); i++) { QPushButton *page_button = button_list->at(i); bottom_layout->addWidget(page_button, 0, Qt::AlignVCenter); } bottom_layout->addWidget(next_page_button, 0, Qt::AlignVCenter); bottom_layout->addWidget(last_page_button, 0, Qt::AlignVCenter); bottom_layout->addStretch(); bottom_layout->setSpacing(2); bottom_layout->setContentsMargins(0, 10, 0, 0); }
void SkinsWidget::initBottomBar() { QSignalMapper *signal_mapper = new QSignalMapper(this); QList<QPushButton *> *button_list = new QList<QPushButton *>(); for(int i=0; i<page_count; i++) { QPushButton *page_button = new QPushButton(); page_button->setFixedWidth(20); page_button->setText(QString::number(i+1, 10)); page_button->setStyleSheet("color:rgb(0, 120, 230); background:transparent;"); page_button->setCursor(Qt::PointingHandCursor); connect(page_button, SIGNAL(clicked()), signal_mapper, SLOT(map())); signal_mapper->setMapping(page_button, page_button->text()); button_list->push_back(page_button); } first_page_button = new QPushButton(); previous_page_button = new QPushButton(); next_page_button = new QPushButton(); last_page_button = new QPushButton(); first_page_button->setFixedWidth(60); previous_page_button->setFixedWidth(60); next_page_button->setFixedWidth(60); last_page_button->setFixedWidth(60); first_page_button->setCursor(Qt::PointingHandCursor); previous_page_button->setCursor(Qt::PointingHandCursor); next_page_button->setCursor(Qt::PointingHandCursor); last_page_button->setCursor(Qt::PointingHandCursor); first_page_button->setStyleSheet("color:rgb(0, 120, 230); background:transparent;"); previous_page_button->setStyleSheet("color:rgb(0, 120, 230); background:transparent;"); next_page_button->setStyleSheet("color:rgb(0, 120, 230); background:transparent;"); last_page_button->setStyleSheet("color:rgb(0, 120, 230); background:transparent;"); first_page_button->setText(tr("Home"));//首页 previous_page_button->setText(tr("Previous"));//上一页 next_page_button->setText(tr("Next"));//下一页 last_page_button->setText(tr("Last"));//末页 connect(first_page_button, SIGNAL(clicked()), signal_mapper, SLOT(map())); connect(previous_page_button, SIGNAL(clicked()), signal_mapper, SLOT(map())); connect(next_page_button, SIGNAL(clicked()), signal_mapper, SLOT(map())); connect(last_page_button, SIGNAL(clicked()), signal_mapper, SLOT(map())); signal_mapper->setMapping(first_page_button, "first"); signal_mapper->setMapping(previous_page_button, "previous"); signal_mapper->setMapping(next_page_button, "next"); signal_mapper->setMapping(last_page_button, "last"); connect(signal_mapper, SIGNAL(mapped(QString)), this, SLOT(showSkin(QString))); bottomLayout = new QHBoxLayout(); bottomLayout->addStretch(); bottomLayout->addWidget(first_page_button, 0, Qt::AlignVCenter); bottomLayout->addWidget(previous_page_button, 0, Qt::AlignVCenter); for(int i=0; i<button_list->count(); i++) { QPushButton *page_button = button_list->at(i); bottomLayout->addWidget(page_button, 0, Qt::AlignVCenter); } bottomLayout->addWidget(next_page_button, 0, Qt::AlignVCenter); bottomLayout->addWidget(last_page_button, 0, Qt::AlignVCenter); bottomLayout->addStretch(); bottomLayout->setSpacing(2); bottomLayout->setContentsMargins(0, 10, 0, 0); }