Qt 音乐播放器项目

news2025/7/14 6:38:48

具体代码见:https://gitee.com/Suinnnnnn/MusicPlayer

文章目录

  • 0. 预备
  • 1. 界面
    • 1.1 各部位长度
    • 1.2 ui文件
    • 1.3 窗口前置设置
    • 1.4 设置QSS
  • 2. 自定义控件
    • 2.1 按钮
    • 2.2 推荐页面
    • 2.3 CommonPage
    • 2.4 滑杆
  • 3. 音乐管理
  • 4. 歌词界面
    • 4.1 ui文件
    • 4.2 LrcPage.h文件
  • 5. 音乐播放控制 + 持久化控制

0. 预备

各个类的作用:

ButtonForm: 自定义了按钮,其包含了图片,文字和动画效果
CommonPage:自定义页面,被“我的”之后的三个页面使用
CommonPageItem:歌曲的每一行就是一个该类的对象,包括编号,歌曲名,专辑名,时间,是否喜欢
CommonSlider:音乐进度条使用,表明当前播放到哪里,支持seek功能
CustomPlaylist:简单实现了在Qt6中删除的QMediaPlaylist
LrcPage:歌词页面
Music:用户直接交互的页面
MusicInfo:保存歌曲信息的类
MusicList:组织MusicInfo的类
RecBoxItemRecommendBox中的一个个单元
RecommendBox:推荐界面的简单实现
VolumBox:音量控制条,支持seek功能

1. 界面

1.1 各部位长度

image-20250303202055668

1.2 ui文件

image-20250303202127812

image-20250303202311424

1.3 窗口前置设置

music.cpp如下

#include "music.h"
#include <QGraphicsDropShadowEffect>
#include <QMouseEvent>
#include "ui_music.h"

Music::Music(QWidget* parent)
    : QWidget(parent)
    , ui(new Ui::Music)
{
    ui->setupUi(this);
    initUI();
}

void Music::initUI()
{
    // 设置无边框
    this->setWindowFlag(Qt::FramelessWindowHint);
    // 设置窗体透明,不然看不到阴影效果
    this->setAttribute(Qt::WA_TranslucentBackground);
    // 添加阴影效果
    QGraphicsDropShadowEffect* shadowEffect = new QGraphicsDropShadowEffect(this);
    shadowEffect->setOffset(0, 0);           // 设置阴影距离
    shadowEffect->setColor(QColor(0, 0, 0)); // 设置阴影颜色
    shadowEffect->setBlurRadius(100);         // 设置阴影模糊半径
    this->setGraphicsEffect(shadowEffect);   // 给 QWidget设置阴影
}

void Music::mousePressEvent(QMouseEvent* event)
{
    // 如果按下左键,记录dragPos
    if (event->button() == Qt::LeftButton) {
        QPoint p1     = event->globalPosition().toPoint();
        QPoint p2     = geometry().topLeft();
        this->dragPos = p1 - p2;
        // qDebug() << dragPos;
        return;
    }
    // 其余事件让父类处理
    QWidget::mousePressEvent(event);
}

void Music::mouseMoveEvent(QMouseEvent* event)
{
    // 如果按下左键并移动,那么就让窗口移动
    if (event->buttons() == Qt::LeftButton) {
        QPoint p1 = event->globalPosition().toPoint();
        QPoint p2 = this->dragPos;
        this->move(p1 - p2);
        // qDebug() << "dragPos: " << p2 << "\nglobalPos: " << p1;
        return;
    }
    // 其余事件让父类处理
    QWidget::mouseMoveEvent(event);
}

Music::~Music()
{
    // qDebug() << "Music::~Music() called";
    delete ui;
}

void Music::on_close_btn_clicked()
{
    // 关闭窗口
    this->close();
}

1.4 设置QSS

widget.ui中删除部分空间的背景颜色,设置QSS。

2. 自定义控件

2.1 按钮

自定义一个ButtonForm,由几个QWidgetQLabel组成
image-20250307223547243

buttonform.h

#ifndef BUTTONFORM_H
#define BUTTONFORM_H

#include <QFrame>
#include <QPropertyAnimation>
namespace Ui
{
class ButtonForm;
}

