本文整理汇总了C++中QWebSettings::testAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ QWebSettings::testAttribute方法的具体用法?C++ QWebSettings::testAttribute怎么用?C++ QWebSettings::testAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWebSettings
的用法示例。
在下文中一共展示了QWebSettings::testAttribute方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadDefaults
void SettingsDialog::loadDefaults()
{
QWebSettings *defaultSettings = QWebSettings::globalSettings();
QString standardFontFamily = defaultSettings->fontFamily(QWebSettings::StandardFont);
int standardFontSize = defaultSettings->fontSize(QWebSettings::DefaultFontSize);
m_standardFont = QFont(standardFontFamily, standardFontSize);
standardLabel->setText(QString(QLatin1String("%1 %2")).arg(m_standardFont.family()).arg(m_standardFont.pointSize()));
QString fixedFontFamily = defaultSettings->fontFamily(QWebSettings::FixedFont);
int fixedFontSize = defaultSettings->fontSize(QWebSettings::DefaultFixedFontSize);
m_fixedFont = QFont(fixedFontFamily, fixedFontSize);
fixedLabel->setText(QString(QLatin1String("%1 %2")).arg(m_fixedFont.family()).arg(m_fixedFont.pointSize()));
downloadsLocation->setText(QDesktopServices::storageLocation(QDesktopServices::DesktopLocation));
blockPopupWindows->setChecked(!defaultSettings->testAttribute(QWebSettings::JavascriptCanOpenWindows));
enableJavascript->setChecked(defaultSettings->testAttribute(QWebSettings::JavascriptEnabled));
enablePlugins->setChecked(defaultSettings->testAttribute(QWebSettings::PluginsEnabled));
enableImages->setChecked(defaultSettings->testAttribute(QWebSettings::AutoLoadImages));
clickToFlash->setChecked(false);
cookieSessionCombo->setCurrentIndex(0);
filterTrackingCookiesCheckbox->setChecked(false);
autoFillPasswordFormsCheckBox->setChecked(false);
minimFontSizeCheckBox->setChecked(false);
minimumFontSizeSpinBox->setValue(9);
}
示例2: updateWindowTitle
void MainWindow::updateWindowTitle(const QString &title)
{
QWebSettings *settings = QWebSettings::globalSettings();
if (title.isEmpty())
{
if (settings->testAttribute(QWebSettings::PrivateBrowsingEnabled))
{
setWindowTitle(i18nc("Window title when private browsing is activated", "rekonq (Private Browsing)"));
}
else
{
setWindowTitle("rekonq");
}
}
else
{
if (settings->testAttribute(QWebSettings::PrivateBrowsingEnabled))
{
setWindowTitle(i18nc("window title, %1 = title of the active website", "%1 – rekonq (Private Browsing)", title));
}
else
{
setWindowTitle(i18nc("window title, %1 = title of the active website", "%1 – rekonq", title));
}
}
}
示例3: updateRow
void DownloadManager::updateRow()
{
DownloadItem *item = qobject_cast<DownloadItem*>(sender());
int row = m_downloads.indexOf(item);
if (-1 == row)
return;
if (!m_iconProvider)
m_iconProvider = new QFileIconProvider();
QIcon icon = m_iconProvider->icon(item->m_output.fileName());
if (icon.isNull())
icon = style()->standardIcon(QStyle::SP_FileIcon);
item->fileIcon->setPixmap(icon.pixmap(48, 48));
downloadsView->setRowHeight(row, item->minimumSizeHint().height());
bool remove = false;
QWebSettings *globalSettings = QWebSettings::globalSettings();
if (!item->downloading()
&& globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled))
remove = true;
if (item->downloadedSuccessfully()
&& removePolicy() == DownloadManager::SuccessFullDownload) {
remove = true;
}
if (remove)
m_model->removeRow(row);
cleanupButton->setEnabled(m_downloads.count() - activeDownloads() > 0);
}
示例4: searchNow
void ToolbarSearch::searchNow()
{
QString searchText = lineEdit()->text();
QStringList newList = m_stringListModel->stringList();
if (newList.contains(searchText))
newList.removeAt(newList.indexOf(searchText));
newList.prepend(searchText);
if (newList.size() >= m_maxSavedSearches)
newList.removeLast();
QWebSettings *globalSettings = QWebSettings::globalSettings();
if (!globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled)) {
m_stringListModel->setStringList(newList);
m_autosaver->changeOccurred();
}
QUrl url(QLatin1String("http://www.google.com/search"));
QUrlQuery urlQuery;
urlQuery.addQueryItem(QLatin1String("q"), searchText);
urlQuery.addQueryItem(QLatin1String("ie"), QLatin1String("UTF-8"));
urlQuery.addQueryItem(QLatin1String("oe"), QLatin1String("UTF-8"));
urlQuery.addQueryItem(QLatin1String("client"), QLatin1String("qtdemobrowser"));
url.setQuery(urlQuery);
emit search(url);
}
示例5: saveSession
void BrowserApplication::saveSession()
{
if (quiting)
return;
QSettings settings;
settings.beginGroup(QLatin1String("MainWindow"));
settings.setValue(QLatin1String("restoring"), false);
settings.endGroup();
QWebSettings *globalSettings = QWebSettings::globalSettings();
if (globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled))
return;
clean();
settings.beginGroup(QLatin1String("sessions"));
int version = 2;
QByteArray data;
QBuffer buffer(&data);
QDataStream stream(&buffer);
buffer.open(QIODevice::WriteOnly);
stream << qint32(BrowserApplicationMagic);
stream << qint32(version);
stream << qint32(m_mainWindows.count());
for (int i = 0; i < m_mainWindows.count(); ++i)
stream << m_mainWindows.at(i)->saveState();
settings.setValue(QLatin1String("lastSession"), data);
settings.endGroup();
}
示例6: destroy
void Manitou::destroy()
{
QSettings settings;
QWebSettings *globalSettings = QWebSettings::globalSettings();
settings.beginGroup("WebKit");
settings.setValue("AutoLoadImages", globalSettings->testAttribute(QWebSettings::AutoLoadImages));
settings.setValue("DevelopersExtras", globalSettings->testAttribute(QWebSettings::DeveloperExtrasEnabled));
settings.setValue("Plugins", globalSettings->testAttribute(QWebSettings::PluginsEnabled));
settings.setValue("LocalStorage", globalSettings->testAttribute(QWebSettings::LocalStorageEnabled));
settings.setValue("LocalDatabase", globalSettings->testAttribute(QWebSettings::LocalStorageDatabaseEnabled));
settings.endGroup();
delete searchHistory;
database.destroy();
delete wiiRemote;
}
示例7: loadDefaults
void SettingsDialog::loadDefaults()
{
QWebSettings *defaultSettings = QWebSettings::globalSettings();
QString standardFontFamily = defaultSettings->fontFamily(QWebSettings::StandardFont);
int standardFontSize = defaultSettings->fontSize(QWebSettings::DefaultFontSize);
standardFont = QFont(standardFontFamily, standardFontSize);
standardLabel->setText(QString(QLatin1String("%1 %2")).arg(standardFont.family()).arg(standardFont.pointSize()));
QString fixedFontFamily = defaultSettings->fontFamily(QWebSettings::FixedFont);
int fixedFontSize = defaultSettings->fontSize(QWebSettings::DefaultFixedFontSize);
fixedFont = QFont(fixedFontFamily, fixedFontSize);
fixedLabel->setText(QString(QLatin1String("%1 %2")).arg(fixedFont.family()).arg(fixedFont.pointSize()));
downloadsLocation->setText(QStandardPaths::writableLocation(QStandardPaths::DesktopLocation));
enableJavascript->setChecked(defaultSettings->testAttribute(QWebSettings::JavascriptEnabled));
enablePlugins->setChecked(defaultSettings->testAttribute(QWebSettings::PluginsEnabled));
}
示例8: loadDefaults
void SettingsDialog::loadDefaults()
{
QWebSettings *defaultSettings = QWebSettings::globalSettings();
QString standardFontFamily = defaultSettings->fontFamily(QWebSettings::StandardFont);
int standardFontSize = defaultSettings->fontSize(QWebSettings::DefaultFontSize);
standardFont = QFont(standardFontFamily, standardFontSize);
standardLabel->setText(QString(QLatin1String("%1 %2")).arg(standardFont.family()).arg(standardFont.pointSize()));
QString fixedFontFamily = defaultSettings->fontFamily(QWebSettings::FixedFont);
int fixedFontSize = defaultSettings->fontSize(QWebSettings::DefaultFixedFontSize);
fixedFont = QFont(fixedFontFamily, fixedFontSize);
fixedLabel->setText(QString(QLatin1String("%1 %2")).arg(fixedFont.family()).arg(fixedFont.pointSize()));
downloadsLocation->setText(QDesktopServices::storageLocation(QDesktopServices::DesktopLocation));
blockPopupWindows->setChecked(!defaultSettings->testAttribute(QWebSettings::JavascriptCanOpenWindows));
enableJavascript->setChecked(defaultSettings->testAttribute(QWebSettings::JavascriptEnabled));
enablePlugins->setChecked(defaultSettings->testAttribute(QWebSettings::PluginsEnabled));
enableImages->setChecked(defaultSettings->testAttribute(QWebSettings::AutoLoadImages));
clickToFlash->setChecked(true);
}
示例9: addHistoryEntry
void HistoryManager::addHistoryEntry(const QString &url)
{
QWebSettings *globalSettings = QWebSettings::globalSettings();
if (globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled))
return;
QUrl cleanUrl(url);
// don't store about: urls (home page related)
if (cleanUrl.scheme() == QString("about"))
return;
cleanUrl.setPassword(QString());
cleanUrl.setHost(cleanUrl.host().toLower());
QString checkUrlString = cleanUrl.toString();
HistoryItem item;
// NOTE
// check if the url has just been visited.
// if so, remove previous entry from history, update and prepend it
if(historyContains(checkUrlString))
{
int index = m_historyFilterModel->historyLocation(checkUrlString);
item = m_history.at(index);
m_history.removeOne(item);
emit entryRemoved(item);
item.dateTime = QDateTime::currentDateTime();
item.visitCount++;
}
else
{
item = HistoryItem(checkUrlString, QDateTime::currentDateTime());
}
m_history.prepend(item);
emit entryAdded(item);
if (m_history.count() == 1)
checkForExpired();
}
示例10: searchNow
void ToolbarSearch::searchNow()
{
QString searchText = text();
QStringList newList = m_recentSearches;
if (newList.contains(searchText))
newList.removeAt(newList.indexOf(searchText));
newList.prepend(searchText);
if (newList.size() >= m_maxSavedSearches)
newList.removeLast();
QWebSettings *globalSettings = QWebSettings::globalSettings();
if (!globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled)) {
m_recentSearches = newList;
m_autosaver->changeOccurred();
}
QUrl url(QLatin1String("http://www.google.com/search"));
url.addEncodedQueryItem(QUrl::toPercentEncoding(QLatin1String("q")),
QUrl::toPercentEncoding(searchText));
url.addQueryItem(QLatin1String("ie"), QLatin1String("UTF-8"));
url.addQueryItem(QLatin1String("oe"), QLatin1String("UTF-8"));
url.addQueryItem(QLatin1String("client"), QCoreApplication::applicationName());
emit search(url);
}
示例11: loadDefaults
void SettingsDialog::loadDefaults()
{
QWebSettings *defaultSettings = QWebSettings::globalSettings();
QString standardFontFamily = defaultSettings->fontFamily(QWebSettings::StandardFont);
int standardFontSize = defaultSettings->fontSize(QWebSettings::DefaultFontSize);
standardFont = QFont(standardFontFamily, standardFontSize);
standardLabel->setText(QString(QLatin1String("%1 %2")).arg(standardFont.family()).arg(standardFont.pointSize()));
QString fixedFontFamily = defaultSettings->fontFamily(QWebSettings::FixedFont);
int fixedFontSize = defaultSettings->fontSize(QWebSettings::DefaultFixedFontSize);
fixedFont = QFont(fixedFontFamily, fixedFontSize);
fixedLabel->setText(QString(QLatin1String("%1 %2")).arg(fixedFont.family()).arg(fixedFont.pointSize()));
comboMainMenu->setCurrentIndex(0);
downloadsLocation->setText( DefaultDownloadPath( false ) );
enableJavascript->setChecked(defaultSettings->testAttribute(QWebSettings::JavascriptEnabled));
enablePlugins->setChecked(defaultSettings->testAttribute(QWebSettings::PluginsEnabled));
blockPopups->setChecked( ! (defaultSettings->testAttribute(QWebSettings::JavascriptCanOpenWindows)) );
autoLoadImages->setChecked(defaultSettings->testAttribute(QWebSettings::AutoLoadImages));
enableDiskCache->setChecked(false);
chkSavePasswords->setChecked(false);
checkBoxDeleteDownloads->setChecked(false);
newTabAction->setCurrentIndex(0);
comboBoxAV->setCurrentIndex(0);
mouseweelClick->setCurrentIndex(1);
comboBoxStyle->addItems(QStyleFactory::keys());
int ind = comboBoxStyle->findText(DefaultAppStyle());
if (ind >= 0)
comboBoxStyle->setCurrentIndex(ind);
chkUserStyleSheet->setChecked(false);
chkUserAgent->setChecked(false);
comboAgents->setEditText("");
chkExtViewer->setChecked(false);
tbGoBack->setChecked( true );
tbGoForward->setChecked( true );
tbAddBook->setChecked( true );
tbHome->setChecked( true );
tbRefresh->setChecked( true );
tbAppStyle->setChecked( true );
tbPrivMode->setChecked( true );
tbPrefs->setChecked( true );
tbImages->setChecked( false );
tbProxy->setChecked( false );
proxyExcept->setChecked(false);
tbCompatibility->setChecked( true );
tbReset->setChecked( false );
#ifndef Q_WS_WIN
proxyAuto->setVisible(false);
#endif
tbInspect->setChecked( false );
tbVirtKeyb->setChecked( false );
tbBookmarks->setChecked( false );
tbTextSize->setChecked( false );
expireHistory->setCurrentIndex(1);
chkBlockAds->setChecked(false);
listAds->clear();
chkBlockAdsEx->setChecked(false);
listAdEx->clear();
}