七、文件与目录操作

news2024/11/16 1:21:59

一、文本文件读写

文件打开方式
QIODevice::ReadOnly	以只读方式打开
QIODevice::QriteOnly		以只写方式打开
QIODevice::ReadWrite	以读写方式打开
QIODevice::Append		新增加的内容将被追加到文件末尾
QIODevice::Truncate		以重写的方式打开,原有内容会被删除
QIODevice::Text				在读取时,行结束符转换为\n;在写时,将行结束符转换为本地格式,例如:Win32平台是\r\n

1、实现工具

(1)创建项目,基于QMainWindow

(2)添加图标资源文件与组件

在这里插入图片描述

(3)实现功能

#include "mainwindow.h"
#include "ui_mainwindow.h"

#include <QFileDialog>

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    setCentralWidget(ui->tabWidget);
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::on_actOpenIODevice_triggered()
{
    QString curPath = QCoreApplication::applicationDirPath();
    QString dlgTitle = "打开文件";
    QString filter = "程序(*.c *.cpp);;文本(*.txt);;所有文件(*.*)";
    QString strFileName = QFileDialog::getOpenFileName(this,
                          dlgTitle, curPath, filter);

    if(strFileName.isEmpty())
    {
        return;
    }

    QFile file(strFileName);

    if(file.open(QIODevice::ReadOnly | QIODevice::Text))
    {
        ui->plainTextEditIODevice->setPlainText(
            QString::fromLocal8Bit(file.readAll()));
        file.close();
        ui->tabWidget->setCurrentIndex(0);
    }
}

void MainWindow::on_actSaveIODevice_triggered()
{
    QString curPath = QCoreApplication::applicationDirPath();
    QString dlgTitle = "保存文件";
    QString filter = "程序(*.c *.cpp);;文本(*.txt);;所有文件(*.*)";
    QString strFileName = QFileDialog::getSaveFileName(this,
                          dlgTitle, curPath, filter);

    if(strFileName.isEmpty())
    {
        return;
    }

    QFile file(strFileName);

    if(file.open(QIODevice::WriteOnly | QIODevice::Text))
    {
        QString str = ui->plainTextEditIODevice->toPlainText();
        QByteArray btArray = str.toUtf8();
        file.write(btArray, btArray.size());
        file.close();
        ui->tabWidget->setCurrentIndex(0);
    }
}

#include <QTextStream>
void MainWindow::on_actOpenStream_triggered()
{
    QString curPath = QCoreApplication::applicationDirPath();
    QString dlgTitle = "打开文件";
    QString filter = "程序(*.c *.cpp);;文本(*.txt);;所有文件(*.*)";
    QString strFileName = QFileDialog::getOpenFileName(this,
                          dlgTitle, curPath, filter);

    if(strFileName.isEmpty())
    {
        return;
    }

    QFile file(strFileName);

    if(file.open(QIODevice::ReadOnly | QIODevice::Text))
    {
        QTextStream stream(&file);

        while (!stream.atEnd())
        {
            ui->plainTextEditTextStream->appendPlainText(stream.readLine());
        }

        //        ui->plainTextEditTextStream->setPlainText(stream.readAll());
        file.close();
        ui->tabWidget->setCurrentIndex(1);
    }
}

void MainWindow::on_actSaveQTextStream_triggered()
{
    QString curPath = QCoreApplication::applicationDirPath();
    QString dlgTitle = "保存文件";
    QString filter = "程序(*.c *.cpp);;文本(*.txt);;所有文件(*.*)";
    QString strFileName = QFileDialog::getSaveFileName(this,
                          dlgTitle, curPath, filter);

    if(strFileName.isEmpty())
    {
        return;
    }

    QFile file(strFileName);

    if(file.open(QIODevice::WriteOnly | QIODevice::Text))
    {
        QTextStream stream(&file);
        QString str = ui->plainTextEditTextStream->toPlainText();
        stream << str;
        file.close();
        ui->tabWidget->setCurrentIndex(1);
    }
}

二、二进制文件读写

使用QFile和QDataStream进行二进制数据的读写
QFile	负责文件的IO设备接口,即与文件物理交互
QDataStream	以数据六的方式读取文件内容或写入文件内容。

