조회 수 9221 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄 첨부
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄 첨부

QStorageInfo 클래스를 사용하면 하드디스크 정보를 가져와서 여유공간 등의 정보를 알 수 있다. 아래 예제에서는 애플리케이션이 Windows 볼륨(C:드라이브) 정보를 가져오는 방법을 보여준다.

#include <QDebug>

#include <QStorageInfo>

#define GB (1024 * 1024 * 1024)

void PrintVolumeInfo(const QString &drive)
{
    QStorageInfo storage(drive);
    if( storage.isValid() && storage.isReady() ) {
        qDebug() << "Name:" << storage.name();
        qDebug() << "Used:" << (storage.bytesTotal()-storage.bytesAvailable()) * 1.0 / GB << "GB";
        qDebug() << "Free:" << storage.bytesAvailable() * 1.0 / GB << "GB";
        qDebug() << "Total:" << storage.bytesTotal() * 1.0 / GB << "GB";
    }
}


...
PrintVolumeInfo("C:");
...

 

실행 결과는 다음과 같다.

QStorageInfo.png

TAG •

  1. No Image notice

    Qt프로그래밍(QtQuick) Beginner를 위한 글 읽는 순서

    Date2019.01.05 CategoryQML and Qt Quick By운영자 Views437334
    read more
  2. Visual Studio Code용 Qt 확장팩

    Date2024.10.09 CategoryInstallation and Deployment Bymakersweb Views13545
    Read More
  3. Qt 응용프로그램에 Web 구성 요소를 표시 with Servo

    Date2024.04.27 CategoryGeneral and Desktop Bymakersweb Views14047
    Read More
  4. Qt Creator 에서 GitHub Copilot 사용하기

    Date2024.04.13 CategoryInstallation and Deployment Bymakersweb Views16528
    Read More
  5. No Image

    QtQuick 애플리케이션에 Rive 애니메이션 통합

    Date2024.03.31 CategoryQML and Qt Quick Bymakersweb Views9043
    Read More
  6. 클라우드용 Qt

    Date2024.01.16 CategoryInstallation and Deployment Bymakersweb Views7862
    Read More
  7. QRhi 에 대해서

    Date2023.12.29 CategoryQt 6 Bymakersweb Views9762
    Read More
  8. Android 애플리케이션 서명 구성

    Date2023.12.17 CategoryMobile and Embedded Bymakersweb Views8372
    Read More
  9. No Image

    QML의 사용자 정의 Image

    Date2023.09.17 CategoryC++ Class Bymakersweb Views11350
    Read More
  10. No Image

    Base64로 인코딩된 파일을 복원

    Date2023.08.06 CategoryC++ Class Bymakersweb Views14057
    Read More
  11. QML에서 D-Bus 통신

    Date2023.03.15 CategoryQML and Qt Quick Bymakersweb Views7229
    Read More
  12. Qt 하이브리드 애플리케이션(Hybrid App) 개발

    Date2023.02.08 CategoryGeneral and Desktop Bymakersweb Views8974
    Read More
  13. No Image

    Widgets(C++) 기반의 기본 스타일을 Dark 테마 및 Material 디자인 스타일로 바꾸기

    Date2023.01.28 CategoryGeneral and Desktop Bymakersweb Views12621
    Read More
  14. OpacityMask 예제

    Date2023.01.26 CategoryQML and Qt Quick Bymakersweb Views12158
    Read More
  15. QProcess 예제 (프로그램 재시작)

    Date2023.01.25 CategoryC++ Class Bymakersweb Views6836
    Read More
  16. 하드디스크 드라이브 여유 공간 계산

    Date2023.01.15 CategoryC++ Class Bymakersweb Views9221
    Read More
  17. No Image

    Qt Property(속성) 시스템

    Date2023.01.08 CategoryGeneral and Desktop Bymakersweb Views12934
    Read More
  18. VTK 를 사용해서 강력한 시각화(3D, Plotting, Chart)Qt 응용프로그램 개발하기

    Date2022.10.16 CategoryGeneral and Desktop Bymakersweb Views9436
    Read More
  19. QProcess 보안 권고 리뷰

    Date2022.09.18 CategoryGeneral and Desktop Bymakersweb Views4979
    Read More
  20. No Image

    QMake 프로젝트를 CMake 프로젝트로 변환 with qmake2cmake

    Date2022.09.17 CategoryInstallation and Deployment Bymakersweb Views5927
    Read More
  21. Qt Safe Renderer 개요

    Date2022.09.08 CategoryMobile and Embedded Bymakersweb Views13284
    Read More
Board Pagination Prev 1 2 3 4 5 9 Next
/ 9