2017-10-29 15:18:40 +08:00
|
|
|
#include "mainwindow.h"
|
2017-12-30 10:19:43 +08:00
|
|
|
#include <qqtapplication.h>
|
2018-01-05 10:54:43 +08:00
|
|
|
#include <QProcess>
|
2018-01-06 11:08:55 +08:00
|
|
|
#include "qfontdatabase.h"
|
|
|
|
#include "qqtcore.h"
|
2017-12-30 10:19:43 +08:00
|
|
|
|
|
|
|
class MainApplication: public QQtApplication
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit MainApplication ( int argc, char* argv[] ) :
|
|
|
|
QQtApplication ( argc, argv ) {
|
|
|
|
QApplication::setApplicationName ( "exquisite" );
|
|
|
|
QApplication::setOrganizationName ( "QQt" );
|
|
|
|
QApplication::setOrganizationDomain ( "www.qqt.com" );
|
2018-01-05 10:54:43 +08:00
|
|
|
//setQSSStyle();
|
2017-12-30 15:01:48 +08:00
|
|
|
#ifdef __EMBEDDED_LINUX__
|
2018-01-06 11:08:55 +08:00
|
|
|
QString fontfile = QProcessEnvironment::systemEnvironment().value("QTDIR");
|
|
|
|
fontfile += "/lib/fonts/wenquanyi.ttf";
|
|
|
|
int fontsize = 14;
|
|
|
|
|
|
|
|
//ignored
|
|
|
|
//QFontDatabase db;
|
|
|
|
pline() << "ziti buged";
|
|
|
|
//pline() << db.families();
|
|
|
|
//pline() << db.styles("WenQuanYi Zen Hei");
|
|
|
|
//if( db.hasFamily("WenQuanYi Zen Hei") ){
|
|
|
|
//pline() << "dddd";
|
|
|
|
//}
|
|
|
|
int fontID = QFontDatabase::addApplicationFont ( fontfile );
|
|
|
|
pline() << "font file:" << fontfile;
|
|
|
|
pline() << "font id:" << fontID << "family size:" << QFontDatabase::applicationFontFamilies ( fontID ).size();
|
|
|
|
QString ziti = QFontDatabase::applicationFontFamilies ( fontID ).at ( 0 );
|
|
|
|
pline() << ziti;
|
|
|
|
//QFont font = db.font("WenQuanYi Zen Hei", "Medium", 14);
|
|
|
|
|
|
|
|
QFont font ( ziti, fontsize );
|
|
|
|
QApplication::setFont ( font );
|
|
|
|
//setTextFont(fontfile, 14);
|
2017-12-30 15:01:48 +08:00
|
|
|
#endif
|
2017-12-30 10:19:43 +08:00
|
|
|
}
|
|
|
|
virtual ~MainApplication() {}
|
|
|
|
};
|
2017-10-20 20:52:19 +08:00
|
|
|
|
2017-10-28 22:03:03 +08:00
|
|
|
int main(int argc, char* argv[])
|
2017-10-20 20:52:19 +08:00
|
|
|
{
|
2017-12-30 10:19:43 +08:00
|
|
|
MainApplication a(argc, argv);
|
2018-01-05 10:54:43 +08:00
|
|
|
|
2017-10-29 15:18:40 +08:00
|
|
|
MainWindow w;
|
2017-10-20 20:52:19 +08:00
|
|
|
w.show();
|
|
|
|
|
|
|
|
return a.exec();
|
|
|
|
}
|
2017-10-28 22:03:03 +08:00
|
|
|
|
2017-10-29 09:14:45 +08:00
|
|
|
|