Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
translatedialog.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
5
7
8TranslateDialog::TranslateDialog(QWidget *parent)
10{
11 m_ui.setupUi(this);
12 connect(m_ui.findNxt, &QAbstractButton::clicked,
13 this, &TranslateDialog::emitFindNext);
14 connect(m_ui.translate, &QAbstractButton::clicked,
15 this, &TranslateDialog::emitTranslateAndFindNext);
16 connect(m_ui.translateAll, &QAbstractButton::clicked,
17 this, &TranslateDialog::emitTranslateAll);
18 connect(m_ui.ledFindWhat, &QLineEdit::textChanged,
19 this, &TranslateDialog::verifyText);
20 connect(m_ui.ckMatchCase, &QAbstractButton::toggled,
21 this, &TranslateDialog::verifyText);
22}
23
24void TranslateDialog::showEvent(QShowEvent *)
25{
26 verifyText();
27 m_ui.ledFindWhat->setFocus();
28}
29
30void TranslateDialog::verifyText()
31{
32 QString text = m_ui.ledFindWhat->text();
33 bool canFind = !text.isEmpty();
34 bool hit = false;
35 if (canFind)
36 emit requestMatchUpdate(hit);
37 m_ui.findNxt->setEnabled(canFind);
38 m_ui.translate->setEnabled(canFind && hit);
39 m_ui.translateAll->setEnabled(canFind);
40}
41
42void TranslateDialog::emitFindNext()
43{
44 emit activated(Skip);
45}
46
47void TranslateDialog::emitTranslateAndFindNext()
48{
49 emit activated(Translate);
50}
51
52void TranslateDialog::emitTranslateAll()
53{
54 emit activated(TranslateAll);
55}
56
57QT_END_NAMESPACE
QObject * parent
Definition qobject.h:73
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
Combined button and popup list for selecting options.