大重构
@@ -5,6 +5,7 @@ if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_LIST_DIR})
|
||||
project(Radio)
|
||||
set(Radio_VERSION 1.0.0)
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
include(third_party/build_infra/start.cmake)
|
||||
include(third_party/CPP_Core/main.cmake)
|
||||
include(third_party/Graphic_Core/main.cmake)
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
include(${CMAKE_SOURCE_DIR}/third_party/build_infra/Doxygen/export.cmake)
|
||||
include(${CMAKE_SOURCE_DIR}/third_party/build_infra/Graphviz/export.cmake)
|
||||
include(${CMAKE_SOURCE_DIR}/third_party/build_infra/LLVM/export.cmake)
|
||||
include(${CMAKE_SOURCE_DIR}/third_party/build_infra/Cppcheck/export.cmake)
|
||||
include(${CMAKE_SOURCE_DIR}/third_party/build_infra/lizard/export.cmake)
|
||||
include(${CMAKE_SOURCE_DIR}/third_party/build_infra/cloc_tokei/export.cmake)
|
||||
include(${CMAKE_SOURCE_DIR}/third_party/build_infra/CodeMetrics/export.cmake)
|
||||
set(module_dir "${CMAKE_CURRENT_LIST_DIR}/module")
|
||||
set(dir "${module_dir}/radio")
|
||||
file(GLOB_RECURSE srcs "${dir}/*.c" "${dir}/*.cpp" "${dir}/*.h" "${dir}/*.hpp")
|
||||
file(GLOB_RECURSE srcs "${dir}/*.c" "${dir}/*.cpp" "${dir}/*.h" "${dir}/*.hpp" "${dir}/*.qrc")
|
||||
add_executable(radio ${srcs})
|
||||
target_link_libraries(radio PUBLIC YSGraphic_Core)
|
||||
if (MSVC)
|
||||
@@ -45,3 +50,57 @@ psc_add_cmake_graphviz_target(psc_radio_cmake_graphviz
|
||||
add_custom_target(psc_radio_docs
|
||||
DEPENDS psc_radio_doxygen psc_radio_graphviz psc_radio_cmake_graphviz
|
||||
)
|
||||
set(radio_metrics_dir "${CMAKE_BINARY_DIR}/metrics/radio")
|
||||
psc_add_llvm_cognitive_target(psc_radio_llvm_cognitive
|
||||
INPUT_DIRS ${radio_document_dirs}
|
||||
EXCLUDE_DIRS ${radio_document_exclude_dirs}
|
||||
COMPILE_COMMANDS "${CMAKE_BINARY_DIR}/compile_commands.json"
|
||||
OUTPUT_DIR "${radio_metrics_dir}/llvm"
|
||||
TOP_N 50
|
||||
THRESHOLD 0
|
||||
)
|
||||
psc_add_cppcheck_target(psc_radio_cppcheck
|
||||
INPUT_DIRS ${radio_document_dirs}
|
||||
EXCLUDE_DIRS ${radio_document_exclude_dirs}
|
||||
COMPILE_COMMANDS "${CMAKE_BINARY_DIR}/compile_commands.json"
|
||||
OUTPUT_DIR "${radio_metrics_dir}/cppcheck"
|
||||
CHECK_LEVEL normal
|
||||
)
|
||||
psc_add_lizard_target(psc_radio_lizard
|
||||
INPUT_DIRS ${radio_document_dirs}
|
||||
EXCLUDE_DIRS ${radio_document_exclude_dirs}
|
||||
OUTPUT_DIR "${radio_metrics_dir}/lizard"
|
||||
TOP_N 50
|
||||
CCN_WARNING 15
|
||||
FUNCTION_LENGTH_WARNING 200
|
||||
ARGUMENT_WARNING 8
|
||||
)
|
||||
psc_add_code_count_target(psc_radio_code_count
|
||||
INPUT_DIRS ${radio_document_dirs}
|
||||
EXCLUDE_DIRS ${radio_document_exclude_dirs}
|
||||
OUTPUT_DIR "${radio_metrics_dir}/code_count"
|
||||
)
|
||||
psc_add_coupling_target(psc_radio_coupling
|
||||
INPUT_DIRS ${radio_document_dirs}
|
||||
EXCLUDE_DIRS ${radio_document_exclude_dirs}
|
||||
OUTPUT_DIR "${radio_metrics_dir}/coupling"
|
||||
TOP_N 50
|
||||
)
|
||||
psc_add_metrics_report_target(psc_radio_metrics
|
||||
PROJECT_NAME "Radio"
|
||||
OUTPUT_DIR "${radio_metrics_dir}"
|
||||
LLVM_DIR "${radio_metrics_dir}/llvm"
|
||||
CPPCHECK_DIR "${radio_metrics_dir}/cppcheck"
|
||||
LIZARD_DIR "${radio_metrics_dir}/lizard"
|
||||
CODE_COUNT_DIR "${radio_metrics_dir}/code_count"
|
||||
COUPLING_DIR "${radio_metrics_dir}/coupling"
|
||||
DEPENDS
|
||||
psc_radio_llvm_cognitive
|
||||
psc_radio_cppcheck
|
||||
psc_radio_lizard
|
||||
psc_radio_code_count
|
||||
psc_radio_coupling
|
||||
)
|
||||
add_custom_target(psc_radio_quality
|
||||
DEPENDS psc_radio_metrics psc_radio_docs
|
||||
)
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
#ifndef CENTER_H
|
||||
#define CENTER_H
|
||||
#include "component/Button.h"
|
||||
#include "global.h"
|
||||
class Center : public QWidget {
|
||||
public:
|
||||
QWidget* cur{};
|
||||
Center() = default;
|
||||
void setWidget(QWidget* widget) {
|
||||
if (cur)
|
||||
{
|
||||
cur->hide();
|
||||
}
|
||||
cur = widget;
|
||||
widget->setParent(this);
|
||||
widget->resize(width(), height());
|
||||
widget->show();
|
||||
}
|
||||
protected:
|
||||
void paintEvent(QPaintEvent* event) override {
|
||||
// QPainter painter(this);
|
||||
// painter.fillRect(event->rect(), Qt::black);
|
||||
// painter.end();
|
||||
QWidget::paintEvent(event);
|
||||
}
|
||||
void resizeEvent(QResizeEvent* event) override {
|
||||
if (cur)
|
||||
{
|
||||
cur->resize(width(), height());
|
||||
}
|
||||
}
|
||||
};
|
||||
#endif
|
||||
@@ -1,23 +0,0 @@
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
#include "Center.h"
|
||||
#include "Navigate_Bar.h"
|
||||
#include "component/frameless/FrameLessWidget.h"
|
||||
#include "header.h"
|
||||
class MainWindow : public FrameLessWidget {
|
||||
public:
|
||||
QVBoxLayout* main_layout;
|
||||
Header* header;
|
||||
QHBoxLayout* center_layout;
|
||||
Navigate_Bar* navigate_bar;
|
||||
Center* center;
|
||||
void create_center_Layout();
|
||||
MainWindow();
|
||||
protected:
|
||||
// void paintEvent(QPaintEvent* event) override {
|
||||
// QPainter painter(this);
|
||||
// painter.fillRect(rect(), Qt::gray);
|
||||
// painter.end();
|
||||
// }
|
||||
};
|
||||
#endif
|
||||
@@ -1,154 +0,0 @@
|
||||
#ifndef Navigate_Bar_H
|
||||
#define Navigate_Bar_H
|
||||
#include "function/function.export.h"
|
||||
#include "global.h"
|
||||
class Delegate_导航 : public QStyledItemDelegate {
|
||||
public:
|
||||
using QStyledItemDelegate::QStyledItemDelegate;
|
||||
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override {
|
||||
painter->save();
|
||||
auto dd = index.data(Qt::DisplayRole).value<导航_Dat>();
|
||||
if (std::holds_alternative<导航_Dat1>(dd.data))
|
||||
{
|
||||
bool selected = option.state & QStyle::State_Selected;
|
||||
if (selected)
|
||||
{
|
||||
painter->setPen(Qt::NoPen);
|
||||
// painter->setBrush(QColor("#ADD8E6"));
|
||||
painter->setBrush(base);
|
||||
painter->drawRoundedRect(option.rect, 4, 4);
|
||||
}
|
||||
auto& d = std::get<导航_Dat1>(dd.data);
|
||||
QColor cc = selected ? Qt::white : d.icon.get_color();
|
||||
int height = 20;
|
||||
int y = (option.rect.height() - height) / 2;
|
||||
QRect iconRect = QRect(option.rect.left() + 8, option.rect.y() + y, height, height);
|
||||
d.icon.render(painter, iconRect, cc);
|
||||
QRect textRect = option.rect;
|
||||
textRect.setLeft(iconRect.right() + 8);
|
||||
painter->setPen(QPen(cc));
|
||||
painter->drawText(textRect, Qt::AlignVCenter, d.text);
|
||||
}
|
||||
if (std::holds_alternative<导航_Dat2>(dd.data))
|
||||
{
|
||||
auto& d = std::get<导航_Dat2>(dd.data);
|
||||
QRect textRect = option.rect;
|
||||
// painter->drawRect(textRect);
|
||||
painter->setPen(QPen(Qt::darkGray));
|
||||
painter->setFont(get_font());
|
||||
painter->drawText(textRect, Qt::AlignVCenter, d.text);
|
||||
painter->drawLine(textRect.bottomLeft(), textRect.bottomRight());
|
||||
}
|
||||
painter->restore();
|
||||
}
|
||||
QFont get_font() const {
|
||||
QFont f;
|
||||
f.setPixelSize(18);
|
||||
return f;
|
||||
}
|
||||
QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const override {
|
||||
auto dd = index.data(Qt::DisplayRole).value<导航_Dat>();
|
||||
if (std::holds_alternative<导航_Dat1>(dd.data))
|
||||
{
|
||||
auto& d = std::get<导航_Dat1>(dd.data);
|
||||
QString text = d.text;
|
||||
int width = option.rect.width(); // 视图宽度
|
||||
QFontMetrics fm(option.font); // 获取字体度量
|
||||
int textHeight =
|
||||
fm.boundingRect(QRect(0, 0, width, 0), Qt::TextWordWrap, text).height(); // 计算多行文本的高度
|
||||
int extraPadding = 10; // 额外的间距
|
||||
return QSize(width, textHeight + extraPadding); // 返回计算后的尺寸
|
||||
}
|
||||
if (std::holds_alternative<导航_Dat2>(dd.data))
|
||||
{
|
||||
auto& d = std::get<导航_Dat2>(dd.data);
|
||||
QString text = d.text;
|
||||
QFontMetrics fm(get_font());
|
||||
int extraPadding = 20; // 额外的间距
|
||||
return QSize(fm.horizontalAdvance(text), fm.height() + extraPadding); // 返回计算后的
|
||||
}
|
||||
return {0, 20};
|
||||
}
|
||||
};
|
||||
class View_导航 : public QListView {
|
||||
public:
|
||||
explicit View_导航(QWidget* parent = nullptr) : QListView(parent) {
|
||||
setFrameShape(QFrame::NoFrame);
|
||||
model = new Model_导航<导航_Dat>(this);
|
||||
QAbstractItemView::setModel(model);
|
||||
setItemDelegate(new Delegate_导航(this));
|
||||
QObject::connect(this, &QListView::clicked, [&](const QModelIndex& index) {
|
||||
导航_Dat it = model->data(index, Qt::DisplayRole).value<导航_Dat>();
|
||||
if (click) click(&it);
|
||||
});
|
||||
setStyleSheet("background: rgba(0, 0, 0, 0);");
|
||||
setSpacing(2);
|
||||
}
|
||||
protected:
|
||||
void paintEvent(QPaintEvent* e) override {
|
||||
QPainter painter(viewport()); // 在视图区域绘制
|
||||
QListView::paintEvent(e);
|
||||
}
|
||||
public:
|
||||
std::function<void(导航_Dat*)> click = nullptr;
|
||||
QVector<导航_Dat> items;
|
||||
void update_model() { model->setDataList(items); }
|
||||
private:
|
||||
Model_导航<导航_Dat>* model;
|
||||
};
|
||||
class Navigate_Bar : public QWidget {
|
||||
public:
|
||||
View_导航* w;
|
||||
QVBoxLayout* layout;
|
||||
void set_click(const std::function<void(导航_Dat*)>& click) { w->click = click; }
|
||||
采集预处理* m采集预处理;
|
||||
信号侦察* m信号侦察;
|
||||
信号处理* m信号处理;
|
||||
信号生成* m信号生成;
|
||||
信号对消* m信号对消;
|
||||
存储列表* m存储列表;
|
||||
protected:
|
||||
void paintEvent(QPaintEvent* event) override {
|
||||
QPainter painter(this);
|
||||
painter.setRenderHints(QPainter::Antialiasing);
|
||||
painter.setPen(Qt::NoPen);
|
||||
painter.setBrush(Qt::white);
|
||||
painter.drawRoundedRect(rect(), 8, 8);
|
||||
painter.end();
|
||||
}
|
||||
public:
|
||||
Navigate_Bar() {
|
||||
layout = new QVBoxLayout(this);
|
||||
w = new View_导航;
|
||||
m采集预处理 = new 采集预处理;
|
||||
m信号侦察 = new 信号侦察;
|
||||
m信号处理 = new 信号处理;
|
||||
m信号生成 = new 信号生成;
|
||||
m信号对消 = new 信号对消;
|
||||
m存储列表 = new 存储列表;
|
||||
QColor c = Qt::darkGray;
|
||||
w->items.push_back(导航_Dat(导航_Dat2{"功能模块"}));
|
||||
w->items.push_back(
|
||||
导航_Dat(导航_Dat1{"采集预处理\n\t\t999.999MHZ", "采集预处理", "F信号 载频、能量、用户聚类",
|
||||
SVGImage_Render().set_path(":/filter_1.svg").set_color(c).create(), m采集预处理}));
|
||||
w->items.push_back(
|
||||
导航_Dat(导航_Dat1{"信号侦察\n\tF信号侦察\n\t\t\t\t6/44", "信号侦察", "F信号 载频、能量、用户聚类",
|
||||
SVGImage_Render().set_path(":/filter_2.svg").set_color(c).create(), m信号侦察}));
|
||||
w->items.push_back(
|
||||
导航_Dat(导航_Dat1{"信号处理", "信号处理", "F信号 载频、能量、用户聚类",
|
||||
SVGImage_Render().set_path(":/filter_3.svg").set_color(c).create(), m信号处理}));
|
||||
w->items.push_back(
|
||||
导航_Dat(导航_Dat1{"信号生成", "信号生成", "F信号 载频、能量、用户聚类",
|
||||
SVGImage_Render().set_path(":/filter_4.svg").set_color(c).create(), m信号生成}));
|
||||
w->items.push_back(
|
||||
导航_Dat(导航_Dat1{"信号对消", "信号对消", "F信号 载频、能量、用户聚类",
|
||||
SVGImage_Render().set_path(":/filter_5.svg").set_color(c).create(), m信号对消}));
|
||||
w->items.push_back(导航_Dat(导航_Dat2{"数据存储"}));
|
||||
w->items.push_back(
|
||||
导航_Dat(导航_Dat1{"存储列表\n\t\t1/60", "存储列表", "F信号 载频、能量、用户聚类",
|
||||
SVGImage_Render().set_path(":/filter_1.svg").set_color(c).create(), m存储列表}));
|
||||
w->update_model();
|
||||
layout->addWidget(w);
|
||||
}
|
||||
};
|
||||
#endif // FUNCTION_BAR_H
|
||||
@@ -1,49 +0,0 @@
|
||||
#include "ScrollBar.h"
|
||||
#include <QPainter>
|
||||
#include <qstyleoption.h>
|
||||
#include "function/function_global.h"
|
||||
void ScrollBar::Style::drawComplexControl(ComplexControl control, const QStyleOptionComplex* option,
|
||||
QPainter* painter, const QWidget* widget) const {
|
||||
|
||||
painter->fillRect(widget->rect(), Qt::white);
|
||||
SubControls sub = option->subControls;
|
||||
if(CC_ScrollBar != control){
|
||||
return;
|
||||
}
|
||||
const QStyleOptionSlider* sopt = qstyleoption_cast<const QStyleOptionSlider*>(option);
|
||||
|
||||
// 前面的矩形
|
||||
QRect front = subControlRect(control, sopt, QStyle::SC_ScrollBarSubLine, widget);
|
||||
QRect back = subControlRect(control, sopt, QStyle::SC_ScrollBarAddLine, widget);
|
||||
|
||||
|
||||
|
||||
// painter->drawRect(leftIndicatorRect);
|
||||
// painter->drawRect(rightIndicatorRect);
|
||||
// qDebug() << r2;
|
||||
// painter->drawRect(r2);
|
||||
|
||||
// if(sub & QStyle::SC_ScrollBarSubLine) {
|
||||
// QStyleOptionComplex* opt = const_cast<QStyleOptionComplex*>(option);
|
||||
// opt->subControls = QStyle::SC_ScrollBarSubLine;
|
||||
// QProxyStyle::drawComplexControl(control, option, painter, widget);
|
||||
// return;
|
||||
// }
|
||||
// if(sub & QStyle::SC_ScrollBarSubLine) {
|
||||
// QStyleOptionComplex* opt = const_cast<QStyleOptionComplex*>(option);
|
||||
// opt->subControls = QStyle::SC_ScrollBarSubLine;
|
||||
// QProxyStyle::drawComplexControl(control, option, painter, widget);
|
||||
// return;
|
||||
// }
|
||||
|
||||
|
||||
QRect scrollBarRect = sopt->rect;
|
||||
painter->setPen(Qt::NoPen);
|
||||
painter->setBrush(Qt::blue);
|
||||
//painter->drawRoundedRect(scrollBarRect, 6, 6);
|
||||
|
||||
QRectF sliderRect = subControlRect(control, sopt, QStyle::SC_ScrollBarSlider, widget);
|
||||
painter->setBrush(base);
|
||||
painter->drawRoundedRect(sliderRect, 6, 6);
|
||||
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
#ifndef SCROLLBAR_H
|
||||
#define SCROLLBAR_H
|
||||
#include <QProxyStyle>
|
||||
#include <QScrollBar>
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
class ScrollBar : public QScrollBar {
|
||||
public:
|
||||
ScrollBar() { setStyle(new Style()); }
|
||||
class Style : public QProxyStyle {
|
||||
public:
|
||||
void drawPrimitive(QStyle::PrimitiveElement element, const QStyleOption* option, QPainter* painter,
|
||||
const QWidget* widget) const override {
|
||||
qDebug() << "drawPrimitive == " << element;
|
||||
QProxyStyle::drawPrimitive(element, option, painter, widget);
|
||||
}
|
||||
void drawComplexControl(ComplexControl control, const QStyleOptionComplex* option, QPainter* painter,
|
||||
const QWidget* widget) const override;
|
||||
void drawControl(ControlElement element, const QStyleOption* option, QPainter* painter,
|
||||
const QWidget* widget) const override {
|
||||
qDebug() << "drawControl == " << element;
|
||||
QProxyStyle::drawControl(element, option, painter, widget);
|
||||
}
|
||||
QRect subElementRect(SubElement element, const QStyleOption* option, const QWidget* widget) const override {
|
||||
qDebug() << "subElementRect == " << element;
|
||||
return QProxyStyle::subElementRect(element, option, widget);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,71 +0,0 @@
|
||||
#include "Table.h"
|
||||
#include <QPainter>
|
||||
|
||||
|
||||
CustomModel::CustomModel(QObject *parent)
|
||||
: QAbstractTableModel(parent) {
|
||||
tableData = {
|
||||
{"Item 1-1", "Item 1-2", "Item 1-3"},
|
||||
{"Item 2-1", "Item 2-2", "Item 2-3"},
|
||||
{"Item 3-1", "Item 3-2", "Item 3-3"}
|
||||
};
|
||||
}
|
||||
|
||||
int CustomModel::rowCount(const QModelIndex &) const {
|
||||
return tableData.size();
|
||||
}
|
||||
|
||||
int CustomModel::columnCount(const QModelIndex &) const {
|
||||
return tableData.isEmpty() ? 0 : tableData[0].size();
|
||||
}
|
||||
|
||||
QVariant CustomModel::data(const QModelIndex &index, int role) const {
|
||||
if (!index.isValid())
|
||||
return QVariant();
|
||||
|
||||
if (role == Qt::DisplayRole || role == Qt::EditRole) {
|
||||
return tableData[index.row()][index.column()];
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
bool CustomModel::setData(const QModelIndex &index, const QVariant &value, int role) {
|
||||
if (index.isValid() && role == Qt::EditRole) {
|
||||
tableData[index.row()][index.column()] = value.toString();
|
||||
emit dataChanged(index, index);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Qt::ItemFlags CustomModel::flags(const QModelIndex &index) const {
|
||||
if (!index.isValid())
|
||||
return Qt::NoItemFlags;
|
||||
|
||||
return Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled;
|
||||
}
|
||||
CustomTableDelegate::CustomTableDelegate(QObject *parent) : QStyledItemDelegate(parent) {}
|
||||
|
||||
void CustomTableDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const {
|
||||
painter->save();
|
||||
|
||||
if (index.row() % 2 == 0) {
|
||||
painter->fillRect(option.rect, QColor(220, 220, 220));
|
||||
} else {
|
||||
painter->fillRect(option.rect, Qt::white);
|
||||
}
|
||||
|
||||
painter->drawText(option.rect, Qt::AlignCenter, index.data().toString());
|
||||
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
CustomTableView::CustomTableView(QWidget *parent) : QTableView(parent) {
|
||||
setAlternatingRowColors(true);
|
||||
setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
#ifndef CUSTOMMODEL_H
|
||||
#define CUSTOMMODEL_H
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
#include <QVector>
|
||||
#include <QString>
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QTableView>
|
||||
#include <QMainWindow>
|
||||
#include <QApplication>
|
||||
#include <QHeaderView>
|
||||
#include <QPainter>
|
||||
|
||||
|
||||
|
||||
class CustomModel : public QAbstractTableModel {
|
||||
public:
|
||||
explicit CustomModel(QObject *parent = nullptr);
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
private:
|
||||
QVector<QVector<QString>> tableData;
|
||||
};
|
||||
|
||||
class CustomTableDelegate : public QStyledItemDelegate {
|
||||
public:
|
||||
explicit CustomTableDelegate(QObject *parent = nullptr);
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
};
|
||||
|
||||
|
||||
class CustomTableView : public QTableView {
|
||||
public:
|
||||
explicit CustomTableView(QWidget *parent = nullptr);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // CUSTOMMODEL_H
|
||||
@@ -1,149 +0,0 @@
|
||||
#ifndef CMAKEUSERPRESETS_JSON_TREE_TABLE_H
|
||||
#define CMAKEUSERPRESETS_JSON_TREE_TABLE_H
|
||||
#include <QApplication>
|
||||
#include <QLineEdit>
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QTreeWidget>
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QVBoxLayout>
|
||||
#include <QWidget>
|
||||
#include "ScrollBar.h"
|
||||
struct TreeNode {
|
||||
QStringList data; // 节点数据,每个字段一个字符串
|
||||
QList<TreeNode*> children; // 子节点列表
|
||||
TreeNode* parent; // 父节点指针
|
||||
|
||||
TreeNode(const QStringList& data, TreeNode* parent = nullptr)
|
||||
: data(data), parent(parent) {}
|
||||
~TreeNode() {
|
||||
qDeleteAll(children);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class TreeModel : public QAbstractItemModel {
|
||||
public:
|
||||
TreeModel(const QStringList& headers, QObject* parent = nullptr)
|
||||
: QAbstractItemModel(parent), headers(headers) {
|
||||
rootItem = new TreeNode(headers);
|
||||
}
|
||||
|
||||
~TreeModel() {
|
||||
delete rootItem;
|
||||
}
|
||||
|
||||
// 必要的虚函数实现
|
||||
int rowCount(const QModelIndex& parent = QModelIndex()) const override {
|
||||
TreeNode* parentNode = nodeFromIndex(parent);
|
||||
return parentNode->children.count();
|
||||
}
|
||||
|
||||
int columnCount(const QModelIndex& parent = QModelIndex()) const override {
|
||||
return headers.count();
|
||||
}
|
||||
|
||||
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override {
|
||||
if (!index.isValid() || role != Qt::DisplayRole)
|
||||
return QVariant();
|
||||
|
||||
TreeNode* item = nodeFromIndex(index);
|
||||
return item->data.value(index.column());
|
||||
}
|
||||
|
||||
QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override {
|
||||
if (!hasIndex(row, column, parent))
|
||||
return QModelIndex();
|
||||
|
||||
TreeNode* parentNode = nodeFromIndex(parent);
|
||||
TreeNode* childItem = parentNode->children.value(row);
|
||||
if (childItem)
|
||||
return createIndex(row, column, childItem);
|
||||
else
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
QModelIndex parent(const QModelIndex& index) const override {
|
||||
if (!index.isValid())
|
||||
return QModelIndex();
|
||||
|
||||
TreeNode* childItem = nodeFromIndex(index);
|
||||
TreeNode* parentItem = childItem->parent;
|
||||
|
||||
if (parentItem == rootItem || !parentItem)
|
||||
return QModelIndex();
|
||||
|
||||
int row = parentItem->parent->children.indexOf(parentItem);
|
||||
return createIndex(row, 0, parentItem);
|
||||
}
|
||||
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override {
|
||||
if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
|
||||
return headers.value(section);
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
// 添加节点的函数
|
||||
void addNode(const QStringList& data, const QModelIndex& parent = QModelIndex()) {
|
||||
TreeNode* parentNode = nodeFromIndex(parent);
|
||||
beginInsertRows(parent, parentNode->children.count(), parentNode->children.count());
|
||||
TreeNode* newNode = new TreeNode(data, parentNode);
|
||||
parentNode->children.append(newNode);
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
private:
|
||||
TreeNode* rootItem;
|
||||
QStringList headers;
|
||||
|
||||
TreeNode* nodeFromIndex(const QModelIndex& index) const {
|
||||
if (index.isValid())
|
||||
return static_cast<TreeNode*>(index.internalPointer());
|
||||
else
|
||||
return rootItem;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class TreeDelegate : public QStyledItemDelegate {
|
||||
public:
|
||||
TreeDelegate(QObject* parent = nullptr) : QStyledItemDelegate(parent) {}
|
||||
|
||||
QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option,
|
||||
const QModelIndex& index) const override {
|
||||
// 根据需要创建编辑器,例如 QLineEdit
|
||||
QLineEdit* editor = new QLineEdit(parent);
|
||||
return editor;
|
||||
}
|
||||
|
||||
void setEditorData(QWidget* editor, const QModelIndex& index) const override {
|
||||
QString value = index.model()->data(index, Qt::EditRole).toString();
|
||||
QLineEdit* lineEdit = static_cast<QLineEdit*>(editor);
|
||||
lineEdit->setText(value);
|
||||
}
|
||||
|
||||
void setModelData(QWidget* editor, QAbstractItemModel* model,
|
||||
const QModelIndex& index) const override {
|
||||
QLineEdit* lineEdit = static_cast<QLineEdit*>(editor);
|
||||
model->setData(index, lineEdit->text(), Qt::EditRole);
|
||||
}
|
||||
|
||||
void updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option,
|
||||
const QModelIndex& index) const override {
|
||||
editor->setGeometry(option.rect);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
class TreeView : public QTreeView {
|
||||
public:
|
||||
TreeView(){
|
||||
setVerticalScrollBar(new ScrollBar());
|
||||
setHorizontalScrollBar(new ScrollBar());
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,99 +0,0 @@
|
||||
#ifndef a_采集预处理_H
|
||||
#define a_采集预处理_H
|
||||
#include "function_global.h"
|
||||
class T_采集预处理_瀑布图 : public YSG::Plot {
|
||||
public:
|
||||
YSG::FrequentAxis* xAxis{};
|
||||
YSG::TimeAxis* yAxis{};
|
||||
YSG::MutiSelectRect* msr{};
|
||||
YSG::WaterFall* wf{};
|
||||
QMenu* mMenu{};
|
||||
void init() override {
|
||||
Plot::init();
|
||||
mObjectName = "WaterFallPlot";
|
||||
bindRenderThread(mObjectName + "Thread");
|
||||
xAxis = YSG::FrequentAxis::Builder(this, Qt::Horizontal).set_tick_length(-10).set_sub_tick_length(-5).build();
|
||||
yAxis = YSG::TimeAxis::Builder(this, Qt::Vertical).build();
|
||||
wf = YSG::WaterFall::Builder(xAxis, yAxis).set_layerName("plottable").set_frequent_range({0, 20}).build();
|
||||
msr = YSG::MutiSelectRect::Builder(xAxis, yAxis).build();
|
||||
}
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent* event) override {
|
||||
xAxis->set_x(0);
|
||||
xAxis->set_y(height() - 1);
|
||||
xAxis->set_pixel_size(width());
|
||||
yAxis->set_x(0);
|
||||
yAxis->set_y(0);
|
||||
yAxis->set_pixel_size(height());
|
||||
// wf->set_frequent_point_size(wf->frequent_axis()->get_pixel_point_size());
|
||||
wf->set_frequent_point_size(width());
|
||||
}
|
||||
void contextMenuEvent(QContextMenuEvent* event) override {
|
||||
if (!mMenu)
|
||||
{
|
||||
auto ws =
|
||||
bw(cw(wf, -1), "瀑布图") + bw(cw(xAxis), "频率轴") + bw(cw(yAxis), "时间轴") + bw(cw(msr), "多选框");
|
||||
mMenu = createMenu(this, ws);
|
||||
}
|
||||
mMenu->exec(event->globalPos());
|
||||
}
|
||||
};
|
||||
class T_采集预处理_频谱图 : public YSG::Plot {
|
||||
public:
|
||||
YSG::FrequentAxis* xAxis{};
|
||||
YSG::Axis* yAxis{};
|
||||
YSG::MutiSelectRect* msr{};
|
||||
YSG::Spectrum* sp{};
|
||||
QMenu* mMenu{};
|
||||
void init() override {
|
||||
Plot::init();
|
||||
mObjectName = "SpectrumPlot";
|
||||
bindRenderThread(mObjectName + "Thread");
|
||||
xAxis = YSG::FrequentAxis::Builder(this, Qt::Horizontal)
|
||||
.set_coord_range({0, 100})
|
||||
.set_tick_length(-10)
|
||||
.set_sub_tick_length(-5)
|
||||
.set_use_wheel(true)
|
||||
.set_use_drag(true)
|
||||
.build();
|
||||
yAxis = YSG::Axis::Builder(this, Qt::Vertical)
|
||||
.set_coord_range({100, 0})
|
||||
.set_unit_text("功率")
|
||||
.set_use_drag(true)
|
||||
.build();
|
||||
sp = YSG::Spectrum::Builder(xAxis, yAxis).set_frequent_range({0, 100}).build();
|
||||
msr = YSG::MutiSelectRect::Builder(xAxis, yAxis).build();
|
||||
}
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent* event) override {
|
||||
int leftMargin = 20, rightMargin = 20, topMargin = 20, bottomMargin = 20;
|
||||
int w = width() - leftMargin - rightMargin;
|
||||
int h = height() - topMargin - bottomMargin;
|
||||
xAxis->set_x(leftMargin);
|
||||
xAxis->set_y(height() - bottomMargin);
|
||||
xAxis->set_pixel_size(w);
|
||||
yAxis->set_x(leftMargin);
|
||||
yAxis->set_y(topMargin);
|
||||
yAxis->set_pixel_size(h);
|
||||
sp->set_frequent_point_size(sp->frequent_axis()->get_pixel_point_size());
|
||||
}
|
||||
void contextMenuEvent(QContextMenuEvent* event) override {
|
||||
if (!mMenu)
|
||||
{
|
||||
auto ws =
|
||||
bw(cw(sp, -1), "频谱图") + bw(cw(xAxis), "频率x轴") + bw(cw(yAxis), "功率y轴") + bw(cw(msr), "多选框");
|
||||
mMenu = createMenu(this, ws);
|
||||
}
|
||||
mMenu->exec(event->globalPos());
|
||||
}
|
||||
};
|
||||
class 采集预处理 : public BaseWidget {
|
||||
public:
|
||||
QHBoxLayout* mainLayout{};
|
||||
T_采集预处理_瀑布图* m_瀑布图{};
|
||||
T_采集预处理_频谱图* m_频谱图{};
|
||||
QVBoxLayout* createV();
|
||||
采集预处理();
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
};
|
||||
#endif
|
||||
@@ -1,62 +0,0 @@
|
||||
#ifndef a_信号侦察_H
|
||||
#define a_信号侦察_H
|
||||
#include "function_global.h"
|
||||
class T_信号侦察_频谱图 : public YSG::Plot {
|
||||
public:
|
||||
YSG::FrequentAxis* xAxis{};
|
||||
YSG::Axis* yAxis{};
|
||||
YSG::MutiSelectRect* msr{};
|
||||
YSG::Spectrum* sp{};
|
||||
QMenu* mMenu{};
|
||||
void init() override {
|
||||
Plot::init();
|
||||
mObjectName = "SpectrumPlot";
|
||||
bindRenderThread(mObjectName + "Thread");
|
||||
xAxis = YSG::FrequentAxis::Builder(this, Qt::Horizontal)
|
||||
.set_coord_range({0, 100})
|
||||
.set_tick_length(-10)
|
||||
.set_sub_tick_length(-5)
|
||||
.set_use_wheel(true)
|
||||
.set_use_drag(true)
|
||||
.build();
|
||||
yAxis = YSG::Axis::Builder(this, Qt::Vertical)
|
||||
.set_coord_range({100, 0})
|
||||
.set_unit_text("功率")
|
||||
.set_use_drag(true)
|
||||
.build();
|
||||
sp = YSG::Spectrum::Builder(xAxis, yAxis).set_frequent_range({0, 100}).build();
|
||||
msr = YSG::MutiSelectRect::Builder(xAxis, yAxis).build();
|
||||
}
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent* event) override {
|
||||
int leftMargin = 20, rightMargin = 20, topMargin = 20, bottomMargin = 20;
|
||||
int w = width() - leftMargin - rightMargin;
|
||||
int h = height() - topMargin - bottomMargin;
|
||||
xAxis->set_x(leftMargin);
|
||||
xAxis->set_y(height() - bottomMargin);
|
||||
xAxis->set_pixel_size(w);
|
||||
yAxis->set_x(leftMargin);
|
||||
yAxis->set_y(topMargin);
|
||||
yAxis->set_pixel_size(h);
|
||||
sp->set_frequent_point_size(sp->frequent_axis()->get_pixel_point_size());
|
||||
}
|
||||
void contextMenuEvent(QContextMenuEvent* event) override {
|
||||
if (!mMenu)
|
||||
{
|
||||
auto ws =
|
||||
bw(cw(sp, -1), "频谱图") + bw(cw(xAxis), "频率x轴") + bw(cw(yAxis), "功率y轴") + bw(cw(msr), "多选框");
|
||||
mMenu = createMenu(this, ws);
|
||||
}
|
||||
mMenu->exec(event->globalPos());
|
||||
}
|
||||
};
|
||||
class 信号侦察 : public BaseWidget {
|
||||
public:
|
||||
QHBoxLayout* mainLayout{};
|
||||
T_信号侦察_频谱图* m_频谱图{};
|
||||
TreeView *treeView{};
|
||||
QVBoxLayout* createV();
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
信号侦察();
|
||||
};
|
||||
#endif // 信号侦察_H
|
||||
@@ -1,12 +0,0 @@
|
||||
#ifndef a_信号处理_H
|
||||
#define a_信号处理_H
|
||||
#include "function_global.h"
|
||||
class 信号处理 : public BaseWidget {
|
||||
public:
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
QVBoxLayout* createV();
|
||||
QHBoxLayout* mainLayout{};
|
||||
TreeView* treeView{};
|
||||
信号处理();
|
||||
};
|
||||
#endif // 信号处理_H
|
||||
@@ -1,62 +0,0 @@
|
||||
#ifndef a_信号生成_H
|
||||
#define a_信号生成_H
|
||||
#include "function_global.h"
|
||||
class T_信号生成_频谱图 : public YSG::Plot {
|
||||
public:
|
||||
YSG::FrequentAxis* xAxis{};
|
||||
YSG::Axis* yAxis{};
|
||||
YSG::MutiSelectRect* msr{};
|
||||
YSG::Spectrum* sp{};
|
||||
QMenu* mMenu{};
|
||||
void init() override {
|
||||
Plot::init();
|
||||
mObjectName = "SpectrumPlot";
|
||||
bindRenderThread(mObjectName + "Thread");
|
||||
xAxis = YSG::FrequentAxis::Builder(this, Qt::Horizontal)
|
||||
.set_coord_range({0, 100})
|
||||
.set_tick_length(-10)
|
||||
.set_sub_tick_length(-5)
|
||||
.set_use_wheel(true)
|
||||
.set_use_drag(true)
|
||||
.build();
|
||||
yAxis = YSG::Axis::Builder(this, Qt::Vertical)
|
||||
.set_coord_range({100, 0})
|
||||
.set_unit_text("功率")
|
||||
.set_use_drag(true)
|
||||
.build();
|
||||
sp = YSG::Spectrum::Builder(xAxis, yAxis).set_frequent_range({0, 100}).build();
|
||||
msr = YSG::MutiSelectRect::Builder(xAxis, yAxis).build();
|
||||
}
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent* event) override {
|
||||
int leftMargin = 20, rightMargin = 20, topMargin = 20, bottomMargin = 20;
|
||||
int w = width() - leftMargin - rightMargin;
|
||||
int h = height() - topMargin - bottomMargin;
|
||||
xAxis->set_x(leftMargin);
|
||||
xAxis->set_y(height() - bottomMargin);
|
||||
xAxis->set_pixel_size(w);
|
||||
yAxis->set_x(leftMargin);
|
||||
yAxis->set_y(topMargin);
|
||||
yAxis->set_pixel_size(h);
|
||||
sp->set_frequent_point_size(sp->frequent_axis()->get_pixel_point_size());
|
||||
}
|
||||
void contextMenuEvent(QContextMenuEvent* event) override {
|
||||
if (!mMenu)
|
||||
{
|
||||
auto ws =
|
||||
bw(cw(sp, -1), "频谱图") + bw(cw(xAxis), "频率x轴") + bw(cw(yAxis), "功率y轴") + bw(cw(msr), "多选框");
|
||||
mMenu = createMenu(this, ws);
|
||||
}
|
||||
mMenu->exec(event->globalPos());
|
||||
}
|
||||
};
|
||||
class 信号生成 : public BaseWidget {
|
||||
public:
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
QHBoxLayout* mainLayout{};
|
||||
QVBoxLayout* createV();
|
||||
TreeView* treeView{};
|
||||
T_信号生成_频谱图* m_频谱图{};
|
||||
信号生成();
|
||||
};
|
||||
#endif // 信号生成_H
|
||||
@@ -1,62 +0,0 @@
|
||||
#ifndef a_信号对消_H
|
||||
#define a_信号对消_H
|
||||
#include "function_global.h"
|
||||
class T_信号对消_频谱图 : public YSG::Plot {
|
||||
public:
|
||||
YSG::FrequentAxis* xAxis{};
|
||||
YSG::Axis* yAxis{};
|
||||
YSG::MutiSelectRect* msr{};
|
||||
YSG::Spectrum* sp{};
|
||||
QMenu* mMenu{};
|
||||
void init() override {
|
||||
Plot::init();
|
||||
mObjectName = "SpectrumPlot";
|
||||
bindRenderThread(mObjectName + "Thread");
|
||||
xAxis = YSG::FrequentAxis::Builder(this, Qt::Horizontal)
|
||||
.set_coord_range({0, 100})
|
||||
.set_tick_length(-10)
|
||||
.set_sub_tick_length(-5)
|
||||
.set_use_wheel(true)
|
||||
.set_use_drag(true)
|
||||
.build();
|
||||
yAxis = YSG::Axis::Builder(this, Qt::Vertical)
|
||||
.set_coord_range({100, 0})
|
||||
.set_unit_text("功率")
|
||||
.set_use_drag(true)
|
||||
.build();
|
||||
sp = YSG::Spectrum::Builder(xAxis, yAxis).set_frequent_range({0, 100}).build();
|
||||
msr = YSG::MutiSelectRect::Builder(xAxis, yAxis).build();
|
||||
}
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent* event) override {
|
||||
int leftMargin = 20, rightMargin = 20, topMargin = 20, bottomMargin = 20;
|
||||
int w = width() - leftMargin - rightMargin;
|
||||
int h = height() - topMargin - bottomMargin;
|
||||
xAxis->set_x(leftMargin);
|
||||
xAxis->set_y(height() - bottomMargin);
|
||||
xAxis->set_pixel_size(w);
|
||||
yAxis->set_x(leftMargin);
|
||||
yAxis->set_y(topMargin);
|
||||
yAxis->set_pixel_size(h);
|
||||
sp->set_frequent_point_size(sp->frequent_axis()->get_pixel_point_size());
|
||||
}
|
||||
void contextMenuEvent(QContextMenuEvent* event) override {
|
||||
if (!mMenu)
|
||||
{
|
||||
auto ws =
|
||||
bw(cw(sp, -1), "频谱图") + bw(cw(xAxis), "频率x轴") + bw(cw(yAxis), "功率y轴") + bw(cw(msr), "多选框");
|
||||
mMenu = createMenu(this, ws);
|
||||
}
|
||||
mMenu->exec(event->globalPos());
|
||||
}
|
||||
};
|
||||
class 信号对消 : public BaseWidget {
|
||||
public:
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
QHBoxLayout* mainLayout{};
|
||||
QVBoxLayout* createV();
|
||||
T_信号对消_频谱图* m_频谱图{};
|
||||
TreeView *treeView{};
|
||||
信号对消();
|
||||
};
|
||||
#endif // 信号对消_H
|
||||
@@ -1,12 +0,0 @@
|
||||
#ifndef a_存储列表_H
|
||||
#define a_存储列表_H
|
||||
#include "function_global.h"
|
||||
class 存储列表 : public BaseWidget {
|
||||
public:
|
||||
void paintEvent(QPaintEvent* event) override;
|
||||
QHBoxLayout* mainLayout{};
|
||||
CustomTableView* m_table{};
|
||||
QVBoxLayout* createV();
|
||||
存储列表();
|
||||
};
|
||||
#endif // 存储列表_H
|
||||
@@ -1,14 +0,0 @@
|
||||
#include "function_global.h"
|
||||
#ifndef b0_升级记录_H
|
||||
#define b0_升级记录_H
|
||||
|
||||
|
||||
|
||||
|
||||
class 升级记录 : QWidget{
|
||||
public:
|
||||
QString content;
|
||||
Button *confirm{};
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,253 +0,0 @@
|
||||
#include "../MainWindow.h"
|
||||
#include "a2_信号侦察.h"
|
||||
#include "a3_信号处理.h"
|
||||
#include "a4_信号生成.h"
|
||||
#include "a5_信号对消.h"
|
||||
#include "function.export.h"
|
||||
#include "a6_存储列表.h"
|
||||
Data_source data_source;
|
||||
void Data_source::set_root(MainWindow* root) { m_root = root; }
|
||||
Data_source::Data_source() {}
|
||||
// 1
|
||||
采集预处理::采集预处理() {
|
||||
mainLayout = new QHBoxLayout(this);
|
||||
mainLayout->setMargin(0);
|
||||
mainLayout->addLayout(createV(), 3);
|
||||
auto fw = new FunctionWidget();
|
||||
auto 中心频率 = create_input("中心频率", "MHZ");
|
||||
auto 带宽 = create_input("带宽", "MHZ");
|
||||
auto 采样率 = create_input("采样率", "MHZ");
|
||||
auto layout = new QVBoxLayout;
|
||||
layout->setSpacing(0);
|
||||
layout->addLayout(中心频率);
|
||||
layout->addSpacing(10);
|
||||
layout->addLayout(带宽);
|
||||
layout->addSpacing(10);
|
||||
layout->addLayout(采样率);
|
||||
fw->init("预处理参数", "展示设备宽采效果", layout);
|
||||
mainLayout->addWidget(fw, 1);
|
||||
}
|
||||
QVBoxLayout* 采集预处理::createV() {
|
||||
QVBoxLayout* ret;
|
||||
ret = new QVBoxLayout();
|
||||
m_频谱图 = new T_采集预处理_频谱图;
|
||||
m_频谱图->init();
|
||||
ret->addWidget(m_频谱图);
|
||||
m_瀑布图 = new T_采集预处理_瀑布图;
|
||||
m_瀑布图->init();
|
||||
ret->addWidget(m_瀑布图);
|
||||
return ret;
|
||||
}
|
||||
void 采集预处理::paintEvent(QPaintEvent* event) {
|
||||
// QPainter painter(this);
|
||||
// painter.fillRect(event->rect(), Qt::white);
|
||||
QWidget::paintEvent(event);
|
||||
}
|
||||
|
||||
// 2
|
||||
QVBoxLayout* 信号侦察::createV() {
|
||||
auto ret = new QVBoxLayout;
|
||||
m_频谱图 = new T_信号侦察_频谱图();
|
||||
m_频谱图->init();
|
||||
ret->addWidget(m_频谱图, 1);
|
||||
QStringList headers = {"子带通道", "频点", "出联状态", "锁定状态", "出联时间", "出联时长", "符号率", "频值", "EbNo", "误码率", "电平", "帧定时"};
|
||||
TreeModel* model = new TreeModel(headers);
|
||||
QStringList parentData = {"父节点1", "数据2", "数据3"};
|
||||
model->addNode(parentData);
|
||||
QModelIndex parentIndex = model->index(0, 0);
|
||||
QStringList childData = {"子节点1", "数据2", "数据3"};
|
||||
model->addNode(childData, parentIndex);
|
||||
treeView = new TreeView;
|
||||
treeView->setModel(model);
|
||||
TreeDelegate* delegate = new TreeDelegate;
|
||||
treeView->setItemDelegate(delegate);
|
||||
treeView->expandAll();
|
||||
ret->addWidget(treeView, 1);
|
||||
return ret;
|
||||
}
|
||||
|
||||
信号侦察::信号侦察() {
|
||||
mainLayout = new QHBoxLayout(this);
|
||||
mainLayout->setMargin(0);mainLayout->setMargin(0);
|
||||
mainLayout->addLayout(createV(), 3);
|
||||
auto fw = new FunctionWidget();
|
||||
auto layout = new QVBoxLayout;
|
||||
layout->setSpacing(0);
|
||||
fw->init("侦察参数", "展示参数信息", layout);
|
||||
layout->addLayout(create_check_box("载波通道", {"221", "222"}));
|
||||
layout->addLayout(create_input("中心频率", "MHz"));
|
||||
layout->addLayout(create_input("带宽", "KHz"));
|
||||
layout->addLayout(create_input("采样率", "KHz"));
|
||||
layout->addLayout(create_check_box("调制方式", {"221", "222"}));
|
||||
layout->addLayout(create_input("符号率", "KBd"));
|
||||
layout->addLayout(create_check_box("译码方式", {"TPC"}));
|
||||
mainLayout->addWidget(fw, 1);
|
||||
}
|
||||
void 信号侦察::paintEvent(QPaintEvent* event) {
|
||||
QPainter painter(this);
|
||||
//painter.fillRect(event->rect(), Qt::yellow);
|
||||
painter.end();
|
||||
QWidget::paintEvent(event);
|
||||
}
|
||||
|
||||
|
||||
// 3
|
||||
信号处理::信号处理() {
|
||||
mainLayout = new QHBoxLayout(this);
|
||||
mainLayout->setMargin(0);
|
||||
mainLayout->addLayout(createV(), 3);
|
||||
auto fw = new FunctionWidget();
|
||||
auto layout = new QVBoxLayout;
|
||||
layout->setSpacing(0);
|
||||
layout->addLayout(create_check_box("工作模式", {"信号侦察"}));
|
||||
layout->addLayout(create_check_box("工作模式", {"信号侦察"}));
|
||||
fw->init("处理参数", "对用户或载波解调译码分析", layout);
|
||||
mainLayout->addWidget(fw, 1);
|
||||
}
|
||||
void 信号处理::paintEvent(QPaintEvent* event) {
|
||||
QPainter painter(this);
|
||||
//painter.fillRect(event->rect(), Qt::green);
|
||||
painter.end();
|
||||
QWidget::paintEvent(event);
|
||||
}
|
||||
QVBoxLayout* 信号处理::createV() {
|
||||
QVBoxLayout* ret;
|
||||
ret = new QVBoxLayout();
|
||||
ret->addWidget(new QWidget, 1);
|
||||
QStringList headers = {"子带通道", "频点", "出联状态", "锁定状态", "出联时间", "出联时长", "符号率", "频值", "EbNo", "误码率", "电平", "帧定时"};
|
||||
TreeModel* model = new TreeModel(headers);
|
||||
QStringList parentData = {"父节点1", "数据2", "数据3"};
|
||||
model->addNode(parentData);
|
||||
QModelIndex parentIndex = model->index(0, 0);
|
||||
QStringList childData = {"子节点1", "数据2", "数据3"};
|
||||
model->addNode(childData, parentIndex);
|
||||
treeView = new TreeView;
|
||||
treeView->setModel(model);
|
||||
TreeDelegate* delegate = new TreeDelegate;
|
||||
treeView->setItemDelegate(delegate);
|
||||
treeView->expandAll();
|
||||
ret->addWidget(treeView, 1);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// 4
|
||||
信号生成::信号生成() {
|
||||
mainLayout = new QHBoxLayout(this);
|
||||
mainLayout->setMargin(0);
|
||||
mainLayout->addLayout(createV(), 3);
|
||||
auto fw = new FunctionWidget();
|
||||
auto layout = new QVBoxLayout;
|
||||
layout->setSpacing(0);
|
||||
layout->addLayout(create_check_box("发射模式", {"多载波合路"}));
|
||||
layout->addLayout(create_check_box("数据源", {"本地样本"}));
|
||||
layout->addLayout(create_check_box("切入点", {"HDLC封装"}));
|
||||
layout->addLayout(create_check_box("信道编码", {"VIT"}));
|
||||
// TODO 80比特帧封装
|
||||
// TODO 符号映射
|
||||
layout->addLayout(create_check_box("调制类型", {"BPSK"}));
|
||||
layout->addLayout(create_input("发射时刻", {""}));
|
||||
// TODO 发射样本
|
||||
fw->init("生成参数", "支持", layout);
|
||||
mainLayout->addWidget(fw, 1);
|
||||
}
|
||||
|
||||
// 4
|
||||
void 信号生成::paintEvent(QPaintEvent* event) {
|
||||
QPainter painter(this);
|
||||
//painter.fillRect(event->rect(), Qt::red);
|
||||
painter.end();
|
||||
QWidget::paintEvent(event);
|
||||
}
|
||||
|
||||
QVBoxLayout* 信号生成::createV() {
|
||||
auto ret = new QVBoxLayout;
|
||||
m_频谱图 = new T_信号生成_频谱图();
|
||||
m_频谱图->init();
|
||||
ret->addWidget(m_频谱图, 1);
|
||||
QStringList headers = {"载波通道", "数据源"};
|
||||
TreeModel* model = new TreeModel(headers);
|
||||
QStringList parentData = {"父节点1", "数据2", "数据3"};
|
||||
model->addNode(parentData);
|
||||
QModelIndex parentIndex = model->index(0, 0);
|
||||
QStringList childData = {"子节点1", "数据2", "数据3"};
|
||||
model->addNode(childData, parentIndex);
|
||||
treeView = new TreeView;
|
||||
treeView->setModel(model);
|
||||
TreeDelegate* delegate = new TreeDelegate;
|
||||
treeView->setItemDelegate(delegate);
|
||||
treeView->expandAll();
|
||||
ret->addWidget(treeView, 1);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
// 5
|
||||
信号对消::信号对消() {
|
||||
mainLayout = new QHBoxLayout(this);
|
||||
mainLayout->setMargin(0);
|
||||
mainLayout->addLayout(createV(), 3);
|
||||
auto fw = new FunctionWidget();
|
||||
auto layout = new QVBoxLayout;
|
||||
layout->setSpacing(0);
|
||||
layout->addLayout(create_check_box("时差", {"10ms", "20ms"}));
|
||||
layout->addLayout(create_check_box("频差", {"100Hz"}));
|
||||
layout->addLayout(create_check_box("搜索范围", {"30ms"}));
|
||||
fw->init("对消参数", "对40M内发射信号对消", layout);
|
||||
mainLayout->addWidget(fw, 1);
|
||||
}
|
||||
void 信号对消::paintEvent(QPaintEvent* event) {
|
||||
QPainter painter(this);
|
||||
//painter.fillRect(event->rect(), Qt::blue);
|
||||
painter.end();
|
||||
QWidget::paintEvent(event);
|
||||
}
|
||||
|
||||
QVBoxLayout* 信号对消::createV() {
|
||||
auto ret = new QVBoxLayout;
|
||||
m_频谱图 = new T_信号对消_频谱图();
|
||||
m_频谱图->init();
|
||||
ret->addWidget(m_频谱图, 1);
|
||||
QStringList headers = {"子带通道", "频点", "出联状态", "锁定状态", "出联时间", "出联时长", "符号率", "频值", "EbNo", "误码率", "电平", "帧定时"};
|
||||
TreeModel* model = new TreeModel(headers);
|
||||
QStringList parentData = {"父节点1", "数据2", "数据3"};
|
||||
model->addNode(parentData);
|
||||
QModelIndex parentIndex = model->index(0, 0);
|
||||
QStringList childData = {"子节点1", "数据2", "数据3"};
|
||||
model->addNode(childData, parentIndex);
|
||||
treeView = new TreeView;
|
||||
treeView->setModel(model);
|
||||
TreeDelegate* delegate = new TreeDelegate;
|
||||
treeView->setItemDelegate(delegate);
|
||||
treeView->expandAll();
|
||||
ret->addWidget(treeView, 1);
|
||||
return ret;
|
||||
}
|
||||
// 6
|
||||
存储列表::存储列表() {
|
||||
mainLayout = new QHBoxLayout(this);
|
||||
mainLayout->setMargin(0);
|
||||
mainLayout->addLayout(createV(), 3);
|
||||
auto fw = new FunctionWidget();
|
||||
auto layout = new QVBoxLayout;
|
||||
layout->setSpacing(0);
|
||||
layout->addLayout(create_check_box("工作模式", {"信号侦察"}));
|
||||
layout->addLayout(create_check_box("工作模式", {"信号侦察"}));
|
||||
fw->init("处理参数", "对用户或载波解调译码分析", layout);
|
||||
mainLayout->addWidget(fw, 1);
|
||||
}
|
||||
void 存储列表::paintEvent(QPaintEvent* event) {
|
||||
QPainter painter(this);
|
||||
//painter.fillRect(event->rect(), Qt::gray);
|
||||
painter.end();
|
||||
QWidget::paintEvent(event);
|
||||
}
|
||||
QVBoxLayout* 存储列表::createV() {
|
||||
auto ret = new QVBoxLayout;
|
||||
m_table = new CustomTableView(this);
|
||||
auto* model = new CustomModel(this);
|
||||
auto* delegate = new CustomTableDelegate(this);
|
||||
m_table->setModel(model);
|
||||
m_table->setItemDelegate(delegate);
|
||||
ret->addWidget(m_table);
|
||||
return ret;
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
#ifndef CMAKEUSERPRESETS_JSON_FUNCTION_EXPORT_H
|
||||
#define CMAKEUSERPRESETS_JSON_FUNCTION_EXPORT_H
|
||||
#include "a1_采集预处理.h"
|
||||
#include "a2_信号侦察.h"
|
||||
#include "a3_信号处理.h"
|
||||
#include "a4_信号生成.h"
|
||||
#include "a5_信号对消.h"
|
||||
#include "a6_存储列表.h"
|
||||
#include "b0_升级记录.h"
|
||||
class MainWindow;
|
||||
class Data_source {
|
||||
public:
|
||||
void set_root(MainWindow* root);
|
||||
Data_source();
|
||||
protected:
|
||||
MainWindow* m_root{};
|
||||
};
|
||||
extern Data_source data_source;
|
||||
#endif
|
||||
@@ -1,88 +0,0 @@
|
||||
#ifndef FUNCTION_GLOBAL_H
|
||||
#define FUNCTION_GLOBAL_H
|
||||
#include <QPaintEvent>
|
||||
#include <QPainter>
|
||||
#include <QWidget>
|
||||
#include "DemoGallery/Tool.h"
|
||||
#include "component/Button.h"
|
||||
#include "component/ComboBox.h"
|
||||
#include "component/Input.h"
|
||||
#include "../Tree_Table.h"
|
||||
#include "../Table.h"
|
||||
|
||||
|
||||
extern QColor base;
|
||||
class FunctionWidget : public QWidget {
|
||||
public:
|
||||
QLabel* title{};
|
||||
QLabel* explain{};
|
||||
QVBoxLayout* layout{};
|
||||
Button* btn{};
|
||||
FunctionWidget() {}
|
||||
void init(const QString& title_text, const QString& explain_text, QLayout* l) {
|
||||
this->title = new QLabel(title_text);
|
||||
this->explain = new QLabel(explain_text);
|
||||
layout = new QVBoxLayout(this);
|
||||
layout->addLayout(create_line_1());
|
||||
btn = new Button();
|
||||
btn->content.text = new Text(QString("确定"), QPen(Qt::white));
|
||||
layout->addLayout(l);
|
||||
// qDebug() << " btn->sizeHint() " << btn->sizeHint();
|
||||
layout->addStretch(1);
|
||||
layout->addWidget(btn);
|
||||
btn->background.set_color(base);
|
||||
}
|
||||
QHBoxLayout* create_line_1() {
|
||||
auto ret = new QHBoxLayout;
|
||||
ret->addWidget(this->title, 1);
|
||||
ret->addWidget(this->explain, 1);
|
||||
return ret;
|
||||
}
|
||||
void paintEvent(QPaintEvent* event) override {
|
||||
QPainter painter(this);
|
||||
painter.setRenderHints(QPainter::Antialiasing);
|
||||
painter.setPen(Qt::NoPen);
|
||||
painter.setBrush(Qt::white);
|
||||
painter.drawRoundedRect(rect(), 8, 8);
|
||||
painter.end();
|
||||
}
|
||||
};
|
||||
class BaseWidget : public QWidget {
|
||||
public:
|
||||
};
|
||||
static Button* create_label(const QString& content) {
|
||||
auto ret = new Button;
|
||||
ret->content.text = new Text(content);
|
||||
ret->content.layout.second_prefix = 4;
|
||||
ret->content.layout.second_suffix = 0;
|
||||
ret->content.layout.main_type = Layout::Prefix_Space;
|
||||
// ret->background.set_border(Qt::yellow);
|
||||
return ret;
|
||||
}
|
||||
static QLayout* create_input(const QString& content, const QString& unit) {
|
||||
auto ret = new QVBoxLayout;
|
||||
ret->setSpacing(0);
|
||||
ret->setMargin(0);
|
||||
auto label = create_label(content);
|
||||
ret->addWidget(label);
|
||||
auto core = new Input;
|
||||
core->unit = unit;
|
||||
core->focus_color = base;
|
||||
ret->addWidget(core);
|
||||
return ret;
|
||||
}
|
||||
static QLayout* create_check_box(const QString& content, const QVector<QString>& opt_list) {
|
||||
auto ret = new QVBoxLayout;
|
||||
ret->setSpacing(0);
|
||||
ret->setMargin(0);
|
||||
auto label = create_label(content);
|
||||
ret->addWidget(label);
|
||||
auto core = new ComboBox;
|
||||
for (auto& opt : opt_list)
|
||||
{
|
||||
core->addItem(opt);
|
||||
}
|
||||
ret->addWidget(core);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
@@ -1,63 +0,0 @@
|
||||
#ifndef F_GLOBAL_H
|
||||
#define F_GLOBAL_H
|
||||
#include <QAbstractListModel>
|
||||
#include <QDebug>
|
||||
#include <QListView>
|
||||
#include <QPainter>
|
||||
#include <QPixmap>
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QVariant>
|
||||
#include <QtWidgets>
|
||||
#include <variant>
|
||||
#include "component/SVG.h"
|
||||
template <typename T>
|
||||
class Model_导航 : public QAbstractListModel {
|
||||
public:
|
||||
explicit Model_导航(QObject* parent = nullptr) : QAbstractListModel(parent) {}
|
||||
int rowCount(const QModelIndex& parent = QModelIndex()) const override { return items.size(); }
|
||||
QVariant data(const QModelIndex& index, int role) const override {
|
||||
if (!index.isValid() || index.row() >= items.size())
|
||||
{
|
||||
return QVariant();
|
||||
}
|
||||
if (role == Qt::DisplayRole)
|
||||
{
|
||||
int i = index.row();
|
||||
return QVariant::fromValue(items[i]);
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
void setDataList(const QVector<T>& dataList) {
|
||||
beginResetModel();
|
||||
items = dataList;
|
||||
endResetModel();
|
||||
}
|
||||
QVector<T> items;
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct 导航_Dat1 {
|
||||
QString text;
|
||||
QString title;
|
||||
QString detail;
|
||||
SVGImage_Render icon;
|
||||
QWidget* widget{};
|
||||
};
|
||||
|
||||
struct 导航_Dat2 {
|
||||
QString text;
|
||||
};
|
||||
|
||||
class 导航_Dat {
|
||||
public:
|
||||
导航_Dat() {}
|
||||
std::variant<导航_Dat1, 导航_Dat2> data;
|
||||
导航_Dat(const std::variant<导航_Dat1, 导航_Dat2>& data) : data(data) {}
|
||||
};
|
||||
|
||||
|
||||
|
||||
Q_DECLARE_METATYPE(导航_Dat)
|
||||
|
||||
#endif
|
||||
@@ -1,103 +0,0 @@
|
||||
#ifndef HEADER_H
|
||||
#define HEADER_H
|
||||
#include "component/Button.h"
|
||||
#include "global.h"
|
||||
struct Button;
|
||||
class Header : public QWidget {
|
||||
public:
|
||||
QLabel *icon;
|
||||
QLabel *app_title;
|
||||
QLabel *text{};
|
||||
QHBoxLayout *layout;
|
||||
Button *show_update{};
|
||||
Switch_Button *max;
|
||||
Button *hide;
|
||||
Button *close;
|
||||
QLabel *cur_title{};
|
||||
QLabel *detail{};
|
||||
|
||||
void set_title(const QString& big_content, const QString& little_content){
|
||||
cur_title->setText(big_content);
|
||||
detail->setText(little_content);
|
||||
}
|
||||
explicit Header(QWidget* parent) : QWidget(parent) {
|
||||
layout = new QHBoxLayout(this);
|
||||
icon = new QLabel(this);
|
||||
icon->setPixmap(QPixmap(":/filter_3.svg"));
|
||||
app_title = new QLabel(this);
|
||||
QFont app_title_font;
|
||||
app_title_font.setPointSize(20);
|
||||
app_title->setFont(app_title_font);
|
||||
app_title->setText("F信号处理设备");
|
||||
app_title->setStyleSheet("color: rgb(255, 255, 255);");
|
||||
layout->addWidget(app_title);
|
||||
|
||||
|
||||
cur_title = new QLabel("???");
|
||||
QFont big_font;
|
||||
big_font.setPointSize(16);
|
||||
cur_title->setFont(big_font);
|
||||
cur_title->setStyleSheet("color: rgb(255, 255, 255);");
|
||||
detail = new QLabel("??");
|
||||
detail->setStyleSheet("color: rgb(255, 255, 255);");
|
||||
|
||||
layout->addWidget(icon);
|
||||
layout->addWidget(app_title);
|
||||
layout->setSpacing(24);
|
||||
layout->addWidget(cur_title);
|
||||
layout->setSpacing(16);
|
||||
layout->addWidget(detail);
|
||||
layout->addStretch();
|
||||
layout->setMargin(0);
|
||||
show_update = create_icon(":/help.svg", base, [parent](QEvent::Type t, QMouseEvent* e) {
|
||||
if (t == QEvent::MouseButtonPress)
|
||||
{
|
||||
//parent->showMinimized();
|
||||
}
|
||||
e->accept();
|
||||
});
|
||||
hide = create_icon(":/zui_xiao_hua.svg", base, [parent](QEvent::Type t, QMouseEvent* e) {
|
||||
if (t == QEvent::MouseButtonPress)
|
||||
{
|
||||
parent->showMinimized();
|
||||
}
|
||||
e->accept();
|
||||
});
|
||||
max = create_switch_icon(
|
||||
base, ":/zui_da_hua2.svg",
|
||||
[parent](QEvent::Type t, QMouseEvent* e) {
|
||||
parent->showMaximized();
|
||||
e->accept();
|
||||
},
|
||||
":/zui_da_hua_back.svg",
|
||||
[parent](QEvent::Type t, QMouseEvent* e) {
|
||||
parent->showNormal();
|
||||
e->accept();
|
||||
});
|
||||
close = create_icon(":/guan_bi.svg", base, [parent](QEvent::Type t, QMouseEvent* e) {
|
||||
if (t == QEvent::MouseButtonPress)
|
||||
{
|
||||
parent->close();
|
||||
}
|
||||
e->accept();
|
||||
});
|
||||
layout->addWidget(show_update);
|
||||
layout->addWidget(hide);
|
||||
layout->addWidget(max);
|
||||
layout->addWidget(close);
|
||||
}
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent* event) override {
|
||||
int a = event->size().height();
|
||||
show_update->setFixedSize({a, a});
|
||||
hide->setFixedSize({a, a});
|
||||
max->setFixedSize({a, a});
|
||||
close->setFixedSize({a, a});
|
||||
}
|
||||
void paintEvent(QPaintEvent* event) override {
|
||||
QPainter painter(this);
|
||||
// painter.fillRect(event->rect(), Qt::blue);
|
||||
painter.end();
|
||||
}
|
||||
};
|
||||
#endif // HEADER_H
|
||||
|
Before Width: | Height: | Size: 216 KiB |
|
Before Width: | Height: | Size: 238 KiB |
|
Before Width: | Height: | Size: 292 KiB |
|
Before Width: | Height: | Size: 275 KiB |
|
Before Width: | Height: | Size: 278 KiB |
|
Before Width: | Height: | Size: 269 KiB |
|
Before Width: | Height: | Size: 281 KiB |
@@ -1,70 +0,0 @@
|
||||
#include <QApplication>
|
||||
#include <QTextCodec>
|
||||
#ifdef _WINDOWS
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
#include <QColor>
|
||||
#include <QDomDocument>
|
||||
#include <QHash>
|
||||
#include "MainWindow.h"
|
||||
#include "component/SVG.h"
|
||||
#include "global.h"
|
||||
// 自定义 qHash 函数
|
||||
#include <QColor>
|
||||
#include <QDebug>
|
||||
#include <QImage>
|
||||
#include <QSet>
|
||||
QColor base = QColor("#007ee1");
|
||||
MainWindow::MainWindow() {
|
||||
background_color = base;
|
||||
main_layout = new QVBoxLayout(this);
|
||||
int a = 2;
|
||||
main_layout->setContentsMargins(leftMargin + 20, topMargin + a, rightMargin + a, bottomMargin + a);
|
||||
header = new Header(this);
|
||||
main_layout->addWidget(header);
|
||||
create_center_Layout();
|
||||
data_source.set_root(this);
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::create_center_Layout() {
|
||||
center_layout = new QHBoxLayout();
|
||||
navigate_bar = new Navigate_Bar();
|
||||
center_layout->addWidget(navigate_bar, 1);
|
||||
center = new Center();
|
||||
center_layout->addWidget(center, 4);
|
||||
|
||||
main_layout->addSpacing(16);
|
||||
main_layout->addLayout(center_layout);
|
||||
|
||||
static auto click = [this](导航_Dat* d) {
|
||||
if(std::holds_alternative<导航_Dat1>(d->data)){
|
||||
auto& dd = std::get<导航_Dat1>(d->data);
|
||||
auto w = dd.widget;
|
||||
center->setWidget(dd.widget);
|
||||
header->set_title(dd.title, dd.detail);
|
||||
}
|
||||
};
|
||||
|
||||
navigate_bar->set_click(click);
|
||||
|
||||
click(&navigate_bar->w->items[0]);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
QApplication app(argc, argv);
|
||||
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
|
||||
#ifdef _WINDOWS
|
||||
SetConsoleOutputCP(CP_UTF8);
|
||||
system("chcp 65001");
|
||||
// setbuf(stdout, 0);
|
||||
#endif
|
||||
qRegisterMetaType<导航_Dat>("Dat");
|
||||
MainWindow w;
|
||||
w.resize(1000, 700);
|
||||
w.show();
|
||||
// svg/filter_1_24dp_5985E1_FILL0_wght400_GRAD0_opsz24.svg
|
||||
YSG::startAllRenderThread();
|
||||
return QApplication::exec();
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
#include "mock_data.h"
|
||||
@@ -1,4 +0,0 @@
|
||||
#ifndef MOCK_DATA_H
|
||||
#define MOCK_DATA_H
|
||||
class mock_data {};
|
||||
#endif
|
||||
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#000000"><path d="M560-360h80v-400H480v80h80v320ZM320-240q-33 0-56.5-23.5T240-320v-480q0-33 23.5-56.5T320-880h480q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H320Zm0-80h480v-480H320v480ZM160-80q-33 0-56.5-23.5T80-160v-560h80v560h560v80H160Zm160-720v480-480Z"/></svg>
|
||||
|
Before Width: | Height: | Size: 369 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#000000"><path d="M440-360h240v-80H520v-80h80q33 0 56.5-23.5T680-600v-80q0-33-23.5-56.5T600-760H440v80h160v80h-80q-33 0-56.5 23.5T440-520v160ZM320-240q-33 0-56.5-23.5T240-320v-480q0-33 23.5-56.5T320-880h480q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H320Zm0-80h480v-480H320v480ZM160-80q-33 0-56.5-23.5T80-160v-560h80v560h560v80H160Zm160-720v480-480Z"/></svg>
|
||||
|
Before Width: | Height: | Size: 462 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#000000"><path d="M440-360h160q33 0 56.5-23.5T680-440v-60q0-26-17-43t-43-17q26 0 43-17t17-43v-60q0-33-23.5-56.5T600-760H440v80h160v80h-80v80h80v80H440v80ZM320-240q-33 0-56.5-23.5T240-320v-480q0-33 23.5-56.5T320-880h480q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H320Zm0-80h480v-480H320v480ZM160-80q-33 0-56.5-23.5T80-160v-560h80v560h560v80H160Zm160-720v480-480Z"/></svg>
|
||||
|
Before Width: | Height: | Size: 474 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#000000"><path d="M600-360h80v-400h-80v160h-80v-160h-80v240h160v160ZM320-240q-33 0-56.5-23.5T240-320v-480q0-33 23.5-56.5T320-880h480q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H320Zm0-80h480v-480H320v480ZM160-80q-33 0-56.5-23.5T80-160v-560h80v560h560v80H160Zm160-720v480-480Z"/></svg>
|
||||
|
Before Width: | Height: | Size: 388 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#000000"><path d="M440-360h160q33 0 56.5-23.5T680-440v-80q0-33-23.5-56.5T600-600h-80v-80h160v-80H440v240h160v80H440v80ZM320-240q-33 0-56.5-23.5T240-320v-480q0-33 23.5-56.5T320-880h480q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H320Zm0-80h480v-480H320v480ZM160-80q-33 0-56.5-23.5T80-160v-560h80v560h560v80H160Zm160-720v480-480Z"/></svg>
|
||||
|
Before Width: | Height: | Size: 439 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#000000"><path d="M520-360h80q33 0 56.5-23.5T680-440v-80q0-33-23.5-56.5T600-600h-80v-80h120v-80H520q-33 0-56.5 23.5T440-680v240q0 33 23.5 56.5T520-360Zm0-160h80v80h-80v-80ZM320-240q-33 0-56.5-23.5T240-320v-480q0-33 23.5-56.5T320-880h480q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H320Zm0-80h480v-480H320v480ZM160-80q-33 0-56.5-23.5T80-160v-560h80v560h560v80H160Zm160-720v480-480Z"/></svg>
|
||||
|
Before Width: | Height: | Size: 492 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#000000"><path d="M440-360h80l160-320v-80H440v80h160L440-360ZM320-240q-33 0-56.5-23.5T240-320v-480q0-33 23.5-56.5T320-880h480q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H320Zm0-80h480v-480H320v480ZM160-80q-33 0-56.5-23.5T80-160v-560h80v560h560v80H160Zm160-720v480-480Z"/></svg>
|
||||
|
Before Width: | Height: | Size: 381 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#000000"><path d="M520-360h80q33 0 56.5-23.5T680-440v-60q0-26-17-43t-43-17q26 0 43-17t17-43v-60q0-33-23.5-56.5T600-760h-80q-33 0-56.5 23.5T440-680v60q0 26 17 43t43 17q-26 0-43 17t-17 43v60q0 33 23.5 56.5T520-360Zm0-320h80v80h-80v-80Zm0 240v-80h80v80h-80ZM320-240q-33 0-56.5-23.5T240-320v-480q0-33 23.5-56.5T320-880h480q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H320Zm0-80h480v-480H320v480ZM160-80q-33 0-56.5-23.5T80-160v-560h80v560h560v80H160Zm160-720v480-480Z"/></svg>
|
||||
|
Before Width: | Height: | Size: 574 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#000000"><path d="M480-360h120q33 0 56.5-23.5T680-440v-240q0-33-23.5-56.5T600-760h-80q-33 0-56.5 23.5T440-680v80q0 33 23.5 56.5T520-520h80v80H480v80Zm120-240h-80v-80h80v80ZM320-240q-33 0-56.5-23.5T240-320v-480q0-33 23.5-56.5T320-880h480q33 0 56.5 23.5T880-800v480q0 33-23.5 56.5T800-240H320Zm0-80h480v-480H320v480ZM160-80q-33 0-56.5-23.5T80-160v-560h80v560h560v80H160Zm160-720v480-480Z"/></svg>
|
||||
|
Before Width: | Height: | Size: 492 B |
@@ -1,14 +0,0 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>filter_1.svg</file>
|
||||
<file>filter_2.svg</file>
|
||||
<file>filter_3.svg</file>
|
||||
<file>filter_4.svg</file>
|
||||
<file>filter_5.svg</file>
|
||||
<file>filter_6.svg</file>
|
||||
<file>filter_7.svg</file>
|
||||
<file>filter_8.svg</file>
|
||||
<file>filter_9.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#000000"><path d="M120-120v-520l520-200v360h40q0-33 23.5-56.5T760-560q33 0 56.5 23.5T840-480v360H120Zm80-80h160v-280h200v-244L200-585v385Zm240 0h120v-120h80v120h120v-200H440v200ZM280-560Zm320 360Zm0-20Z"/></svg>
|
||||
|
Before Width: | Height: | Size: 309 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#000000"><path d="m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"/></svg>
|
||||
|
Before Width: | Height: | Size: 222 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#000000"><path d="M478-240q21 0 35.5-14.5T528-290q0-21-14.5-35.5T478-340q-21 0-35.5 14.5T428-290q0 21 14.5 35.5T478-240Zm-36-154h74q0-33 7.5-52t42.5-52q26-26 41-49.5t15-56.5q0-56-41-86t-97-30q-57 0-92.5 30T342-618l66 26q5-18 22.5-39t53.5-21q32 0 48 17.5t16 38.5q0 20-12 37.5T506-526q-44 39-54 59t-10 73Zm38 314q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z"/></svg>
|
||||
|
Before Width: | Height: | Size: 695 B |
@@ -1,19 +0,0 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>app.svg</file>
|
||||
<file>zui_da_hua2.svg</file>
|
||||
<file>help.svg</file>
|
||||
<file>save.svg</file>
|
||||
<file>settings.svg</file>
|
||||
<file>toggle_off.svg</file>
|
||||
<file>toggle_on.svg</file>
|
||||
|
||||
<!-- asd-->
|
||||
|
||||
<file>guan_bi.svg</file>
|
||||
<file>zui_da_hua.svg</file>
|
||||
<file>zui_da_hua_back.svg</file>
|
||||
<file>zui_xiao_hua.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#000000"><path d="M840-680v480q0 33-23.5 56.5T760-120H200q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h480l160 160Zm-80 34L646-760H200v560h560v-446ZM480-240q50 0 85-35t35-85q0-50-35-85t-85-35q-50 0-85 35t-35 85q0 50 35 85t85 35ZM240-560h360v-160H240v160Zm-40-86v446-560 114Z"/></svg>
|
||||
|
Before Width: | Height: | Size: 388 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#000000"><path d="m370-80-16-128q-13-5-24.5-12T307-235l-119 50L78-375l103-78q-1-7-1-13.5v-27q0-6.5 1-13.5L78-585l110-190 119 50q11-8 23-15t24-12l16-128h220l16 128q13 5 24.5 12t22.5 15l119-50 110 190-103 78q1 7 1 13.5v27q0 6.5-2 13.5l103 78-110 190-118-50q-11 8-23 15t-24 12L590-80H370Zm70-80h79l14-106q31-8 57.5-23.5T639-327l99 41 39-68-86-65q5-14 7-29.5t2-31.5q0-16-2-31.5t-7-29.5l86-65-39-68-99 42q-22-23-48.5-38.5T533-694l-13-106h-79l-14 106q-31 8-57.5 23.5T321-633l-99-41-39 68 86 64q-5 15-7 30t-2 32q0 16 2 31t7 30l-86 65 39 68 99-42q22 23 48.5 38.5T427-266l13 106Zm42-180q58 0 99-41t41-99q0-58-41-99t-99-41q-59 0-99.5 41T342-480q0 58 40.5 99t99.5 41Zm-2-140Z"/></svg>
|
||||
|
Before Width: | Height: | Size: 771 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#000000"><path d="M280-240q-100 0-170-70T40-480q0-100 70-170t170-70h400q100 0 170 70t70 170q0 100-70 170t-170 70H280Zm0-80h400q66 0 113-47t47-113q0-66-47-113t-113-47H280q-66 0-113 47t-47 113q0 66 47 113t113 47Zm0-40q50 0 85-35t35-85q0-50-35-85t-85-35q-50 0-85 35t-35 85q0 50 35 85t85 35Zm200-120Z"/></svg>
|
||||
|
Before Width: | Height: | Size: 403 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#000000"><path d="M280-240q-100 0-170-70T40-480q0-100 70-170t170-70h400q100 0 170 70t70 170q0 100-70 170t-170 70H280Zm0-80h400q66 0 113-47t47-113q0-66-47-113t-113-47H280q-66 0-113 47t-47 113q0 66 47 113t113 47Zm400-40q50 0 85-35t35-85q0-50-35-85t-85-35q-50 0-85 35t-35 85q0 50 35 85t85 35ZM480-480Z"/></svg>
|
||||
|
Before Width: | Height: | Size: 405 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#000000"><path d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Z"/></svg>
|
||||
|
Before Width: | Height: | Size: 267 B |
@@ -1,3 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#000000">
|
||||
<path d="M200-120q-33 0-56.5-23.5T120-200v-160h80v160h160v80H200Zm400 0v-80h160v-160h80v160q0 33-23.5 56.5T760-120H600ZM120-600v-160q0-33 23.5-56.5T200-840h160v80H200v160h-80Zm640 0v-160H600v-80h160q33 0 56.5 23.5T840-760v160h-80Z"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 352 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#000000"><path d="M240-400v80h-80q-33 0-56.5-23.5T80-400v-400q0-33 23.5-56.5T160-880h400q33 0 56.5 23.5T640-800v80h-80v-80H160v400h80ZM400-80q-33 0-56.5-23.5T320-160v-400q0-33 23.5-56.5T400-640h400q33 0 56.5 23.5T880-560v400q0 33-23.5 56.5T800-80H400Zm0-80h400v-400H400v400Zm200-200Z"/></svg>
|
||||
|
Before Width: | Height: | Size: 390 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#000000"><path d="M200-440v-80h560v80H200Z"/></svg>
|
||||
|
Before Width: | Height: | Size: 149 B |
@@ -1,129 +0,0 @@
|
||||
#ifndef CUSTOMMODEL_H
|
||||
#define CUSTOMMODEL_H
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
#include <QVector>
|
||||
#include <QString>
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QTableView>
|
||||
#include <QMainWindow>
|
||||
#include <QApplication>
|
||||
#include <QHeaderView>
|
||||
#include <QPainter>
|
||||
|
||||
|
||||
|
||||
class CustomModel : public QAbstractTableModel {
|
||||
public:
|
||||
explicit CustomModel(QObject *parent = nullptr);
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
private:
|
||||
QVector<QVector<QString>> tableData;
|
||||
};
|
||||
|
||||
class CustomTableDelegate : public QStyledItemDelegate {
|
||||
public:
|
||||
explicit CustomTableDelegate(QObject *parent = nullptr);
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
};
|
||||
|
||||
|
||||
class CustomTableView : public QTableView {
|
||||
public:
|
||||
explicit CustomTableView(QWidget *parent = nullptr);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // CUSTOMMODEL_H
|
||||
|
||||
|
||||
CustomModel::CustomModel(QObject *parent)
|
||||
: QAbstractTableModel(parent) {
|
||||
tableData = {
|
||||
{"Item 1-1", "Item 1-2", "Item 1-3"},
|
||||
{"Item 2-1", "Item 2-2", "Item 2-3"},
|
||||
{"Item 3-1", "Item 3-2", "Item 3-3"}
|
||||
};
|
||||
}
|
||||
|
||||
int CustomModel::rowCount(const QModelIndex &) const {
|
||||
return tableData.size();
|
||||
}
|
||||
|
||||
int CustomModel::columnCount(const QModelIndex &) const {
|
||||
return tableData.isEmpty() ? 0 : tableData[0].size();
|
||||
}
|
||||
|
||||
QVariant CustomModel::data(const QModelIndex &index, int role) const {
|
||||
if (!index.isValid())
|
||||
return QVariant();
|
||||
|
||||
if (role == Qt::DisplayRole || role == Qt::EditRole) {
|
||||
return tableData[index.row()][index.column()];
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
bool CustomModel::setData(const QModelIndex &index, const QVariant &value, int role) {
|
||||
if (index.isValid() && role == Qt::EditRole) {
|
||||
tableData[index.row()][index.column()] = value.toString();
|
||||
emit dataChanged(index, index);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Qt::ItemFlags CustomModel::flags(const QModelIndex &index) const {
|
||||
if (!index.isValid())
|
||||
return Qt::NoItemFlags;
|
||||
|
||||
return Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled;
|
||||
}
|
||||
CustomTableDelegate::CustomTableDelegate(QObject *parent) : QStyledItemDelegate(parent) {}
|
||||
|
||||
void CustomTableDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const {
|
||||
painter->save();
|
||||
|
||||
if (index.row() % 2 == 0) {
|
||||
painter->fillRect(option.rect, QColor(220, 220, 220));
|
||||
} else {
|
||||
painter->fillRect(option.rect, Qt::white);
|
||||
}
|
||||
|
||||
painter->drawText(option.rect, Qt::AlignCenter, index.data().toString());
|
||||
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
CustomTableView::CustomTableView(QWidget *parent) : QTableView(parent) {
|
||||
setAlternatingRowColors(true);
|
||||
setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
QApplication app(argc, argv);
|
||||
|
||||
auto *tableView = new CustomTableView;
|
||||
auto *model = new CustomModel(tableView);
|
||||
auto *delegate = new CustomTableDelegate(tableView);
|
||||
|
||||
tableView->setModel(model);
|
||||
tableView->setItemDelegate(delegate);
|
||||
|
||||
tableView->show();
|
||||
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
@@ -1,240 +0,0 @@
|
||||
#include <QApplication>
|
||||
#include <QWidget>
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include <QTextCodec>
|
||||
#include <Windows.h>
|
||||
#endif
|
||||
#include <QStyle>
|
||||
#include <QWidget>
|
||||
#include <QtWidgets>
|
||||
#include "GenerateMockData.h"
|
||||
#include "base/Graphic.h"
|
||||
#include "base/Plot.h"
|
||||
#include "component/Table/Table_View.h"
|
||||
#include "component/Tree/Tree_View.h"
|
||||
#include "component/simple_widget.h"
|
||||
#include "plottable/Afterglow.h"
|
||||
#include "plottable/Planisphere.h"
|
||||
#include "plottable/Planisphere_p.h"
|
||||
#include "plottable/Spectrum.h"
|
||||
#include "plottable/Spectrum_p.h"
|
||||
#include "plottable/WaterFall.h"
|
||||
#include "plottable/WaterFall_p.h"
|
||||
#include "DemoGallery/AfterglowPlot.h"
|
||||
#include "DemoGallery/DemoGallery.h"
|
||||
#include "DemoGallery/PlanispherePlot.h"
|
||||
#include "DemoGallery/SpectrumPlot.h"
|
||||
#include "DemoGallery/WaterFallPlot.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QTreeWidget>
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QVBoxLayout>
|
||||
#include <QWidget>
|
||||
|
||||
|
||||
struct TreeNode {
|
||||
QStringList data; // 节点数据,每个字段一个字符串
|
||||
QList<TreeNode*> children; // 子节点列表
|
||||
TreeNode* parent; // 父节点指针
|
||||
|
||||
TreeNode(const QStringList& data, TreeNode* parent = nullptr)
|
||||
: data(data), parent(parent) {}
|
||||
~TreeNode() {
|
||||
qDeleteAll(children);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class TreeModel : public QAbstractItemModel {
|
||||
public:
|
||||
TreeModel(const QStringList& headers, QObject* parent = nullptr)
|
||||
: QAbstractItemModel(parent), headers(headers) {
|
||||
rootItem = new TreeNode(headers);
|
||||
}
|
||||
|
||||
~TreeModel() {
|
||||
delete rootItem;
|
||||
}
|
||||
|
||||
// 必要的虚函数实现
|
||||
int rowCount(const QModelIndex& parent = QModelIndex()) const override {
|
||||
TreeNode* parentNode = nodeFromIndex(parent);
|
||||
return parentNode->children.count();
|
||||
}
|
||||
|
||||
int columnCount(const QModelIndex& parent = QModelIndex()) const override {
|
||||
return headers.count();
|
||||
}
|
||||
|
||||
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override {
|
||||
if (!index.isValid() || role != Qt::DisplayRole)
|
||||
return QVariant();
|
||||
|
||||
TreeNode* item = nodeFromIndex(index);
|
||||
return item->data.value(index.column());
|
||||
}
|
||||
|
||||
QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override {
|
||||
if (!hasIndex(row, column, parent))
|
||||
return QModelIndex();
|
||||
|
||||
TreeNode* parentNode = nodeFromIndex(parent);
|
||||
TreeNode* childItem = parentNode->children.value(row);
|
||||
if (childItem)
|
||||
return createIndex(row, column, childItem);
|
||||
else
|
||||
return QModelIndex();
|
||||
}
|
||||
|
||||
QModelIndex parent(const QModelIndex& index) const override {
|
||||
if (!index.isValid())
|
||||
return QModelIndex();
|
||||
|
||||
TreeNode* childItem = nodeFromIndex(index);
|
||||
TreeNode* parentItem = childItem->parent;
|
||||
|
||||
if (parentItem == rootItem || !parentItem)
|
||||
return QModelIndex();
|
||||
|
||||
int row = parentItem->parent->children.indexOf(parentItem);
|
||||
return createIndex(row, 0, parentItem);
|
||||
}
|
||||
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override {
|
||||
if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
|
||||
return headers.value(section);
|
||||
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
// 添加节点的函数
|
||||
void addNode(const QStringList& data, const QModelIndex& parent = QModelIndex()) {
|
||||
TreeNode* parentNode = nodeFromIndex(parent);
|
||||
beginInsertRows(parent, parentNode->children.count(), parentNode->children.count());
|
||||
TreeNode* newNode = new TreeNode(data, parentNode);
|
||||
parentNode->children.append(newNode);
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
private:
|
||||
TreeNode* rootItem;
|
||||
QStringList headers;
|
||||
|
||||
TreeNode* nodeFromIndex(const QModelIndex& index) const {
|
||||
if (index.isValid())
|
||||
return static_cast<TreeNode*>(index.internalPointer());
|
||||
else
|
||||
return rootItem;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class TreeDelegate : public QStyledItemDelegate {
|
||||
public:
|
||||
TreeDelegate(QObject* parent = nullptr) : QStyledItemDelegate(parent) {}
|
||||
|
||||
QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option,
|
||||
const QModelIndex& index) const override {
|
||||
// 根据需要创建编辑器,例如 QLineEdit
|
||||
QLineEdit* editor = new QLineEdit(parent);
|
||||
return editor;
|
||||
}
|
||||
|
||||
void setEditorData(QWidget* editor, const QModelIndex& index) const override {
|
||||
QString value = index.model()->data(index, Qt::EditRole).toString();
|
||||
QLineEdit* lineEdit = static_cast<QLineEdit*>(editor);
|
||||
lineEdit->setText(value);
|
||||
}
|
||||
|
||||
void setModelData(QWidget* editor, QAbstractItemModel* model,
|
||||
const QModelIndex& index) const override {
|
||||
QLineEdit* lineEdit = static_cast<QLineEdit*>(editor);
|
||||
model->setData(index, lineEdit->text(), Qt::EditRole);
|
||||
}
|
||||
|
||||
void updateEditorGeometry(QWidget* editor, const QStyleOptionViewItem& option,
|
||||
const QModelIndex& index) const override {
|
||||
editor->setGeometry(option.rect);
|
||||
}
|
||||
};
|
||||
|
||||
class TreeView : public QTreeView{
|
||||
public:
|
||||
};
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
QApplication app(argc, argv);
|
||||
// 定义表头
|
||||
QStringList headers = {"字段1", "字段2", "字段3"};
|
||||
// 创建模型并设置表头
|
||||
TreeModel* model = new TreeModel(headers);
|
||||
// 添加层次化数据
|
||||
QStringList parentData = {"父节点1", "数据2", "数据3"};
|
||||
model->addNode(parentData);
|
||||
QModelIndex parentIndex = model->index(0, 0);
|
||||
QStringList childData = {"子节点1", "数据2", "数据3"};
|
||||
model->addNode(childData, parentIndex);
|
||||
|
||||
// 创建视图并设置模型
|
||||
TreeView* treeView = new TreeView;
|
||||
treeView->setModel(model);
|
||||
|
||||
// 设置自定义委托
|
||||
TreeDelegate* delegate = new TreeDelegate;
|
||||
treeView->setItemDelegate(delegate);
|
||||
|
||||
// 展开所有节点
|
||||
treeView->expandAll();
|
||||
|
||||
// 显示窗口
|
||||
QMainWindow mainWindow;
|
||||
mainWindow.setCentralWidget(treeView);
|
||||
mainWindow.resize(600, 400);
|
||||
|
||||
|
||||
mainWindow.show();
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
|
||||
int main2(int argc, char *argv[]) {
|
||||
QApplication app(argc, argv);
|
||||
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
|
||||
#ifdef _WINDOWS
|
||||
SetConsoleOutputCP(CP_UTF8);
|
||||
system("chcp 65001");
|
||||
//setbuf(stdout, 0);
|
||||
#endif
|
||||
QElapsedTimer timer;
|
||||
timer.start();
|
||||
// DemoGallery w;
|
||||
// w.resize(1000, 600);
|
||||
// w.show();
|
||||
|
||||
// YSG::Graphic g;
|
||||
// g.resize(1000, 600);
|
||||
// g.show();
|
||||
|
||||
// auto it = new YSG::SelectColorDialog();
|
||||
// it->resize(1000, 600);
|
||||
// it->show();
|
||||
|
||||
Tree_View w;
|
||||
w.resize(400, 400);
|
||||
w.show();
|
||||
|
||||
|
||||
|
||||
YSG::startAllRenderThread();
|
||||
qDebug() << "启动耗时 " << timer.elapsed();
|
||||
|
||||
|
||||
|
||||
//f();
|
||||
|
||||
|
||||
return QApplication::exec();
|
||||
}
|
||||
@@ -18,30 +18,33 @@ static double max = 160;
|
||||
QWidget* IntermediateFrequencyWidget::createSpectrogramPowerPlot() {
|
||||
class SpectrumPlot : public YSG::Plot {
|
||||
public:
|
||||
YSG::Frequent_Axis* xAxis{};
|
||||
YSG::Axis* yAxis{};
|
||||
YSG::Muti_Select_Rect* msr{};
|
||||
YSG::Spectrum* sp{};
|
||||
std::shared_ptr<YSG::Frequent_Axis> xAxis{};
|
||||
std::shared_ptr<YSG::Axis> yAxis{};
|
||||
std::shared_ptr<YSG::Muti_Select_Rect> msr{};
|
||||
std::shared_ptr<YSG::Spectrum> sp{};
|
||||
QMenu* mMenu{};
|
||||
void init() override {
|
||||
Plot::init();
|
||||
object_name = "SpectrumPlot";
|
||||
xAxis = YSG::Frequent_Axis::Builder(this, Qt::Horizontal)
|
||||
auto data = create_renderable_node(root_renderable(), "DataRenderable");
|
||||
auto axis = create_renderable_node(root_renderable(), "AxisRenderable");
|
||||
auto overlay = create_renderable_node(root_renderable(), "OverlayRenderable");
|
||||
xAxis = YSG::Frequent_Axis::Builder(axis, Qt::Horizontal)
|
||||
.set_tick_length(-10)
|
||||
.set_coord_range(frequent_range)
|
||||
.set_tick_length(-10)
|
||||
.set_sub_tick_length(-5)
|
||||
.build();
|
||||
yAxis = YSG::Axis::Builder(this, Qt::Vertical)
|
||||
yAxis = YSG::Axis::Builder(axis, Qt::Vertical)
|
||||
.set_coord_range({160, 0})
|
||||
.set_unit_text("功率")
|
||||
.build();
|
||||
sp = YSG::Spectrum::Builder(xAxis, yAxis)
|
||||
sp = YSG::Spectrum::Builder(data, xAxis, yAxis)
|
||||
.set_frequent_range(frequent_range)
|
||||
.set_use_sweep_frequent_rect(true)
|
||||
.set_frequent_point_size(1024)
|
||||
.build();
|
||||
msr = YSG::Muti_Select_Rect::Builder(xAxis, yAxis).build();
|
||||
msr = YSG::Muti_Select_Rect::Builder(overlay, xAxis, yAxis).build();
|
||||
}
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent* event) override {
|
||||
@@ -55,10 +58,10 @@ QWidget* IntermediateFrequencyWidget::createSpectrogramPowerPlot() {
|
||||
void contextMenuEvent(QContextMenuEvent* event) override {
|
||||
if (!mMenu) {
|
||||
auto ws =
|
||||
bw(cw(sp, -1), "频谱图") +
|
||||
bw(cw(xAxis), "频率x轴") +
|
||||
bw(cw(yAxis), "功率y轴") +
|
||||
bw(cw(msr), "多选框");
|
||||
bw(cw(sp.get(), -1), "频谱图") +
|
||||
bw(cw(xAxis.get()), "频率x轴") +
|
||||
bw(cw(yAxis.get()), "功率y轴") +
|
||||
bw(cw(msr.get()), "多选框");
|
||||
mMenu = createMenu(this, ws);
|
||||
}
|
||||
mMenu->exec(event->globalPos());
|
||||
@@ -77,30 +80,33 @@ QWidget* IntermediateFrequencyWidget::createSpectrogramPowerPlot() {
|
||||
QWidget* IntermediateFrequencyWidget::create_Afterglow_Plot() {
|
||||
class AfterglowPlot : public YSG::Plot {
|
||||
public:
|
||||
YSG::Frequent_Axis* xAxis{};
|
||||
YSG::Axis* yAxis{};
|
||||
YSG::Afterglow* ag{};
|
||||
YSG::Muti_Select_Rect* msr{};
|
||||
std::shared_ptr<YSG::Frequent_Axis> xAxis{};
|
||||
std::shared_ptr<YSG::Axis> yAxis{};
|
||||
std::shared_ptr<YSG::Afterglow> ag{};
|
||||
std::shared_ptr<YSG::Muti_Select_Rect> msr{};
|
||||
QMenu* mMenu{};
|
||||
void init() override {
|
||||
Plot::init();
|
||||
object_name = "AfterglowPlot";
|
||||
xAxis = YSG::Frequent_Axis::Builder(this, Qt::Horizontal)
|
||||
auto data = create_renderable_node(root_renderable(), "DataRenderable");
|
||||
auto axis = create_renderable_node(root_renderable(), "AxisRenderable");
|
||||
auto overlay = create_renderable_node(root_renderable(), "OverlayRenderable");
|
||||
xAxis = YSG::Frequent_Axis::Builder(axis, Qt::Horizontal)
|
||||
.set_coord_range(frequent_range)
|
||||
.set_tick_length(-10)
|
||||
.set_sub_tick_length(-5)
|
||||
.set_use_drag(true)
|
||||
.build();
|
||||
yAxis = YSG::Axis::Builder(this, Qt::Vertical)
|
||||
yAxis = YSG::Axis::Builder(axis, Qt::Vertical)
|
||||
.set_coord_range({160, 0})
|
||||
.set_use_drag(true)
|
||||
.build();
|
||||
ag = YSG::Afterglow::Builder(xAxis, yAxis)
|
||||
ag = YSG::Afterglow::Builder(data, xAxis, yAxis)
|
||||
.set_frequent_range(frequent_range)
|
||||
.set_power_range({0, 160})
|
||||
.set_frequent_point_size(1024)
|
||||
.build();
|
||||
msr = YSG::Muti_Select_Rect::Builder(xAxis, yAxis).build();
|
||||
msr = YSG::Muti_Select_Rect::Builder(overlay, xAxis, yAxis).build();
|
||||
}
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent* event) override {
|
||||
@@ -115,10 +121,10 @@ QWidget* IntermediateFrequencyWidget::create_Afterglow_Plot() {
|
||||
void contextMenuEvent(QContextMenuEvent* event) override {
|
||||
if (!mMenu) {
|
||||
auto ws =
|
||||
bw(cw(ag, -1), "余辉图") +
|
||||
bw(cw(xAxis), "频率轴") +
|
||||
bw(cw(yAxis), "功率概率轴") +
|
||||
bw(cw(msr), "多选框");
|
||||
bw(cw(ag.get(), -1), "余辉图") +
|
||||
bw(cw(xAxis.get()), "频率轴") +
|
||||
bw(cw(yAxis.get()), "功率概率轴") +
|
||||
bw(cw(msr.get()), "多选框");
|
||||
mMenu = createMenu(this, ws);
|
||||
}
|
||||
mMenu->exec(event->globalPos());
|
||||
@@ -256,7 +262,7 @@ void IntermediateFrequencyWidget::initMenu() {
|
||||
auto addInitFrequent = new ValueMenuButton("添加初始频率:%1", fontSize, [frequentStep,this](ValueMenuButton* that, bool add) {
|
||||
int newFrequent = (int)that->mValue + (add ? frequentStep->mValue : -frequentStep->mValue);
|
||||
that->setValue(newFrequent);
|
||||
}, mSpectrogramLine->frequent_range().lower);
|
||||
}, mSpectrogramLine->frequent_range().origin);
|
||||
auto btn1_1 = new ValueMenuButton("当前标记:%1", fontSize, [&, markFrequent](ValueMenuButton* that, bool add) {
|
||||
int index = ((int)that->mValue + (add ? 1 : -1)) % mSpectrogramLine->select_line_marker_size();
|
||||
that->setValue(index);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef IntermediateFrequencyWidget_H
|
||||
#define IntermediateFrequencyWidget_H
|
||||
#include "../BaseWidget.h"
|
||||
#include <memory>
|
||||
|
||||
class TextButton;
|
||||
class DoubleTextButton;
|
||||
@@ -17,8 +18,8 @@ public:
|
||||
QPushButton *m1, *m2, *m3, *m4, *m5, *m6;
|
||||
FrequentShower *mFrequentShower;
|
||||
ProgressBar *mProgressBar1, *mProgressBar2;
|
||||
YSG::Spectrum *mSpectrogramLine{};
|
||||
YSG::Afterglow *mAfterglow{};
|
||||
std::shared_ptr<YSG::Spectrum> mSpectrogramLine{};
|
||||
std::shared_ptr<YSG::Afterglow> mAfterglow{};
|
||||
QWidget* createSpectrogramPowerPlot();
|
||||
QWidget* create_Afterglow_Plot();
|
||||
void initMenu();
|
||||
|
||||
@@ -15,27 +15,30 @@ static YSG::Range frequent_range = {-12000, 12000};
|
||||
QWidget* RadioWidget::createSpectrogramPowerPlot() {
|
||||
class SpectrumPlot : public YSG::Plot {
|
||||
public:
|
||||
YSG::Frequent_Axis* xAxis{};
|
||||
YSG::Axis* yAxis{};
|
||||
YSG::Muti_Select_Rect* msr{};
|
||||
YSG::Spectrum* sp{};
|
||||
std::shared_ptr<YSG::Frequent_Axis> xAxis{};
|
||||
std::shared_ptr<YSG::Axis> yAxis{};
|
||||
std::shared_ptr<YSG::Muti_Select_Rect> msr{};
|
||||
std::shared_ptr<YSG::Spectrum> sp{};
|
||||
QMenu* mMenu{};
|
||||
void init() override {
|
||||
Plot::init();
|
||||
object_name = "SpectrumPlot";
|
||||
xAxis = YSG::Frequent_Axis::Builder(this, Qt::Horizontal)
|
||||
auto data = create_renderable_node(root_renderable(), "DataRenderable");
|
||||
auto axis = create_renderable_node(root_renderable(), "AxisRenderable");
|
||||
auto overlay = create_renderable_node(root_renderable(), "OverlayRenderable");
|
||||
xAxis = YSG::Frequent_Axis::Builder(axis, Qt::Horizontal)
|
||||
.set_coord_range(frequent_range)
|
||||
.set_tick_length(-10)
|
||||
.build();
|
||||
yAxis = YSG::Axis::Builder(this, Qt::Vertical)
|
||||
yAxis = YSG::Axis::Builder(axis, Qt::Vertical)
|
||||
.set_coord_range({max, 0})
|
||||
.set_unit_text("功率")
|
||||
.build();
|
||||
sp = YSG::Spectrum::Builder(xAxis, yAxis)
|
||||
sp = YSG::Spectrum::Builder(data, xAxis, yAxis)
|
||||
.set_frequent_range(frequent_range)
|
||||
.set_frequent_point_size(1024)
|
||||
.build();
|
||||
msr = YSG::Muti_Select_Rect::Builder(xAxis, yAxis).build();
|
||||
msr = YSG::Muti_Select_Rect::Builder(overlay, xAxis, yAxis).build();
|
||||
if (use_Performance_shower) set_use_performance_shower(true);
|
||||
}
|
||||
protected:
|
||||
@@ -50,10 +53,10 @@ QWidget* RadioWidget::createSpectrogramPowerPlot() {
|
||||
void contextMenuEvent(QContextMenuEvent* event) override {
|
||||
if (!mMenu) {
|
||||
auto ws =
|
||||
bw(cw(sp, -1), "频谱图") +
|
||||
bw(cw(xAxis), "频率x轴") +
|
||||
bw(cw(yAxis), "功率y轴") +
|
||||
bw(cw(msr), "多选框");
|
||||
bw(cw(sp.get(), -1), "频谱图") +
|
||||
bw(cw(xAxis.get()), "频率x轴") +
|
||||
bw(cw(yAxis.get()), "功率y轴") +
|
||||
bw(cw(msr.get()), "多选框");
|
||||
mMenu = createMenu(this, ws);
|
||||
}
|
||||
mMenu->exec(event->globalPos());
|
||||
@@ -72,29 +75,32 @@ QWidget* RadioWidget::createSpectrogramPowerPlot() {
|
||||
QWidget* RadioWidget::createWaterFallPlot() {
|
||||
class WaterFallPlot : public YSG::Plot {
|
||||
public:
|
||||
YSG::Frequent_Axis* xAxis{};
|
||||
YSG::Time_Axis* yAxis{};
|
||||
YSG::Muti_Select_Rect* msr{};
|
||||
YSG::Waterfall* wf{};
|
||||
std::shared_ptr<YSG::Frequent_Axis> xAxis{};
|
||||
std::shared_ptr<YSG::Time_Axis> yAxis{};
|
||||
std::shared_ptr<YSG::Muti_Select_Rect> msr{};
|
||||
std::shared_ptr<YSG::Waterfall> wf{};
|
||||
QMenu* mMenu{};
|
||||
void init() override {
|
||||
Plot::init();
|
||||
object_name = "WaterFallPlot";
|
||||
xAxis = YSG::Frequent_Axis::Builder(this, Qt::Horizontal)
|
||||
auto data = create_renderable_node(root_renderable(), "DataRenderable");
|
||||
auto axis = create_renderable_node(root_renderable(), "AxisRenderable");
|
||||
auto overlay = create_renderable_node(root_renderable(), "OverlayRenderable");
|
||||
xAxis = YSG::Frequent_Axis::Builder(axis, Qt::Horizontal)
|
||||
.set_tick_length(-10)
|
||||
.set_sub_tick_length(-5)
|
||||
.set_coord_range(frequent_range)
|
||||
.build();
|
||||
yAxis = YSG::Time_Axis::Builder(this, Qt::Vertical)
|
||||
yAxis = YSG::Time_Axis::Builder(axis, Qt::Vertical)
|
||||
.set_time_point_size(100)
|
||||
.build();
|
||||
wf = YSG::Waterfall::Builder(xAxis, yAxis)
|
||||
wf = YSG::Waterfall::Builder(data, xAxis, yAxis)
|
||||
.set_frequent_range(frequent_range)
|
||||
.set_frequent_point_size(1024)
|
||||
.set_power_range({0, max})
|
||||
// .set_time_point_size(100)
|
||||
.build();
|
||||
msr = YSG::Muti_Select_Rect::Builder(xAxis, yAxis).build();
|
||||
msr = YSG::Muti_Select_Rect::Builder(overlay, xAxis, yAxis).build();
|
||||
if (use_Performance_shower) set_use_performance_shower(true);
|
||||
}
|
||||
protected:
|
||||
@@ -109,10 +115,10 @@ QWidget* RadioWidget::createWaterFallPlot() {
|
||||
void contextMenuEvent(QContextMenuEvent* event) override {
|
||||
if (!mMenu) {
|
||||
auto ws =
|
||||
bw(cw(wf, -1), "瀑布图") +
|
||||
bw(cw(xAxis), "频率轴") +
|
||||
bw(cw(yAxis), "时间轴") +
|
||||
bw(cw(msr), "多选框");
|
||||
bw(cw(wf.get(), -1), "瀑布图") +
|
||||
bw(cw(xAxis.get()), "频率轴") +
|
||||
bw(cw(yAxis.get()), "时间轴") +
|
||||
bw(cw(msr.get()), "多选框");
|
||||
mMenu = createMenu(this, ws);
|
||||
}
|
||||
mMenu->exec(event->globalPos());
|
||||
@@ -126,27 +132,30 @@ QWidget* RadioWidget::createWaterFallPlot() {
|
||||
QWidget* RadioWidget::createAudioSpectrogramPlot() {
|
||||
class SpectrumPlot : public YSG::Plot {
|
||||
public:
|
||||
YSG::Frequent_Axis* xAxis{};
|
||||
YSG::Axis* yAxis{};
|
||||
YSG::Muti_Select_Rect* msr{};
|
||||
YSG::Spectrum* sp{};
|
||||
std::shared_ptr<YSG::Frequent_Axis> xAxis{};
|
||||
std::shared_ptr<YSG::Axis> yAxis{};
|
||||
std::shared_ptr<YSG::Muti_Select_Rect> msr{};
|
||||
std::shared_ptr<YSG::Spectrum> sp{};
|
||||
QMenu* mMenu{};
|
||||
void init() override {
|
||||
Plot::init();
|
||||
object_name = "SpectrumPlot";
|
||||
xAxis = YSG::Frequent_Axis::Builder(this, Qt::Horizontal)
|
||||
auto data = create_renderable_node(root_renderable(), "DataRenderable");
|
||||
auto axis = create_renderable_node(root_renderable(), "AxisRenderable");
|
||||
auto overlay = create_renderable_node(root_renderable(), "OverlayRenderable");
|
||||
xAxis = YSG::Frequent_Axis::Builder(axis, Qt::Horizontal)
|
||||
.set_coord_range({-12000, 12000})
|
||||
.set_tick_length(-10)
|
||||
.set_sub_tick_length(-5)
|
||||
.build();
|
||||
yAxis = YSG::Axis::Builder(this, Qt::Vertical)
|
||||
yAxis = YSG::Axis::Builder(axis, Qt::Vertical)
|
||||
.set_coord_range({12000, -12000})
|
||||
.set_unit_text("功率").build();
|
||||
sp = YSG::Spectrum::Builder(xAxis, yAxis)
|
||||
sp = YSG::Spectrum::Builder(data, xAxis, yAxis)
|
||||
.set_frequent_range({-12000, 12000})
|
||||
.set_frequent_point_size(512)
|
||||
.build();
|
||||
msr = YSG::Muti_Select_Rect::Builder(xAxis, yAxis).build();
|
||||
msr = YSG::Muti_Select_Rect::Builder(overlay, xAxis, yAxis).build();
|
||||
if (use_Performance_shower) set_use_performance_shower(true);
|
||||
}
|
||||
protected:
|
||||
@@ -161,10 +170,10 @@ QWidget* RadioWidget::createAudioSpectrogramPlot() {
|
||||
void contextMenuEvent(QContextMenuEvent* event) override {
|
||||
if (!mMenu) {
|
||||
auto ws =
|
||||
bw(cw(sp, -1), "频谱图") +
|
||||
bw(cw(xAxis), "频率x轴") +
|
||||
bw(cw(yAxis), "功率y轴") +
|
||||
bw(cw(msr), "多选框");
|
||||
bw(cw(sp.get(), -1), "频谱图") +
|
||||
bw(cw(xAxis.get()), "频率x轴") +
|
||||
bw(cw(yAxis.get()), "功率y轴") +
|
||||
bw(cw(msr.get()), "多选框");
|
||||
mMenu = createMenu(this, ws);
|
||||
}
|
||||
mMenu->exec(event->globalPos());
|
||||
@@ -178,24 +187,27 @@ QWidget* RadioWidget::createAudioSpectrogramPlot() {
|
||||
QWidget* RadioWidget::createTimePowerPlot() {
|
||||
class AudioPlot : public YSG::Plot {
|
||||
public:
|
||||
YSG::Time_Axis* xAxis{};
|
||||
YSG::Axis* yAxis{};
|
||||
YSG::Audio_Frequent* audio{};
|
||||
YSG::Muti_Select_Rect* msr{};
|
||||
std::shared_ptr<YSG::Time_Axis> xAxis{};
|
||||
std::shared_ptr<YSG::Axis> yAxis{};
|
||||
std::shared_ptr<YSG::Audio_Frequent> audio{};
|
||||
std::shared_ptr<YSG::Muti_Select_Rect> msr{};
|
||||
QMenu* mMenu{};
|
||||
void init() override {
|
||||
Plot::init();
|
||||
object_name = "AudioPlot";
|
||||
xAxis = YSG::Time_Axis::Builder(this, Qt::Horizontal)
|
||||
auto data = create_renderable_node(root_renderable(), "DataRenderable");
|
||||
auto axis = create_renderable_node(root_renderable(), "AxisRenderable");
|
||||
auto overlay = create_renderable_node(root_renderable(), "OverlayRenderable");
|
||||
xAxis = YSG::Time_Axis::Builder(axis, Qt::Horizontal)
|
||||
.set_tick_length(-10)
|
||||
.set_sub_tick_length(-5)
|
||||
.build();
|
||||
yAxis = YSG::Axis::Builder(this, Qt::Vertical)
|
||||
yAxis = YSG::Axis::Builder(axis, Qt::Vertical)
|
||||
.set_coord_range({12000, -12000})
|
||||
.build();
|
||||
audio = YSG::Audio_Frequent::Builder(xAxis, yAxis)
|
||||
audio = YSG::Audio_Frequent::Builder(data, xAxis, yAxis)
|
||||
.build();
|
||||
msr = YSG::Muti_Select_Rect::Builder(xAxis, yAxis).build();
|
||||
msr = YSG::Muti_Select_Rect::Builder(overlay, xAxis, yAxis).build();
|
||||
if (use_Performance_shower) set_use_performance_shower(true);
|
||||
}
|
||||
protected:
|
||||
@@ -211,10 +223,10 @@ QWidget* RadioWidget::createTimePowerPlot() {
|
||||
void contextMenuEvent(QContextMenuEvent* event) override {
|
||||
if (!mMenu) {
|
||||
auto ws =
|
||||
bw(cw(audio, -1), "音频图") +
|
||||
bw(cw(yAxis), "功率y轴") +
|
||||
bw(cw(xAxis), "时间轴") +
|
||||
bw(cw(msr), "多选框");
|
||||
bw(cw(audio.get(), -1), "音频图") +
|
||||
bw(cw(yAxis.get()), "功率y轴") +
|
||||
bw(cw(xAxis.get()), "时间轴") +
|
||||
bw(cw(msr.get()), "多选框");
|
||||
mMenu = createMenu(this, ws);
|
||||
}
|
||||
mMenu->exec(event->globalPos());
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef RadioWidget_H
|
||||
#define RadioWidget_H
|
||||
#include "../BaseWidget.h"
|
||||
#include <memory>
|
||||
|
||||
|
||||
class TextButton;
|
||||
@@ -25,10 +26,10 @@ public:
|
||||
QWidget* createAudioSpectrogramPlot();
|
||||
QWidget* createTimePowerPlot();
|
||||
QWidget* createWaterFallPlot();
|
||||
YSG::Spectrum *mSpectrogramLine{};
|
||||
YSG::Spectrum* mAudioSpectrogramPlot{};
|
||||
YSG::Audio_Frequent *mTimePower{};
|
||||
YSG::Waterfall *mWaterFall{};
|
||||
std::shared_ptr<YSG::Spectrum> mSpectrogramLine{};
|
||||
std::shared_ptr<YSG::Spectrum> mAudioSpectrogramPlot{};
|
||||
std::shared_ptr<YSG::Audio_Frequent> mTimePower{};
|
||||
std::shared_ptr<YSG::Waterfall> mWaterFall{};
|
||||
protected:
|
||||
void focusInEvent(QFocusEvent *event) override;
|
||||
void keyPressEvent(QKeyEvent *event) override;
|
||||
|
||||
@@ -14,26 +14,29 @@
|
||||
QWidget* SweepFrequencyWidget::createSpectrogramPowerPlot() {
|
||||
class SweepFrequentPlot : public YSG::Plot {
|
||||
public:
|
||||
YSG::Axis* xAxis{};
|
||||
YSG::Axis* yAxis{};
|
||||
YSG::Muti_Select_Rect* msr{};
|
||||
YSG::Sweep_Frequent* sf{};
|
||||
std::shared_ptr<YSG::Axis> xAxis{};
|
||||
std::shared_ptr<YSG::Axis> yAxis{};
|
||||
std::shared_ptr<YSG::Muti_Select_Rect> msr{};
|
||||
std::shared_ptr<YSG::Sweep_Frequent> sf{};
|
||||
QMenu* mMenu{};
|
||||
void init() override {
|
||||
Plot::init();
|
||||
object_name = "AxisTestPlot";
|
||||
xAxis = YSG::Axis::Builder(this, Qt::Horizontal)
|
||||
auto data = create_renderable_node(root_renderable(), "DataRenderable");
|
||||
auto axis = create_renderable_node(root_renderable(), "AxisRenderable");
|
||||
auto overlay = create_renderable_node(root_renderable(), "OverlayRenderable");
|
||||
xAxis = YSG::Axis::Builder(axis, Qt::Horizontal)
|
||||
.set_coord_range({0, 100})
|
||||
.set_tick_length(-10).build();
|
||||
yAxis = YSG::Axis::Builder(this, Qt::Vertical)
|
||||
yAxis = YSG::Axis::Builder(axis, Qt::Vertical)
|
||||
.set_coord_range({100, 0})
|
||||
.set_tick_length(-10).build();
|
||||
sf = YSG::Sweep_Frequent::Builder(xAxis, yAxis)
|
||||
sf = YSG::Sweep_Frequent::Builder(data, xAxis, yAxis)
|
||||
.set_block_num(200)
|
||||
.set_block_frequent_point_size(20)
|
||||
.set_frequent_range({0, 100})
|
||||
.build();
|
||||
msr = YSG::Muti_Select_Rect::Builder(xAxis, yAxis).build();
|
||||
msr = YSG::Muti_Select_Rect::Builder(overlay, xAxis, yAxis).build();
|
||||
}
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent* event) override {
|
||||
@@ -47,10 +50,10 @@ QWidget* SweepFrequencyWidget::createSpectrogramPowerPlot() {
|
||||
void contextMenuEvent(QContextMenuEvent* event) override {
|
||||
if (!mMenu) {
|
||||
auto ws =
|
||||
bw(cw(sf, -1), "扫频图") +
|
||||
bw(cw(xAxis), "x轴") +
|
||||
bw(cw(yAxis), "y轴") +
|
||||
bw(cw(msr), "多选框");
|
||||
bw(cw(sf.get(), -1), "扫频图") +
|
||||
bw(cw(xAxis.get()), "x轴") +
|
||||
bw(cw(yAxis.get()), "y轴") +
|
||||
bw(cw(msr.get()), "多选框");
|
||||
mMenu = createMenu(this, ws);
|
||||
}
|
||||
mMenu->exec(event->globalPos());
|
||||
@@ -131,11 +134,11 @@ void SweepFrequencyWidget::initMenu() {
|
||||
auto startFreq = new ValueMenuButton("起始频率:%1 Hz", fontSize, [&](ValueMenuButton* that, bool add) {
|
||||
that->setValue(that->mValue + (double)(add ? 1 : -1));
|
||||
}, -1);
|
||||
startFreq->setValue(mSweepFrequencyLine->frequent_range().lower);
|
||||
startFreq->setValue(mSweepFrequencyLine->frequent_range().origin);
|
||||
auto endFreq = new ValueMenuButton("终止频率:%1 Hz", fontSize, [&](ValueMenuButton* that, bool add) {
|
||||
that->setValue(that->mValue + (double)(add ? 1 : -1));
|
||||
}, -1);
|
||||
endFreq->setValue(mSweepFrequencyLine->frequent_range().upper);
|
||||
endFreq->setValue(mSweepFrequencyLine->frequent_range().target);
|
||||
auto btn3 = new MenuButton("设置频率", fontSize, [&, startFreq, endFreq]() {
|
||||
mSweepFrequencyLine->set_frequent_range({startFreq->mValue, endFreq->mValue});
|
||||
});
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef SweepFrequencyWidget_H
|
||||
#define SweepFrequencyWidget_H
|
||||
#include "../BaseWidget.h"
|
||||
#include <memory>
|
||||
class TextButton;
|
||||
class DoubleTextButton;
|
||||
class FrequentShower;
|
||||
@@ -22,7 +23,7 @@ public:
|
||||
FrequentShower *mSelectValueWidget;
|
||||
ProgressBar *mProgressBar1, *mProgressBar2;
|
||||
void initMenu();
|
||||
YSG::Sweep_Frequent *mSweepFrequencyLine{};
|
||||
std::shared_ptr<YSG::Sweep_Frequent> mSweepFrequencyLine{};
|
||||
QWidget* createSpectrogramPowerPlot();
|
||||
protected:
|
||||
void focusInEvent(QFocusEvent *event) override;
|
||||
|
||||