Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

CelListViewItem Class Reference

#include <cellistviewitem.h>

List of all members.

Public Slots

int compare (QListViewItem *i, int col, bool ascending) const

Public Member Functions

 CelListViewItem (QListViewItem *parent, std::string name, double dist, const char *dist_unit, double app_mag, double abs_mag, QString type)
 CelListViewItem (QListView *parent, std::string name, double dist, const char *dist_unit, double app_mag, double abs_mag, QString type)
double getAbsMag () const
double getAppMag () const
double getDist () const
std::string getName () const
 ~CelListViewItem ()

Private Attributes

double abs_mag
double app_mag
double dist
const char * dist_unit
std::string name
QString type


Constructor & Destructor Documentation

CelListViewItem::CelListViewItem QListView *  parent,
std::string  name,
double  dist,
const char *  dist_unit,
double  app_mag,
double  abs_mag,
QString  type
 

Definition at line 215 of file celestialbrowser.cpp.

References ReplaceGreekLetterAbbr().

00216     : QListViewItem(parent),
00217     name(_name),
00218     dist(_dist),
00219     dist_unit(_dist_unit),
00220     app_mag(_app_mag),
00221     abs_mag(_abs_mag),
00222     type(_type)
00223 {
00224     char buf[20];
00225     QString label;
00226     this->setText(0, QString::fromUtf8(ReplaceGreekLetterAbbr(_name).c_str()));
00227 
00228     sprintf(buf, " %.2f %s", _dist, _dist_unit);
00229     label = buf;
00230     this->setText(1, label);
00231 
00232     if (_app_mag != 0) {
00233         sprintf(buf, " %.2f ", _app_mag);
00234         label = buf;
00235         this->setText(2, label);
00236     }
00237 
00238     if (_abs_mag != 0) {
00239         sprintf(buf, " %.2f ", _abs_mag);
00240         label = buf;
00241         this->setText(3, label);
00242     }
00243 
00244     this->setText(4, _type);
00245 }

CelListViewItem::CelListViewItem QListViewItem *  parent,
std::string  name,
double  dist,
const char *  dist_unit,
double  app_mag,
double  abs_mag,
QString  type
 

Definition at line 247 of file celestialbrowser.cpp.

References ReplaceGreekLetterAbbr().

00248     : QListViewItem(parent),
00249     name(_name),
00250     dist(_dist),
00251     dist_unit(_dist_unit),
00252     app_mag(_app_mag),
00253     abs_mag(_abs_mag),
00254     type(_type)
00255 {
00256     char buf[20];
00257     QString label;
00258 
00259     this->setText(0, QString::fromUtf8(ReplaceGreekLetterAbbr(_name).c_str()));
00260 
00261     sprintf(buf, " %.2f %s", _dist, _dist_unit);
00262     label = buf;
00263     this->setText(1, label);
00264 
00265     if (_app_mag != 0) {
00266         sprintf(buf, " %.2f ", _app_mag);
00267         label = buf;
00268         this->setText(2, label);
00269     }
00270 
00271     if (_abs_mag != 0) {
00272         sprintf(buf, " %.2f ", _abs_mag);
00273         label = buf;
00274         this->setText(3, label);
00275     }
00276 
00277     this->setText(4, _type);
00278 }

CelListViewItem::~CelListViewItem  ) 
 

Definition at line 280 of file celestialbrowser.cpp.

00280                                   {
00281 
00282 }


Member Function Documentation

int CelListViewItem::compare QListViewItem *  i,
int  col,
bool  ascending
const [slot]
 

Definition at line 284 of file celestialbrowser.cpp.

References abs_mag, app_mag, dist, getAbsMag(), getAppMag(), and getDist().

00284                                                                                 {
00285     if (col == 0 || col > 3) {
00286         return key(col, ascending).localeAwareCompare(i->key(col, ascending));
00287     } else {
00288         if (col == 1) return (dist > dynamic_cast<CelListViewItem*>(i)->getDist()) * 2 - 1;
00289         if (col == 2) return (app_mag > dynamic_cast<CelListViewItem*>(i)->getAppMag()) * 2 - 1;
00290         if (col == 3) return (abs_mag > dynamic_cast<CelListViewItem*>(i)->getAbsMag()) * 2 - 1;
00291     }
00292 }

double CelListViewItem::getAbsMag  )  const [inline]
 

Definition at line 16 of file cellistviewitem.h.

Referenced by compare().

00016 { return abs_mag; }

double CelListViewItem::getAppMag  )  const [inline]
 

Definition at line 15 of file cellistviewitem.h.

Referenced by compare().

00015 { return app_mag; }

double CelListViewItem::getDist  )  const [inline]
 

Definition at line 14 of file cellistviewitem.h.

Referenced by compare().

00014 { return dist; }

std::string CelListViewItem::getName  )  const [inline]
 

Definition at line 12 of file cellistviewitem.h.

Referenced by CelestialBrowser::slotRightClickOnStar().

00012 { return name; }


Member Data Documentation

double CelListViewItem::abs_mag [private]
 

Definition at line 26 of file cellistviewitem.h.

Referenced by compare().

double CelListViewItem::app_mag [private]
 

Definition at line 25 of file cellistviewitem.h.

Referenced by compare().

double CelListViewItem::dist [private]
 

Definition at line 23 of file cellistviewitem.h.

Referenced by compare().

const char* CelListViewItem::dist_unit [private]
 

Definition at line 24 of file cellistviewitem.h.

std::string CelListViewItem::name [private]
 

Definition at line 22 of file cellistviewitem.h.

QString CelListViewItem::type [private]
 

Definition at line 27 of file cellistviewitem.h.


The documentation for this class was generated from the following files:
Generated on Sat Jan 14 22:33:10 2006 for Celestia by  doxygen 1.4.1