mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2025-07-04 00:05:25 +08:00
qt 6.6.0 clean
This commit is contained in:
17
tests/manual/fontfeatures/fontfeatures.pro
Normal file
17
tests/manual/fontfeatures/fontfeatures.pro
Normal file
@ -0,0 +1,17 @@
|
||||
TEMPLATE = app
|
||||
TARGET = fontfeatures
|
||||
INCLUDEPATH += .
|
||||
QT += widgets
|
||||
|
||||
# You can make your code fail to compile if you use deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
# Please consult the documentation of the deprecated API in order to know
|
||||
# how to port your code away from it.
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_UP_TO=0x060000 # disables all APIs deprecated in Qt 6.0.0 and earlier
|
||||
|
||||
# Input
|
||||
HEADERS += mainwindow.h
|
||||
FORMS += mainwindow.ui
|
||||
SOURCES += main.cpp \
|
||||
mainwindow.cpp \
|
14
tests/manual/fontfeatures/main.cpp
Normal file
14
tests/manual/fontfeatures/main.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
// Copyright (C) 2023 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
MainWindow w;
|
||||
w.show();
|
||||
return a.exec();
|
||||
}
|
225
tests/manual/fontfeatures/mainwindow.cpp
Normal file
225
tests/manual/fontfeatures/mainwindow.cpp
Normal file
@ -0,0 +1,225 @@
|
||||
// Copyright (C) 2023 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
, ui(new Ui::MainWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
setup();
|
||||
updateSampleText();
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void MainWindow::updateSampleText()
|
||||
{
|
||||
QFont font = ui->fontComboBox->currentFont();
|
||||
font.setPixelSize(54);
|
||||
|
||||
for (int i = 0; i < ui->lwFeatures->count(); ++i) {
|
||||
QListWidgetItem *it = ui->lwFeatures->item(i);
|
||||
if (it->checkState() != Qt::PartiallyChecked) {
|
||||
QByteArray ba = it->text().toLatin1();
|
||||
font.setFeature(ba, !!it->checkState());
|
||||
}
|
||||
}
|
||||
|
||||
ui->lSampleDisplay->setFont(font);
|
||||
ui->lSampleDisplay->setText(ui->leSampleText->text());
|
||||
}
|
||||
|
||||
void MainWindow::enableAll()
|
||||
{
|
||||
for (int i = 0; i < ui->lwFeatures->count(); ++i) {
|
||||
QListWidgetItem *it = ui->lwFeatures->item(i);
|
||||
it->setCheckState(Qt::Checked);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::disableAll()
|
||||
{
|
||||
for (int i = 0; i < ui->lwFeatures->count(); ++i) {
|
||||
QListWidgetItem *it = ui->lwFeatures->item(i);
|
||||
it->setCheckState(Qt::Unchecked);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::reset()
|
||||
{
|
||||
for (int i = 0; i < ui->lwFeatures->count(); ++i) {
|
||||
QListWidgetItem *it = ui->lwFeatures->item(i);
|
||||
it->setCheckState(Qt::PartiallyChecked);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::setup()
|
||||
{
|
||||
connect(ui->fontComboBox, &QFontComboBox::currentFontChanged, this, &MainWindow::updateSampleText);
|
||||
connect(ui->leSampleText, &QLineEdit::textChanged, this, &MainWindow::updateSampleText);
|
||||
connect(ui->lwFeatures, &QListWidget::itemChanged, this, &MainWindow::updateSampleText);
|
||||
connect(ui->pbEnableAll, &QPushButton::clicked, this, &MainWindow::enableAll);
|
||||
connect(ui->pbDisableAll, &QPushButton::clicked, this, &MainWindow::disableAll);
|
||||
connect(ui->pbReset, &QPushButton::clicked, this, &MainWindow::reset);
|
||||
|
||||
QList<QByteArray> featureList =
|
||||
{
|
||||
"aalt",
|
||||
"abvf",
|
||||
"abvm",
|
||||
"abvs",
|
||||
"afrc",
|
||||
"akhn",
|
||||
"blwf",
|
||||
"blwm",
|
||||
"blws",
|
||||
"calt",
|
||||
"case",
|
||||
"ccmp",
|
||||
"cfar",
|
||||
"chws",
|
||||
"cjct",
|
||||
"clig",
|
||||
"cpct",
|
||||
"cpsp",
|
||||
"cswh",
|
||||
"curs",
|
||||
"cv01",
|
||||
"c2pc",
|
||||
"c2sc",
|
||||
"dist",
|
||||
"dlig",
|
||||
"dnom",
|
||||
"dtls",
|
||||
"expt",
|
||||
"falt",
|
||||
"fin2",
|
||||
"fin3",
|
||||
"fina",
|
||||
"flac",
|
||||
"frac",
|
||||
"fwid",
|
||||
"half",
|
||||
"haln",
|
||||
"halt",
|
||||
"hist",
|
||||
"hkna",
|
||||
"hlig",
|
||||
"hngl",
|
||||
"hojo",
|
||||
"hwid",
|
||||
"init",
|
||||
"isol",
|
||||
"ital",
|
||||
"jalt",
|
||||
"jp78",
|
||||
"jp83",
|
||||
"jp90",
|
||||
"jp04",
|
||||
"kern",
|
||||
"lfbd",
|
||||
"liga",
|
||||
"ljmo",
|
||||
"lnum",
|
||||
"locl",
|
||||
"ltra",
|
||||
"ltrm",
|
||||
"mark",
|
||||
"med2",
|
||||
"medi",
|
||||
"mgrk",
|
||||
"mkmk",
|
||||
"mset",
|
||||
"nalt",
|
||||
"nlck",
|
||||
"nukt",
|
||||
"numr",
|
||||
"onum",
|
||||
"opbd",
|
||||
"ordn",
|
||||
"ornm",
|
||||
"palt",
|
||||
"pcap",
|
||||
"pkna",
|
||||
"pnum",
|
||||
"pref",
|
||||
"pres",
|
||||
"pstf",
|
||||
"psts",
|
||||
"pwid",
|
||||
"qwid",
|
||||
"rand",
|
||||
"rclt",
|
||||
"rkrf",
|
||||
"rlig",
|
||||
"rphf",
|
||||
"rtbd",
|
||||
"rtla",
|
||||
"rtlm",
|
||||
"ruby",
|
||||
"rvrn",
|
||||
"salt",
|
||||
"sinf",
|
||||
"size",
|
||||
"smcp",
|
||||
"smpl",
|
||||
"ss01",
|
||||
"ss02",
|
||||
"ss03",
|
||||
"ss04",
|
||||
"ss05",
|
||||
"ss06",
|
||||
"ss07",
|
||||
"ss08",
|
||||
"ss09",
|
||||
"ss10",
|
||||
"ss11",
|
||||
"ss12",
|
||||
"ss13",
|
||||
"ss14",
|
||||
"ss15",
|
||||
"ss16",
|
||||
"ss17",
|
||||
"ss18",
|
||||
"ss19",
|
||||
"ss20",
|
||||
"ssty",
|
||||
"stch",
|
||||
"subs",
|
||||
"sups",
|
||||
"swsh",
|
||||
"titl",
|
||||
"tjmo",
|
||||
"tnam",
|
||||
"tnum",
|
||||
"trad",
|
||||
"twid",
|
||||
"unic",
|
||||
"valt",
|
||||
"vatu",
|
||||
"vchw",
|
||||
"vert",
|
||||
"vhal",
|
||||
"vjmo",
|
||||
"vkna",
|
||||
"vkrn",
|
||||
"vpal",
|
||||
"vrt2",
|
||||
"vrtr",
|
||||
"zero"
|
||||
};
|
||||
|
||||
for (auto it = featureList.constBegin(); it != featureList.constEnd(); ++it) {
|
||||
QListWidgetItem *item = new QListWidgetItem(*it);
|
||||
item->setFlags(Qt::ItemIsUserTristate | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
|
||||
item->setCheckState(Qt::PartiallyChecked);
|
||||
ui->lwFeatures->addItem(item);
|
||||
}
|
||||
}
|
32
tests/manual/fontfeatures/mainwindow.h
Normal file
32
tests/manual/fontfeatures/mainwindow.h
Normal file
@ -0,0 +1,32 @@
|
||||
// Copyright (C) 2023 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class MainWindow; }
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWindow(QWidget *parent = nullptr);
|
||||
~MainWindow();
|
||||
|
||||
private slots:
|
||||
void updateSampleText();
|
||||
void enableAll();
|
||||
void disableAll();
|
||||
void reset();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
|
||||
void setup();
|
||||
};
|
||||
#endif // MAINWINDOW_H
|
116
tests/manual/fontfeatures/mainwindow.ui
Normal file
116
tests/manual/fontfeatures/mainwindow.ui
Normal file
@ -0,0 +1,116 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>600</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QFontComboBox" name="fontComboBox"/>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Sample text:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="leSampleText">
|
||||
<property name="text">
|
||||
<string>Foobar</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbEnableAll">
|
||||
<property name="text">
|
||||
<string>Enable all</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbDisableAll">
|
||||
<property name="text">
|
||||
<string>Disable all</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbReset">
|
||||
<property name="text">
|
||||
<string>Reset</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="lwFeatures">
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="flow">
|
||||
<enum>QListView::TopToBottom</enum>
|
||||
</property>
|
||||
<property name="isWrapping" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="viewMode">
|
||||
<enum>QListView::ListMode</enum>
|
||||
</property>
|
||||
<property name="uniformItemSizes">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lSampleDisplay">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>LABEL</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Reference in New Issue
Block a user