void KateTabButton::mousePressEvent(QMouseEvent *ev) { ev->accept(); if (ev->button() == Qt::LeftButton) { if (! isChecked()) { // make sure we stay checked setChecked(true); } // notify that this button was activated emit activated(this); } else { ev->ignore(); } }
void KisPressureHSVOption::apply(KoColorTransformation* transfo, const KisPaintInformation& info) const { if (!isChecked()) { return; } if(d->paramId == -1) { d->paramId = transfo->parameterId(d->parameterName); } double v = computeValue(info) * (d->max - d->min) + d->min; transfo->setParameter(d->paramId, v); }
// render void CWindowControl_Radio::render(void) { float32 fRadius = getSize().m_x / 2; CVector2ui32 vecCircleCenterPosition = getPosition() + ((uint32) fRadius); // todo - use CVector2ui32 vecCircleCenterPosition = CMathUtility::getCircleFromRectangle() if (isChecked()) { CGDIPlusUtility::drawCircleFill(vecCircleCenterPosition, fRadius, 0x0000FFFF); } else { CGDIPlusUtility::drawCircleFill(vecCircleCenterPosition, fRadius, getFillColour()); } CGDIPlusUtility::drawCircleBorder(vecCircleCenterPosition, fRadius, getLineColour()); CGDIPlusUtility::drawText(CVector2ui32(getPosition().m_x + getSize().m_x + getIconRightMargin(), getPosition().m_y), CVector2ui32(getPosition().m_x + getSize().m_x + getIconRightMargin() + 500, getSize().m_y), getText(), getTextColour(), getFontSize(), isBold()); }
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option , QWidget *widget) { Q_UNUSED(option); Q_UNUSED(widget); QRectF paintRect(style()->marginLeft(), style()->marginTop(), size().width() - style()->marginLeft() - style()->marginRight(), size().height() - style()->marginTop() - style()->marginBottom()); painter->fillRect(paintRect, m_color); if (isChecked()) { painter->setPen(QColor(0, 0, 0)); painter->drawRect(rect()); } }
void tButtonTestButton::paintEvent( QPaintEvent* e ) { QPushButton::paintEvent( e ); // Paint red outline around key if depressed if ( isDown() || isChecked() ) { QPainter p( this ); QPen pen( Qt::red ); pen.setWidth( 8 ); p.setPen( pen ); p.drawRect( QRect( 0, 0, this->width(), this->height() ) ); p.end(); } }
/*! * \internal */ void HacLed::paintEvent(QPaintEvent * ) { QPainter p(this); QColor bgColor = palette().background().color(); if (d->shape==Circular) { int sidesize = qMin(width(), height()); p.setRenderHint(QPainter::Antialiasing); int rad = sidesize*0.45; QRect r = rect().adjusted((width()-sidesize)/2, (height()-sidesize)/2, -(width()-sidesize)/2, -(height()-sidesize)/2); QRadialGradient grad(rect().center(), rad, rect().center()-QPoint(sidesize*0.1, sidesize*0.1) ); grad.setColorAt(0.0, palette().color(QPalette::Light)); grad.setColorAt(0.75, isChecked() ? d->color : bgColor); p.setBrush(grad); QPen pe = p.pen(); pe.setWidth(d->width); pe.setColor(palette().color(QPalette::Foreground)); p.setPen(pe); p.drawEllipse(r.adjusted(d->width,d->width,-d->width,-d->width)); } else { /*if (d->shape == Rectangular)*/ QStyleOptionFrame opt; opt.initFrom(this); opt.lineWidth = d->width; opt.midLineWidth = d->width; if (d->shape==RectangularRaised) opt.state |= QStyle::State_Raised; else if (d->shape==RectangularSunken) opt.state |= QStyle::State_Sunken; QBrush br(isChecked() ? d->color : bgColor); if (d->shape==RectangularPlain) qDrawPlainRect(&p, opt.rect, opt.palette.foreground().color(), d->width, &br); else qDrawShadePanel(&p, opt.rect, opt.palette, d->shape==RectangularSunken, d->width, &br); } }
void CCheckBox::onTouchCancelled(CCTouch* pTouch, float fDuration) { CC_WIDGET_LONGCLICK_ONTOUCHCANCELLED; if( isChecked() ) { SAFE_SET_VISIBLE(m_pCheckedPress, false); SAFE_SET_VISIBLE(m_pChecked, true); } else { SAFE_SET_VISIBLE(m_pNormalPress, false); SAFE_SET_VISIBLE(m_pNormal, true); } }
EAppearance RenderThemeQt::applyTheme(QStyleOption& option, RenderObject* o) const { // Default bits: no focus, no mouse over option.state &= ~(QStyle::State_HasFocus | QStyle::State_MouseOver); if (!isEnabled(o)) option.state &= ~QStyle::State_Enabled; if (isReadOnlyControl(o)) // Readonly is supported on textfields. option.state |= QStyle::State_ReadOnly; if (supportsFocus(o->style()->appearance()) && isFocused(o)) option.state |= QStyle::State_HasFocus; if (isHovered(o)) option.state |= QStyle::State_MouseOver; EAppearance result = o->style()->appearance(); switch (result) { case PushButtonAppearance: case SquareButtonAppearance: case ButtonAppearance: case ButtonBevelAppearance: case ListItemAppearance: case MenulistButtonAppearance: case ScrollbarButtonLeftAppearance: case ScrollbarButtonRightAppearance: case ScrollbarTrackHorizontalAppearance: case ScrollbarTrackVerticalAppearance: case ScrollbarThumbHorizontalAppearance: case ScrollbarThumbVerticalAppearance: case SearchFieldResultsButtonAppearance: case SearchFieldCancelButtonAppearance: { if (isPressed(o)) option.state |= QStyle::State_Sunken; else if (result == PushButtonAppearance) option.state |= QStyle::State_Raised; break; } } if(result == RadioAppearance || result == CheckboxAppearance) option.state |= (isChecked(o) ? QStyle::State_On : QStyle::State_Off); return result; }
//----------------------------------------------------------------------------- void CBinarySensorArrayWidget::updateData () { if ( isChecked() ) { for ( unsigned int i = 0; i < mSensorArray->getNumSamples(); i++ ) { mLed[i]->setHidden ( false ); if ( mSensorArray->mBitData[i] ) mLed[i]->setData ( CDataLed::GREEN_ON ); else mLed[i]->setData ( CDataLed::GREEN_OFF ); } } else { for ( unsigned int i = 0; i < mSensorArray->getNumSamples(); i++ ) mLed[i]->setHidden ( true ); } }
void ImageWidget::paintEvent(QPaintEvent *pe) { QRect rc = rect(); QPainter painter(this); painter.fillRect(rc, QBrush(QColor(255, 255, 255))); QPoint pos((rc.width() - image_.width()) >> 1, (rc.height() - image_.height()) >> 1); painter.drawImage(pos, image_); if (isChecked()) { QPainterPath path; path.addRoundedRect(rc.adjusted(2, 2, -2, -2), 8, 8); painter.drawPath(path); } }
void CQGroupBox:: setChecked(bool checked) { if (checked != checked_) { checked_ = checked; if (isCheckable()) { updateEnabled(); emit toggled(isChecked()); update(); } } }
void ReportPropertiesButton::paintEvent(QPaintEvent* event) { Q_UNUSED(event); QPainter painter(this); QPen pen(palette().windowText(), 2.0, Qt::SolidLine, Qt::SquareCap, Qt::MiterJoin); QColor c(pen.color()); c.setAlpha(120); pen.setColor(c); painter.setPen(pen); painter.drawRect(4, 4, width() - 8, height() - 8); if (isChecked()) { painter.fillRect(7, 7, width() - 14, height() - 14, pen.brush()); } }
void KisPressureHSVOption::apply(KoColorTransformation* transfo, const KisPaintInformation& info) const { if (!isChecked()) { return; } if (d->paramId == -1) { d->paramId = transfo->parameterId(d->parameterName); } qreal value = computeRotationLikeValue(info, 0, false); transfo->setParameter(d->paramId, value); transfo->setParameter(3, 0); //sets the type to HSV. transfo->setParameter(4, false); //sets the colorize to false. }
Qt::ItemFlags ContentSelectorModel::ContentModel::flags(const QModelIndex &index) const { if (!index.isValid()) return Qt::NoItemFlags; const EsmFile *file = item(index.row()); if (!file) return Qt::NoItemFlags; //game files can always be checked if (file->isGameFile()) return Qt::ItemIsEnabled | Qt::ItemIsSelectable; Qt::ItemFlags returnFlags; bool allDependenciesFound = true; bool gamefileChecked = false; //addon can be checked if its gamefile is and all other dependencies exist foreach (const QString &fileName, file->gameFiles()) { bool depFound = false; foreach (EsmFile *dependency, mFiles) { //compare filenames only. Multiple instances //of the filename (with different paths) is not relevant here. depFound = (dependency->fileName().compare(fileName, Qt::CaseInsensitive) == 0); if (!depFound) continue; if (!gamefileChecked) { if (isChecked (dependency->filePath())) gamefileChecked = (dependency->isGameFile()); } // force it to iterate all files in cases where the current // dependency is a game file to ensure that a later duplicate // game file is / is not checked. // (i.e., break only if it's not a gamefile or the game file has been checked previously) if (gamefileChecked || !(dependency->isGameFile())) break; } allDependenciesFound = allDependenciesFound && depFound; }
void FalagardRewardItem::drawSelf( float z ) { if (d_needsRedraw ) { d_renderCache.clearCachedImagery(); d_needsRedraw = false; drawNormal(z); } if (isChecked()) // 如果按下了,就画按下的蒙字 { drawPushed(z); } Window::drawSelf(z); }
void DeintSettingsW::writeSettings() { Settings &QMPSettings = QMPlay2Core.getSettings(); QMPSettings.set("Deinterlace/ON", isChecked()); QMPSettings.set("Deinterlace/Auto", autoDeintB->isChecked()); QMPSettings.set("Deinterlace/Doubler", doublerB->isChecked()); QMPSettings.set("Deinterlace/AutoParity", autoParityB->isChecked()); QMPSettings.set("Deinterlace/SoftwareMethod", softwareMethodsCB->currentText()); QMPSettings.set("Deinterlace/TFF", (bool)parityCB->currentIndex()); QSet<Module *> videoDeintModules; for (QObject *obj : children()) if (obj->isWidgetType() && !obj->property("module").isNull()) videoDeintModules.insert((Module *)obj->property("module").value<void *>()); for (Module *module : asConst(videoDeintModules)) module->videoDeintSave(); }
unsigned RenderThemeGdk::determineState(RenderObject* o) { unsigned result = TS_NORMAL; if (!isEnabled(o)) result = TS_DISABLED; else if (isReadOnlyControl(o)) result = TFS_READONLY; // Readonly is supported on textfields. else if (supportsFocus(o->style()->appearance()) && isFocused(o)) result = TS_FOCUSED; else if (isPressed(o)) result = TS_ACTIVE; else if (isHovered(o)) result = TS_HOVER; if (isChecked(o)) result += 4; // 4 unchecked states, 4 checked states. return result; }
//----------------------------------------------------------------------------- void CVelocity2dWidget::updateData(CVelocity2d velocity) { if ( isChecked() ) { mXDotLine->setHidden ( false ); mYDotLine->setHidden ( false ); mYawDotLine->setHidden ( false ); mXDotLine->setData ( velocity.mXDot ); mYDotLine->setData ( velocity.mYDot ); mYawDotLine->setData ( R2D ( velocity.mYawDot ) ); } else { mXDotLine->setHidden ( true ); mYDotLine->setHidden ( true ); mYawDotLine->setHidden ( true ); } }
void TquestionAsWdg::groupChecked() { if (isChecked()) { asNoteChB->setChecked(true); asNameChB->setChecked(true); // For this moment only guitar check boxes can be invisible, no need to unchecking others if (asFretPosChB->isVisible()) asFretPosChB->setChecked(true); else asFretPosChB->setChecked(false); asSoundChB->setChecked(true); } else { asNoteChB->setChecked(false); asNameChB->setChecked(false); asFretPosChB->setChecked(false); asSoundChB->setChecked(false); } }
/* * Draws the button. */ void DColorButton::paintEvent(QPaintEvent *e) { QPainter painter(this); QStyleOptionButton opt; if ( isChecked() ) { opt.state |= QStyle::State_Raised; } opt.rect = rect(); opt.palette.setColor(QPalette::Button, m_color); opt.palette.setColor(QPalette::Background, m_color); style()->drawControl(QStyle::CE_PushButtonBevel, &opt, &painter, this); }
bool RazorShortcutButton::event(QEvent *event) { Q_D(RazorShortcutButton); if (isChecked()) { if (event->type() == QEvent::KeyPress) return d->keyPressEvent(static_cast<QKeyEvent *>(event)); if (event->type() == QEvent::KeyRelease) return d->keyReleaseEvent(static_cast<QKeyEvent *>(event)); if (event->type() == QEvent::FocusOut) setChecked(false); } return QToolButton::event(event); }
QString CheckBox::handleDCOP(int function, const QStringList& args) { switch (function) { case DCOP::text: return text(); case DCOP::setText: setWidgetText(args[0]); break; case DCOP::checked: return QString::number(isChecked()); case DCOP::setChecked: setChecked(args[0] != "false" && args[0] != "0"); break; default: return KommanderWidget::handleDCOP(function, args); } return QString(); }
unsigned RenderThemeChromiumWin::determineState(RenderObject* o) { unsigned result = TS_NORMAL; ControlPart appearance = o->style()->appearance(); if (!isEnabled(o)) result = TS_DISABLED; else if (isReadOnlyControl(o) && (TextFieldPart == appearance || TextAreaPart == appearance || SearchFieldPart == appearance)) result = ETS_READONLY; // Readonly is supported on textfields. else if (isPressed(o)) // Active overrides hover and focused. result = TS_PRESSED; else if (supportsFocus(appearance) && isFocused(o)) result = ETS_FOCUSED; else if (isHovered(o)) result = TS_HOT; if (isChecked(o)) result += 4; // 4 unchecked states, 4 checked states. return result; }
void ImageButton::paintEvent( QPaintEvent* event ) { QPainter p( this ); p.setClipRect( event->rect() ); QIcon::Mode mode = isDown() ? QIcon::Active : isEnabled() ? QIcon::Normal : QIcon::Disabled; QIcon::State state = isChecked() ? QIcon::On : QIcon::Off; icon().paint( &p, rect(), Qt::AlignCenter, mode, state ); }
QStyleOptionButton PushButtonOrientated::getStyleOption() const { QStyleOptionButton option; option.initFrom(this); if (m_orientation == Qt::Vertical) { QSize size = option.rect.size(); size.transpose(); option.rect.setSize(size); } option.features = QStyleOptionButton::None; if (isFlat()) { option.features |= QStyleOptionButton::Flat; } if (menu()) { option.features |= QStyleOptionButton::HasMenu; } if (autoDefault() || isDefault()) { option.features |= QStyleOptionButton::AutoDefaultButton; } if (isDefault()) { option.features |= QStyleOptionButton::DefaultButton; } if (isDown() || (menu() && menu()->isVisible())) { option.state |= QStyle::State_Sunken; } if (isChecked()) { option.state |= QStyle::State_On; } if (!isFlat() && !isDown()) { option.state |= QStyle::State_Raised; } option.text = text(); option.icon = icon(); option.iconSize = iconSize(); return option; }
void FindReplaceDlg::changeCoding(void) { _currDataType = (eCodingType)::SendDlgItemMessage(_hSelf, IDC_COMBO_DATATYPE, CB_GETCURSEL, 0, 0); _pFindCombo->setCodingType(_currDataType); _pReplaceCombo->setCodingType(_currDataType); /* in hex mode keep sure that is match case */ if (_currDataType == HEX_CODE_HEX) { ::ShowWindow(::GetDlgItem(_hSelf, IDC_CHECK_MATCHCASE), SW_HIDE); _isMatchCase = TRUE; } else { ::ShowWindow(::GetDlgItem(_hSelf, IDC_CHECK_MATCHCASE), SW_SHOW); _isMatchCase = isChecked(IDC_CHECK_MATCHCASE); } }
void TimeCursor::paintCursor(SansFont &font) { if (!isChecked()) return; GLfloat cp = getPosition(); glPushMatrix(); glLineWidth(1); glColor4f(0.8, 0.8, 0.8, 1.0); glEnable(GL_LINE_STIPPLE); glBegin(GL_LINES); glVertex2f(cp, -DIVS_VOLTAGE/2); glVertex2f(cp, DIVS_VOLTAGE/2); glEnd(); glDisable(GL_LINE_STIPPLE); glPopMatrix(); glPushMatrix(); glColor4f(0.8, 0.8, 0.8, 1.0); double timePos = (cp + DIVS_TIME/2) / timeDiv + (DIVS_TIME - DIVS_TIME / timeDiv) * timeShift - DIVS_TIME/2; timePos *= timeBase; int precision; if (timeDiv < 10) precision = 2; else if (timeDiv < 100) precision = 3; else precision = 4; QString str; if (timeBase < 1e-3) str = QString::number(timePos * 1e6, 'f', precision).append(QChar(0xB5)).append("s"); else if (timeBase < 1) str = QString::number(timePos * 1e3, 'f', precision).append("ms"); else str = QString::number(timePos, 'f', precision).append("s"); double strWidth = 0.17 * str.length(); if (cp < DIVS_TIME/2 - strWidth) glTranslatef(cp, -DIVS_VOLTAGE/2, 0.0); else glTranslatef(cp - strWidth, -DIVS_VOLTAGE/2, 0.0); font.glString(str, 0.3); glPopMatrix(); }
void KisInputButton::keyPressEvent(QKeyEvent *event) { if (isChecked()) { if (d->newInput) { d->keys.clear(); d->newInput = false; } Qt::Key key = static_cast<Qt::Key>(event->key()); if (key == Qt::Key_Meta && event->modifiers().testFlag(Qt::ShiftModifier)) { key = Qt::Key_Alt; } d->keys.append(key); d->updateLabel(); d->resetTimer->start(); } }
void ExtendedButton::paintEvent(QPaintEvent* event) { if (!isVisible()) return; QStylePainter p(this); QStyleOptionButton option; initStyleOption(&option); if (option.features & QStyleOptionButton::Flat) { if (isChecked() || isDown()) p.setOpacity(m_pressedOpacity / 100.0); else if (underMouse()) p.setOpacity(m_hoveredOpacity / 100.0); else p.setOpacity(m_normalOpacity / 100.0); option.features = option.features & ~QStyleOptionButton::Flat; } p.drawControl(QStyle::CE_PushButtonBevel, option); if (p.opacity() != 1.0) p.setOpacity(1.0); if (m_contentOrientation == Qt::Horizontal) { p.drawControl(QStyle::CE_PushButtonLabel, option); } else { long x = option.rect.left() + (option.rect.width() - option.iconSize.width()) / 2; long y = option.rect.top() + (option.rect.height() - option.iconSize.height() - m_contentInterval - option.fontMetrics.height()) / 2; p.drawPixmap(x, y, option.iconSize.width(), option.iconSize.height(), option.icon.pixmap(option.iconSize)); y += option.iconSize.height() + m_contentInterval; p.drawText(QRect(option.rect.left(), y, option.rect.width(), option.fontMetrics.height()), Qt::AlignHCenter | Qt::AlignTop, option.text); } }
void ToggleButton::paintEvent( QPaintEvent* event ) { Q_UNUSED( event ); QPainter p( this ); p.save(); QRect r = contentsRect(); StyleHelper::horizontalHeader( &p, r ); p.restore(); p.save(); p.setRenderHint( QPainter::Antialiasing ); p.setPen( Qt::white ); { QRect highlightRect( r ); highlightRect.adjust( 0, 2, 0, -3 ); if ( isChecked() ) { p.setBrush( StyleHelper::headerHighlightColor() ); } else if ( false ) { p.setBrush( StyleHelper::headerLowerColor() ); } else { p.setBrush( StyleHelper::headerUpperColor() ); } p.drawRoundedRect( highlightRect, 4.0, 4.0 ); } QTextOption to( Qt::AlignCenter ); r.adjust( 8, 0, -8, 0 ); p.setBrush( StyleHelper::headerTextColor() ); p.drawText( r, text(), to ); p.restore(); }