Freeciv-3.2: unit_item Class Reference

Freeciv-3.2

Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Slots | Private Member Functions | Private Attributes
unit_item Class Reference

`#include <citydlg.h>`

Inheritance diagram for unit_item:

## Public Member Functions

| unit_item (QWidget *parent, struct unit *punit, bool supp=false, int happy_cost=0)
| ~unit_item ()
void | init_pix ()

## Protected Member Functions

void | wheelEvent (QWheelEvent *event)
void | mousePressEvent (QMouseEvent *event)
void | leaveEvent (QEvent *event)
void | enterEvent (QEnterEvent *event)

## Private Slots

void | disband ()
void | change_homecity ()
void | activate_unit ()
void | activate_and_close_dialog ()
void | sentry_unit ()
void | fortify_unit ()
void | upgrade_unit ()
void | load_unit ()
void | unload_unit ()
void | unload_all ()

## Private Member Functions

void | contextMenuEvent (QContextMenuEvent *ev)
void | create_actions ()

## Private Attributes

QAction * | disband_action
QAction * | change_home
QAction * | activate
QAction * | activate_and_close
QAction * | sentry
QAction * | fortify
QAction * | load
QAction * | unload
QAction * | upgrade
QAction * | unload_trans
QMenu * | unit_menu
struct unit * | qunit
QImage | unit_img
int | happy_cost
bool | supported

## Detailed Description

Definition at line 141 of file citydlg.h.

## Constructor & Destructor Documentation

## ◆ unit_item()

unit_item::unit_item | ( | QWidget * | parent,
|  | struct unit * | punit,
|  | bool | supp = `false`,
|  | int | hppy_cost = `0`
| ) |  |

Class representing one unit, allows context menu, holds pixmap for it

Definition at line 662 of file citydlg.cpp.

## ◆ ~unit_item()

unit_item::~unit_item | ( |  | ) |

Destructor for unit item

Definition at line 742 of file citydlg.cpp.

## Member Function Documentation

## ◆ activate_and_close_dialog

void unit_item::activate_and_close_dialog | ( |  | ) |

privateslot

Activates unit and closes city dialog

Definition at line 945 of file citydlg.cpp.

Referenced by create_actions().

## ◆ activate_unit

void unit_item::activate_unit | ( |  | ) |

privateslot

Activates unit in city dialog

Definition at line 956 of file citydlg.cpp.

Referenced by create_actions().

## ◆ change_homecity

void unit_item::change_homecity | ( |  | ) |

privateslot

Changes homecity for given unit

Definition at line 935 of file citydlg.cpp.

Referenced by create_actions().

## ◆ contextMenuEvent()

void unit_item::contextMenuEvent | ( | QContextMenuEvent * | event | ) |

private

Context menu handler

Definition at line 749 of file citydlg.cpp.

## ◆ create_actions()

void unit_item::create_actions | ( |  | ) |

private

Initializes context menu

Definition at line 803 of file citydlg.cpp.

Referenced by unit_item().

## ◆ disband

void unit_item::disband | ( |  | ) |

privateslot

Popups MessageBox for disbanding unit and disbands it

Definition at line 881 of file citydlg.cpp.

Referenced by create_actions().

## ◆ enterEvent()

void unit_item::enterEvent | ( | QEnterEvent * | event | ) |

protected

Mouse entered widget

Definition at line 977 of file citydlg.cpp.

## ◆ fortify_unit

void unit_item::fortify_unit | ( |  | ) |

privateslot

Fortifies unit in city dialog

Definition at line 966 of file citydlg.cpp.

Referenced by create_actions().

## ◆ init_pix()

void unit_item::init_pix | ( |  | ) |

Sets pixmap for unit_item class

Definition at line 733 of file citydlg.cpp.

Referenced by leaveEvent(), and city_dialog::update_units().

## ◆ leaveEvent()

void unit_item::leaveEvent | ( | QEvent * | event | ) |

protected

Mouse left widget

Definition at line 998 of file citydlg.cpp.

