Reduce dependency on Main Window
Some checks are pending
CI - File health / Check (push) Waiting to run
CI - macOS / Build (1.2.19, GUI=OFF, 6.7.0) (push) Waiting to run
CI - macOS / Build (1.2.19, GUI=ON, 6.7.0) (push) Waiting to run
CI - macOS / Build (2.0.10, GUI=OFF, 6.7.0) (push) Waiting to run
CI - macOS / Build (2.0.10, GUI=ON, 6.7.0) (push) Waiting to run
CI - Python / Check (push) Waiting to run
CI - Ubuntu / Build (1.2.19, GUI=OFF, 6.5.2) (push) Waiting to run
CI - Ubuntu / Build (1.2.19, GUI=ON, 6.5.2) (push) Waiting to run
CI - Ubuntu / Build (2.0.10, GUI=OFF, 6.5.2) (push) Waiting to run
CI - Ubuntu / Build (2.0.10, GUI=ON, 6.5.2) (push) Waiting to run
CI - WebUI / Check (push) Waiting to run
CI - Windows / Build (1.2.19) (push) Waiting to run
CI - Windows / Build (2.0.10) (push) Waiting to run

PR #21753.
This commit is contained in:
Chocobo1 2024-11-06 13:45:14 +08:00 committed by GitHub
parent 75d1ac8889
commit 3da9444688
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 10 deletions

View File

@ -41,8 +41,8 @@
#include <QDebug>
#include <QEvent>
#include <QList>
#include <QMessageBox>
#include <QMenu>
#include <QMessageBox>
#include <QMouseEvent>
#include <QObject>
#include <QRegularExpression>
@ -84,10 +84,9 @@ namespace
}
}
SearchWidget::SearchWidget(IGUIApplication *app, MainWindow *mainWindow)
: GUIApplicationComponent(app, mainWindow)
SearchWidget::SearchWidget(IGUIApplication *app, QWidget *parent)
: GUIApplicationComponent(app, parent)
, m_ui {new Ui::SearchWidget()}
, m_mainWindow {mainWindow}
{
m_ui->setupUi(this);
m_ui->tabWidget->tabBar()->installEventFilter(this);
@ -175,6 +174,7 @@ bool SearchWidget::eventFilter(QObject *object, QEvent *event)
}
return false;
}
return QWidget::eventFilter(object, event);
}
@ -373,7 +373,7 @@ void SearchWidget::tabStatusChanged(QWidget *tab)
{
Q_ASSERT(m_activeSearchTab->status() != SearchJobWidget::Status::Ongoing);
if (app()->desktopIntegration()->isNotificationsEnabled() && (m_mainWindow->currentTabWidget() != this))
if (app()->desktopIntegration()->isNotificationsEnabled() && (app()->mainWindow()->currentTabWidget() != this))
{
if (m_activeSearchTab->status() == SearchJobWidget::Status::Error)
app()->desktopIntegration()->showNotification(tr("Search Engine"), tr("Search has failed"));

View File

@ -30,7 +30,6 @@
#pragma once
#include <QList>
#include <QPointer>
#include <QWidget>
@ -38,9 +37,7 @@
class QEvent;
class QObject;
class QTabWidget;
class MainWindow;
class SearchJobWidget;
namespace Ui
@ -54,7 +51,7 @@ class SearchWidget : public GUIApplicationComponent<QWidget>
Q_DISABLE_COPY_MOVE(SearchWidget)
public:
explicit SearchWidget(IGUIApplication *app, MainWindow *mainWindow);
explicit SearchWidget(IGUIApplication *app, QWidget *parent);
~SearchWidget() override;
void giveFocusToSearchInput();
@ -83,6 +80,5 @@ private:
Ui::SearchWidget *m_ui = nullptr;
QPointer<SearchJobWidget> m_currentSearchTab; // Selected tab
QPointer<SearchJobWidget> m_activeSearchTab; // Tab with running search
MainWindow *m_mainWindow = nullptr;
bool m_isNewQueryString = false;
};