Create test program for creating screenshot with Qt

Former-commit-id: 7e665ef0cd63f66c34ba2b441cafe34689358f3a
This commit is contained in:
T. van der Zwan 2013-12-20 19:46:03 +01:00
parent feb88d56bd
commit eb4170c316
2 changed files with 24 additions and 0 deletions

View File

@ -48,3 +48,7 @@ target_link_libraries(test_blackborderprocessor
add_executable(test_qregexp TestQRegExp.cpp) add_executable(test_qregexp TestQRegExp.cpp)
target_link_libraries(test_qregexp target_link_libraries(test_qregexp
${QT_LIBRARIES}) ${QT_LIBRARIES})
add_executable(test_qtscreenshot TestQtScreenshot.cpp)
target_link_libraries(test_qtscreenshot
${QT_LIBRARIES})

20
test/TestQtScreenshot.cpp Normal file
View File

@ -0,0 +1,20 @@
// STL includes
#include <iostream>
// QT includes
#include <QApplication>
#include <QDesktopWidget>
#include <QPixmap>
int main(int argc, char** argv)
{
QApplication app(argc, argv);
QPixmap originalPixmap = QPixmap::grabWindow(QApplication::desktop()->winId());
std::cout << "Grabbed image: [" << originalPixmap.width() << "; " << originalPixmap.height() << "]" << std::endl;
return 0;
}