1、实现工具

(1)创建项目,基于QMainWIndow

(2)添加图标资源文件,添加组件

在这里插入图片描述

(3)实现功能

#include "mainwindow.h"
#include "ui_mainwindow.h"


MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    setCentralWidget(ui->tableView);

    theModel = new QStandardItemModel(this);
    theSelect = new QItemSelectionModel(theModel);
    ui->tableView->setModel(theModel);

    QStringList headerList;
    headerList << "Depth";
    headerList << "Measured Depth";
    headerList << "Direction";
    headerList << "Offset";
    headerList << "Quality";
    headerList << "Sampled";
    theModel->setHorizontalHeaderLabels(headerList);
    resetTable(5);
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::resetTable(int row)
{
    theModel->removeRows(0, theModel->rowCount());
    theModel->setRowCount(row);

    QString str = theModel->headerData(theModel->columnCount() - 1, Qt::Horizontal,
                                       Qt::DisplayRole).toString();

    for (int i = 0; i < row; ++i)
    {
        //        ui->tableView->setItemDelegateForColumn(0, &intSpinDelegate);
        //        ui->tableView->setItemDelegateForColumn(1, &floatSpinDelegate);
        //        ui->tableView->setItemDelegateForColumn(2, &floatSpinDelegate);
        //        ui->tableView->setItemDelegateForColumn(3, &floatSpinDelegate);
        //        ui->tableView->setItemDelegateForColumn(5, &checkboxDelegate);

        QModelIndex index = theModel->index(i, theModel->columnCount() - 1);
        QStandardItem *item = theModel->itemFromIndex(index);
        item->setData(str, Qt::DisplayRole);
        item->setCheckable(true);
        item->setEditable(false);
    }
}

void MainWindow::on_actTabeset_triggered()
{
    resetTable(10);
}

#include <QFileDialog>
void MainWindow::on_actOpen_triggered()
{
    QString curPath = QCoreApplication::applicationDirPath();
    QString title = "打开文件";
    QString filter = "Qt预定义编码(*.stm)";
    QString strFileName = QFileDialog::getOpenFileName(this, title, curPath, filter);

    if(strFileName.isEmpty())
    {
        return;
    }

    QFile file(strFileName);

    if(file.open(QIODevice::ReadOnly))
    {
        QDataStream stream(&file);
        stream.setVersion(QDataStream::Qt_5_13);
        qint16 rowCount, colCount;
        stream >> rowCount;
        stream >> colCount;
        resetTable(rowCount);
        /*
        headerList << "Depth";
        headerList << "Measured Depth";
        headerList << "Direction";
        headerList << "Offset";
        headerList << "Quality";
        headerList << "Sampled";
        */
        QString str;

        for (int i = 0; i < colCount; ++i)
        {
            stream >> str;
        }

        qint16 Depth;
        qreal MeasuredDepth, Direction, offset;
        QString Quality;
        bool sampled;

        QModelIndex index;
        QStandardItem *item;

        for (int i = 0; i < rowCount; ++i)
        {
            stream >> Depth;
            index = theModel->index(i, 0);
            item = theModel->itemFromIndex(index);
            item->setData(Depth, Qt::DisplayRole);

            stream >> MeasuredDepth;
            index = theModel->index(i, 1);
            item = theModel->itemFromIndex(index);
            item->setData(MeasuredDepth, Qt::DisplayRole);

            stream >> Direction;
            index = theModel->index(i, 2);
            item = theModel->itemFromIndex(index);
            item->setData(Direction, Qt::DisplayRole);

            stream >> offset;
            index = theModel->index(i, 3);
            item = theModel->itemFromIndex(index);
            item->setData(offset, Qt::DisplayRole);

            stream >> Quality;
            index = theModel->index(i, 4);
            item = theModel->itemFromIndex(index);
            item->setData(Quality, Qt::DisplayRole);

            stream >> sampled;
            index = theModel->index(i, 5);
            item = theModel->itemFromIndex(index);

            if(sampled)
            {
                item->setCheckState(Qt::Checked);

            }
            else
            {
                item->setCheckState(Qt::Unchecked);
            }
        }

        file.close();
    }
}


