void FilmstripFrames::drawFrameIcon(QPainter &p, const QRect &r, int index, const TFrameId &fid, int flags) { QPixmap pm; TXshSimpleLevel *sl = getLevel(); if (sl) { pm = IconGenerator::instance()->getIcon(sl, fid); } if (!pm.isNull()) { p.drawPixmap(r.left(), r.top(), pm); if (sl && sl->getType() == PLI_XSHLEVEL && flags & F_INBETWEEN_RANGE) { int x1 = r.right(); int x0 = x1 - 12; int y0 = r.top(); int y1 = r.bottom(); p.fillRect(x0, y0, x1 - x0 + 1, y1 - y0 + 1, QColor(180, 180, 180, 255)); p.setPen(Qt::black); p.drawLine(x0 - 1, y0, x0 - 1, y1); QPixmap inbetweenPixmap( svgToPixmap(":Resources/filmstrip_inbetween.svg")); p.drawPixmap( x0 + 2, y1 - inbetweenPixmap.height() / inbetweenPixmap.devicePixelRatio() - 3, inbetweenPixmap); } } else { // non riesco (per qualche ragione) a visualizzare l'icona p.fillRect(r, QColor(255, 200, 200)); p.setPen(Qt::black); p.drawText(r, tr("no icon"), QTextOption(Qt::AlignCenter)); } }
void TPanelTitleBar::paintEvent(QPaintEvent *) { QPainter painter(this); QRect rect = this->rect(); bool isPanelActive; TPanel *dw = qobject_cast<TPanel *>(parentWidget()); Q_ASSERT(dw != 0); // docked panel if (!dw->isFloating()) { isPanelActive = dw->widgetInThisPanelIsFocused(); qDrawBorderPixmap(&painter, rect, QMargins(3, 3, 3, 3), (isPanelActive) ? m_activeBorderPm : m_borderPm); } // floating panel else { isPanelActive = isActiveWindow(); qDrawBorderPixmap( &painter, rect, QMargins(3, 3, 3, 3), (isPanelActive) ? m_floatActiveBorderPm : m_floatBorderPm); } if (dw->getOrientation() == TDockWidget::vertical) { QString titleText = painter.fontMetrics().elidedText( dw->windowTitle(), Qt::ElideRight, rect.width() - 50); painter.setBrush(Qt::NoBrush); painter.setPen(isPanelActive ? m_activeTitleColor : m_titleColor); painter.drawText(QPointF(10, 15), titleText); } if (dw->isFloating()) { const static QPixmap closeButtonPixmap( svgToPixmap(":/Resources/pane_close.svg", QSize(18, 18))); const static QPixmap closeButtonPixmapOver( svgToPixmap(":/Resources/pane_close_rollover.svg", QSize(18, 18))); QPoint closeButtonPos(rect.right() - 18, rect.top() + 1); if (m_closeButtonHighlighted) painter.drawPixmap(closeButtonPos, closeButtonPixmapOver); else painter.drawPixmap(closeButtonPos, closeButtonPixmap); } painter.end(); }