class ButtonForm : public QFrame
{
    Q_OBJECT
public:
    explicit ButtonForm(QWidget* parent = nullptr);
    void set_id_and_icon_and_text(int id, const QString& icon, const QString& text);
    void clear_backgrond_color() const;
    int  get_page_id() const;
    void show_animation();
    void hide_animation();
    ~ButtonForm();
protected:
    void mousePressEvent(QMouseEvent* event);

private:
    void                set_animation_and_start(QPropertyAnimation* animation, int duration,
                                                QRect rect1, QRect rect2, QRect rect3, int loopCount);
    Ui::ButtonForm*     ui;
    int                 pageID;          // 当前页面的ID, 用于翻页
    QPropertyAnimation* line1_animation; // 动画
    QPropertyAnimation* line2_animation;
    QPropertyAnimation* line3_animation;
    QPropertyAnimation* line4_animation;
    QPropertyAnimation* line5_animation;
signals:
    void clicked(int pageID);
};

#endif // BUTTONFORM_H

接着将music.ui中的左侧QWidget替换为ButtonForm

运行结果如下,点击不同的按钮可以跳转到不同的QWidget,且按钮有动画效果

image-20250313214533199

2.2 推荐页面

music.ui中的recommend_page下添加一个QScrollArea类型的scrollArea,里面有三个QLabel和两个RecommendBox

image-20250313214119841

RecommendBox.ui如下

image-20250313214155057

RecommendBox.h

#ifndef RECOMMENDBOX_H
#define RECOMMENDBOX_H

#include <qjsonarray.h>
#include <QWidget>

namespace Ui
{
class RecommendBox;
}

class RecommendBox : public QWidget
{
    Q_OBJECT

public:
    explicit RecommendBox(QWidget* parent = nullptr);
    void init_rec_box(QJsonArray pics);
    void set_col_and_row(int row, int col);
    ~RecommendBox();

private slots:
    void on_left_btn_clicked();
    void on_right_btn_clicked();
private:
    void              add_rec_item();
    void              del_rec_item();
    Ui::RecommendBox* ui;
    int               row           = 2;
    int               column        = 5;
    int               current_group = 0; // 当前是第几组
    int               group_count;       // 一共有多少组
    QJsonArray        pics_path_and_text;
};

#endif // RECOMMENDBOX_H

RecBoxItem.ui如下

image-20250313214254346

RecBoxItem.h如下

#ifndef RECBOXITEM_H
#define RECBOXITEM_H

#include <QPropertyAnimation>
#include <QWidget>

namespace Ui
{
class RecBoxItem;
}

class RecBoxItem : public QWidget
{
    Q_OBJECT

public:
    explicit RecBoxItem(QWidget* parent = nullptr);
    bool eventFilter(QObject* watched, QEvent* event);
    void set_icon_and_text(const QString& icon, const QString& text);
    ~RecBoxItem();

private:
    Ui::RecBoxItem*                                                         ui;
    std::function<void(QPropertyAnimation*, int, QRect, QRect, QRect, int)> set_animation_and_start;
};

#endif // RECBOXITEM_H

运行结果如下,支持换页,而且选中图片会有动画效果

image-20250313214420275

2.3 CommonPage

由于需要上传文件,所以现在把之前的我的播客改为上传音乐

image-20250318201535927

CommonPage被播客, 我喜欢, 最近播放, 上传音乐所使用。
下面是CommonPage.ui

image-20250318201704598

下面是CommonPage.h(目前)

#ifndef COMMONPAGE_H
#define COMMONPAGE_H

#include <QFrame>

namespace Ui
{
class CommonPage;
}

class CommonPage : public QFrame
{
    Q_OBJECT

public:
    explicit CommonPage(QWidget* parent = nullptr);
    void init_my_like();
    void init_podcast();
    void init_recent_play();
    void init_upload_music();
    ~CommonPage();
private:
    void            set_podcast();
    void            reset_up_widget(const QString& title = "xxx");
    Ui::CommonPage* ui;
};

#endif // COMMONPAGE_H

CommonPage使用了CommonPageItem,下面是CommonPageItem.ui

image-20250318201815958

CommonPageItem.h如下

#ifndef COMMONPAGEITEM_H
#define COMMONPAGEITEM_H
#include <QFrame>

namespace Ui
{
class CommonPageItem;
}

