📄 my_widget.cpp.html
字号:
<HTML><HEAD><TITLE>my_widget.cpp.html</TITLE></HEAD><BODY BGCOLOR=#FFFFFF TEXT=#000000><PRE><FONT COLOR=#a020f0>#include </FONT><FONT COLOR=#ff00ff><iostream></FONT>using namespace std;<FONT COLOR=#a020f0>#include </FONT><FONT COLOR=#ff00ff>"my_widget.h"</FONT><FONT COLOR=#008b8b>MyMainWindow::MyMainWindow</FONT>(QWidget* parent, <B><FONT COLOR=#2e8b57>const</FONT></B> <B><FONT COLOR=#2e8b57>char</FONT></B>* name):QMainWindow(parent, name){ CreateMenu(); <FONT COLOR=#5151fb>// create a button</FONT> buttonExit = <B><FONT COLOR=#853e26>new</FONT></B> QPushButton(<FONT COLOR=#ff00ff>"Exit"</FONT>, <B><FONT COLOR=#853e26>this</FONT></B>, <FONT COLOR=#ff00ff>0</FONT>); buttonExit->setGeometry(<FONT COLOR=#ff00ff>60</FONT>, <FONT COLOR=#ff00ff>60</FONT>, <FONT COLOR=#ff00ff>100</FONT>, <FONT COLOR=#ff00ff>40</FONT>);}<B><FONT COLOR=#2e8b57>void</FONT></B> MyMainWindow::CreateMenu(){ QPopupMenu* file = <B><FONT COLOR=#853e26>new</FONT></B> QPopupMenu(<B><FONT COLOR=#853e26>this</FONT></B>); file->insertItem(<FONT COLOR=#ff00ff>"Testing"</FONT>); file->insertItem(<FONT COLOR=#ff00ff>"Exit"</FONT>); menuBar()->insertItem(<FONT COLOR=#ff00ff>"File"</FONT>, file); QPopupMenu* help = <B><FONT COLOR=#853e26>new</FONT></B> QPopupMenu(<B><FONT COLOR=#853e26>this</FONT></B>); help->insertItem(<FONT COLOR=#ff00ff>"About"</FONT>); menuBar()->insertItem(<FONT COLOR=#ff00ff>"Help"</FONT>, help);}</PRE></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -