Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Question about how to init QFile in the header
Forum Updated to NodeBB v4.3 + New Features

Question about how to init QFile in the header

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 156 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rock37
    wrote on last edited by
    #1

    hey folks,

    i have code here where QFile is initalized like

    QFile = QString("Path/to/a/file.txt"); it works in the header file but when i try it in the .cpp file it throws an error... how can that be ?

    sierdzioS 1 Reply Last reply
    0
    • R rock37

      hey folks,

      i have code here where QFile is initalized like

      QFile = QString("Path/to/a/file.txt"); it works in the header file but when i try it in the .cpp file it throws an error... how can that be ?

      sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      @rock37 what is the error message?The code you included is not valid C++ so not sure how it worked for you at all.

      If you need a QFile variable in cpp file, you can use this:

      QFile file("path.to/file.txt");
      

      (Z(:^

      1 Reply Last reply
      2

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved