ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

test

2021-12-28 04:02:00  阅读:161  来源: 互联网

标签:lable dbstatus show ui mp test btn


一、

  1 void DocM::inital()
  2 {
  3 	mp_lable_dbstatus = new QLabel(this);
  4 	mp_lable_ret = new QLabel(this);
  5 	mp_lable_statistic = new QLabel(this);
  6 	mp_btn_dbstatus = new QPushButton(this);
  7 	mp_btn_dbstatus->setEnabled(false);
  8 	QString str = QString::number(DbUtil::getInstance().getBookCount());
  9 	mp_lable_statistic->setText(QString::fromLocal8Bit("系统中图书数量:%1 册").arg(str));
 10 	mp_lable_statistic->setStyleSheet("background-color: rgb(211, 211, 211);");
 11 
 12 	QFont pret;
 13 	pret.setBold(true);
 14 	mp_lable_ret->setFont(pret);
 15 	mp_lable_ret->setStyleSheet("QLabel{color:rgb(66, 133, 245);}");
 16 	mp_lable_ret->setText(QString::fromLocal8Bit("匹配书籍:20册"));
 17 
 18 
 19 	mp_btn_dbstatus->setMaximumHeight(25);
 20 	mp_btn_dbstatus->setMaximumWidth(25);
 21 	mp_btn_dbstatus->setMask(QRegion(0, 0, 22, 22, QRegion::Ellipse));
 22 
 23 	QFont font = mp_btn_dbstatus->font();
 24 	font.setPointSize(8);
 25 	mp_btn_dbstatus->setFont(font);
 26 	mp_btn_dbstatus->setStyleSheet("background-color: rgb(0, 255, 0);");
 27 	mp_btn_dbstatus->setText(QString::fromLocal8Bit("正常"));
 28 	if (DbUtil::getInstance().check())
 29 	{
 30 		mp_btn_dbstatus->setStyleSheet("background-color: rgb(0, 255, 0);");
 31 		mp_btn_dbstatus->setText(QString::fromLocal8Bit("正常"));
 32 	}
 33 	else
 34 	{
 35 		mp_btn_dbstatus->setStyleSheet("background-color: rgb(255, 0, 0);");
 36 		mp_btn_dbstatus->setText(QString::fromLocal8Bit("断开"));
 37 	}
 38 
 39 
 40 	mp_lable_dbstatus->setText(QString::fromLocal8Bit("数据库连接:"));
 41 
 42 	ui.statusBar->addWidget(mp_lable_statistic);
 43 	ui.statusBar->addWidget(mp_lable_ret);
 44 	ui.statusBar->addPermanentWidget(mp_lable_dbstatus);
 45 	ui.statusBar->addPermanentWidget(mp_btn_dbstatus);
 46 
 47 	ui.pb_search->setStyleSheet("background-color: rgb(220, 220, 220);");
 48 
 49 	ui.tbv_show->horizontalHeader()->setHighlightSections(false);
 50 	QFont fh_header = ui.tbv_show->horizontalHeader()->font();
 51 	fh_header.setFamily("song");
 52 	fh_header.setPointSize(14);
 53 	fh_header.setBold(true);
 54 	ui.tbv_show->horizontalHeader()->setFont(fh_header);
 55 	ui.tbv_show->horizontalHeader()->setStyleSheet("QHeaderView::section{background:DimGray;color:rgb(255, 255, 255)}");
 56 	ui.tbv_show->horizontalHeader()->setSortIndicatorShown(true);
 57 	ui.tbv_show->horizontalHeader()->setSortIndicator(0, Qt::SortOrder::AscendingOrder);
 58 	ui.tbv_show->verticalHeader()->setStyleSheet("QHeaderView::section{background:white; color:black;}");
 59 	QFont fv_header = ui.tbv_show->verticalHeader()->font();
 60 	fv_header.setFamily("song");
 61 	fv_header.setPointSize(10);
 62 	ui.tbv_show->verticalHeader()->setFont(fv_header);
 63 
 64 	ui.tbv_show->hide();
 65 	ui.tbv_show->horizontalHeader()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
 66 	mp_lable_ret->hide();
 67 }
 68 

 

 

  1 void DocM::inital()
  2 {
  3 	mp_lable_dbstatus = new QLabel(this);
  4 	mp_lable_ret = new QLabel(this);
  5 	mp_lable_statistic = new QLabel(this);
  6 	mp_btn_dbstatus = new QPushButton(this);
  7 	mp_btn_dbstatus->setEnabled(false);
  8 	QString str = QString::number(DbUtil::getInstance().getBookCount());
  9 	mp_lable_statistic->setText(QString::fromLocal8Bit("系统中图书数量:%1 册").arg(str));
 10 	mp_lable_statistic->setStyleSheet("background-color: rgb(211, 211, 211);");
 11 
 12 	QFont pret;
 13 	pret.setBold(true);
 14 	mp_lable_ret->setFont(pret);
 15 	mp_lable_ret->setStyleSheet("QLabel{color:rgb(66, 133, 245);}");
 16 	mp_lable_ret->setText(QString::fromLocal8Bit("匹配书籍:20册"));
 17 
 18 
 19 	mp_btn_dbstatus->setMaximumHeight(25);
 20 	mp_btn_dbstatus->setMaximumWidth(25);
 21 	mp_btn_dbstatus->setMask(QRegion(0, 0, 22, 22, QRegion::Ellipse));
 22 
 23 	QFont font = mp_btn_dbstatus->font();
 24 	font.setPointSize(8);
 25 	mp_btn_dbstatus->setFont(font);
 26 	mp_btn_dbstatus->setStyleSheet("background-color: rgb(0, 255, 0);");
 27 	mp_btn_dbstatus->setText(QString::fromLocal8Bit("正常"));
 28 	if (DbUtil::getInstance().check())
 29 	{
 30 		mp_btn_dbstatus->setStyleSheet("background-color: rgb(0, 255, 0);");
 31 		mp_btn_dbstatus->setText(QString::fromLocal8Bit("正常"));
 32 	}
 33 	else
 34 	{
 35 		mp_btn_dbstatus->setStyleSheet("background-color: rgb(255, 0, 0);");
 36 		mp_btn_dbstatus->setText(QString::fromLocal8Bit("断开"));
 37 	}
 38 
 39 
 40 	mp_lable_dbstatus->setText(QString::fromLocal8Bit("数据库连接:"));
 41 
 42 	ui.statusBar->addWidget(mp_lable_statistic);
 43 	ui.statusBar->addWidget(mp_lable_ret);
 44 	ui.statusBar->addPermanentWidget(mp_lable_dbstatus);
 45 	ui.statusBar->addPermanentWidget(mp_btn_dbstatus);
 46 
 47 	ui.pb_search->setStyleSheet("background-color: rgb(220, 220, 220);");
 48 
 49 	ui.tbv_show->horizontalHeader()->setHighlightSections(false);
 50 	QFont fh_header = ui.tbv_show->horizontalHeader()->font();
 51 	fh_header.setFamily("song");
 52 	fh_header.setPointSize(14);
 53 	fh_header.setBold(true);
 54 	ui.tbv_show->horizontalHeader()->setFont(fh_header);
 55 	ui.tbv_show->horizontalHeader()->setStyleSheet("QHeaderView::section{background:DimGray;color:rgb(255, 255, 255)}");
 56 	ui.tbv_show->horizontalHeader()->setSortIndicatorShown(true);
 57 	ui.tbv_show->horizontalHeader()->setSortIndicator(0, Qt::SortOrder::AscendingOrder);
 58 	ui.tbv_show->verticalHeader()->setStyleSheet("QHeaderView::section{background:white; color:black;}");
 59 	QFont fv_header = ui.tbv_show->verticalHeader()->font();
 60 	fv_header.setFamily("song");
 61 	fv_header.setPointSize(10);
 62 	ui.tbv_show->verticalHeader()->setFont(fv_header);
 63 
 64 	ui.tbv_show->hide();
 65 	ui.tbv_show->horizontalHeader()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
 66 	mp_lable_ret->hide();
 67 }
 68 

标签:lable,dbstatus,show,ui,mp,test,btn
来源: https://www.cnblogs.com/mehome/p/15739142.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有