MCPcopy Create free account
hub / github.com/KangLin/RabbitRemoteControl / CAddressCompleter

Method CAddressCompleter

Plugins/WebBrowser/AddressCompleter.cpp:55–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53}
54
55CAddressCompleter::CAddressCompleter(CHistoryDatabase *db, QWidget *parent)
56 : QWidget(parent)
57 , m_pLineEdit(nullptr)
58 , m_pShowAnimation(nullptr)
59 , m_pHideAnimation(nullptr)
60 , m_currentSelectedIndex(-1)
61 , m_maxVisibleItems(8)
62 , m_isCompleterVisible(false)
63 , m_pDatabase(db)
64{
65 m_szEnter = tr("Enter '@' show commands") + "; "
66 + tr("Enter a website URL or search content ......");
67 m_szLineEditToolTip = m_szEnter + "\n\n"
68 + tr("Enter ↲ key: Apply current url");
69
70 m_szListWidgetToolTip += tr("Enter ↲ key: Apply current item") + "\n";
71 m_szListWidgetToolTip += tr("Tab ⇆ key: Apply current item") + "\n";
72 m_szListWidgetToolTip += tr("Esc Key: Exit address completer") + "\n";
73 m_szListWidgetToolTip += tr("Space Key: Exit address completer") + "\n";
74 m_szListWidgetToolTip += tr("↑ (Upper arrow) key: Select previous item") + "\n";
75 m_szListWidgetToolTip += tr("↓ (Down arrow) key: Select next item");
76
77 m_szLineEditToolTipShow = m_szEnter + "\n\n" + m_szListWidgetToolTip;
78 setToolTip(m_szListWidgetToolTip);
79
80 setupUI();
81
82 // 设置搜索延迟定时器(300ms防抖动)
83 m_pSearchTimer = new QTimer(this);
84 if(m_pSearchTimer) {
85 m_pSearchTimer->setSingleShot(true);
86 m_pSearchTimer->setInterval(300);
87 bool check = connect(m_pSearchTimer, &QTimer::timeout,
88 this, &CAddressCompleter::performSearch);
89 Q_ASSERT(check);
90 }
91
92 // 动画效果
93 m_pShowAnimation = new QPropertyAnimation(this, "geometry", this);
94 m_pHideAnimation = new QPropertyAnimation(this, "geometry", this);
95
96 // 初始隐藏
97 hide();
98}
99
100CAddressCompleter::~CAddressCompleter()
101{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected