Freeciv-3.3
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Slots | Private Member Functions | Private Attributes
minimap_view Class Reference

#include <mapview.h>

+ Inheritance diagram for minimap_view:

Public Member Functions

 minimap_view (QWidget *parent)
 
 ~minimap_view ()
 
void paint (QPainter *painter, QPaintEvent *event)
 
virtual void update_menu ()
 
void update_image ()
 
void reset ()
 

Protected Member Functions

void paintEvent (QPaintEvent *event)
 
void resizeEvent (QResizeEvent *event)
 
void mousePressEvent (QMouseEvent *event)
 
void mouseMoveEvent (QMouseEvent *event)
 
void mouseReleaseEvent (QMouseEvent *event)
 
void wheelEvent (QWheelEvent *event)
 
void moveEvent (QMoveEvent *event)
 
void showEvent (QShowEvent *event)
 

Private Slots

void update_pixmap (const QImage &image)
 
void zoom_in ()
 
void zoom_out ()
 

Private Member Functions

void draw_viewport (QPainter *painter)
 
void scale (double factor)
 
void scale_point (int &x, int &y)
 

Private Attributes

double scale_factor
 
float w_ratio
 
float h_ratio
 
minimap_thread thread
 
QBrush background
 
QPixmappix
 
QPoint cursor
 
QPoint position
 
resize_widgetrw
 

Additional Inherited Members

- Data Fields inherited from fcwidget
bool was_destroyed
 

Detailed Description

Definition at line 218 of file mapview.h.

Constructor & Destructor Documentation

◆ minimap_view()

minimap_view::minimap_view ( QWidget *  parent)

Constructor for minimap

Definition at line 535 of file mapview.cpp.

◆ ~minimap_view()

minimap_view::~minimap_view ( )

Minimap_view destructor

Definition at line 556 of file mapview.cpp.

Member Function Documentation

◆ draw_viewport()

void minimap_view::draw_viewport ( QPainter painter)
private

Draws viewport on minimap

Definition at line 659 of file mapview.cpp.

Referenced by paint().

◆ mouseMoveEvent()

void minimap_view::mouseMoveEvent ( QMouseEvent event)
protected

Called when mouse button was pressed. Used to moving minimap.

Definition at line 956 of file mapview.cpp.

◆ mousePressEvent()

void minimap_view::mousePressEvent ( QMouseEvent event)
protected

Mouse Handler for minimap_view Left button - moves minimap Right button - recenters on some point For wheel look mouseWheelEvent

Definition at line 920 of file mapview.cpp.

◆ mouseReleaseEvent()

void minimap_view::mouseReleaseEvent ( QMouseEvent event)
protected

Called when mouse button unpressed. Restores cursor.

Definition at line 979 of file mapview.cpp.

◆ moveEvent()

void minimap_view::moveEvent ( QMoveEvent event)
protected

Minimap is being moved, position is being remembered

Definition at line 642 of file mapview.cpp.

◆ paint()

void minimap_view::paint ( QPainter painter,
QPaintEvent event 
)

Redraws visible map using stored pixmap

Definition at line 840 of file mapview.cpp.

Referenced by paintEvent().

◆ paintEvent()

void minimap_view::paintEvent ( QPaintEvent event)
protected

Paint event for minimap

Definition at line 566 of file mapview.cpp.

◆ reset()

void minimap_view::reset ( )

Sets minimap scale to default

Definition at line 731 of file mapview.cpp.

Referenced by fc_client::switch_page().

◆ resizeEvent()

void minimap_view::resizeEvent ( QResizeEvent event)
protected

Called when minimap has been resized

Definition at line 866 of file mapview.cpp.

◆ scale()

void minimap_view::scale ( double  factor)
private

Sets scaling factor for minimap

Definition at line 578 of file mapview.cpp.

◆ scale_point()

void minimap_view::scale_point ( int x,
int y 
)
private

Scales point from real overview coords to scaled overview coords.

Definition at line 695 of file mapview.cpp.

Referenced by draw_viewport().

◆ showEvent()

void minimap_view::showEvent ( QShowEvent event)
protected

Minimap is just unhidden, old position is restored

Definition at line 650 of file mapview.cpp.

◆ update_image()

void minimap_view::update_image ( )

Updates minimap's pixmap

Definition at line 829 of file mapview.cpp.

Referenced by mousePressEvent(), resizeEvent(), and scale().

◆ update_menu()

void minimap_view::update_menu ( )
virtual

Called by close widget, cause widget has been hidden. Updates menu.

Implements fcwidget.

Definition at line 634 of file mapview.cpp.

◆ update_pixmap

void minimap_view::update_pixmap ( const QImage image)
privateslot

Slot for updating pixmap from thread's image

Definition at line 739 of file mapview.cpp.

Referenced by minimap_view().

◆ wheelEvent()

void minimap_view::wheelEvent ( QWheelEvent event)
protected

Wheel event for minimap - zooms it in or out

Definition at line 886 of file mapview.cpp.

◆ zoom_in

void minimap_view::zoom_in ( )
privateslot

Sets scale factor to scale minimap 20% up

Definition at line 899 of file mapview.cpp.

Referenced by wheelEvent().

◆ zoom_out

void minimap_view::zoom_out ( )
privateslot

Sets scale factor to scale minimap 20% down

Definition at line 909 of file mapview.cpp.

Referenced by wheelEvent().

Field Documentation

◆ background

QBrush minimap_view::background
private

Definition at line 251 of file mapview.h.

Referenced by minimap_view().

◆ cursor

QPoint minimap_view::cursor
private

Definition at line 253 of file mapview.h.

Referenced by mouseMoveEvent(), and mousePressEvent().

◆ h_ratio

float minimap_view::h_ratio
private

Definition at line 249 of file mapview.h.

Referenced by draw_viewport(), minimap_view(), mousePressEvent(), paint(), and resizeEvent().

◆ pix

QPixmap* minimap_view::pix
private

Definition at line 252 of file mapview.h.

Referenced by minimap_view(), paint(), update_pixmap(), and ~minimap_view().

◆ position

QPoint minimap_view::position
private

Definition at line 254 of file mapview.h.

Referenced by moveEvent(), and showEvent().

◆ rw

resize_widget* minimap_view::rw
private

Definition at line 255 of file mapview.h.

Referenced by minimap_view(), and paint().

◆ scale_factor

double minimap_view::scale_factor
private

◆ thread

minimap_thread minimap_view::thread
private

Definition at line 250 of file mapview.h.

Referenced by minimap_view(), and update_image().

◆ w_ratio

float minimap_view::w_ratio
private

Definition at line 249 of file mapview.h.

Referenced by draw_viewport(), minimap_view(), mousePressEvent(), paint(), and resizeEvent().