MCPcopy Create free account
hub / github.com/Liniyous/ElaWidgetTools / initWindow

Method initWindow

ElaWidgetToolsExample/mainwindow.cpp:83–205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81}
82
83void MainWindow::initWindow()
84{
85 setFocusPolicy(Qt::StrongFocus);
86 setAppBarHeight(45);
87 // setIsCentralStackedWidgetTransparent(true);
88 setWindowIcon(QIcon(":/include/Image/Cirno.jpg"));
89 resize(1200, 740);
90 // eTheme->setThemeMode(ElaThemeType::Dark);
91 // setIsNavigationBarEnable(false);
92 // setNavigationBarDisplayMode(ElaNavigationType::Compact);
93 // setWindowButtonFlag(ElaAppBarType::MinimizeButtonHint, false);
94 setUserInfoCardPixmap(QPixmap(":/Resource/Image/Cirno.jpg"));
95 setUserInfoCardTitle("ElaWidgetTools");
96 setUserInfoCardSubTitle("Liniyous@gmail.com");
97 setWindowTitle("ElaWidgetTools");
98 // setIsStayTop(true);
99 // setUserInfoCardVisible(false);
100 // setNavigationBarWidth(260);
101 ElaText* centralStack = new ElaText("这是一个主窗口堆栈页面", this);
102 centralStack->setFocusPolicy(Qt::StrongFocus);
103 centralStack->setTextPixelSize(32);
104 centralStack->setAlignment(Qt::AlignCenter);
105 addCentralWidget(centralStack);
106
107 // 窗口绘制模式
108 setWindowPixmap(ElaThemeType::Light, QPixmap(":/Resource/Image/WindowBase/Miku.png"));
109 setWindowPixmap(ElaThemeType::Dark, QPixmap(":/Resource/Image/WindowBase/WorldTree.jpg"));
110 setWindowMoviePath(ElaThemeType::Light, ":/Resource/Image/WindowBase/Miku.gif");
111 setWindowMoviePath(ElaThemeType::Dark, ":/Resource/Image/WindowBase/WorldTree.gif");
112 //setWindowPaintMode(ElaWindowType::PaintMode::Pixmap);
113
114 // 自定义AppBar菜单
115 ElaMenu* appBarMenu = new ElaMenu(this);
116 appBarMenu->setMenuItemHeight(27);
117 connect(appBarMenu->addAction("跳转到一级主要堆栈"), &QAction::triggered, this, [=]() {
118 setCurrentStackIndex(0);
119 });
120 connect(appBarMenu->addAction("跳转到二级主要堆栈"), &QAction::triggered, this, [=]() {
121 setCurrentStackIndex(1);
122 });
123 connect(appBarMenu->addAction("更改页面切换特效(Scale)"), &QAction::triggered, this, [=]() {
124 setStackSwitchMode(ElaWindowType::StackSwitchMode::Scale);
125 });
126 connect(appBarMenu->addElaIconAction(ElaIconType::GearComplex, "自定义主窗口设置"), &QAction::triggered, this, [=]() {
127 navigation(_settingKey);
128 });
129 appBarMenu->addSeparator();
130 connect(appBarMenu->addElaIconAction(ElaIconType::MoonStars, "更改项目主题"), &QAction::triggered, this, [=]() {
131 eTheme->setThemeMode(eTheme->getThemeMode() == ElaThemeType::Light ? ElaThemeType::Dark : ElaThemeType::Light);
132 });
133 connect(appBarMenu->addAction("使用原生菜单"), &QAction::triggered, this, [=]() {
134 setCustomMenu(nullptr);
135 });
136 setCustomMenu(appBarMenu);
137
138 // 堆栈独立自定义窗口
139 QWidget* centralCustomWidget = new QWidget(this);
140 QHBoxLayout* centralCustomWidgetLayout = new QHBoxLayout(centralCustomWidget);

Callers

nothing calls this directly

Calls 15

setMenuItemHeightMethod · 0.80
setThemeModeMethod · 0.80
getThemeModeMethod · 0.80
undoCommandMethod · 0.80
redoCommandMethod · 0.80
setFixedHeightMethod · 0.80
setPlaceholderTextMethod · 0.80
setIsWrapAnywhereMethod · 0.80
setBusyingWidthMethod · 0.80
setFixedSizeMethod · 0.80
setIsBusyingMethod · 0.80
addWidgetMethod · 0.80

Tested by

no test coverage detected