wumu
2025-02-10 6a1c01b3b618d56011560d19f4da9c47793fff4a
0210
7个文件已修改
6个文件已添加
248 ■■■■■ 已修改文件
clientmainwindow.cpp 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
clientmainwindow.h 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
getstocklist.cpp 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
historydata.cpp 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
historydata.cpp.autosave 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
historydata.h 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
historydata.h.autosave 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
historydata.ui 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
leadingcompany.cpp 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
openssl-1.0.2q-x64_86-win64.zip 补丁 | 查看 | 原始文档 | blame | 历史
regularinvestment.cpp 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
stock_plan.pro 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
stockpolicy.cpp 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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*)));
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; // 历史相关
};
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个dll动态库拷贝的生成目录中: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;
        }
    }
historydata.cpp
New file
@@ -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");
      //打开数据库(已经安装过mysql驱动了)
      if(db.open()==false){
          QMessageBox::warning(this,"waring",db.lastError().text());
      }else{
          qDebug()<<"mysql conn ok";
      }
}
historydata.cpp.autosave
New file
@@ -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");
      //打开数据库(已经安装过mysql驱动了)
      if(db.open()==false){
          QMessageBox::warning(this,"waring",db.lastError().text());
      }else{
          qDebug()<<"mysql conn ok";
      }
}
void HistoryData::on_pushButton_update_clicked()
{
}
historydata.h
New file
@@ -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
historydata.h.autosave
New file
@@ -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
historydata.ui
New file
@@ -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>
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)
openssl-1.0.2q-x64_86-win64.zip
Binary files differ
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)
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
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")