这篇教程C++ style函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中style函数的典型用法代码示例。如果您正苦于以下问题:C++ style函数的具体用法?C++ style怎么用?C++ style使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了style函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: stylebool ScrollbarThemeQt::shouldCenterOnThumb(Scrollbar*, const PlatformMouseEvent& evt){ // Middle click centers slider thumb (if supported). return style()->styleHint(QStyle::SH_ScrollBar_MiddleClickAbsolutePosition) && evt.button() == MiddleButton;}
开发者ID:13W,项目名称:phantomjs,代码行数:5,
示例2: ASSERTvoid CSSStyleSelector::applySVGProperty(int id, CSSValue* value){ ASSERT(value); CSSPrimitiveValue* primitiveValue = 0; if (value->isPrimitiveValue()) primitiveValue = static_cast<CSSPrimitiveValue*>(value); SVGRenderStyle* svgstyle = m_style->accessSVGStyle(); unsigned short valueType = value->cssValueType(); bool isInherit = m_parentNode && valueType == CSSPrimitiveValue::CSS_INHERIT; bool isInitial = valueType == CSSPrimitiveValue::CSS_INITIAL || (!m_parentNode && valueType == CSSPrimitiveValue::CSS_INHERIT); // What follows is a list that maps the CSS properties into their // corresponding front-end RenderStyle values. Shorthands(e.g. border, // background) occur in this list as well and are only hit when mapping // "inherit" or "initial" into front-end values. switch (id) { // ident only properties case CSSPropertyAlignmentBaseline: { HANDLE_INHERIT_AND_INITIAL(alignmentBaseline, AlignmentBaseline) if (!primitiveValue) break; svgstyle->setAlignmentBaseline(*primitiveValue); break; } case CSSPropertyBaselineShift: { HANDLE_INHERIT_AND_INITIAL(baselineShift, BaselineShift); if (!primitiveValue) break; if (primitiveValue->getIdent()) { switch (primitiveValue->getIdent()) { case CSSValueBaseline: svgstyle->setBaselineShift(BS_BASELINE); break; case CSSValueSub: svgstyle->setBaselineShift(BS_SUB); break; case CSSValueSuper: svgstyle->setBaselineShift(BS_SUPER); break; default: break; } } else { svgstyle->setBaselineShift(BS_LENGTH); svgstyle->setBaselineShiftValue(primitiveValue); } break; } case CSSPropertyKerning: { HANDLE_INHERIT_AND_INITIAL(kerning, Kerning); svgstyle->setKerning(primitiveValue); break; } case CSSPropertyPointerEvents: { HANDLE_INHERIT_AND_INITIAL(pointerEvents, PointerEvents) if (!primitiveValue) break; svgstyle->setPointerEvents(*primitiveValue); break; } case CSSPropertyDominantBaseline: { HANDLE_INHERIT_AND_INITIAL(dominantBaseline, DominantBaseline) if (primitiveValue) svgstyle->setDominantBaseline(*primitiveValue); break; } case CSSPropertyColorInterpolation: { HANDLE_INHERIT_AND_INITIAL(colorInterpolation, ColorInterpolation) if (primitiveValue) svgstyle->setColorInterpolation(*primitiveValue); break; } case CSSPropertyColorInterpolationFilters: { HANDLE_INHERIT_AND_INITIAL(colorInterpolationFilters, ColorInterpolationFilters) if (primitiveValue) svgstyle->setColorInterpolationFilters(*primitiveValue); break; } case CSSPropertyColorRendering: { HANDLE_INHERIT_AND_INITIAL(colorRendering, ColorRendering) if (primitiveValue) svgstyle->setColorRendering(*primitiveValue); break; } case CSSPropertyClipRule://.........这里部分代码省略.........
开发者ID:UIKit0,项目名称:WebkitAIR,代码行数:101,
示例3: roundffloat RenderTextControl::scaleEmToUnits(int x) const{ // This matches the unitsPerEm value for MS Shell Dlg and Courier New from the "head" font table. float unitsPerEm = 2048.0f; return roundf(style()->font().size() * x / unitsPerEm);}
开发者ID:Moondee,项目名称:Artemis,代码行数:6,
示例4: styleChange virtual void styleChange( QStyle& ) { setFixedWidth( style().pixelMetric( QStyle::PM_SplitterWidth, this ) ); }
开发者ID:gms8994,项目名称:amarok-1.4,代码行数:4,
示例5: setBorderRadius/*! Draw the border of the plot canvas /param painter Painter /sa setBorderRadius()*/void QwtPlotCanvas::drawBorder( QPainter *painter ){ if ( d_data->borderRadius > 0 ) { if ( frameWidth() > 0 ) { QwtPainter::drawRoundedFrame( painter, QRectF( frameRect() ), d_data->borderRadius, d_data->borderRadius, palette(), frameWidth(), frameStyle() ); } } else {#if QT_VERSION >= 0x040500#if !defined(_MSC_VER)#pragma GCC diagnostic push#pragma GCC diagnostic ignored "-Wdeprecated-declarations"#endif QStyleOptionFrameV3 opt;#if !defined(_MSC_VER)#pragma GCC diagnostic pop#endif opt.init(this); int frameShape = frameStyle() & QFrame::Shape_Mask; int frameShadow = frameStyle() & QFrame::Shadow_Mask; opt.frameShape = QFrame::Shape( int( opt.frameShape ) | frameShape );#if 0 opt.rect = frameRect();#endif switch (frameShape) { case QFrame::Box: case QFrame::HLine: case QFrame::VLine: case QFrame::StyledPanel: case QFrame::Panel: { opt.lineWidth = lineWidth(); opt.midLineWidth = midLineWidth(); break; } default: { opt.lineWidth = frameWidth(); break; } } if ( frameShadow == Sunken ) opt.state |= QStyle::State_Sunken; else if ( frameShadow == Raised ) opt.state |= QStyle::State_Raised; style()->drawControl(QStyle::CE_ShapedFrame, &opt, painter, this);#else drawFrame( painter );#endif }}
开发者ID:Aerovinci,项目名称:qgroundcontrol,代码行数:68,
示例6: styleQRect ControlSlider::handleRect(){ int sliderPos = style()->sliderPositionFromValue(minimum(),maximum(),value(),width()-12); return QRect(sliderPos,0,12,12);}
开发者ID:ABuus,项目名称:partyplayer,代码行数:5,
示例7: QWidgetPlayerControls::PlayerControls(QWidget *parent) : QWidget(parent) , playerState(QMediaPlayer::StoppedState) , playerMuted(false) , playButton(0) , stopButton(0) , nextButton(0) , previousButton(0) , muteButton(0) , volumeSlider(0) , rateBox(0){ playButton = new QToolButton(this); playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay)); connect(playButton, SIGNAL(clicked()), this, SLOT(playClicked())); stopButton = new QToolButton(this); stopButton->setIcon(style()->standardIcon(QStyle::SP_MediaStop)); stopButton->setEnabled(false); connect(stopButton, SIGNAL(clicked()), this, SIGNAL(stop())); nextButton = new QToolButton(this); nextButton->setIcon(style()->standardIcon(QStyle::SP_MediaSkipForward)); connect(nextButton, SIGNAL(clicked()), this, SIGNAL(next())); previousButton = new QToolButton(this); previousButton->setIcon(style()->standardIcon(QStyle::SP_MediaSkipBackward)); connect(previousButton, SIGNAL(clicked()), this, SIGNAL(previous())); muteButton = new QToolButton(this); muteButton->setIcon(style()->standardIcon(QStyle::SP_MediaVolume)); connect(muteButton, SIGNAL(clicked()), this, SLOT(muteClicked())); volumeSlider = new QSlider(Qt::Horizontal, this); volumeSlider->setRange(0, 100); connect(volumeSlider, SIGNAL(sliderMoved(int)), this, SIGNAL(changeVolume(int))); rateBox = new QComboBox(this); rateBox->addItem("0.5x", QVariant(0.5)); rateBox->addItem("1.0x", QVariant(1.0)); rateBox->addItem("2.0x", QVariant(2.0)); rateBox->setCurrentIndex(1); connect(rateBox, SIGNAL(activated(int)), SLOT(updateRate())); QBoxLayout *layout = new QHBoxLayout; layout->setMargin(0); layout->addWidget(stopButton); layout->addWidget(previousButton); layout->addWidget(playButton); layout->addWidget(nextButton); layout->addWidget(muteButton); layout->addWidget(volumeSlider); layout->addWidget(rateBox); setLayout(layout);}
开发者ID:MarianMMX,项目名称:MarianMMX,代码行数:62,
示例8: paintervoid KMultiTabBarTab::paintEvent(QPaintEvent*) { QPainter painter(this); QStyleOptionToolButton opt; initStyleOption(&opt); // Paint bevel.. if (underMouse() || isChecked()) { opt.text.clear(); opt.icon = QIcon(); style()->drawComplexControl(QStyle::CC_ToolButton, &opt, &painter, this); } int hMargin, vMargin; computeMargins(&hMargin, &vMargin); // We first figure out how much room we have for the text, based on // icon size and margin, try to fit in by eliding, and perhaps // give up on drawing the text entirely if we're too short on room QPixmap icon = iconPixmap(); int textRoom = 0; int iconRoom = 0; QString t; if (shouldDrawText()) { if (isVertical()) { iconRoom = icon.height() + 2*vMargin; textRoom = height() - iconRoom - vMargin; } else { iconRoom = icon.width() + 2*hMargin; textRoom = width() - iconRoom - hMargin; } t = painter.fontMetrics().elidedText(text(), Qt::ElideRight, textRoom); // See whether anything is left. Qt will return either // ... or the ellipsis unicode character, 0x2026 if (t == QLatin1String("...") || t == QChar(0x2026)) t.clear(); } // Label time.... Simple case: no text, so just plop down the icon right in the center // We only do this when the button never draws the text, to avoid jumps in icon position // when resizing if (!shouldDrawText()) { style()->drawItemPixmap(&painter, rect(), Qt::AlignCenter | Qt::AlignVCenter, icon); return; } // Now where the icon/text goes depends on text direction and tab position QRect iconArea; QRect labelArea; bool bottomIcon = false; bool rtl = layoutDirection() == Qt::RightToLeft; if (isVertical()) { if (m_position == KMultiTabBar::Left && !rtl) bottomIcon = true; if (m_position == KMultiTabBar::Right && rtl) bottomIcon = true; } //alignFlags = Qt::AlignLeading | Qt::AlignVCenter; if (isVertical()) { if (bottomIcon) { labelArea = QRect(0, vMargin, width(), textRoom); iconArea = QRect(0, vMargin + textRoom, width(), iconRoom); } else { labelArea = QRect(0, iconRoom, width(), textRoom); iconArea = QRect(0, 0, width(), iconRoom); } } else { // Pretty simple --- depends only on RTL/LTR if (rtl) { labelArea = QRect(hMargin, 0, textRoom, height()); iconArea = QRect(hMargin + textRoom, 0, iconRoom, height()); } else { labelArea = QRect(iconRoom, 0, textRoom, height()); iconArea = QRect(0, 0, iconRoom, height()); } } style()->drawItemPixmap(&painter, iconArea, Qt::AlignCenter | Qt::AlignVCenter, icon); if (t.isEmpty()) return; QRect labelPaintArea = labelArea; if (isVertical()) { // If we're vertical, we paint to a simple 0,0 origin rect, // and get the transformations to get us in the right place labelPaintArea = QRect(0, 0, labelArea.height(), labelArea.width()); QTransform tr; if (bottomIcon) { tr.translate(labelArea.x(), labelPaintArea.width() + labelArea.y()); tr.rotate(-90); } else {//.........这里部分代码省略.........
开发者ID:fluxer,项目名称:kdelibs,代码行数:101,
示例9: mKeywordsChangeColorvoid LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, LLColor4 incolor, bool log_to_file, const LLUUID& source, const std::string& name){ static const LLCachedControl<bool> mKeywordsChangeColor(gSavedPerAccountSettings, "KeywordsChangeColor", false); static const LLCachedControl<LLColor4> mKeywordsColor(gSavedPerAccountSettings, "KeywordsColor", LLColor4(1.f, 1.f, 1.f, 1.f)); if (gAgentID != source) { if (mKeywordsChangeColor) { if (AscentKeyword::hasKeyword(utf8msg, 2)) { incolor = mKeywordsColor; } } if (mDing && (!hasFocus() || !gFocusMgr.getAppHasFocus())) { static const LLCachedControl<std::string> ding("LiruNewMessageSound"); static const LLCachedControl<std::string> dong("LiruNewMessageSoundForSystemMessages"); LLUI::sAudioCallback(LLUUID(source.notNull() ? ding : dong)); } } const LLColor4& color = incolor; // start tab flashing when receiving im for background session from user if (source.notNull()) { LLMultiFloater* hostp = getHost(); if( !isInVisibleChain() && hostp && source != gAgentID) { hostp->setFloaterFlashing(this, TRUE); } } // Now we're adding the actual line of text, so erase the // "Foo is typing..." text segment, and the optional timestamp // if it was present. JC removeTypingIndicator(NULL); // Actually add the line bool prepend_newline = true; if (gSavedSettings.getBOOL("IMShowTimestamps")) { mHistoryEditor->appendTime(prepend_newline); prepend_newline = false; } std::string show_name = name; bool is_irc = false; // 'name' is a sender name that we want to hotlink so that clicking on it opens a profile. if (!name.empty()) // If name exists, then add it to the front of the message. { // Don't hotlink any messages from the system (e.g. "Second Life:"), so just add those in plain text. if (name == SYSTEM_FROM) { mHistoryEditor->appendColoredText(name,false,prepend_newline,color); } else { // IRC style text starts with a colon here; empty names and system messages aren't irc style. static const LLCachedControl<bool> italicize("LiruItalicizeActions"); is_irc = italicize && utf8msg[0] != ':'; if (source.notNull()) LLAvatarNameCache::getPNSName(source, show_name); // Convert the name to a hotlink and add to message. LLStyleSP source_style = LLStyleMap::instance().lookupAgent(source); source_style->mItalic = is_irc; mHistoryEditor->appendStyledText(show_name,false,prepend_newline,source_style); } prepend_newline = false; } // Append the chat message in style { LLStyleSP style(new LLStyle); style->setColor(color); style->mItalic = is_irc; style->mBold = gSavedSettings.getBOOL("SingularityBoldGroupModerator") && isModerator(source); mHistoryEditor->appendStyledText(utf8msg, false, prepend_newline, style); } if (log_to_file && gSavedPerAccountSettings.getBOOL("LogInstantMessages") ) { std::string histstr; if (gSavedPerAccountSettings.getBOOL("IMLogTimestamp")) histstr = LLLogChat::timestamp(gSavedPerAccountSettings.getBOOL("LogTimestampDate")) + show_name + utf8msg; else histstr = show_name + utf8msg; // [Ansariel: Display name support] // Floater title contains display name -> bad idea to use that as filename // mLogLabel, however, is the old legacy name //LLLogChat::saveHistory(getTitle(),histstr); LLLogChat::saveHistory(mLogLabel, histstr); // [/Ansariel: Display name support] }//.........这里部分代码省略.........
开发者ID:mightymarc,项目名称:SWAMPWATER,代码行数:101,
示例10: stylevoid CSSParserFont::parse(const std::string &propname, const std::vector<CSSToken> &tokens, std::vector<std::unique_ptr<CSSPropertyValue> > &inout_values){ std::unique_ptr<CSSValueFontStyle> style(new CSSValueFontStyle()); std::unique_ptr<CSSValueFontVariant> variant(new CSSValueFontVariant()); std::unique_ptr<CSSValueFontWeight> weight(new CSSValueFontWeight()); std::unique_ptr<CSSValueFontSize> size(new CSSValueFontSize()); std::unique_ptr<CSSValueLineHeight> line_height(new CSSValueLineHeight()); std::unique_ptr<CSSValueFontFamily> family(new CSSValueFontFamily()); style->type = CSSValueFontStyle::type_normal; variant->type = CSSValueFontVariant::type_normal; weight->type = CSSValueFontWeight::type_normal; size->type = CSSValueFontSize::type_medium; line_height->type = CSSValueLineHeight::type_normal; family->type = CSSValueFontFamily::type_names; family->names.push_back(CSSValueFontFamilyName()); bool font_style_set = false; bool font_variant_set = false; bool font_weight_set = false; int normal_count = 0; size_t pos = 0; CSSToken token; while (pos < tokens.size()) { token = next_token(pos, tokens); if (token.type == CSSToken::type_ident) { if (tokens.size() == 1 && (equals(token.value, "caption") || equals(token.value, "icon") || equals(token.value, "menu") || equals(token.value, "message-box") || equals(token.value, "small-caption") || equals(token.value, "status-bar"))) { inout_values.push_back(std::move(style)); inout_values.push_back(std::move(variant)); inout_values.push_back(std::move(weight)); inout_values.push_back(std::move(size)); inout_values.push_back(std::move(line_height)); inout_values.push_back(std::move(family)); return; } else if (equals(token.value, "inherit") && tokens.size() == 1) { style->type = CSSValueFontStyle::type_inherit; variant->type = CSSValueFontVariant::type_inherit; weight->type = CSSValueFontWeight::type_inherit; size->type = CSSValueFontSize::type_inherit; line_height->type = CSSValueLineHeight::type_inherit; family->type = CSSValueFontFamily::type_inherit; inout_values.push_back(std::move(style)); inout_values.push_back(std::move(variant)); inout_values.push_back(std::move(weight)); inout_values.push_back(std::move(size)); inout_values.push_back(std::move(line_height)); inout_values.push_back(std::move(family)); return; } else if (equals(token.value, "normal")) // font-style or font-weight or font-variant { int allowed = 3; if (font_style_set) allowed--; if (font_weight_set) allowed--; if (font_variant_set) allowed--; if (normal_count < allowed) normal_count++; } else if (equals(token.value, "italic") && !font_style_set) // font-style { font_style_set = true; style->type = CSSValueFontStyle::type_italic; } else if (equals(token.value, "oblique") && !font_style_set) // font-style { font_style_set = true; style->type = CSSValueFontStyle::type_oblique; } else if (equals(token.value, "small-caps") && !font_variant_set) // font-variant { font_style_set = true; variant->type = CSSValueFontVariant::type_small_caps; } else if (equals(token.value, "bold") && !font_weight_set) // font-weight { font_weight_set = true; weight->type = CSSValueFontWeight::type_bold; } else if (equals(token.value, "bolder") && !font_weight_set) // font-weight { font_weight_set = true; weight->type = CSSValueFontWeight::type_bolder; } else if (equals(token.value, "lighter") && !font_weight_set) // font-weight { font_weight_set = true;//.........这里部分代码省略.........
开发者ID:Cassie90,项目名称:ClanLib,代码行数:101,
示例11: styleQPixmap KMultiTabBarTab::iconPixmap() const{ int iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, this); return icon().pixmap(iconSize);}
开发者ID:fluxer,项目名称:kdelibs,代码行数:5,
示例12: computeNewScaledFontForStylevoid RenderSVGInlineText::updateScaledFont(){ computeNewScaledFontForStyle(*this, style(), m_scalingFactor, m_scaledFont);}
开发者ID:MYSHLIFE,项目名称:webkit,代码行数:4,
示例13: styleOptionSliderint ScrollbarThemeQt::trackLength(Scrollbar* scrollbar){ QStyleOptionSlider* opt = styleOptionSlider(scrollbar); IntRect track = style()->subControlRect(QStyle::CC_ScrollBar, opt, QStyle::SC_ScrollBarGroove, 0); return scrollbar->orientation() == HorizontalScrollbar ? track.width() : track.height();}
开发者ID:13W,项目名称:phantomjs,代码行数:6,
示例14: Q_D/*! Initialize /a option with the values from this QToolButton. This method is useful for subclasses when they need a QStyleOptionToolButton, but don't want to fill in all the information themselves. /sa QStyleOption::initFrom()*/void QToolButton::initStyleOption(QStyleOptionToolButton *option) const{ if (!option) return; Q_D(const QToolButton); option->initFrom(this); bool forceNoText = false; option->iconSize = iconSize(); //default value#ifndef QT_NO_TOOLBAR if (parentWidget()) { if (QToolBar *toolBar = qobject_cast<QToolBar *>(parentWidget())) { option->iconSize = toolBar->iconSize(); } }#endif // QT_NO_TOOLBAR if (!forceNoText) option->text = d->text; option->icon = d->icon; option->arrowType = d->arrowType; if (d->down) option->state |= QStyle::State_Sunken; if (d->checked) option->state |= QStyle::State_On; if (d->autoRaise) option->state |= QStyle::State_AutoRaise; if (!d->checked && !d->down) option->state |= QStyle::State_Raised; option->subControls = QStyle::SC_ToolButton; option->activeSubControls = QStyle::SC_None; option->features = QStyleOptionToolButton::None; if (d->popupMode == QToolButton::MenuButtonPopup) { option->subControls |= QStyle::SC_ToolButtonMenu; option->features |= QStyleOptionToolButton::MenuButtonPopup; } if (option->state & QStyle::State_MouseOver) { option->activeSubControls = d->hoverControl; } if (d->menuButtonDown) { option->state |= QStyle::State_Sunken; option->activeSubControls |= QStyle::SC_ToolButtonMenu; } if (d->down) { option->state |= QStyle::State_Sunken; option->activeSubControls |= QStyle::SC_ToolButton; } if (d->arrowType != Qt::NoArrow) option->features |= QStyleOptionToolButton::Arrow; if (d->popupMode == QToolButton::DelayedPopup) option->features |= QStyleOptionToolButton::PopupDelay;#ifndef QT_NO_MENU if (d->hasMenu()) option->features |= QStyleOptionToolButton::HasMenu;#endif if (d->toolButtonStyle == Qt::ToolButtonFollowStyle) { option->toolButtonStyle = Qt::ToolButtonStyle(style()->styleHint(QStyle::SH_ToolButtonStyle, option, this)); } else option->toolButtonStyle = d->toolButtonStyle; if (option->toolButtonStyle == Qt::ToolButtonTextBesideIcon) { // If the action is not prioritized, remove the text label to save space if (d->defaultAction && d->defaultAction->priority() < QAction::NormalPriority) option->toolButtonStyle = Qt::ToolButtonIconOnly; } if (d->icon.isNull() && d->arrowType == Qt::NoArrow && !forceNoText) { if (!d->text.isEmpty()) option->toolButtonStyle = Qt::ToolButtonTextOnly; else if (option->toolButtonStyle != Qt::ToolButtonTextOnly) option->toolButtonStyle = Qt::ToolButtonIconOnly; } option->pos = pos(); option->font = font();}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:88,
示例15: xvoid RenderReplaced::paint(PaintInfo& paintInfo, int tx, int ty){ if (!shouldPaint(paintInfo, tx, ty)) return; tx += x(); ty += y(); if (hasBoxDecorations() && (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection)) paintBoxDecorations(paintInfo, tx, ty); if (paintInfo.phase == PaintPhaseMask) { paintMask(paintInfo, tx, ty); return; } if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline) && style()->outlineWidth()) paintOutline(paintInfo.context, tx, ty, width(), height()); if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection) return; if (!shouldPaintWithinRoot(paintInfo)) return; bool drawSelectionTint = selectionState() != SelectionNone && !document()->printing(); if (paintInfo.phase == PaintPhaseSelection) { if (selectionState() == SelectionNone) return; drawSelectionTint = false; } bool completelyClippedOut = false; if (style()->hasBorderRadius()) { IntRect borderRect = IntRect(tx, ty, width(), height()); if (borderRect.isEmpty()) completelyClippedOut = true; else { // Push a clip if we have a border radius, since we want to round the foreground content that gets painted. paintInfo.context->save(); IntSize topLeft, topRight, bottomLeft, bottomRight; style()->getBorderRadiiForRect(borderRect, topLeft, topRight, bottomLeft, bottomRight); paintInfo.context->addRoundedRectClip(borderRect, topLeft, topRight, bottomLeft, bottomRight); } } if (!completelyClippedOut) { paintReplaced(paintInfo, tx, ty); if (style()->hasBorderRadius()) paintInfo.context->restore(); } // The selection tint never gets clipped by border-radius rounding, since we want it to run right up to the edges of // surrounding content. if (drawSelectionTint) { IntRect selectionPaintingRect = localSelectionRect(); selectionPaintingRect.move(tx, ty); paintInfo.context->fillRect(selectionPaintingRect, selectionBackgroundColor(), style()->colorSpace()); }}
开发者ID:mikedougherty,项目名称:webkit,代码行数:64,
示例16: m_dongleMainWindow::MainWindow(const QUrl& url) : m_dongle(new mobot_t){ progress = 0; QFile file; file.setFileName(":/jquery.min.js"); file.open(QIODevice::ReadOnly); jQuery = file.readAll(); jQuery.append("/nvar qt = { 'jQuery': jQuery.noConflict(true) };"); file.close();//! [1] QNetworkProxyFactory::setUseSystemConfiguration(true); m_interface = new JsInterface(this);//! [2] view = new QWebView(this); view->load(url); connect(view, SIGNAL(loadFinished(bool)), SLOT(adjustLocation())); connect(view, SIGNAL(titleChanged(QString)), SLOT(adjustTitle())); connect(view, SIGNAL(loadProgress(int)), SLOT(setProgress(int))); connect(view, SIGNAL(loadFinished(bool)), SLOT(finishLoading(bool))); connect(view->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(populateJavaScriptWindowObject())); locationEdit = new QLineEdit(this); locationEdit->setSizePolicy(QSizePolicy::Expanding, locationEdit->sizePolicy().verticalPolicy()); connect(locationEdit, SIGNAL(returnPressed()), SLOT(changeLocation())); QToolBar *toolBar = addToolBar(tr("Navigation")); toolBar->addAction(view->pageAction(QWebPage::Back)); toolBar->addAction(view->pageAction(QWebPage::Forward)); toolBar->addAction(view->pageAction(QWebPage::Reload)); toolBar->addAction(view->pageAction(QWebPage::Stop)); toolBar->addWidget(locationEdit);//! [2] QMenu *viewMenu = menuBar()->addMenu(tr("&View")); QAction* viewSourceAction = new QAction("Page Source", this); connect(viewSourceAction, SIGNAL(triggered()), SLOT(viewSource())); viewMenu->addAction(viewSourceAction);//! [3] QMenu *effectMenu = menuBar()->addMenu(tr("&Effect")); effectMenu->addAction("Highlight all links", this, SLOT(highlightAllLinks())); rotateAction = new QAction(this); rotateAction->setIcon(style()->standardIcon(QStyle::SP_FileDialogDetailedView)); rotateAction->setCheckable(true); rotateAction->setText(tr("Turn images upside down")); connect(rotateAction, SIGNAL(toggled(bool)), this, SLOT(rotateImages(bool))); effectMenu->addAction(rotateAction); QMenu *toolsMenu = menuBar()->addMenu(tr("&Tools")); toolsMenu->addAction(tr("Remove GIF images"), this, SLOT(removeGifImages())); toolsMenu->addAction(tr("Remove all inline frames"), this, SLOT(removeInlineFrames())); toolsMenu->addAction(tr("Remove all object elements"), this, SLOT(removeObjectElements())); toolsMenu->addAction(tr("Remove all embedded elements"), this, SLOT(removeEmbeddedElements())); setCentralWidget(view); setUnifiedTitleAndToolBarOnMac(true); baroboInit(); qDebug() << "App path : " << qApp->applicationDirPath();}
开发者ID:aruggles,项目名称:BaroboLabHack,代码行数:66,
示例17: frameRectvoid QFrame::drawFrame(QPainter *p){ QPoint p1, p2; QRect r = frameRect(); int type = fstyle & MShape; int cstyle = fstyle & MShadow;#ifdef QT_NO_DRAWUTIL p->setPen(black); // #### p->drawRect(r); //### a bit too simple#else const QColorGroup & g = colorGroup();#ifndef QT_NO_STYLE QStyleOption opt(lineWidth(), midLineWidth()); QStyle::SFlags flags = QStyle::Style_Default; if (isEnabled()) flags |= QStyle::Style_Enabled; if (cstyle == Sunken) flags |= QStyle::Style_Sunken; else if (cstyle == Raised) flags |= QStyle::Style_Raised; if (hasFocus()) flags |= QStyle::Style_HasFocus; if (hasMouse()) flags |= QStyle::Style_MouseOver;#endif // QT_NO_STYLE switch (type) { case Box: if (cstyle == Plain) qDrawPlainRect(p, r, g.foreground(), lwidth); else qDrawShadeRect(p, r, g, cstyle == Sunken, lwidth, midLineWidth()); break; case LineEditPanel: style().drawPrimitive(QStyle::PE_PanelLineEdit, p, r, g, flags, opt); break; case GroupBoxPanel: style().drawPrimitive(QStyle::PE_PanelGroupBox, p, r, g, flags, opt); break; case TabWidgetPanel: style().drawPrimitive(QStyle::PE_PanelTabWidget, p, r, g, flags, opt); break; case MenuBarPanel:#ifndef QT_NO_STYLE style().drawPrimitive(QStyle::PE_PanelMenuBar, p, r, g, flags, opt); break;#endif // fall through to Panel if QT_NO_STYLE case ToolBarPanel:#ifndef QT_NO_STYLE style().drawPrimitive(QStyle::PE_PanelDockWindow, p, rect(), g, flags, opt); break;#endif // fall through to Panel if QT_NO_STYLE case StyledPanel:#ifndef QT_NO_STYLE if (cstyle == Plain) qDrawPlainRect(p, r, g.foreground(), lwidth); else style().drawPrimitive(QStyle::PE_Panel, p, r, g, flags, opt); break;#endif // fall through to Panel if QT_NO_STYLE case PopupPanel:#ifndef QT_NO_STYLE { int vextra = style().pixelMetric(QStyle::PM_PopupMenuFrameVerticalExtra, this), hextra = style().pixelMetric(QStyle::PM_PopupMenuFrameHorizontalExtra, this); if (vextra > 0 || hextra > 0) { QRect fr = frameRect(); int fw = frameWidth(); if (vextra > 0) { style().drawControl(QStyle::CE_PopupMenuVerticalExtra, p, this, QRect(fr.x() + fw, fr.y() + fw, fr.width() - (fw*2), vextra), g, flags, opt); style().drawControl(QStyle::CE_PopupMenuVerticalExtra, p, this, QRect(fr.x() + fw, fr.bottom() - fw - vextra, fr.width() - (fw*2), vextra), g, flags, opt); } if (hextra > 0) { style().drawControl(QStyle::CE_PopupMenuHorizontalExtra, p, this, QRect(fr.x() + fw, fr.y() + fw + vextra, hextra, fr.height() - (fw*2) - vextra), g, flags, opt); style().drawControl(QStyle::CE_PopupMenuHorizontalExtra, p, this, QRect(fr.right() - fw - hextra, fr.y() + fw + vextra, hextra, fr.height() - (fw*2) - vextra), g, flags, opt); } } if (cstyle == Plain) qDrawPlainRect(p, r, g.foreground(), lwidth); else//.........这里部分代码省略.........
开发者ID:JeremiasE,项目名称:KFormula,代码行数:101,
示例18: barWidth//-----------------------------------------------------------------------------//!//-----------------------------------------------------------------------------void tRepowerMotoringWidgetSimrad::PaintBars( QPainter& painter, QVector< float >& values, bool isLeft ){ if ( m_pEngineRPMGauge ) { painter.save(); QRect gaugeRect = m_pEngineRPMGauge->geometry(); const int barWidth( qRound( gaugeRect.height() * 0.05 ) ); const int offsetValue ( qRound( barWidth + ( barWidth * 0.5 ) ) ); const int cStep( offsetValue / 4 ) ; int totalOffset( int( offsetValue / 1.5 ) ); int count( 0 ); foreach( float value, values ) { QRect middleRect( gaugeRect ); tDigitalData data( DATA_TYPE_ENGINE_TEMP ); middleRect.adjust( -totalOffset, -totalOffset, totalOffset, totalOffset ); if ( true == isLeft ) { data = tDigitalData( DATA_TYPE_ENGINE_TRIM ); } qreal span( ( 45 - ( count * cStep ) ) ); count ++; int spanForArc( int( span * 16 ) ); qreal leftStartAngle( 180 * 16 ); qreal rightStartAngle( 360 * 16 ); // Red bit tNOSStyle* pStyle = qobject_cast< tNOSStyle* >( style() ); Assert( pStyle ); QColor redColour( Qt::red ); if ( pStyle ) { redColour = pStyle->GetColor( tNOSStyle::eNCR_Destructive ); } painter.setPen( QPen( redColour, barWidth ) ); if ( true == isLeft ) { painter.drawArc( middleRect, int( leftStartAngle - ( spanForArc / 2 ) ), spanForArc ); } else { painter.drawArc( middleRect, int( rightStartAngle - ( spanForArc / 2 ) ), spanForArc ); } // Black bit span -= cRedLineWidth; int blackSpan( int( span * 16 ) ); painter.setPen( QPen( palette().color( QPalette::Active, QPalette::Background ), barWidth ) ); if ( true == isLeft ) { painter.translate( QPoint( cRedLineWidth, 0 ) ); painter.drawArc( middleRect, int( leftStartAngle - ( blackSpan / 2 ) ), blackSpan ); } else { painter.translate( QPoint( -cRedLineWidth, 0 ) ); painter.drawArc( middleRect, int( rightStartAngle- ( blackSpan / 2 ) ), blackSpan ); } // Grey bit. span -= ( cBlackLineWidth / 3 ); int greyBarWidth( barWidth - ( cBlackLineWidth * 3 ) ); int greySpan( int( span * 16 ) ); QColor greyColour( palette().color( QPalette::Disabled, QPalette::Text ) ); greyColour.setAlpha( 100 ); painter.setPen( QPen( greyColour, greyBarWidth ) ); if ( true == isLeft ) { painter.translate( QPoint( cBlackLineWidth / 3, 0 ) ); painter.drawArc( middleRect, int( leftStartAngle - ( greySpan / 2 ) ), greySpan ); painter.translate( QPoint( -cBlackLineWidth / 3, 0 ) ); } else { painter.translate( QPoint( -cBlackLineWidth / 3, 0 ) ); painter.drawArc( middleRect, int( rightStartAngle - ( greySpan / 2 ) ), greySpan ); painter.translate( QPoint( cBlackLineWidth / 3, 0 ) ); } // White bit if ( value > 0 ) { painter.setPen( QPen( palette().color( QPalette::Active, QPalette::Text ), greyBarWidth ) ); float fillPercentage( qBound( 0.0f, ( 1 / data.Max() ) * value, 1.0f ) ); int fillSpan( int( span * fillPercentage * 16 ) ); // Adjust the value to take into account the line thickness. if ( fillSpan > greyBarWidth ) { fillSpan -= int( greyBarWidth );//.........这里部分代码省略.........
开发者ID:dulton,项目名称:53_hero,代码行数:101,
示例19: Splitter Splitter( BrowserBar *w ) : QWidget( w, "divider" ) { setCursor( QCursor(SplitHCursor) ); styleChange( style() ); }
开发者ID:gms8994,项目名称:amarok-1.4,代码行数:5,
示例20: Q_D/*! /reimp */bool QToolBar::event(QEvent *event){ Q_D(QToolBar); switch (event->type()) { case QEvent::Timer: if (d->waitForPopupTimer.timerId() == static_cast<QTimerEvent*>(event)->timerId()) { QWidget *w = QApplication::activePopupWidget(); if (!waitForPopup(this, w)) { d->waitForPopupTimer.stop(); if (!this->underMouse()) d->layout->setExpanded(false); } } break; case QEvent::Hide: if (!isHidden()) break; // fallthrough intended case QEvent::Show: d->toggleViewAction->setChecked(event->type() == QEvent::Show); emit visibilityChanged(event->type() == QEvent::Show);#if defined(Q_WS_MAC) if (toolbarInUnifiedToolBar(this)) { // I can static_cast because I did the qobject_cast in the if above, therefore // we must have a QMainWindowLayout here. QMainWindowLayout *mwLayout = qt_mainwindow_layout(qobject_cast<QMainWindow *>(parentWidget())); mwLayout->fixSizeInUnifiedToolbar(this); mwLayout->syncUnifiedToolbarVisibility(); }#endif // Q_WS_MAC break; case QEvent::ParentChange: d->layout->checkUsePopupMenu();#if defined(Q_WS_MAC) if (parentWidget() && parentWidget()->isWindow()) qt_mac_updateToolBarButtonHint(parentWidget());#endif break; case QEvent::MouseButtonPress: { if (d->mousePressEvent(static_cast<QMouseEvent*>(event))) return true; break; } case QEvent::MouseButtonRelease: if (d->mouseReleaseEvent(static_cast<QMouseEvent*>(event))) return true; break; case QEvent::HoverEnter: case QEvent::HoverLeave: // there's nothing special to do here and we don't want to update the whole widget return true; case QEvent::HoverMove: {#ifndef QT_NO_CURSOR QHoverEvent *e = static_cast<QHoverEvent*>(event); QStyleOptionToolBar opt; initStyleOption(&opt); if (style()->subElementRect(QStyle::SE_ToolBarHandle, &opt, this).contains(e->pos())) setCursor(Qt::SizeAllCursor); else unsetCursor();#endif break; } case QEvent::MouseMove: if (d->mouseMoveEvent(static_cast<QMouseEvent*>(event))) return true; break;#ifdef Q_OS_WINCE case QEvent::ContextMenu: { QContextMenuEvent* contextMenuEvent = static_cast<QContextMenuEvent*>(event); QWidget* child = childAt(contextMenuEvent->pos()); QAbstractButton* button = qobject_cast<QAbstractButton*>(child); if (button) button->setDown(false); } break;#endif case QEvent::Leave: if (d->state != 0 && d->state->dragging) {#ifdef Q_OS_WIN // This is a workaround for loosing the mouse on Vista. QPoint pos = QCursor::pos(); QMouseEvent fake(QEvent::MouseMove, mapFromGlobal(pos), pos, Qt::NoButton, QApplication::mouseButtons(), QApplication::keyboardModifiers()); d->mouseMoveEvent(&fake);#endif } else { if (!d->layout->expanded) break; QWidget *w = QApplication::activePopupWidget(); if (waitForPopup(this, w)) { d->waitForPopupTimer.start(POPUP_TIMER_INTERVAL, this); break; }//.........这里部分代码省略.........
开发者ID:ballock,项目名称:qtbase,代码行数:101,
示例21: testPaintAttributevoid QwtPlotCanvas::drawCanvas( QPainter *painter, bool withBackground ) { bool hackStyledBackground = false; if ( withBackground && testAttribute( Qt::WA_StyledBackground ) && testPaintAttribute( HackStyledBackground ) ) { // Antialiasing rounded borders is done by // inserting pixels with colors between the // border color and the color on the canvas, // When the border is painted before the plot items // these colors are interpolated for the canvas // and the plot items need to be clipped excluding // the anialiased pixels. In situations, where // the plot items fill the area at the rounded // borders this is noticeable. // The only way to avoid these annoying "artefacts" // is to paint the border on top of the plot items. if ( d_data->styleSheet.hasBorder && !d_data->styleSheet.borderPath.isEmpty() ) { // We have a border with at least one rounded corner hackStyledBackground = true; } } if ( withBackground ) { painter->save(); if ( testAttribute( Qt::WA_StyledBackground ) ) { if ( hackStyledBackground ) { // paint background without border painter->setPen( Qt::NoPen ); painter->setBrush( d_data->styleSheet.background.brush ); painter->setBrushOrigin( d_data->styleSheet.background.origin ); painter->setClipPath( d_data->styleSheet.borderPath ); painter->drawRect( contentsRect() ); } else { qwtDrawStyledBackground( this, painter ); } } else if ( autoFillBackground() ) { painter->setPen( Qt::NoPen ); painter->setBrush( palette().brush( backgroundRole() ) ); if ( d_data->borderRadius > 0.0 && ( rect() == frameRect() ) ) { if ( frameWidth() > 0 ) { painter->setClipPath( borderPath( rect() ) ); painter->drawRect( rect() ); } else { painter->setRenderHint( QPainter::Antialiasing, true ); painter->drawPath( borderPath( rect() ) ); } } else { painter->drawRect( rect() ); } } painter->restore(); } painter->save(); if ( !d_data->styleSheet.borderPath.isEmpty() ) { painter->setClipPath( d_data->styleSheet.borderPath, Qt::IntersectClip ); } else { if ( d_data->borderRadius > 0.0 ) painter->setClipPath( borderPath( frameRect() ), Qt::IntersectClip ); else painter->setClipRect( contentsRect(), Qt::IntersectClip ); } plot()->drawCanvas( painter ); painter->restore(); if ( withBackground && hackStyledBackground ) { // Now paint the border on top QStyleOptionFrame opt; opt.initFrom(this); style()->drawPrimitive( QStyle::PE_Frame, &opt, painter, this);//.........这里部分代码省略.........
开发者ID:Aerovinci,项目名称:qgroundcontrol,代码行数:101,
示例22: stylePen::style Pen::Style() const{ return style( (*API->Pen->GetPenStyle)( handle ) );}
开发者ID:AndresPozo,项目名称:PCL,代码行数:4,
示例23: QApplicationApp::App(int &argc, char **argv): QApplication(argc, argv), d(new Data(this)) { if (QFile::exists(applicationDirPath() % "/bomi.ini"_a)) { QSettings set(applicationDirPath() % "/bomi.ini"_a, QSettings::IniFormat); d->useLocalConfig = set.value(u"app/use-local-config"_q, false).toBool(); Global::useLocalConfig = set.value(u"global/use-local-config"_q, false).toBool(); if (d->useLocalConfig != Global::useLocalConfig) { const auto from = _WritablePath(Location::Config, false); Global::useLocalConfig = d->useLocalConfig; const auto to = _WritablePath(Location::Config, false); d->copyConfig(from, to); set.setValue(u"global/use-local-config"_q, Global::useLocalConfig); } }#ifdef Q_OS_LINUX setlocale(LC_NUMERIC,"C");#endif OS::initialize(); _New(d->parser); d->parser->addOption(LineCmd::Open, u"open"_q, u"Open given %1 for file path or URL."_q, u"mrl"_q); d->parser->addOption(LineCmd::SetSubtitle, u"set-subtitle"_q, u"Set subtitle file to display."_q, u"file"_q);// d->parser->addOption(LineCmd::AddSubtitle, u"add-subtitle"_q,// u"Add subtitle file to display."_q, u"file"_q); d->parser->addOption(LineCmd::Wake, u"wake"_q, u"Bring the application window in front."_q); d->parser->addOption(LineCmd::Action, u"action"_q, u"Exectute %1 action or open %1 menu."_q, u"id"_q); d->parser->addOption(LineCmd::LogLevel, u"log-level"_q, u"Maximum verbosity for log. %1 should be one of nexts:/n "_q % Log::levelNames().join(u", "_q), u"lv"_q); d->parser->addOption(LineCmd::Debug, u"debug"_q, u"Turn on options for debugging."_q); d->parser->addOption(LineCmd::DumpApiTree, u"dump-api-tree"_q, u"Dump API structure tree to stdout."_q); d->parser->addOption(LineCmd::DumpActionList, u"dump-action-list"_q, u"Dump executable action list to stdout."_q);#ifdef Q_OS_WIN d->parser->addOption(LineCmd::WinAssoc, u"win-assoc"_q, u"Associate given comma-separated extension list."_q, u"ext"_q); d->parser->addOption(LineCmd::WinUnassoc, u"win-unassoc"_q, u"Unassociate all extensions."_q); d->parser->addOption(LineCmd::WinAssocDefault, u"win-assoc-default"_q, u"Associate default extensions."_q);#endif d->parser->parse(arguments()); d->gldebug = d->parser->isSet(LineCmd::Debug); const auto lvStdOut = d->parser->stdoutLogLevel(); d->import(); d->storage.setObject(this, u"application"_q); d->storage.add("locale", &d->locale); d->storage.json("log-option", &d->logOption); d->storage.add("style-name", &d->styleName); d->storage.add("unique", &d->unique); d->storage.add("open-folders", open_folders, set_open_folders); d->storage.add("font"); d->storage.add("fixedFont"); d->storage.restore(); setLocale(d->locale); auto logOption = d->logOption; if (logOption.level(LogOutput::StdOut) < lvStdOut) logOption.setLevel(LogOutput::StdOut, lvStdOut); Log::setOption(logOption); setQuitOnLastWindowClosed(false);#ifndef Q_OS_MAC setWindowIcon(defaultIcon());#endif d->styleNames = [this] () { auto names = QStyleFactory::keys(); const auto defaultName = style()->objectName(); for (auto it = ++names.begin(); it != names.end(); ++it) { if (defaultName.compare(*it, Qt::CaseInsensitive) == 0) { const auto name = *it; names.erase(it); names.prepend(name); break; } } return names; }(); auto makeStyle = [&]() { auto name = d->styleName; if (style()->objectName().compare(name, Qt::CaseInsensitive) == 0) return; if (!d->styleNames.contains(name, Qt::CaseInsensitive)) return; setStyle(QStyleFactory::create(name)); }; makeStyle(); connect(&d->connection, &LocalConnection::messageReceived,//.........这里部分代码省略.........
开发者ID:ertos12,项目名称:bomi,代码行数:101,
示例24: styleint QgsDateTimeEdit::frameWidth() const{ return style()->pixelMetric( QStyle::PM_DefaultFrameWidth );}
开发者ID:ACorradini,项目名称:QGIS,代码行数:4,
示例25: initStyleOption/*! /reimp*/bool QCheckBox::hitButton(const QPoint &pos) const{ QStyleOptionButton opt; initStyleOption(&opt); return style()->subElementRect(QStyle::SE_CheckBoxClickRect, &opt, this).contains(pos);}
开发者ID:NikhilNJ,项目名称:screenplay-dx,代码行数:9,
示例26: styleint QgsDoubleSpinBox::frameWidth() const{ return style()->pixelMetric( QStyle::PM_DefaultFrameWidth );}
开发者ID:LingboTang,项目名称:QGIS,代码行数:4,
|