Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: item hight error when turn off bluetooth #942

Merged
merged 1 commit into from
Dec 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions plugins/bluetooth/componments/bluetoothadapteritem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,10 @@ void BluetoothAdapterItem::updateIconTheme(DGuiApplicationHelper::ColorType type

QSize BluetoothAdapterItem::sizeHint() const
{
// 没有 item 就不去做一些无效的计算了,包括分割线的高度
if (m_deviceListview->count() < 1)
return QSize(ItemWidth, m_adapterLabel->height());

int visualHeight = 0;
for (int i = 0; i < m_deviceListview->count(); i++)
visualHeight += m_deviceListview->visualRect(m_deviceModel->index(i, 0)).height();
Expand Down Expand Up @@ -276,6 +280,10 @@ void BluetoothAdapterItem::initData()

void BluetoothAdapterItem::onDeviceAdded(const Device *device)
{
// 关闭蓝牙设备时,不再响应上一个扫描操作的新增的 device
if (!m_adapterStateBtn->isChecked())
return;

int insertRow = 0;
foreach (const auto item, m_deviceItems) {
if (item->device()->connectState()) {
Expand Down