当前位置: 首页>>代码示例>>C++>>正文


C++ QStyle::standardPalette方法代码示例

本文整理汇总了C++中QStyle::standardPalette方法的典型用法代码示例。如果您正苦于以下问题:C++ QStyle::standardPalette方法的具体用法?C++ QStyle::standardPalette怎么用?C++ QStyle::standardPalette使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QStyle的用法示例。


在下文中一共展示了QStyle::standardPalette方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: settings

MainWindow::MainWindow() : model_(new DicModel(dic_, freq_))
{
    ui_.setupUi(this);
    ui_.tableView->setModel(model_.get());
    ui_.statusbar->insertPermanentWidget(0, ui_.frmInfo);

    QSettings settings("Ensisoft", "Pinyin-Translator");
    const auto wwidth  = settings.value("window/width", width()).toInt();
    const auto wheight = settings.value("window/height", height()).toInt();
    const auto xpos   = settings.value("window/xpos", x()).toInt();
    const auto ypos   = settings.value("window/ypos", y()).toInt();
    const auto traditional = settings.value("window/traditional", true).toBool();
    const auto font = settings.value("window/font").toString();
    if (!font.isEmpty())
    {
        QFont f;
        if (f.fromString(font))
            setFont(f);
    }

    ui_.actionTraditional->setChecked(traditional);
    ui_.actionSimplified->setChecked(!traditional);
    ui_.editInput->installEventFilter(this);    
    model_->toggleTraditional(traditional);

    move(xpos, ypos);
    resize(wwidth, wheight);

    QStyle* style = QApplication::setStyle("Cleanlooks");
    if (style)
    {
        QApplication::setPalette(style->standardPalette());
    }
}
开发者ID:ensisoft,项目名称:pinyin-translator,代码行数:34,代码来源:mainwindow.cpp

示例2: chooseStyle

void KStyleComboBox::chooseStyle(const QString &style)
{
    QStyle *st = QStyleFactory::create(style);
    if (st) {
        qApp->setStyle( st );
        qApp->setPalette(st->standardPalette());
    }
}
开发者ID:BackupTheBerlios,项目名称:ktoon-svn,代码行数:8,代码来源:kstylecombobox.cpp

示例3: applySettings

void Appearance::applySettings(SettingsWidget* gui) 
{
    const auto mine = dynamic_cast<MySettings*>(gui);    
    const auto name = mine->getStyleName();

    current_style_name_ = name;

    if (current_style_name_ == "Default")
        return;

    QStyle* style = QApplication::setStyle(current_style_name_);
    QApplication::setPalette(style->standardPalette());
}
开发者ID:ensisoft,项目名称:newsflash-plus,代码行数:13,代码来源:appearance.cpp

示例4: styleSelected

void StyleInspector::styleSelected(const QItemSelection &selection)
{
  if (selection.isEmpty())
    return;
  const QModelIndex index = selection.first().topLeft();
  QObject *obj = index.data(ObjectModel::ObjectRole).value<QObject*>();
  QStyle *style = qobject_cast<QStyle*>(obj);
  m_primitiveModel->setStyle(style);
  m_controlModel->setStyle(style);
  m_complexControlModel->setStyle(style);
  m_pixelMetricModel->setStyle(style);
  m_standardIconModel->setStyle(style);
  m_standardPaletteModel->setPalette(style ? style->standardPalette() : qApp->palette());
}
开发者ID:pangpangpang3,项目名称:GammaRay,代码行数:14,代码来源:styleinspector.cpp

示例5: QWebView

EmbeddedWebView::EmbeddedWebView(QWidget *parent, QNetworkAccessManager *networkManager):
    QWebView(parent), m_scrollParent(0L), m_resizeInProgress(0)
{
    // set to expanding, ie. "freely" - this is important so the widget will attempt to shrink below the sizehint!
    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    setFocusPolicy(Qt::StrongFocus); // not by the wheel
    setPage(new ErrorCheckingPage(this));
    page()->setNetworkAccessManager(networkManager);

    QWebSettings *s = settings();
    s->setAttribute(QWebSettings::JavascriptEnabled, false);
    s->setAttribute(QWebSettings::JavaEnabled, false);
    s->setAttribute(QWebSettings::PluginsEnabled, false);
    s->setAttribute(QWebSettings::PrivateBrowsingEnabled, true);
    s->setAttribute(QWebSettings::JavaEnabled, false);
    s->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, false);
    s->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, false);
    s->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, false);
    s->clearMemoryCaches();

    page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
    connect(this, SIGNAL(linkClicked(QUrl)), this, SLOT(slotLinkClicked(QUrl)));
    connect(this, SIGNAL(loadFinished(bool)), this, SLOT(handlePageLoadFinished()));
    connect(page()->mainFrame(), SIGNAL(contentsSizeChanged(QSize)), this, SLOT(handlePageLoadFinished()));

    // Scrolling is implemented on upper layers
    page()->mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
    page()->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);

    // Setup shortcuts for standard actions
    QAction *copyAction = page()->action(QWebPage::Copy);
    copyAction->setShortcut(tr("Ctrl+C"));
    addAction(copyAction);

    // Redmine#3, the QWebView uses black text color when rendering stuff on dark background
    QPalette palette = QApplication::palette();
    if (palette.background().color().lightness() < 50) {
        QStyle *style = QStyleFactory::create(QLatin1String("windows"));
        Q_ASSERT(style);
        palette = style->standardPalette();
        setPalette(palette);
    }

    setContextMenuPolicy(Qt::NoContextMenu);
    findScrollParent();
}
开发者ID:SpOOnman,项目名称:trojita,代码行数:46,代码来源:EmbeddedWebView.cpp

示例6: loadState

void Appearance::loadState(app::Settings& s)
{
    current_style_name_ = s.get("theme", "name", "Default");
    if (current_style_name_ == "Default")
        return;

    QStyle* style = QApplication::setStyle(current_style_name_);
    if (!style)
    {
        WARN("No such style %1", current_style_name_);
        WARN("Style set to Default");
        current_style_name_ = "Default";
        return;
    }
    QApplication::setPalette(style->standardPalette());

    DEBUG("Qt style %1", current_style_name_);
}
开发者ID:ensisoft,项目名称:newsflash-plus,代码行数:18,代码来源:appearance.cpp


注:本文中的QStyle::standardPalette方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。