void MainWindow::keyPressEvent(QKeyEvent *e) { if(e->key()==Qt::Key_Return){ actionPreview(); }else{ QMainWindow::keyPressEvent(e); } }
Html_Viewer::Html_Viewer() : QMainWindow(), ui(new Ui::Html_Form) { QWidget *temp = new QWidget(this); setCentralWidget(temp); ui->setupUi(temp); setWindowTitle("Html Viewer"); createActions(); setStartupText(); // signals connect(ui->webView, SIGNAL(loadFinished(bool)), this, SLOT(updateTextEdit())); connect(ui->clearPB, SIGNAL(clicked()), ui->plainTextEdit, SLOT(clear()) ); connect(ui->previewPB, SIGNAL(clicked()), this, SLOT(actionPreview()) ); }