void MainWindow::on_actSave_triggered()
{
    QString curPath = QCoreApplication::applicationDirPath();
    QString title = "保存文件";
    QString filter = "标准编码(*.dat)";
    QString strFileName = QFileDialog::getSaveFileName(this, title, curPath, filter);

    if(strFileName.isEmpty())
    {
        return;
    }

    QFile file(strFileName);

    if(file.open(QIODevice::WriteOnly | QIODevice::Truncate))
    {
        QDataStream stream(&file);
        stream.setVersion(QDataStream::Qt_5_13);
        qint16 rowCount, colCount;
        rowCount = theModel->rowCount();
        colCount = theModel->columnCount();
        stream << rowCount;
        stream << colCount;

        /*
        headerList << "Depth";
        headerList << "Measured Depth";
        headerList << "Direction";
        headerList << "Offset";
        headerList << "Quality";
        headerList << "Sampled";
        */
        for (int i = 0; i < colCount; ++i)
        {
            stream << theModel->horizontalHeaderItem(i)->text();
        }

        qint16 Depth;
        qreal MeasuredDepth, Direction, offset;
        QString Quality;
        bool sampled;

        for (int i = 0; i < rowCount; ++i)
        {
            auto data = theModel->item(i, 0)->data(Qt::DisplayRole);
            Depth = theModel->item(i, 0)->data(Qt::DisplayRole).toInt();
            stream << Depth;

            MeasuredDepth = theModel->item(i, 1)->data(Qt::DisplayRole).toFloat();
            stream << MeasuredDepth;

            Direction = theModel->item(i, 2)->data(Qt::DisplayRole).toFloat();
            stream << Direction;

            offset = theModel->item(i, 3)->data(Qt::DisplayRole).toFloat();
            stream << offset;

            Quality = theModel->item(i, 4)->data(Qt::DisplayRole).toString();
            stream << Quality;

            if(theModel->item(i, 5)->checkState() == Qt::Checked)
            {
                sampled = true;
            }
            else
            {
                sampled = false;
            }

            stream << sampled;
        }

        file.close();
    }
}

void MainWindow::on_actOpenBin_triggered()
{
    QString curPath = QCoreApplication::applicationDirPath();
    QString title = "打开文件";
    QString filter = "标准编码(*.dat)";
    QString strFileName = QFileDialog::getOpenFileName(this, title, curPath, filter);

    if(strFileName.isEmpty())
    {
        return;
    }

    QFile file(strFileName);

    if(file.open(QIODevice::ReadOnly))
    {
        QDataStream stream(&file);
        stream.setByteOrder(QDataStream::LittleEndian);
        stream.setVersion(QDataStream::Qt_5_13);
        qint16 rowCount, colCount;
        //        stream >> rowCount;
        //        stream >> colCount;

        stream.readRawData((char*)&rowCount, sizeof(qint16));
        stream.readRawData((char*)&colCount, sizeof(qint16));

        /*
        headerList << "Depth";
        headerList << "Measured Depth";
        headerList << "Direction";
        headerList << "Offset";
        headerList << "Quality";
        headerList << "Sampled";
        */
        char* buf;
        uint strLen;

        for (int i = 0; i < colCount; ++i)
        {
            //            stream >> str;
            stream.readBytes(buf, strLen);
        }

        qint16 Depth;
        qreal MeasuredDepth, Direction, offset;
        QString Quality;
        qint8 sampled;

        QModelIndex index;
        QStandardItem *item;

        for (int i = 0; i < rowCount; ++i)
        {
            //            stream >> Depth;
            stream.readRawData((char*)&Depth, sizeof(qint16));
            index = theModel->index(i, 0);
            item = theModel->itemFromIndex(index);
            item->setData(Depth, Qt::DisplayRole);

            //            stream >> MeasuredDepth;
            stream.readRawData((char*)&MeasuredDepth, sizeof(qreal));
            index = theModel->index(i, 1);
            item = theModel->itemFromIndex(index);
            item->setData(MeasuredDepth, Qt::DisplayRole);

            //            stream >> Direction;
            stream.readRawData((char*)&Direction, sizeof(qreal));
            index = theModel->index(i, 2);
            item = theModel->itemFromIndex(index);
            item->setData(Direction, Qt::DisplayRole);

            //            stream >> offset;
            stream.readRawData((char*)&offset, sizeof(qreal));
            index = theModel->index(i, 3);
            item = theModel->itemFromIndex(index);
            item->setData(offset, Qt::DisplayRole);

            //            stream >> Quality;
            stream.readBytes(buf, strLen);
            Quality = QString::fromLocal8Bit(buf, strLen);
            index = theModel->index(i, 4);
            item = theModel->itemFromIndex(index);
            item->setData(Quality, Qt::DisplayRole);

            //            stream >> sampled;
            stream.readRawData((char*)&sampled, sizeof(qint8));
            index = theModel->index(i, 5);
            item = theModel->itemFromIndex(index);

            if(sampled)
            {
                item->setCheckState(Qt::Checked);

            }
            else
            {
                item->setCheckState(Qt::Unchecked);
            }
        }

        file.close();
    }
}

void MainWindow::on_actSaveBin_triggered()
{
    QString curPath = QCoreApplication::applicationDirPath();
    QString title = "保存文件";
    QString filter = "标准编码(*.dat)";
    QString strFileName = QFileDialog::getSaveFileName(this, title, curPath, filter);

    if(strFileName.isEmpty())
    {
        return;
    }

    QFile file(strFileName);

    if(file.open(QIODevice::WriteOnly | QIODevice::Truncate))
    {
        QDataStream stream(&file);
        stream.setByteOrder(QDataStream::LittleEndian);
        stream.setVersion(QDataStream::Qt_5_13);
        qint16 rowCount, colCount;
        rowCount = theModel->rowCount();
        colCount = theModel->columnCount();
        //        stream << rowCount;
        //        stream << colCount;
        stream.writeRawData((char*)&rowCount, sizeof(qint16));
        stream.writeRawData((char*)&colCount, sizeof(qint16));


        /*
        headerList << "Depth";
        headerList << "Measured Depth";
        headerList << "Direction";
        headerList << "Offset";
        headerList << "Quality";
        headerList << "Sampled";
        */
        QByteArray btArray;

        for (int i = 0; i < colCount; ++i)
        {
            //            stream << theModel->horizontalHeaderItem(i)->text();
            btArray = theModel->horizontalHeaderItem(i)->text().toUtf8();
            stream.writeBytes(btArray, btArray.length());
        }

        qint16 Depth;
        qreal MeasuredDepth, Direction, offset;
        QString Quality;
        int8_t sampled;

        for (int i = 0; i < rowCount; ++i)
        {
            auto data = theModel->item(i, 0)->data(Qt::DisplayRole);
            Depth = theModel->item(i, 0)->data(Qt::DisplayRole).toInt();
            //            stream << Depth;
            stream.writeRawData((char*)&Depth, sizeof(qint16));

            MeasuredDepth = theModel->item(i, 1)->data(Qt::DisplayRole).toFloat();
            //            stream << MeasuredDepth;
            stream.writeRawData((char*)&MeasuredDepth, sizeof(qreal));

            Direction = theModel->item(i, 2)->data(Qt::DisplayRole).toFloat();
            //            stream << Direction;
            stream.writeRawData((char*)&Direction, sizeof(qreal));

            offset = theModel->item(i, 3)->data(Qt::DisplayRole).toFloat();
            //            stream << offset;
            stream.writeRawData((char*)&offset, sizeof(qreal));

            Quality = theModel->item(i, 4)->data(Qt::DisplayRole).toString();
            //            stream << Quality;
            btArray = Quality.toUtf8();
            stream.writeBytes(btArray, btArray.length());

            if(theModel->item(i, 5)->checkState() == Qt::Checked)
            {
                sampled = 1;
            }
            else
            {
                sampled = 0;
            }

            //            stream << sampled;
            stream.writeRawData((char*)&sampled, sizeof(int8_t));

        }

        file.close();
    }
}

三、文件目录操作

