首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > QT开发 >

QT解决办法

2012-07-31 
QThlayout1 new QHBoxLayout(this)hlayout1 - addWidget(previousbutton)hlayout1 - addWidget(play

QT

  hlayout1 = new QHBoxLayout(this);
  hlayout1 -> addWidget(previousbutton);
  hlayout1 -> addWidget(playbutton);
  hlayout1 -> addWidget(stopbutton);
  hlayout1 -> addWidget(nextbutton);
  hlayout1 -> addWidget(volumeslider);

  hlayout2 = new QHBoxLayout(this);
  hlayout2 -> addWidget(hslider);
  hlayout2 -> addWidget(timeedit);


  hlayout3=new QHBoxLayout(this);
  hlayout3 -> addWidget(openbutton);
  hlayout3 -> addWidget(listbutton);
  hlayout3 -> addWidget(lrcbutton);

  vlayout = new QVBoxLayout(this);
  vlayout ->addLayout(hlayout1);
  vlayout ->addLayout(hlayout2);
  vlayout ->addLayout(hlayout3);

  widget = new QWidget(this);
  widget -> setLayout(vlayout);
  setCentralWidget(widget);


调试结果为:

&"warning: GDB: Failed to set controlling terminal: Invalid argument\n"
QLayout: Attempting to add QLayout "" to MainWindow "", which already has a layout
QLayout: Attempting to add QLayout "" to MainWindow "", which already has a layout
QLayout: Attempting to add QLayout "" to MainWindow "", which already has a layout
QLayout: Attempting to add QLayout "" to MainWindow "", which already has a layout
运行都正常,就是这些显示红色警报,求指导啊


[解决办法]
layout可以不用指定父
[解决办法]
hlayout1 = new QHBoxLayout(this);

(this)去掉

热点排行