<style type="text/css"> <!-- @page {margin:2cm} pre {font-family:"DejaVu Sans Mono",monospace} p {margin-bottom:0.21cm} strong {font-style:italic; font-weight:normal} --> </style>

修改VowelCube例子使其正确地显示

大名鼎鼎的Qt教程C++GUI Programming with Qt 4, secondedition》源代码出现了错误VowelCube例子在我的计算机(UbuntuWindows8)无法运行。Ubuntu下无法显示三维图形,Windows8显示出现错误而崩溃。

后来查看了相关的论坛,我了解了怎样修改这个例子使其顺利地运行。资源下载地址:这里

首先在构造函数中添加以下的代码,不填充背景和不自动进行缓存交换。

setAutoBufferSwap( false );
setAutoFillBackground( false );

然后在重写的paintEvent()函数中添加下面的代码:

QPainter painter( this );
drawBackground( &painter );
painter.end( );
drawCube( );
painter.begin(this);
drawLegend(&painter);
painter.end( );
swapBuffers( );

编译,即可运行。

修改VowelCube例子使其正确地显示

修改VowelCube例子使其正确地显示

相关文章:

  • 2022-12-23
  • 2022-02-10
  • 2022-01-01
  • 2021-11-19
  • 2022-12-23
  • 2022-12-23
  • 2021-05-27
猜你喜欢
  • 2022-01-25
  • 2022-12-23
  • 2021-06-30
  • 2021-09-11
  • 2022-01-24
  • 2021-10-18
  • 2021-12-04
相关资源
相似解决方案