1 Star 0 Fork 37

Emiak/SuperDT

forked from 我是唐/SuperDT 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
CMainWindow.cpp 3.67 KB
一键复制 编辑 原始数据 按行查看 历史
TANG-N 提交于 2021-03-19 13:26 . V1.1
#include "CMainWindow.h"
#include "ui_CMainWindow.h"
#include <QDebug>
#include "VSettings.h"
#include "VAbout.h"
#include <QSizePolicy>
#include "CUIHelper.h"
#include "VDialogProtocal.h"
#include "VDialogAscii.h"
#include "CSettings.h"
#include "VDialogPay.h"
CMainWindow::CMainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::CMainWindow)
{
ui->setupUi(this);
QIcon iconVer;
iconVer.addFile(":UI/btn_v_n.png",QSize(32,32),QIcon::Normal);
iconVer.addFile(":UI/ver_c.png",QSize(32,32),QIcon::Active);
ui->toolBar->addAction(iconVer,tr("垂直分屏"));
ui->toolBar->addAction(QIcon(":UI/btn_h_n.png"),tr("水平分屏"));
ui->toolBar->addAction(QIcon(":UI/btn_close_n.png"),tr("关闭分屏"));
connect(ui->toolBar,&QToolBar::actionTriggered,[=](QAction *pAction){
// qDebug()<<pAction->text();
QString strText = pAction->text();
if(tr("垂直分屏") == strText){
ui->vwindowsplitter->slotVSplitScreen();
}else if(tr("水平分屏") == strText){
ui->vwindowsplitter->slotHSplitScreen();
}else if(tr("关闭分屏") == strText){
ui->vwindowsplitter->slotMergeScreen();
}
});
connect(ui->menu_help,&QMenu::triggered,[=](QAction *pAction){
// qDebug()<<pAction->text();
if("action_about" == pAction->objectName()){
VAbout vabout;
vabout.exec();
}else if("action_wave" == pAction->objectName()){
//非模态形式创建
VDialogProtocal dialog;
dialog.exec();
}else if("action_ascii" == pAction->objectName()){
VDialogAscii dialog;
dialog.exec();
}else if("action_zfb" == pAction->objectName()){
VDialogPay dialog(VDialogPay::ENM_PAY_ZFB);
dialog.exec();
}else if("action_wx" == pAction->objectName()){
VDialogPay dialog(VDialogPay::ENM_PAY_WX);
dialog.exec();
}else if("action_list" == pAction->objectName()){
VDialogPay dialog(VDialogPay::ENM_LIST);
dialog.exec();
}
});
connect(ui->menu_settings,&QMenu::triggered,[=](QAction *pAction){
if("action_preference" == pAction->objectName()){
VSettings vsettings;
vsettings.exec();
}
});
// CUIHelper::installQss("D:/TempPro/SuperDTV2/style.qss");
//初始化状态栏
initStatusBar();
}
CMainWindow::~CMainWindow()
{
delete ui;
}
CMainWindow *CMainWindow::getInstance()
{
static CMainWindow *pInstance = nullptr;
if(nullptr == pInstance) {
pInstance = new CMainWindow();
}
return pInstance;
}
void CMainWindow::slotSendBytes(int nBytes)
{
m_pSendLabel->setText(tr("发送:") + QString::number(nBytes) + tr("字节"));
}
void CMainWindow::slotRecvBytes(int nBytes)
{
m_pRecvLabel->setText(tr("接收:") + QString::number(nBytes) + tr("字节"));
}
void CMainWindow::slotTextCode(QString strTextCode)
{
m_pTextCodeLabel->setText(strTextCode);
}
void CMainWindow::initStatusBar()
{
QStatusBar *pBar = this->statusBar();
if(nullptr == pBar)
return ;
m_pTextCodeLabel = new QLabel();
m_pSendLabel = new QLabel(pBar);
m_pRecvLabel = new QLabel(pBar);
m_pBtnRecount = new QPushButton(pBar);
m_pBtnRecount->setText(tr("重新计数"));
connect(m_pBtnRecount,&QPushButton::clicked,[=]{
emit sigRecount();
});
pBar->addPermanentWidget(m_pTextCodeLabel);
pBar->addPermanentWidget(m_pSendLabel);
pBar->addPermanentWidget(m_pRecvLabel);
pBar->addPermanentWidget(m_pBtnRecount);
slotSendBytes(0);
slotRecvBytes(0);
slotTextCode(CSettings::getInstance()->textCode());
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/Emika/super-dt.git
[email protected]:Emika/super-dt.git
Emika
super-dt
SuperDT
master

搜索帮助