⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Wt
All Projects
Wt
Overview
Activity
Roadmap
Issues
Wiki
Forums
Download (1.29 KB)
Bug #11505
ยป wt_bug_setHeaderData.cpp
Tibor Miseta
, 04/07/2023 07:37 PM
/*
* wt_bug_thread.cpp
*
* Created on: Apr 3, 2023
* Author: oldfashioned
*/
#include
<Wt/WApplication.h>
#include
<Wt/WTreeView.h>
#include
<Wt/WContainerWidget.h>
#include
<Wt/WStandardItem.h>
#include
<Wt/WStandardItemModel.h>
class
HelloApplication
:
public
Wt
::
WApplication
{
public:
HelloApplication
(
const
Wt
::
WEnvironment
&
env
)
:
Wt
::
WApplication
(
env
)
{
setTitle
(
"Set Header Data"
);
auto
model
=
std
::
make_shared
<
Wt
::
WStandardItemModel
>
();
// ***** This call here crashes the program, it exits unexpectedly ****
model
->
setHeaderData
(
0
,
Wt
::
Orientation
::
Horizontal
,
std
::
string
(
"Header"
));
for
(
int
i
=
0
;
i
<
5
;
i
++
)
{
auto
item
=
std
::
make_unique
<
Wt
::
WStandardItem
>
();
item
->
setText
(
"Item"
);
model
->
invisibleRootItem
()
->
appendRow
(
std
::
move
(
item
));
}
// ***** Calling it here is OK ****
// model->setHeaderData(0, Wt::Orientation::Horizontal, std::string("Header"));
auto
view
=
std
::
make_unique
<
Wt
::
WTreeView
>
();
view
->
setModel
(
model
);
root
()
->
addWidget
(
std
::
move
(
view
));
}
};
int
main
(
int
argc
,
char
**
argv
)
{
return
Wt
::
WRun
(
argc
,
argv
,
[](
const
Wt
::
WEnvironment
&
env
)
{
return
std
::
make_unique
<
HelloApplication
>
(
env
);
});
}
(1-1/1)
Loading...