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

109 lines
3.0 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <QtWidgets/QtWidgets>
#include "QMainFrame.h"
QMainFrame::QMainFrame(QWidget *parent)
: QMainWindow(parent)
{
setupUi(this);
init();
}
QMainFrame::~QMainFrame()
{
}
void QMainFrame::init()
{
initWidget();
initSignal();
initStatusBar();
}
void QMainFrame::initWidget()
{
//标题栏
setWindowTitle( windowTitle() + QString::fromLocal8Bit(" - 版本号v") + QString::fromLocal8Bit( getVersion().c_str()) );
//工具栏
//ui.pActionDataManage->setEnabled( false );
//层叠窗口
m_pWidgetStack = new QMyStackedWidget( this );
setCentralWidget( m_pWidgetStack );
//加入信息录入窗口
m_pWidgetInfoInput = new QTelSalePolicyInfoInputWidget();
m_pWidgetStack->addWidget( m_pWidgetInfoInput, QString::fromLocal8Bit("电销转介绍信息录入窗口") );
m_pWidgetStack->showWidget( QString::fromLocal8Bit("电销转介绍信息录入窗口") );
//加入查询窗口
m_pWidgetQuery = new QTelSalePolicyInfoQuery();
m_pWidgetStack->addWidget( m_pWidgetQuery, QString::fromLocal8Bit("信息查询窗口") );
//加入参数设置窗口
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}" ));
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()
{
//验证
QStatusBar * pStatusBar = this->statusBar();
if ( pStatusBar == NULL )
{
return;
}
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()
{
m_pWidgetStack->showWidget( QString::fromLocal8Bit("电销转介绍信息录入窗口") );
}
void QMainFrame::onShowQueryWidget()
{
m_pWidgetStack->showWidget( QString::fromLocal8Bit("信息查询窗口") );
}
void QMainFrame::onShowSetParameterWidget()
{
m_pWidgetStack->showWidget( QString::fromLocal8Bit("参数配置窗口") );
}