void Login::Login_layout_init() { /*top*/ Close_Btn = new Push_Btn(); Min_Btn = new Push_Btn(); Title_label = new QLabel(); top_lable = new QLabel(); top_img = new QMovie(); //Keep QFont TitleFont("楷体", 12, QFont::Bold); Title_label->setFixedSize(400,35); Title_label->setStyleSheet("background-color:rgb(23, 197, 104); color:white;"); Min_Btn->Load_Pixmap_keven(":/SysButton/min"); Close_Btn->Load_Pixmap_keven(":/SysButton/close"); Title_label->setText(tr("Smart L")); Title_label->setFont(TitleFont); Title_label->setAlignment(Qt::AlignCenter); top_layout = new QHBoxLayout(); top_layout->addWidget(Title_label); top_layout->addWidget(Min_Btn); top_layout->addWidget(Close_Btn); top_layout->setMargin(0); top_layout->setSpacing(0); /*middle*/ User_Name = new QLineEdit(); Passwd = new QLineEdit(); Regiser_account = new QLabel(); Forget_Passwd = new QLabel(); Auto_login = new QCheckBox(); Remind_passwd = new QCheckBox(); User_Name->setPlaceholderText(tr("Account")); User_Name->setFixedSize(150, 30); Passwd->setPlaceholderText(tr("Passwd")); Passwd->setEchoMode(QLineEdit::Password); Passwd->setFixedSize(150, 30); Regiser_account->setText("<a href = http://blog.csdn.net/ongoingcre>" + tr("Register") + "</a>"); Regiser_account->setFixedSize(50,30); Forget_Passwd->setText("<a href = http://blog.csdn.net/ongoingcre>" + tr("Forget") + "</a>"); Forget_Passwd->setFixedSize(50,30); Auto_login->setText(tr("Auto Login")); Auto_login->setFixedSize(100,30); Remind_passwd->setText(tr("Remind Passwd")); Remind_passwd->setFixedSize(100,30); //Regiser_account->setStyleSheet("background-color:red"); middle_layout = new QGridLayout(); middle_layout->addWidget(User_Name,0,0,Qt::AlignCenter); middle_layout->addWidget(Regiser_account,0,1,Qt::AlignRight); middle_layout->addWidget(Passwd,1,0,Qt::AlignCenter); middle_layout->addWidget(Forget_Passwd,1,1,Qt::AlignRight); middle_layout->addWidget(Auto_login,2,0,Qt::AlignCenter); middle_layout->addWidget(Remind_passwd,2,1,Qt::AlignCenter); //middle_layout->setMargin(0); middle_layout->setSpacing(25); middle_layout->setContentsMargins(100,75,80,15); middle_layout->setColumnStretch(6,1); /*bottom*/ Login_Btn = new Bottom_Btn(); Qrcode_Btn = new QPushButton(); Qrcode_Btn->setFixedSize(35,25); Qrcode_Btn->setCursor(QCursor(Qt::PointingHandCursor)); //Login_Btn->setFixedSize(200,35); Qrcode = new QLabel(); Qrcode->setFixedSize(65,35); Login_Btn->Load_Beside_img("",tr("Login"),200,35,25); Login_Btn->setShortcut(Qt::Key_Enter); //设置快捷键为Enter Login_Btn->setShortcut(QKeySequence::InsertParagraphSeparator); //回车快捷键 Login_Btn->setFocus(); QFont BottomFont("楷体", 10.5, QFont::Bold); Login_Btn->setFont(BottomFont); Qrcode_Btn->setIcon(QIcon(":/Mainmenu/qrcode")); Qrcode_Btn->setFlat(true); bottom_layout = new QHBoxLayout(); //bottom_layout->addStretch(0); bottom_layout->addWidget(Login_Btn); bottom_layout->addWidget(Qrcode); bottom_layout->addWidget(Qrcode_Btn); bottom_layout->setMargin(0); bottom_layout->setSpacing(0); bottom_layout->setContentsMargins(100,0,0,15); /**/ page_1_login = new QWidget(this); page_1_login->setLayout(middle_layout); page_1_login->setStyleSheet("background-color:white"); main_layout = new QStackedLayout(); main_layout->addWidget(page_1_login); main_layout->addWidget(page_2_qrcode); main_layout->setMargin(0); main_layout->setSpacing(0); main_layout->setCurrentWidget(page_1_login); /*main layout*/ layout = new QVBoxLayout(this); layout->addLayout(top_layout); layout->addLayout(main_layout); layout->addLayout(bottom_layout); //layout->addStretch(0); layout->setMargin(0); layout->setSpacing(0); this->setLayout(layout); /*自动补全*/ QStringList word_list; word_list<<"admin"<<"user"; m_completer = new QCompleter(word_list, this); m_completer->setCaseSensitivity(Qt::CaseInsensitive); User_Name->setCompleter(m_completer); /*SIGNAL TO SLOT*/ connect(Close_Btn,SIGNAL(clicked()),this,SLOT(close())); connect(Regiser_account,SIGNAL(linkActivated(QString)),this,SLOT(OpenUrl(QString ))); connect(Forget_Passwd,SIGNAL(linkActivated(QString)),this,SLOT(OpenUrl(QString ))); connect(Login_Btn,SIGNAL(clicked()),this,SLOT(Login_response())); connect(Min_Btn,SIGNAL(clicked()),this,SLOT(hide())); connect(Qrcode_Btn,SIGNAL(clicked()),this,SLOT(Qrcode_Btn_clicked())); }
/*!**************************************************************************** @Function InitView @Return bool true if no error occurred @Description Code in InitView() will be called by PVRShell upon initialization or after a change in the rendering context. Used to initialize variables that are dependent on the rendering context (e.g. textures, vertex buffers, etc.) ******************************************************************************/ bool OGLES2IntroducingPrint3D::InitView() { /* Initialize the textures used by Print3D. To properly display text, Print3D needs to know the viewport dimensions and whether the text should be rotated. We get the dimensions using the shell function PVRShellGet(prefWidth/prefHeight). We can also get the rotate parameter by checking prefIsRotated and prefFullScreen. */ bool bRotate = PVRShellGet(prefIsRotated) && PVRShellGet(prefFullScreen); // Retrieve screen metrics from PVRShell unsigned int uiWidth = PVRShellGet(prefWidth); unsigned int uiHeight = PVRShellGet(prefHeight); /* The fonts are loaded here using a PVRTool's ResourceFile wrapper. However, it is possible to load the textures in any way that provides access to a pointer to memory, and the size of the file. */ CPVRTResourceFile CustomFont(c_szTextFile); if(!CustomFont.IsOpen()) { PVRShellSet(prefExitMessage, "ERROR: Failed to load font file!"); return false; } CPVRTResourceFile IntroFont(c_szIntroFile); if(!IntroFont.IsOpen()) { PVRShellSet(prefExitMessage, "ERROR: Failed to load font file!"); return false; } // Determine which size title font to use. unsigned int uiMinScreenLen = PVRT_MIN(uiWidth, uiHeight); const char* pTitleFontFile = NULL; if(uiMinScreenLen >= 720) pTitleFontFile = c_szTitleFont[eFontSize_56]; else if(uiMinScreenLen >= 640) pTitleFontFile = c_szTitleFont[eFontSize_46]; else pTitleFontFile = c_szTitleFont[eFontSize_36]; CPVRTResourceFile TitleFont(pTitleFontFile); if(!TitleFont.IsOpen()) { PVRShellSet(prefExitMessage, "ERROR: Failed to load font file!"); return false; } /* The first version of Print3D.SetTextures() presented here sets up m_Print3D with default, built-in textures. The overloaded functions provided allow user-defined textures to be loaded instead. Please refer to PVRTexTool's user manual for instructions on generating fonts files. */ m_Print3D.SetTextures(NULL, uiWidth, uiHeight, bRotate); m_CentralText.SetTextures(NULL, CustomFont.DataPtr(), uiWidth, uiHeight, bRotate); m_IntroText.SetTextures(NULL, IntroFont.DataPtr(), uiWidth, uiHeight, bRotate); m_TitleText.SetTextures(NULL, TitleFont.DataPtr(), uiWidth, uiHeight, bRotate); // Sets the clear color glClearColor(0.0f, 0.0f, 0.0f, 1.0f); // Generate background texture GenerateBackgroundTexture(uiWidth, uiHeight); m_ulStartTime = PVRShellGetTime(); return true; }