Results 1 to 19 of 19

Thread: QFile as an argument of a function?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: QFile as an argument of a function?

    If filename is not used, how does ChildWindow tell Heritage which file to open?
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  2. #2
    Join Date
    Jan 2012
    Posts
    83
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QFile as an argument of a function?

    Maybe I was not clear.
    In my code, at the level of first class.cpp line 11, we have:
    Qt Code:
    1. QStringList Heritage::operation1(QString fileName)
    To copy to clipboard, switch view to plain text mode 
    On the line 14, we have:
    Qt Code:
    1. QFile file1(m_openFile->text());
    To copy to clipboard, switch view to plain text mode 
    m_openFile->text() replaces what you called in your code fileName, and what I've added here too. But the variable "fileName" is not used. It was my problem.
    To answer to your qestion, according to me, ChildWindow shows the path to the file to be opned to Heritage with the expression: m_openFile->text().
    Could you please clarify this situation? I would be grateful to you.

  3. #3
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: QFile as an argument of a function?

    I think you are missing some basic concepts.

    you need to open "filename", not "m_openFile->text()",
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  4. #4
    Join Date
    Jan 2012
    Posts
    83
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QFile as an argument of a function?

    Many thanks Reddy!
    It is working now.
    One more time, many thanks for your advices and help.
    Last edited by Stanfillirenfro; 2nd February 2013 at 17:24.

Similar Threads

  1. How to pass an argument to evaluateJavaScript function?
    By TheIndependentAquarius in forum Qt Programming
    Replies: 5
    Last Post: 5th January 2013, 09:45
  2. Function: ... Argument
    By sonulohani in forum General Programming
    Replies: 3
    Last Post: 15th December 2012, 15:55
  3. Invoking dll function with argument crashed
    By moiit in forum Qt Programming
    Replies: 13
    Last Post: 7th March 2012, 14:34
  4. QVector as function argument
    By stefan in forum Qt Programming
    Replies: 4
    Last Post: 12th May 2011, 12:40
  5. QMap as function argument...
    By cydside in forum Qt Programming
    Replies: 5
    Last Post: 18th April 2009, 17:59

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.