Freeciv-3.1: units_select Class Reference

Freeciv-3.1

Loading...
Searching...
No Matches
Public Member Functions | Data Fields | Protected Member Functions | Private Slots | Private Attributes
units_select Class Reference

`#include <dialogs.h>`

Inheritance diagram for units_select:

## Public Member Functions

| units_select (struct tile *ptile, QWidget *parent)
| ~units_select ()
void | update_menu ()
void | update_units ()
void | create_pixmap ()

## Data Fields

tile * | utile
Data Fields inherited from fcwidget
bool | was_destroyed

## Protected Member Functions

void | paint (QPainter *painter, QPaintEvent *event)
void | paintEvent (QPaintEvent *event)
void | mousePressEvent (QMouseEvent *event)
void | keyPressEvent (QKeyEvent *event)
void | mouseMoveEvent (QMouseEvent *event)
void | wheelEvent (QWheelEvent *event)
void | closeEvent (QCloseEvent *event)

## Private Slots

void | update_img ()

## Private Attributes

QPixmap * | pix
QPixmap * | h_pix
QSize | item_size
QList< unit * > | unit_list
QFont | ufont
QFont | info_font
int | row_count
close_widget * | cw
bool | more
int | show_line
int | highligh_num
int | unit_count

## Detailed Description

Definition at line 202 of file dialogs.h.

## Constructor & Destructor Documentation

## ◆ units_select()

units_select::units_select | ( | struct tile * | ptile,
|  | QWidget * | parent
| ) |  |

Contructor for units_select

Definition at line 4308 of file dialogs.cpp.

## ◆ ~units_select()

units_select::~units_select | ( |  | ) |

Destructor for unit select

Definition at line 4343 of file dialogs.cpp.

## Member Function Documentation

## ◆ closeEvent()

void units_select::closeEvent | ( | QCloseEvent * | event | ) |

protected

Close event for units_select, restores focus to map

Definition at line 4686 of file dialogs.cpp.

## ◆ create_pixmap()

void units_select::create_pixmap | ( |  | ) |

Create pixmap of whole widget except borders (pix)

Definition at line 4353 of file dialogs.cpp.

Referenced by mouseMoveEvent(), units_select(), update_img(), fc_client::update_unit_sel(), and wheelEvent().

## ◆ keyPressEvent()

void units_select::keyPressEvent | ( | QKeyEvent * | event | ) |

protected

Keyboard handler for units_select

Definition at line 4719 of file dialogs.cpp.

## ◆ mouseMoveEvent()

void units_select::mouseMoveEvent | ( | QMouseEvent * | event | ) |

protected

Event for mouse moving around units_select

Definition at line 4488 of file dialogs.cpp.

## ◆ mousePressEvent()

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

protected

Mouse pressed event for units_select. Left Button - chooses units Right Button - closes widget

Definition at line 4519 of file dialogs.cpp.

## ◆ paint()

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

protected

Redirected paint event

Definition at line 4553 of file dialogs.cpp.

Referenced by paintEvent().

## ◆ paintEvent()

void units_select::paintEvent | ( | QPaintEvent * | event | ) |

protected

Paint event, redirects to paint(...)

Definition at line 4631 of file dialogs.cpp.

## ◆ update_img

void units_select::update_img | ( |  | ) |

privateslot

Update image, because in constructor theme colors are uninitialized in QPainter

Definition at line 4544 of file dialogs.cpp.

Referenced by units_select().

## ◆ update_menu()

void units_select::update_menu | ( |  | ) |

virtual

Function from abstract fcwidget to update menu, its not needed cause widget is easy closable via right mouse click

Implements fcwidget.

Definition at line 4644 of file dialogs.cpp.

## ◆ update_units()

void units_select::update_units | ( |  | ) |

Updates unit list on tile

Definition at line 4654 of file dialogs.cpp.

Referenced by create_pixmap(), mousePressEvent(), qtg_real_focus_units_changed(), units_select(), fc_client::update_unit_sel(), and wheelEvent().

## ◆ wheelEvent()

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

protected

Mouse wheel event for units_select

Definition at line 4695 of file dialogs.cpp.

## Field Documentation

## ◆ cw

close_widget* units_select::cw

private

Definition at line 213 of file dialogs.h.

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

## ◆ h_pix

QPixmap* units_select::h_pix

private

Definition at line 206 of file dialogs.h.

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

## ◆ highligh_num

int units_select::highligh_num

private

Definition at line 234 of file dialogs.h.

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

## ◆ info_font

QFont units_select::info_font

private

Definition at line 211 of file dialogs.h.

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

## ◆ item_size

QSize units_select::item_size

private

pixmap for highlighting

Definition at line 207 of file dialogs.h.

Referenced by create_pixmap(), and mouseMoveEvent().

## ◆ more

bool units_select::more

private

Definition at line 232 of file dialogs.h.

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

## ◆ pix

QPixmap* units_select::pix

private

Definition at line 205 of file dialogs.h.

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

## ◆ row_count

int units_select::row_count

private

Definition at line 212 of file dialogs.h.

Referenced by create_pixmap(), and mouseMoveEvent().

## ◆ show_line

int units_select::show_line

private

Definition at line 233 of file dialogs.h.

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

## ◆ ufont

QFont units_select::ufont

private

storing units only for drawing, for rest units iterate utile->units

Definition at line 210 of file dialogs.h.

Referenced by create_pixmap(), and units_select().

## ◆ unit_count

int units_select::unit_count

private

Definition at line 235 of file dialogs.h.

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

## ◆ unit_list

QList<unit*> units_select::unit_list

private

size of each pixmap of unit

Definition at line 208 of file dialogs.h.

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

## ◆ utile

tile* units_select::utile

Definition at line 220 of file dialogs.h.

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