Changeset 8 for trunk/examples
- Timestamp:
- Nov 16, 2005, 8:36:46 PM (20 years ago)
- Location:
- trunk/examples
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/examples/action/application.cpp
r7 r8 34 34 #include "filesave.xpm" 35 35 #include "fileopen.xpm" 36 #ifndef QT_NO_PRINTER 36 37 #include "fileprint.xpm" 38 #endif 37 39 38 40 … … 40 42 : QMainWindow( 0, "example application main window", WDestructiveClose ) 41 43 { 44 #ifndef QT_NO_PRINTER 42 45 printer = new QPrinter( QPrinter::HighResolution ); 46 #endif 43 47 44 48 QAction * fileNewAction; … … 79 83 fileSaveAsAction->setWhatsThis( fileSaveText ); 80 84 85 #ifndef QT_NO_PRINTER 81 86 filePrintAction = new QAction( "Print File", QPixmap( fileprint ), 82 87 "&Print...", CTRL+Key_P, this, "print" ); … … 88 93 "command from the File menu."; 89 94 filePrintAction->setWhatsThis( filePrintText ); 95 #else 96 Q_UNUSED( filePrintAction ) 97 #endif 90 98 91 99 fileCloseAction = new QAction( "Close", "&Close", CTRL+Key_W, this, … … 105 113 fileOpenAction->addTo( fileTools ); 106 114 fileSaveAction->addTo( fileTools ); 115 #ifndef QT_NO_PRINTER 107 116 filePrintAction->addTo( fileTools ); 117 #endif 108 118 (void)QWhatsThis::whatsThisButton( fileTools ); 109 119 … … 117 127 fileSaveAction->addTo( file ); 118 128 fileSaveAsAction->addTo( file ); 129 #ifndef QT_NO_PRINTER 119 130 file->insertSeparator(); 120 131 filePrintAction->addTo( file ); 132 #endif 121 133 file->insertSeparator(); 122 134 fileCloseAction->addTo( file ); … … 150 162 ApplicationWindow::~ApplicationWindow() 151 163 { 164 #ifndef QT_NO_PRINTER 152 165 delete printer; 166 #endif 153 167 } 154 168 … … 228 242 void ApplicationWindow::print() 229 243 { 244 #ifndef QT_NO_PRINTER 230 245 printer->setFullPage( TRUE ); 231 246 if ( printer->setup(this) ) { // printer dialog … … 266 281 statusBar()->message( "Printing aborted", 2000 ); 267 282 } 283 #endif 268 284 } 269 285 -
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 -
trunk/examples/examples.pro
r7 r8 122 122 x11:SUBDIRS += biff \ 123 123 desktop 124 125 ## @todo (dmik): examples below are substracted until implemented 126 127 os2:SUBDIRS -= \ 128 demo \ 129 dirview \ 130 distributor \ 131 dragdrop \ 132 drawdemo \ 133 extension \ 134 helpdemo \ 135 movies \ 136 process \ 137 qdir \ 138 tetrix \ 139 tux \ 140 widgets -
trunk/examples/menu/menu.cpp
r7 r8 152 152 options->insertTearOffHandle(); 153 153 options->setCaption("Options"); 154 options->insertItem( "&Normal Font", this, SLOT(normal()) ); 154 155 options->polish(); // adjust system settings 156 QFont of( options->font().family(), options->font().pointSize() ); 157 int normID = options->insertItem( new MyMenuItem( "&Normal Font", of ) ); 158 options->connectItem( normID, this, SLOT(normal()) ); 155 159 options->insertSeparator(); 156 157 options->polish(); // adjust system settings 158 QFont f = options->font(); 160 QFont f = QFont( of ); 159 161 f.setBold( TRUE ); 160 162 boldID = options->insertItem( new MyMenuItem( "Bold", f ) ); 161 163 options->setAccel( CTRL+Key_B, boldID ); 162 164 options->connectItem( boldID, this, SLOT(bold()) ); 163 f = font();165 f = QFont( of ); 164 166 f.setUnderline( TRUE ); 165 167 underlineID = options->insertItem( new MyMenuItem( "Underline", f ) );
Note:
See TracChangeset
for help on using the changeset viewer.