DrawText() public method

public DrawText ( QPoint p, string s ) : void
p QPoint
s string
return void
Ejemplo n.º 1
0
        protected override void PaintEvent(Qyoto.QPaintEvent arg1)
        {
            using (QPainter p = new QPainter(this)) {
                var rect = ContentsRect();
                //var fm = new QFontMetrics(Font);

                //if (fm.Width(Text) > rect.Width()) {
                    var gradient = new QLinearGradient(rect.TopLeft(), rect.TopRight());
                    gradient.SetColorAt(0.8, Palette.Color(QPalette.ColorRole.WindowText));
                    gradient.SetColorAt(1.0, new QColor(Qt.GlobalColor.transparent));
                    var pen = new QPen();
                    pen.SetBrush(new QBrush(gradient));
                    p.SetPen(pen);
                //}

                p.DrawText(rect, (int)Qt.TextFlag.TextSingleLine, Text);
            }
        }
Ejemplo n.º 2
0
            public override void Paint(Qyoto.QPainter painter, Qyoto.QStyleOptionGraphicsItem option, Qyoto.QWidget widget)
            {
                painter.SetRenderHint(QPainter.RenderHint.Antialiasing, true);
                int iconSize = m_Grid.IconSize;

                // Parent opacity overrides item opacity.
                var parentGroup = (RosterItemGroup)base.Group();

                if (parentGroup == null)                 // This happens while the item is being removed.
                {
                    return;
                }
                if (parentGroup.Opacity != 1)
                {
                    painter.SetOpacity(parentGroup.Opacity);
                }
                else
                {
                    painter.SetOpacity(m_Opacity);
                }

                QPixmap pixmap = (QPixmap)m_Grid.Model.GetImage(m_Item);

                Gui.DrawAvatar(painter, iconSize, iconSize, pixmap);

                if (IsHover)
                {
                    // FIXME: Do something?
                }

                if (m_Grid.ListMode)
                {
                    var rect = BoundingRect();
                    var pen  = new QPen();
                    pen.SetBrush(m_Grid.Palette.Text());
                    painter.SetPen(pen);

                    int x = iconSize + m_Grid.IconPadding;
                    painter.DrawText(x, 0, (int)rect.Width() - x, (int)rect.Height(), (int)Qt.TextFlag.TextSingleLine, m_Grid.Model.GetName(m_Item));
                }
            }
Ejemplo n.º 3
0
            public override void Paint(Qyoto.QPainter painter, Qyoto.QStyleOptionGraphicsItem option, Qyoto.QWidget widget)
            {
                painter.SetOpacity(m_Opacity);

                var color = m_Grid.Palette.Color(QPalette.ColorRole.Text);

                // Group Name
                painter.SetFont(m_Font);
                painter.SetPen(new QPen(color));

                string text = null;

                if (m_Grid.ShowGroupCounts)
                {
                    text = String.Format("{0} ({1}/{2})",
                                         m_GroupName,
                                         m_Grid.Model.NumOnlineItemsInGroup(m_GroupName),
                                         m_Grid.Model.NumItemsInGroup(m_GroupName));
                }
                else
                {
                    text = m_GroupName;
                }

                painter.DrawText(BoundingRect(), text);

                int arrowX = m_Grid.IconPadding + m_Metrics.Width(text) + 4;
                int arrowY = 5;

                // Group expander arrow
                painter.Save();
                painter.Translate(arrowX, arrowY);
                QPainterPath path = new QPainterPath();

                if (IsExpanded)
                {
                    path.MoveTo(0, 0);
                    path.LineTo(4, 0);
                    path.LineTo(2, 2);
                    path.LineTo(0, 0);
                }
                else
                {
                    path.MoveTo(2, 0);
                    path.LineTo(2, 4);
                    path.LineTo(0, 2);
                    path.LineTo(2, 0);
                }
                painter.SetPen(new QPen(color));
                painter.SetBrush(new QBrush(color));
                painter.DrawPath(path);
                painter.Restore();

                m_ArrowRect = new QRectF(arrowX, 0, 4, m_Grid.HeaderHeight);

                if (ItemOver)
                {
                    painter.SetPen(new QPen(new QColor("red")));
                    painter.DrawRect(BoundingRect());
                }
            }
Ejemplo n.º 4
0
Archivo: t8.cs Proyecto: KDE/qyoto
 protected override void PaintEvent(QPaintEvent ev)
 {
     using (QPainter painter = new QPainter(this)) {
         painter.DrawText(200, 200, string.Format("Angle = {0}",currentAngle));
         painter.End();
     }
 }
Ejemplo n.º 5
0
    protected override void PaintEvent(QPaintEvent arg1)
    {
        QPainter painter = new QPainter(this);

        if (gameEnded) {
            painter.SetPen(Qt.GlobalColor.black);
            painter.SetFont(new QFont("Courier", 48, (int) QFont.Weight.Bold));
            painter.DrawText(Rect, (int) Qt.AlignmentFlag.AlignCenter, Tr("Game Over"));
        }

        PaintCannon(painter);
        PaintBarrier(painter);
        if (IsShooting)
            PaintShot(painter);
        if (!gameEnded)
            PaintTarget(painter);

        painter.End();
    }