Search Results

Search found 1 results on 1 pages for 'karunesh'.

Page 1/1 | 1 

  • QPrinter, QPrintDialog giving errors not encountered in code examples

    - by karunesh
    In the imageviewer example, QPainter and QPrintDialog objects are defined and used as following: #ifndef QT_NO_PRINTER QPrinter printer; #endif and QPrintDialog dialog(&printer, this); A QPainter object is then initialized with QPrinter (printer). When I tried to use the same code in my function, it looks like: void imageviewer::print() { ... #ifdef QT_NO_PRINTER QPrinter printer(this); //ERROR 1 QPrintDialog dialog(&printer, this);//ERROR 2 and 3 if (dialog.exec()) //ERROR 4 { //do the painting } #endif } The errors are: 1. variable 'QPrinter printer' has initializer but incomplete type 2. 'QPrintDialog' was not declared in this scope 3. Expected ';' before 'dialog' 4. 'dialog' was not declared in this scope What I am notable to understand is why are these errors arising when I am using them in my code, but not in the example. As a friend pointed out, I made sure that I used the right #include files and made sure that 'printer' and 'dialog' were not touched anywhere else in the example.

    Read the article

1