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

📄 mainlyxt-editor-cpp.html

📁 qtopiaphone英文帮助,用于初学者和开发人员,初学者可以用来学习,开发人员可以用来资料查询.
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Qt Toolkit - mainlyXt/editor.cpp example file</title><style type="text/css"><!--h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }a:link { color: #004faf; text-decoration: none }a:visited { color: #672967; text-decoration: none }body { background: white; color: black; }--></style></head><body bgcolor="#ffffff"><table width="100%"><tr><td><a href="index.html"><img width="100" height="100" src="qtlogo.png"alt="Home" border="0"><img width="100"height="100" src="face.png" alt="Home" border="0"></a><td valign="top"><div align="right"><img src="dochead.png" width="472" height="27"><br><a href="classes.html"><b>Classes</b></a>- <a href="annotated.html">Annotated</a>- <a href="hierarchy.html">Tree</a>- <a href="functions.html">Functions</a>- <a href="index.html">Home</a>- <a href="topicals.html"><b>Structure</b>  <font face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular" align="center" size=32>Qte</font></a></div></table><h1 align=center>Editor Example</h1>  <p>  This example shows two simple text editors, with most of the  program written in Xt.  One editor is a Qt QMultiLineEdit, the  other is an Athena Widgets text widget.  They are bound together  in an Xt form widget.<pre>#include "<a name="qxt.h"></a><a href="qxt-h.html">qxt.h</a>"#include &lt;<a name="qmultilineedit.h"></a><a href="qmultilineedit-h.html">qmultilineedit.h</a>&gt;#include &lt;<a name="qpainter.h"></a><a href="qpainter-h.html">qpainter.h</a>&gt;#include &lt;<a name="qmessagebox.h"></a><a href="qmessagebox-h.html">qmessagebox.h</a>&gt;#include &lt;X11/Shell.h&gt;#include &lt;X11/StringDefs.h&gt;#include &lt;X11/Xaw/Form.h&gt;#include &lt;X11/Xaw/AsciiText.h&gt;static const char* QTEDMSG =    "This is a Qt widget.\nIt is a QMultiLineEdit.";static const char* XTEDMSG =    "This is an Xt widget.\nIt is an asciiTextWidgetClass.";class EncapsulatedQtWidget : public QXtWidget {public:    <a name="QMultiLineEdit"></a><a href="qmultilineedit.html">QMultiLineEdit</a>* mle;    EncapsulatedQtWidget(Widget parent) :        <a name="QXtWidget"></a><a href="qxtwidget.html">QXtWidget</a>("editor", parent, TRUE)    {        mle = new <a href="qmultilineedit.html">QMultiLineEdit</a>(this);        mle-&gt;<a name="setText"></a><a href="qmultilineedit.html#3fd8c1">setText</a>(QTEDMSG);    }    void resizeEvent(<a name="QResizeEvent"></a><a href="qresizeevent.html">QResizeEvent</a>* e )    {        <a name="QXtWidget::resizeEvent"></a><a href="qxtwidget.html#71ff15">QXtWidget::resizeEvent</a>( e );        mle-&gt;<a name="resize"></a><a href="qwidget.html#ff9d07">resize</a>(width(),height());    }};main(int argc, char** argv){    XtAppContext app;    Widget toplevel = XtAppInitialize(        &amp;app, "Editors",        0, 0, &amp;argc, argv, 0, 0, 0);    <a name="QXtApplication"></a><a href="qxtapplication.html">QXtApplication</a> qapp(XtDisplay(toplevel));    Widget form = XtVaCreateManagedWidget("form", formWidgetClass, toplevel, 0);    EncapsulatedQtWidget qtchild(form);    Arg args[20];    Cardinal nargs=0;    XtSetArg(args[nargs], XtNwidth, 200);                    nargs++;    XtSetArg(args[nargs], XtNheight, 200);                   nargs++;    XtSetValues(qtchild.<a name="xtWidget"></a><a href="qxtwidget.html#a2c32d">xtWidget</a>(), args, nargs);    nargs=0;    XtSetArg(args[nargs], XtNeditType, XawtextEdit);         nargs++;    XtSetArg(args[nargs], XtNstring, XTEDMSG);               nargs++;    XtSetArg(args[nargs], XtNwidth, 200);                    nargs++;    XtSetArg(args[nargs], XtNheight, 200);                   nargs++;    XtSetArg(args[nargs], XtNfromHoriz, qtchild.<a href="qxtwidget.html#a2c32d">xtWidget</a>()); nargs++;    Widget xtchild = XtCreateManagedWidget("editor", asciiTextWidgetClass,        form, args, nargs);    XtRealizeWidget(toplevel);//     XSetInputFocus( qt_xdisplay(), qtchild.mle-&gt;winId(), RevertToParent, CurrentTime );    //XtAppMainLoop(app);    // or the equivalent:    XEvent xe;    while (1)    {        XtAppNextEvent(app, &amp;xe);        XtDispatchEvent(&amp;xe);    }}</pre><p><address><hr><div align="center"><table width="100%" cellspacing="0" border="0"><tr><td>Copyright 

⌨️ 快捷键说明

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