Changeset 8 for trunk/examples/application
- Timestamp:
- Nov 16, 2005, 8:36:46 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/examples/application/application.cpp
r7 r8 33 33 #include "filesave.xpm" 34 34 #include "fileopen.xpm" 35 #ifndef QT_NO_PRINTER 35 36 #include "fileprint.xpm" 37 #endif 36 38 37 39 ApplicationWindow::ApplicationWindow() 38 40 : QMainWindow( 0, "example application main window", WDestructiveClose | WGroupLeader ) 39 41 { 42 #ifndef QT_NO_PRINTER 40 43 printer = new QPrinter( QPrinter::HighResolution ); 44 #endif 41 45 QPixmap openIcon, saveIcon, printIcon; 42 46 … … 54 58 this, SLOT(save()), fileTools, "save file" ); 55 59 60 #ifndef QT_NO_PRINTER 56 61 printIcon = QPixmap( fileprint ); 57 62 QToolButton * filePrint 58 63 = new QToolButton( printIcon, "Print File", QString::null, 59 64 this, SLOT(print()), fileTools, "print file" ); 65 #else 66 Q_UNUSED( printIcon ) 67 #endif 60 68 61 69 … … 78 86 QWhatsThis::add( fileSave, fileSaveText ); 79 87 88 #ifndef QT_NO_PRINTER 80 89 const char * filePrintText = "Click this button to print the file you " 81 90 "are editing.\n" … … 84 93 85 94 QWhatsThis::add( filePrint, filePrintText ); 95 #endif 86 96 87 97 … … 104 114 file->setWhatsThis( id, fileSaveText ); 105 115 116 #ifndef QT_NO_PRINTER 106 117 file->insertSeparator(); 107 118 … … 109 120 this, SLOT(print()), CTRL+Key_P ); 110 121 file->setWhatsThis( id, filePrintText ); 122 #endif 111 123 112 124 file->insertSeparator(); … … 137 149 ApplicationWindow::~ApplicationWindow() 138 150 { 151 #ifndef QT_NO_PRINTER 139 152 delete printer; 153 #endif 140 154 } 141 155 … … 216 230 void ApplicationWindow::print() 217 231 { 232 #ifndef QT_NO_PRINTER 218 233 printer->setFullPage( TRUE ); 219 234 if ( printer->setup(this) ) { // printer dialog … … 254 269 statusBar()->message( "Printing aborted", 2000 ); 255 270 } 271 #endif 256 272 } 257 273
Note:
See TracChangeset
for help on using the changeset viewer.