## ◆ load_unit

void unit_item::load_unit | ( |  | ) |

privateslot

Loads unit into some transport

Definition at line 899 of file citydlg.cpp.

Referenced by create_actions().

## ◆ mousePressEvent()

void unit_item::mousePressEvent | ( | QMouseEvent * | event | ) |

protected

Mouse press event -activates unit and closes dialog

Definition at line 1032 of file citydlg.cpp.

## ◆ sentry_unit

void unit_item::sentry_unit | ( |  | ) |

privateslot

Sentries unit in city dialog

Definition at line 1045 of file citydlg.cpp.

Referenced by create_actions().

## ◆ unload_all

void unit_item::unload_all | ( |  | ) |

privateslot

Unloads all units from transporter

Definition at line 915 of file citydlg.cpp.

Referenced by create_actions().

## ◆ unload_unit

void unit_item::unload_unit | ( |  | ) |

privateslot

Unloads unit

Definition at line 907 of file citydlg.cpp.

Referenced by create_actions().

## ◆ upgrade_unit

void unit_item::upgrade_unit | ( |  | ) |

privateslot

Upgrades unit

Definition at line 923 of file citydlg.cpp.

Referenced by create_actions().

## ◆ wheelEvent()

void unit_item::wheelEvent | ( | QWheelEvent * | event | ) |

protected

Mouse wheel event - send it to scrollbar

Definition at line 1006 of file citydlg.cpp.

## Field Documentation

## ◆ activate

QAction* unit_item::activate

private

Definition at line 146 of file citydlg.h.

Referenced by contextMenuEvent(), and create_actions().

## ◆ activate_and_close

QAction* unit_item::activate_and_close

private

Definition at line 147 of file citydlg.h.

Referenced by contextMenuEvent(), and create_actions().

## ◆ change_home

QAction* unit_item::change_home

private

Definition at line 145 of file citydlg.h.

Referenced by contextMenuEvent(), and create_actions().

## ◆ disband_action

QAction* unit_item::disband_action

private

Definition at line 144 of file citydlg.h.

Referenced by contextMenuEvent(), and create_actions().

## ◆ fortify

QAction* unit_item::fortify

private

Definition at line 149 of file citydlg.h.

Referenced by contextMenuEvent(), and create_actions().

## ◆ happy_cost

int unit_item::happy_cost

private

Definition at line 167 of file citydlg.h.

Referenced by unit_item().

## ◆ load

QAction* unit_item::load

private

Definition at line 150 of file citydlg.h.

Referenced by contextMenuEvent(), and create_actions().

## ◆ qunit

struct unit* unit_item::qunit

private

Definition at line 163 of file citydlg.h.

Referenced by activate_and_close_dialog(), activate_unit(), change_homecity(), contextMenuEvent(), create_actions(), disband(), fortify_unit(), load_unit(), mousePressEvent(), sentry_unit(), unit_item(), unload_all(), unload_unit(), and upgrade_unit().

## ◆ sentry

QAction* unit_item::sentry

private

Definition at line 148 of file citydlg.h.

Referenced by contextMenuEvent(), and create_actions().

## ◆ supported

bool unit_item::supported

private

Definition at line 168 of file citydlg.h.

Referenced by unit_item().

## ◆ unit_img

QImage unit_item::unit_img

private

Definition at line 164 of file citydlg.h.

Referenced by init_pix(), and unit_item().

## ◆ unit_menu

QMenu* unit_item::unit_menu

private

Definition at line 154 of file citydlg.h.

## ◆ unload

QAction* unit_item::unload

private

Definition at line 151 of file citydlg.h.

Referenced by contextMenuEvent(), and create_actions().

## ◆ unload_trans

QAction* unit_item::unload_trans

private

Definition at line 153 of file citydlg.h.

Referenced by contextMenuEvent(), and create_actions().

## ◆ upgrade

QAction* unit_item::upgrade

private

Definition at line 152 of file citydlg.h.

Referenced by contextMenuEvent(), and create_actions().