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. Task-number: QTBUG-111228 Change-Id: If4a3b04729bc7fa5859ca88183eec376f6992455 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> (cherry picked from commit 5651be517a9f25798a051f7dd7548d40381148df) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
bda8c5216c
commit
95ed706e82
@ -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