diff --git a/src/content-widget.cpp b/src/content-widget.cpp index e289b41..7892a78 100644 --- a/src/content-widget.cpp +++ b/src/content-widget.cpp @@ -52,6 +52,7 @@ ContentWidget::~ContentWidget() { * @brief initUI 初始化homepage和resultpage */ void ContentWidget::initUI() { + this->setFixedHeight(486); QPalette pal = palette(); pal.setColor(QPalette::Base, QColor(0, 0, 0, 0)); pal.setColor(QPalette::Window, QColor(0, 0, 0, 0)); //使用此palette的窗口背景将为透明 @@ -71,7 +72,7 @@ void ContentWidget::initUI() { m_resultDetailArea = new QScrollArea(m_resultPage); m_resultDetailArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_resultDetailArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); - m_resultListArea->setFixedWidth(244); + m_resultListArea->setFixedWidth(280); m_resultPageLyt->addWidget(m_resultListArea); m_resultPageLyt->addWidget(m_resultDetailArea); m_resultPage->setLayout(m_resultPageLyt); @@ -80,7 +81,7 @@ void ContentWidget::initUI() { m_resultDetail = new QWidget(m_resultDetailArea); m_listLyt = new QVBoxLayout(m_resultList); m_detailLyt = new QVBoxLayout(m_resultDetail); - m_resultList->setFixedWidth(236); + m_resultList->setFixedWidth(280); m_resultList->setFixedHeight(0); m_listLyt->setContentsMargins(0, 0, 12, 0); m_listLyt->setSpacing(0); diff --git a/src/control/highlight-item-delegate.cpp b/src/control/highlight-item-delegate.cpp index c57e1e3..0cbc39a 100644 --- a/src/control/highlight-item-delegate.cpp +++ b/src/control/highlight-item-delegate.cpp @@ -53,7 +53,7 @@ void HighlightItemDelegate::paint(QPainter * painter, const QStyleOptionViewItem ctx.palette.setColor(QPalette::Text, optionV4.palette.color(QPalette::Active, QPalette::HighlightedText)); QRect textRect = style->subElementRect(QStyle::SE_ItemViewItemText, &optionV4); - textRect.adjust(0, -5, 0, 0); +// textRect.adjust(0, 0, 0, 0); painter->save(); painter->translate(textRect.topLeft()); painter->setClipRect(textRect.translated(-textRect.topLeft())); @@ -174,3 +174,10 @@ void HighlightItemDelegate::setSearchKeyword(const QString ®FindKeyWords) { m_regFindKeyWords.clear(); m_regFindKeyWords = regFindKeyWords; } + +QSize HighlightItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const +{ + QSize size = QStyledItemDelegate::sizeHint(option,index); + size.setHeight(size.height() + 10); + return size; +} diff --git a/src/control/highlight-item-delegate.h b/src/control/highlight-item-delegate.h index cc71b72..01caa2e 100644 --- a/src/control/highlight-item-delegate.h +++ b/src/control/highlight-item-delegate.h @@ -30,6 +30,8 @@ class HighlightItemDelegate : public QStyledItemDelegate { public: explicit HighlightItemDelegate(QObject *parent = nullptr); void setSearchKeyword(const QString &); +protected: + QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; private: QString m_regFindKeyWords = 0; void paint(QPainter *, const QStyleOptionViewItem &, const QModelIndex &) const override; diff --git a/src/control/search-detail-view.cpp b/src/control/search-detail-view.cpp index 09bac26..0a55b16 100644 --- a/src/control/search-detail-view.cpp +++ b/src/control/search-detail-view.cpp @@ -487,7 +487,7 @@ void SearchDetailView::initUI() { //图标和名称、分割线区域 m_iconLabel = new QLabel(this); m_iconLabel->setAlignment(Qt::AlignCenter); - m_iconLabel->setFixedHeight(120); + m_iconLabel->setFixedHeight(128); m_nameFrame = new QFrame(this); m_nameLayout = new QHBoxLayout(m_nameFrame); m_nameLabel = new QLabel(m_nameFrame); @@ -596,13 +596,13 @@ void SearchDetailView::setIcon(const QString &path, const bool &installed) icon = QIcon::fromTheme(path); } } - m_iconLabel->setPixmap(icon.pixmap(icon.actualSize(QSize(96, 96)))); + m_iconLabel->setPixmap(icon.pixmap(icon.actualSize(QSize(128, 128)))); } else if (m_type == SearchListView::ResType::Setting) { QIcon icon = FileUtils::getSettingIcon(path, true); - m_iconLabel->setPixmap(icon.pixmap(icon.actualSize(QSize(96, 96)))); + m_iconLabel->setPixmap(icon.pixmap(icon.actualSize(QSize(128, 128)))); } else { QIcon icon = FileUtils::getFileIcon(QUrl::fromLocalFile(path).toString()); - m_iconLabel->setPixmap(icon.pixmap(icon.actualSize(QSize(96, 96)))); + m_iconLabel->setPixmap(icon.pixmap(icon.actualSize(QSize(128, 128)))); } } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 2863b07..2c593da 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -174,7 +174,7 @@ MainWindow::~MainWindow() { * 设置本窗口的大小 this->setFixedSize(640, 640); */ void MainWindow::initUi() { - this->setFixedSize(640, 590); + this->setFixedSize(680, 590); m_frame = new QFrame(this);