gpt4 book ai didi

linux - 关闭QT5应用程序窗口后显示未清除

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:45:49 25 4
gpt4 key购买 nike

我已经使用 yocto 为 TexasInstruments DRA7XX-EVM 板交叉编译了 Qt5.4.8。以下是我的配置选项。

QT_CONFIG_FLAGS = \
-rpath \
-pkg-config \
-opengl es2 \
-no-accessibility \
-dbus \
-no-directfb \
-evdev \
-make examples \
-compile-examples \
-no-fontconfig \
-freetype \
-no-iconv \
-icu \
-system-libjpeg \
-system-libpng \
-make libs \
-eglfs \
-kms \
-linuxfb \
-no-mitshm \
-no-mtdev -no-nis -openssl-linked -no-openvg -qt-pcre -pulseaudio -release -no-sm -no-sql-db2 -no-sql-ibase -no-sql-mysql -no-sql-oci -no-sql-odbc -no-sql-psql -no-sql-sqlite -no-sql-sqlite2 -no-sql-tds -nomake tests -make tools -no-tslib -libudev -widgets -no-xcb -no-xcursor -no-xfixes -no-xinerama -no-xinput -no-xinput2 -no-xkb -no-xkbcommon -no-xrandr -no-xrender -no-xshape -no-xsync -no-xvideo -system-zlib \
-no-wayland \
-force-pkg-config \

我已经在我的目标 shell 上导出了以下变量:

export QT_QPA_PLATFORM=linuxfb

export QT_QPA_GENERIC_PLUGINS=evdevtouch,evdevmouse,evdevkeyboard

export QT_QPA_EVDEV_KEYBOARD_PARAMETERS=grab=1

然后我运行我的应用程序:$./我的应用程序

窗口在屏幕上正确显示。但是当我退出应用程序时,屏幕并没有被清除。请检查我的配置选项并告诉我是否需要进行任何更改。还有一些关于在窗口关闭后清除帧缓冲区的解决方案。

最佳答案

我通过使用 qAddPostRoutine() 添加一个在退出时清除帧缓冲区的例程解决了这个问题。

清除函数如下:

//Used on exit to clear the fb
static void fbclear()
{
char dev[256] = "/dev/fb";
struct fb_var_screeninfo var_info;
int fd = open(dev, O_RDWR);
int line_size;
int buffer_size;
void *buffer = NULL;
if (fd < 0) {
printf("failed to open %s display device\n", dev);
return;
}
//get display size
ioctl (fd, FBIOGET_VSCREENINFO, &var_info);
line_size = var_info.xres * var_info.bits_per_pixel / 8;
buffer_size = line_size * var_info.yres;
//malloc buffer and set to 0
buffer = malloc(buffer_size);
memset(buffer, 0, buffer_size);
//write zeros to display
write(fd, buffer, buffer_size);
free(buffer);
close(fd);
return;
}

然后我将以下内容添加到我的 main() 中:

qAddPostRoutine(fbclear);

关于linux - 关闭QT5应用程序窗口后显示未清除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37321975/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com