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

#include <view_research.h>

+ Inheritance diagram for research_diagram:
+ Collaboration diagram for research_diagram:

Public Member Functions

 research_diagram (QWidget *parent=0)
 Constructor for research diagram. More...
 
 ~research_diagram () override
 Destructor for research diagram. More...
 
void update_reqtree ()
 Recreates whole diagram and schedules update. More...
 
void reset ()
 Initializes research diagram. More...
 
QSize size ()
 Returns size of research_diagram. More...
 
bool get_tech_position (Tech_type_id id, int *x, int *y)
 Find the center of a node, identified by tech id, and return true if the node was found; false otherwise. More...
 

Private Slots

void show_tooltip ()
 Slot for timer used to show tooltip. More...
 

Private Member Functions

void mousePressEvent (QMouseEvent *event) override
 Mouse handler for research_diagram. More...
 
void mouseMoveEvent (QMouseEvent *event) override
 Mouse move handler for research_diagram - for showing tooltips. More...
 
void paintEvent (QPaintEvent *event) override
 Paint event for research_diagram. More...
 

Private Attributes

QPixmap * pcanvas
 
struct reqtreereq
 
bool timer_active
 
int width
 
int height
 
QList< req_tooltip_help * > * tt_help {nullptr}
 
QPoint tooltip_pos
 
QString tooltip_text
 
QRect tooltip_rect
 

Detailed Description

Definition at line 32 of file view_research.h.

Constructor & Destructor Documentation

◆ research_diagram()

research_diagram::research_diagram ( QWidget *  parent = 0)

Constructor for research diagram.

Definition at line 66 of file view_research.cpp.

◆ ~research_diagram()

research_diagram::~research_diagram ( )
override

Destructor for research diagram.

Definition at line 78 of file view_research.cpp.

Member Function Documentation

◆ get_tech_position()

bool research_diagram::get_tech_position ( Tech_type_id  id,
int *  x,
int *  y 
)

Find the center of a node, identified by tech id, and return true if the node was found; false otherwise.

If a node is found, x and y are filled with the center of the node.

Definition at line 119 of file view_research.cpp.

Referenced by science_report::scroll_reqtree_to_tech().

◆ mouseMoveEvent()

void research_diagram::mouseMoveEvent ( QMouseEvent *  event)
overrideprivate

Mouse move handler for research_diagram - for showing tooltips.

Definition at line 174 of file view_research.cpp.

◆ mousePressEvent()

void research_diagram::mousePressEvent ( QMouseEvent *  event)
overrideprivate

Mouse handler for research_diagram.

Definition at line 127 of file view_research.cpp.

◆ paintEvent()

void research_diagram::paintEvent ( QPaintEvent *  event)
overrideprivate

Paint event for research_diagram.

Definition at line 251 of file view_research.cpp.

◆ reset()

void research_diagram::reset ( )

Initializes research diagram.

Definition at line 99 of file view_research.cpp.

Referenced by research_diagram(), science_report::reset_tree(), science_report::update_report(), and update_reqtree().

◆ show_tooltip

void research_diagram::show_tooltip ( )
privateslot

Slot for timer used to show tooltip.

Definition at line 236 of file view_research.cpp.

Referenced by mouseMoveEvent().

◆ size()

QSize research_diagram::size ( )

Returns size of research_diagram.

Definition at line 264 of file view_research.cpp.

Referenced by science_report::reset_tree(), and science_report::science_report().

◆ update_reqtree()

void research_diagram::update_reqtree ( )

Recreates whole diagram and schedules update.

Definition at line 88 of file view_research.cpp.

Referenced by science_report::update_reqtree().

Member Data Documentation

◆ height

int research_diagram::height
private

Definition at line 53 of file view_research.h.

Referenced by paintEvent(), reset(), size(), and update_reqtree().

◆ pcanvas

QPixmap* research_diagram::pcanvas
private

◆ req

struct reqtree* research_diagram::req
private

◆ timer_active

bool research_diagram::timer_active
private

Definition at line 51 of file view_research.h.

Referenced by mouseMoveEvent(), reset(), and show_tooltip().

◆ tooltip_pos

QPoint research_diagram::tooltip_pos
private

Definition at line 55 of file view_research.h.

Referenced by mouseMoveEvent(), and show_tooltip().

◆ tooltip_rect

QRect research_diagram::tooltip_rect
private

Definition at line 57 of file view_research.h.

Referenced by mouseMoveEvent(), and show_tooltip().

◆ tooltip_text

QString research_diagram::tooltip_text
private

Definition at line 56 of file view_research.h.

Referenced by mouseMoveEvent(), and show_tooltip().

◆ tt_help

QList<req_tooltip_help *>* research_diagram::tt_help {nullptr}
private

Definition at line 54 of file view_research.h.

Referenced by mouseMoveEvent(), mousePressEvent(), update_reqtree(), and ~research_diagram().

◆ width

int research_diagram::width
private

Definition at line 52 of file view_research.h.

Referenced by paintEvent(), reset(), size(), and update_reqtree().