⚲
Project
General
Profile
Sign in
Register
Home
Projects
Help
Search
:
Wt
All Projects
Wt
Overview
Activity
Roadmap
Issues
Wiki
Forums
Download (843 Bytes)
RE: Wt::WFileUpload::setDisplayWidget does't work with image
» forum_16484.cpp
The code -
Roel Standaert, 08/22/2019 11:11 AM
#include
<Wt/WApplication.h>
#include
<Wt/WContainerWidget.h>
#include
<Wt/WFileUpload.h>
#include
<Wt/WImage.h>
#include
<Wt/WLink.h>
#include
<Wt/WServer.h>
#include
<memory>
int
main
(
int
argc
,
char
**
argv
)
{
return
Wt
::
WRun
(
argc
,
argv
,
[](
const
Wt
::
WEnvironment
&
env
)
{
auto
app
=
std
::
make_unique
<
Wt
::
WApplication
>
(
env
);
auto
c
=
app
->
root
()
->
addNew
<
Wt
::
WContainerWidget
>
();
c
->
setStyleClass
(
"image-input-wrapper"
);
Wt
::
WImage
*
img
=
c
->
addWidget
(
std
::
make_unique
<
Wt
::
WImage
>
(
Wt
::
WLink
(
Wt
::
LinkType
::
Url
,
"/my_img.png"
)));
img
->
setStyleClass
(
"rounded-circle"
);
img
->
setWidth
(
Wt
::
WLength
(
100
,
Wt
::
LengthUnit
::
Pixel
));
img
->
setHeight
(
Wt
::
WLength
(
100
,
Wt
::
LengthUnit
::
Pixel
));
Wt
::
WFileUpload
*
fu
=
c
->
addWidget
(
std
::
make_unique
<
Wt
::
WFileUpload
>
());
fu
->
setDisplayWidget
(
img
);
return
app
;
});
}
« Previous
1
2
Next »
(1-1/2)
Loading...