forked from linuxdeepin/dtkwidget
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdlineedit.cpp
More file actions
749 lines (624 loc) · 21.3 KB
/
dlineedit.cpp
File metadata and controls
749 lines (624 loc) · 21.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
// SPDX-FileCopyrightText: 2015 - 2022 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: LGPL-3.0-or-later
#include <QMenu>
#include <QDBusInterface>
#include <QDBusReply>
#include <QDebug>
#include <QTimer>
#include "dlineedit.h"
#include "private/dlineedit_p.h"
#include "darrowrectangle.h"
#include <DToolTip>
#include <DPalette>
#include <DGuiApplicationHelper>
#define private public
#ifndef slots
#define slots Q_SLOTS
#endif
#include <private/qlineedit_p.h>
#undef private
DWIDGET_BEGIN_NAMESPACE
/*!
@~english
\class Dtk::Widget::DLineEdit
\inmodule dtkwidget
\brief DLineEdit is an input box for aggregating QLineEdit.
\list
\li DLineEdit provides the function of inserting controls into the left and right ends of the input box
\li DLineEdit provides an input box with warning color
\li DLineEdit provides an input box with a text warning message
\endlist
*/
/*!
@~english
\property DLineEdit::alert
\brief Warning Mode Properties.
Used to turn on or judge whether it is in warning mode.
*/
/*!
@~english
\brief Constructor of DLineEdit
\a parent The parameter is sent to the QWidget constructor.
*/
DLineEdit::DLineEdit(QWidget *parent)
: QWidget(parent)
, DObject(*new DLineEditPrivate(this))
{
D_D(DLineEdit);
d->init();
}
DLineEdit::~DLineEdit()
{
}
/*!
@~english
\brief Returns the QLineEdit object.
If DLineEdit does not meet the use requirements of the input box,
please use the object thrown by this function
\return
*/
QLineEdit *DLineEdit::lineEdit() const
{
D_DC(DLineEdit);
return d->lineEdit;
}
DLineEdit::DLineEdit(DLineEditPrivate &q, QWidget *parent)
: QWidget(parent)
, DObject(q)
{
d_func()->init();
}
void DLineEdit::setAlert(bool isAlert)
{
Q_D(DLineEdit);
//qDebug() << "setAlert..." << isAlert;
d->control->setAlert(isAlert);
}
bool DLineEdit::isAlert() const
{
D_DC(DLineEdit);
return d->control->isAlert();
}
void DLineEdit::showAlertMessage(const QString &text, int duration)
{
showAlertMessage(text, nullptr, duration);
}
/*!
@~english
\brief Display warning message.
Display the specified text message, and the warning message disappears after the specified time.
\note When the time parameter is - 1, the warning message will always exist
\a text Warning text
\a duration The length of time displayed in milliseconds
\a follower Tooltip follow
*/
void DLineEdit::showAlertMessage(const QString &text, QWidget *follower, int duration)
{
D_D(DLineEdit);
d->control->showAlertMessage(text, follower ? follower : this->lineEdit(), duration);
}
/*!
@~english
\brief Specify alignment.
Now only (bottom) left, (bottom) right, (bottom horizontal) center are supported, and left alignment is the default.
\note When the parameter is other, the default left alignment
\a alignment Message alignment
*/
void DLineEdit::setAlertAlignment(Qt::Alignment alignment)
{
D_D(DLineEdit);
d->control->setAlertAlignment(alignment);
}
Qt::Alignment DLineEdit::alertAlignment() const
{
D_DC(DLineEdit);
return d->control->alertAlignment();
}
void DLineEdit::setAlertMessageAlignment(Qt::Alignment alignment)
{
D_D(DLineEdit);
d->control->setMessageAlignment(alignment);
}
Qt::Alignment DLineEdit::alertMessageAlignment() const
{
D_DC(DLineEdit);
return d->control->messageAlignment();
}
/*!
@~english
\brief Hide warning message box.
*/
void DLineEdit:: hideAlertMessage()
{
Q_D(DLineEdit);
if (d->control) {
d->control->hideAlertMessage();
}
// if (d->frame) {
// d->frame->hide();
// if (d->follower) {
// this->removeEventFilter(d->follower);
// d->follower = nullptr;
// }
// }
}
/*!
@~english
\brief Add a control to the left of the input box.
Insert the control in QList to the left of the input box
\note Call this function several times, and only the last call will take effect
\a list Stores the list of controls
*/
void DLineEdit::setLeftWidgets(const QList<QWidget *> &list)
{
Q_D(DLineEdit);
if (d->leftWidget != nullptr) {
d->leftWidget->hide();
d->leftWidget->deleteLater();
d->leftWidget = nullptr;
}
if (list.isEmpty())
return;
d->leftWidget = new QWidget;
QHBoxLayout *layout = new QHBoxLayout(d->leftWidget);
layout->setContentsMargins(0, 0, 0, 0);
d->hLayout->insertWidget(0, d->leftWidget);
QList<QWidget *>::const_iterator itor;
for (itor = list.constBegin(); itor != list.constEnd(); itor++) {
layout->addWidget(*itor);
}
d->leftWidget->adjustSize();
}
/*!
@~english
\brief Add a control to the right of the input box.
Insert the control in QList to the right of the input box
\note Call this function several times, and only the last call will take effect
\a list Stores the list of controls
*/
void DLineEdit::setRightWidgets(const QList<QWidget *> &list)
{
Q_D(DLineEdit);
if (d->rightWidget != nullptr) {
d->rightWidget->hide();
d->rightWidget->deleteLater();
d->rightWidget = nullptr;
}
if (list.isEmpty())
return;
d->rightWidget = new QWidget;
d->rightWidget->setAccessibleName("DLineEditRightWidget");
QHBoxLayout *layout = new QHBoxLayout(d->rightWidget);
layout->setContentsMargins(0, 0, 0, 0);
d->hLayout->addWidget(d->rightWidget);
QList<QWidget *>::const_iterator itor;
for (itor = list.constBegin(); itor != list.constEnd(); itor++) {
layout->addWidget(*itor);
}
d->rightWidget->adjustSize();
}
/*!
@~english
\brief Whether to hide the control on the left side of the input box.
\a visible Whether to hide
*/
void DLineEdit::setLeftWidgetsVisible(bool visible)
{
Q_D(DLineEdit);
d->leftWidget->setVisible(visible);
}
/*!
@~english
\brief Whether to hide the control on the right of the input box.
\a visible Whether to hide
*/
void DLineEdit::setRightWidgetsVisible(bool visible)
{
Q_D(DLineEdit);
d->rightWidget->setVisible(visible);
}
/*!
@~english
\brief Set whether the clear button is visible.
\a enable True means the button is visible, false means the button is not visible
*/
void DLineEdit::setClearButtonEnabled(bool enable)
{
Q_D(DLineEdit);
d->lineEdit->setClearButtonEnabled(enable);
if (enable)
if (QToolButton *lineEditClearButton = d->lineEdit->findChild<QToolButton *>())
lineEditClearButton->setAccessibleName("DLineEditClearButton");
}
/*!
@~english
\brief Whether the return clear button is visible.
\return True means the clear button is visible, false means the clear button is not visible
*/
bool DLineEdit::isClearButtonEnabled() const
{
D_DC(DLineEdit);
return d->lineEdit->isClearButtonEnabled();
}
/*!
@~english
\brief Set the displayed text.
\a text Displayed text
*/
void DLineEdit::setText(const QString &text)
{
D_D(DLineEdit);
d->lineEdit->setText(text);
}
/*!
@~english
\brief Returns the currently displayed text.
\return Return the displayed text
*/
QString DLineEdit::text()
{
D_DC(DLineEdit);
return d->lineEdit->text();
}
/*!
@~english
\brief Empty the edited content.
*/
void DLineEdit::clear()
{
D_D(DLineEdit);
return d->lineEdit->clear();
}
/*!
@~english
\brief Returns the echo mode of the input box.
\return Returns the mode of echo
*/
QLineEdit::EchoMode DLineEdit::echoMode() const
{
D_DC(DLineEdit);
return d->lineEdit->echoMode();
}
/*!
@~english
\brief Set the mode of echo.
\a mode Echoed mode
*/
void DLineEdit::setEchoMode(QLineEdit::EchoMode mode)
{
D_D(DLineEdit);
d->lineEdit->setEchoMode(mode);
}
/*!
@~english
\brief Set the text menu policy of the line edit control.
\a policy How to display the right-click menu
Forwards the ContextMenuEvent message of the actual variable QLineEdit
\sa QLineEdit::setContextMenuPolicy
*/
void DLineEdit::setContextMenuPolicy(Qt::ContextMenuPolicy policy)
{
D_D(DLineEdit);
d->lineEdit->setContextMenuPolicy(policy);
}
/*!
@~english
\brief Return to whether the voice dictation menu item is displayed.
\return True to display voice dictation menu items, false to not display
*/
bool DLineEdit::speechToTextIsEnabled() const
{
D_D(const DLineEdit);
return d->bSpeechToText;
}
void DLineEdit::setPlaceholderText(const QString& placeholderText)
{
D_D(DLineEdit);
d->lineEdit->setPlaceholderText(placeholderText);
}
/*!
@~english
\brief Set whether to display voice dictation menu items.
\a enable True is displayed, and the flash is not displayed
*/
void DLineEdit::setSpeechToTextEnabled(bool enable)
{
D_D(DLineEdit);
d->bSpeechToText = enable;
}
/*!
@~english
\brief Return to whether to display voice reading menu item.
\return True to display voice reading menu items, false to not display
*/
bool DLineEdit::textToSpeechIsEnabled() const
{
D_D(const DLineEdit);
return d->bTextToSpeech;
}
/*!
@~english
\brief Set whether to display voice reading menu items.
\a enable True is displayed, and the flash is not displayed
*/
void DLineEdit::setTextToSpeechEnabled(bool enable)
{
D_D(DLineEdit);
d->bTextToSpeech = enable;
}
/*!
@~english
\brief Returns whether to display the text translation menu item.
\return True to display the text translation menu item, false to not display
*/
bool DLineEdit::textToTranslateIsEnabled() const
{
D_D(const DLineEdit);
return d->bTextToTranslate;
}
/*!
@~english
\brief Set whether to display the text translation menu item
\a enable True to display, false to not display
*/
void DLineEdit::setTextToTranslateEnabled(bool enable)
{
D_D(DLineEdit);
d->bTextToTranslate = enable;
}
/*!
@~english
\brief Returns whether the input text can be cut
\return True means the text can be cut, false means it cannot be cut
*/
bool DLineEdit::cutEnabled() const
{
D_DC(DLineEdit);
return d->bEnableCut;
}
/*!
@~english
\brief Set whether the input text can be cut
\a enabled True means the input text can be cut, false means it cannot be cut
*/
void DLineEdit::setCutEnabled(bool enable)
{
D_D(DLineEdit);
d->bEnableCut = enable;
}
/*!
@~english
\brief Returns whether the input text can be copied
\return True means that the text can be copied, and false means that it cannot be copied
*/
bool DLineEdit::copyEnabled() const
{
D_DC(DLineEdit);
return d->bEnableCopy;
}
/*!
@~english
\brief Set whether the input text can be copied
\a enabled True means the input text can be copied, false means it cannot be copied
*/
void DLineEdit::setCopyEnabled(bool enable)
{
D_D(DLineEdit);
d->bEnableCopy = enable;
}
/*!
@~english
\brief Event filter
\a watched Listened child control pointer, \a event Events to be filtered \a event example.
The filter does not perform any filtering action, but will monitor the focus status of the input box and send the signal focusChanged ()
\return If filtering is successful, return true; otherwise, return false .
*/
bool DLineEdit::eventFilter(QObject *watched, QEvent *event)
{
D_D(DLineEdit);
if (event->type() == QEvent::FocusIn) {
if (DGuiApplicationHelper::IsTableEnvironment && QGuiApplication::inputMethod())
QGuiApplication::inputMethod()->show();
Q_EMIT focusChanged(true);
} else if (event->type() == QEvent::FocusOut) {
Q_EMIT focusChanged(false);
} else if (watched == lineEdit() && event->type() == QEvent::KeyPress) {
QKeyEvent *pKeyEvent = static_cast<QKeyEvent *>(event);
if (pKeyEvent == QKeySequence::Copy && !copyEnabled()) {
return true;
}
if (pKeyEvent == QKeySequence::Cut && !cutEnabled()) {
return true;
}
if (pKeyEvent == QKeySequence::SelectAll) {
QApplication::clipboard()->setText(lineEdit()->text(), QClipboard::Mode::Selection);
}
} else if (watched == lineEdit() && event->type() == QEvent::ContextMenu && lineEdit()->contextMenuPolicy() == Qt::DefaultContextMenu) {
QLineEdit *le = static_cast<QLineEdit *>(watched);
if (!le->isEnabled() || le->echoMode() == QLineEdit::Password ||
(!textToSpeechIsEnabled() && !textToTranslateIsEnabled() && !speechToTextIsEnabled())) {
return QWidget::eventFilter(watched, event);
}
QLineEdit *pLineEdit = static_cast<QLineEdit*>(watched);
QMenu *menu = pLineEdit->createStandardContextMenu();
for (QAction *action : menu->actions()) {
if (action->text().startsWith(QLineEdit::tr("&Copy")) && !copyEnabled() ) {
action->setEnabled(false);
}
if (action->text().startsWith(QLineEdit::tr("Cu&t")) && !cutEnabled()) {
action->setEnabled(false);
}
}
connect(menu, &QMenu::triggered, this, [pLineEdit](QAction *pAction) {
if (pAction->text().startsWith(QLineEdit::tr("Select All"))) {
QApplication::clipboard()->setText(pLineEdit->text(), QClipboard::Mode::Selection);
}
});
auto msg = QDBusMessage::createMethodCall("com.iflytek.aiassistant", "/",
"org.freedesktop.DBus.Peer", "Ping");
// 用之前 Ping 一下, 300ms 内没回复就认定是服务出问题,不再添加助手菜单项
// Fix:Bug-154857 此处不能使用 BlockWithGui 否则右键事件会被处理,事件传递到
// DSearchEdit 上会导致 edit 获得焦点然后菜单弹出后又失去焦点,有闪烁现象。。
auto pingReply = QDBusConnection::sessionBus().call(msg, QDBus::Block, 300);
auto errorType = QDBusConnection::sessionBus().lastError().type();
if (errorType == QDBusError::Timeout || errorType == QDBusError::NoReply) {
qWarning() << pingReply << "\nwill not add aiassistant actions!";
menu->popup(static_cast<QContextMenuEvent*>(event)->globalPos());
event->accept();
return true;
}
QDBusInterface testSpeech("com.iflytek.aiassistant",
"/aiassistant/tts",
"com.iflytek.aiassistant.tts",
QDBusConnection::sessionBus());
// 测试朗读接口是否开启
QDBusReply<bool> speechReply = testSpeech.call(QDBus::AutoDetect, "getTTSEnable");
QDBusInterface testReading("com.iflytek.aiassistant",
"/aiassistant/tts",
"com.iflytek.aiassistant.tts",
QDBusConnection::sessionBus());
//测试朗读是否在进行
QDBusReply<bool> readingReply = testReading.call(QDBus::AutoDetect, "isTTSInWorking");
QDBusInterface testTranslate("com.iflytek.aiassistant",
"/aiassistant/trans",
"com.iflytek.aiassistant.trans",
QDBusConnection::sessionBus());
//测试翻译接口是否开启
QDBusReply<bool> translateReply = testTranslate.call(QDBus::AutoDetect, "getTransEnable");
QDBusInterface testSpeechToText("com.iflytek.aiassistant",
"/aiassistant/iat",
"com.iflytek.aiassistant.iat",
QDBusConnection::sessionBus());
//测试听写接口是否开启
QDBusReply<bool> speechToTextReply = testSpeechToText.call(QDBus::AutoDetect, "getIatEnable");
//朗读,翻译,听写都没有开启,则弹出默认菜单
if (!speechReply.value() && !translateReply.value() && !speechToTextReply.value()) {
menu->popup(static_cast<QContextMenuEvent*>(event)->globalPos());
event->accept();
return true;
}
menu->addSeparator();
if (speechReply.value() && textToSpeechIsEnabled()) {
QAction *pAction_1 = nullptr;
if (readingReply.value()) {
pAction_1 = menu->addAction(QCoreApplication::translate("DLineEdit", "Stop reading"));
} else {
pAction_1 = menu->addAction(QCoreApplication::translate("DLineEdit", "Text to Speech"));
}
//没有选中文本,则菜单置灰色
if (!pLineEdit->hasSelectedText()) {
pAction_1->setEnabled(false);
}
connect(pAction_1, &QAction::triggered, this, [] {
QDBusInterface speechInterface("com.iflytek.aiassistant",
"/aiassistant/deepinmain",
"com.iflytek.aiassistant.mainWindow",
QDBusConnection::sessionBus());
if (speechInterface.isValid()) {
speechInterface.call(QDBus::BlockWithGui, "TextToSpeech");//此函在第一次调用时朗读,在朗读状态下再次调用为停止朗读
} else {
qWarning() << "[DLineEdit] TextToSpeech ERROR";
}
});
}
if (translateReply.value() && textToTranslateIsEnabled()) {
QAction *pAction_2 = menu->addAction(QCoreApplication::translate("DLineEdit", "Translate"));
//没有选中文本,则菜单置灰色
if (!pLineEdit->hasSelectedText()) {
pAction_2->setEnabled(false);
}
connect(pAction_2, &QAction::triggered, this, [] {
QDBusInterface translationInterface("com.iflytek.aiassistant",
"/aiassistant/deepinmain",
"com.iflytek.aiassistant.mainWindow",
QDBusConnection::sessionBus());
if (translationInterface.isValid()) {
translationInterface.call(QDBus::BlockWithGui, "TextToTranslate");//执行翻译
} else {
qWarning() << "[DLineEdit] Translation ERROR";
}
});
}
if (speechToTextReply.value() && speechToTextIsEnabled()) {
QAction *pAction_3 = menu->addAction(QCoreApplication::translate("DLineEdit", "Speech To Text"));
connect(pAction_3, &QAction::triggered, this, [] {
QDBusInterface speechToTextInterface("com.iflytek.aiassistant",
"/aiassistant/deepinmain",
"com.iflytek.aiassistant.mainWindow",
QDBusConnection::sessionBus());
if (speechToTextInterface.isValid()) {
speechToTextInterface.call(QDBus::BlockWithGui, "SpeechToText");//执行听写
} else {
qWarning() << "[DLineEdit] SpeechToText ERROR";
}
});
}
//FIXME: 由于Qt在UOS系统环境下不明原因的bug,使用menu->setAttribute(Qt::WA_DeleteOnClose) 销毁menu会在特定情况下出现崩溃的问题,这里采用一种变通的做法
connect(menu, &QMenu::aboutToHide, this, [=] {
if (menu->activeAction()) {
menu->deleteLater();
} else {
QTimer::singleShot(0, this, [=] {
menu->deleteLater();
});
}
});
menu->popup(static_cast<QContextMenuEvent*>(event)->globalPos());
event->accept();
pLineEdit->setFocus();
return true;
}
// if (d->frame)
// {
// if (watched == d->follower && event->type() == QEvent::Move) {
// d->updateTooltipPos();
// }
// }
return QWidget::eventFilter(watched, event);
}
bool DLineEdit::event(QEvent *e)
{
//D_D(DLineEdit);
// if (e->type() == QEvent::Move || e->type() == QEvent::Resize) {
// if (d->frame)
// d->updateTooltipPos();
// }
return QWidget::event(e);
}
DLineEditPrivate::DLineEditPrivate(DLineEdit *q)
: DObjectPrivate(q)
, leftWidget(nullptr)
, rightWidget(nullptr)
, lineEdit(nullptr)
, hLayout(nullptr)
{
}
void DLineEditPrivate::updateTooltipPos()
{
//control->updateTooltipPos();
}
void DLineEditPrivate::init()
{
Q_Q(DLineEdit);
hLayout = new QHBoxLayout(q);
lineEdit = new QLineEdit(q);
q->setFocusProxy(lineEdit); // fix DlineEdit setFocut but lineEdit can not edit(without focus rect)
q->setFocusPolicy(lineEdit->focusPolicy());
control = new DAlertControl(lineEdit, q);
q->connect(control, &DAlertControl::alertChanged, q, &DLineEdit::alertChanged);
hLayout->setContentsMargins(0, 0, 0, 0);
// Set spacing to 10 for between widget.
hLayout->setSpacing(10);
hLayout->addWidget(lineEdit);
lineEdit->installEventFilter(q);
lineEdit->setAccessibleName("DLineEditChildLineEdit");
q->setClearButtonEnabled(true);
q->connect(lineEdit, &QLineEdit::textChanged, q, &DLineEdit::textChanged);
q->connect(lineEdit, &QLineEdit::textEdited, q, &DLineEdit::textEdited);
q->connect(lineEdit, &QLineEdit::cursorPositionChanged, q, &DLineEdit::cursorPositionChanged);
q->connect(lineEdit, &QLineEdit::returnPressed, q, &DLineEdit::returnPressed);
q->connect(lineEdit, &QLineEdit::editingFinished, q, &DLineEdit::editingFinished);
q->connect(lineEdit, &QLineEdit::selectionChanged, q, &DLineEdit::selectionChanged);
}
DWIDGET_END_NAMESPACE