-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathQtCustomAndroidWebView.cpp
63 lines (52 loc) · 1.95 KB
/
QtCustomAndroidWebView.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include "QtCustomAndroidWebView.h"
//#include <QtWidgets/QLayout>
//-----------------------------------------------------------------------------
int QtCustomAndroidWebView::sm_tag = 0;
//-----------------------------------------------------------------------------
QtCustomAndroidWebView::QtCustomAndroidWebView( QWidget *parent )
: QWidget( parent )
, m_androidID( generateNewTag() )
{
// if( parent && parent->layout() )
// parent->layout()->addWidget( this );
m_nativeSender.createNewWebView( androidID() );
m_nativeSender.attachWebViewToMainLayout( androidID() );
}
//-----------------------------------------------------------------------------
QtCustomAndroidWebView::~QtCustomAndroidWebView()
{
m_nativeSender.removeWebView( androidID() );
}
//-----------------------------------------------------------------------------
void QtCustomAndroidWebView::loadURL( QString const& url ) const
{
m_nativeSender.loadUrlAtWebView( androidID(), url );
}
//-----------------------------------------------------------------------------
void QtCustomAndroidWebView::loadHtmlData( QString const& data ) const
{
m_nativeSender.loadHtmlAtWebView( androidID(), data );
}
//-----------------------------------------------------------------------------
void QtCustomAndroidWebView::move( int x, int y )
{
QWidget::move( x, y );
m_nativeSender.moveWebView( androidID(), x, y );
}
//-----------------------------------------------------------------------------
void QtCustomAndroidWebView::move( QPoint const& p )
{
QtCustomAndroidWebView::move( p.x(), p.y() );
}
//-----------------------------------------------------------------------------
void QtCustomAndroidWebView::resize( int w, int h )
{
QWidget::resize( w, h );
m_nativeSender.resizeWebView( androidID(), w, h );
}
//-----------------------------------------------------------------------------
int QtCustomAndroidWebView::generateNewTag()
{
sm_tag++;
return sm_tag;
}