• 大小: 20.51MB
    文件类型: .zip
    金币: 2
    下载: 1 次
    发布日期: 2023-08-01
  • 语言: 其他
  • 标签: QT  CAN  C++  上位机  

资源简介

QT开发的CAN总线上位机,应该有一些能参考的东西,不贵

资源截图

代码片段和文件信息

#include “fileswindow.h“
#include “ui_fileswindow.h“

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

    model = new QFileSystemModel(this);
    model->setFilter(QDir::QDir::AllEntries);
    //auto index = model->index(QDir::currentPath());
    //ui->listView->setRootIndex(index);
    model->setRootPath(QApplication::applicationDirPath());
    ui->listView->setModel(model);
    ui->listView->setRootIndex(model->index(QApplication::applicationDirPath()));
    //ui->listView->setRootIndex(model->index(QApplication::applicationDirPath()));

    //connect(ui->listView SIGNAL(doubleClicked(QModelIndex)) this SLOT(on_listWidget_doubleClicked(QModelIndex)));
}

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



void FilesWindow::on_listView_doubleClicked(const QModelIndex &index)
{
    QFileInfo fileInfo = model->fileInfo(index);


    if(fileInfo.fileName() == “..“){
        QDir dir = fileInfo.dir();
        dir.cdUp();
        ui->listView->setRootIndex(model->index(dir.absolutePath()));
    }
    else if(fileInfo.fileName() == “.“){
        ui->listView->setRootIndex(model->index(““));
    }
    else if(fileInfo.isDir()){
        ui->listView->setRootIndex(index);
    }
    else if(fileInfo.isFile()){
        emit sendPlotFile(QString(fileInfo.fileName()));
        //ui->lineEdit->setText(fileInfo.fileName()+“ “+fileInfo.filePath());
        this->close();
    }
}

void FilesWindow::on_pushButton_2_clicked()
{
    this->close();
    delete ui;
}

void FilesWindow::on_pushButton_clicked()
{
    emit sendPlotFile(model->fileInfo(ui->listView->currentIndex()).fileName());
    //ui->lineEdit->setText(fileInfo.fileName());
    this->close();
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-05-10 13:15  CAN-BUS-GUI-master\
     目录           0  2018-05-10 13:15  CAN-BUS-GUI-master\GUI_for_CHAI\
     文件        1443  2018-05-10 13:15  CAN-BUS-GUI-master\GUI_for_CHAI\GUI_for_CHAI.pro
     文件       43951  2018-05-10 13:15  CAN-BUS-GUI-master\GUI_for_CHAI\GUI_for_CHAI.pro.user
     文件      159232  2018-05-10 13:15  CAN-BUS-GUI-master\GUI_for_CHAI\chai.dll
     文件       10310  2018-05-10 13:15  CAN-BUS-GUI-master\GUI_for_CHAI\chai.h
     文件       11164  2018-05-10 13:15  CAN-BUS-GUI-master\GUI_for_CHAI\chai.lib
     文件        1742  2018-05-10 13:15  CAN-BUS-GUI-master\GUI_for_CHAI\fileswindow.cpp
     文件         594  2018-05-10 13:15  CAN-BUS-GUI-master\GUI_for_CHAI\fileswindow.h
     文件        1190  2018-05-10 13:15  CAN-BUS-GUI-master\GUI_for_CHAI\fileswindow.ui
     文件       19376  2018-05-10 13:15  CAN-BUS-GUI-master\GUI_for_CHAI\graphplotwindow.cpp
     文件        1968  2018-05-10 13:15  CAN-BUS-GUI-master\GUI_for_CHAI\graphplotwindow.h
     文件       21899  2018-05-10 13:15  CAN-BUS-GUI-master\GUI_for_CHAI\graphplotwindow.ui
     文件         269  2018-05-10 13:15  CAN-BUS-GUI-master\GUI_for_CHAI\main.cpp
     文件       26782  2018-05-10 13:15  CAN-BUS-GUI-master\GUI_for_CHAI\mainwindow.cpp
     文件        2842  2018-05-10 13:15  CAN-BUS-GUI-master\GUI_for_CHAI\mainwindow.h
     文件       23373  2018-05-10 13:15  CAN-BUS-GUI-master\GUI_for_CHAI\mainwindow.ui
     文件        6859  2018-05-10 13:15  CAN-BUS-GUI-master\GUI_for_CHAI\plotfromfile.cpp
     文件         820  2018-05-10 13:15  CAN-BUS-GUI-master\GUI_for_CHAI\plotfromfile.h
     文件        4014  2018-05-10 13:15  CAN-BUS-GUI-master\GUI_for_CHAI\plotfromfile.ui
     文件     1118717  2018-05-10 13:15  CAN-BUS-GUI-master\GUI_for_CHAI\qcustomplot.cpp
     文件      266925  2018-05-10 13:15  CAN-BUS-GUI-master\GUI_for_CHAI\qcustomplot.h
     文件         669  2018-05-10 13:15  CAN-BUS-GUI-master\GUI_for_CHAI\settingswindow.cpp
     文件         387  2018-05-10 13:15  CAN-BUS-GUI-master\GUI_for_CHAI\settingswindow.h
     文件        3963  2018-05-10 13:15  CAN-BUS-GUI-master\GUI_for_CHAI\settingswindow.ui
     文件      120334  2018-05-10 13:15  CAN-BUS-GUI-master\libgcc_s_dw2-1.dll
     文件     1540622  2018-05-10 13:15  CAN-BUS-GUI-master\libstdc++-6.dll
     文件       79360  2018-05-10 13:15  CAN-BUS-GUI-master\libwinpthread-1.dll
     目录           0  2018-05-10 13:15  CAN-BUS-GUI-master\release\
     文件     7741645  2018-05-10 13:15  CAN-BUS-GUI-master\release\03.05.18 _ 16.04.49.txt
     文件         745  2018-05-10 13:15  CAN-BUS-GUI-master\release\03.05.18 _ 16.04.50.txt
............此处省略77个文件信息

评论

共有 条评论