如何在QT 4.5.2中使用XCreateWindow创建的窗口上显示对话框

时间:2009-09-11 07:32:09

标签: c++ qt4

我正在做项目工作。我在其中开发了一个使用XCreateWindow显示图像的全尺寸屏幕。现在我想在这个屏幕上显示一个对话框。我创建了一个它没有在全尺寸屏幕上显示的QDialog,但是当它不是全尺寸时它会显示在屏幕上。任何帮助。我创建屏幕和对话框的代码如下

XSetWindowAttributes attribs;
XClassHint *classhints;
XSizeHints *sizehints;
int wndwidth, wndheight;
long input_mask, ic_input_mask;
XEvent xevent;

wndwidth = fullscreen ? WidthOfScreen(screen) : width;
wndheight = fullscreen ? HeightOfScreen(screen) : height;

attribs.background_pixel = BlackPixelOfScreen(screen);

attribs.backing_store = ownbackstore ? NotUseful : Always;

attribs.override_redirect = fullscreen;

wnd = XCreateWindow(display, RootWindowOfScreen(screen), 0, 0, wndwidth,
wndheight, 0, CopyFromParent, InputOutput, CopyFromParent,
CWBackPixel | CWBackingStore | CWOverrideRedirect, &attribs);


XRaiseWindow(display, wnd);

//QDialog I want to show on wnd(XCreateWindow)
ToolbarDialog *objToolbarDialog= new ToolbarDialog();
objToolbarDialog->setVisible(true);
objToolbarDialog->showNormal();

1 个答案:

答案 0 :(得分:0)

你的例子不是Qt代码 - 所以你混淆了吗?

请注意:不要混淆Qt代码和直接调用X11 lib!大多数Qt类需要QApplication对象才能工作。

侨, 克里斯