abc

void DocM::inital()
{
    mp_lable_dbstatus = new QLabel(this);
    mp_lable_ret = new QLabel(this);
    mp_lable_statistic = new QLabel(this);
    mp_btn_dbstatus = new QPushButton(this);
    mp_btn_dbstatus->setEnabled(false);
    QString str = QString::number(DbUtil::getInstance().getBookCount());
    mp_lable_statistic->setText(QString::fromLocal8Bit("系统中图书数量:%1 册").arg(str));
    mp_lable_statistic->setStyleSheet("background-color: rgb(211, 211, 211);");

    QFont pret;
    pret.setBold(true);
    mp_lable_ret->setFont(pret);
    mp_lable_ret->setStyleSheet("QLabel{color:rgb(66, 133, 245);}");
    mp_lable_ret->setText(QString::fromLocal8Bit("匹配书籍:20册"));


    mp_btn_dbstatus->setMaximumHeight(25);
    mp_btn_dbstatus->setMaximumWidth(25);
    mp_btn_dbstatus->setMask(QRegion(0, 0, 22, 22, QRegion::Ellipse));

    QFont font = mp_btn_dbstatus->font();
    font.setPointSize(8);
    mp_btn_dbstatus->setFont(font);
    mp_btn_dbstatus->setStyleSheet("background-color: rgb(0, 255, 0);");
    mp_btn_dbstatus->setText(QString::fromLocal8Bit("正常"));
    if (DbUtil::getInstance().check())
    {
        mp_btn_dbstatus->setStyleSheet("background-color: rgb(0, 255, 0);");
        mp_btn_dbstatus->setText(QString::fromLocal8Bit("正常"));
    }
    else
    {
        mp_btn_dbstatus->setStyleSheet("background-color: rgb(255, 0, 0);");
        mp_btn_dbstatus->setText(QString::fromLocal8Bit("断开"));
    }


    mp_lable_dbstatus->setText(QString::fromLocal8Bit("数据库连接:"));

    ui.statusBar->addWidget(mp_lable_statistic);
    ui.statusBar->addWidget(mp_lable_ret);
    ui.statusBar->addPermanentWidget(mp_lable_dbstatus);
    ui.statusBar->addPermanentWidget(mp_btn_dbstatus);

    ui.pb_search->setStyleSheet("background-color: rgb(220, 220, 220);");

    ui.tbv_show->horizontalHeader()->setHighlightSections(false);
    QFont fh_header = ui.tbv_show->horizontalHeader()->font();
    fh_header.setFamily("song");
    fh_header.setPointSize(14);
    fh_header.setBold(true);
    ui.tbv_show->horizontalHeader()->setFont(fh_header);
    ui.tbv_show->horizontalHeader()->setStyleSheet("QHeaderView::section{background:DimGray;color:rgb(255, 255, 255)}");
    ui.tbv_show->horizontalHeader()->setSortIndicatorShown(true);
    ui.tbv_show->horizontalHeader()->setSortIndicator(0, Qt::SortOrder::AscendingOrder);
    ui.tbv_show->verticalHeader()->setStyleSheet("QHeaderView::section{background:white; color:black;}");
    QFont fv_header = ui.tbv_show->verticalHeader()->font();
    fv_header.setFamily("song");
    fv_header.setPointSize(10);
    ui.tbv_show->verticalHeader()->setFont(fv_header);

    ui.tbv_show->hide();
    ui.tbv_show->horizontalHeader()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
    mp_lable_ret->hide();
}
void DocM::inital()
{
    mp_lable_dbstatus = new QLabel(this);
    mp_lable_ret = new QLabel(this);
    mp_lable_statistic = new QLabel(this);
    mp_btn_dbstatus = new QPushButton(this);
    mp_btn_dbstatus->setEnabled(false);
    QString str = QString::number(DbUtil::getInstance().getBookCount());
    mp_lable_statistic->setText(QString::fromLocal8Bit("系统中图书数量:%1 册").arg(str));
    mp_lable_statistic->setStyleSheet("background-color: rgb(211, 211, 211);");

    QFont pret;
    pret.setBold(true);
    mp_lable_ret->setFont(pret);
    mp_lable_ret->setStyleSheet("QLabel{color:rgb(66, 133, 245);}");
    mp_lable_ret->setText(QString::fromLocal8Bit("匹配书籍:20册"));


    mp_btn_dbstatus->setMaximumHeight(25);
    mp_btn_dbstatus->setMaximumWidth(25);
    mp_btn_dbstatus->setMask(QRegion(0, 0, 22, 22, QRegion::Ellipse));

    QFont font = mp_btn_dbstatus->font();
    font.setPointSize(8);
    mp_btn_dbstatus->setFont(font);
    mp_btn_dbstatus->setStyleSheet("background-color: rgb(0, 255, 0);");
    mp_btn_dbstatus->setText(QString::fromLocal8Bit("正常"));
    if (DbUtil::getInstance().check())
    {
        mp_btn_dbstatus->setStyleSheet("background-color: rgb(0, 255, 0);");
        mp_btn_dbstatus->setText(QString::fromLocal8Bit("正常"));
    }
    else
    {
        mp_btn_dbstatus->setStyleSheet("background-color: rgb(255, 0, 0);");
        mp_btn_dbstatus->setText(QString::fromLocal8Bit("断开"));
    }


    mp_lable_dbstatus->setText(QString::fromLocal8Bit("数据库连接:"));

    ui.statusBar->addWidget(mp_lable_statistic);
    ui.statusBar->addWidget(mp_lable_ret);
    ui.statusBar->addPermanentWidget(mp_lable_dbstatus);
    ui.statusBar->addPermanentWidget(mp_btn_dbstatus);

    ui.pb_search->setStyleSheet("background-color: rgb(220, 220, 220);");

    ui.tbv_show->horizontalHeader()->setHighlightSections(false);
    QFont fh_header = ui.tbv_show->horizontalHeader()->font();
    fh_header.setFamily("song");
    fh_header.setPointSize(14);
    fh_header.setBold(true);
    ui.tbv_show->horizontalHeader()->setFont(fh_header);
    ui.tbv_show->horizontalHeader()->setStyleSheet("QHeaderView::section{background:DimGray;color:rgb(255, 255, 255)}");
    ui.tbv_show->horizontalHeader()->setSortIndicatorShown(true);
    ui.tbv_show->horizontalHeader()->setSortIndicator(0, Qt::SortOrder::AscendingOrder);
    ui.tbv_show->verticalHeader()->setStyleSheet("QHeaderView::section{background:white; color:black;}");
    QFont fv_header = ui.tbv_show->verticalHeader()->font();
    fv_header.setFamily("song");
    fv_header.setPointSize(10);
    ui.tbv_show->verticalHeader()->setFont(fv_header);

    ui.tbv_show->hide();
    ui.tbv_show->horizontalHeader()->setSectionResizeMode(0, QHeaderView::ResizeToContents);
    mp_lable_ret->hide();
}
上一篇:高性能MySql学习笔记-附录


下一篇:testaaa