16,215
社区成员
发帖
与我相关
我的任务
分享
Widget::Widget(QWidget *parent)
: QWidget(parent),
{
QGridLayout *gridLayout = new QGridLayout( this );
...
m_label = new QLabel( tr("示例表格"), this );
gridLayout->addWidget(m_label, 0, 0);
//什么时候可以不用delete对象。
//Qt具有半自动内存管理机制,
//必须是QObject或其派生类的对象,并指定了父窗口(父子关系)。
QChartView *chartView;
chartView = new QChartView(createLineChart());
gridLayout->addWidget(chartView, 1, 0);
chartView = new QChartView(createBarChart(m_valueCount));
gridLayout->addWidget(chartView, 2, 0);
setLayout( gridLayout );
}