Results 1 to 2 of 2

Thread: Qt c++ 5.5 screen not save (windows)

  1. #1
    Join Date
    Aug 2015
    Posts
    8
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Qt c++ 5.5 screen not save (windows)

    Hi i have a problem in windows qt c++

    Qt Code:
    1. void Ekrancek()
    2. {
    3. QString time = QTime::currentTime().toString(Qt::DateFormat());
    4. QScreen *ekran = QGuiApplication::primaryScreen();
    5. if(ekran)
    6. {
    7.  
    8. QPixmap selam = ekran->grabWindow(0);
    9.  
    10. #ifdef Q_OS_LINUX
    11. selam.save("/root/'"+time+"'.png");
    12. #endif
    13.  
    14. #ifdef Q_OS_WIN32
    15.  
    16. selam.save("'"+time+"'.png");
    17.  
    18. #endif
    19. }
    20. }
    To copy to clipboard, switch view to plain text mode 

    this block working in linux but not working in windows

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qt c++ 5.5 screen not save (windows)

    Well, you do not specify a full path on Windows.
    Also ' might be a forbidden character in a Windows filename.

    Why do you need an #ifdef here anyway?

    Cheers,
    _

Similar Threads

  1. Replies: 1
    Last Post: 10th April 2015, 22:31
  2. How can I save the windows I have previously opened ?
    By Marwa Shams in forum Qt Programming
    Replies: 4
    Last Post: 25th September 2011, 19:28
  3. Replies: 0
    Last Post: 13th April 2010, 19:27
  4. How to save a file in Windows 1250 code
    By TomASS in forum Newbie
    Replies: 7
    Last Post: 10th February 2010, 15:21
  5. Replies: 0
    Last Post: 5th May 2008, 12:43

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.