class CommonPageItem : public QFrame
{
    Q_OBJECT

public:
    explicit CommonPageItem(QWidget* parent = nullptr);
    const QRect& get_page_item_geometry() const;
    void         set_num(int num);
    void         enterEvent(QEnterEvent* event);
    void         leaveEvent(QEvent* event);
    void         mouseDoubleClickEvent(QMouseEvent* event);
    ~CommonPageItem();

private:
    void                set_background_color(const QString& color);
    bool                is_played() const;
    int                 play_num = -1;
    Ui::CommonPageItem* ui;
};

#endif // COMMONPAGEITEM_H

2.4 滑杆

CommonSlider.ui,音乐进度条使用

image-20250318202343565

CommonSlider.h

#ifndef COMMONSLIDER_H
#define COMMONSLIDER_H

#include <QFrame>

namespace Ui
{
class CommonSlider;
}


/* 愿意是想让进度条和音量条都用该类,后来发现不如再写一个类。此类仅用于进度条 */
class CommonSlider : public QFrame
{
    Q_OBJECT

public:
    explicit CommonSlider(QWidget* parent = nullptr);
    void init_progress_bar();
    void init_volume_btn();
    ~CommonSlider();

private:
    Ui::CommonSlider* ui;
};

#endif // COMMONSLIDER_H

VolumeBox.ui,音量按钮使用

image-20250318202432773

VolumeBox.h

#ifndef VOLUMEBOX_H
#define VOLUMEBOX_H

#include <QFrame>

namespace Ui
{
class VolumeBox;
}

class VolumeBox : public QFrame
{
    Q_OBJECT

public:
    explicit VolumeBox(QWidget* parent = nullptr);
    ~VolumeBox();
private:
    Ui::VolumeBox* ui;
};

#endif // VOLUMEBOX_H

music.cpp中给音量按钮添加事件过滤器

bool Music::eventFilter(QObject* obj, QEvent* event)
{
    if (obj == ui->play_volume_btn || obj == volume_box) {
        if (event->type() == QEvent::Enter) {
            // 鼠标进入时显示 volume_box
            QPoint btnPos    = ui->play_volume_btn->mapToGlobal(QPoint(0, 0)); // 获取全局坐标
            QPoint targetPos = btnPos - QPoint(10, volume_box->height());      // 按钮上方
            volume_box->move(targetPos);
            volume_box->show();
        } else if (event->type() == QEvent::Leave) {
            // 鼠标离开时隐藏 VolumeBox (如果超过了300ms)
            hide_timer->start(300);
        }
    }
    return QWidget::eventFilter(obj, event);
}

3. 音乐管理

设置此按钮的槽函数

image-20250318202730525

点击后需要添加我们选中的文件,使用QFileDialog。使用MusicInfo类保存所有音乐的信息。使用MusicList类来管理这些Music

MusicInfo.h,储存音乐信息

#ifndef MUSICINFO_H
#define MUSICINFO_H

#include <QString>
#include <QUrl>
#include <QUuid>

class MusicInfo
{
public:
    MusicInfo(const QUrl& url);
    // 禁止拷贝(根据需要实现移动语义)
    MusicInfo(const MusicInfo&)            = delete;
    MusicInfo& operator=(const MusicInfo&) = delete;
    /* 必须声明移动构造函数,作用如下
     * 1. 明确告知编译器生成移动构造函数
     * 2. 允许容器使用移动语义操作对象
     * 3. 保留类的不可拷贝特性
     * */
    MusicInfo(MusicInfo&&)            = default;
    MusicInfo& operator=(MusicInfo&&) = default;
    bool       is_valid();
    void       parse_metadata();
    QUuid      getUuid() const;

    bool    getIs_like() const;
    void    setIs_like(bool newIs_like);
    bool    getIs_recent_play() const;
    void    setIs_recent_play(bool newIs_recent_play);
    bool    getIs_valid_flag() const;
    void    setIs_valid_flag(bool newIs_valid_flag);
    QString getMusic_name() const;
    QString getAlbum_name() const;
    qint64  getMusic_time() const;

private:
    void    check_valid();
    QUuid   uuid;                   // uuid, 防止重复
    QUrl    url;                    // 歌曲的URL
    QString music_name;             // 音乐名称
    QString album_name;             // 专辑名称
    qint64  music_time;             // 音乐持续时间(ms)
    bool    is_like        = false; // 是否喜欢
    bool    is_recent_play = false; // 是否是最近播放
    bool    is_valid_flag  = false; // 是否是音频文件
};

