PDA

View Full Version : Renaming file using QDir::rename



akshaysulakhe
29th August 2013, 10:37
Hello friends,
I am trying to swap two file names using QDir::rename. I have 2 files 100.jpg and 101.jpg. But it fails as the new filename exists and rename fails if new filename already exists. I tried the old engineering method, a,b,c the three variables. Then c=a, a=b, b=c. But this also fails with rename. Kindly let me know what to do. Thank you for your time.

high_flyer
29th August 2013, 10:45
Please post your code.

Soumya Somasekhar Ram
29th August 2013, 12:14
I need to rename pushbutton's name dynamically.
Can you suggest a method for that..
Thanks in advance

Santosh Reddy
29th August 2013, 13:05
I tried the old engineering method, a,b,c the three variables. Then c=a, a=b, b=c. But this also fails with rename. Kindly let me know what to do. Thank you for your time.
Do this..
1. Copy a to c
2. Delete a
3. Copy b to a
4. Delete b
5. Copy c to b
6. Delete c