Permalink
Browse files

Added interrogation icon to get station information

  • Loading branch information...
1 parent e64a8e4 commit ba35c549ac72823dc7596a9895f2f796aba04d55 @gnuvince committed Apr 25, 2011
Showing with 88 additions and 6 deletions.
  1. BIN data/icons/help.png
  2. +1 −0 icones.qrc
  3. +13 −0 pages/selectstationpage.cpp
  4. +1 −0 pages/selectstationpage.h
  5. +62 −2 qrc_icones.cpp
  6. +2 −1 station.cpp
  7. +1 −1 station.h
  8. +6 −1 stationmodel.cpp
  9. +2 −1 stationsortproxy.cpp
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -11,5 +11,6 @@
<file>data/icons/arrow_left.png</file>
<file>data/icons/arrow_right.png</file>
<file>data/icons/tick.png</file>
+ <file>data/icons/help.png</file>
</qresource>
</RCC>
@@ -1,3 +1,5 @@
+#include <QMessageBox>
+
#include "selectstationpage.h"
#include "page.h"
#include "stationsortproxy.h"
@@ -17,8 +19,11 @@ SelectStationPage::SelectStationPage(
view->setSelectionMode(QAbstractItemView::SingleSelection);
view->verticalHeader()->hide();
view->resizeColumnToContents(1);
+ view->resizeColumnToContents(2);
view->resizeRowsToContents();
+ connect(view, SIGNAL(clicked(QModelIndex)), this, SLOT(showInformation(QModelIndex)));
+
QFont font = view->font();
font.setPointSize(8);
view->setFont(font);
@@ -44,3 +49,11 @@ void SelectStationPage::stationSelected(QModelIndex index) {
btnNext->setEnabled(true);
}
+
+void SelectStationPage::showInformation(QModelIndex index) {
+ if (index.column() == 2) {
+ QModelIndex index2 = index.model()->index(index.row(), 0);
+ QString stationName = index2.data().toString();
+ QMessageBox::information(this, tr("Info"), stationName, 0);
+ }
+}
@@ -19,6 +19,7 @@ class SelectStationPage : public Page
public slots:
void stationSelected(QModelIndex index);
+ void showInformation(QModelIndex index);
private:
StationSortProxy *stationModel;
View
@@ -1,7 +1,7 @@
/****************************************************************************
** Resource object code
**
-** Created: Thu Apr 21 20:15:49 2011
+** Created: Mon Apr 25 11:17:40 2011
** by: The Resource Compiler for Qt version 4.7.2
**
** WARNING! All changes made in this file will be lost!
@@ -961,6 +961,59 @@ static const unsigned char qt_resource_data[] = {
0x78,0x10,0xc7,0x83,0x38,0x3e,0xc4,0xf5,0x21,0x9e,0x40,0x7d,0x81,0xfa,0xf2,0xd6,
0x58,0xef,0x3b,0xff,0x2,0x94,0x4c,0x63,0xd9,0xa7,0xb9,0x53,0x2f,0x0,0x0,0x0,
0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82,
+ // /home/vince/universite/H11/IFT2905/Projet/data/icons/help.png
+ 0x0,0x0,0x3,0x12,
+ 0x89,
+ 0x50,0x4e,0x47,0xd,0xa,0x1a,0xa,0x0,0x0,0x0,0xd,0x49,0x48,0x44,0x52,0x0,
+ 0x0,0x0,0x10,0x0,0x0,0x0,0x10,0x8,0x6,0x0,0x0,0x0,0x1f,0xf3,0xff,0x61,
+ 0x0,0x0,0x0,0x4,0x67,0x41,0x4d,0x41,0x0,0x0,0xaf,0xc8,0x37,0x5,0x8a,0xe9,
+ 0x0,0x0,0x0,0x19,0x74,0x45,0x58,0x74,0x53,0x6f,0x66,0x74,0x77,0x61,0x72,0x65,
+ 0x0,0x41,0x64,0x6f,0x62,0x65,0x20,0x49,0x6d,0x61,0x67,0x65,0x52,0x65,0x61,0x64,
+ 0x79,0x71,0xc9,0x65,0x3c,0x0,0x0,0x2,0xa4,0x49,0x44,0x41,0x54,0x38,0xcb,0xa5,
+ 0x93,0xdd,0x4f,0x92,0x61,0x18,0xc6,0xfd,0x5b,0xe0,0x4f,0x68,0xad,0xe6,0x6a,0xd5,
+ 0x6a,0x9d,0xd5,0xd6,0x38,0xe8,0xa0,0x3,0xa7,0xe6,0x27,0xd0,0xd4,0x72,0xb5,0xc,
+ 0x96,0xb3,0x74,0x98,0xd3,0x2c,0x29,0x35,0x33,0x9d,0xa,0x6a,0xea,0x9c,0x8a,0x2,
+ 0x6f,0x2,0x22,0x88,0x26,0xca,0x97,0x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f,0x34,0x93,0xa1,0x50,0x24,0x3,0xb1,
+ 0xea,0x83,0x84,0xa9,0x73,0xab,0x66,0xe2,0xf8,0x13,0xf9,0xe2,0x5,0x56,0xf9,0x9b,
+ 0xf9,0xe0,0x92,0x33,0x2,0xe5,0x8a,0x1f,0xdc,0x36,0xd,0xa,0x9a,0x94,0x68,0x1b,
+ 0x37,0x65,0xf8,0x15,0xce,0x6f,0x98,0xc0,0xb0,0xc6,0xd,0x8d,0x25,0x80,0x9b,0xd5,
+ 0x63,0xc1,0xeb,0xf,0x47,0x59,0x27,0x16,0x29,0x4f,0x34,0xcb,0xb9,0xd7,0x40,0xa4,
+ 0x74,0xf6,0x6d,0xa8,0xad,0x41,0xbc,0x94,0x2c,0xa1,0xa4,0x59,0x8e,0xa2,0xc6,0x69,
+ 0x3c,0xef,0xd5,0x43,0x69,0xf4,0x42,0x65,0xf6,0xe3,0x6a,0xc5,0xe7,0xd4,0xe5,0x7,
+ 0x43,0x9c,0x53,0x57,0xf9,0x8e,0x50,0xc6,0xb9,0xfd,0x6c,0x32,0xd4,0x47,0xac,0xe3,
+ 0xab,0x3b,0xc,0x8b,0x37,0x96,0x61,0xd1,0xb9,0x83,0x2e,0x99,0xd,0xb9,0x3c,0x69,
+ 0xe8,0x62,0xb9,0x84,0x73,0xe6,0x31,0xdd,0x78,0x34,0xca,0xbe,0x56,0x35,0x22,0xb8,
+ 0x52,0x31,0x4c,0x5e,0xe2,0xf,0x52,0xb9,0x5c,0x29,0x75,0xa1,0x6c,0x80,0x3c,0x5f,
+ 0xda,0x2f,0x38,0x57,0xdc,0xc7,0xfe,0xeb,0x35,0xfe,0x2b,0x3f,0x1,0xd7,0xaf,0x5,
+ 0xa2,0xbd,0x4d,0xbd,0xc4,0x0,0x0,0x0,0x0,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,
+ 0x82,
};
@@ -1041,6 +1094,11 @@ static const unsigned char qt_resource_name[] = {
0x9,0x65,0x8e,0x67,
0x0,0x65,
0x0,0x72,0x0,0x72,0x0,0x6f,0x0,0x72,0x0,0x2e,0x0,0x70,0x0,0x6e,0x0,0x67,
+ // help.png
+ 0x0,0x8,
+ 0xc,0x33,0x5a,0x87,
+ 0x0,0x68,
+ 0x0,0x65,0x0,0x6c,0x0,0x70,0x0,0x2e,0x0,0x70,0x0,0x6e,0x0,0x67,
};
@@ -1052,7 +1110,7 @@ static const unsigned char qt_resource_struct[] = {
// :/icones/data
0x0,0x0,0x0,0x12,0x0,0x2,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x3,
// :/icones/data/icons
- 0x0,0x0,0x0,0x20,0x0,0x2,0x0,0x0,0x0,0x8,0x0,0x0,0x0,0x9,
+ 0x0,0x0,0x0,0x20,0x0,0x2,0x0,0x0,0x0,0x9,0x0,0x0,0x0,0x9,
// :/icones/data/images
0x0,0x0,0x0,0x30,0x0,0x2,0x0,0x0,0x0,0x1,0x0,0x0,0x0,0x5,
// :/icones/data/images/icons
@@ -1073,6 +1131,8 @@ static const unsigned char qt_resource_struct[] = {
0x0,0x0,0x1,0x66,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x36,0x90,
// :/icones/data/icons/pencil.png
0x0,0x0,0x1,0x4c,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x34,0xca,
+ // :/icones/data/icons/help.png
+ 0x0,0x0,0x1,0x7e,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x39,0x2e,
// :/icones/data/icons/table_multiple.png
0x0,0x0,0x0,0xea,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x2e,0xe8,
// :/icones/data/icons/arrow_right.png
View
@@ -36,7 +36,8 @@ QStringList& Station::headers() {
trUtf8("position") <<
trUtf8("photo") <<
trUtf8("carte") <<
- trUtf8("Distance");
+ trUtf8("Distance") <<
+ trUtf8("Information");
return _headers;
}
View
@@ -32,7 +32,7 @@ class Station : public QObject
{
Q_OBJECT
public:
- enum Colonnes { COL_ID, COL_NOM, COL_DESCR, COL_COFF, COL_POS, COL_PHOTO, COL_CARTE, COL_DIST };
+ enum Colonnes { COL_ID, COL_NOM, COL_DESCR, COL_COFF, COL_POS, COL_PHOTO, COL_CARTE, COL_DIST, COL_INFO };
public:
explicit Station(uint id, QString nom, QString description, QString coffret, GeoPosition position, QPixmap stationImage, QPixmap mapImage, QObject *parent = 0);
View
@@ -22,6 +22,7 @@
#include "geoposition.h"
#include "station.h"
#include <QDebug>
+#include <QPixmap>
StationModel::StationModel(QObject *parent) :
QAbstractTableModel(parent)
@@ -38,7 +39,11 @@ QVariant StationModel::fieldAt(const QModelIndex &index, int role) const
if (column == Station::COL_DIST && role == Qt::DisplayRole) {
qreal distance = s->getPosition().distanceFrom(currentPosition);
- return QVariant(QString("%1 km").arg(distance, 0, 'f', 2));
+ return QString("%1 km").arg(distance, 0, 'f', 2);
+ }
+ if (column == Station::COL_INFO && role == Qt::DecorationRole) {
+ QPixmap pix(":/icones/data/icons/help.png");
+ return pix;
}
return s->field(column, role);
@@ -10,7 +10,8 @@ StationSortProxy::StationSortProxy(QObject *parent) :
bool StationSortProxy::filterAcceptsColumn(int source_column, const QModelIndex &source_parent) const {
return source_column == Station::COL_NOM
- || source_column == Station::COL_DIST;
+ || source_column == Station::COL_DIST
+ || source_column == Station::COL_INFO;
}
bool StationSortProxy::lessThan(const QModelIndex &left, const QModelIndex &right) const {

0 comments on commit ba35c54

Please sign in to comment.