Freeciv21
Develop your civilization from humble roots to a global empire
unit_list_widget Class Reference

#include <citydlg.h>

+ Inheritance diagram for unit_list_widget:
+ Collaboration diagram for unit_list_widget:

Public Member Functions

 unit_list_widget (QWidget *parent=nullptr)
 Constructor. More...
 
QSize viewportSizeHint () const override
 Reimplemented virtual method. More...
 
void set_oneliner (bool oneliner)
 Sets whether the list should try to use a single line. More...
 
void set_show_upkeep (bool show)
 Sets whether upkeep needs to be shown. More...
 
void set_units (unit_list *units)
 Sets the list of units to be displayed. More...
 
std::vector< unit * > selected_playable_units () const
 Finds the list of currently selected units. More...
 

Protected Member Functions

void contextMenuEvent (QContextMenuEvent *event) override
 Reimplemented to provide the unit context menu. More...
 

Private Member Functions

void activate ()
 Activates unit and closes city dialog. More...
 
QPixmap create_unit_image (const unit *punit)
 Creates the image to represent the given unit in the list. More...
 

Private Attributes

bool m_oneliner = false
 
bool m_show_upkeep = false
 

Detailed Description

Definition at line 64 of file citydlg.h.

Constructor & Destructor Documentation

◆ unit_list_widget()

unit_list_widget::unit_list_widget ( QWidget *  parent = nullptr)
explicit

Constructor.

Definition at line 70 of file citydlg.cpp.

Member Function Documentation

◆ activate()

void unit_list_widget::activate ( )
private

Activates unit and closes city dialog.

Definition at line 166 of file citydlg.cpp.

Referenced by unit_list_widget().

◆ contextMenuEvent()

void unit_list_widget::contextMenuEvent ( QContextMenuEvent *  event)
overrideprotected

Reimplemented to provide the unit context menu.

Definition at line 148 of file citydlg.cpp.

◆ create_unit_image()

QPixmap unit_list_widget::create_unit_image ( const unit punit)
private

Creates the image to represent the given unit in the list.

Definition at line 184 of file citydlg.cpp.

Referenced by set_units().

◆ selected_playable_units()

std::vector< unit * > unit_list_widget::selected_playable_units ( ) const

Finds the list of currently selected units.

Definition at line 128 of file citydlg.cpp.

Referenced by activate(), and contextMenuEvent().

◆ set_oneliner()

void unit_list_widget::set_oneliner ( bool  oneliner)
inline

Sets whether the list should try to use a single line.

Definition at line 72 of file citydlg.h.

◆ set_show_upkeep()

void unit_list_widget::set_show_upkeep ( bool  show)
inline

Sets whether upkeep needs to be shown.

Definition at line 75 of file citydlg.h.

◆ set_units()

void unit_list_widget::set_units ( unit_list *  units)

Sets the list of units to be displayed.

Definition at line 101 of file citydlg.cpp.

◆ viewportSizeHint()

QSize unit_list_widget::viewportSizeHint ( ) const
override

Reimplemented virtual method.

Definition at line 84 of file citydlg.cpp.

Member Data Documentation

◆ m_oneliner

bool unit_list_widget::m_oneliner = false
private

Definition at line 88 of file citydlg.h.

Referenced by set_oneliner(), and viewportSizeHint().

◆ m_show_upkeep

bool unit_list_widget::m_show_upkeep = false
private

Definition at line 89 of file citydlg.h.

Referenced by create_unit_image(), and set_show_upkeep().