Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
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
4
#
include
"translatedialog.h"
5
6
QT_BEGIN_NAMESPACE
7
8
TranslateDialog::TranslateDialog(
QWidget
*
parent
)
9
:
QDialog
(
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
24
void
TranslateDialog::showEvent(QShowEvent *)
25
{
26
verifyText();
27
m_ui.ledFindWhat->setFocus();
28
}
29
30
void
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
42
void
TranslateDialog::emitFindNext()
43
{
44
emit activated(Skip);
45
}
46
47
void
TranslateDialog::emitTranslateAndFindNext()
48
{
49
emit activated(Translate);
50
}
51
52
void
TranslateDialog::emitTranslateAll()
53
{
54
emit activated(TranslateAll);
55
}
56
57
QT_END_NAMESPACE
QObjectData::parent
QObject * parent
Definition
qobject.h:74
QWidget
The QWidget class is the base class of all user interface objects.
Definition
qwidget.h:99
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qttools
src
linguist
linguist
translatedialog.cpp
Generated on
for Qt by
1.18.0