Huggle  build:^490^dce1e5c
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
scorewordsdbform.cpp
1 //This program is free software: you can redistribute it and/or modify
2 //it under the terms of the GNU General Public License as published by
3 //the Free Software Foundation, either version 3 of the License, or
4 //(at your option) any later version.
5 
6 //This program is distributed in the hope that it will be useful,
7 //but WITHOUT ANY WARRANTY; without even the implied warranty of
8 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 //GNU General Public License for more details.
10 
11 #include "scorewordsdbform.hpp"
12 #include "ui_scorewordsdbform.h"
13 using namespace Huggle;
14 
15 ScoreWordsDbForm::ScoreWordsDbForm(QWidget *parent) : QDialog(parent), ui(new Ui::ScoreWordsDbForm)
16 {
17  ui->setupUi(this);
18  ui->tableWidget->setColumnCount(2);
19  QStringList header;
20  header << "Score" << "Word";
21  ui->tableWidget->setHorizontalHeaderLabels(header);
22  ui->tableWidget->verticalHeader()->setVisible(false);
23  ui->tableWidget->horizontalHeader()->setSelectionBehavior(QAbstractItemView::SelectRows);
24  ui->tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
25 #if QT_VERSION >= 0x050000
26 // Qt5 code
27  ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
28 #else
29 // Qt4 code
30  ui->tableWidget->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
31 #endif
32  ui->tableWidget->setShowGrid(false);
33  int x = 0;
34  while (x < Configuration::LocalConfig_ScoreWords.count())
35  {
36  ScoreWord word = Configuration::LocalConfig_ScoreWords.at(x);
37  ui->tableWidget->insertRow(x);
38  ui->tableWidget->setItem(x, 0, new QTableWidgetItem(QString::number(word.score)));
39  ui->tableWidget->setItem(x, 1, new QTableWidgetItem(word.word));
40  x++;
41  }
42 }
43 
44 ScoreWordsDbForm::~ScoreWordsDbForm()
45 {
46  delete ui;
47 }
The ScoreWord class.