#endif                              // MUSICINFO_H

MusicList.h,管理一个个MusicInfo

#ifndef MUSICINFO_H
#define MUSICINFO_H

#include <QString>
#include <QUrl>
#include <QUuid>

class MusicInfo
{
public:
    MusicInfo(const QUrl& url);
    // 禁止拷贝(根据需要实现移动语义)
    MusicInfo(const MusicInfo&)            = delete;
    MusicInfo& operator=(const MusicInfo&) = delete;
    /* 必须声明移动构造函数,作用如下
     * 1. 明确告知编译器生成移动构造函数
     * 2. 允许容器使用移动语义操作对象
     * 3. 保留类的不可拷贝特性
     * */
    MusicInfo(MusicInfo&&)            = default;
    MusicInfo& operator=(MusicInfo&&) = default;
    bool       is_valid();
    void       parse_metadata();
    QUuid      getUuid() const;

    bool    getIs_like() const;
    void    setIs_like(bool newIs_like);
    bool    getIs_recent_play() const;
    void    setIs_recent_play(bool newIs_recent_play);
    bool    getIs_valid_flag() const;
    void    setIs_valid_flag(bool newIs_valid_flag);
    QString getMusic_name() const;
    QString getAlbum_name() const;
    qint64  getMusic_time() const;

private:
    void    check_valid();
    QUuid   uuid;                   // uuid, 防止重复
    QUrl    url;                    // 歌曲的URL
    QString music_name;             // 音乐名称
    QString album_name;             // 专辑名称
    qint64  music_time;             // 音乐持续时间(ms)
    bool    is_like        = false; // 是否喜欢
    bool    is_recent_play = false; // 是否是最近播放
    bool    is_valid_flag  = false; // 是否是音频文件
};

#endif                              // MUSICINFO_H

Music.h中增加处理点击爱心按钮的槽函数

void handle_item_like_btn_clicked(bool is_like, const QUuid& uuid);

4. 歌词界面

解析.lrc文件

4.1 ui文件

image-20250406194553897

4.2 LrcPage.h文件

#ifndef LRCPAGE_H
#define LRCPAGE_H
#include <QFrame>
#include <QPropertyAnimation>

namespace Ui
{
class LrcPage;
}

// 歌词的一行
struct LyricLine {
    LyricLine(qint64 time_p, QString text_p)
        : time(time_p), text(text_p)
    {
    }
    qint64  time; // 时间(ms)
    QString text; // 歌词
};

class LrcPage : public QFrame
{
    Q_OBJECT

public:
    explicit LrcPage(QWidget* parent = nullptr);
    bool    parse_lrc_file(const QString& lrc_filename);
    void    push_line_to_lrc_vector(qint64 time, QString text);
    QString get_lrc_filename_by_url(const QUrl& url);
    void    set_ui_label(qint64 time);
    void    set_name_and_singer(const QString& music, const QString& singer);
    void    clear_lyric_lines();
    ~LrcPage();
private slots:
    void on_quit_clicked();
private:
    int                 get_lyric_lines_index_by_time(qint64 time);
    QString             get_lyric_lines_line_by_index(int index);
    Ui::LrcPage*        ui;
    QPropertyAnimation* lrc_animation; // 歌词界面隐藏动画
    QVector<LyricLine>  lyric_lines;   // 歌词的所有内容,由一行行的结构体组成
};

#endif                                 // LRCPAGE_H

5. 音乐播放控制 + 持久化控制

使用QMediaPlayer类,由于Qt6中删除了QPlayList类,所以我自定义了一个CustomPlayList

#ifndef CUSTOMPLAYLIST_H
#define CUSTOMPLAYLIST_H

#include <QList>
#include <QMediaPlayer>
#include <QObject>
#include <QRandomGenerator>
#include <QUrl>

class CustomPlaylist : public QObject
{
    Q_OBJECT

public:
    enum PlaybackMode {
        Sequential, // 顺序播放
        SingleLoop, // 单曲循环播放
        Random      // 随机播放
    };
    Q_ENUM(PlaybackMode)

