0

QWidget::create 関数を使用して QWidget を X11 ウィンドウに配置しようとしていますが、1 つではなく 2 つのウィンドウが表示されます。

class QTkMainWindow: public QWidget {
    public:
         QTkMainWindow(WId win)
         :QWidget() {
              QWidget::create(win, true, true);
         }
};

void createApp(int argc, char **argv) {
    Display *d;
    Window w;
    XEvent e;
    int s;

    d = XOpenDisplay(NULL);
    s = DefaultScreen(d);
    w = XCreateSimpleWindow(d, RootWindow(d, s), 10, 10, 100, 100, 1,
                       BlackPixel(d, s), WhitePixel(d, s));
    XSelectInput(d, w, ExposureMask | KeyPressMask);


    QApplication *qapp = new QApplication(argc, argv);
    QTkMainWindow *win = new QTkMainWindow(w);
    win->show();        

    XMapWindow(d, w);

    while (1) {
        XNextEvent(d, &e);
        qapp->processEvents();
        if (e.type == KeyPress)
            break;
    }
}

何が欠けているのか誰か教えてもらえますか?

ありがとう!

4

0 に答える 0