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 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())); }
/** * 处理内容:窗体控件的创建 * @param void * @return void */ void MainWnd::createWidget() { // 创建标题栏 m_pTitleBar = new TitleBar(this); connect(m_pTitleBar,SIGNAL(menuClicked()),SLOT(showMenu())); connect(m_pTitleBar,SIGNAL(minClicked()),SLOT(showMin())); connect(m_pTitleBar,SIGNAL(maxClicked()),SLOT(showMax())); connect(m_pTitleBar,SIGNAL(closeClicked()),SLOT(showClose())); // 创建对工具栏 m_pToolBar = new ToolBar(this); // 创建内容区域 m_pContentWidget = new Html5Viewer(this); m_pContentWidget->setOrientation(Html5Viewer::ScreenOrientationAuto); //m_pContentWidget->showExpanded(); //m_pContentWidget->loadFile(QLatin1String("QtStyleSheetsReference.html")); QString strURL = SysSettings::Instance()->value(QString::fromLocal8Bit("url/turl"),QVariant()).toString(); m_pContentWidget->loadUrl(QUrl(strURL)); // 创建状态栏 m_pStatuBar = new StatusBar(this); // // 右键菜单 // connect(this,SIGNAL(customContextMenuRequested(const QPoint&)),this,SLOT(menuRight(const QPoint&))); }
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) : 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); } }