mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-02 15:45:21 +00:00
fix: 修复跨端协同设备数量变化时列表页面显示不全的问题。
当跨端协同列表数量变化的时候,没有将子页面高度变化通知父窗口从而更新整个页面高度导致的问题。 Log: 修复跨端协同设备数量变化时列表页面显示不全的问题 But: https://pms.uniontech.com/bug-view-165835.html Influence: 跨端协同设备变化时,页面显示。 Change-Id: I3a0ac51ea7f412cc530a075ad55b4cc710a5df90
This commit is contained in:
parent
c73ef98002
commit
a8b8e6bd00
@ -31,10 +31,9 @@
|
||||
#include <QStandardItemModel>
|
||||
|
||||
#define TITLE_HEIGHT 16
|
||||
#define ITME_WIDTH 310
|
||||
#define ITEM_WIDTH 310
|
||||
#define ITEM_HEIGHT 36
|
||||
#define LISTVIEW_ITEM_SPACE 2
|
||||
#define ITME_SPACE 10
|
||||
#define LISTVIEW_ITEM_SPACE 5
|
||||
#define PER_DEGREE 14
|
||||
|
||||
DevCollaborationWidget::DevCollaborationWidget(QWidget *parent)
|
||||
@ -59,6 +58,13 @@ void DevCollaborationWidget::showEvent(QShowEvent *event)
|
||||
QWidget::showEvent(event);
|
||||
}
|
||||
|
||||
void DevCollaborationWidget::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
Q_EMIT sizeChanged();
|
||||
|
||||
QWidget::resizeEvent(event);
|
||||
}
|
||||
|
||||
void DevCollaborationWidget::initUI()
|
||||
{
|
||||
m_deviceListView->setModel(m_viewItemModel);
|
||||
@ -73,7 +79,7 @@ void DevCollaborationWidget::initUI()
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout();
|
||||
mainLayout->setMargin(0);
|
||||
mainLayout->setContentsMargins(0, 0, 0, 0);
|
||||
mainLayout->setSpacing(ITME_SPACE);
|
||||
mainLayout->setSpacing(0);
|
||||
mainLayout->addLayout(hLayout);
|
||||
mainLayout->addWidget(m_deviceListView);
|
||||
|
||||
@ -107,7 +113,7 @@ void DevCollaborationWidget::loadDevice()
|
||||
if (!m_deviceListView->isVisible())
|
||||
m_deviceListView->setVisible(true);
|
||||
|
||||
m_deviceListView->setFixedSize(ITME_WIDTH, m_deviceListView->count() * ITEM_HEIGHT + LISTVIEW_ITEM_SPACE * (m_deviceListView->count() * 2));
|
||||
m_deviceListView->setFixedSize(ITEM_WIDTH, m_deviceListView->count() * ITEM_HEIGHT + LISTVIEW_ITEM_SPACE * (m_deviceListView->count() * 2));
|
||||
}
|
||||
|
||||
resetWidgetSize();
|
||||
@ -175,9 +181,9 @@ void DevCollaborationWidget::updateDeviceListView()
|
||||
|
||||
void DevCollaborationWidget::resetWidgetSize()
|
||||
{
|
||||
int height = TITLE_HEIGHT + ITME_SPACE + (m_deviceListView->count() ? m_deviceListView->height() : 0);
|
||||
int height = TITLE_HEIGHT + (m_deviceListView->count() ? m_deviceListView->height() : 0);
|
||||
|
||||
setFixedSize(ITME_WIDTH, height);
|
||||
setFixedSize(ITEM_WIDTH, height);
|
||||
}
|
||||
|
||||
void DevCollaborationWidget::itemClicked(const QModelIndex &index)
|
||||
|
@ -39,8 +39,12 @@ class DevCollaborationWidget : public QWidget
|
||||
public:
|
||||
explicit DevCollaborationWidget(QWidget *parent = nullptr);
|
||||
|
||||
signals:
|
||||
void sizeChanged();
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent *event) override;
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
|
||||
private slots:
|
||||
void loadDevice();
|
||||
|
@ -60,7 +60,14 @@ void DisplaySettingWidget::initUI()
|
||||
|
||||
setLayout(mainLayout);
|
||||
|
||||
resizeWidgetHeight();
|
||||
connect(m_collaborationWidget, &DevCollaborationWidget::sizeChanged,
|
||||
this, &DisplaySettingWidget::resizeWidgetHeight);
|
||||
}
|
||||
|
||||
void DisplaySettingWidget::resizeWidgetHeight()
|
||||
{
|
||||
QMargins margins = this->contentsMargins();
|
||||
setFixedHeight(margins.top() + margins.bottom() + m_brightnessAdjWidget->height() +
|
||||
m_collaborationWidget->height() + m_settingBtn->height() + ItemSpacing * 2);
|
||||
m_collaborationWidget->height() + m_settingBtn->height() + ItemSpacing * 2);
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ public:
|
||||
|
||||
private:
|
||||
void initUI();
|
||||
void resizeWidgetHeight();
|
||||
|
||||
private:
|
||||
BrightnessAdjWidget *m_brightnessAdjWidget; // 亮度调整
|
||||
|
Loading…
x
Reference in New Issue
Block a user