aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorConfuSomu2023-08-02 02:10:55 +0200
committerConfuSomu2023-08-02 02:10:55 +0200
commit88e272b40dd9b0a182662ac77296dc2330b2027f (patch)
tree44913cf55601ae6a8249e31c8723a6e86ae31c97 /src
parent42434314d65cdc29402c7adcb08c2fa5113f7ca2 (diff)
downloadActorViewer-88e272b40dd9b0a182662ac77296dc2330b2027f.tar
ActorViewer-88e272b40dd9b0a182662ac77296dc2330b2027f.tar.gz
ActorViewer-88e272b40dd9b0a182662ac77296dc2330b2027f.zip
Make a QAction from the Search button
This allows us to have an action in the menu bar and a keyboard shortcut.
Diffstat (limited to 'src')
-rw-r--r--src/mainwindow.cpp3
-rw-r--r--src/mainwindow.h2
-rw-r--r--src/mainwindow.ui9
3 files changed, 12 insertions, 2 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 2b8a0df..4b3b010 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -19,6 +19,7 @@ MainWindow::MainWindow(QWidget *parent)
ui->setupUi(this);
connect(ui->buttonCopy, &QPushButton::clicked, ui->actionCopy_status, &QAction::trigger);
connect(ui->buttonRandom, &QPushButton::clicked, ui->actionRandom_status, &QAction::trigger);
+ connect(ui->buttonSearch, &QPushButton::clicked, ui->actionFind, &QAction::trigger);
connect(&archive_thread_watcher, &QFutureWatcher<std::variant<QString, Archive::InitError>>::finished, this, &MainWindow::archive_thread_watcher_done);
}
@@ -100,7 +101,7 @@ void MainWindow::on_actionCopy_status_triggered(bool checked) {
}
}
-void MainWindow::on_buttonSearch_clicked() {
+void MainWindow::on_actionFind_triggered(bool checked) {
if (!find_dialog) {
find_dialog = new FindDialog(this);
find_dialog->set_qlist_widget(ui->listWidget);
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 7b87880..fedbc9d 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -46,9 +46,9 @@ private slots:
void on_actionReblogs_triggered(bool checked);
void on_actionRandom_status_triggered(bool checked);
void on_actionCopy_status_triggered(bool checked);
+ void on_actionFind_triggered(bool checked);
void on_textInputSearch_textEdited(const QString &text);
- void on_buttonSearch_clicked();
void on_menuView_aboutToHide();
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index f4a9263..f4bd5a0 100644
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -125,6 +125,7 @@ p, li { white-space: pre-wrap; }
<string>Edit</string>
</property>
<addaction name="actionCopy_status"/>
+ <addaction name="actionFind"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuEdit"/>
@@ -247,6 +248,14 @@ p, li { white-space: pre-wrap; }
<string>Copy status text</string>
</property>
</action>
+ <action name="actionFind">
+ <property name="text">
+ <string>Find in list…</string>
+ </property>
+ <property name="shortcut">
+ <string>Ctrl+F</string>
+ </property>
+ </action>
</widget>
<tabstops>
<tabstop>listWidget</tabstop>