diff --git a/src/widgets/common/downloaditem.cpp b/src/widgets/common/downloaditem.cpp index 30047f8..4c1e179 100644 --- a/src/widgets/common/downloaditem.cpp +++ b/src/widgets/common/downloaditem.cpp @@ -22,6 +22,8 @@ DownloadItem::DownloadItem(QWidget *parent) : QWidget(parent), ui->pushButton_3->hide(); ui->widget_spinner->start(); ui->widget_spinner->hide(); + + ui->label->setElideMode(Qt::TextElideMode::ElideRight); } DownloadItem::~DownloadItem() @@ -48,6 +50,7 @@ void DownloadItem::setMax(qint64 max) void DownloadItem::setName(QString name) { ui->label->setText(name); + ui->label->setToolTip(name); } QString DownloadItem::getName() diff --git a/src/widgets/common/downloaditem.ui b/src/widgets/common/downloaditem.ui index 2d57cf3..a02e136 100644 --- a/src/widgets/common/downloaditem.ui +++ b/src/widgets/common/downloaditem.ui @@ -7,13 +7,25 @@ <x>0</x> <y>0</y> <width>666</width> - <height>54</height> + <height>56</height> </rect> </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>56</height> + </size> + </property> <property name="maximumSize"> <size> <width>16777215</width> - <height>54</height> + <height>56</height> </size> </property> <property name="windowTitle"> @@ -40,10 +52,22 @@ </property> <item> <widget class="QLabel" name="label_3"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>48</width> + <height>48</height> + </size> + </property> <property name="maximumSize"> <size> <width>48</width> - <height>16777215</height> + <height>48</height> </size> </property> <property name="text"> @@ -52,6 +76,9 @@ <property name="scaledContents"> <bool>true</bool> </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> </widget> </item> <item> @@ -70,6 +97,31 @@ </property> </spacer> </item> + <item> + <widget class="DLabel" name="label"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>80</width> + <height>48</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>120</width> + <height>48</height> + </size> + </property> + <property name="text"> + <string>Name</string> + </property> + </widget> + </item> <item> <widget class="QLabel" name="label_filename"> <property name="maximumSize"> @@ -83,33 +135,6 @@ </property> </widget> </item> - <item> - <widget class="QLabel" name="label"> - <property name="minimumSize"> - <size> - <width>80</width> - <height>0</height> - </size> - </property> - <property name="maximumSize"> - <size> - <width>16777215</width> - <height>16777215</height> - </size> - </property> - <property name="font"> - <font> - <pointsize>13</pointsize> - </font> - </property> - <property name="text"> - <string>Name</string> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - </widget> - </item> <item> <spacer name="horizontalSpacer_2"> <property name="orientation"> @@ -153,11 +178,14 @@ <property name="leftMargin"> <number>0</number> </property> + <property name="topMargin"> + <number>8</number> + </property> <property name="rightMargin"> <number>0</number> </property> <property name="bottomMargin"> - <number>0</number> + <number>8</number> </property> <item> <widget class="QProgressBar" name="progressBar"> @@ -297,6 +325,11 @@ <header location="global">dspinner.h</header> <container>1</container> </customwidget> + <customwidget> + <class>DLabel</class> + <extends>QLabel</extends> + <header>dlabel.h</header> + </customwidget> </customwidgets> <resources/> <connections/> diff --git a/src/widgets/downloadlistwidget.cpp b/src/widgets/downloadlistwidget.cpp index 01a7157..28a31f3 100644 --- a/src/widgets/downloadlistwidget.cpp +++ b/src/widgets/downloadlistwidget.cpp @@ -91,7 +91,7 @@ void DownloadListWidget::addItem(QString name, QString fileName, QString pkgName di->pkgName = pkgName; di->seticon(icon); QListWidgetItem *pItem = new QListWidgetItem(); - pItem->setSizeHint(QSize(240, 50)); + pItem->setSizeHint(QSize(240, 56)); // ui 中单个 downloaditem 高度固定 56px(上下 margin 8px,图片固定 48x48) ui->listWidget->addItem(pItem); ui->listWidget->setItemWidget(pItem, di); if (!isBusy) diff --git a/src/widgets/downloadlistwidget.ui b/src/widgets/downloadlistwidget.ui index 16cb680..e46a655 100644 --- a/src/widgets/downloadlistwidget.ui +++ b/src/widgets/downloadlistwidget.ui @@ -85,7 +85,7 @@ QListWidget::item::selected }</string> </property> <property name="frameShape"> - <enum>QFrame::StyledPanel</enum> + <enum>QFrame::NoFrame</enum> </property> <property name="verticalScrollBarPolicy"> <enum>Qt::ScrollBarAsNeeded</enum> @@ -99,9 +99,15 @@ QListWidget::item::selected <property name="autoScrollMargin"> <number>10</number> </property> + <property name="editTriggers"> + <set>QAbstractItemView::NoEditTriggers</set> + </property> <property name="resizeMode"> <enum>QListView::Fixed</enum> </property> + <property name="spacing"> + <number>4</number> + </property> </widget> </item> <item>