Merge pull request #261 from iaom/0531-dev-main
Make a slight adjustment to the UI.
This commit is contained in:
commit
5cbb5008c6
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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))));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue