void HighlighterByKate::highlight(const string& plain, const string type, std::ostream& out) { m_note->setText(QString::fromUtf8(plain.c_str())); m_note->setHighlightingMode(QString::fromStdString(type.empty() ? "None" : mimeMap[type])); out << exportDocument(m_note).toUtf8().constData(); }
void plotsDialog::on_exportMenuButton_triggered(QAction *arg1) { if(arg1->text() == "Print") print(); else if(arg1->text() == "pdf File") exportDocument(); // else if(arg1->text() == "Data") // qDebug()<<"They want data!"; }
void MainWindow::initMenuFile() { //connect menu "File" Action connect(actionNew, SIGNAL(triggered()), _documentManager, SLOT(newDocument())); connect(actionOpen, SIGNAL(triggered()), _documentManager, SLOT(open())); connect(actionSave, SIGNAL(triggered()), _documentManager, SLOT(save())); connect(actionSaveAs, SIGNAL(triggered()), _documentManager, SLOT(saveAs())); connect(actionSaveACopyAs, SIGNAL(triggered()), _documentManager, SLOT(saveACopyAs())); connect(actionSaveAll, SIGNAL(triggered()), _documentManager, SLOT(saveAll())); connect(actionClose, SIGNAL(triggered()), _documentManager, SLOT(close())); connect(actionCloseAll, SIGNAL(triggered()), _documentManager, SLOT(closeAll())); connect(actionCloseAllExceptCurrentDocument, SIGNAL(triggered()), _documentManager, SLOT(closeAllExceptCurrentDocument())); connect(actionReload, SIGNAL(triggered()), _documentManager, SLOT(reload())); connect(actionPrint, SIGNAL(triggered()), _documentManager, SLOT(print())); connect(actionExit, SIGNAL(triggered()), qApp, SLOT(closeAllWindows())); connect(actionExportAsHTML, SIGNAL(triggered()), this, SLOT(exportDocument())); connect(actionNewSession, SIGNAL(triggered()), _sessionManager, SLOT(newSession())); connect(actionOpenSession, SIGNAL(triggered()), _sessionManager, SLOT(openSession())); connect(actionSwitchSession, SIGNAL(triggered()), _sessionManager, SLOT(switchSession())); connect(actionSaveSession, SIGNAL(triggered()), _sessionManager, SLOT(saveSession())); connect(actionSaveSessionAs, SIGNAL(triggered()), _sessionManager, SLOT(saveSessionAs())); connect(actionManageSessions, SIGNAL(triggered()), _sessionManager, SLOT(manageSessions())); //recent file actions connect(actionEmptyRecentFilesList, SIGNAL(triggered()), this, SLOT(clearRecentFile())); connect(actionOpenAllRecentFiles, SIGNAL(triggered()), this, SLOT(openAllRecentFile())); _recentFileSeparator = menuRecentFiles->addSeparator(); for (int i = 0; i < MaxRecentFiles; ++i) { _recentFileActions[i] = new QAction(this); _recentFileActions[i]->setVisible(false); connect(_recentFileActions[i], SIGNAL(triggered()),this, SLOT(openRecentFile())); menuRecentFiles->addAction(_recentFileActions[i]); } updateRecentFileActions(); }
MainWindow::MainWindow( QWidget *parent ): QMainWindow( parent ) { QWidget *w = new QWidget( this ); d_plot = new Plot( w ); d_panner = new QwtPolarPanner( d_plot->canvas() ); d_panner->setEnabled( false ); d_zoomer = new QwtPolarMagnifier( d_plot->canvas() ); d_zoomer->setEnabled( false ); d_settingsEditor = new SettingsEditor( w ); d_settingsEditor->showSettings( d_plot->settings() ); connect( d_settingsEditor, SIGNAL( edited( const PlotSettings & ) ), d_plot, SLOT( applySettings( const PlotSettings & ) ) ); QHBoxLayout *layout = new QHBoxLayout( w ); layout->addWidget( d_settingsEditor, 0 ); layout->addWidget( d_plot, 10 ); setCentralWidget( w ); QToolBar *toolBar = new QToolBar( this ); QToolButton *btnZoom = new QToolButton( toolBar ); const QString zoomHelp = "Use the wheel to zoom in/out.\n" "When the plot is zoomed in,\n" "use the left mouse button to move it."; btnZoom->setText( "Zoom" ); btnZoom->setIcon( QPixmap( zoom_xpm ) ); btnZoom->setToolButtonStyle( Qt::ToolButtonTextUnderIcon ); btnZoom->setToolTip( zoomHelp ); btnZoom->setCheckable( true ); toolBar->addWidget( btnZoom ); connect( btnZoom, SIGNAL( toggled( bool ) ), SLOT( enableZoomMode( bool ) ) ); QToolButton *btnPrint = new QToolButton( toolBar ); btnPrint->setText( "Print" ); btnPrint->setIcon( QPixmap( print_xpm ) ); btnPrint->setToolButtonStyle( Qt::ToolButtonTextUnderIcon ); toolBar->addWidget( btnPrint ); connect( btnPrint, SIGNAL( clicked() ), SLOT( printDocument() ) ); #ifdef QT_SVG_LIB QToolButton *btnExport = new QToolButton( toolBar ); btnExport->setText( "Export" ); btnExport->setIcon( QPixmap( print_xpm ) ); btnExport->setToolButtonStyle( Qt::ToolButtonTextUnderIcon ); toolBar->addWidget( btnExport ); connect( btnExport, SIGNAL( clicked() ), SLOT( exportDocument() ) ); #endif addToolBar( toolBar ); }
MainWindow::MainWindow( QWidget *parent ): QMainWindow( parent ) { d_plot = new Plot( this ); const int margin = 5; d_plot->setContentsMargins( margin, margin, margin, 0 ); setContextMenuPolicy( Qt::NoContextMenu ); d_zoomer[0] = new Zoomer( QwtPlot::xBottom, QwtPlot::yLeft, d_plot->canvas() ); d_zoomer[0]->setRubberBand( QwtPicker::RectRubberBand ); d_zoomer[0]->setRubberBandPen( QColor( Qt::green ) ); d_zoomer[0]->setTrackerMode( QwtPicker::ActiveOnly ); d_zoomer[0]->setTrackerPen( QColor( Qt::white ) ); d_zoomer[1] = new Zoomer( QwtPlot::xTop, QwtPlot::yRight, d_plot->canvas() ); d_panner = new QwtPlotPanner( d_plot->canvas() ); d_panner->setMouseButton( Qt::MidButton ); d_picker = new QwtPlotPicker( QwtPlot::xBottom, QwtPlot::yLeft, QwtPlotPicker::CrossRubberBand, QwtPicker::AlwaysOn, d_plot->canvas() ); d_picker->setStateMachine( new QwtPickerDragPointMachine() ); d_picker->setRubberBandPen( QColor( Qt::green ) ); d_picker->setRubberBand( QwtPicker::CrossRubberBand ); d_picker->setTrackerPen( QColor( Qt::white ) ); setCentralWidget( d_plot ); QToolBar *toolBar = new QToolBar( this ); QToolButton *btnZoom = new QToolButton( toolBar ); btnZoom->setText( "Zoom" ); btnZoom->setIcon( QPixmap( zoom_xpm ) ); btnZoom->setCheckable( true ); btnZoom->setToolButtonStyle( Qt::ToolButtonTextUnderIcon ); toolBar->addWidget( btnZoom ); connect( btnZoom, SIGNAL( toggled( bool ) ), SLOT( enableZoomMode( bool ) ) ); #ifndef QT_NO_PRINTER QToolButton *btnPrint = new QToolButton( toolBar ); btnPrint->setText( "Print" ); btnPrint->setIcon( QPixmap( print_xpm ) ); btnPrint->setToolButtonStyle( Qt::ToolButtonTextUnderIcon ); toolBar->addWidget( btnPrint ); connect( btnPrint, SIGNAL( clicked() ), SLOT( print() ) ); #endif QToolButton *btnExport = new QToolButton( toolBar ); btnExport->setText( "Export" ); btnExport->setIcon( QPixmap( print_xpm ) ); btnExport->setToolButtonStyle( Qt::ToolButtonTextUnderIcon ); toolBar->addWidget( btnExport ); connect( btnExport, SIGNAL( clicked() ), SLOT( exportDocument() ) ); toolBar->addSeparator(); QWidget *hBox = new QWidget( toolBar ); QHBoxLayout *layout = new QHBoxLayout( hBox ); layout->setSpacing( 0 ); layout->addWidget( new QWidget( hBox ), 10 ); // spacer layout->addWidget( new QLabel( "Damping Factor", hBox ), 0 ); layout->addSpacing( 10 ); QwtCounter *cntDamp = new QwtCounter( hBox ); cntDamp->setRange( 0.0, 5.0, 0.01 ); cntDamp->setValue( 0.0 ); layout->addWidget( cntDamp, 0 ); ( void )toolBar->addWidget( hBox ); addToolBar( toolBar ); #ifndef QT_NO_STATUSBAR ( void )statusBar(); #endif enableZoomMode( false ); showInfo(); connect( cntDamp, SIGNAL( valueChanged( double ) ), d_plot, SLOT( setDamp( double ) ) ); connect( d_picker, SIGNAL( moved( const QPoint & ) ), SLOT( moved( const QPoint & ) ) ); connect( d_picker, SIGNAL( selected( const QPolygon & ) ), SLOT( selected( const QPolygon & ) ) ); }