Apply new ttf for linux font.
This commit is contained in:
@@ -40,7 +40,7 @@ void InputObject::initUi()
|
||||
"QLineEdit,QDateEdit{background-color: rgba(0,0,0,0.5);\
|
||||
min-height:100px;max-height:100px; min-width:500px;max-width:500px;\
|
||||
border: 2px solid #ef9cba; border-radius:20px;\
|
||||
font-family:Microsoft YaHei; color:white;margin:0;font-size:36px;}"
|
||||
color:white;margin:0;font-size:36px;}"
|
||||
"QTextEdit{background-color: rgba(0,0,0,0.5);\
|
||||
min-height:300px;max-height:300px; min-width:700px;max-width:700px;\
|
||||
border: 2px solid #ef9cba; border-radius:20px;\
|
||||
@@ -55,7 +55,7 @@ void InputObject::initUi()
|
||||
"QLineEdit,QDateEdit,QTextEdit{\
|
||||
background:qlineargradient(x1:0,y1:0,x2:1,y2:1,stop: 0.0 silver, stop: 1.0 grey);\
|
||||
border: 1px solid #1e1b18; border-radius:20px;\
|
||||
font-family:Microsoft YaHei; color:black;margin:0;font-size:36px;}"
|
||||
color:black;margin:0;font-size:36px;}"
|
||||
|
||||
"QLineEdit,QDateEdit{min-height:100px; max-height:100px; min-width:500px; max-width:500px;}"
|
||||
"QTextEdit{min-height:300px;max-height:300px; min-width:700px;max-width:700px;}"
|
||||
|
||||
@@ -36,7 +36,7 @@ LoginWindow::~LoginWindow()
|
||||
|
||||
void LoginWindow::initUi()
|
||||
{
|
||||
QString style = "*{background-color:#3c3c3c; font-family:Microsoft YaHei; color:white;margin:0;font-size:16px;}"
|
||||
QString style = "*{background-color:#3c3c3c; color:white;margin:0;font-size:16px;}"
|
||||
"QLabel#title{font-Size:98px;color:qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,"
|
||||
"stop: 0.0 darkgray, stop: 0.5 lightgray, stop: 1.0 darkgray);}"
|
||||
"QLabel#warn{color:#930000;background:transparent;font-size:20px;}"
|
||||
@@ -150,7 +150,8 @@ void LoginWindow::doLogin()
|
||||
if (SQLHelper::QueryCount(sql) > 0)
|
||||
{
|
||||
accept();
|
||||
} else{
|
||||
}
|
||||
else {
|
||||
warn->setVisible(true);
|
||||
}
|
||||
// bool isLoginSuccess = UserService::ValidateAccount(strUserCode, encryptedPassword);
|
||||
|
||||
38
src/main.cpp
38
src/main.cpp
@@ -1,29 +1,51 @@
|
||||
#include "mainwindow.h"
|
||||
#include "mainwindow.h"
|
||||
#include <QApplication>
|
||||
#include "loginwindow.h"
|
||||
#include "InputObject.h"
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <src/db/SQLHelper.h>
|
||||
#include <QTextCodec>
|
||||
#include <QFontDatabase>
|
||||
QString loadFontFromFile(QString path)
|
||||
{
|
||||
static QString font;
|
||||
static bool loaded = false;
|
||||
if (!loaded)
|
||||
{
|
||||
loaded = true;
|
||||
int loadedFontID = QFontDatabase::addApplicationFont(path);
|
||||
QStringList loadedFontFamilies = QFontDatabase::applicationFontFamilies(loadedFontID);
|
||||
if (!loadedFontFamilies.empty())
|
||||
font = loadedFontFamilies.at(0);
|
||||
}
|
||||
return font;
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
//QLocale::setDefault(QLocale::English);
|
||||
qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
|
||||
#ifdef CUTE_STYLE
|
||||
qputenv("QT_VIRTUALKEYBOARD_STYLE", QByteArray("retro"));
|
||||
#endif // CUTE_STYLE
|
||||
|
||||
//qputenv("QT_LOGGING_RULES", QByteArray("qt.virtualkeyboard=true"));
|
||||
|
||||
|
||||
QApplication a(argc, argv);
|
||||
QString layouts_path = QString(QCoreApplication::applicationDirPath()).append("/layouts");
|
||||
qputenv("QT_VIRTUALKEYBOARD_LAYOUT_PATH", QByteArray(layouts_path.toStdString().c_str()));
|
||||
|
||||
QQmlApplicationEngine engine;
|
||||
engine.addImportPath("/VirtualKeyboard/content/styles");
|
||||
#ifdef CUTE_STYLE
|
||||
qputenv("QT_VIRTUALKEYBOARD_STYLE", QByteArray("retro"));
|
||||
#else
|
||||
qputenv("QT_VIRTUALKEYBOARD_STYLE", QByteArray("default"));
|
||||
#endif
|
||||
QTextCodec* codec = QTextCodec::codecForName("utf8");
|
||||
QTextCodec::setCodecForLocale(codec);
|
||||
|
||||
//QString fontName = loadFontFromFile(":/fonts/MicrosoftYahei.ttf");
|
||||
QString fontName = loadFontFromFile(":/fonts/DroidSansFallback.ttf");
|
||||
|
||||
|
||||
QFont font(fontName);
|
||||
QApplication::setFont(font);
|
||||
|
||||
//a.installEventFilter(obj);
|
||||
InputObject* obj = new InputObject();
|
||||
a.installEventFilter(obj);
|
||||
|
||||
@@ -14,7 +14,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
QMainWindow(parent),
|
||||
ui(new Ui::MainWindow)
|
||||
{
|
||||
const QString style = "*{background-color:#3c3c3c; font-family:Microsoft YaHei; color:white;margin:0;font-size:16px;}"
|
||||
const QString style = "*{background-color:#3c3c3c; color:white;margin:0;font-size:16px;}"
|
||||
"QTabBar::tab {\n"
|
||||
"height:60px;"
|
||||
"width:300px;"
|
||||
@@ -94,7 +94,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
{
|
||||
QString* str = (QString*)msg;
|
||||
msgDialog->showMessage(*str);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
msgDialog->showMessage("Something went error!");
|
||||
}
|
||||
msgDialog->showExitButton();
|
||||
@@ -107,7 +108,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
{
|
||||
QString* str = (QString*)msg;
|
||||
msgDialog->showMessage(*str);
|
||||
} else{
|
||||
}
|
||||
else {
|
||||
msgDialog->hideMessage();
|
||||
}
|
||||
msgDialog->hideExitButton();
|
||||
@@ -120,7 +122,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
{
|
||||
QVariant* var = (QVariant*)msg;
|
||||
msgDialog->showMessage(QString("Scanning %1%").arg((int)(var->toFloat() * 100.0f)));
|
||||
} else{
|
||||
}
|
||||
else {
|
||||
msgDialog->hideMessage();
|
||||
}
|
||||
msgDialog->hideExitButton();
|
||||
|
||||
Reference in New Issue
Block a user