Skip to content

Commit

Permalink
fix: Preview view area scroll bar display error
Browse files Browse the repository at this point in the history
Adjust the position of the scrollbar in the scrollview

Log: Preview view area scroll bar display error
Bug: https://pms.uniontech.com/bug-view-245725.html
  • Loading branch information
liyigang1 authored and max-lvs committed Mar 28, 2024
1 parent c485f77 commit 6fb0710
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ DetailSpaceWidget::DetailSpaceWidget(QFrame *parent)
#ifdef DTKWIDGET_CLASS_DSizeMode
connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::sizeModeChanged, this, &DetailSpaceWidget::initUiForSizeMode);
#endif

initUiForSizeMode();
initializeUi();
initConnect();
initUiForSizeMode();
}

void DetailSpaceWidget::initUiForSizeMode()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ static constexpr char kCurrentEventSpace[] { DPF_MACRO_TO_STR(DPDETAILSPACE_NAME
DetailView::DetailView(QWidget *parent)
: DFrame(parent)
{
#ifdef DTKWIDGET_CLASS_DSizeMode
connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::sizeModeChanged, this, &DetailView::initUiForSizeMode);
#endif
initInfoUI();
initUiForSizeMode();
}

DetailView::~DetailView()
Expand Down Expand Up @@ -100,6 +104,19 @@ void DetailView::setUrl(const QUrl &url, int widgetFilter)
createBasicWidget(url, widgetFilter);
}

void DetailView::initUiForSizeMode()
{
if (!scrollArea)
return;
#ifdef DTKWIDGET_CLASS_DSizeMode
scrollArea->setFixedWidth(DSizeModeHelper::element(254, 282));
scrollArea->setContentsMargins(DSizeModeHelper::element(2, 0),0,DSizeModeHelper::element(0, 6),0);
#else
scrollArea->setFixedWidth(282);
scrollArea->setContentsMargins(0,0,6,0);
#endif
}

void DetailView::initInfoUI()
{
scrollArea = new QScrollArea(this);
Expand All @@ -115,6 +132,7 @@ void DetailView::initInfoUI()
vLayout = new QVBoxLayout(this);
vLayout->addStretch();
expandFrame->setLayout(vLayout);
vLayout->setContentsMargins(0,0,8,0);

mainLayout = new QVBoxLayout(this);
mainLayout->addWidget(scrollArea, Qt::AlignCenter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ class DetailView : public DFrame
public slots:
void setUrl(const QUrl &url, int widgetFilter);

private slots:
void initUiForSizeMode();

private:
void initInfoUI();

Expand Down

0 comments on commit 6fb0710

Please sign in to comment.