Results 1 to 2 of 2

Thread: Using rename in Qfile

  1. #1
    Join Date
    Jun 2012
    Posts
    6
    Qt products
    Qt4

    Default Using rename in Qfile

    Hello. I am trying to change the name of a file that I SSH over to my local Ubuntu computer from an external linux computer. I am trying to use the Qfile class, but I am confused as to how to use the rename function. I have to make a system that makes sure I don't overwrite the old data. So i need to have a counter that increases and is added tot he name of the file so the file(s) wont ever get overwritten. So how do i use the Qstring class to achieve this. because the rename function calls for it's use and I am pretty lost.

    -Thanks

  2. #2
    Join Date
    Jan 2008
    Posts
    72
    Thanks
    3
    Thanked 4 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: Using rename in Qfile

    Hi JvwLong,
    you can use member function of QFile, i.e bool QFile::rename ( const QString & oldName, const QString & newName ) [static] to rename your file. you can use a static counter and increase or decrease its value as you want. and as well you can convert it into QString using QString::number(int ).
    I hope it will helpful to you.

Similar Threads

  1. Rename a Tab of a QTabWidget
    By Qiieha in forum Qt Programming
    Replies: 8
    Last Post: 27th August 2021, 18:26
  2. Replies: 4
    Last Post: 9th May 2011, 09:52
  3. QFile &QFile::operator= is private
    By Fallen_ in forum Newbie
    Replies: 1
    Last Post: 15th March 2011, 15:08
  4. QFile or QDir rename()
    By maxpower in forum Qt Programming
    Replies: 2
    Last Post: 23rd January 2009, 17:50
  5. QFile::rename()
    By Bagstone in forum Qt Programming
    Replies: 1
    Last Post: 15th February 2008, 10:53

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.