26 #include <QFontDatabase> 27 #include <QHeaderView> 28 #include <QSizePolicy> 29 #include <QStandardItem> 30 #include <QStandardItemModel> 32 #include <QStringList> 35 #include <QTextStream> 36 #include <QVBoxLayout> 49 if (fileItem->fileName().contains(
".csv")) {
52 else if (fileItem->fileName().contains(
".txt")) {
66 if (!QFile::exists(fileItem->fileName())) {
70 QFile file(fileItem->fileName());
71 if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
75 int numHeaderLines = 3;
76 if (fileItem->fileName().contains(
"images")) {
80 QTextStream in(&file);
90 header1 = in.readLine();
91 lineToken1 = header1.split(
",");
92 header2 = in.readLine();
93 lineToken2 = header2.split(
",");
95 if (numHeaderLines == 2) {
96 for (
int i = 0; i < lineToken1.size(); i++) {
97 QString t1 = lineToken1.at(i);
98 QString t2 = lineToken2.at(i);
99 QString head = t1 +
"\n" + t2;
101 model->setHorizontalHeaderItem(i,v1);
104 if (numHeaderLines == 3) {
105 header3 = in.readLine();
106 lineToken3 = header3.split(
",");
108 lineToken1.append(
"");
109 lineToken2.append(
"");
111 for (
int i = 0; i < lineToken3.size(); i++) {
112 QString t1 = lineToken1.at(i);
113 QString t2 = lineToken2.at(i);
114 QString t3 = lineToken3.at(i);
115 QString head = t1 +
"\n" + t2 +
"\n" + t3;
117 model->setHorizontalHeaderItem(i,v1);
123 while (!in.atEnd()) {
124 QString fileLine = in.readLine();
127 QStringList lineToken = fileLine.split(
",", QString::SkipEmptyParts);
129 bool rejected =
false;
130 if (lineToken.at(lineToken.size()-1) ==
"*") {
135 for (
int i = 0; i < lineToken.size(); i++) {
136 QString value = lineToken.at(i);
141 item->setData(QColor(200,0,0), Qt::BackgroundRole);
151 QTableView *qtable=
new QTableView();
152 qtable->setModel(
model);
153 qtable->setSortingEnabled(
true);
157 qtable->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
159 setCentralWidget(qtable);
161 QSizePolicy policy = sizePolicy();
162 policy.setHorizontalPolicy(QSizePolicy::Expanding);
163 policy.setVerticalPolicy(QSizePolicy::Expanding);
164 setSizePolicy(policy);
175 if (!QFile::exists(fileItem->fileName())) {
179 QFile file(fileItem->fileName());
180 if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
184 QTextStream in(&file);
185 QTextEdit *qText=
new QTextEdit();
190 const QFont fixedFont = QFontDatabase::systemFont(QFontDatabase::FixedFont);
191 qText->setFontFamily(fixedFont.family());
193 while (!in.atEnd()) {
194 qText->append(in.readLine());
199 setCentralWidget(qText);
200 qText->moveCursor(QTextCursor::Start);
202 QSizePolicy policy = sizePolicy();
203 policy.setHorizontalPolicy(QSizePolicy::Expanding);
204 policy.setVerticalPolicy(QSizePolicy::Expanding);
205 setSizePolicy(policy);
void displayTextFile(FileItemQsp fileItem)
Creates a view showing a text file from BundleSolutionInfo.
void displayCsvFile(FileItemQsp fileItem)
Creates a view showing the CSV file from BundleSolutionInfo.
AbstractProjectItemView is a base class for views of a ProjectItemModel in Qt's model-view framework...
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
BundleObservationView(FileItemQsp fileItem, QWidget *parent=0)
Creates a view showing the CSV or text files from BundleSolutionInfo.
~BundleObservationView()
Destructor.
void setItem(int row, ProjectItem *item)
Sets the item at the top-level row.
Namespace for ISIS/Bullet specific routines.
virtual ProjectItemModel * model()
Returns the model used by the view.