- Timestamp:
- Jun 24, 2012, 4:48:14 PM (12 years ago)
- Location:
- trunk/BNC/src/rinex
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/rinex/graphwin.cpp
r4347 r4348 63 63 connect(_buttonClose, SIGNAL(clicked()), this, SLOT(slotClose())); 64 64 65 _buttonPrint = new QPushButton(tr("Print"), this); 66 _buttonPrint->setMaximumWidth(10*ww); 67 connect(_buttonPrint, SIGNAL(clicked()), this, SLOT(slotPrint())); 68 65 69 // Color Scale 66 70 // ----------- … … 92 96 QHBoxLayout* buttonLayout = new QHBoxLayout; 93 97 buttonLayout->addWidget(_buttonClose); 98 buttonLayout->addWidget(_buttonPrint); 94 99 95 100 QVBoxLayout* mainLayout = new QVBoxLayout(this); … … 114 119 QDialog::closeEvent(event); 115 120 } 121 122 // Print the widget 123 //////////////////////////////////////////////////////////////////////////// 124 void t_graphWin::slotPrint() { 125 126 QPrinter printer; 127 QPrintDialog* dialog = new QPrintDialog(&printer, this); 128 dialog->setWindowTitle(tr("Print Plot")); 129 if (dialog->exec() != QDialog::Accepted) { 130 return; 131 } 132 else { 133 QPainter painter; 134 painter.begin(&printer); 135 QWidget* prtWidget = this; // TODO: only a part of it? 136 double xscale = printer.pageRect().width()/double(prtWidget->width()); 137 double yscale = printer.pageRect().height()/double(prtWidget->height()); 138 double scale = qMin(xscale, yscale); 139 painter.translate(printer.paperRect().x() + printer.pageRect().width()/2, 140 printer.paperRect().y() + printer.pageRect().height()/2); 141 painter.scale(scale, scale); 142 painter.translate(-width()/2, -height()/2); 143 prtWidget->render(&painter); 144 } 145 } -
trunk/BNC/src/rinex/graphwin.h
r4337 r4348 58 58 private slots: 59 59 void slotClose(); 60 void slotPrint(); 60 61 61 62 protected: … … 64 65 private: 65 66 QPushButton* _buttonClose; 67 QPushButton* _buttonPrint; 66 68 QwtScaleWidget* _colorScale; 67 69 };
Note:
See TracChangeset
for help on using the changeset viewer.