解决搜索结果图标锯齿问题

This commit is contained in:
metanoia1989 2020-11-30 22:44:25 +08:00
parent 736ede0742
commit 4315f04023
4 changed files with 55 additions and 7 deletions

@ -5,6 +5,7 @@
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QEventLoop>
#include <QPainter>
AppItem::AppItem(QWidget *parent) :
QWidget(parent),
@ -63,6 +64,7 @@ void AppItem::downloadIcon(QString icon)
reqManager->deleteLater();
QPixmap pixmap;
pixmap.loadFromData(reply->readAll());
qDebug() << "图标下载完毕:" << pixmap;
pixmap = pixmap.scaled(78, 78, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
if (reply->error() == QNetworkReply::NoError) {
QMetaObject::invokeMethod(this, "loadIcon", Qt::QueuedConnection,
@ -73,6 +75,7 @@ void AppItem::downloadIcon(QString icon)
void AppItem::loadIcon(QPixmap pic)
{
qDebug() << pic;
ui->lbl_icon->setPixmap(pic);
}

@ -6,13 +6,44 @@
<rect>
<x>0</x>
<y>0</y>
<width>300</width>
<height>100</height>
<width>331</width>
<height>131</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<property name="styleSheet">
<string notr="true">QWidget#AppItem {
width: 300px;
height: 100px;
margin: 15px;
color: #6d6d6d;
border-radius: 18px;
background-color: #F4F4F6;
}
QLabel#lbl_icon {
background: transparent;
border-radius: 10px;
}
QLabel#lbl_title {
text-align: left;
font-weight: lighter;
white-space: nowrap;
padding-right: 10px;
font-size: 19px;
}
QLabel#lbl_desc {
text-align: left;
font-weight: lighter;
white-space: nowrap;
font-size: 12px;
color: grey;
}</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="lbl_icon">
@ -30,6 +61,9 @@ padding: 10px;</string>
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
@ -42,6 +76,12 @@ padding: 10px;</string>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>50</height>
</size>
</property>
<property name="text">
<string/>
</property>
@ -55,6 +95,12 @@ padding: 10px;</string>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>50</height>
</size>
</property>
<property name="text">
<string/>
</property>

@ -312,7 +312,6 @@ void Widget::setTheme(bool isDark,QColor color)
if(ui->stackedWidget->currentIndex()==0){
chooseLeftMenu(nowMenu);
}
}
DTitlebar* Widget::getTitlebar()

@ -345,7 +345,7 @@
<number>0</number>
</property>
<property name="currentIndex">
<number>3</number>
<number>2</number>
</property>
<widget class="QWidget" name="page">
<layout class="QVBoxLayout" name="verticalLayout_4">
@ -1398,8 +1398,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>879</width>
<height>657</height>
<width>98</width>
<height>28</height>
</rect>
</property>
</widget>