文件目录操作相关类:
  • QCoreApplocation:用于提取应用程序路径、程序名等文件信息
  • QFIle:除了打开文件操作外,还有复制文件、删除文件等功能
  • QFileInfo:用于提取文件信息,包括路径、文件名、后缀
  • QDir:用于提取目录或文件,文件重名等操作
  • QTemporaryDir和QTemporaryFile:用于创建临时目录和临时文件
  • QFileSystemWatcher:监听目录下为念的添加和删除等变化

1、实现工具

(1)创建项目,基于QMainWindow

(2)添加组件

在这里插入图片描述

(3)实现功能

#include "mainwindow.h"
#include "ui_mainwindow.h"

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

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::getBtnInfo(QObject *btn)
{
    QPushButton* button = static_cast<QPushButton*>(btn);
    ui->plainTextEdit->appendPlainText(button->text());
    ui->plainTextEdit->appendPlainText(button->toolTip());
}

#include <QFileDialog>
void MainWindow::on_btnOpenFile_clicked()
{
    QString strCurPath = QDir::currentPath();
    QString strFileName = QFileDialog::getOpenFileName(this, "", strCurPath, "(*.*)");
    ui->lineEditFile->setText(strFileName);
}

void MainWindow::on_btnOpenDir_clicked()
{
    QString strCurPath = QDir::currentPath();
    QString strDirName = QFileDialog::getExistingDirectory(this, "", strCurPath);
    ui->lineEditDir->setText(strDirName);
}

void MainWindow::on_btnClear_clicked()
{
    ui->plainTextEdit->clear();
}
void MainWindow::on_btnApplicationDirPath_clicked()
{
    //    QPushButton* btn = static_cast<QPushButton*>(sender());
    //    ui->plainTextEdit->appendPlainText(btn->text());
    //    ui->plainTextEdit->appendPlainText(btn->toolTip());
    getBtnInfo(sender());
    ui->plainTextEdit->appendPlainText(QCoreApplication::applicationDirPath());
}

void MainWindow::on_btnStaticCopy_clicked()
{
    getBtnInfo(sender());
    QString strSource = ui->lineEditFile->text();
    QFileInfo info(strSource);
    QString strDest = info.path() + "/" + info.fileName() + "-副本." + info.suffix();
    QFile::copy(strSource, strDest);
    ui->plainTextEdit->appendPlainText("源文件: " + strSource);
    ui->plainTextEdit->appendPlainText("副本: " + strDest + "\n");

}

void MainWindow::on_btnMkdir_clicked()
{
    getBtnInfo(sender());
    QDir dir(ui->lineEditDir->text());

    if(dir.mkdir("newDir"))
    {
        ui->plainTextEdit->appendPlainText("创建成功");
    }
    else
    {
        ui->plainTextEdit->appendPlainText("创建失败");
    }
}

void MainWindow::on_btnAddPath_clicked()
{
    getBtnInfo(sender());
    ui->plainTextEdit->appendPlainText("监听目录:" + ui->lineEditDir->text());
    fileWatcher.addPath(ui->lineEditDir->text());
    fileWatcher.addPath(ui->lineEditFile->text());

    QObject::connect(&fileWatcher, &QFileSystemWatcher::directoryChanged,
                     this, MainWindow::on_dirctoryChanged);
    QObject::connect(&fileWatcher, &QFileSystemWatcher::fileChanged,
                     this, MainWindow::on_fileChanged);

}

void MainWindow::on_fileChanged()
{
    ui->plainTextEdit->appendPlainText("监听到文件");
}

void MainWindow::on_dirctoryChanged()
{
    ui->plainTextEdit->appendPlainText("监听到目录");
}

void MainWindow::on_btnRemovePath_clicked()
{
    getBtnInfo(sender());
    ui->plainTextEdit->appendPlainText("监听目录:" + ui->lineEditDir->text());
    fileWatcher.removePath(ui->lineEditDir->text());
    fileWatcher.removePath(ui->lineEditFile->text());

    QObject::disconnect(&fileWatcher, &QFileSystemWatcher::directoryChanged,
                        this, MainWindow::on_dirctoryChanged);
    QObject::disconnect(&fileWatcher, &QFileSystemWatcher::fileChanged,
                        this, MainWindow::on_fileChanged);
}

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

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

相关文章

makefile 编译动态链接库使用(.so库文件)

makefile 编译动态链接库使用&#xff08;.so库文件&#xff09; 动态链接库:不会把代码编译到二进制文件中&#xff0c;而是在运行时才去加载&#xff0c; 好处是程序可以和库文件分离&#xff0c;可以分别发版&#xff0c;然后库文件可以被多处共享 动态链接库 动态&#…

java servlet 学生成绩查询管理系统Myeclipse开发mysql数据库web结构java编程计算机网页项目

一、源码特点 java Web学生成绩查询管理系统是一套完善的java web信息管理系统 采用servlet dao bean&#xff0c;对理解JSP java编程开发语言有帮助&#xff0c;系统具有完整的源代码和数据库&#xff0c;系统主要采用 B/S模式开发。开发环境为TOMCAT7.0,Myeclipse8.5开发…

插混、增程、纯电为什么说纯电是未来的趋势

技术路线&#xff1a;插混、增程、纯电趋势判断 新能源汽车目前有纯电动、增程式、插电式3 种主流技术路径&#xff0c;其中增程式和插电式均为混动技术。纯电动汽车是指以动力电池为动力&#xff0c;用电机驱动车轮行驶&#xff1b;混动技术分为串联、并联、混联3 种模式&…

一个 web版linux、数据库、redis、mongo统一管理操作平台

mayfly-go&#xff1a;一个 web版linux、数据库、redis、mongo统一管理操作平台 功能介绍 linux&#xff1a; ssh终端(终端操作记录回放)&#xff0c;文件查看&#xff08;可根据常见后缀名高亮显示关键词等&#xff09;、修改、上传、下载、删除等&#xff0c;脚本管理执行&…

Spring5系列学习文章分享---第一篇(概述+特点+IOC原理+IOC并操作之bean的XML管理操作)

目录 Spring&#xff08;概述特点IOC原理IOC并操作之bean的XML管理操作&#xff09;概述Spring是轻量级的开源的JavaEE框架Spring可以解决企业应用开发的复杂性Spring有两个核心部分ioc,aopSpring特点 loc(概念和原理)什么是 IOCIOC 底层原理IOC 过程图 IOC&#xff08;接口&am…

蓝桥杯重要知识点和赛题直通车

<蓝桥杯软件赛>零基础备赛20周 第 1周(2023-10-23): 蓝桥杯软件赛介绍官方链接零基础能得奖吗&#xff1f; 第 2周(2023-10-30): 常考知识点蓝桥杯怎么判题备赛计划 第 3周(2023-11-06): 填空题&#xff08;分数少但越来越不好做&#xff09; 第 4周(2023-11-13): &#…

免费在线压缩图片网站分享

支持批量压缩处理&#xff0c;但需要注意&#xff0c;网站仅仅支持体积为5MB的图片&#xff0c;压缩率高达66%&#xff0c;压缩完成后&#xff0c;点下Donwnload all&#xff0c;就能将图片保存至本地。 网页端直接进行图片压缩 https://tinify.cn/

软件测试到底是选择自学还是报培训机构(纯个人经验分享)----分享给正在迷茫的学弟学妹们!

&#x1f525; 交流讨论&#xff1a;欢迎加入我们一起学习&#xff01; &#x1f525; 资源分享&#xff1a;耗时200小时精选的「软件测试」资料包 &#x1f525; 教程推荐&#xff1a;火遍全网的《软件测试》教程 &#x1f4e2;欢迎点赞 &#x1f44d; 收藏 ⭐留言 &#x1…

IOS工程师,再不转型!失业在所难免!

随着智能手机的快速普及&#xff0c;移动应用开发成为了一个炙手可热的职业。而在手机市场上&#xff0c;以前主要是iOS和Android是两个操作系统。近几年在中国市场上&#xff0c;iPhone手机销量持续下滑&#xff0c;与之相反&#xff0c;华为手机一直处于领先地位。这对于从事…

【立创EDA-PCB设计基础】3.网络表概念解读+板框绘制

前言&#xff1a;本文对网络表概念解读板框绘制&#xff08;确定PCB板子轮廓&#xff09; 网络表概念解读 在本专栏的上一篇文章【嘉立创EDA-PCB设计指南】2&#xff0c;将设计的原理图转为了PCB&#xff0c;在PCB界面下出现了所有的封装&#xff0c;以及所有的飞线属性&…

数据集笔记:UJIIndoorLoc

1 数据集介绍 UJIIndoorLoc - UCI Machine Learning Repository UJIIndoorLoc是一个多建筑多楼层的室内定位数据库&#xff0c;用于测试依赖于WLAN/WiFi指纹的室内定位系统。 2 数据读取 数据分类训练数据和测试数据 import pandas as pdapd.read_csv(Downloads/ujiindoo…

Bit Extraction and Bootstrapping for BGV/BFV

参考文献&#xff1a; [GHS12] Gentry C, Halevi S, Smart N P. Better bootstrapping in fully homomorphic encryption[C]//International Workshop on Public Key Cryptography. Berlin, Heidelberg: Springer Berlin Heidelberg, 2012: 1-16.[AP13] Alperin-Sheriff J, Pe…

Python文件操作和异常处理:高效处理数据的利器

文章目录 一、引言1.1 文件操作和异常处理对于编程的重要性1.2 Python作为实现文件操作和异常处理的强大工具 二、为什么学习文件操作和异常处理2.1 处理各种文件格式&#xff1a;从文本到图像到音频等2.2 确保代码的鲁棒性&#xff1a;有效处理异常情况 三、文件读取和写入3.1…

Duplicate object key json(520)

亲爱的码友&#xff0c;当你看到这个错误 请查看一下你的json文件内容的关键词是不是重复了 举个栗子&#x1f330; 往下翻翻&#xff1a; 删一个就行&#xff01;&#xff01;&#xff01; 被自己傻哭了吧&#x1f923;&#x1f923;&#x1f923;

阿里云优惠整理,最新2024阿里云优惠政策解读

阿里云优惠政策有哪些&#xff1f;2024年阿里云优惠政策风向改了&#xff0c;之前一直是老用户与狗的营销策略&#xff0c;今年阿里云2核2G、3M固定带宽服务器99元居然开启了老用户购买权限&#xff0c;并且续费不涨价&#xff0c;阿里云这波操作确实让用户赢麻了&#xff0c;在…

数据可视化 | 期末复习 | 补档

文章目录 &#x1f4da;介绍可视化&#x1f407;什么是可视化&#x1f407;科学可视化&#xff0c;信息可视化&#xff0c;可视分析系统三者之间有什么区别&#x1f525;&#x1f407;可视化的基本流程&#x1f407;可视化的两个基本设计原则&#x1f407;数据属性&#x1f407…

【Android】TypedArray的使用

介绍 看电池电量组件BatteryMeterView的时候看到的。 Array是个数组&#xff0c;所有TypedArray也是个容器&#xff0c;基本是用于自定义View里面的&#xff08;至少我目前见过的全部都在自定义View里面&#xff09;。 使用 1.自定义View public class RoundSeekbarView e…

QComboBox 下拉框

文章目录 1、简介2、functions3、Signal QT 官方文档参考地址&#xff1a;https://doc.qt.io/qt-5/qcombobox.html 1、简介 QComboBox 是下拉列表框组件类&#xff0c;它提供一个下拉列表供用户选择&#xff0c;也可以直接当作一个 QLineEdit 用作输入。 2、functions 1、voi…

《GitHub Copilot 操作指南》课程介绍

第1节&#xff1a;GitHub Copilot 概述 一、什么是 GitHub Copilot 什么是 GitHub Copilot GitHub Copilot是GitHub与OpenAI合作开发的编程助手工具&#xff0c;利用机器学习模型生成代码建议。它集成在开发者的集成开发环境&#xff08;IDE&#xff09;中&#xff0c;可以根…

词语的魔力:语言在我们生活中的艺术与影响

Words That Move Mountains: The Art and Impact of Language in Our Lives 词语的魔力&#xff1a;语言在我们生活中的艺术与影响 Hello there, wonderful people! Today, I’d like to gab about the magical essence of language that’s more than just a chatty tool in o…