telsale-management/代码/telsale_aux_kit/source/QMainFrame.cpp

109 lines
3.0 KiB
C++
Raw Normal View History

2018-06-02 09:47:28 +00:00
#include <QtWidgets/QtWidgets>
#include "QMainFrame.h"
QMainFrame::QMainFrame(QWidget *parent)
: QMainWindow(parent)
2018-06-01 10:21:26 +00:00
{
setupUi(this);
init();
}
QMainFrame::~QMainFrame()
{
}
void QMainFrame::init()
{
initWidget();
initSignal();
initStatusBar();
}
void QMainFrame::initWidget()
{
2018-06-01 10:21:26 +00:00
//标题栏
setWindowTitle( windowTitle() + QString::fromLocal8Bit(" - 版本号v") + QString::fromLocal8Bit( getVersion().c_str()) );
2018-06-01 10:21:26 +00:00
//工具栏
//ui.pActionDataManage->setEnabled( false );
2018-06-01 10:21:26 +00:00
//层叠窗口
m_pWidgetStack = new QMyStackedWidget( this );
setCentralWidget( m_pWidgetStack );
2018-06-01 10:21:26 +00:00
//加入信息录入窗口
m_pWidgetInfoInput = new QTelSalePolicyInfoInputWidget();
2018-06-01 10:21:26 +00:00
m_pWidgetStack->addWidget( m_pWidgetInfoInput, QString::fromLocal8Bit("电销转介绍信息录入窗口") );
m_pWidgetStack->showWidget( QString::fromLocal8Bit("电销转介绍信息录入窗口") );
2018-06-01 10:21:26 +00:00
//加入查询窗口
m_pWidgetQuery = new QTelSalePolicyInfoQuery();
2018-06-01 10:21:26 +00:00
m_pWidgetStack->addWidget( m_pWidgetQuery, QString::fromLocal8Bit("信息查询窗口") );
2018-06-01 10:21:26 +00:00
//加入参数设置窗口
QScrollArea * pScrollArea = new QScrollArea();
m_pWidgetConfiguration = new QConfigurationWidget();
pScrollArea->setWidget( m_pWidgetConfiguration );
pScrollArea->setAlignment( Qt::AlignLeft | Qt::AlignTop );
pScrollArea->setObjectName( QString::fromLocal8Bit("pScrollAreaInput") );
pScrollArea->setStyleSheet( QString::fromLocal8Bit( "#pScrollAreaInput\n{\n border: none;\n}" ));
2018-06-01 10:21:26 +00:00
m_pWidgetStack->addWidget( pScrollArea, QString::fromLocal8Bit("参数配置窗口") );
}
void QMainFrame::initSignal()
{
connect( pActionInput, SIGNAL(triggered()), this, SLOT(onShowInputWidget()) );
connect( pActionQuery, SIGNAL(triggered()), this, SLOT(onShowQueryWidget()) );
connect( pActionSetParameter, SIGNAL(triggered()), this, SLOT(onShowSetParameterWidget()) );
}
void QMainFrame::resizeEvent( QResizeEvent * pEvent )
{
QMainWindow::resizeEvent( pEvent );
}
void QMainFrame::initStatusBar()
{
2018-06-01 10:21:26 +00:00
//验证
QStatusBar * pStatusBar = this->statusBar();
if ( pStatusBar == NULL )
{
return;
}
2018-06-01 10:21:26 +00:00
QString strDate = QDate::currentDate().toString( QString::fromLocal8Bit("当前日期yyyy年MM月dd日 ") );
QString strUserName = QString::fromLocal8Bit("操作员:") + QString::fromLocal8Bit( getUserName().c_str() ) + QString(" ");
QString strUserCode = QString::fromLocal8Bit("工号:") + QString::fromLocal8Bit( getUserCode().c_str() ) + QString(" ");
//strUser.
pStatusBar->addPermanentWidget( new QLabel(strDate) );
pStatusBar->addPermanentWidget( new QLabel(strUserName) );
pStatusBar->addPermanentWidget( new QLabel(strUserCode) );
}
void QMainFrame::onShowInputWidget()
{
2018-06-01 10:21:26 +00:00
m_pWidgetStack->showWidget( QString::fromLocal8Bit("电销转介绍信息录入窗口") );
}
void QMainFrame::onShowQueryWidget()
{
2018-06-01 10:21:26 +00:00
m_pWidgetStack->showWidget( QString::fromLocal8Bit("信息查询窗口") );
}
void QMainFrame::onShowSetParameterWidget()
{
2018-06-01 10:21:26 +00:00
m_pWidgetStack->showWidget( QString::fromLocal8Bit("参数配置窗口") );
}