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

#include <unitselect.h>

+ Inheritance diagram for units_select:
+ Collaboration diagram for units_select:

Public Member Functions

 units_select (struct tile *ptile, QWidget *parent=0)
 Contructor for units_select. More...
 
 ~units_select () override
 Destructor for unit select. More...
 
void update_units ()
 Updates unit list on tile. More...
 
void create_pixmap ()
 Create pixmap of whole widget except borders (pix) More...
 

Public Attributes

tileutile
 

Protected Member Functions

void paint (QPainter *painter, QPaintEvent *event)
 Redirected paint event. More...
 
void paintEvent (QPaintEvent *event) override
 Paint event, redirects to paint(...) More...
 
void mousePressEvent (QMouseEvent *event) override
 Mouse pressed event for units_select. More...
 
void mouseMoveEvent (QMouseEvent *event) override
 Event for mouse moving around units_select. More...
 
void wheelEvent (QWheelEvent *event) override
 Mouse wheel event for units_select. More...
 
void closeEvent (QCloseEvent *event) override
 Close event for units_select, restores focus to map. More...
 

Private Member Functions

 Q_DISABLE_COPY (units_select)
 

Private Attributes

QPixmap * pix
 
QPixmap * h_pix
 
QSize item_size
 pixmap for highlighting More...
 
std::vector< unit * > unit_list
 size of each pixmap of unit More...
 
QFont ufont
 
QFont info_font
 
int column_count
 
int row_count
 
bool more
 
int show_line
 
int highligh_num
 
int unit_count
 

Detailed Description

Definition at line 28 of file unitselect.h.

Constructor & Destructor Documentation

◆ units_select()

units_select::units_select ( struct tile ptile,
QWidget *  parent = 0 
)

Contructor for units_select.

Definition at line 36 of file unitselect.cpp.

◆ ~units_select()

units_select::~units_select ( )
override

Destructor for unit select.

Definition at line 56 of file unitselect.cpp.

Member Function Documentation

◆ closeEvent()

void units_select::closeEvent ( QCloseEvent *  event)
overrideprotected

Close event for units_select, restores focus to map.

Definition at line 350 of file unitselect.cpp.

◆ create_pixmap()

void units_select::create_pixmap ( )

Create pixmap of whole widget except borders (pix)

Definition at line 65 of file unitselect.cpp.

Referenced by mouseMoveEvent(), units_select(), update_unit_sel(), and wheelEvent().

◆ mouseMoveEvent()

void units_select::mouseMoveEvent ( QMouseEvent *  event)
overrideprotected

Event for mouse moving around units_select.

do nothing if mouse is on border, just skip next if

Definition at line 186 of file unitselect.cpp.

◆ mousePressEvent()

void units_select::mousePressEvent ( QMouseEvent *  event)
overrideprotected

Mouse pressed event for units_select.

Left Button - chooses units Right Button - closes widget

Definition at line 213 of file unitselect.cpp.

◆ paint()

void units_select::paint ( QPainter *  painter,
QPaintEvent *  event 
)
protected

Redirected paint event.

Definition at line 228 of file unitselect.cpp.

Referenced by paintEvent().

◆ paintEvent()

void units_select::paintEvent ( QPaintEvent *  event)
overrideprotected

Paint event, redirects to paint(...)

Definition at line 301 of file unitselect.cpp.

◆ Q_DISABLE_COPY()

units_select::Q_DISABLE_COPY ( units_select  )
private

◆ update_units()

void units_select::update_units ( )

Updates unit list on tile.

Definition at line 314 of file unitselect.cpp.

Referenced by create_pixmap(), mousePressEvent(), real_focus_units_changed(), units_select(), update_unit_sel(), and wheelEvent().

◆ wheelEvent()

void units_select::wheelEvent ( QWheelEvent *  event)
overrideprotected

Mouse wheel event for units_select.

Definition at line 359 of file unitselect.cpp.

Member Data Documentation

◆ column_count

int units_select::column_count
private

Definition at line 37 of file unitselect.h.

Referenced by create_pixmap(), mouseMoveEvent(), paint(), update_units(), and wheelEvent().

◆ h_pix

QPixmap* units_select::h_pix
private

Definition at line 32 of file unitselect.h.

Referenced by create_pixmap(), units_select(), and ~units_select().

◆ highligh_num

int units_select::highligh_num
private

Definition at line 57 of file unitselect.h.

Referenced by create_pixmap(), mouseMoveEvent(), mousePressEvent(), paint(), and units_select().

◆ info_font

QFont units_select::info_font
private

Definition at line 36 of file unitselect.h.

Referenced by create_pixmap(), mouseMoveEvent(), paint(), and units_select().

◆ item_size

QSize units_select::item_size
private

pixmap for highlighting

Definition at line 33 of file unitselect.h.

Referenced by create_pixmap(), and mouseMoveEvent().

◆ more

bool units_select::more
private

Definition at line 55 of file unitselect.h.

Referenced by create_pixmap(), paint(), and wheelEvent().

◆ pix

QPixmap* units_select::pix
private

Definition at line 31 of file unitselect.h.

Referenced by create_pixmap(), paint(), units_select(), and ~units_select().

◆ row_count

int units_select::row_count
private

Definition at line 37 of file unitselect.h.

Referenced by create_pixmap(), mouseMoveEvent(), and wheelEvent().

◆ show_line

int units_select::show_line
private

Definition at line 56 of file unitselect.h.

Referenced by paint(), units_select(), update_units(), and wheelEvent().

◆ ufont

QFont units_select::ufont
private

Definition at line 35 of file unitselect.h.

Referenced by create_pixmap(), and units_select().

◆ unit_count

int units_select::unit_count
private

Definition at line 58 of file unitselect.h.

Referenced by create_pixmap(), paint(), and update_units().

◆ unit_list

std::vector<unit *> units_select::unit_list
private

size of each pixmap of unit

units currently visible

Definition at line 34 of file unitselect.h.

Referenced by create_pixmap(), mousePressEvent(), paint(), and update_units().

◆ utile

tile* units_select::utile

Definition at line 44 of file unitselect.h.

Referenced by paint(), units_select(), update_units(), and wheelEvent().