資源簡介
此資源是買來的源碼,包含了Qt常用的控件的CSS代碼,直接加載CSS文件實現(xiàn)換膚。

代碼片段和文件信息
#include?“frmmain.h“
#include?“ui_frmmain.h“
#include?“api/myhelper.h“
frmMain::frmMain(QWidget?*parent)?:
????QDialog(parent)
????ui(new?Ui::frmMain)
{
????ui->setupUi(this);
????this->Initstyle();
????this->InitForm();
????myHelper::FormInCenter(this);
}
frmMain::~frmMain()
{
????delete?ui;
}
void?frmMain::Initstyle()
{
????this->max?=?false;
????this->location?=?this->geometry();
????this->setProperty(“Form“?true);
????this->setProperty(“CanMove“?true);
????this->setWindowtitle(ui->lab_title->text());
????//設置窗體標題欄隱藏
????this->setWindowFlags(Qt::framelessWindowHint?|?Qt::WindowSystemMenuHint?|?Qt::WindowMinimizeButtonHint);
????//安裝事件監(jiān)聽器讓標題欄識別鼠標雙擊
????ui->lab_title->installEventFilter(this);
????Iconhelper::Instance()->SetIcon(ui->btnMenu_Close?QChar(0xf00d));
????Iconhelper::Instance()->SetIcon(ui->btnMenu_Max?QChar(0xf096));
????Iconhelper::Instance()->SetIcon(ui->btnMenu_Min?QChar(0xf068));
????Iconhelper::Instance()->SetIcon(ui->lab_Ico?QChar(0xf015));
????connect(ui->btnMenu_Close?SIGNAL(clicked())?this?SLOT(close()));
????connect(ui->btnMenu_Min?SIGNAL(clicked())?this?SLOT(showMinimized()));
}
bool?frmMain::eventFilter(Qobject?*obj?QEvent?*event)
{
????if?(event->type()?==?QEvent::MouseButtondblclick)?{
????????this->on_btnMenu_Max_clicked();
????????return?true;
????}
????return?Qobject::eventFilter(obj?event);
}
void?frmMain::InitForm()
{
????QStringList?qssName;
????qssName?<“黑色“?<“灰黑色“?<“灰色“?<“淺灰色“?<“深灰色“?<“銀色“?<“淡藍色“?<“藍色“;
????ui->cboxstyle->addItems(qssName);
????myHelper::Sleep(300);
????ui->cboxstyle->setCurrentIndex(3);
}
void?frmMain::on_btnMenu_Max_clicked()
{
????if?(max)?{
????????this->setGeometry(location);
????????Iconhelper::Instance()->SetIcon(ui->btnMenu_Max?QChar(0xf096));
????????ui->btnMenu_Max->setToolTip(“最大化“);
????????this->setProperty(“CanMove“?true);
????}?else?{
????????location?=?this->geometry();
????????this->setGeometry(qApp->desktop()->availableGeometry());
????????Iconhelper::Instance()->SetIcon(ui->btnMenu_Max?QChar(0xf079));
????????ui->btnMenu_Max->setToolTip(“還原“);
????????this->setProperty(“CanMove“?false);
????}
????max?=?!max;
}
void?frmMain::on_pushButton_clicked()
{
????myHelper::ShowMessageBoxInfo(“恭喜你獲得我公司送出的1000萬元大禮一份!“);
}
void?frmMain::on_pushButton_2_clicked()
{
????int?result?=?myHelper::ShowMessageBoxQuesion(“確定真的不要我了嗎?“);
????if?(result?==?1)?{
????????myHelper::ShowMessageBoxInfo(“你好狠心啊!“);
????}?else?{
????????myHelper::ShowMessageBoxInfo(“親愛的我就知道你不會離開我的!“);
????}
}
void?frmMain::on_pushButton_3_clicked()
{
????myHelper::ShowMessageBoxError(“天空飄來五個字!“);
}
void?frmMain::on_pushButton_5_clicked()
{
????bool?ok;
????QString?value?=?myHelper::ShowInputBox(“請輸入姓名:“?ok);
????if?(ok)?{
????????myHelper::ShowMessageBoxInfo(“您輸入的是:“?+?value);
????}
}
void?frmMain::on_cboxstyle_currentIndexChanged(const?QString?&arg1)
{
????QString?qssNam
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2015-06-25?12:48??QUI\
?????目錄???????????0??2015-06-25?10:40??QUI\api\
?????文件?????????899??2015-06-25?10:52??QUI\api\app.cpp
?????文件?????????506??2015-06-25?10:52??QUI\api\app.h
?????文件????????1255??2015-06-25?10:52??QUI\api\appinit.cpp
?????文件?????????433??2015-06-25?10:52??QUI\api\appinit.h
?????文件?????????656??2015-06-25?10:52??QUI\api\icon
?????文件?????????754??2015-06-25?10:52??QUI\api\icon
?????文件????????3393??2015-06-25?10:52??QUI\api\myhelper.h
?????文件????????3979??2015-06-25?10:55??QUI\frmmain.cpp
?????文件?????????843??2015-06-25?10:52??QUI\frmmain.h
?????文件???????33592??2015-05-24?17:29??QUI\frmmain.ui
?????文件?????????260??2015-06-25?10:52??QUI\main.cpp
?????目錄???????????0??2015-06-25?12:34??QUI\other\
?????目錄???????????0??2015-06-25?12:33??QUI\other\image\
?????文件????????2837??2014-10-12?11:12??QUI\other\image\add_bottom.png
?????文件?????????148??2014-10-12?11:12??QUI\other\image\add_left.png
?????文件?????????151??2014-10-12?11:12??QUI\other\image\add_right.png
?????文件????????2838??2014-10-12?11:12??QUI\other\image\add_top.png
?????文件????????6312??2013-12-30?12:24??QUI\other\image\btn_close.png
?????文件????????8207??2013-07-22?20:13??QUI\other\image\btn_ok.png
?????文件?????????691??2014-10-12?11:12??QUI\other\image\checkbox_checked.png
?????文件?????????581??2014-10-12?11:12??QUI\other\image\checkbox_unchecked.png
?????文件??????594652??2014-10-12?11:12??QUI\other\image\Font?Awesome?Cheatsheet.png
?????文件??????141564??2014-10-12?11:12??QUI\other\image\fontawesome-webfont.ttf
?????文件????????2477??2014-10-12?11:12??QUI\other\image\msg_error.png
?????文件????????2956??2014-10-12?11:12??QUI\other\image\msg_info.png
?????文件????????3954??2014-10-12?11:12??QUI\other\image\msg_question.png
?????文件??????117337??2014-10-12?11:12??QUI\other\image\qt_zh_CN.qm
?????文件?????????888??2014-10-12?11:12??QUI\other\image\radio_normal.png
?????文件????????1024??2014-10-12?11:12??QUI\other\image\radio_selected.png
............此處省略21個文件信息
評論
共有 條評論