    explicit CustomPlaylist(QMediaPlayer* player, QObject* parent = nullptr);

    // 基本操作
    void addMedia(const QUrl& url);
    void removeMedia(int index);
    void clear();
    void next();
    void previous();
    void setCurrentIndex(int index);

    // 获取信息
    int  currentIndex() const;
    QUrl currentMedia() const;
    int  mediaCount() const;

    // 播放模式
    PlaybackMode playbackMode() const;
    void         setPlaybackMode(PlaybackMode mode);

signals:
    void currentIndexChanged(int index);
    void mediaAdded(int index);
    void mediaRemoved(int index);
    void playbackModeChanged(PlaybackMode mode);

private slots:
    void handleMediaStatusChanged(QMediaPlayer::MediaStatus status);

private:
    QList<QUrl>   m_mediaList;         // 存储媒体项
    int           m_currentIndex = -1; // 当前播放索引
    PlaybackMode  m_playbackMode = Sequential;
    QMediaPlayer* m_player;            // 关联的 QMediaPlayer
    QList<int>    m_randomOrder;       // 随机播放顺序缓存

    void updateRandomOrder();          // 更新随机播放顺序
    int  getNextIndex() const;         // 根据模式获取下一个索引
    int  getPreviousIndex() const;     // 根据模式获取上一个索引
};
#endif                                 // CUSTOMPLAYLIST_H

使用QSQLITE数据库,用于持久化操作,下面是music.h文件

#ifndef MUSIC_H
#define MUSIC_H

#include <QAudioOutput>
#include <QJsonArray>
#include <QMediaPlayer>
#include <QPropertyAnimation>
#include <QSqlDatabase>
#include <QWidget>
#include "CommonPage.h"
#include "CustomPlaylist.h"
#include "LrcPage.h"
#include "VolumeBox.h"

QT_BEGIN_NAMESPACE
namespace Ui
{
class Music;
}
QT_END_NAMESPACE

class Music : public QWidget
{
    Q_OBJECT

public:
    Music(QWidget* parent = nullptr);
    void       initUI();
    void       initPlayer();
    void       initStaticToolTip();
    void       initSqlLite();
    void       initMusicList();
    void       connect_signals_and_slots();
    void       mousePressEvent(QMouseEvent* event);
    void       mouseMoveEvent(QMouseEvent* event);
    bool       eventFilter(QObject* obj, QEvent* event);
    void       play_music_from_index(CommonPage* page, int index);
    QJsonArray get_random_recommend_pic() const;
    ~Music();
private slots:
    // 形如on_xxx是ui文件生成的, 其余是自己写的
    void handle_button_form_clicked(int pageID);
    void handle_item_like_btn_clicked(bool is_like, const QUuid& uuid);
    void handle_upload_music();
    void handle_play_state_changed(QMediaPlayer::PlaybackState new_state);
    void handle_play_mode_changed(CustomPlaylist::PlaybackMode mode);
    void handle_play_all_music_btn_clicked(CommonPage* page);
    void handle_double_clicked_song(CommonPage* page, int index);
    void handle_current_index_changed(int new_index);
    void handle_volume_changed(int volume);
    void handle_duration_changed(qint64 duration);
    void handle_position_changed(qint64 duration);
    void handle_slider_pos_changed(double ratio);
    void handle_meta_data_changed();
    void on_close_btn_clicked();
    void on_stop_btn_clicked();
    void on_next_song_btn_clicked();
    void on_prev_song_btn_clicked();
    void on_play_mode_btn_clicked();
    void on_play_volume_btn_clicked();
    void on_my_like_btn_clicked();
    void on_lrc_btn_clicked();
    void on_music_pic_btn_clicked();
    void on_min_btn_clicked();
private:
    void                      hide_volume_box();
    static QString            transform_million_second(qint64 msecond);
    void                      set_like_btn_icon(bool is_like);
    MusicList::const_iterator get_now_play_music_info_by_index(int index);
    void                      quit_progress();
private:
    Ui::Music* ui;
    // 由于窗口没有了默认边框,所以要想移动,需要有该属性,其值为 全局的鼠标位置-widget左上位置
    QPoint              dragPos;
    VolumeBox*          volume_box;
    QTimer*             hide_timer;
    QMediaPlayer*       player;
    CustomPlaylist*     play_list;
    QAudioOutput*       audio_output;
    CommonPage*         play_page;       // 当前播放
    bool                is_mute = false; // 是否静音, false表示没被静音
    qint64              total_duration;  // 当前音乐的总时长
    LrcPage*            lrc_page;        // 歌词页面
    QPropertyAnimation* lrc_animation;   // 歌词界面显示动画
    QSqlDatabase        db;              // 数据库驱动
};
#endif                                   // MUSIC_H

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2330107.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

