bug2159fix.diff

Patch generated by SVN in Eclipse - Charles Timko -, 2010-05-18 10:56 AM

Download (3.91 KB)

View differences:

src/app/composer/qgscomposer.h (working copy)
41 41
class QResizeEvent;
42 42
class QFile;
43 43
class QSizeGrip;
44
class QPageSetupDialog;
45
class QPrinter;
44 46

  
45 47
/** \ingroup MapComposer
46 48
 * \brief A gui for composing a printable map.
......
118 120
    //! Print the composition
119 121
    void on_mActionPrint_triggered();
120 122

  
123
    //! Page Setup for composition
124
    void on_mActionPageSetup_triggered();
125

  
121 126
    //! Print as image
122 127
    void on_mActionExportAsImage_triggered();
123 128

  
......
201 206
    //! Save window state
202 207
    void saveWindowState();
203 208

  
204
    /**Add a composer arrow to the item/widget map and crete a configuration widget for it*/
209
    /**Add a composer arrow to the item/widget map and creates a configuration widget for it*/
205 210
    void addComposerArrow( QgsComposerArrow* arrow );
206 211

  
207 212
    /**Add a composer map to the item/widget map and creates a configuration widget for it*/
......
299 304

  
300 305
    //! Window menu action to select this window
301 306
    QAction *mWindowAction;
307

  
308
    //! Page & Printer Setup
309
    QPrinter *mPrinter;
302 310
};
303 311

  
304 312
#endif
src/ui/qgscomposerbase.ui (working copy)
474 474
    <string>Adds attribute table</string>
475 475
   </property>
476 476
  </action>
477
  <action name="mActionPageSetup">
478
   <property name="text">
479
    <string>Page Setup</string>
480
   </property>
481
  </action>
477 482
 </widget>
478 483
 <tabstops>
479 484
  <tabstop>mCompositionNameComboBox</tabstop>
src/app/composer/qgscomposer.cpp (working copy)
52 52
#include <QMatrix>
53 53
#include <QMenuBar>
54 54
#include <QMessageBox>
55
#include <QPageSetupDialog>
55 56
#include <QPainter>
56 57

  
57 58
#include <QPrinter>
......
74 75
  setupTheme();
75 76
  QObject::connect( mButtonBox, SIGNAL( rejected() ), this, SLOT( close() ) );
76 77

  
78
  // Create a default printer at mPrinter
79
  mPrinter = new QPrinter();
80

  
77 81
  QToolButton* orderingToolButton = new QToolButton( this );
78 82
  orderingToolButton->setPopupMode( QToolButton::InstantPopup );
79 83
  orderingToolButton->setAutoRaise( true );
......
137 141
  fileMenu->addAction( mActionExportAsPDF );
138 142
  fileMenu->addAction( mActionExportAsSVG );
139 143
  fileMenu->addSeparator();
144
  fileMenu->addAction( mActionPageSetup );
140 145
  fileMenu->addAction( mActionPrint );
141 146
  fileMenu->addSeparator();
142 147
  fileMenu->addAction( mActionQuit );
......
486 491

  
487 492
void QgsComposer::on_mActionPrint_triggered()
488 493
{
489
  QPrinter printer;
494
  //QPrinter printer;
490 495
  if ( mComposition )
491 496
  {
492 497
    if ( mComposition->paperWidth() >= mComposition->paperHeight() )
493 498
    {
494
      printer.setOrientation( QPrinter::Landscape );
499
      mPrinter->setOrientation( QPrinter::Landscape );
495 500
    }
496 501
    else
497 502
    {
498
      printer.setOrientation( QPrinter::Portrait );
503
      mPrinter->setOrientation( QPrinter::Portrait );
499 504
    }
500 505
  }
501
  printer.setPaperSize( QSizeF( mComposition->paperWidth(), mComposition->paperHeight() ), QPrinter::Millimeter );
502
  QPrintDialog printDialog( &printer, 0 );
506
  mPrinter->setPaperSize( QSizeF( mComposition->paperWidth(), mComposition->paperHeight() ), QPrinter::Millimeter );
507
  QPrintDialog printDialog( mPrinter, 0 );
503 508
  if ( printDialog.exec() != QDialog::Accepted )
504 509
  {
505 510
    return;
506 511
  }
507 512

  
508
  print( printer );
513
  print( *mPrinter );
509 514
}
510 515

  
511 516
void QgsComposer::print( QPrinter &printer )
......
1498 1503
  }
1499 1504
}
1500 1505

  
1506
void QgsComposer::on_mActionPageSetup_triggered()
1507
{
1508
	if ( !mComposition )
1509
		return;
1510

  
1511
	QPageSetupDialog *pageSetupDialog;
1512
	pageSetupDialog = new QPageSetupDialog(mPrinter, this);
1513

  
1514
	pageSetupDialog->show();
1501 1515

  
1516
}