| 49 | } |
| 50 | |
| 51 | void TwoViewInfoTab::InitializeTable(const QStringList& table_header) { |
| 52 | QGridLayout* grid = new QGridLayout(this); |
| 53 | |
| 54 | info_label_ = new QLabel(this); |
| 55 | grid->addWidget(info_label_, 0, 0); |
| 56 | |
| 57 | QPushButton* show_button = new QPushButton(tr("Show matches"), this); |
| 58 | connect( |
| 59 | show_button, &QPushButton::released, this, &TwoViewInfoTab::ShowMatches); |
| 60 | grid->addWidget(show_button, 0, 1, Qt::AlignRight); |
| 61 | |
| 62 | table_widget_ = new QTableWidget(this); |
| 63 | table_widget_->setColumnCount(table_header.size()); |
| 64 | table_widget_->setHorizontalHeaderLabels(table_header); |
| 65 | |
| 66 | table_widget_->setShowGrid(true); |
| 67 | table_widget_->setSelectionBehavior(QAbstractItemView::SelectRows); |
| 68 | table_widget_->setSelectionMode(QAbstractItemView::SingleSelection); |
| 69 | table_widget_->setEditTriggers(QAbstractItemView::NoEditTriggers); |
| 70 | table_widget_->horizontalHeader()->setStretchLastSection(true); |
| 71 | table_widget_->verticalHeader()->setVisible(false); |
| 72 | table_widget_->verticalHeader()->setDefaultSectionSize(20); |
| 73 | |
| 74 | grid->addWidget(table_widget_, 1, 0, 1, 2); |
| 75 | } |
| 76 | |
| 77 | void TwoViewInfoTab::ShowMatches() { |
| 78 | QItemSelectionModel* select = table_widget_->selectionModel(); |