本文整理汇总了C++中QWebFrame::securityOrigin方法的典型用法代码示例。如果您正苦于以下问题:C++ QWebFrame::securityOrigin方法的具体用法?C++ QWebFrame::securityOrigin怎么用?C++ QWebFrame::securityOrigin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWebFrame
的用法示例。
在下文中一共展示了QWebFrame::securityOrigin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: securityOrigin
QWebSecurityOrigin QWebFrameProto::securityOrigin() const
{
scriptDeprecated("QWebFrame will not be available in future versions");
QWebFrame *item = qscriptvalue_cast<QWebFrame*>(thisObject());
if (item)
return item->securityOrigin();
#if QT_VERSION >= 0x050000
return QWebSecurityOrigin(QUrl());
#else
return QWebSecurityOrigin(QWebSecurityOrigin::allOrigins().first()); // TODO: what's better?
#endif
}
示例2: QDialog
SiteInfo::SiteInfo(WebView* view, QWidget* parent)
: QDialog(parent)
, ui(new Ui::SiteInfo)
, m_certWidget(0)
, m_view(view)
{
setAttribute(Qt::WA_DeleteOnClose);
ui->setupUi(this);
ui->listWidget->item(0)->setIcon(QIcon::fromTheme("document-properties", QIcon(":/icons/preferences/document-properties.png")));
ui->listWidget->item(1)->setIcon(QIcon::fromTheme("applications-graphics", QIcon(":/icons/preferences/applications-graphics.png")));
ui->listWidget->item(2)->setIcon(QIcon::fromTheme("text-x-sql", QIcon(":/icons/preferences/text-x-sql.png")));
ui->listWidget->item(3)->setIcon(QIcon::fromTheme("dialog-password", QIcon(":/icons/preferences/dialog-password.png")));
ui->listWidget->item(0)->setSelected(true);
WebPage* webPage = view->page();
QWebFrame* frame = view->page()->mainFrame();
QString title = view->title();
QSslCertificate cert = webPage->sslCertificate();
m_baseUrl = frame->baseUrl();
//GENERAL
ui->heading->setText(QString("<b>%1</b>:").arg(title));
ui->siteAddress->setText(view->url().toString());
ui->sizeLabel->setText(qz_fileSizeToString(webPage->totalBytes()));
QString encoding;
//Meta
QWebElementCollection meta = frame->findAllElements("meta");
for (int i = 0; i < meta.count(); i++) {
QWebElement element = meta.at(i);
QString content = element.attribute("content");
QString name = element.attribute("name");
if (name.isEmpty()) {
name = element.attribute("http-equiv");
}
if (!element.attribute("charset").isEmpty()) {
encoding = element.attribute("charset");
}
if (content.contains(QLatin1String("charset="))) {
encoding = content.mid(content.indexOf(QLatin1String("charset=")) + 8);
}
if (content.isEmpty() || name.isEmpty()) {
continue;
}
QTreeWidgetItem* item = new QTreeWidgetItem(ui->treeTags);
item->setText(0, name);
item->setText(1, content);
ui->treeTags->addTopLevelItem(item);
}
if (encoding.isEmpty()) {
encoding = mApp->webSettings()->defaultTextEncoding();
}
ui->encodingLabel->setText(encoding.toUpper());
//MEDIA
QWebElementCollection img = frame->findAllElements("img");
for (int i = 0; i < img.count(); i++) {
QWebElement element = img.at(i);
QString src = element.attribute("src");
QString alt = element.attribute("alt");
if (alt.isEmpty()) {
if (src.indexOf(QLatin1Char('/')) == -1) {
alt = src;
}
else {
int pos = src.lastIndexOf(QLatin1Char('/'));
alt = src.mid(pos);
alt.remove(QLatin1Char('/'));
}
}
if (src.isEmpty() || alt.isEmpty()) {
continue;
}
QTreeWidgetItem* item = new QTreeWidgetItem(ui->treeImages);
item->setText(0, alt);
item->setText(1, src);
ui->treeImages->addTopLevelItem(item);
}
//DATABASES
const QList<QWebDatabase> &databases = frame->securityOrigin().databases();
int counter = 0;
foreach(const QWebDatabase & b, databases) {
QListWidgetItem* item = new QListWidgetItem(ui->databaseList);
item->setText(b.displayName());
item->setData(Qt::UserRole + 10, counter);
++counter;
}