.NET用C#在PDF文档中添加、删除和替换图片

在当今数字化文档处理场景中&#xff0c;动态操作PDF文档中的图像已成为企业级应用开发的核心需求之一。通过C#在.NET平台实现图片的添加、替换和删除功能&#xff0c;不仅能显著提升PDF文档的视觉表现力与信息承载效率&#xff0c;更可满足数据动态更新、内容精准维护等复杂业…

anaconda安装使用+pytorch环境配置(cpu)+pycharm环境配置(详细教程)

一、anaconda下载 1.anaconda官网尝试下载&#xff1a; 官网网址&#xff1a;Anaconda | Built to Advance Open Source AI 1.进入官网 2.点击Products->Distribution&#xff0c;跳过注册进入下载页面 3.选择系统下载 2.清华镜像下载 1.网址&#xff1a;Index of /anac…

c++STL入门

目录 什么是STL&#xff1f; vector容器 构造函数 赋值操作 vector容量和大小 vector存放内置数据类型 vector存放自定义数据类型 存放指针 vector容器嵌套容器 string容器 构造函数 赋值操作 字符串拼接 查找和替换 string字符串比较 string字符存取 string插…

electron-update + nginx热更新

1.安装"electron-updater": “^6.6.2”, npm i electron-updater2.创建checkUpdate.js // 引入自动更新 const {autoUpdater} require(electron-updater); const { dialog } require(electron); // 自动更新检查 export function checkForUpdates() {// 检查新版…

前端知识点---本地存储(javascript)

localStorage 是浏览器提供的一个 本地存储 API&#xff0c;可以在用户的浏览器中存储数据&#xff0c;数据不会随页面刷新而丢失。 1. 基本用法 (1) 存储数据&#xff08;setItem&#xff09; localStorage.setItem("username", "zhangsan");存储 “use…

QML 批量创建模块 【Repeater】 组件详解

在 QML 中&#xff0c;Repeater 组件是一种非常实用的工具&#xff0c;能够批量创建控件&#xff0c;尤其是在我们需要根据数据动态生成多个相同类型的控件时。无论是列表、网格&#xff0c;还是动态生成按钮、标签等控件&#xff0c;Repeater 都能轻松胜任。 1. Repeater 组件…

【Python】Python 环境 + Pycharm 编译器 官网免费下载安装(图文教程,新手安装,Windows 10 系统)

目录 Python 环境的下载安装第一步 进入官网第二步 找到匹配 windows 系统的 python 下载页面第三步 根据电脑 cpu 架构选择 python 版本第四步 安装 python 环境第五步 验证 python 环境变量 Pycharm 的下载安装第一步 进入官网第二步 安装 Pycharm Community Edition第三步 第…

在 Elasticsearch 中使用 Amazon Nova 模型

作者&#xff1a;来自 Elastic Andre Luiz 了解如何在 Elasticsearch 中使用 Amazon Nova 系列模型。 在本文中&#xff0c;我们将讨论 Amazon 的 AI 模型家族——Amazon Nova&#xff0c;并学习如何将其与 Elasticsearch 结合使用。 关于 Amazon Nova Amazon Nova 是 Amazon …

sql server数据库可疑修复

sql server数据库可疑修复 从上图可以看到数据库nchrdb显示可疑&#xff0c;导致原因为NC系统在增加公共薪资项目的时候&#xff0c;扩展字段报错了&#xff0c;第一次遇到这种情况&#xff0c;折腾了很久终于解决&#xff0c;记下解决方案&#xff1a; 1&#xff0c;将SQL数据…

【项目管理-高项】学习方法 整体概览

相关文档&#xff0c;希望互相学习&#xff0c;共同进步 风123456789&#xff5e;-CSDN博客 1.背景 &#x1f4dd; 软考高项,全称 信息系统项目管理师 ,是软考高级资格项目之一。 本考试考三门科目&#xff1a;综合知识&#xff08;上午&#xff09;、案例分析&#xff08;下午…

