Commit 35553cad by ss.dai

程序完工(云鹏)

parent 945de392
...@@ -635,3 +635,24 @@ void FlowControl::onReEntryOrder(const QString &orderId) ...@@ -635,3 +635,24 @@ void FlowControl::onReEntryOrder(const QString &orderId)
emit showAlert(AlertForm::SUCCESS, "补录销售单成功"); emit showAlert(AlertForm::SUCCESS, "补录销售单成功");
} }
} }
QStringList FlowControl::GetSearchResult(const QString &orderNum)
{
QStringList tmplist;
if(!orderNum.isEmpty())
{
QMap<QString, OrderObject*>::iterator i;
for(i = m_ordersMap.begin(); i!=m_ordersMap.end(); i++)
{
QString tmpOrderId = i.key();
while (!tmpOrderId.at(0).isDigit()) {
tmpOrderId = tmpOrderId.mid(1);
}
if(tmpOrderId.startsWith(orderNum))
{
tmplist.append(i.key());
}
}
}
return tmplist;
}
...@@ -198,6 +198,11 @@ public slots: ...@@ -198,6 +198,11 @@ public slots:
* 返回:NULL * 返回:NULL
* */ * */
void onReEntryOrder(const QString& orderId); void onReEntryOrder(const QString& orderId);
/* 功能:根据订单号搜索订单
* 参数:订单号
* 返回:NULL
* */
QStringList GetSearchResult(const QString &orderNum);
}; };
#endif // FLOWCONTROL_H #endif // FLOWCONTROL_H
...@@ -22,6 +22,7 @@ ConfigManger::SqlConnectInfo ConfigManger::GetSqlConnectInfo() ...@@ -22,6 +22,7 @@ ConfigManger::SqlConnectInfo ConfigManger::GetSqlConnectInfo()
{ {
SqlConnectInfo info; SqlConnectInfo info;
info.host = m_userConfig->value(INI_HOST).toString(); info.host = m_userConfig->value(INI_HOST).toString();
qDebug()<<info.host;
info.username = m_userConfig->value(INI_USERNAME).toString(); info.username = m_userConfig->value(INI_USERNAME).toString();
info.password = m_userConfig->value(INI_PASSWORD).toString(); info.password = m_userConfig->value(INI_PASSWORD).toString();
info.database = m_userConfig->value(INI_DATABASE).toString(); info.database = m_userConfig->value(INI_DATABASE).toString();
......
#include "ClickedLineEdit.h"
void ClickedLineEdit::mousePressEvent(QMouseEvent *event)
{
if (event->button()==Qt::LeftButton)//拦截点击左键动作
{
emit ShowNumPad();
event->accept();//默认处理过程
}
return;
}
#ifndef CLICKEDLINEEDIT_H
#define CLICKEDLINEEDIT_H
#include <QMouseEvent>
#include <QLineEdit>
class ClickedLineEdit : public QLineEdit
{
Q_OBJECT
public:
ClickedLineEdit(QWidget *parent = 0)
:QLineEdit(parent){}
protected:
void mousePressEvent(QMouseEvent *event);
signals:
void ShowNumPad();
};
#endif // CLICKEDLINEEDIT_H
#include "SysTray.h"
SysTray::SysTray(QObject *parent) :
QSystemTrayIcon(parent)
{
creatMenu();
this->setIcon( QIcon(":takeaway.ico"));
connect(this , SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(iconIsActived(QSystemTrayIcon::ActivationReason)));
}
void SysTray::creatMenu()
{
QMenu *menu = new QMenu();
QAction *quit = new QAction( tr("退出"),menu);
connect( quit ,&QAction::triggered, this, &SysTray::sgExit);
menu->addAction(quit);
menu->setStyleSheet( "QMenu\
{\
font: 10pt \"新宋体\";\
color: rgb(0, 0, 0);\
}\
");
this->setContextMenu( menu);
}
void SysTray::iconIsActived(QSystemTrayIcon::ActivationReason reason)
{
switch(reason)
{ //点击托盘显示窗口
case QSystemTrayIcon::Trigger:
emit sgOpenMainDialog();
break;
case QSystemTrayIcon::DoubleClick:
emit sgOpenMainDialog();
break;
default:
break;
}
}
#ifndef SYSTRAY_H
#define SYSTRAY_H
#include <QSystemTrayIcon>
#include <QAction>
#include <QMenu>
class SysTray : public QSystemTrayIcon
{
Q_OBJECT
public:
explicit SysTray(QObject *parent = 0);
void creatMenu();
signals:
void sgOpenMainDialog(); //打开main
void sgExit(); //退出
private slots:
void iconIsActived(QSystemTrayIcon::ActivationReason reason);
};
#endif // SYSTRAY_H
...@@ -48,6 +48,7 @@ bool BillSocket::Request(const QJsonObject &requestJson, QJsonObject &recvJson, ...@@ -48,6 +48,7 @@ bool BillSocket::Request(const QJsonObject &requestJson, QJsonObject &recvJson,
return false; return false;
} }
recvJson = QJsonDocument::fromJson(recvArray).object(); recvJson = QJsonDocument::fromJson(recvArray).object();
qDebug() << recvJson;
reply->deleteLater(); reply->deleteLater();
return true; return true;
......
#include "NumpadForm.h"
#include "ui_NumpadForm.h"
NumpadForm::NumpadForm(QWidget *parent) :
QDialog(parent),
ui(new Ui::NumpadForm)
{
ui->setupUi(this);
this->setWindowFlags(Qt::FramelessWindowHint);
this->setAttribute(Qt::WA_TranslucentBackground);
this->move(parent->width()*2/3, parent->height()/3);
this->hide();
for(int i=0; i<10; i++)
{
QPushButton *targetBtn = this->findChild<QPushButton*>(QString("numpadBtn%1").arg(i));
if(targetBtn!=NULL)
{
connect(targetBtn, &QPushButton::clicked, this, &NumpadForm::onNumBtnClicked);
}
}
}
NumpadForm::~NumpadForm()
{
delete ui;
}
void NumpadForm::onNumBtnClicked()
{
QPushButton *targetBtn = (QPushButton*)sender();
emit inputNum(targetBtn->property("num").toInt());
}
void NumpadForm::on_numpadBtnCancle_clicked()
{
emit cleanInput();
this->hide();
}
void NumpadForm::on_numpadBtnDel_clicked()
{
emit backInput();
}
#ifndef NUMPADFORM_H
#define NUMPADFORM_H
#include <QDialog>
namespace Ui {
class NumpadForm;
}
class NumpadForm : public QDialog
{
Q_OBJECT
public:
explicit NumpadForm(QWidget *parent = 0);
~NumpadForm();
private:
Ui::NumpadForm *ui;
private slots:
void onNumBtnClicked();
void on_numpadBtnCancle_clicked();
void on_numpadBtnDel_clicked();
signals:
void inputNum(int num);
void backInput();
void cleanInput();
};
#endif // NUMPADFORM_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>NumpadForm</class>
<widget class="QDialog" name="NumpadForm">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>253</width>
<height>328</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QWidget" name="numpadWdg" native="true">
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>10</number>
</property>
<property name="topMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>10</number>
</property>
<property name="bottomMargin">
<number>5</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="2" column="1">
<widget class="QPushButton" name="numpadBtn8">
<property name="maximumSize">
<size>
<width>56</width>
<height>56</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>8</string>
</property>
<property name="num" stdset="0">
<number>8</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="numpadBtn4">
<property name="maximumSize">
<size>
<width>56</width>
<height>56</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>4</string>
</property>
<property name="num" stdset="0">
<number>4</number>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="numpadBtn3">
<property name="maximumSize">
<size>
<width>56</width>
<height>56</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>3</string>
</property>
<property name="num" stdset="0">
<number>3</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="numpadBtn7">
<property name="maximumSize">
<size>
<width>56</width>
<height>56</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>7</string>
</property>
<property name="num" stdset="0">
<number>7</number>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="numpadBtn2">
<property name="maximumSize">
<size>
<width>56</width>
<height>56</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>2</string>
</property>
<property name="num" stdset="0">
<number>2</number>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="numpadBtn5">
<property name="maximumSize">
<size>
<width>56</width>
<height>56</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>5</string>
</property>
<property name="num" stdset="0">
<number>5</number>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="numpadBtn9">
<property name="maximumSize">
<size>
<width>56</width>
<height>56</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>9</string>
</property>
<property name="num" stdset="0">
<number>9</number>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="numpadBtn6">
<property name="maximumSize">
<size>
<width>56</width>
<height>56</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>6</string>
</property>
<property name="num" stdset="0">
<number>6</number>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="numpadBtn1">
<property name="maximumSize">
<size>
<width>56</width>
<height>56</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>1</string>
</property>
<property name="num" stdset="0">
<number>1</number>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="numpadBtnDel">
<property name="maximumSize">
<size>
<width>56</width>
<height>56</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string/>
</property>
<property name="num" stdset="0">
<number>-1</number>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="numpadBtn0">
<property name="maximumSize">
<size>
<width>56</width>
<height>56</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>0</string>
</property>
<property name="num" stdset="0">
<number>0</number>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="numpadBtnCancle">
<property name="maximumSize">
<size>
<width>56</width>
<height>56</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>关闭</string>
</property>
<property name="num" stdset="0">
<number>-1</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
#include "SRForm.h"
#include "ui_SRForm.h"
#include <QDebug>
#include <Control/flowControl.h>
SerachResultForm::SerachResultForm(QWidget *parent) :
QDialog(parent),
ui(new Ui::SerachResultForm)
{
ui->setupUi(this);
this->setWindowFlags(Qt::FramelessWindowHint);
this->setAttribute(Qt::WA_TranslucentBackground);
this->hide();
}
SerachResultForm::~SerachResultForm()
{
delete ui;
}
void SerachResultForm::iniListWidget(const QStringList &list)
{
qDebug() << __FUNCTION__;
ui->searchResultListWdg->clear();
if(list.isEmpty())
{
this->hide();
}else
{
this->show();
ui->searchResultListWdg->addItems(list);
}
}
void SerachResultForm::on_searchResultListWdg_itemClicked(QListWidgetItem *item)
{
this->hide();
emit currentTextChanged(item->text());
emit numform();
}
void SerachResultForm::do_searchResult(const QString &result)
{
this->iniListWidget(FlowControl::GetInstance().GetSearchResult(result));
}
#ifndef SRFORM_H
#define SRFORM_H
#include <QDialog>
#include <QListWidgetItem>
namespace Ui {
class SerachResultForm;
}
class SerachResultForm : public QDialog
{
Q_OBJECT
public:
explicit SerachResultForm(QWidget *parent = 0);
~SerachResultForm();
void iniListWidget(const QStringList&);
private:
Ui::SerachResultForm *ui;
private slots:
void on_searchResultListWdg_itemClicked(QListWidgetItem * item);
;
public slots:
void do_searchResult(const QString& result);
signals:
void currentTextChanged(const QString&);
void numform();
};
#endif // SRFORM_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SerachResultForm</class>
<widget class="QDialog" name="SerachResultForm">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>310</width>
<height>200</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QWidget" name="searchResultWdg" native="true">
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>5</number>
</property>
<property name="topMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<property name="bottomMargin">
<number>5</number>
</property>
<property name="spacing">
<number>5</number>
</property>
<item row="0" column="0">
<widget class="QListWidget" name="searchResultListWdg">
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="autoScrollMargin">
<number>16</number>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<property name="flow">
<enum>QListView::TopToBottom</enum>
</property>
<property name="spacing">
<number>10</number>
</property>
<property name="viewMode">
<enum>QListView::ListMode</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
...@@ -13,7 +13,6 @@ DetailForm::DetailForm(QWidget *parent) : ...@@ -13,7 +13,6 @@ DetailForm::DetailForm(QWidget *parent) :
ui(new Ui::DetailForm) ui(new Ui::DetailForm)
{ {
ui->setupUi(this); ui->setupUi(this);
connect(this, &DetailForm::reEntryOrder, &FlowControl::GetInstance(), &FlowControl::onReEntryOrder); connect(this, &DetailForm::reEntryOrder, &FlowControl::GetInstance(), &FlowControl::onReEntryOrder);
connect(this, &DetailForm::processOrder, &FlowControl::GetInstance(), &FlowControl::onProcessOrder); connect(this, &DetailForm::processOrder, &FlowControl::GetInstance(), &FlowControl::onProcessOrder);
......
#include "floatForm.h" #include "floatForm.h"
#include "ui_floatForm.h" #include "ui_floatForm.h"
#include <QPixmap> #include <QPixmap>
#include<QRect>
#include "DTools/configManger.h" #include "DTools/configManger.h"
#include "preDefine.h" #include "preDefine.h"
#include "QsLog.h" #include "QsLog.h"
#include<QDesktopWidget>
FloatForm::FloatForm(QWidget *parent) : FloatForm::FloatForm(QWidget *parent) :
QDialog(parent), QDialog(parent),
...@@ -40,7 +42,30 @@ void FloatForm::mouseMoveEvent(QMouseEvent *event) ...@@ -40,7 +42,30 @@ void FloatForm::mouseMoveEvent(QMouseEvent *event)
{ {
QPoint moveAmount = event->globalPos() - m_lastMousePos; QPoint moveAmount = event->globalPos() - m_lastMousePos;
m_absMove += moveAmount; m_absMove += moveAmount;
move(pos() + moveAmount); QDesktopWidget* desktopWidget = QApplication::desktop();
//获取设备屏幕大小
QRect screenRect = desktopWidget->screenGeometry();
int g_nActScreenX = screenRect.width()-150;
int g_nActScreenY = screenRect.height()-100;
if(g_nActScreenX>(pos() + moveAmount).x())
{
g_nActScreenX=(pos() + moveAmount).x();
}
if(g_nActScreenX<=0)
{
g_nActScreenX=0;
}
if(g_nActScreenY>(pos() + moveAmount).y())
{
g_nActScreenY=(pos() + moveAmount).y();
}
if(g_nActScreenY<=0)
{
g_nActScreenY=0;
}
move(QPoint(g_nActScreenX,g_nActScreenY));
m_lastMousePos = event->globalPos(); m_lastMousePos = event->globalPos();
m_bMouseMove = true; m_bMouseMove = true;
} }
......
...@@ -38,7 +38,11 @@ SOURCES += main.cpp\ ...@@ -38,7 +38,11 @@ SOURCES += main.cpp\
floatForm.cpp \ floatForm.cpp \
detailForm.cpp \ detailForm.cpp \
Control/refundControl.cpp \ Control/refundControl.cpp \
Model/stockObject.cpp Model/stockObject.cpp \
NumpadForm.cpp \
SRForm.cpp \
Dclass/ClickedLineEdit.cpp \
Dclass/SysTray.cpp
HEADERS += \ HEADERS += \
mainForm.h \ mainForm.h \
...@@ -60,7 +64,11 @@ HEADERS += \ ...@@ -60,7 +64,11 @@ HEADERS += \
floatForm.h \ floatForm.h \
detailForm.h \ detailForm.h \
Control/refundControl.h \ Control/refundControl.h \
Model/stockObject.h Model/stockObject.h \
NumpadForm.h \
SRForm.h \
Dclass/ClickedLineEdit.h \
Dclass/SysTray.h
FORMS += mainForm.ui \ FORMS += mainForm.ui \
alertForm.ui \ alertForm.ui \
...@@ -68,7 +76,9 @@ FORMS += mainForm.ui \ ...@@ -68,7 +76,9 @@ FORMS += mainForm.ui \
pickForm.ui \ pickForm.ui \
settingForm.ui \ settingForm.ui \
floatForm.ui \ floatForm.ui \
detailForm.ui detailForm.ui \
NumpadForm.ui \
SRForm.ui
RC_FILE += fmTakeaway.rc RC_FILE += fmTakeaway.rc
...@@ -80,4 +90,8 @@ CONFIG(release, debug|release) { ...@@ -80,4 +90,8 @@ CONFIG(release, debug|release) {
LIBS += -L../fmPrinter/debug -lfmPrinter LIBS += -L../fmPrinter/debug -lfmPrinter
} }
RESOURCES +=
DISTFILES +=
...@@ -78,13 +78,13 @@ int main(int argc, char *argv[]) ...@@ -78,13 +78,13 @@ int main(int argc, char *argv[])
QLOG_INFO() << QString("-------- fmTakeaway exit --------"); QLOG_INFO() << QString("-------- fmTakeaway exit --------");
return -1; return -1;
} }
FloatForm f; FloatForm f;
MainForm w; MainForm w;
QObject::connect(&w, &MainForm::showFloatForm, &f, &FloatForm::onShow); QObject::connect(&w, &MainForm::showFloatForm, &f, &FloatForm::onShow);
QObject::connect(&w, &MainForm::startRemind, &f, &FloatForm::onStartRemind); QObject::connect(&w, &MainForm::startRemind, &f, &FloatForm::onStartRemind);
QObject::connect(&w, &MainForm::stopRemind, &f, &FloatForm::onStopRemind); QObject::connect(&w, &MainForm::stopRemind, &f, &FloatForm::onStopRemind);
QObject::connect(&f, &FloatForm::showMainForm, &w, &MainForm::show); QObject::connect(&f, &FloatForm::showMainForm, &w, &MainForm::show);
w.MyShow(); w.MyShow();
return a.exec(); return a.exec();
......
...@@ -16,21 +16,22 @@ MainForm::MainForm(QWidget *parent) : ...@@ -16,21 +16,22 @@ MainForm::MainForm(QWidget *parent) :
// 初始化成员变量 // 初始化成员变量
m_prevBtn = NULL; m_prevBtn = NULL;
m_prevTable = NULL; m_prevTable = NULL;
m_raiseIndex = 0;
m_tableList.append(ui->mainTableNew); m_tableList.append(ui->mainTableNew);
m_tableList.append(ui->mainTableMake); m_tableList.append(ui->mainTableMake);
m_tableList.append(ui->mainTableSend); m_tableList.append(ui->mainTableSend);
m_tableList.append(ui->mainTableRefund); m_tableList.append(ui->mainTableRefund);
m_tableList.append(ui->mainTableFinsh); m_tableList.append(ui->mainTableFinsh);
m_tableList.append(ui->mainTableOther); m_tableList.append(ui->mainTableOther);
// 注册信号槽参数 // 注册信号槽参数
qRegisterMetaType<CashierObject>("CashierObject"); qRegisterMetaType<CashierObject>("CashierObject");
qRegisterMetaType< QList<CashierObject> >("QList<CashierObject>"); qRegisterMetaType< QList<CashierObject> >("QList<CashierObject>");
qRegisterMetaType<DeliverObject>("DeliverObject"); qRegisterMetaType<DeliverObject>("DeliverObject");
qRegisterMetaType< QList<DeliverObject> >("QList<DeliverObject>"); qRegisterMetaType< QList<DeliverObject> >("QList<DeliverObject>");
qRegisterMetaType<AlertForm::Type>("AlertForm::Type"); qRegisterMetaType<AlertForm::Type>("AlertForm::Type");
// 连接信号槽 // 连接信号槽
m_numpadForm = new NumpadForm(this);
m_srForm = new SerachResultForm(this);
connect(&m_timeTimer, &QTimer::timeout, this, &MainForm::onSetCurrentTime); connect(&m_timeTimer, &QTimer::timeout, this, &MainForm::onSetCurrentTime);
connect(this, &MainForm::flowStart, &FlowControl::GetInstance(), &FlowControl::onFlowStart); connect(this, &MainForm::flowStart, &FlowControl::GetInstance(), &FlowControl::onFlowStart);
connect(this, &MainForm::processOrder, &FlowControl::GetInstance(), &FlowControl::onProcessOrder); connect(this, &MainForm::processOrder, &FlowControl::GetInstance(), &FlowControl::onProcessOrder);
...@@ -45,10 +46,16 @@ MainForm::MainForm(QWidget *parent) : ...@@ -45,10 +46,16 @@ MainForm::MainForm(QWidget *parent) :
connect(&FlowControl::GetInstance(), &FlowControl::showDeliverPickForm, this, &MainForm::onShowDeliverPickForm); connect(&FlowControl::GetInstance(), &FlowControl::showDeliverPickForm, this, &MainForm::onShowDeliverPickForm);
connect(&FlowControl::GetInstance(), &FlowControl::showCashierPickForm, this, &MainForm::onShowCashierPickForm); connect(&FlowControl::GetInstance(), &FlowControl::showCashierPickForm, this, &MainForm::onShowCashierPickForm);
connect(&FlowControl::GetInstance(), &FlowControl::showOrderDetails, this, &MainForm::onShowOrderDetails); connect(&FlowControl::GetInstance(), &FlowControl::showOrderDetails, this, &MainForm::onShowOrderDetails);
connect(&m_tray, &SysTray::sgExit, this, &MainForm::close);
connect(ui->mainEdtSearch, &ClickedLineEdit::ShowNumPad, m_numpadForm,&QWidget::show);
connect(m_numpadForm, &NumpadForm::inputNum, this, &MainForm::onInputNum);
connect(m_numpadForm, &NumpadForm::backInput, this, &MainForm::onBackInput);
connect(m_numpadForm, &NumpadForm::cleanInput, this, &MainForm::onCleanInput);
connect(ui->mainEdtSearch,&QLineEdit::textChanged, m_srForm,&SerachResultForm::do_searchResult);
connect(m_srForm, &SerachResultForm::currentTextChanged,this,&MainForm::getOrderDetails);
connect(m_srForm,&SerachResultForm::numform,m_numpadForm,&QWidget::hide);
// 初始化界面 // 初始化界面
_Init(); _Init();
// 开启时间定时器 // 开启时间定时器
m_timeTimer.start(1000); m_timeTimer.start(1000);
} }
...@@ -61,18 +68,19 @@ MainForm::~MainForm() ...@@ -61,18 +68,19 @@ MainForm::~MainForm()
void MainForm::MyShow() void MainForm::MyShow()
{ {
this->show(); this->show();
// 考虑到坐标问题放到这里构建 // 考虑到坐标问题放到这里构建
m_alertForm = new AlertForm(this); m_alertForm = new AlertForm(this);
m_pickForm = new PickForm(this); m_pickForm = new PickForm(this);
connect(m_pickForm, &PickForm::updateCashier, this, &MainForm::onUpdateCashier); connect(m_pickForm, &PickForm::updateCashier, this, &MainForm::onUpdateCashier);
m_settingForm = new SettingForm(this); m_settingForm = new SettingForm(this);
m_detailForm = new DetailForm(this); m_detailForm = new DetailForm(this);
emit flowStart(); emit flowStart();
QPoint point=ui->mainEdtSearch->mapToParent(ui->mainEdtSearch->pos());
QPoint point1=ui->mainEdtSearch->mapToGlobal(point);
m_srForm->move(point.x(), point1.y()-260);
//QLOG_DEBUG()<<point.x()<<point.y();
return; return;
} }
...@@ -116,15 +124,22 @@ void MainForm::_Init() ...@@ -116,15 +124,22 @@ void MainForm::_Init()
m_prevBtn = ui->mainBtnNew; m_prevBtn = ui->mainBtnNew;
m_prevTable = ui->mainTableNew; m_prevTable = ui->mainTableNew;
m_currentTable = ui->mainTableNew; m_currentTable = ui->mainTableNew;
//显示系统托盘
m_tray.show();
// 门店营业状态详情暂时屏蔽 // 门店营业状态详情暂时屏蔽
// TODO // TODO
ui->mainBtnOpeDetails->hide(); ui->mainBtnOpeDetails->hide();
} }
void MainForm::onSetCurrentTime() void MainForm::onSetCurrentTime()
{ {
if(m_raiseIndex++ > 10)
{
raise(); raise();
m_raiseIndex = 0;
}
ui->mainSlabTime->setText(QDateTime::currentDateTime().toString("yyyy年MM月dd日 hh:mm:ss")); ui->mainSlabTime->setText(QDateTime::currentDateTime().toString("yyyy年MM月dd日 hh:mm:ss"));
} }
...@@ -353,3 +368,18 @@ void MainForm::onMainTableItemClicked(QTableWidgetItem *item) ...@@ -353,3 +368,18 @@ void MainForm::onMainTableItemClicked(QTableWidgetItem *item)
{ {
emit getOrderDetails(((QTableWidget*)sender())->item(item->row(), 1)->text()); emit getOrderDetails(((QTableWidget*)sender())->item(item->row(), 1)->text());
} }
void MainForm::onInputNum(int num)
{
ui->mainEdtSearch->setText(QString("%1%2").arg(ui->mainEdtSearch->text()).arg(num));
}
void MainForm::onBackInput()
{
QString tmpStr = ui->mainEdtSearch->text();
ui->mainEdtSearch->setText(tmpStr.mid(0, tmpStr.length()-1));
}
void MainForm::onCleanInput()
{
ui->mainEdtSearch->setText("");
}
...@@ -10,6 +10,10 @@ ...@@ -10,6 +10,10 @@
#include "settingForm.h" #include "settingForm.h"
#include "detailForm.h" #include "detailForm.h"
#include <QTimer> #include <QTimer>
#include "Dclass/SysTray.h"
#include "Dclass/ClickedLineEdit.h"
#include "NumpadForm.h"
#include "SRForm.h"
namespace Ui { namespace Ui {
class MainForm; class MainForm;
...@@ -52,6 +56,15 @@ private: ...@@ -52,6 +56,15 @@ private:
// 当前选中的表 // 当前选中的表
QTableWidget *m_currentTable; QTableWidget *m_currentTable;
// 系统托盘
SysTray m_tray;
// 搜索键盘
NumpadForm *m_numpadForm;
// 搜索结果
SerachResultForm *m_srForm;
// 置顶计数器
int m_raiseIndex;
/* 功能:还原按钮和表 /* 功能:还原按钮和表
* 参数:NULL * 参数:NULL
...@@ -105,6 +118,11 @@ signals: ...@@ -105,6 +118,11 @@ signals:
* 返回:NULL * 返回:NULL
* */ * */
void getOrderDetails(const QString& orderId); void getOrderDetails(const QString& orderId);
/* 功能:将搜索框字符传递给搜索结果窗口
* 参数:[1]搜索框现存字符
* 返回:NULL
* */
void onSerachTextChanged(const QString&);
private slots: private slots:
...@@ -210,6 +228,23 @@ public slots: ...@@ -210,6 +228,23 @@ public slots:
* 返回:NULL * 返回:NULL
* */ * */
void onShowOrderDetails(OrderObject* orderObject); void onShowOrderDetails(OrderObject* orderObject);
/* 功能:搜索框输入数字
* 参数:[1]按键数字
* 返回:NULL
* */
void onInputNum(int num);
/* 功能:搜索框删除一格
* 参数:NULL
* 返回:NULL
* */
void onBackInput();
/* 功能:搜索框清空数字
* 参数:NULL
* 返回:NULL
* */
void onCleanInput();
}; };
#endif // MAINFORM_H #endif // MAINFORM_H
...@@ -963,7 +963,7 @@ ...@@ -963,7 +963,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLineEdit" name="mainEdtSearch"> <widget class="ClickedLineEdit" name="mainEdtSearch">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>
...@@ -1228,6 +1228,13 @@ ...@@ -1228,6 +1228,13 @@
</layout> </layout>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>ClickedLineEdit</class>
<extends>QLineEdit</extends>
<header>DClasses/ClickedLineEdit.h</header>
</customwidget>
</customwidgets>
<resources/> <resources/>
<connections> <connections>
<connection> <connection>
......
...@@ -58,8 +58,8 @@ ...@@ -58,8 +58,8 @@
#define JSON_DELIVERYPHONE "deliveryman_phone" #define JSON_DELIVERYPHONE "deliveryman_phone"
#define JSON_ORDER "order" #define JSON_ORDER "order"
#define JSON_SHOPSTATUS "channels" #define JSON_SHOPSTATUS "channels"
#define JSON_CHANNELNAME "name"
#define JSON_SHOPSTATUSDESC "status_desc" #define JSON_SHOPSTATUSDESC "status_desc"
#define JSON_SHOPCHANNELNAME "name"
// 订单的操作码 // 订单的操作码
#define OPERATION_GETDELIVERS "getDelivers" #define OPERATION_GETDELIVERS "getDelivers"
......
...@@ -5,13 +5,13 @@ ...@@ -5,13 +5,13 @@
#include <QPrinterInfo> #include <QPrinterInfo>
#include <QSound> #include <QSound>
#include "fmPrinter.h" #include "fmPrinter.h"
#include <QListView>
SettingForm::SettingForm(QWidget *parent) : SettingForm::SettingForm(QWidget *parent) :
QDialog(parent), QDialog(parent),
ui(new Ui::SettingForm) ui(new Ui::SettingForm)
{ {
ui->setupUi(this); ui->setupUi(this);
// 初始化打印机选项 // 初始化打印机选项
QString printer = ConfigManger::GetInstance().GetPrinterName(); QString printer = ConfigManger::GetInstance().GetPrinterName();
QStringList printerList = QPrinterInfo::availablePrinterNames(); QStringList printerList = QPrinterInfo::availablePrinterNames();
...@@ -24,8 +24,8 @@ SettingForm::SettingForm(QWidget *parent) : ...@@ -24,8 +24,8 @@ SettingForm::SettingForm(QWidget *parent) :
ui->settingCbxPrinter->setCurrentIndex(i); ui->settingCbxPrinter->setCurrentIndex(i);
} }
} }
_Init(); _Init();
ui->settingCbxPrinter->setView(new QListView());
} }
SettingForm::~SettingForm() SettingForm::~SettingForm()
......
...@@ -79,6 +79,12 @@ ...@@ -79,6 +79,12 @@
<property name="focusPolicy"> <property name="focusPolicy">
<enum>Qt::NoFocus</enum> <enum>Qt::NoFocus</enum>
</property> </property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
<property name="frame"> <property name="frame">
<bool>false</bool> <bool>false</bool>
</property> </property>
......
<RCC> <RCC>
<qresource> <qresource prefix="/">
<file>deaufult.qss</file> <file>deaufult.qss</file>
<file>tabBtn_normal.png</file> <file>tabBtn_normal.png</file>
<file>tabBtn_checked.png</file> <file>tabBtn_checked.png</file>
...@@ -26,5 +26,13 @@ ...@@ -26,5 +26,13 @@
<file>detailFrm_bg1.png</file> <file>detailFrm_bg1.png</file>
<file>detailFrm_bg2.png</file> <file>detailFrm_bg2.png</file>
<file>detailLab.png</file> <file>detailLab.png</file>
<file>takeaway.ico</file>
<file>numpad_bg.png</file>
<file>numpad_btn_123.png</file>
<file>numpad_btn_456.png</file>
<file>numpad_btn_7890.png</file>
<file>numpad_btn_back_normal.png</file>
<file>numpad_btn_back_press.png</file>
<file>notify_bg.png</file>
</qresource> </qresource>
</RCC> </RCC>
...@@ -293,9 +293,16 @@ QWidget ...@@ -293,9 +293,16 @@ QWidget
padding: 1px 18px 1px 3px; padding: 1px 18px 1px 3px;
min-width: 6em; min-width: 6em;
} }
#settingCbxPrinter::drop-down {
subcontrol-origin: padding;
subcontrol-position: top right;
width: 30px;
border-left-width: 0px;
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
}
#settingCbxPrinter::down-arrow #settingCbxPrinter::down-arrow
{ {
background-color: rgba(0,0,0,0);
image: url(:cbxArrow.png); image: url(:cbxArrow.png);
} }
#settingCbxPrinter QAbstractItemView #settingCbxPrinter QAbstractItemView
...@@ -305,7 +312,7 @@ QWidget ...@@ -305,7 +312,7 @@ QWidget
border-radius: 3px; border-radius: 3px;
selection-background-color: lightgray; selection-background-color: lightgray;
} }
#settingCbxPrinter QListView::item #settingCbxPrinter QAbstractItemView::item
{ {
height: 25px; height: 25px;
} }
...@@ -482,7 +489,70 @@ QWidget ...@@ -482,7 +489,70 @@ QWidget
height: 0px; height: 0px;
} }
/*---------------------------------DetailForm[ end ]---------------------------------*/ /*---------------------------------DetailForm[ end ]---------------------------------*/
/*---------------------------------NumpadForm[beigin]---------------------------------*/
#numpadWdg
{
border-image: url(:numpad_bg.png);
}
#numpadBtn1,#numpadBtn2,#numpadBtn3
{
font: 12pt "微软雅黑";
color: rgb(29, 29, 29);
border-image: url(:numpad_btn_123.png);
}
#numpadBtn4,#numpadBtn5,#numpadBtn6
{
font: 12pt "微软雅黑";
color: rgb(29, 29, 29);
border-image: url(:numpad_btn_456.png);
}
#numpadBtn7,#numpadBtn8,#numpadBtn9,#numpadBtn0,#numpadBtnCancle
{
font: 12pt "微软雅黑";
color: rgb(29, 29, 29);
border-image: url(:numpad_btn_7890.png);
}
#numpadBtnDel
{
border-image: url(:numpad_btn_back_normal.png);
}
#numpadBtn1:pressed,#numpadBtn2:pressed,#numpadBtn3:pressed
{
font: 12pt "微软雅黑";
color: rgb(230, 237, 225);
border-image: url(:numpad_btn_123.png);
}
#numpadBtn4:pressed,#numpadBtn5:pressed,#numpadBtn6:pressed
{
font: 12pt "微软雅黑";
color: rgb(230, 237, 225);
border-image: url(:numpad_btn_456.png);
}
#numpadBtn7:pressed,#numpadBtn8:pressed,#numpadBtn9:pressed,#numpadBtn0:pressed,#numpadBtnCancle:pressed
{
font: 12pt "微软雅黑";
color: rgb(230, 237, 225);
border-image: url(:numpad_btn_7890.png);
}
#numpadBtnDel:pressed
{
border-image: url(:numpad_btn_back_press.png);
}
/*---------------------------------NumpadForm[ end ]---------------------------------*/
/*---------------------------------SearchResultForm[beigin]---------------------------------*/
#searchResultWdg
{
border-image: url(:notify_bg.png);
}
#searchResultListWdg
{
color: rgb(90, 90, 90);
font: 13pt "微软雅黑";
}
/*---------------------------------SearchResultForm[ end ]---------------------------------*/
......
rcc -binary deaufult.qrc -o ../../../build/takeaway-Debug/fmTakeaway/debug/skin/deaufult.rcc rcc -binary deaufult.qrc -o ..\..\..\build\takeaway-Debug\fmTakeaway\debug\skin\deaufult.rcc
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment