XBEL stream example: use constructor initialization
The treeWidget member of MainWindow could be initialized before the body of the constructor, enabling it to be a *const variable. Pick-to: 6.6 6.5 Task-number: QTBUG-111228 Change-Id: If4a3b04729bc7fa5859ca88183eec376f6992455 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
This commit is contained in:
parent
d4d600d411
commit
5651be517a
@ -24,8 +24,8 @@ using namespace Qt::StringLiterals;
|
|||||||
|
|
||||||
//! [0]
|
//! [0]
|
||||||
MainWindow::MainWindow()
|
MainWindow::MainWindow()
|
||||||
|
: treeWidget(new QTreeWidget)
|
||||||
{
|
{
|
||||||
treeWidget = new QTreeWidget;
|
|
||||||
treeWidget->header()->setSectionResizeMode(QHeaderView::Stretch);
|
treeWidget->header()->setSectionResizeMode(QHeaderView::Stretch);
|
||||||
treeWidget->setHeaderLabels(QStringList{ tr("Title"), tr("Location") });
|
treeWidget->setHeaderLabels(QStringList{ tr("Title"), tr("Location") });
|
||||||
#if QT_CONFIG(clipboard) && QT_CONFIG(contextmenu)
|
#if QT_CONFIG(clipboard) && QT_CONFIG(contextmenu)
|
||||||
|
@ -28,7 +28,7 @@ public slots:
|
|||||||
private:
|
private:
|
||||||
void createMenus();
|
void createMenus();
|
||||||
|
|
||||||
QTreeWidget *treeWidget;
|
QTreeWidget *const treeWidget;
|
||||||
};
|
};
|
||||||
//! [0]
|
//! [0]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user