【Linux网络与网络编程】05.应用层自定义协议序列化和反序列化

前言 本篇博客通过网络计算器的实现来帮助各位理解应用层自定义协议以及序列化和反序列化。 一、认识自定义协议&&序列化和反序列化 我们程序员写的一个个解决我们实际问题&#xff0c;满足我们日常需求的网络程序都是在应用层。前面我们说到&#xff1a;协议是一种…

Flutter之页面布局二

目录&#xff1a; 1、列表布局1.1、基础列表1.2、水平滑动的列表1.3、网格列表1.3、不同列表项的列表1.4、包含间隔的列表1.6、长列表 2、滚动2.1、浮动的顶栏2.2、平衡错位滚动 1、列表布局 1.1、基础列表 import package:flutter/material.dart;void main() > runApp(con…

RCE漏洞的小点总结

RCE简介与危害&#xff1a;包括远程代码执行和远程命令执行漏洞。 在很多web应用中&#xff0c;开发人员会使用一些函数&#xff0c;这些函数以一些字符串作为输入&#xff0c;功能是将输入的字符串当作代码或者命令来进行执行。当用户可以控制这些函数的输入时&#xff0c;就…

单片机实现多线程的方法汇总

在单片机上实现“多线程”的方法有几种&#xff0c;下面按照从简单到复杂、从轻量到系统性来列出常见的方案&#xff1a; &#x1f9f5; 一、伪多线程&#xff08;最轻量&#xff09; 方法&#xff1a;主循环 状态机 / 定时器轮询 主循环中轮流调用各个任务的处理函数&#x…

Java八股文-List集合

集合的底层是否加锁也就代表是否线程安全 (一)List集合 一、数组 array[1]是如何通过索引找到堆内存中对应的这块数据的呢? (1)数组如何获取其他元素的地址值 (2)为什么数组的索引是从0开始的&#xff0c;不可以从1开始吗 (3)操作数组的时间复杂度 ①查找 根据索引查询 未…

从零构建大语言模型全栈开发指南:第四部分:工程实践与部署-4.2.3行业案例:智能客服中的图文交互系统

👉 点击关注不迷路 👉 点击关注不迷路 👉 点击关注不迷路 文章大纲 从零构建大语言模型全栈开发指南-第四部分:工程实践与部署4.2.3 行业案例:智能客服中的图文交互系统1. 图文交互系统的核心挑战与价值2. 系统架构设计2.1 分层架构2.2 Adapter技术应用3. 行业应用案例…

华为IP(4)

VRRP&#xff08;虚拟路由冗余协议&#xff09; 前言&#xff1a; 局域网中的用户终端通常采用配置一个默认网关的形式访问外部网络&#xff0c;如果默认网关设备发生故障&#xff0c;那么所有用户终端访问外部网络的流量将会中断。可以通过部署多个网关的方式来解决单点故障…

计算机网络中科大 - 第1章 结构化笔记(详细解析)

博主主页 目录 **1. 计算机网络概述****1.1 计算机网络的定义****1.2 计算机网络的发展** **2. 计算机网络的组成与分类****2.1 计算机网络的组成****2.2 计算机网络的分类****按地理范围****按拓扑结构****按交换方式** **3. 计算机网络的性能指标****4. 计算机网络体系结构**…

【神经网络】python实现神经网络(三)——正向学习的模拟演练

有了之前的经验(【神经网络】python实现神经网络(二)——正向推理的模拟演练),我们继续来介绍如何正向训练神经网络中的超参(包含权重以及偏置),本章大致的流程图如下: 一.损失函数 神经网络以某个指标为基准寻求最优权重参数,而这个指标即可称之为 “损失函数” 。(…

PPTAgent:一款开源免费生成和评估幻灯片的项目

这篇文章介绍一下PPTAgent&#xff0c;一个从文档自动生成演示文稿的创新系统。该系统从人类的展示创作方法中汲取灵感&#xff0c;采用两步流程来确保卓越的整体质量。此外&#xff0c;本文还介绍了PPTEval&#xff0c;这是一个综合评估框架&#xff0c;可以跨多个维度评估演示…