#includeint main(int argc, char *argv[]) { GtkWidget *about_dialog; gtk_init(&argc, &argv); about_dialog = gtk_about_dialog_new (); gtk_about_dialog_set_program_name (GTK_ABOUT_DIALOG (about_dialog), "My Application"); gtk_about_dialog_set_version (GTK_ABOUT_DIALOG (about_dialog), "1.0"); gtk_about_dialog_set_license (GTK_ABOUT_DIALOG (about_dialog), "Copyright (c) 2021"); gtk_dialog_run (GTK_DIALOG (about_dialog)); gtk_widget_destroy (about_dialog); return 0; }
#includeThis example shows how to use AboutDialog in the Qt library to create an about dialog box for an application. The application name, version number, and copyright information are set using a QLabel.#include #include #include #include #include #include #include int main(int argc, char *argv[]) { QApplication app(argc, argv); QDialog about_dialog; about_dialog.setWindowTitle("About My Application"); QVBoxLayout* layout = new QVBoxLayout(&about_dialog); QLabel* label = new QLabel; label->setText(" " " My Application
Version: 1.0 " "Copyright (c) 2021 "); label->setAlignment(Qt::AlignCenter); layout->addWidget(label); QDialogButtonBox* button_box = new QDialogButtonBox(QDialogButtonBox::Ok); layout->addWidget(button_box); QObject::connect(button_box, SIGNAL(accepted()), &about_dialog, SLOT(accept())); about_dialog.exec(); return 0; }