mirror of
https://github.com/Quill-OS/quill.git
synced 2024-11-01 05:43:21 -07:00
51 lines
1.5 KiB
C++
51 lines
1.5 KiB
C++
#include "searchresultswidget.h"
|
|
#include "ui_searchresultswidget.h"
|
|
#include "functions.h"
|
|
|
|
#include <QMessageBox>
|
|
|
|
searchResultsWidget::searchResultsWidget(QWidget *parent) :
|
|
QWidget(parent),
|
|
ui(new Ui::searchResultsWidget)
|
|
{
|
|
ui->setupUi(this);
|
|
ui->listView->setStyleSheet("font-size: 10pt");
|
|
ui->backBtn->setProperty("type", "borderless");
|
|
ui->backBtn->setStyleSheet("font-size: 9pt; padding: 10px; font-weight: bold; background: lightGrey");
|
|
ui->openBtn->setProperty("type", "borderless");
|
|
ui->openBtn->setStyleSheet("font-size: 9pt; padding: 10px; font-weight: bold; background: lightGrey");
|
|
}
|
|
|
|
searchResultsWidget::~searchResultsWidget()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
void searchResultsWidget::setListViewContents(QStringList searchResults) {
|
|
QStringListModel * model = new QStringListModel(this);
|
|
model->setStringList(searchResults);
|
|
ui->listView->setModel(model);
|
|
}
|
|
|
|
void searchResultsWidget::on_openBtn_clicked()
|
|
{
|
|
index = ui->listView->currentIndex();
|
|
itemText = index.data(Qt::DisplayRole).toString();
|
|
if(!itemText.isEmpty()) {
|
|
emit openBookFile(itemText, true);
|
|
global::keyboard::searchDialog = false;
|
|
global::keyboard::keyboardDialog = false;
|
|
searchResultsWidget::close();
|
|
}
|
|
else {
|
|
QMessageBox::critical(this, tr("Invalid argument"), tr("Please select a search result."));
|
|
}
|
|
}
|
|
|
|
|
|
void searchResultsWidget::on_backBtn_clicked()
|
|
{
|
|
global::forbidOpenSearchDialog = false;
|
|
searchResultsWidget::close();
|
|
}
|
|
|