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

📄 editor.cpp

📁 Linux 下的图形编程环境。
💻 CPP
字号:
#include "qxt.h"#include <qmultilinedit.h>#include <qpainter.h>#include <qmessagebox.h>#include <X11/Shell.h>#include <X11/StringDefs.h>#include <X11/Xaw/Form.h>#include <X11/Xaw/AsciiText.h>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:    QMultiLineEdit* mle;    EncapsulatedQtWidget(Widget parent) :	QXtWidget("editor", parent, TRUE)    {	mle = new QMultiLineEdit(this);	mle->setText(QTEDMSG);    }    void resizeEvent(QResizeEvent* e )    {	QXtWidget::resizeEvent( e );	mle->resize(width(),height());    }};main(int argc, char** argv){    XtAppContext app;    Widget toplevel = XtAppInitialize(	&app, "Editors",	0, 0, &argc, argv, 0, 0, 0);    QXtApplication 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.xtWidget(), 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.xtWidget()); nargs++;    Widget xtchild = XtCreateManagedWidget("editor", asciiTextWidgetClass,	form, args, nargs);    XtRealizeWidget(toplevel);//     XSetInputFocus( qt_xdisplay(), qtchild.mle->winId(), RevertToParent, CurrentTime );    //XtAppMainLoop(app);    // or the equivalent:    XEvent xe;    while (1)    {	XtAppNextEvent(app, &xe);	XtDispatchEvent(&xe);    }}

⌨️ 快捷键说明

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