You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Drone_project/Src/core/main.cpp

42 lines
2.1 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#include <QApplication>
#include "../ui/mainwindow.h"
int main(int argc, char *argv[]) {
// 禁用 Wayland优先使用 X11(xcb),否则回退为 offscreen
QByteArray display = qgetenv("DISPLAY");
if (!display.isEmpty()) {
qputenv("QT_QPA_PLATFORM", QByteArray("xcb"));
} else {
qputenv("QT_QPA_PLATFORM", QByteArray("offscreen"));
}
QApplication app(argc, argv);
app.setApplicationDisplayName("");
// 全局样式表(浅色主题)
app.setStyleSheet(
"*{font-family:'Segoe UI','PingFang SC','Microsoft YaHei','WenQuanYi Micro Hei',sans-serif;}"
"QWidget{background:#fafafa;color:#222;}"
"QGroupBox{border:1px solid #e0e0e0;border-radius:8px;margin-top:8px;padding-top:12px;}"
"QGroupBox::title{subcontrol-origin: margin;left:10px;padding:0 6px;color:#111;font-weight:bold;}"
"QFrame{background:white;border:1px solid #e6e6e6;border-radius:8px;}"
"#headerBar{background:#ffffff;border:1px solid #e6e6e6;border-radius:10px;}"
"#sideNav{background:#ffffff;border:1px solid #e6e6e6;border-radius:10px;}"
"#rightPanel{background:transparent;}"
"QToolButton{background:#ffffff;border:1px solid #e6e6e6;border-radius:8px;padding:6px;}"
"QToolButton:hover{background:#f2f7ff;border-color:#d0dcff;}"
"QPushButton{background:#ffffff;border:1px solid #d9d9d9;border-radius:8px;padding:6px 10px;}"
"QPushButton:hover{background:#f8f8f8;border-color:#c8c8c8;}"
"QPushButton:pressed{background:#f0f0f0;}"
"QPushButton[primary='true']{background:#2979ff;color:#fff;border:1px solid #1f6ae6;}"
"QPushButton[primary='true']:hover{background:#1565c0;border-color:#155bb0;}"
"QLabel.section{font-weight:bold;padding:4px 0;}"
"QLineEdit,QComboBox{background:#ffffff;border:1px solid #d9d9d9;border-radius:6px;padding:4px 6px;}"
"QComboBox QAbstractItemView{border:1px solid #d9d9d9;background:#ffffff;selection-background-color:#e8f0ff;}"
"#recLed{background:#e33;border-radius:7px;}"
);
MainWindow w;
w.resize(1280, 800);
w.show();
return app.exec();
}