fix(frontend):issues[I8WVVI]搜索结果响应较慢时,先选中一个条目,过会自动刷新会同时选中两个条目
This commit is contained in:
parent
820475b572
commit
ae154e876d
|
@ -53,8 +53,8 @@ void ResultArea::appendWidet(ResultWidget *widget)
|
||||||
m_mainLyt->addWidget(widget);
|
m_mainLyt->addWidget(widget);
|
||||||
setupConnectionsForWidget(widget);
|
setupConnectionsForWidget(widget);
|
||||||
widget->clearResult();
|
widget->clearResult();
|
||||||
m_widget_list.append(widget);
|
m_widgetList.append(widget);
|
||||||
int spacing_height = m_widget_list.length() > 1 ? m_mainLyt->spacing() : 0;
|
int spacing_height = m_widgetList.length() > 1 ? m_mainLyt->spacing() : 0;
|
||||||
m_widget->setFixedHeight(m_widget->height() + widget->height() + spacing_height);
|
m_widget->setFixedHeight(m_widget->height() + widget->height() + spacing_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,9 +63,9 @@ void ResultArea::insertWidget(ResultWidget *widget, int index)
|
||||||
m_mainLyt->insertWidget(index, widget);
|
m_mainLyt->insertWidget(index, widget);
|
||||||
setupConnectionsForWidget(widget);
|
setupConnectionsForWidget(widget);
|
||||||
widget->clearResult();
|
widget->clearResult();
|
||||||
m_widget_list.insert(index, widget);
|
m_widgetList.insert(index, widget);
|
||||||
qDebug() << "========insert widget:" << widget->pluginId() << index;
|
qDebug() << "========insert widget:" << widget->pluginId() << index;
|
||||||
int spacing_height = m_widget_list.length() > 1 ? m_mainLyt->spacing() : 0;
|
int spacing_height = m_widgetList.length() > 1 ? m_mainLyt->spacing() : 0;
|
||||||
m_widget->setFixedHeight(m_widget->height() + widget->height() + spacing_height);
|
m_widget->setFixedHeight(m_widget->height() + widget->height() + spacing_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,19 +73,19 @@ bool ResultArea::removeWidget(const QString &pluginName)
|
||||||
{
|
{
|
||||||
int height = 0;
|
int height = 0;
|
||||||
bool res(false);
|
bool res(false);
|
||||||
for (ResultWidget *myWidget : m_widget_list) {
|
for (ResultWidget *myWidget : m_widgetList) {
|
||||||
if (myWidget->pluginId() == pluginName) {
|
if (myWidget->pluginId() == pluginName) {
|
||||||
height = myWidget->height();
|
height = myWidget->height();
|
||||||
myWidget->disconnect();
|
myWidget->disconnect();
|
||||||
myWidget->clearResult();
|
myWidget->clearResult();
|
||||||
m_mainLyt->removeWidget(myWidget);
|
m_mainLyt->removeWidget(myWidget);
|
||||||
m_widget_list.removeAll(myWidget);
|
m_widgetList.removeAll(myWidget);
|
||||||
res = true;
|
res = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (res) {
|
if (res) {
|
||||||
int spacing_height = m_widget_list.length() > 0 ? m_mainLyt->spacing() : 0;
|
int spacing_height = m_widgetList.length() > 0 ? m_mainLyt->spacing() : 0;
|
||||||
m_widget->setFixedHeight(m_widget->height() - (height + spacing_height));
|
m_widget->setFixedHeight(m_widget->height() - (height + spacing_height));
|
||||||
qDebug() << "Remove Widget " << pluginName;
|
qDebug() << "Remove Widget " << pluginName;
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ bool ResultArea::removeWidget(const QString &pluginName)
|
||||||
|
|
||||||
bool ResultArea::moveWidget(const QString& pluginName, int index)
|
bool ResultArea::moveWidget(const QString& pluginName, int index)
|
||||||
{
|
{
|
||||||
for (ResultWidget *myWidget : m_widget_list) {
|
for (ResultWidget *myWidget : m_widgetList) {
|
||||||
if (myWidget->pluginId() == pluginName) {
|
if (myWidget->pluginId() == pluginName) {
|
||||||
m_mainLyt->removeWidget(myWidget);
|
m_mainLyt->removeWidget(myWidget);
|
||||||
m_mainLyt->insertWidget(index, myWidget);//第一个插件固定为bestlist
|
m_mainLyt->insertWidget(index, myWidget);//第一个插件固定为bestlist
|
||||||
|
@ -110,7 +110,7 @@ bool ResultArea::moveWidget(const QString& pluginName, int index)
|
||||||
*/
|
*/
|
||||||
void ResultArea::setVisibleList(const QStringList &list)
|
void ResultArea::setVisibleList(const QStringList &list)
|
||||||
{
|
{
|
||||||
Q_FOREACH (auto widget, m_widget_list) {
|
Q_FOREACH (auto widget, m_widgetList) {
|
||||||
if (list.contains(widget->pluginId())) {
|
if (list.contains(widget->pluginId())) {
|
||||||
widget->setEnabled(true);
|
widget->setEnabled(true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -121,15 +121,15 @@ void ResultArea::setVisibleList(const QStringList &list)
|
||||||
|
|
||||||
void ResultArea::pressEnter()
|
void ResultArea::pressEnter()
|
||||||
{
|
{
|
||||||
if (false == m_is_selected) {//未选中时默认选取bestlist第一项
|
if (false == m_isSelected) {//未选中时默认选取bestlist第一项
|
||||||
int resultNum = m_bestListWidget->getResultNum();
|
int resultNum = m_bestListWidget->getResultNum();
|
||||||
if (0 == resultNum) {//无搜索结果时默认选中websearch
|
if (0 == resultNum) {//无搜索结果时默认选中websearch
|
||||||
for (ResultWidget * i : m_widget_list) {
|
for (ResultWidget * i : m_widgetList) {
|
||||||
if (m_selectedPluginID == m_widget_list.back()->pluginId()) {
|
if (m_selectedPluginID == m_widgetList.back()->pluginId()) {
|
||||||
QModelIndex index = i->getModlIndex(0, 0);
|
QModelIndex index = i->getModlIndex(0, 0);
|
||||||
i->setResultSelection(index);
|
i->setResultSelection(index);
|
||||||
m_selectedPluginID = i->pluginId();
|
m_selectedPluginID = i->pluginId();
|
||||||
m_is_selected = true;
|
m_isSelected = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ void ResultArea::pressEnter()
|
||||||
QModelIndex index = m_bestListWidget->getModlIndex(0, 0);
|
QModelIndex index = m_bestListWidget->getModlIndex(0, 0);
|
||||||
m_bestListWidget->setResultSelection(index);
|
m_bestListWidget->setResultSelection(index);
|
||||||
m_selectedPluginID = m_bestListWidget->getWidgetName();
|
m_selectedPluginID = m_bestListWidget->getWidgetName();
|
||||||
m_is_selected = true;
|
m_isSelected = true;
|
||||||
}
|
}
|
||||||
} else {//选中状态时默认启动action首项
|
} else {//选中状态时默认启动action首项
|
||||||
//先判断详情页是否打开
|
//先判断详情页是否打开
|
||||||
|
@ -145,7 +145,7 @@ void ResultArea::pressEnter()
|
||||||
if (m_selectedPluginID == m_bestListWidget->getWidgetName()) {//最佳匹配
|
if (m_selectedPluginID == m_bestListWidget->getWidgetName()) {//最佳匹配
|
||||||
m_bestListWidget->activateIndex();
|
m_bestListWidget->activateIndex();
|
||||||
} else {
|
} else {
|
||||||
for (ResultWidget * i : m_widget_list) {
|
for (ResultWidget * i : m_widgetList) {
|
||||||
if (m_selectedPluginID == i->pluginId()) {
|
if (m_selectedPluginID == i->pluginId()) {
|
||||||
i->activateIndex();
|
i->activateIndex();
|
||||||
break;
|
break;
|
||||||
|
@ -161,7 +161,7 @@ void ResultArea::pressEnter()
|
||||||
|
|
||||||
void ResultArea::pressDown()
|
void ResultArea::pressDown()
|
||||||
{
|
{
|
||||||
if (m_selectedPluginID == m_widget_list.back()->pluginId()) {//当前为web search,暂不处理
|
if (m_selectedPluginID == m_widgetList.back()->pluginId()) {//当前为web search,暂不处理
|
||||||
return;
|
return;
|
||||||
} else if (m_selectedPluginID == m_bestListWidget->getWidgetName()) {
|
} else if (m_selectedPluginID == m_bestListWidget->getWidgetName()) {
|
||||||
QModelIndex index = m_bestListWidget->getCurrentSelection();
|
QModelIndex index = m_bestListWidget->getCurrentSelection();
|
||||||
|
@ -175,7 +175,7 @@ void ResultArea::pressDown()
|
||||||
sendKeyPressSignal(m_selectedPluginID);
|
sendKeyPressSignal(m_selectedPluginID);
|
||||||
} else if (index.row() >= maxNum - 1 or index.row() < 0) {//跳转下一个widget
|
} else if (index.row() >= maxNum - 1 or index.row() < 0) {//跳转下一个widget
|
||||||
m_bestListWidget->clearResultSelection();
|
m_bestListWidget->clearResultSelection();
|
||||||
for (ResultWidget * plugin : m_widget_list) {
|
for (ResultWidget * plugin : m_widgetList) {
|
||||||
if (plugin->getResultNum() != 0) {
|
if (plugin->getResultNum() != 0) {
|
||||||
QModelIndex resultIndex = plugin->getModlIndex(0, 0);
|
QModelIndex resultIndex = plugin->getModlIndex(0, 0);
|
||||||
plugin->setResultSelection(resultIndex);
|
plugin->setResultSelection(resultIndex);
|
||||||
|
@ -188,7 +188,7 @@ void ResultArea::pressDown()
|
||||||
qWarning() << "QModelIndex error ! row:" << index.row() << "maxNum:" << maxNum;
|
qWarning() << "QModelIndex error ! row:" << index.row() << "maxNum:" << maxNum;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (ResultWidget * plugin : m_widget_list) {
|
for (ResultWidget * plugin : m_widgetList) {
|
||||||
if (m_selectedPluginID == plugin->pluginId()) {
|
if (m_selectedPluginID == plugin->pluginId()) {
|
||||||
QModelIndex index = plugin->getCurrentSelection();
|
QModelIndex index = plugin->getCurrentSelection();
|
||||||
int maxNum = plugin->getExpandState() ?
|
int maxNum = plugin->getExpandState() ?
|
||||||
|
@ -201,10 +201,10 @@ void ResultArea::pressDown()
|
||||||
sendKeyPressSignal(m_selectedPluginID);
|
sendKeyPressSignal(m_selectedPluginID);
|
||||||
} else if (index.row() >= maxNum - 1 or index.row() < 0) {//跳转下一个widget
|
} else if (index.row() >= maxNum - 1 or index.row() < 0) {//跳转下一个widget
|
||||||
plugin->clearResultSelection();
|
plugin->clearResultSelection();
|
||||||
int indexNum = m_widget_list.indexOf(plugin);
|
int indexNum = m_widgetList.indexOf(plugin);
|
||||||
bool findNextWidget = false;
|
bool findNextWidget = false;
|
||||||
while (++indexNum < m_widget_list.size()) {
|
while (++indexNum < m_widgetList.size()) {
|
||||||
plugin = m_widget_list[indexNum];
|
plugin = m_widgetList[indexNum];
|
||||||
if (plugin->getResultNum() != 0) {
|
if (plugin->getResultNum() != 0) {
|
||||||
QModelIndex resultIndex = plugin->getModlIndex(0, 0);
|
QModelIndex resultIndex = plugin->getModlIndex(0, 0);
|
||||||
plugin->setResultSelection(resultIndex);
|
plugin->setResultSelection(resultIndex);
|
||||||
|
@ -227,7 +227,7 @@ void ResultArea::pressDown()
|
||||||
|
|
||||||
void ResultArea::pressUp()
|
void ResultArea::pressUp()
|
||||||
{
|
{
|
||||||
if (!m_is_selected) {
|
if (!m_isSelected) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_selectedPluginID == m_bestListWidget->getWidgetName()) {
|
if (m_selectedPluginID == m_bestListWidget->getWidgetName()) {
|
||||||
|
@ -248,7 +248,7 @@ void ResultArea::pressUp()
|
||||||
sendKeyPressSignal(m_selectedPluginID);
|
sendKeyPressSignal(m_selectedPluginID);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (ResultWidget * plugin : m_widget_list) {
|
for (ResultWidget * plugin : m_widgetList) {
|
||||||
if (m_selectedPluginID == plugin->pluginId()) {
|
if (m_selectedPluginID == plugin->pluginId()) {
|
||||||
int indexMaxNum = plugin->getExpandState() ?
|
int indexMaxNum = plugin->getExpandState() ?
|
||||||
plugin->getResultNum() : (plugin->getResultNum() < NUM_LIMIT_SHOWN_DEFAULT ?
|
plugin->getResultNum() : (plugin->getResultNum() < NUM_LIMIT_SHOWN_DEFAULT ?
|
||||||
|
@ -261,10 +261,10 @@ void ResultArea::pressUp()
|
||||||
sendKeyPressSignal(m_selectedPluginID);
|
sendKeyPressSignal(m_selectedPluginID);
|
||||||
} else if (index.row() == 0) {//跳转下一个widget
|
} else if (index.row() == 0) {//跳转下一个widget
|
||||||
plugin->clearResultSelection();
|
plugin->clearResultSelection();
|
||||||
int indexNum = m_widget_list.indexOf(plugin);
|
int indexNum = m_widgetList.indexOf(plugin);
|
||||||
bool findNextWidget = false;
|
bool findNextWidget = false;
|
||||||
while (--indexNum >= 0) {
|
while (--indexNum >= 0) {
|
||||||
plugin = m_widget_list[indexNum];
|
plugin = m_widgetList[indexNum];
|
||||||
if (plugin->getResultNum() != 0) {
|
if (plugin->getResultNum() != 0) {
|
||||||
int maxNum = plugin->getExpandState() ?
|
int maxNum = plugin->getExpandState() ?
|
||||||
plugin->getResultNum() : (plugin->getResultNum() < NUM_LIMIT_SHOWN_DEFAULT ?
|
plugin->getResultNum() : (plugin->getResultNum() < NUM_LIMIT_SHOWN_DEFAULT ?
|
||||||
|
@ -284,7 +284,7 @@ void ResultArea::pressUp()
|
||||||
QModelIndex setIndex = m_bestListWidget->getModlIndex(--bestListNum, 0);
|
QModelIndex setIndex = m_bestListWidget->getModlIndex(--bestListNum, 0);
|
||||||
m_bestListWidget->setResultSelection(setIndex);
|
m_bestListWidget->setResultSelection(setIndex);
|
||||||
m_selectedPluginID = m_bestListWidget->getWidgetName();
|
m_selectedPluginID = m_bestListWidget->getWidgetName();
|
||||||
m_is_selected = true;
|
m_isSelected = true;
|
||||||
sendKeyPressSignal(m_selectedPluginID);
|
sendKeyPressSignal(m_selectedPluginID);
|
||||||
}
|
}
|
||||||
if (findNextWidget){
|
if (findNextWidget){
|
||||||
|
@ -310,7 +310,7 @@ int ResultArea::getVScrollBarWidth()
|
||||||
|
|
||||||
bool ResultArea::getSelectedState()
|
bool ResultArea::getSelectedState()
|
||||||
{
|
{
|
||||||
return m_is_selected;
|
return m_isSelected;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResultArea::sendKeyPressSignal(QString &pluginID)
|
void ResultArea::sendKeyPressSignal(QString &pluginID)
|
||||||
|
@ -327,7 +327,7 @@ void ResultArea::sendKeyPressSignal(QString &pluginID)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
height += m_bestListWidget->height();
|
height += m_bestListWidget->height();
|
||||||
for (ResultWidget *plugin : m_widget_list) {
|
for (ResultWidget *plugin : m_widgetList) {
|
||||||
if (pluginID == plugin->pluginId()) {
|
if (pluginID == plugin->pluginId()) {
|
||||||
QModelIndex index = plugin->getCurrentSelection();
|
QModelIndex index = plugin->getCurrentSelection();
|
||||||
//todo 这里偶尔会导致崩溃@jxx,暂时规避。
|
//todo 这里偶尔会导致崩溃@jxx,暂时规避。
|
||||||
|
@ -353,20 +353,20 @@ void ResultArea::sendKeyPressSignal(QString &pluginID)
|
||||||
void ResultArea::onWidgetSizeChanged()
|
void ResultArea::onWidgetSizeChanged()
|
||||||
{
|
{
|
||||||
int whole_height = 0;
|
int whole_height = 0;
|
||||||
Q_FOREACH (ResultWidget *widget, m_widget_list) {
|
Q_FOREACH (ResultWidget *widget, m_widgetList) {
|
||||||
whole_height += widget->height();
|
whole_height += widget->height();
|
||||||
}
|
}
|
||||||
whole_height += m_bestListWidget->height();
|
whole_height += m_bestListWidget->height();
|
||||||
|
|
||||||
int spacing_height = m_widget_list.length() > 1 ? m_mainLyt->spacing() : 0;
|
int spacing_height = m_widgetList.length() > 1 ? m_mainLyt->spacing() : 0;
|
||||||
m_widget->setFixedHeight(whole_height + spacing_height * (m_widget_list.length() - 1));
|
m_widget->setFixedHeight(whole_height + spacing_height * (m_widgetList.length() - 1));
|
||||||
Q_EMIT this->resizeHeight(whole_height + spacing_height * (m_widget_list.length() - 1));
|
Q_EMIT this->resizeHeight(whole_height + spacing_height * (m_widgetList.length() - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResultArea::setSelectionInfo(QString &pluginID)
|
void ResultArea::setSelectionInfo(QString &pluginID)
|
||||||
{
|
{
|
||||||
m_detail_open_state = true;
|
m_detail_open_state = true;
|
||||||
m_is_selected = true;
|
m_isSelected = true;
|
||||||
m_selectedPluginID = pluginID;
|
m_selectedPluginID = pluginID;
|
||||||
if (m_selectedPluginID != m_bestListWidget->getWidgetName()) {
|
if (m_selectedPluginID != m_bestListWidget->getWidgetName()) {
|
||||||
m_bestListWidget->clearResultSelection();
|
m_bestListWidget->clearResultSelection();
|
||||||
|
@ -462,22 +462,19 @@ void ResultArea::initConnections()
|
||||||
connect(this, &ResultArea::startSearch, m_bestListWidget, &BestListWidget::startSearch);
|
connect(this, &ResultArea::startSearch, m_bestListWidget, &BestListWidget::startSearch);
|
||||||
connect(this, &ResultArea::startSearch, this, [=] () {
|
connect(this, &ResultArea::startSearch, this, [=] () {
|
||||||
m_detail_open_state = false;
|
m_detail_open_state = false;
|
||||||
m_is_selected = false;
|
m_isSelected = false;
|
||||||
m_selectedPluginID = "";
|
m_selectedPluginID = "";
|
||||||
});
|
});
|
||||||
connect(m_bestListWidget, &BestListWidget::sizeChanged, this, &ResultArea::onWidgetSizeChanged);
|
connect(m_bestListWidget, &BestListWidget::sizeChanged, this, &ResultArea::onWidgetSizeChanged);
|
||||||
connect(m_bestListWidget, &BestListWidget::sizeChanged, this, [=] () {
|
connect(m_bestListWidget, &BestListWidget::sizeChanged, this, [=] () {
|
||||||
QModelIndex index = m_bestListWidget->getModlIndex(0, 0);
|
QModelIndex index = m_bestListWidget->getModlIndex(0, 0);
|
||||||
if (index.isValid()) {
|
if (index.isValid() && (m_selectedPluginID == m_bestListWidget->getWidgetName() || m_selectedPluginID.isEmpty())) {
|
||||||
m_bestListWidget->setResultSelection(index);
|
m_bestListWidget->setResultSelection(index);
|
||||||
m_selectedPluginID = m_bestListWidget->getWidgetName();
|
m_selectedPluginID = m_bestListWidget->getWidgetName();
|
||||||
m_is_selected = true;
|
m_isSelected = true;
|
||||||
|
|
||||||
for (ResultWidget * i : m_widget_list) {
|
if(!m_widgetList.isEmpty()) {
|
||||||
if (i->pluginId() == m_widget_list.back()->pluginId()) {
|
m_widgetList.last()->clearResultSelection();
|
||||||
i->clearResultSelection();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -485,7 +482,7 @@ void ResultArea::initConnections()
|
||||||
connect(m_bestListWidget, &BestListWidget::currentRowChanged, this, &ResultArea::currentRowChanged);
|
connect(m_bestListWidget, &BestListWidget::currentRowChanged, this, &ResultArea::currentRowChanged);
|
||||||
connect(m_bestListWidget, &BestListWidget::currentRowChanged, this, [=] () {
|
connect(m_bestListWidget, &BestListWidget::currentRowChanged, this, [=] () {
|
||||||
m_detail_open_state = true;
|
m_detail_open_state = true;
|
||||||
m_is_selected = true;
|
m_isSelected = true;
|
||||||
m_selectedPluginID = m_bestListWidget->getWidgetName();
|
m_selectedPluginID = m_bestListWidget->getWidgetName();
|
||||||
});
|
});
|
||||||
connect(this, &ResultArea::clearSelectedRow, m_bestListWidget, &BestListWidget::clearSelectedRow);
|
connect(this, &ResultArea::clearSelectedRow, m_bestListWidget, &BestListWidget::clearSelectedRow);
|
||||||
|
@ -494,7 +491,7 @@ void ResultArea::initConnections()
|
||||||
});
|
});
|
||||||
connect(m_bestListWidget, &BestListWidget::rowClicked, this, &ResultArea::rowClicked);
|
connect(m_bestListWidget, &BestListWidget::rowClicked, this, &ResultArea::rowClicked);
|
||||||
connect(this->verticalScrollBar(), &QScrollBar::valueChanged, this, [=] (int value) {//判断显示和隐藏逻辑
|
connect(this->verticalScrollBar(), &QScrollBar::valueChanged, this, [=] (int value) {//判断显示和隐藏逻辑
|
||||||
Q_FOREACH(auto widget, m_widget_list) {
|
Q_FOREACH(auto widget, m_widgetList) {
|
||||||
if (!widget->getExpandState()) {
|
if (!widget->getExpandState()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -516,7 +513,7 @@ void ResultArea::initConnections()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
connect(this->m_titleLabel, &TitleLabel::retractClicked, this, [=] () {
|
connect(this->m_titleLabel, &TitleLabel::retractClicked, this, [=] () {
|
||||||
Q_FOREACH(auto widget, m_widget_list) {
|
Q_FOREACH(auto widget, m_widgetList) {
|
||||||
if (widget->pluginName() == m_titleLabel->text()) {
|
if (widget->pluginName() == m_titleLabel->text()) {
|
||||||
if (!m_titleLabel->isHidden()) {
|
if (!m_titleLabel->isHidden()) {
|
||||||
m_titleLabel->hide();
|
m_titleLabel->hide();
|
||||||
|
@ -547,11 +544,11 @@ void ResultArea::setupConnectionsForWidget(ResultWidget *widget)
|
||||||
connect(this, &ResultArea::stopSearch, widget, &ResultWidget::stopSearch);
|
connect(this, &ResultArea::stopSearch, widget, &ResultWidget::stopSearch);
|
||||||
connect(widget, &ResultWidget::sizeChanged, this, &ResultArea::onWidgetSizeChanged);
|
connect(widget, &ResultWidget::sizeChanged, this, &ResultArea::onWidgetSizeChanged);
|
||||||
connect(widget, &ResultWidget::sizeChanged, this, [=] () {
|
connect(widget, &ResultWidget::sizeChanged, this, [=] () {
|
||||||
if (widget->pluginId() == m_widget_list.back()->pluginId() and m_selectedPluginID != m_bestListWidget->getWidgetName()) {//每次搜索默认选中websearch,由bestlist取消
|
if (widget->pluginId() == m_widgetList.back()->pluginId() and m_selectedPluginID != m_bestListWidget->getWidgetName()) {//每次搜索默认选中websearch,由bestlist取消
|
||||||
QModelIndex index = widget->getModlIndex(0, 0);
|
QModelIndex index = widget->getModlIndex(0, 0);
|
||||||
if (index.isValid()) {
|
if (index.isValid()) {
|
||||||
widget->setResultSelection(index);
|
widget->setResultSelection(index);
|
||||||
m_is_selected = true;
|
m_isSelected = true;
|
||||||
m_selectedPluginID = widget->pluginId();
|
m_selectedPluginID = widget->pluginId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,12 +86,12 @@ private:
|
||||||
QWidget * m_widget = nullptr;
|
QWidget * m_widget = nullptr;
|
||||||
QVBoxLayout * m_mainLyt = nullptr;
|
QVBoxLayout * m_mainLyt = nullptr;
|
||||||
BestListWidget * m_bestListWidget = nullptr;
|
BestListWidget * m_bestListWidget = nullptr;
|
||||||
QList<ResultWidget *> m_widget_list;
|
QList<ResultWidget *> m_widgetList;
|
||||||
TitleLabel * m_titleLabel = nullptr;
|
TitleLabel * m_titleLabel = nullptr;
|
||||||
ResultScrollBar *m_scrollBar = nullptr;
|
ResultScrollBar *m_scrollBar = nullptr;
|
||||||
|
|
||||||
bool m_detail_open_state = false;
|
bool m_detail_open_state = false;
|
||||||
bool m_is_selected = false;
|
bool m_isSelected = false;
|
||||||
QString m_selectedPluginID;
|
QString m_selectedPluginID;
|
||||||
QPoint m_pressPoint;
|
QPoint m_pressPoint;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue