代码拉取完成,页面将自动刷新
同步操作将从 murphy/QTLauncher 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#include "browser.h"
#include <QVBoxLayout>
#include <QComboBox>
#include <QtDebug>
namespace ui {
AddressBar::AddressBar(QWidget *parent) :
QWidget(parent)
{
//mAddressEdit = new QLineEdit(parent);
mAddressEdit = new QComboBox(parent);
mGoButton = new QPushButton("Go", parent);
mLayout = new QHBoxLayout(this);
mLayout->addWidget(mAddressEdit);
mLayout->addWidget(mGoButton);
mAddressEdit->addItem("www.baidu.com");
mAddressEdit->addItem("www.google.com");
mAddressEdit->addItem("www.hao123.com");
mAddressEdit->addItem("www.163.com");
mAddressEdit->addItem("www.sina.com.cn");
mAddressEdit->addItem("www.qq.com");
mAddressEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
connect(mGoButton, SIGNAL(clicked()), this, SLOT(goToSite()));
//connect(mAddressEdit, SIGNAL(returnPressed()), this, SLOT(goToSite()));
}
AddressBar::~AddressBar()
{
#if 0
delete mAddressEdit;
delete mGoButton;
#endif
}
void AddressBar::goToSite()
{
//qDebug() << __FILE__ << __func__ << __LINE__;
//QString address = mAddressEdit->text();
QString address = mAddressEdit->currentText();
if( !address.contains("http://") && !address.contains("https://") ) {
address = "http://" + address;
}
//qDebug() << __FILE__ << __func__ << __LINE__;
if (!address.isEmpty()){
//qDebug() << __FILE__ << __func__ << __LINE__;
emit go(QUrl(address));
}
}
HtmlView::HtmlView(QWidget *parent) :
QWebView(parent)
{
}
void HtmlView::loadNewPage(const QUrl &url)
{
//qDebug() << __FILE__ << __func__ << __LINE__ << url;
this->load(url);
}
Broswer::Broswer(QWidget *parent)
:BaseWidget(parent)
{
QVBoxLayout *layout = centralLayout();
mBar = new AddressBar;
mView = new HtmlView;
layout->addWidget(mBar);
layout->addWidget(mView);
layout->addStretch(1);
connect(mBar, SIGNAL(go(QUrl)), mView, SLOT(loadNewPage(QUrl)));
setWindowTitle("Browser v1.0");
setFixedSize(800, 480);
}
Broswer::~Broswer()
{
delete mBar;
delete mView;
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。