//linguistic.pro
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TRANSLATIONS = amharic_ln.ts
TARGET = linguistic
TEMPLATE = app
SOURCES += main.cpp\
dialog.cpp
HEADERS += dialog.h
FORMS += dialog.ui
CODECFORTR = UTF-8
//main.cpp
#include "dialog.h"
#include <QApplication>
#include <QTranslator>
#include <QFont>
#include <QFontDatabase>
#include <QFile>
#include <QDebug>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QFile res("C:/Documents and Settings/user/My Documents/Qt Projects/linguistic/gfzemen.ttf");
res.open(QIODevice::ReadOnly);
QFontDatabase fdata;
fdata.addApplicationFontFromData(res.readAll());
Dialog w;
QFont f("GF Zemen Unicode");
f.setPointSize(12);
w.setFont(f);
w.show();
return a.exec();
}
//dialog.h
#ifndef DIALOG_H
#define DIALOG_H
#include <QDialog>
#include <QTranslator>
#include <QDebug>
#include <QDir>
namespace Ui {
class Dialog;
}
class Dialog : public QDialog
{
Q_OBJECT
public:
explicit Dialog(QWidget *parent = 0);
~Dialog();
private:
Ui::Dialog *ui;
QApplication *tapp;
QTranslator translate;
QString file;
};
#endif // DIALOG_H
//dialog.cpp
#include "dialog.h"
#include "ui_dialog.h"
Dialog::Dialog(QWidget *parent): QDialog(parent), ui(new Ui::Dialog)
{
translate.load("C:/Documents and Settings/user/My Documents/Qt Projects/linguistic/amharic_ln.qm");
tapp->installTranslator(&translate);
ui->setupUi(this);
}
Dialog::~Dialog()
{
delete ui;
}
No comments:
Post a Comment