Skip to content

Fix issue with qt6.8 #66

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions qt5/guiwrapper/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,21 @@
#include "fcitxqtconfiguifactory.h"
#include "fcitxqtcontrollerproxy.h"
#include "fcitxqtwatcher.h"
#include <QCloseEvent>
#include <QDebug>
#include <QLocale>
#include <QMessageBox>
#include <QPushButton>
#include <QShowEvent>
#include <QWidget>
#include <QWindow>
#include <fcitx-utils/i18n.h>

namespace fcitx {

MainWindow::MainWindow(const QString &path, FcitxQtConfigUIWidget *pluginWidget,
QWidget *parent)
: QDialog(parent), path_(path), watcher_(new FcitxQtWatcher(this)),
: QWidget(parent), path_(path), watcher_(new FcitxQtWatcher(this)),
pluginWidget_(pluginWidget), proxy_(0) {
setupUi(this);
watcher_->setConnection(QDBusConnection::sessionBus());
Expand Down Expand Up @@ -145,6 +148,12 @@ void MainWindow::showEvent(QShowEvent *event) {
connect(this, &QObject::destroyed, mainWindow, &QObject::deleteLater);
subWindow->setTransientParent(mainWindow);

QDialog::showEvent(event);
QWidget::showEvent(event);
}

void MainWindow::closeEvent(QCloseEvent *event) {
QWidget::closeEvent(event);

qApp->quit();
}
} // namespace fcitx
4 changes: 3 additions & 1 deletion qt5/guiwrapper/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@
#include "fcitxqtconfiguiwidget.h"
#include "ui_mainwindow.h"
#include <QDBusPendingCallWatcher>
#include <QWidget>

namespace fcitx {

class FcitxQtControllerProxy;
class FcitxQtWatcher;
class MainWindow : public QDialog, public Ui::MainWindow {
class MainWindow : public QWidget, public Ui::MainWindow {
Q_OBJECT
public:
explicit MainWindow(const QString &path,
Expand All @@ -35,6 +36,7 @@ public Q_SLOTS:

protected:
void showEvent(QShowEvent *event) override;
void closeEvent(QCloseEvent *event) override;

private Q_SLOTS:
void saveFinished();
Expand Down
8 changes: 4 additions & 4 deletions qt5/guiwrapper/wrapperapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <QWindow>
#include <fcitx-utils/i18n.h>
#include <fcitx-utils/standardpath.h>
#include <qnamespace.h>

namespace fcitx {

Expand Down Expand Up @@ -69,15 +70,14 @@ void WrapperApp::init() {
mainWindow_ = new MainWindow(path, widget);
if (ok && winid) {
mainWindow_->setParentWindow(winid);
mainWindow_->setWindowModality(Qt::WindowModal);
mainWindow_->setWindowFlag(Qt::Dialog);
}
QMetaObject::invokeMethod(this, "run", Qt::QueuedConnection);
}
}

void WrapperApp::run() {
mainWindow_->exec();
QMetaObject::invokeMethod(this, "quit", Qt::QueuedConnection);
}
void WrapperApp::run() { mainWindow_->show(); }

WrapperApp::~WrapperApp() {
if (mainWindow_) {
Expand Down
Loading