🦄 refactor(UI模块): 重新设置搜索设备按钮
This commit is contained in:
parent
7721b9f482
commit
f73261ad5e
|
@ -132,9 +132,4 @@ void ConnectInterface::setSearchBtnState(bool state)
|
|||
} else {
|
||||
m_searchWin->setSearchBtnState(false);
|
||||
}
|
||||
}
|
||||
|
||||
void ConnectInterface::moveSearchBtn()
|
||||
{
|
||||
m_searchWin->moveSearchBtn();
|
||||
}
|
|
@ -26,7 +26,6 @@ public:
|
|||
void setItemInfo(const QMap<QString, KMobileCommon::DiscoveryDeviceInfo> &map);
|
||||
void showLoad();
|
||||
void setSearchBtnState(bool state);
|
||||
void moveSearchBtn();
|
||||
|
||||
Q_SIGNALS:
|
||||
void sigBackBtnClicked();
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
SearchDeviceWin::SearchDeviceWin(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
initUI();
|
||||
initSearchButton();
|
||||
}
|
||||
|
||||
SearchDeviceWin::~SearchDeviceWin()
|
||||
|
@ -79,7 +78,7 @@ void SearchDeviceWin::initUI()
|
|||
void SearchDeviceWin::showLoad()
|
||||
{
|
||||
isSearchInitFinish = false;
|
||||
m_searchBtn->hide();
|
||||
showSearchBtn(false);
|
||||
m_stackedWidget->setCurrentIndex(1);
|
||||
}
|
||||
|
||||
|
@ -87,9 +86,9 @@ void SearchDeviceWin::setSearchBtnState(bool isShow)
|
|||
{
|
||||
isShowSearchBtn = isShow;
|
||||
if (isShowSearchBtn && isSearchInitFinish) {
|
||||
m_searchBtn->show();
|
||||
showSearchBtn(true);
|
||||
} else {
|
||||
m_searchBtn->hide();
|
||||
showSearchBtn(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -128,26 +127,30 @@ void SearchDeviceWin::setItemInfo(const QMap<QString, KMobileCommon::DiscoveryDe
|
|||
m_stackedWidget->setCurrentIndex(0);
|
||||
isSearchInitFinish = true;
|
||||
if (isShowSearchBtn && isSearchInitFinish) {
|
||||
m_searchBtn->show();
|
||||
showSearchBtn(true);
|
||||
}
|
||||
}
|
||||
|
||||
void SearchDeviceWin::initSearchButton()
|
||||
void SearchDeviceWin::showSearchBtn(bool isShow)
|
||||
{
|
||||
m_searchBtn = new LevitationButton(this);
|
||||
m_searchBtn->setIcon(":/connectinterface/searchrefresh.svg");
|
||||
m_searchBtn->setText(tr("Search"));
|
||||
m_searchBtn->hide();
|
||||
connect(m_searchBtn, &LevitationButton::clicked, this, [=]() {
|
||||
qInfo() << "continue search clicked";
|
||||
Q_EMIT sigContinueSearch();
|
||||
});
|
||||
}
|
||||
|
||||
void SearchDeviceWin::moveSearchBtn()
|
||||
{
|
||||
m_searchBtn->move(
|
||||
QPoint(this->width() / 2 - m_searchBtn->width() / 2, this->height() - 16 - m_searchBtn->height()));
|
||||
if (isShow) {
|
||||
if (m_searchBtn == nullptr) {
|
||||
m_searchBtn = new LevitationButton(this);
|
||||
m_searchBtn->setIcon(":/connectinterface/searchrefresh.svg");
|
||||
m_searchBtn->setText(tr("Search"));
|
||||
connect(m_searchBtn, &LevitationButton::clicked, this, [=]() {
|
||||
qInfo() << "continue search clicked";
|
||||
Q_EMIT sigContinueSearch();
|
||||
});
|
||||
m_searchBtn->move(
|
||||
QPoint(this->width() / 2 - m_searchBtn->width() / 2, this->height() - 16 - m_searchBtn->height()));
|
||||
}
|
||||
m_searchBtn->show();
|
||||
} else {
|
||||
if (m_searchBtn != nullptr) {
|
||||
m_searchBtn->hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SearchDeviceWin::setTheme(PublicAttributes::Theme theme)
|
||||
|
|
|
@ -31,8 +31,6 @@ public:
|
|||
|
||||
void setSearchBtnState(bool isShow);
|
||||
|
||||
void moveSearchBtn();
|
||||
|
||||
Q_SIGNALS:
|
||||
void sigItemInfo(QString);
|
||||
void sigContinueSearch();
|
||||
|
@ -41,7 +39,7 @@ Q_SIGNALS:
|
|||
|
||||
private:
|
||||
void initUI();
|
||||
void initSearchButton();
|
||||
void showSearchBtn(bool isShow);
|
||||
|
||||
private:
|
||||
QListWidget *m_listWidget = nullptr;
|
||||
|
|
Loading…
Reference in New Issue