Commit e273b875 authored by Samikshan Bairagya's avatar Samikshan Bairagya

Display magnitude information for sky objects in details-view

parent 631e95e5
......@@ -233,7 +233,7 @@ Rectangle {
id: nextObjText
objectName: "nextObj"
x: 195
y: 276
y: 359
width: 101
height: 15
color: "#ffffff"
......@@ -253,6 +253,19 @@ Rectangle {
onClicked: nextObjText.nextObjTextClicked()
}
}
Text {
id: magText
objectName: "magTextObj"
x: 102
y: 285
width: 80
height: 15
text: qsTr("text")
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
font.pixelSize: 12
}
}
}
}
......@@ -15,7 +15,6 @@
* *
***************************************************************************/
#include "QDeclarativeContext"
#include "WIView.h"
#include "QGraphicsObject"
#include "skymap.h"
......@@ -29,8 +28,7 @@ WIView::WIView ( QObject *parent) : QObject(parent)
baseView = new QDeclarativeView();
ctxt = baseView->rootContext();
ctxt->setContextProperty("catListModel", QVariant::fromValue(m->returnCatListModel( ModelManager::BaseList )));
//baseListBox = new QDeclarativeView();
//kDebug()<<QUrl::fromLocalFile("Base.qml");
baseView->setSource(QUrl("/home/sam/kstars/kstars/tools/WhatsInteresting/Base.qml"));
baseObj = dynamic_cast<QObject *> (baseView->rootObject());
......@@ -43,24 +41,7 @@ WIView::WIView ( QObject *parent) : QObject(parent)
nextObj = baseObj->findChild<QObject *>("nextObj");
connect(nextObj, SIGNAL(nextObjTextClicked()), this, SLOT(onNextObjTextClicked()));
// planetaryListView->setSource(QUrl::fromLocalFile("WIPlanetaryListView.qml"));
// QObject *planetaryListObj = planetaryListView->rootObject();
// deepSkyListView->setSource(QUrl::fromLocalFile("WIDeepSkyListView.qml"));
// QObject *deepSkyListObj = deepSkyListView->rootObject();
// skyObjListView = new QDeclarativeView();
// skyObjListView->rootContext()->setContextProperty("skyObjModel", m->returnModel(ModelManager::Planets));
// skyObjListView->setSource(QUrl("/home/sam/kstars/kstars/tools/WhatsInteresting/SkyObjListView.qml"));
//
// kDebug()<<skyObjListView->rootContext()->contextProperty("skyObjModel");
//skyObjListView->setParent(baseListBox);
//QObject *skyObjectListObj = dynamic_cast<QObject *> (skyObjListView->rootObject());
//skyObjectListObj->setParent(listBoxObj);
baseView->show();
//skyObjectListObj->setParent(baseObj);
//skyObjectListObj->setProperty("skyObjModel", m->returnModel(2));
}
WIView::~WIView() {}
......@@ -143,9 +124,12 @@ void WIView::loadDetailsView(SkyObjItem* soitem, int index)
QObject* sonameObj = detailsViewObj->findChild<QObject *>("sonameObj");
QObject* posTextObj = detailsViewObj->findChild<QObject *>("posTextObj");
QObject* descTextObj = detailsViewObj->findChild<QObject *>("descTextObj");
QObject* magTextObj = detailsViewObj->findChild<QObject *>("magTextObj");
sonameObj->setProperty("text", soitem->getName());
posTextObj->setProperty("text", soitem->getPosition());
descTextObj->setProperty("text", soitem->getDesc());
magTextObj->setProperty("text", soitem->getMagnitude());
detailsViewObj->setProperty("visible", true);
curSoItem = soitem;
......@@ -157,5 +141,4 @@ void WIView::onNextObjTextClicked()
int modelSize = m->returnModel(curSoItem->getType())->rowCount();
SkyObjItem *nextItem = m->returnModel(curSoItem->getType())->getSkyObjItem((curIndex+1)%modelSize);
loadDetailsView(nextItem, (curIndex+1)%modelSize);
}
}
\ No newline at end of file
......@@ -93,3 +93,10 @@ QString SkyObjItem::getDesc()
return QString("No Description found for selected sky-object");
}
QString SkyObjItem::getMagnitude()
{
QString magtext = "Magnitude : ";
magtext.append(QString::number(so->mag()));
return magtext;
}
......@@ -39,10 +39,11 @@ public:
QHash<int, QByteArray> roleNames() const;
inline QString getName() { return name; }
inline QString getType() { return type; }
void setPosition(SkyObject* so);
inline QString getPosition() { return position; }
inline SkyObject* getSkyObject() { return so; }
QString getDesc();
QString getMagnitude();
void setPosition(SkyObject* so);
private:
QString name;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment