1. save Chinese file name whit input name.

2. modify font form set point size to pixel size.
This commit is contained in:
shouchih_chen 陳守志 2022-02-14 09:57:40 +08:00
parent 3534552d23
commit fb995d0786
2 changed files with 15 additions and 8 deletions

View File

@ -13,18 +13,18 @@
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>{B66B108B-6DA8-408D-936D-988FF8B6B722}</ProjectGuid> <ProjectGuid>{B66B108B-6DA8-408D-936D-988FF8B6B722}</ProjectGuid>
<Keyword>QtVS_v304</Keyword> <Keyword>QtVS_v304</Keyword>
<WindowsTargetPlatformVersion Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'">10.0.19041.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'">8.1</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'">10.0.19041.0</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'">8.1</WindowsTargetPlatformVersion>
<QtMsBuild Condition="'$(QtMsBuild)'=='' OR !Exists('$(QtMsBuild)\qt.targets')">$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild> <QtMsBuild Condition="'$(QtMsBuild)'=='' OR !Exists('$(QtMsBuild)\qt.targets')">$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v142</PlatformToolset> <PlatformToolset>v140</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<PlatformToolset>v142</PlatformToolset> <PlatformToolset>v140</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt_defaults.props')"> <ImportGroup Condition="Exists('$(QtMsBuild)\qt_defaults.props')">

View File

@ -16,7 +16,8 @@
#define BG_BOY_PATH ":/NameCreater/resource/background_boy.jpg" #define BG_BOY_PATH ":/NameCreater/resource/background_boy.jpg"
#define BG_GIRL_PATH ":/NameCreater/resource/background_girl.jpg" #define BG_GIRL_PATH ":/NameCreater/resource/background_girl.jpg"
#define FONT_NAME QStringLiteral("µØ±d¶êÅé Std W8") #define FONT_NAME QStringLiteral("µØ±d¶êÅé Std W8")
#define FONT_SIZE 74 #define FONT_SIZE 120
//#define FONT_SIZE 74
#define BG_MIX_TYPE_STR "mix" #define BG_MIX_TYPE_STR "mix"
#define BG_BOY_TYPE_STR "boy" #define BG_BOY_TYPE_STR "boy"
@ -112,11 +113,12 @@ QList<NameInfo_t> getNameByFile(const QString& filename) {
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
int export_times = 0; int export_times = 0;
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); //QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication a(argc, argv); QApplication a(argc, argv);
QFont font(FONT_NAME, FONT_SIZE); QFont font(FONT_NAME);
font.setPixelSize(FONT_SIZE);
QColor font_color(0, 0, 0); QColor font_color(0, 0, 0);
@ -172,7 +174,12 @@ int main(int argc, char* argv[])
scene.addItem(textItem3); scene.addItem(textItem3);
} }
} }
QString file_name = QString("export_%1.jpg").arg(QString::number(n + 1)); //if (name_info.bg_type == 0) {
// view.show();
// break;
//}
QString file_name = QString("%1_%2_%3.jpg").arg(QString::number(export_times+1),name_info.name1,name_info.name2);
saveToImage(file_name, &scene); saveToImage(file_name, &scene);
export_times++; export_times++;
} }