- Timestamp:
- Sep 1, 2012, 2:57:37 PM (12 years ago)
- Location:
- trunk/BNC/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/bncmap.h
r4627 r4630 16 16 public slots: 17 17 void slotNewPoint(const QString& name, double latDeg, double lonDeg); 18 18 19 private slots: 20 void slotClose(); 21 void slotPrint(); 22 23 protected: 24 virtual void closeEvent(QCloseEvent *); 25 19 26 private: 20 QwtPlot* _mapPlot; 27 QwtPlot* _mapPlot; 28 QPushButton* _buttonClose; 29 QPushButton* _buttonPrint; 21 30 }; 22 31 -
trunk/BNC/src/bncmap_svg.cpp
r4629 r4630 17 17 t_bncMap::t_bncMap(QWidget* parent) : QDialog(parent) { 18 18 19 // Map in Scalable Vector Graphics (svg) Format 20 // -------------------------------------------- 19 21 _mapPlot = new QwtPlot(); 20 22 … … 28 30 mapItem->attach(_mapPlot); 29 31 32 // Buttons 33 // ------- 34 int ww = QFontMetrics(font()).width('w'); 35 36 _buttonClose = new QPushButton(tr("Close"), this); 37 _buttonClose->setMaximumWidth(10*ww); 38 connect(_buttonClose, SIGNAL(clicked()), this, SLOT(slotClose())); 39 40 _buttonPrint = new QPushButton(tr("Print"), this); 41 _buttonPrint->setMaximumWidth(10*ww); 42 connect(_buttonPrint, SIGNAL(clicked()), this, SLOT(slotPrint())); 43 44 // Layout 45 // ------ 46 QHBoxLayout* buttonLayout = new QHBoxLayout; 47 buttonLayout->addWidget(_buttonClose); 48 buttonLayout->addWidget(_buttonPrint); 49 30 50 QVBoxLayout* mainLayout = new QVBoxLayout(this); 31 51 mainLayout->addWidget(_mapPlot); 52 mainLayout->addLayout(buttonLayout); 32 53 54 // Important 55 // --------- 33 56 _mapPlot->replot(); 34 57 } … … 54 77 } 55 78 79 // Close 80 //////////////////////////////////////////////////////////////////////////// 81 void t_bncMap::slotClose() { 82 done(0); 83 } 56 84 85 // Close Dialog gracefully 86 //////////////////////////////////////////////////////////////////////////// 87 void t_bncMap::closeEvent(QCloseEvent* event) { 88 QDialog::closeEvent(event); 89 } 57 90 91 // Print the widget 92 //////////////////////////////////////////////////////////////////////////// 93 void t_bncMap::slotPrint() { 94 95 QPrinter printer; 96 QPrintDialog* dialog = new QPrintDialog(&printer, this); 97 dialog->setWindowTitle(tr("Print Plot")); 98 if (dialog->exec() != QDialog::Accepted) { 99 return; 100 } 101 else { 102 qDebug() << "Print Map"; 103 } 104 }
Note:
See TracChangeset
for help on using the changeset viewer.