From 6a1c01b3b618d56011560d19f4da9c47793fff4a Mon Sep 17 00:00:00 2001 From: wumu <mayi@mayi.com> Date: 星期一, 10 二月 2025 12:30:47 +0800 Subject: [PATCH] 0210 --- historydata.h.autosave | 30 ++++++ leadingcompany.cpp | 2 historydata.h | 28 +++++ historydata.cpp | 38 +++++++ historydata.ui | 58 +++++++++++ stock_plan.pro | 11 + stockpolicy.cpp | 3 openssl-1.0.2q-x64_86-win64.zip | 0 clientmainwindow.h | 2 clientmainwindow.cpp | 4 getstocklist.cpp | 26 ++++- regularinvestment.cpp | 3 historydata.cpp.autosave | 43 ++++++++ 13 files changed, 237 insertions(+), 11 deletions(-) diff --git a/clientmainwindow.cpp b/clientmainwindow.cpp index 6a7a785..47c405a 100644 --- a/clientmainwindow.cpp +++ b/clientmainwindow.cpp @@ -1,6 +1,7 @@ 锘�#include "clientmainwindow.h" #include "ui_clientmainwindow.h" +#pragma execution_character_set("utf-8") ClientMainWindow::ClientMainWindow(QWidget *parent) : QMainWindow(parent), @@ -38,6 +39,9 @@ m_regular = new RegularInvestment(this); ui->tabWidget->addTab(m_regular,"瀹氭姇璁剧疆"); + m_history = new HistoryData(this); + ui->tabWidget->addTab(m_history,"鍘嗗彶鍒嗘瀽"); + // 鍏宠仈涓�涓�2涓晫闈㈢殑淇″彿鍜屾Ы锛岀敤鏉ヤ紶閫掑浘琛ㄦ墍闇�鐨勬暟鎹強灞曠ず connect(m_getStockList,SIGNAL(sendChartData(QLineSeries*)),m_stockPolicy,SLOT(showNewStockData(QLineSeries*))); diff --git a/clientmainwindow.h b/clientmainwindow.h index cc26bea..6301130 100644 --- a/clientmainwindow.h +++ b/clientmainwindow.h @@ -7,6 +7,7 @@ #include "leadingcompany.h" #include "showinfomessage.h" #include "regularinvestment.h" +#include "historydata.h" namespace Ui { @@ -30,6 +31,7 @@ LeadingCompany *m_leadingCom; // 榫欏ご鍏徃 ShowInfoMessage *m_showInfoMess; // 鏄剧ず淇℃伅鎻愮ず RegularInvestment *m_regular; // 瀹氭姇璁剧疆 + HistoryData *m_history; // 鍘嗗彶鐩稿叧 }; diff --git a/getstocklist.cpp b/getstocklist.cpp index 61776ef..ea32aa9 100644 --- a/getstocklist.cpp +++ b/getstocklist.cpp @@ -8,6 +8,9 @@ #include <QJsonArray> #include <QLibrary> // 鐢ㄤ簬鍔犺浇dll鍔ㄦ�佸簱鐨勭被 + +#pragma execution_character_set("utf-8") + GetStockList::GetStockList(QWidget *parent) : QMainWindow(parent), ui(new Ui::GetStockList) @@ -20,6 +23,8 @@ // 濡傛灉https 璁块棶鐨勬椂鍊欙紝杩樻槸鐖彇澶辫触锛屽彲浠ヤ唬鐮佸姞杞藉姩鎬佸簱鏉ユ敮鎸� // 鍓嶆彁鏉′欢鏄妸2涓猟ll鍔ㄦ�佸簱鎷疯礉鐨勭敓鎴愮洰褰曚腑:libeay32.dll 鍜� ssleay32.dll // 鎷疯礉鍒扮敓鎴愮洰褰曪紝灏卞彲浠ョ洿鎺ュ姞杞� + // 鑻ユ槸msvc 64bit鐨勭紪璇戝櫒锛岄渶瑕佷笅杞藉搴斾綅鏁扮殑dll搴撴潵鎷疯礉鍗冲彲 -- openssl-1.0.2q-x64_86-win64.zip + QLibrary lb("libeay32.dll"); if(lb.load()){ qDebug()<<"load libeay32.dll 鎴愬姛"; @@ -174,10 +179,10 @@ // 鏀寔缂栬緫妗嗙殑妯$硦鍖归厤 m_completer = new QCompleter(this); - m_completer->setModel(m_customModel); + m_completer->setModel(m_customModel); // 鍏宠仈鍖呭惈鎵�鏈夊尮閰嶅唴瀹圭殑妯″瀷鎴栬�呭瓧绗︿覆閾捐〃 m_completer->setCaseSensitivity(Qt::CaseInsensitive); // 涓嶅尯鍒嗗ぇ灏忓啓 m_completer->setCompletionMode(QCompleter::PopupCompletion); // 鑷姩鏄剧ず涓嬫媺妗� - m_completer->setFilterMode(Qt::MatchStartsWith); // 鍓嶇紑鍖归厤 + m_completer->setFilterMode(Qt::MatchContains); // 鍓嶇紑鍖归厤銆佸寘鍚�佸悗缂� ui->lineEdit_search->setCompleter(m_completer); // 鍏宠仈鍖归厤鐨勬帶浠� } @@ -525,9 +530,16 @@ if(ma5 >= open && ma10 >= open && ma20 >= open && ma30 >= open && ma5 <= close && ma10 <= close && ma20 <= close && ma30 <= close){ qDebug()<<"涓�闃崇┛鍥涚嚎:"<< code <<curDateTime<<" 浠锋牸:"<<close << "閲忚兘姣�:"<<volume_rate; - QString info = QString("<font size=8 color=red> %3 %4 涓�闃崇┛鍥涚嚎:%1 浠锋牸:%2 閲忚兘姣�:%5 鍛ㄦ湡:%6 甯傚��:%7浜�</font>").arg(curDateTime).arg(close).arg(code).arg(m_codeNames[code]).arg(volume_rate) - .arg(m_dateType).arg(market_cap/100000000.0); - emit sendInfoMess(info); + if(volume_rate > 4){ + QString info = QString("<font size=8 color=blue> %3 %4 涓�闃崇┛鍥涚嚎:%1 浠锋牸:%2 閲忚兘姣�:%5 鍛ㄦ湡:%6 甯傚��:%7浜�</font>").arg(curDateTime).arg(close).arg(code).arg(m_codeNames[code]).arg(volume_rate) + .arg(m_dateType).arg(market_cap/100000000.0); + emit sendInfoMess(info); + }else{ + QString info = QString("<font size=8 color=red> %3 %4 涓�闃崇┛鍥涚嚎:%1 浠锋牸:%2 閲忚兘姣�:%5 鍛ㄦ湡:%6 甯傚��:%7浜�</font>").arg(curDateTime).arg(close).arg(code).arg(m_codeNames[code]).arg(volume_rate) + .arg(m_dateType).arg(market_cap/100000000.0); + emit sendInfoMess(info); + } + } } @@ -953,12 +965,14 @@ void GetStockList::on_pushButton_search_clicked() { + ui->tableView->clearSelection(); QString condition = ui->lineEdit_search->text(); for(int i =0;i<m_customModel->rowCount();++i){ if(m_customModel->data(m_customModel->index(i,0)).toString() == condition || m_customModel->data(m_customModel->index(i,1)).toString() == condition) { - ui->tableView->setCurrentIndex(m_customModel->index(i,0)); + //ui->tableView->setCurrentIndex(m_customModel->index(i,0)); + ui->tableView->selectRow(i); break; } } diff --git a/historydata.cpp b/historydata.cpp new file mode 100644 index 0000000..970ddd8 --- /dev/null +++ b/historydata.cpp @@ -0,0 +1,38 @@ +锘�#include "historydata.h" +#include "ui_historydata.h" + +#include <QMessageBox> +#include <QDebug> + +HistoryData::HistoryData(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::HistoryData) +{ + ui->setupUi(this); +} + +HistoryData::~HistoryData() +{ + delete ui; +} + +void HistoryData::on_pushButton_clicked() +{ + + //娣诲姞涓�涓暟鎹簱 + QSqlDatabase db=QSqlDatabase::addDatabase("QMYSQL"); //鎷彿鍐呰鍐欏嚭鏁版嵁搴撶殑绫诲瀷 + //璁剧疆鏁版嵁搴� + db.setHostName("127.0.0.1"); //璁剧疆鏁版嵁搴撶殑涓绘満ip + //璁剧疆鏁版嵁搴撶殑鐢ㄦ埛鍚� + db.setUserName("root"); + //璁剧疆鏁版嵁搴撶殑瀵嗙爜 + db.setPassword("root"); //杩欎釜灏辨槸瀹夎MySQL鏃惰缃殑瀵嗙爜 + //璁剧疆鏁版嵁搴撶殑鍚嶅瓧 + db.setDatabaseName("stock_plan"); + //鎵撳紑鏁版嵁搴擄紙宸茬粡瀹夎杩噈ysql椹卞姩浜嗭級 + if(db.open()==false){ + QMessageBox::warning(this,"waring",db.lastError().text()); + }else{ + qDebug()<<"mysql conn ok"; + } +} diff --git a/historydata.cpp.autosave b/historydata.cpp.autosave new file mode 100644 index 0000000..ad880b2 --- /dev/null +++ b/historydata.cpp.autosave @@ -0,0 +1,43 @@ +锘�#include "historydata.h" +#include "ui_historydata.h" + +#include <QMessageBox> +#include <QDebug> + +HistoryData::HistoryData(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::HistoryData) +{ + ui->setupUi(this); +} + +HistoryData::~HistoryData() +{ + delete ui; +} + +void HistoryData::on_pushButton_clicked() +{ + + //娣诲姞涓�涓暟鎹簱 + QSqlDatabase db=QSqlDatabase::addDatabase("QMYSQL"); //鎷彿鍐呰鍐欏嚭鏁版嵁搴撶殑绫诲瀷 + //璁剧疆鏁版嵁搴� + db.setHostName("127.0.0.1"); //璁剧疆鏁版嵁搴撶殑涓绘満ip + //璁剧疆鏁版嵁搴撶殑鐢ㄦ埛鍚� + db.setUserName("root"); + //璁剧疆鏁版嵁搴撶殑瀵嗙爜 + db.setPassword("root"); //杩欎釜灏辨槸瀹夎MySQL鏃惰缃殑瀵嗙爜 + //璁剧疆鏁版嵁搴撶殑鍚嶅瓧 + db.setDatabaseName("stock_plan"); + //鎵撳紑鏁版嵁搴擄紙宸茬粡瀹夎杩噈ysql椹卞姩浜嗭級 + if(db.open()==false){ + QMessageBox::warning(this,"waring",db.lastError().text()); + }else{ + qDebug()<<"mysql conn ok"; + } +} + +void HistoryData::on_pushButton_update_clicked() +{ + +} diff --git a/historydata.h b/historydata.h new file mode 100644 index 0000000..6ff71a7 --- /dev/null +++ b/historydata.h @@ -0,0 +1,28 @@ +锘�#ifndef HISTORYDATA_H +#define HISTORYDATA_H + +#include <QMainWindow> +#include <QSqlDatabase> +#include <QSqlError> +#include <QSqlQuery> + +namespace Ui { +class HistoryData; +} + +class HistoryData : public QMainWindow +{ + Q_OBJECT + +public: + explicit HistoryData(QWidget *parent = 0); + ~HistoryData(); + +private slots: + void on_pushButton_clicked(); + +private: + Ui::HistoryData *ui; +}; + +#endif // HISTORYDATA_H diff --git a/historydata.h.autosave b/historydata.h.autosave new file mode 100644 index 0000000..233fe54 --- /dev/null +++ b/historydata.h.autosave @@ -0,0 +1,30 @@ +锘�#ifndef HISTORYDATA_H +#define HISTORYDATA_H + +#include <QMainWindow> +#include <QSqlDatabase> +#include <QSqlError> +#include <QSqlQuery> + +namespace Ui { +class HistoryData; +} + +class HistoryData : public QMainWindow +{ + Q_OBJECT + +public: + explicit HistoryData(QWidget *parent = 0); + ~HistoryData(); + +private slots: + void on_pushButton_clicked(); + + void on_pushButton_update_clicked(); + +private: + Ui::HistoryData *ui; +}; + +#endif // HISTORYDATA_H diff --git a/historydata.ui b/historydata.ui new file mode 100644 index 0000000..b857d56 --- /dev/null +++ b/historydata.ui @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>HistoryData</class> + <widget class="QMainWindow" name="HistoryData"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>827</width> + <height>711</height> + </rect> + </property> + <property name="windowTitle"> + <string>MainWindow</string> + </property> + <widget class="QWidget" name="centralwidget"> + <widget class="QPushButton" name="pushButton"> + <property name="geometry"> + <rect> + <x>540</x> + <y>20</y> + <width>101</width> + <height>41</height> + </rect> + </property> + <property name="text"> + <string>Test</string> + </property> + </widget> + <widget class="QPushButton" name="pushButton_update"> + <property name="geometry"> + <rect> + <x>650</x> + <y>20</y> + <width>111</width> + <height>41</height> + </rect> + </property> + <property name="text"> + <string>涓�閿洿鏂版暟鎹�</string> + </property> + </widget> + </widget> + <widget class="QMenuBar" name="menubar"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>827</width> + <height>26</height> + </rect> + </property> + </widget> + <widget class="QStatusBar" name="statusbar"/> + </widget> + <resources/> + <connections/> +</ui> diff --git a/leadingcompany.cpp b/leadingcompany.cpp index c3b148f..1b0f6e4 100644 --- a/leadingcompany.cpp +++ b/leadingcompany.cpp @@ -1,6 +1,8 @@ 锘�#include "leadingcompany.h" #include "ui_leadingcompany.h" +#pragma execution_character_set("utf-8") + LeadingCompany::LeadingCompany(QWidget *parent) : QMainWindow(parent), ui(new Ui::LeadingCompany) diff --git a/openssl-1.0.2q-x64_86-win64.zip b/openssl-1.0.2q-x64_86-win64.zip new file mode 100644 index 0000000..269ed82 --- /dev/null +++ b/openssl-1.0.2q-x64_86-win64.zip Binary files differ diff --git a/regularinvestment.cpp b/regularinvestment.cpp index 2d7a501..75aa3f0 100644 --- a/regularinvestment.cpp +++ b/regularinvestment.cpp @@ -9,6 +9,9 @@ #include <qnetworkreply.h> #include <QDebug> + +#pragma execution_character_set("utf-8") + RegularInvestment::RegularInvestment(QWidget *parent) : QMainWindow(parent), ui(new Ui::RegularInvestment) diff --git a/stock_plan.pro b/stock_plan.pro index 60cf5de..9051dba 100644 --- a/stock_plan.pro +++ b/stock_plan.pro @@ -4,7 +4,7 @@ # #------------------------------------------------- -QT += core gui network charts +QT += core gui network charts sql greaterThan(QT_MAJOR_VERSION, 4): QT += widgets @@ -32,7 +32,8 @@ showinfomessage.cpp \ customitem.cpp \ customsortproxymodel.cpp \ - regularinvestment.cpp + regularinvestment.cpp \ + historydata.cpp HEADERS += \ clientmainwindow.h \ @@ -42,7 +43,8 @@ showinfomessage.h \ customitem.h \ customsortproxymodel.h \ - regularinvestment.h + regularinvestment.h \ + historydata.h FORMS += \ clientmainwindow.ui \ @@ -50,4 +52,5 @@ stockpolicy.ui \ leadingcompany.ui \ showinfomessage.ui \ - regularinvestment.ui + regularinvestment.ui \ + historydata.ui diff --git a/stockpolicy.cpp b/stockpolicy.cpp index b84e4f4..19f3de9 100644 --- a/stockpolicy.cpp +++ b/stockpolicy.cpp @@ -1,8 +1,9 @@ -#include "stockpolicy.h" +锘�#include "stockpolicy.h" #include "ui_stockpolicy.h" #include <QDebug> #include <QLegendMarker> +#pragma execution_character_set("utf-8") -- Gitblit v1.8.0