bool CIwGameUITabs::LoadFromXoml(IIwGameXomlResource* parent, bool load_children, CIwGameXmlNode* node) { if (parent->getClassTypeHash() != CIwGameXomlNames::Scene_Hash && parent->getClassTypeHash() != CIwGameXomlNames::Actor_Hash) { CIwGameError::LogError("Error: XOML - Tabs needs to be declared inside a scene or an actor"); return false; } Orientation = Orientation_Horizontal; // Load main actor attributes if (!CIwGameUIListBox::LoadFromXoml(parent, false, node)) return false; InitTabs(); if (load_children) { // Process inner tags if (!IW_GAME_XOML->Process(this, node)) return false; } return true; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), strIconApp(":/AppIcon/Resources/AppIcon_ArchitectureBuilding_96px.ico"), strIconConnectCardReader(":/ToolbarIcons/Resources/connect_72px.ico"), strIconDisconnectCardReader(":/ToolbarIcons/Resources/disconnect_72px.ico"), strIconOwnerCard(":/ToolbarIcons/Resources/users_72px.ico"), strIconManagerCard(":/ToolbarIcons/Resources/administrator_72px.ico"), strIconFunctionCard(":/ToolbarIcons/Resources/FuncCard_72px.ico"), strIconRemoteOperation(":/ToolbarIcons/Resources/remote_72px.ico"), strIconStatisticalAnalysis(":/ToolbarIcons/Resources/Statistics_72px.ico"), strIconElevatorManage(":/ToolbarIcons/Resources/Management_72px.ico"), strIconSystemSetting(":/ToolbarIcons/Resources/setting_72px.ico"), strIconHelpSupport(":/ToolbarIcons/Resources/Help_72px.ico"), strIconExitApp(":/ToolbarIcons/Resources/exit_72px.ico"), strPathQssFile(":/CSS/StyleSheet.qss"), clrBKApp(QColor(100,200,200)), ui(new Ui::MainWindow) { ui->setupUi(this); pMainWnd=this; //读取ini配置文件 setIniFile=new QSettings("AppSetting.ini",QSettings::IniFormat); setIniFile->setIniCodec(QTextCodec::codecForName("GB2312")); //setIniFile->setValue("/SystemSetting/Company", "北京凯瑞通电子技术有限公司"); setIniFile->beginGroup("SystemSetting"); QString strCompanyName=setIniFile->value("Company").toString(); setIniFile->endGroup(); //加载CSS样式表文件并应用相应样式 QFile qssFile(strPathQssFile); if(qssFile.exists()) { qssFile.open(QFile::ReadOnly); if(qssFile.isOpen()) { QString qss = QLatin1String(qssFile.readAll()); qApp->setStyleSheet(qss); qssFile.close(); } } else { QMessageBox::warning(NULL,"Qss文件错误",strPathQssFile+"找不到!"); return; } //限制窗口大小 this->setMaximumSize(1500,1000); //设置应用程序背景色 QPalette *paletteApp=new QPalette(); paletteApp->setColor(QPalette::Background,clrBKApp); this->setPalette(*paletteApp); delete paletteApp; //设置应用程序图标 this->setWindowIcon(QIcon(strIconApp)); //隐藏标题栏 this->setWindowFlags(Qt::FramelessWindowHint); //主窗体菜单栏初始化 ui->menuBar->hide(); //主窗体状态栏初始化 strUsrName = "abc"; strUsrLevel = "系统管理员"; QString strLabelUsrInfo = "用户名:"+strUsrName+" 用户级别:"+strUsrLevel; QLabel *labelCompanyName=new QLabel; labelCompanyName->setText(strLabelUsrInfo); statusBar()->addWidget(labelCompanyName); //主窗体工具栏初始化 InitToolBar(); //主窗体Tabs初始化 InitTabs(); //主窗体信息窗口初始化 InitVBoxInfos(); //主窗体框架初始化 layoutHBoxMain=new QHBoxLayout(ui->centralWidget); layoutHBoxMain->addLayout(layoutVBoxTabs); layoutHBoxMain->addWidget(grpboxInfos); TabWidgetDisplay(0); //获取MainWindows的句柄 hMainWnd=(HWND)this->winId(); //启动指定序号设备插拔监视 ch375rw.SetDeviceNotify(); //检查读卡器是否连接上 bool isConnected; if(!ch375rw.OpenDevice()) { isConnected=false; } else { isConnected=true; ch375rw.Beep(1); } isConnected=true; ConnectedCardReader(isConnected); }
BOOL CDlgMaintabDownload::OnInitDialog() { CResizableDialog::OnInitDialog(); // get last active tab id in MaintabDownload int nLastActiveTab = thePrefs.GetMaintabDownloadLastActiveTab(); ETabId eLastActiveTabId; switch (nLastActiveTab) { case TI_DOWNLOADING: eLastActiveTabId = TI_DOWNLOADING; break; case TI_DOWNLOADED: eLastActiveTabId = TI_DOWNLOADED; break; case TI_RSSWND: eLastActiveTabId = TI_RSSWND; break; default: eLastActiveTabId = TI_DOWNLOADING; break; } ModifyStyle(0, WS_CLIPCHILDREN); theWndMgr.SetWndHandle(CWndMgr::WI_MAINTAB_DOWNLOAD_DLG, m_hWnd); InitTabs(); if(thePrefs.GetSplitterbarPositionDownload() == 100) { m_wndSplitter.m_nflag = 0; m_wndSplitter.m_bActive = FALSE; } else { m_wndSplitter.m_nflag = 1; m_wndSplitter.m_bActive = TRUE; } //m_wndSplitter.m_nflag = 1; CRect rcWnd; GetWindowRect(rcWnd); ScreenToClient(rcWnd); InitControlContainer(); LONG splitpos = thePrefs.GetSplitterbarPositionDownload() * rcWnd.Height() / 100; CRect rcDlgItem; m_DownloadTabWnd.GetWindowRect(rcDlgItem); ScreenToClient(rcDlgItem); rcDlgItem.bottom = splitpos - m_wndSplitter.GetHBreadth(); m_DownloadTabWnd.MoveWindow(rcDlgItem); m_tabwndInfo.GetWindowRect(rcDlgItem); ScreenToClient(rcDlgItem); rcDlgItem.top = splitpos; m_tabwndInfo.MoveWindow(rcDlgItem); AddAnchor(m_DownloadTabWnd, TOP_LEFT, CSize(100, thePrefs.GetSplitterbarPositionDownload())); AddAnchor(m_wndSplitter, CSize(0, thePrefs.GetSplitterbarPositionDownload()), BOTTOM_RIGHT); AddAnchor(m_tabwndInfo, CSize(0, thePrefs.GetSplitterbarPositionDownload()), BOTTOM_RIGHT); SetDownloadlistActiveTab(eLastActiveTabId); return TRUE; }