void Paint( QPainter& painter, int x, int y ) const { painter.save(); QRect rect( x, y, Width(), Height() ); painter.setClipRect( rect ); // BG QPen pen = QPen( QColor( 160, 160, 160 ) ); pen.setWidth( 3 ); painter.setPen( pen ); painter.setBrush( QBrush( QColor( 70, 70, 70, 175 ) ) ); painter.drawRoundedRect( rect, 10, 10 ); // Title y += Padding(); painter.setPen( QPen( Qt::white) ); painter.setFont( mTitleFont ); painter.drawText( x, y, Width(), TitleHeight(), Qt::AlignCenter | Qt::AlignVCenter | Qt::TextDontClip, mTitle ); y += TitleHeight() + RowSpacing(); // Lines painter.setPen( QPen( Qt::white) ); painter.setFont( mRowFont ); for( const QVariantMap& it : mHistory ) { int mx = x + Padding(); DrawMana( painter, mx, y, RowHeight(), RowHeight(), it["mana"].toInt() ); int cx = mx + RowHeight() + 5; DrawCardLine( painter, cx, y, RowWidth() - cx, RowHeight(), it["name"].toString(), it["count"].toInt() ); y += RowHeight(); y += RowSpacing(); } painter.restore(); }
//////////////////////////////////////////////////////////// // QueueListBox //////////////////////////////////////////////////////////// QueueListBox::QueueListBox(const std::string& drop_type_str, const std::string& prompt_str) : CUIListBox(), m_drop_point(end()), m_show_drop_point(false), m_order_issuing_enabled(true), m_showing_prompt(true), m_prompt_str(prompt_str) { AllowDropType(drop_type_str); GG::Connect(BeforeInsertSignal, &QueueListBox::EnsurePromptHiddenSlot, this); GG::Connect(AfterEraseSignal, &QueueListBox::ShowPromptConditionallySlot, this); GG::Connect(ClearedSignal, &QueueListBox::ShowPromptSlot, this); GG::Connect(GG::ListBox::RightClickedSignal, &QueueListBox::ItemRightClicked, this); // preinitialize listbox/row column widths, because what // ListBox::Insert does on default is not suitable for this case SetNumCols(1); SetColWidth(0, GG::X0); LockColWidths(); NormalizeRowsOnInsert(false); Insert(new PromptRow(RowWidth(), m_prompt_str)); }