Neverendingo (Talk | contribs) m (Text replace - "<code>" to "<syntaxhighlight lang="text">") |
Neverendingo (Talk | contribs) m (Text replace - "</code>" to "</syntaxhighlight>") |
||
| Line 31: | Line 31: | ||
// this makes the print job start | // this makes the print job start | ||
} | } | ||
| − | </ | + | </syntaxhighlight> |
== How to compile == | == How to compile == | ||
| Line 42: | Line 42: | ||
kde4_add_executable(printhelloworld printtest.cpp) | kde4_add_executable(printhelloworld printtest.cpp) | ||
target_link_libraries(printhelloworld ${${KDE4_KDECORE_LIBS} ${QT_QTGUI_LIBRARY}) | target_link_libraries(printhelloworld ${${KDE4_KDECORE_LIBS} ${QT_QTGUI_LIBRARY}) | ||
| − | </ | + | </syntaxhighlight> |
=== Make and Run === | === Make and Run === | ||
Contents |
Print Hello World on your printer.
#include <qpainter.h>#include <qprinter.h>#include <kapplication.h>#include <kaboutdata.h>#include <kmessagebox.h>#include <kcmdlineargs.h>/*This prints Hello World on your printer*/int main(int argc, char *argv[])
{KAboutData aboutData( "test", "test", "1.0", "test",
KAboutData::License_GPL, "(c) 2006" );
KCmdLineArgs::init( argc, argv, &aboutData );
KApplication app;QPrinter printer;
printer.setFullPage(true);
QPainter painter;
painter.begin(&printer);
painter.drawText(100,100,"Hello World");
painter.end();
// this makes the print job start}find_package(KDE4 REQUIRED)
include_directories( ${KDE4_INCLUDES} )
kde4_add_executable(printhelloworld printtest.cpp)
target_link_libraries(printhelloworld ${${KDE4_KDECORE_LIBS} ${QT_QTGUI_LIBRARY})Then do:
cmake . make ./printhelloworld