#define tr QObject::tr QTextCodec::setCodecForTr( QTextCodec::codecForName("UTF-8"));int seconds = 60;int minutes = 1;textEdit->setText( tr("Введенное количество секунд ")+QString::number(seconds) + tr(" соответствует ") \ + QString::number(minutes) + tr(" минуте " ));
#ifndef PROGA1_ABOUT_H#define PROGA1_ABOUT_H#include <QWidget>#include <QObject>#include "ui_proga1_about.h"class about : public QWidget, Ui::About{ Q_OBJECTpublic: QWidget *about = new QWidget;};#endif // PROGA1_ABOUT_H
#ifndef PROGA1_H#define PROGA1_H#include <QMainWindow>#include <QObject>#include "ui_proga1.h"#include "ui_proga1_about.h"class MainWindow : public QMainWindow, Ui::MainWindow // наследование от QMainWindow и Ui::MainWindow{ Q_OBJECTpublic: MainWindow(QMainWindow* p = 0) : QMainWindow(p) //Передача параметров конструктору базового класса { setupUi(this); connect(pushButton, SIGNAL(clicked()), this, SLOT(rasschet())); connect(kn_about, SIGNAL(triggered()), &about, SLOT(OpenWindows())); }public slots: void rasschet(); void OpenWindows() { emit open(); } void CloseWindows() { emit close(); }};#endif
class MyAbout : public QWidget, Ui::About{ Q_OBJECT void Init( void ) { about = new QWidget(); }public: QWidget *about;};
#ifndef PROGA1_ABOUT_H#define PROGA1_ABOUT_H#include <QWidget>#include <QObject>#include "ui_proga1_about.h"class MyAbout : public QWidget, Ui::About{ Q_OBJECT void Init(void) { about = new QWidget(); }public: QWidget *about;};#endif // PROGA1_ABOUT_H
/********************************************************************************** Form generated from reading ui file 'proga1_about.ui'**** Created: Thu 5. Nov 20:09:36 2009** by: Qt User Interface Compiler version 4.4.3**** WARNING! All changes made in this file will be lost when recompiling ui file!********************************************************************************/#ifndef UI_PROGA1_ABOUT_H#define UI_PROGA1_ABOUT_H#include <QtCore/QVariant>#include <QtGui/QAction>#include <QtGui/QApplication>#include <QtGui/QButtonGroup>#include <QtGui/QLabel>#include <QtGui/QPushButton>#include <QtGui/QWidget>QT_BEGIN_NAMESPACEclass Ui_About{public: QPushButton *pushButton; QLabel *label; QLabel *label_2; void setupUi(QWidget *About) { if (About->objectName().isEmpty()) About->setObjectName(QString::fromUtf8("About")); About->resize(290, 90); About->setMinimumSize(QSize(290, 90)); About->setMaximumSize(QSize(290, 90)); About->setStyleSheet(QString::fromUtf8("")); pushButton = new QPushButton(About); pushButton->setObjectName(QString::fromUtf8("pushButton")); pushButton->setGeometry(QRect(110, 60, 75, 23)); label = new QLabel(About); label->setObjectName(QString::fromUtf8("label")); label->setGeometry(QRect(20, 10, 251, 16)); label_2 = new QLabel(About); label_2->setObjectName(QString::fromUtf8("label_2")); label_2->setGeometry(QRect(20, 30, 231, 16)); retranslateUi(About); QObject::connect(pushButton, SIGNAL(pressed()), About, SLOT(close())); QMetaObject::connectSlotsByName(About); } // setupUi void retranslateUi(QWidget *About) { About->setWindowTitle(QApplication::translate("About", "\320\236 \320\277\321\200\320\276\320\263\321\200\320\260\320\274\320\274\320\265", 0, QApplication::UnicodeUTF8)); pushButton->setText(QApplication::translate("About", "\320\227\320\260\320\272\321\200\321\213\321\202\321\214", 0, QApplication::UnicodeUTF8)); label->setText(QApplication::translate("About", "\320\237\321\200\320\276\320\263\321\200\320\260\320\274\320\274\320\260 \320\277\320\265\321\200\320\265\320\262\320\276\320\264\320\270\321\202 \320\267\320\260\320\264\320\260\320\275\320\275\321\213\320\265 \321\201 \320\272\320\273\320\260\320\262\320\270\320\260\321\202\321\203\321\200\321\213", 0, QApplication::UnicodeUTF8)); label_2->setText(QApplication::translate("About", "\321\201\320\265\320\272\321\203\320\275\320\264\321\213 \320\262 \320\262\320\270\320\264 \320\247\320\247:\320\234\320\234:\320\241\320\241", 0, QApplication::UnicodeUTF8)); Q_UNUSED(About); } // retranslateUi};namespace Ui { class About: public Ui_About {};} // namespace UiQT_END_NAMESPACE#endif // UI_PROGA1_ABOUT_H
#include <QApplication>#include <QtCore>#include <QTextCodec>#include "proga2.h"int main(int argc, char *argv[]){ QApplication app(argc, argv); MainWindow w; w.show(); return app.exec();}
/********************************************************************************** Form generated from reading ui file 'proga1.ui'**** Created: Fri 30. Oct 15:48:49 2009** by: Qt User Interface Compiler version 4.4.3**** WARNING! All changes made in this file will be lost when recompiling ui file!********************************************************************************/#ifndef UI_PROGA1_H#define UI_PROGA1_H#include <QtCore/QVariant>#include <QtGui/QAction>#include <QtGui/QApplication>#include <QtGui/QButtonGroup>#include <QtGui/QLabel>#include <QtGui/QMainWindow>#include <QtGui/QMenu>#include <QtGui/QMenuBar>#include <QtGui/QPushButton>#include <QtGui/QSpinBox>#include <QtGui/QStatusBar>#include <QtGui/QTextEdit>#include <QtGui/QWidget>QT_BEGIN_NAMESPACEclass Ui_MainWindow{public: QAction *action_4; QAction *action_5; QAction *action_6; QAction *action_7; QAction *action_Ctrl_Q; QWidget *centralwidget; QSpinBox *spinBox; QTextEdit *textEdit; QPushButton *pushButton; QPushButton *pushButton_2; QLabel *label; QLabel *label_2; QStatusBar *statusbar; QMenuBar *menubar; QMenu *menu; QMenu *menu_2; QMenu *menu_3; void setupUi(QMainWindow *MainWindow) { if (MainWindow->objectName().isEmpty()) MainWindow->setObjectName(QString::fromUtf8("MainWindow")); MainWindow->setWindowModality(Qt::ApplicationModal); MainWindow->setEnabled(true); MainWindow->resize(600, 600); MainWindow->setMinimumSize(QSize(385, 294)); MainWindow->setMaximumSize(QSize(600, 600)); action_4 = new QAction(MainWindow); action_4->setObjectName(QString::fromUtf8("action_4")); action_4->setCheckable(true); action_4->setChecked(true); action_5 = new QAction(MainWindow); action_5->setObjectName(QString::fromUtf8("action_5")); action_5->setCheckable(true); action_6 = new QAction(MainWindow); action_6->setObjectName(QString::fromUtf8("action_6")); action_7 = new QAction(MainWindow); action_7->setObjectName(QString::fromUtf8("action_7")); action_Ctrl_Q = new QAction(MainWindow); action_Ctrl_Q->setObjectName(QString::fromUtf8("action_Ctrl_Q")); centralwidget = new QWidget(MainWindow); centralwidget->setObjectName(QString::fromUtf8("centralwidget")); spinBox = new QSpinBox(centralwidget); spinBox->setObjectName(QString::fromUtf8("spinBox")); spinBox->setGeometry(QRect(50, 40, 161, 22)); spinBox->setMaximum(10000000); textEdit = new QTextEdit(centralwidget); textEdit->setObjectName(QString::fromUtf8("textEdit")); textEdit->setGeometry(QRect(50, 110, 301, 71)); //textEdit->setReadOnly(true); pushButton = new QPushButton(centralwidget); pushButton->setObjectName(QString::fromUtf8("pushButton")); pushButton->setGeometry(QRect(250, 40, 101, 21)); pushButton_2 = new QPushButton(centralwidget); pushButton_2->setObjectName(QString::fromUtf8("pushButton_2")); pushButton_2->setGeometry(QRect(160, 210, 75, 23)); label = new QLabel(centralwidget); label->setObjectName(QString::fromUtf8("label")); label->setGeometry(QRect(50, 20, 500, 16)); label_2 = new QLabel(centralwidget); label_2->setObjectName(QString::fromUtf8("label_2")); label_2->setGeometry(QRect(50, 90, 151, 16)); MainWindow->setCentralWidget(centralwidget); statusbar = new QStatusBar(MainWindow); statusbar->setObjectName(QString::fromUtf8("statusbar")); MainWindow->setStatusBar(statusbar); menubar = new QMenuBar(MainWindow); menubar->setObjectName(QString::fromUtf8("menubar")); menubar->setGeometry(QRect(0, 0, 385, 22)); menu = new QMenu(menubar); menu->setObjectName(QString::fromUtf8("menu")); menu_2 = new QMenu(menubar); menu_2->setObjectName(QString::fromUtf8("menu_2")); menu_3 = new QMenu(menubar); menu_3->setObjectName(QString::fromUtf8("menu_3")); MainWindow->setMenuBar(menubar); QWidget::setTabOrder(spinBox, pushButton); QWidget::setTabOrder(pushButton, textEdit); QWidget::setTabOrder(textEdit, pushButton_2); menubar->addAction(menu->menuAction()); menubar->addAction(menu_2->menuAction()); menubar->addAction(menu_3->menuAction()); menu->addAction(action_6); menu->addAction(action_7); menu->addAction(action_Ctrl_Q); menu_2->addAction(action_4); menu_2->addAction(action_5); retranslateUi(MainWindow); QObject::connect(pushButton_2, SIGNAL(clicked()), MainWindow, SLOT(close())); QObject::connect(action_Ctrl_Q, SIGNAL(triggered()), MainWindow, SLOT(close())); QMetaObject::connectSlotsByName(MainWindow); } // setupUi void retranslateUi(QMainWindow *MainWindow) { MainWindow->setWindowTitle(QApplication::translate("MainWindow", "\320\237\321\200\320\276\320\263\321\200\320\260\320\274\320\274\320\260 \342\204\2261 :)", 0, QApplication::UnicodeUTF8)); action_4->setText(QApplication::translate("MainWindow", "\320\240\321\203\321\201\321\201\320\272\320\270\320\271", 0, QApplication::UnicodeUTF8)); action_5->setText(QApplication::translate("MainWindow", "\320\220\320\275\320\263\320\273\320\270\320\271\321\201\320\272\320\270\320\271", 0, QApplication::UnicodeUTF8)); action_6->setText(QApplication::translate("MainWindow", "\320\236 \320\277\321\200\320\276\320\263\321\200\320\260\320\274\320\274\320\265", 0, QApplication::UnicodeUTF8)); action_7->setText(QApplication::translate("MainWindow", "\320\236\320\261 \320\260\320\262\321\202\320\276\321\200\320\265", 0, QApplication::UnicodeUTF8)); action_Ctrl_Q->setText(QApplication::translate("MainWindow", "\320\222\321\213\321\205\320\276\320\264", 0, QApplication::UnicodeUTF8)); pushButton->setText(QApplication::translate("MainWindow", "\320\240\320\260\321\201\321\201\321\207\320\270\321\202\320\260\321\202\321\214", 0, QApplication::UnicodeUTF8)); pushButton_2->setText(QApplication::translate("MainWindow", "\320\222\321\213\321\205\320\276\320\264", 0, QApplication::UnicodeUTF8)); label->setText(QApplication::translate("MainWindow", "\320\222\320\262\320\265\320\264\320\270\321\202\320\265 \320\272\320\276\320\273\320\270\321\207\320\265\321\201\321\202\320\262\320\276 \321\201\320\265\320\272\321\203\320\275\320\264", 0, QApplication::UnicodeUTF8)); label_2->setText(QApplication::translate("MainWindow", "\320\240\320\265\320\267\321\203\320\273\321\214\321\202\320\260\321\202 \321\200\320\260\320\261\320\276\321\202\321\213 \320\277\321\200\320\276\320\263\321\200\320\260\320\274\320\274\321\213", 0, QApplication::UnicodeUTF8)); menu->setTitle(QApplication::translate("MainWindow", "\320\244\320\260\320\271\320\273", 0, QApplication::UnicodeUTF8)); menu_2->setTitle(QApplication::translate("MainWindow", "\320\257\320\267\321\213\320\272", 0, QApplication::UnicodeUTF8)); menu_3->setTitle(QApplication::translate("MainWindow", "\320\237\320\276\320\274\320\276\321\211\321\214", 0, QApplication::UnicodeUTF8)); } // retranslateUi};namespace Ui { class MainWindow: public Ui_MainWindow {};} // namespace UiQT_END_NAMESPACE#endif // UI_PROGA1_H
#ifndef PROGA1_H#define PROGA1_H#include <QMainWindow>#include <QObject>#include "ui_proga2.h"class MainWindow : public QMainWindow, Ui::MainWindow // <--------!!!!!!!!!!!!!!!!!!!!!!{ Q_OBJECTpublic: MainWindow(QMainWindow* p = 0) : QMainWindow(p) { setupUi(this); connect(pushButton, SIGNAL(clicked()), this, SLOT(rasschet())); connect(action_6, SIGNAL(triggered()), this, SLOT(about())); }public slots: void rasschet(); void about();};#endif
#include <QtCore>#include <QTextCodec>#include <QtGui> #include "proga2.h"#include "ui_proga2.h"#include <QObject>#define tr QObject::trvoid MainWindow::rasschet(){QTextCodec::setCodecForTr( QTextCodec::codecForName("UTF-8"));int seconds = 60;int minutes = 1;textEdit->setText( tr("Введенное количество секунд ")+QString::number(seconds) + tr(" соответствует ") \ + QString::number(minutes) + tr(" минуте " ));}void MainWindow::about(){QTextCodec::setCodecForTr( QTextCodec::codecForName("UTF-8"));qDebug() << "about";QMessageBox::about(this, tr("О программе"), tr(" <b>Программа</b> Демонстрирует перевод \ секунд в ..." ));}
#include <QtCore>#include <QTextCodec>#include <QtGui> #include "proga1.h"#include "proga1_about.h"void MainWindow::rasschet(){#define tr QObject::tr QTextCodec::setCodecForTr( QTextCodec::codecForName("UTF-8"));int seconds = 60;int minutes = 1;textEdit->setText( tr("Введенное количество секунд ")+QString::number(seconds) + tr(" соответствует ") \ + QString::number(minutes) + tr(" минуте " ));}void MainWindow::about(){QTextCodec::setCodecForTr( QTextCodec::codecForName("UTF-8"));qDebug() << "MainWindow::about";qDebug() << this->isModal();// Главное окно - модальное// Сделаем его немодальным, т.е. разблоируем дочерние виджеты для вводаthis->setWindowModality(Qt::NonModal);MyAbout *myabout = new MyAbout;myabout->show();}
#ifndef PROGA1ABOUT_H#define PROGA1ABOUT_H#include <QWidget>#include "ui_proga1_about.h"class MyAbout : public QWidget, public Ui::About{ Q_OBJECTpublic: MyAbout(QWidget *parent = 0);};#endif
#include <QtGui>#include "proga1_about.h"MyAbout::MyAbout(QWidget *parent) : QWidget(parent){ setupUi(this); connect(pushButton, SIGNAL(pressed()), this, SLOT(close()));}
...#include <QTextCodec>#include "proga1.h"extern bool RU=false;
...#include <QtGui/QWidget>extern bool RU;QT_BEGIN_NAMESPACE...menu_2->addAction(action_4);menu_2->addAction(action_5); if (!RU) { pushButton->setText("Translate"); pushButton_2->setText("close"); } else retranslateUi(MainWindow);QObject::connect(pushButton_2, SIGNAL(clicked()), MainWindow, SLOT(close()));QObject::connect(action_Ctrl_Q, SIGNAL(triggered()), MainWindow, SLOT(close()));
/********************************************************************************** Form generated from reading ui file 'proga1.ui'**** Created: Fri 30. Oct 15:48:49 2009** by: Qt User Interface Compiler version 4.4.3**** WARNING! All changes made in this file will be lost when recompiling ui file!********************************************************************************/#ifndef UI_PROGA1_H#define UI_PROGA1_H#include <QtCore/QVariant>#include <QtGui/QAction>#include <QtGui/QApplication>#include <QtGui/QButtonGroup>#include <QtGui/QLabel>#include <QtGui/QMainWindow>#include <QtGui/QMenu>#include <QtGui/QMenuBar>#include <QtGui/QPushButton>#include <QtGui/QSpinBox>#include <QtGui/QStatusBar>#include <QtGui/QTextEdit>#include <QtGui/QWidget>class Ui_MainWindow{public: QAction *action_4; QAction *action_5; QAction *action_6; QAction *action_7; QAction *action_Ctrl_Q;//////////////////////////////////////////////// QAction *aboutQtAct;/////////////////////////////////////////////// QWidget *centralwidget; QSpinBox *spinBox; QTextEdit *textEdit; QPushButton *pushButton; QPushButton *pushButton_2; QLabel *label; QLabel *label_2; QStatusBar *statusbar; QMenuBar *menubar; QMenu *menu; QMenu *menu_2; QMenu *menu_3; void setupUi(QMainWindow *MainWindow) { if (MainWindow->objectName().isEmpty()) MainWindow->setObjectName(QString::fromUtf8("MainWindow")); MainWindow->setWindowModality(Qt::ApplicationModal); MainWindow->setEnabled(true); MainWindow->resize(600, 600); MainWindow->setMinimumSize(QSize(385, 294)); MainWindow->setMaximumSize(QSize(600, 600)); action_4 = new QAction(MainWindow); action_4->setObjectName(QString::fromUtf8("action_4")); action_4->setCheckable(true); action_4->setChecked(true); action_5 = new QAction(MainWindow); action_5->setObjectName(QString::fromUtf8("action_5")); action_5->setCheckable(true); action_6 = new QAction(MainWindow); action_6->setObjectName(QString::fromUtf8("action_6")); action_7 = new QAction(MainWindow); action_7->setObjectName(QString::fromUtf8("action_7")); action_Ctrl_Q = new QAction(MainWindow); action_Ctrl_Q->setObjectName(QString::fromUtf8("action_Ctrl_Q")); /////////////////////////////////////////////////////////////////////////////////////////////////////////////// aboutQtAct = new QAction(MainWindow); aboutQtAct->setObjectName(QString::fromUtf8("aboutQtAct")); ////////////////////////////////////////////////////////////////////////////////////////////////////////////// centralwidget = new QWidget(MainWindow); centralwidget->setObjectName(QString::fromUtf8("centralwidget")); spinBox = new QSpinBox(centralwidget); spinBox->setObjectName(QString::fromUtf8("spinBox")); spinBox->setGeometry(QRect(50, 40, 161, 22)); spinBox->setMaximum(10000000); textEdit = new QTextEdit(centralwidget); textEdit->setObjectName(QString::fromUtf8("textEdit")); textEdit->setGeometry(QRect(50, 110, 301, 71)); pushButton = new QPushButton(centralwidget); pushButton->setObjectName(QString::fromUtf8("pushButton")); pushButton->setGeometry(QRect(250, 40, 101, 21)); pushButton_2 = new QPushButton(centralwidget); pushButton_2->setObjectName(QString::fromUtf8("pushButton_2")); pushButton_2->setGeometry(QRect(160, 210, 75, 23)); label = new QLabel(centralwidget); label->setObjectName(QString::fromUtf8("label")); label->setGeometry(QRect(50, 20, 500, 16)); label_2 = new QLabel(centralwidget); label_2->setObjectName(QString::fromUtf8("label_2")); label_2->setGeometry(QRect(50, 90, 151, 16)); MainWindow->setCentralWidget(centralwidget); statusbar = new QStatusBar(MainWindow); statusbar->setObjectName(QString::fromUtf8("statusbar")); MainWindow->setStatusBar(statusbar); menubar = new QMenuBar(MainWindow); menubar->setObjectName(QString::fromUtf8("menubar")); menubar->setGeometry(QRect(0, 0, 385, 22)); menu = new QMenu(menubar); menu->setObjectName(QString::fromUtf8("menu")); menu_2 = new QMenu(menubar); menu_2->setObjectName(QString::fromUtf8("menu_2")); menu_3 = new QMenu(menubar); menu_3->setObjectName(QString::fromUtf8("menu_3")); MainWindow->setMenuBar(menubar); QWidget::setTabOrder(spinBox, pushButton); QWidget::setTabOrder(pushButton, textEdit); QWidget::setTabOrder(textEdit, pushButton_2); menubar->addAction(menu->menuAction()); menubar->addAction(menu_2->menuAction()); menubar->addAction(menu_3->menuAction()); menu->addAction(action_6); menu->addAction(action_7); menu->addAction(action_Ctrl_Q); menu_2->addAction(action_4); menu_2->addAction(action_5);////////////////////////////////////////////////////////////////////////////////////////////// menu_3->addAction(aboutQtAct);///////////////////////////////////////////////////////////////////////////////////////////// retranslateUi(MainWindow); QObject::connect(pushButton_2, SIGNAL(clicked()), MainWindow, SLOT(close())); QObject::connect(action_Ctrl_Q, SIGNAL(triggered()), MainWindow, SLOT(close())); QMetaObject::connectSlotsByName(MainWindow); } // setupUi void retranslateUi(QMainWindow *MainWindow) { MainWindow->setWindowTitle(QApplication::translate("MainWindow", "\320\237\321\200\320\276\320\263\321\200\320\260\320\274\320\274\320\260 \342\204\2261 :)", 0, QApplication::UnicodeUTF8)); action_4->setText(QApplication::translate("MainWindow", "\320\240\321\203\321\201\321\201\320\272\320\270\320\271", 0, QApplication::UnicodeUTF8)); action_5->setText(QApplication::translate("MainWindow", "\320\220\320\275\320\263\320\273\320\270\320\271\321\201\320\272\320\270\320\271", 0, QApplication::UnicodeUTF8)); action_6->setText(QApplication::translate("MainWindow", "\320\236 \320\277\321\200\320\276\320\263\321\200\320\260\320\274\320\274\320\265", 0, QApplication::UnicodeUTF8)); action_7->setText(QApplication::translate("MainWindow", "\320\236\320\261 \320\260\320\262\321\202\320\276\321\200\320\265", 0, QApplication::UnicodeUTF8)); action_Ctrl_Q->setText(QApplication::translate("MainWindow", "\320\222\321\213\321\205\320\276\320\264", 0, QApplication::UnicodeUTF8)); ////////////////////////////////// aboutQtAct->setText(QApplication::translate("MainWindow", "\320\237\320\276\320\274\320\276\321\211\321\214", 0, QApplication::UnicodeUTF8)); ///////////////////////////////// pushButton->setText(QApplication::translate("MainWindow", "\320\240\320\260\321\201\321\201\321\207\320\270\321\202\320\260\321\202\321\214", 0, QApplication::UnicodeUTF8)); pushButton_2->setText(QApplication::translate("MainWindow", "\320\222\321\213\321\205\320\276\320\264", 0, QApplication::UnicodeUTF8)); label->setText(QApplication::translate("MainWindow", "\320\222\320\262\320\265\320\264\320\270\321\202\320\265 \320\272\320\276\320\273\320\270\321\207\320\265\321\201\321\202\320\262\320\276 \321\201\320\265\320\272\321\203\320\275\320\264", 0, QApplication::UnicodeUTF8)); label_2->setText(QApplication::translate("MainWindow", "\320\240\320\265\320\267\321\203\320\273\321\214\321\202\320\260\321\202 \321\200\320\260\320\261\320\276\321\202\321\213 \320\277\321\200\320\276\320\263\321\200\320\260\320\274\320\274\321\213", 0, QApplication::UnicodeUTF8)); menu->setTitle(QApplication::translate("MainWindow", "\320\244\320\260\320\271\320\273", 0, QApplication::UnicodeUTF8)); menu_2->setTitle(QApplication::translate("MainWindow", "\320\257\320\267\321\213\320\272", 0, QApplication::UnicodeUTF8)); menu_3->setTitle(QApplication::translate("MainWindow", "\320\237\320\276\320\274\320\276\321\211\321\214", 0, QApplication::UnicodeUTF8)); } // retranslateUi};namespace Ui { class MainWindow: public Ui_MainWindow {};} // namespace UiQT_END_NAMESPACE
#ifndef PROGA1_H#define PROGA1_H#include <QtGui>#include <QObject>#include "ui_proga1.h"class MainWindow : public QMainWindow, Ui::MainWindow { Q_OBJECTpublic: MainWindow(QMainWindow* p = 0) : QMainWindow(p) { setupUi(this); connect(pushButton, SIGNAL(clicked()), this, SLOT(rasschet())); connect(action_6, SIGNAL(triggered()), this, SLOT(about())); connect(aboutQtAct, SIGNAL(triggered()), this, SLOT(aboutQt())); }public slots: void rasschet(); void about(); void aboutQt();};#endif
#include <QtCore>#include <QTextCodec>#include <QtGui> #include "proga1.h"#include "proga1_about.h"void MainWindow::rasschet(){#define tr QObject::tr QTextCodec::setCodecForTr( QTextCodec::codecForName("UTF-8"));int seconds = 60;int minutes = 1;textEdit->setText( tr("Введенное количество секунд ")+QString::number(seconds) + tr(" соответствует ") \ + QString::number(minutes) + tr(" минуте " ));}void MainWindow::about(){QTextCodec::setCodecForTr( QTextCodec::codecForName("UTF-8"));qDebug() << "MainWindow::about";qDebug() << this->isModal();this->setWindowModality(Qt::NonModal);MyAbout *myabout = new MyAbout;myabout->show();}void MainWindow::aboutQt(){qDebug() << "It's slot aboutQt";QMessageBox::about(this, tr("Qt"), tr("Qt Trolltech - Nokia."));}