void CLabel::paintEvent(QPaintEvent *e) { QPainter painter(this); if (getMouseEnterFlag()) { paintWidget(50, &painter); } else if (getMousePressFlag()) { paintWidget(80, &painter); } QWidget::paintEvent(e); }
void table_widget_delegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { if (_column_datas.contains(index.column())) { paintWidget(painter, option, index); } else { QStyledItemDelegate::paint(painter, option, index); } }
void MyButton::paintEvent(QPaintEvent *pev) { QPainter painter(this); painter.setPen(QColor("green")); int x, y; QRect rect4Text; if (TOP2BOTTOM == m_textDirection) { x = 2 * this->m_fontHeight; y = 2 * this->m_fontWidth; rect4Text.setX(this->m_fontHeight / 2); rect4Text.setY(this->m_fontWidth / 2); rect4Text.setHeight(this->m_fontWidth); rect4Text.setWidth(this->m_fontHeight); } else if (LEFT2RIGHT == m_textDirection) { x = 2 * this->m_fontWidth; y = 2 * this->m_fontHeight; rect4Text.setX(this->m_fontWidth / 2); rect4Text.setY(this->m_fontHeight / 2); rect4Text.setHeight(this->m_fontHeight); rect4Text.setWidth(this->m_fontWidth); } this->setFixedSize(x, y); painter.drawText(rect4Text, m_text); if (this->m_enterFlag) { paintWidget(60, &painter); } else if (this->m_pressedFlag) { paintWidget(30, &painter); } else { paintWidget(100, &painter); } }
void CLabel::paintEvent(QPaintEvent *e) { QPainter painter(this); if (getMouseEnterFlag()) { if (m_bEnableTransition) { paintWidget(100, &painter, 0); } else { paintWidget(100, &painter, 3); } } else if (getMousePressFlag()) { if (m_bEnableTransition) { paintWidget(150, &painter,0); } else { paintWidget(180, &painter,3); } //paintWidget(200, &painter); } else { if (!m_bIsBkgTransparent) { paintWidget(50, &painter,0); } //paintWidget(20, &painter); } QWidget::paintEvent(e); }
void WidgetManager::paintPageWidgets(WebPage *page) { if (page == NULL) return; MySQL *query = page->site->manager->newQuery(); String sql = "select widgetId, tag from widget_site where siteId='" + (String)page->site->siteId + "'"; if (query->active(sql)) { int count = query->getRowCount(); for (int i = 0; i < count; i++) { int widgetId = query->getFieldValue(i, "widgetId").toInt(); String tag = query->getFieldValue(i, "tag"); paintWidget(page, tag, widgetId); } } }
void FractionPainter::paintEvent(QPaintEvent *) { QPainter paint(this); paintWidget(paint); }
void ColorShades::onPaint(ui::PaintEvent& ev) { auto theme = skin::SkinTheme::instance(); ui::Graphics* g = ev.graphics(); gfx::Rect bounds = clientBounds(); theme->paintWidget(g, this, style(), bounds); bounds.shrink(3*ui::guiscale()); gfx::Rect box(bounds.x, bounds.y, m_boxSize*ui::guiscale(), bounds.h); Shade colors = getShade(); if (colors.size() >= 2) { gfx::Rect hotBounds; int j = 0; for (int i=0; box.x<bounds.x2(); ++i, box.x += box.w) { // Make the last box a little bigger to just use all // available size if (i == int(colors.size())-1) { if (bounds.x+bounds.w-box.x <= m_boxSize+m_boxSize/2) box.w = bounds.x+bounds.w-box.x; } app::Color color; if (m_dragIndex >= 0 && m_hotIndex == i) { color = colors[m_dragIndex]; } else { if (j == m_dragIndex) { ++j; } if (j < int(colors.size())) color = colors[j++]; else color = app::Color::fromMask(); } draw_color(g, box, color, (doc::ColorMode)app_get_current_pixel_format()); if (m_hotIndex == i) hotBounds = box; } if (!hotBounds.isEmpty() && isHotEntryVisible()) { hotBounds.enlarge(3*ui::guiscale()); ui::PaintWidgetPartInfo info; theme->paintWidgetPart( g, theme->styles.shadeSelection(), hotBounds, info); } } else { g->fillRect(theme->colors.editorFace(), bounds); g->drawAlignedUIText(text(), theme->colors.face(), gfx::ColorNone, bounds, ui::CENTER | ui::MIDDLE); } }