#include <QApplication> #include <QSplitter> #include <QTextEdit> #include <QTextCodec> #include <QtWidgets/QWidget> #include <QtWidgets/QMenu> #include <QtWidgets/QMenuBar> #include <QtWidgets/QHBoxLayout> #include <QtWidgets/QMainWindow> #include <QtWidgets/QAction> #include <QtCore/QVariant> #include <QtWidgets/QApplication> #include <QtWidgets/QHBoxLayout> #include <QtWidgets/QListView> #include <QtWidgets/QMainWindow> #include <QtWidgets/QMenuBar> #include <QtWidgets/QSplitter> #include <QtWidgets/QStatusBar> #include <QtWidgets/QTextEdit> #include <QtWidgets/QToolBar> #include <QtWidgets/QWidget> void setUpUI(QMainWindow *TeslaManageClass); void retranslateUi(QMainWindow *TeslaManageClass); class TeslaManage : public QMainWindow { public: TeslaManage(QWidget *parent = 0); }; TeslaManage::TeslaManage(QWidget *parent) : QMainWindow(parent) { setUpUI(this); } QWidget *centralWidget; QHBoxLayout *horizontalLayout; QSplitter *splitter_2; QListView *listView; QSplitter *splitter; QWidget *widget; QTextEdit *textEdit_2; QTextEdit *textEdit; QMenuBar *menuBar; QToolBar *mainToolBar; QStatusBar *statusBar; QMenu *menu; QMenu *menu_2; QMenu *menu_4; QAction *actionFile; QAction *actionView; void setUpUI(QMainWindow *TeslaManageClass) { //ont::QFont(const QString & family, int pointSize = -1, int weight = -1, bool italic = false) actionFile = new QAction(TeslaManageClass); actionFile->setObjectName(QString::fromUtf8("actionFile")); actionView = new QAction(TeslaManageClass); actionView->setObjectName(QString::fromUtf8("actionView")); //actionFile->setText(QApplication::translate("QSplitterTestClass", "\346\226\207\344\273\266", nullptr)); //actionView->setText(QApplication::translate("QSplitterTestClass", "\350\247\206\345\233\276", nullptr)); QIcon icon; icon.addFile(QString::fromUtf8("Resources/Images/AppMenu_Open_32.ico"), QSize(), QIcon::Normal, QIcon::Off); actionFile->setIcon(icon); actionView = new QAction(TeslaManageClass); actionView->setObjectName(QString::fromUtf8("actionView")); QIcon icon1; icon1.addFile(QString::fromUtf8("Resources/Images/autocam-basicTourWheel.ico"), QSize(), QIcon::Normal, QIcon::Off); actionView->setIcon(icon1); centralWidget = new QWidget(TeslaManageClass); centralWidget->setObjectName(QString::fromUtf8("centralWidget")); horizontalLayout = new QHBoxLayout(centralWidget); horizontalLayout->setSpacing(6); horizontalLayout->setContentsMargins(11, 11, 11, 11); horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout")); splitter_2 = new QSplitter(centralWidget); splitter_2->setObjectName(QString::fromUtf8("splitter_2")); splitter_2->setOrientation(Qt::Horizontal); listView = new QListView(splitter_2); listView->setObjectName(QString::fromUtf8("listView")); listView->setMinimumSize(QSize(20, 0)); listView->setMaximumSize(QSize(400, 16777215)); splitter_2->addWidget(listView); splitter = new QSplitter(splitter_2); splitter->setObjectName(QString::fromUtf8("splitter")); splitter->setOrientation(Qt::Vertical); widget = new QWidget(splitter); widget->setObjectName(QString::fromUtf8("widget")); splitter->addWidget(widget); textEdit_2 = new QTextEdit(splitter); textEdit_2->setObjectName(QString::fromUtf8("textEdit_2")); splitter->addWidget(textEdit_2); splitter_2->addWidget(splitter); textEdit = new QTextEdit(splitter_2); textEdit->setObjectName(QString::fromUtf8("textEdit")); textEdit->setMinimumSize(QSize(20, 20)); textEdit->setMaximumSize(QSize(400, 16777215)); splitter_2->addWidget(textEdit); horizontalLayout->addWidget(splitter_2); TeslaManageClass->setCentralWidget(centralWidget); menuBar = new QMenuBar(TeslaManageClass); menuBar->setObjectName(QString::fromUtf8("menuBar")); menuBar->setGeometry(QRect(0, 0, 902, 26)); TeslaManageClass->setMenuBar(menuBar); menu = new QMenu(menuBar); menu->setObjectName(QString::fromUtf8("menu")); menu_2 = new QMenu(menuBar); menu_2->setObjectName(QString::fromUtf8("menu_2")); menu_4 = new QMenu(menuBar); menu_4->setObjectName(QString::fromUtf8("menu_4")); menuBar->addAction(menu->menuAction()); menuBar->addAction(menu_2->menuAction()); menuBar->addAction(menu_4->menuAction()); mainToolBar = new QToolBar(TeslaManageClass); mainToolBar->setObjectName(QString::fromUtf8("mainToolBar")); mainToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); TeslaManageClass->addToolBar(Qt::TopToolBarArea, mainToolBar); mainToolBar->addAction(actionFile); mainToolBar->addSeparator(); mainToolBar->addAction(actionView); statusBar = new QStatusBar(TeslaManageClass); statusBar->setObjectName(QString::fromUtf8("statusBar")); TeslaManageClass->setStatusBar(statusBar); retranslateUi(TeslaManageClass); //centralWidget->show(); } void retranslateUi(QMainWindow *TeslaManageClass) { TeslaManageClass->setWindowTitle(QApplication::translate("QSplitterTestClass", "QSplitterTest", nullptr)); actionFile->setText(QApplication::translate("QSplitterTestClass", "\346\226\207\344\273\266", nullptr)); actionView->setText(QApplication::translate("QSplitterTestClass", "\350\247\206\345\233\276", nullptr)); } int main(int argc, char *argv[]) { QApplication a(argc, argv); //第一个参数是字体族,第二个是字体尺寸,第三个是加粗系数,第四个是斜体设置 QFont font("ZYSong18030", 12); //指定显示字体 a.setFont(font); TeslaManage w; w.setWindowIcon(QIcon("./Resources/Images/jetstream.ico")); //w.show(); w.showMaximized(); return a.exec(); }