Exemple #1
0
 private void about() {
   QMessageBox.about(
       this,
       tr("About Icons"),
       tr(
           "The <b>Icons</b> example illustrates how Qt renders an icon in "
               + "different modes (active, normal, disabled, and selected) and "
               + "states (on and off) based on a set of images."));
 }
 private void about() {
   QMessageBox.about(
       this,
       tr("About Scribble"),
       tr(
           "<p>The <b>Scribble</b> example shows how to use QMainWindow as the "
               + "base widget for an application, and how to reimplement some of "
               + "QWidget's event handlers to receive the events generated for "
               + "the application's widgets:</p><p> We reimplement the mouse event "
               + "handlers to facilitate drawing, the paint event handler to "
               + "update the application and the resize event handler to optimize "
               + "the application's appearance. In addition we reimplement the "
               + "close event handler to intercept the close events before "
               + "terminating the application.</p><p> The example also demonstrates "
               + "how to use QPainter to draw an image in real time, as well as "
               + "to repaint widgets.</p>"));
 }
  private boolean maybeSave() {
    if (scribbleArea.isModified()) {
      QMessageBox.StandardButton ret;
      ret =
          QMessageBox.warning(
              this,
              tr("Scribble"),
              tr("The image has been modified.\n" + "Do you want to save your changes?"),
              new QMessageBox.StandardButtons(
                  QMessageBox.StandardButton.Save, QMessageBox.StandardButton.Discard));

      if (ret == QMessageBox.StandardButton.Save) {
        return saveFile("png");
      } else if (ret == QMessageBox.StandardButton.Cancel) {
        return false;
      }
    }
    return true;
  }