diff --git a/bin/comtool.exe b/bin/comtool.exe new file mode 100644 index 0000000..0145048 Binary files /dev/null and b/bin/comtool.exe differ diff --git a/bin/comtool.ini b/bin/comtool.ini new file mode 100644 index 0000000..d3b8abe --- /dev/null +++ b/bin/comtool.ini @@ -0,0 +1,22 @@ +[ComConfig] +PortName=COM1 +BaudRate=9600 +DataBit=8 +Parity=\x65e0 +StopBit=1 +HexSend=false +HexReceive=false +Debug=false +AutoClear=false +AutoSend=false +SendInterval=1000 +AutoSave=false +SaveInterval=5000 + +[NetConfig] +Mode=Tcp_Client +ServerIP=127.0.0.1 +ServerPort=6000 +ListenPort=6000 +SleepTime=100 +AutoConnect=false diff --git a/bin/netserver.exe b/bin/netserver.exe new file mode 100644 index 0000000..d4f7706 Binary files /dev/null and b/bin/netserver.exe differ diff --git a/bin/netserver.ini b/bin/netserver.ini new file mode 100644 index 0000000..6a77a8f --- /dev/null +++ b/bin/netserver.ini @@ -0,0 +1,9 @@ +[AppConfig] +ListenPort1=6907 +CmdStart1=76 +CmdLen1=12 +HexData1=false +ListenPort2=6908 +CmdStart2=76 +CmdLen2=12 +HexData2=false diff --git a/bin/nettool.exe b/bin/nettool.exe new file mode 100644 index 0000000..49f81c5 Binary files /dev/null and b/bin/nettool.exe differ diff --git a/bin/nettool.ini b/bin/nettool.ini new file mode 100644 index 0000000..1c1a0c5 --- /dev/null +++ b/bin/nettool.ini @@ -0,0 +1,59 @@ +[AppConfig] +CurrentIndex=0 + +[TcpClientConfig] +HexSendTcpClient=false +HexReceiveTcpClient=false +DebugTcpClient=false +AutoSendTcpClient=false +IntervalTcpClient=1000 +TcpServerIP=127.0.0.1 +TcpServerPort=6000 + +[TcpServerConfig] +HexSendTcpServer=false +HexReceiveTcpServer=false +DebugTcpServer=false +AutoSendTcpServer=false +IntervalTcpServer=1000 +TcpListenIP=127.0.0.1 +TcpListenPort=6000 +SelectAllTcpServer=true + +[UdpClientConfig] +HexSendUdpClient=false +HexReceiveUdpClient=false +DebugUdpClient=false +AutoSendUdpClient=false +IntervalUdpClient=1000 +UdpServerIP=127.0.0.1 +UdpServerPort=6000 + +[UdpServerConfig] +HexSendUdpServer=false +HexReceiveUdpServer=false +DebugUdpServer=false +AutoSendUdpServer=false +IntervalUdpServer=1000 +UdpListenIP=127.0.0.1 +UdpListenPort=6000 +SelectAllUdpServer=false + +[WebClientConfig] +HexSendWebClient=false +HexReceiveWebClient=false +DebugWebClient=false +AutoSendWebClient=false +IntervalWebClient=1000 +WebServerIP=ws://127.0.0.1 +WebServerPort=6000 + +[WebServerConfig] +HexSendWebServer=false +HexReceiveWebServer=false +DebugWebServer=false +AutoSendWebServer=false +IntervalWebServer=1000 +WebListenIP=127.0.0.1 +WebListenPort=6000 +SelectAllWebServer=true diff --git a/comtool/comtool.pro b/comtool/comtool.pro index 651d7f9..330e74f 100644 --- a/comtool/comtool.pro +++ b/comtool/comtool.pro @@ -10,7 +10,6 @@ RC_FILE = other/main.rc SOURCES += main.cpp HEADERS += head.h RESOURCES += other/main.qrc -CONFIG += warn_off INCLUDEPATH += $$PWD INCLUDEPATH += $$PWD/api @@ -24,11 +23,3 @@ include ($$PWD/../core_qui/core_qui.pri) INCLUDEPATH += $$PWD/../3rd_qextserialport include ($$PWD/../3rd_qextserialport/3rd_qextserialport.pri) - -unix:!macx { -contains(arma7, DEFINES) { -INCLUDEPATH += /usr/local/openssl-1.0.2m-h3-gcc-4.9.2/include -LIBS += -L/usr/local/openssl-1.0.2m-h3-gcc-4.9.2/lib -lssl -lcrypto -LIBS += -L/usr/local/h3_rootfsv -lXdmcp -}} - diff --git a/core_qui/core_qui.pri b/core_qui/core_qui.pri index 260e3f1..ca5a737 100644 --- a/core_qui/core_qui.pri +++ b/core_qui/core_qui.pri @@ -1,3 +1,25 @@ +#指定编译产生的文件分门别类放到对应目录 +MOC_DIR = temp/moc +RCC_DIR = temp/rcc +UI_DIR = temp/ui +OBJECTS_DIR = temp/obj + +#指定编译生成的可执行文件放到源码上一级目录下的bin目录 +!android { +!wasm { +DESTDIR = $$PWD/../bin +}} + +#把所有警告都关掉眼不见为净 +CONFIG += warn_off +#开启大资源支持 +CONFIG += resources_big +#开启后会将打印信息用控制台输出 +#CONFIG += console + +#引入全志H3芯片依赖 +include ($$PWD/h3.pri) + HEADERS += \ $$PWD/iconhelper.h \ $$PWD/quiconfig.h \ @@ -21,10 +43,5 @@ SOURCES += \ $$PWD/quitipbox.cpp \ $$PWD/quiwidget.cpp -!contains(DEFINES, no_qui_qm) { RESOURCES += $$PWD/source/qm.qrc -} - -!contains(DEFINES, no_qui_ttf) { RESOURCES += $$PWD/source/ttf.qrc -} diff --git a/core_qui/h3.pri b/core_qui/h3.pri new file mode 100644 index 0000000..d976a3e --- /dev/null +++ b/core_qui/h3.pri @@ -0,0 +1,6 @@ +unix:!macx { +contains(DEFINES, arma7) { +INCLUDEPATH += /usr/local/openssl-1.0.2m-h3-gcc-4.9.2/include +LIBS += -L/usr/local/openssl-1.0.2m-h3-gcc-4.9.2/lib -lssl -lcrypto +LIBS += -L/usr/local/h3_rootfsv -lXdmcp +}} diff --git a/core_qui/quihelper.cpp b/core_qui/quihelper.cpp index d7a438b..2b2fe2f 100644 --- a/core_qui/quihelper.cpp +++ b/core_qui/quihelper.cpp @@ -57,20 +57,24 @@ int QUIHelper::deskHeight() return getScreenRect().height(); } +QWidget *QUIHelper::centerBaseForm = 0; void QUIHelper::setFormInCenter(QWidget *form) { int formWidth = form->width(); int formHeight = form->height(); - QRect rect = getScreenRect(); + + //如果=0表示采用系统桌面屏幕为参照 + QRect rect; + if (centerBaseForm == 0) { + rect = getScreenRect(); + } else { + rect = centerBaseForm->geometry(); + } + int deskWidth = rect.width(); int deskHeight = rect.height(); - QPoint movePoint(deskWidth / 2 - formWidth / 2 + rect.x(), deskHeight / 2 - formHeight / 2); + QPoint movePoint(deskWidth / 2 - formWidth / 2 + rect.x(), deskHeight / 2 - formHeight / 2 + rect.y()); form->move(movePoint); - - //其他系统自动最大化 -#ifndef Q_OS_WIN - QTimer::singleShot(100, form, SLOT(showMaximized())); -#endif } QString QUIHelper::appName() @@ -319,8 +323,8 @@ void QUIHelper::setFramelessForm(QWidget *widgetMain, QWidget *widgetTitle, widgetMain->setProperty("form", true); widgetMain->setProperty("canMove", true); - //根据设定逐个追加属性 - widgetMain->setWindowFlags(Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint); + //根据设定逐个追加属性 去掉了 Qt::X11BypassWindowManagerHint + widgetMain->setWindowFlags(Qt::FramelessWindowHint); if (tool) { widgetMain->setWindowFlags(widgetMain->windowFlags() | Qt::Tool); } @@ -1206,8 +1210,8 @@ void QUIHelper::initTableView(QTableView *tableView, int rowHeight, bool headVis tableView->horizontalHeader()->setStretchLastSection(stretchLast); //行标题最小宽度尺寸 tableView->horizontalHeader()->setMinimumSectionSize(0); - //行标题最大高度 - tableView->horizontalHeader()->setMaximumHeight(rowHeight); + //行标题最小高度,等同于和默认行高一致 + tableView->horizontalHeader()->setFixedHeight(rowHeight); //默认行高 tableView->verticalHeader()->setDefaultSectionSize(rowHeight); //选中时一行整体选中 diff --git a/core_qui/quihelper.h b/core_qui/quihelper.h index 47cd806..e3a099a 100644 --- a/core_qui/quihelper.h +++ b/core_qui/quihelper.h @@ -10,9 +10,13 @@ public: static int getScreenIndex(); static QRect getScreenRect(bool available = true); - //获取桌面宽度高度+居中显示 + //获取桌面宽度高度 static int deskWidth(); static int deskHeight(); + + //居中显示窗体 + //定义标志位指定是以桌面为参照还是主程序界面为参照 + static QWidget *centerBaseForm; static void setFormInCenter(QWidget *form); //程序文件名称+当前所在路径 diff --git a/core_qui/quiinputbox.cpp b/core_qui/quiinputbox.cpp index 0464bb9..a52f127 100644 --- a/core_qui/quiinputbox.cpp +++ b/core_qui/quiinputbox.cpp @@ -228,6 +228,10 @@ void QUIInputBox::setParameter(const QString &title, int type, int closeSec, } else if (type == 1) { this->txtValue->setVisible(false); this->cboxValue->addItems(defaultValue.split("|")); + //回显字符串作为默认的下拉选项 + if (!placeholderText.isEmpty()) { + this->cboxValue->setCurrentIndex(this->cboxValue->findText(placeholderText)); + } } } diff --git a/core_qui/quiwidget.cpp b/core_qui/quiwidget.cpp index 8a590f0..023f2e4 100644 --- a/core_qui/quiwidget.cpp +++ b/core_qui/quiwidget.cpp @@ -3,8 +3,7 @@ QUIWidget::QUIWidget(QWidget *parent) : QDialog(parent) { this->initControl(); - this->initForm(); - QUIHelper::setFormInCenter(this); + this->initForm(); } QUIWidget::~QUIWidget() @@ -66,7 +65,7 @@ QPushButton *QUIWidget::getBtnMenuMax() const return this->btnMenu_Max; } -QPushButton *QUIWidget::getBtnMenuMClose() const +QPushButton *QUIWidget::getBtnMenuClose() const { return this->btnMenu_Close; } @@ -396,6 +395,7 @@ void QUIWidget::setMainWidget(QWidget *mainWidget) //自动设置大小 resize(mainWidget->width(), mainWidget->height() + this->widgetTitle->height()); this->mainWidget = mainWidget; + QUIHelper::setFormInCenter(this); } } diff --git a/core_qui/quiwidget.h b/core_qui/quiwidget.h index 98f9581..ce47fe8 100644 --- a/core_qui/quiwidget.h +++ b/core_qui/quiwidget.h @@ -55,7 +55,7 @@ public: QToolButton *getBtnMenu() const; QPushButton *getBtnMenuMin() const; QPushButton *getBtnMenuMax() const; - QPushButton *getBtnMenuMClose() const; + QPushButton *getBtnMenuClose() const; QString getTitle() const; Qt::Alignment getAlignment() const; diff --git a/netserver/netserver.pro b/netserver/netserver.pro index 5598c92..2004c64 100644 --- a/netserver/netserver.pro +++ b/netserver/netserver.pro @@ -10,7 +10,6 @@ RC_FILE = other/main.rc SOURCES += main.cpp HEADERS += head.h RESOURCES += other/main.qrc -CONFIG += warn_off INCLUDEPATH += $$PWD INCLUDEPATH += $$PWD/api diff --git a/nettool/nettool.pro b/nettool/nettool.pro index 88da4a9..ee81df6 100644 --- a/nettool/nettool.pro +++ b/nettool/nettool.pro @@ -22,7 +22,6 @@ DESTDIR = $$PWD/../bin SOURCES += main.cpp HEADERS += head.h RESOURCES += other/main.qrc -CONFIG += warn_off INCLUDEPATH += $$PWD INCLUDEPATH += $$PWD/api