PDA

View Full Version : Qt c++ 5.5 screen not save (windows)



BuranereLoo
31st August 2015, 18:54
Hi i have a problem in windows qt c++


void Ekrancek()
{
QString time = QTime::currentTime().toString(Qt::DateFormat());
QScreen *ekran = QGuiApplication::primaryScreen();
if(ekran)
{

QPixmap selam = ekran->grabWindow(0);

#ifdef Q_OS_LINUX
selam.save("/root/'"+time+"'.png");
#endif

#ifdef Q_OS_WIN32

selam.save("'"+time+"'.png");

#endif
}
}

this block working in linux but not working in windows

anda_skoa
31st August 2015, 20:21
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,
_