mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 22:54:01 +02:00
Get rid of Q_OBJECT in HistoryInner
This commit is contained in:
parent
f469cab7b0
commit
1c8d4ee7ab
3 changed files with 7 additions and 10 deletions
|
@ -72,9 +72,6 @@ class HistoryWidget;
|
|||
class HistoryInner
|
||||
: public Ui::RpWidget
|
||||
, public Ui::AbstractTooltipShower {
|
||||
// The Q_OBJECT meta info is used for qobject_cast!
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
using Element = HistoryView::Element;
|
||||
|
||||
|
|
|
@ -351,7 +351,7 @@ void SendKeySequence(
|
|||
const auto focused = QApplication::focusWidget();
|
||||
if (qobject_cast<QLineEdit*>(focused)
|
||||
|| qobject_cast<QTextEdit*>(focused)
|
||||
|| qobject_cast<HistoryInner*>(focused)) {
|
||||
|| dynamic_cast<HistoryInner*>(focused)) {
|
||||
QApplication::postEvent(
|
||||
focused,
|
||||
new QKeyEvent(QEvent::KeyPress, key, modifiers));
|
||||
|
@ -826,12 +826,12 @@ void MainWindow::updateGlobalMenuHook() {
|
|||
canRedo = edit->document()->isRedoAvailable();
|
||||
canPaste = clipboardHasText;
|
||||
if (canCopy) {
|
||||
if (const auto inputField = qobject_cast<Ui::InputField*>(
|
||||
if (const auto inputField = dynamic_cast<Ui::InputField*>(
|
||||
focused->parentWidget())) {
|
||||
markdownEnabled = inputField->isMarkdownEnabled();
|
||||
}
|
||||
}
|
||||
} else if (const auto list = qobject_cast<HistoryInner*>(focused)) {
|
||||
} else if (const auto list = dynamic_cast<HistoryInner*>(focused)) {
|
||||
canCopy = list->canCopySelected();
|
||||
canDelete = list->canDeleteSelected();
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ namespace {
|
|||
|
||||
void SendKeySequence(Qt::Key key, Qt::KeyboardModifiers modifiers = Qt::NoModifier) {
|
||||
const auto focused = QApplication::focusWidget();
|
||||
if (qobject_cast<QLineEdit*>(focused) || qobject_cast<QTextEdit*>(focused) || qobject_cast<HistoryInner*>(focused)) {
|
||||
if (qobject_cast<QLineEdit*>(focused) || qobject_cast<QTextEdit*>(focused) || dynamic_cast<HistoryInner*>(focused)) {
|
||||
QApplication::postEvent(focused, new QKeyEvent(QEvent::KeyPress, key, modifiers));
|
||||
QApplication::postEvent(focused, new QKeyEvent(QEvent::KeyRelease, key, modifiers));
|
||||
}
|
||||
|
@ -628,12 +628,12 @@ void MainWindow::updateGlobalMenuHook() {
|
|||
canRedo = edit->document()->isRedoAvailable();
|
||||
canPaste = clipboardHasText;
|
||||
if (canCopy) {
|
||||
if (const auto inputField = qobject_cast<Ui::InputField*>(
|
||||
if (const auto inputField = dynamic_cast<Ui::InputField*>(
|
||||
focused->parentWidget())) {
|
||||
canApplyMarkdown = inputField->isMarkdownEnabled();
|
||||
}
|
||||
}
|
||||
} else if (auto list = qobject_cast<HistoryInner*>(focused)) {
|
||||
} else if (auto list = dynamic_cast<HistoryInner*>(focused)) {
|
||||
canCopy = list->canCopySelected();
|
||||
canDelete = list->canDeleteSelected();
|
||||
}
|
||||
|
@ -669,7 +669,7 @@ void MainWindow::updateGlobalMenuHook() {
|
|||
bool MainWindow::eventFilter(QObject *obj, QEvent *evt) {
|
||||
QEvent::Type t = evt->type();
|
||||
if (t == QEvent::FocusIn || t == QEvent::FocusOut) {
|
||||
if (qobject_cast<QLineEdit*>(obj) || qobject_cast<QTextEdit*>(obj) || qobject_cast<HistoryInner*>(obj)) {
|
||||
if (qobject_cast<QLineEdit*>(obj) || qobject_cast<QTextEdit*>(obj) || dynamic_cast<HistoryInner*>(obj)) {
|
||||
updateGlobalMenu();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue