void MainWindow::on_actionHelp_triggered() { // generic help QTextEdit *pTxt = new QTextEdit(this); pTxt->setWindowFlags(Qt::Window); //or Qt::Tool, Qt::Dialog if you like pTxt->setReadOnly(true); pTxt->append("qPicView by Ilkka Prusi 2011"); pTxt->append(""); pTxt->append("This program is free to use and distribute. No warranties of any kind."); pTxt->append("Program uses Qt 4.7.1 under LGPL v. 2.1"); pTxt->append(""); pTxt->append("Keyboard shortcuts:"); pTxt->append(""); pTxt->append("* = resize/fit"); pTxt->append("+ = zoom in"); pTxt->append("- = zoom out"); pTxt->append("Left = previous"); pTxt->append("Right = next"); pTxt->append("Up/Down = scroll"); pTxt->append(""); pTxt->append("F = open file"); pTxt->append("F1 = help (this)"); pTxt->append("F11 = fullscreen toggle"); pTxt->append("Esc = close"); pTxt->append(""); pTxt->append("Tip: set as default program :)"); pTxt->show(); }
void FQTermImageOrigin::showFullExifInfo() { QString exifInfo = QString::fromStdString(exifExtractor_->extractExifInfo(model_->filePath(tree_->currentIndex()).toLocal8Bit().data())); QString comment; if ((*exifExtractor_)["UserComment"].length() > 8) { QString commentEncoding = QString::fromStdString((*exifExtractor_)["UserComment"].substr(0, 8)); if (commentEncoding.startsWith("UNICODE")) { //UTF-16 QTextCodec* c = QTextCodec::codecForName("UTF-16"); comment = c->toUnicode((*exifExtractor_)["UserComment"].substr(8).c_str()); } else if (commentEncoding.startsWith("JIS")) { //JIS X 0208 QTextCodec* c = QTextCodec::codecForName("JIS X 0208"); comment = c->toUnicode((*exifExtractor_)["UserComment"].substr(8).c_str()); } else { comment = QString::fromStdString((*exifExtractor_)["UserComment"].substr(8)); } } QTextEdit* info = new QTextEdit; info->setText(exifInfo + tr("Comment : ") + comment + "\n"); info->setWindowFlags(Qt::Dialog); info->setAttribute(Qt::WA_DeleteOnClose); info->setAttribute(Qt::WA_ShowModal); // info->setLineWrapMode(QTextEdit::NoWrap); info->setReadOnly(true); QFontMetrics fm(font()); info->resize(fm.width("Orientation : 1st row - 1st col : top - left side "), fm.height() * 20); info->show(); }
void MainWindow::on_actionAbout_triggered() { QTextEdit *pTxt = new QTextEdit(this); pTxt->setWindowFlags(Qt::Window); //or Qt::Tool, Qt::Dialog if you like pTxt->setReadOnly(true); pTxt->append("qIffTool by Ilkka Prusi 2011"); pTxt->append(""); pTxt->append("This program is free to use and distribute. No warranties of any kind."); pTxt->append("Program uses Qt 4.7.2 under LGPL v. 2.1"); pTxt->append(""); pTxt->append("Keyboard shortcuts:"); pTxt->append(""); pTxt->append("F = open file"); pTxt->append("Esc = close"); pTxt->append("? = about (this dialog)"); pTxt->append(""); pTxt->show(); }
void ComputationalResultsTableView::showLogFile() { MongoDatabase *db = MongoDatabase::instance(); mongo::GridFS fs(*db->connection(), "chem", "fs"); mongo::BSONObj *obj = static_cast<mongo::BSONObj *>(currentIndex().internalPointer()); if (obj) { const char *file_name = obj->getStringField("log_file"); mongo::GridFile file = fs.findFile(file_name); if (!file.exists()) { QMessageBox::critical(this, "Error", "Failed to load output file."); return; } // load file into a buffer std::stringstream stream; file.write(stream); QTextEdit *viewer = new QTextEdit(this); viewer->resize(500, 600); viewer->setWindowFlags(Qt::Dialog); viewer->setWindowTitle(file_name); viewer->setReadOnly(true); std::string file_data_string = stream.str(); viewer->setText(file_data_string.c_str()); viewer->show(); } else { QMessageBox::critical(this, "Error", "Failed to load output file."); } }
// ------------------------------------------------------------------------- void ctkQImageView::keyPressEvent( QKeyEvent * event ) { Q_D( ctkQImageView ); if( d->SliceNumber >= 0 && d->SliceNumber < d->ImageList.size() ) { switch( event->key() ) { case Qt::Key_H: { QTextEdit * help = new QTextEdit(); help->setWindowFlags( Qt::Window ); help->setMinimumSize( 500, 500 ); help->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ); help->setReadOnly( true ); help->append("<h1>CTK Simple Image Viewer Widget</h1>"); help->append("Contributed by: Kitware, Inc.<br>"); help->append("<h3>Keyboard commands:</h3>"); help->append(" <em>q</em> : quit"); help->append(" <em>h</em> : display this help"); help->append(" <em>i</em> : invert intensities"); help->append(" <em>[ ]</em> : increase / decrease zoom"); help->append(" <em>x y</em> : flip along the x / y axis"); help->append(" <em>r</em> : reset to initial conditions"); help->append(" <em>spacebar</em> : toggle continuous tracking of cursor"); help->append(" <em>up-arrow down-arrow</em> : change to next / previous slice"); help->append("<h3>Mouse commands:</h3>"); help->append(" <em>left-button</em> : window and level"); help->append(" <em>middle-button</em> : zoom"); help->append(" <em>right-button</em> : center"); help->show(); break; } case Qt::Key_Space: { d->Window->setMouseTracking( ! d->Window->hasMouseTracking() ); break; } case Qt::Key_X: { this->setFlipXAxis( ! this->flipXAxis() ); break; } case Qt::Key_Y: { this->setFlipYAxis( ! this->flipYAxis() ); break; } case Qt::Key_T: { this->setTransposeXY( ! this->transposeXY() ); break; } case Qt::Key_BracketRight: { this->setZoom( this->zoom() * 1.1 ); break; } case Qt::Key_BracketLeft: { this->setZoom( this->zoom() * 0.9 ); break; } case Qt::Key_I: { this->setInvertImage( ! this->invertImage() ); this->update( false, false ); break; } case Qt::Key_Q: { exit( EXIT_SUCCESS ); break; } case Qt::Key_R: { this->reset(); break; } case Qt::Key_Up: { this->setSliceNumber( d->SliceNumber+1 ); break; } case Qt::Key_Down: { this->setSliceNumber( d->SliceNumber-1 ); break; } default: { event->ignore(); } }; } }