⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 my_widget.cpp.html

📁 qt example for users
💻 HTML
字号:
<HTML><HEAD><TITLE>my_widget.cpp.html</TITLE></HEAD><BODY BGCOLOR=#FFFFFF TEXT=#000000><PRE><FONT COLOR=#a020f0>#include </FONT><FONT COLOR=#ff00ff>&lt;iostream&gt;</FONT>using namespace std;<FONT COLOR=#a020f0>#include </FONT><FONT COLOR=#ff00ff>&quot;my_widget.h&quot;</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>&quot;Exit&quot;</FONT>, <B><FONT COLOR=#853e26>this</FONT></B>, <FONT COLOR=#ff00ff>0</FONT>);	buttonExit-&gt;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-&gt;insertItem(<FONT COLOR=#ff00ff>&quot;Testing&quot;</FONT>);	file-&gt;insertItem(<FONT COLOR=#ff00ff>&quot;Exit&quot;</FONT>);	menuBar()-&gt;insertItem(<FONT COLOR=#ff00ff>&quot;File&quot;</FONT>, file);	QPopupMenu* help = <B><FONT COLOR=#853e26>new</FONT></B> QPopupMenu(<B><FONT COLOR=#853e26>this</FONT></B>);	help-&gt;insertItem(<FONT COLOR=#ff00ff>&quot;About&quot;</FONT>);	menuBar()-&gt;insertItem(<FONT COLOR=#ff00ff>&quot;Help&quot;</FONT>, help);}</PRE></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -