Fix#135498 usd AddBtn of libukcc to repalce the Add Folder Button(origin is QPushButton).

This commit is contained in:
JunjieBai 2022-08-17 10:04:24 +08:00
parent aa425fe91b
commit 7c333778e9
2 changed files with 22 additions and 18 deletions

View File

@ -195,8 +195,9 @@ void Search::initUi()
m_addBlockDirFrame->setFrameShape(QFrame::Shape::NoFrame);
m_addBlockDirFrame->setFixedHeight(60);
m_addBlockDirWidget = new QPushButton(m_addBlockDirFrame);
m_addBlockDirWidget->setFixedHeight(60);
// m_addBlockDirWidget = new QPushButton(m_addBlockDirFrame);
m_addBlockDirWidget = new AddBtn(m_addBlockDirFrame);
// m_addBlockDirWidget->setFixedHeight(60);
// m_addBlockDirWidget->setObjectName("addBlockDirWidget");
// QPalette pal;
@ -212,27 +213,28 @@ void Search::initUi()
// HoverWidget:hover:!pressed#addBlockDirWidget{background: %1; \
// border-radius: 4px;}").arg(stringColor));
m_addBlockDirWidget->setProperty("useButtonPalette", true);
// m_addBlockDirWidget->setStyleSheet("QPushButton:!checked{background: palette(base);}");
m_addBlockDirWidget->setFlat(true);
//之前自己写的添加按钮目前方案用控制面板提供的AddBtn后面有变动再放出来(属性全都注掉了有问题找ukcc寻求帮助
// m_addBlockDirWidget->setProperty("useButtonPalette", true);
//// m_addBlockDirWidget->setStyleSheet("QPushButton:!checked{background: palette(base);}");
// m_addBlockDirWidget->setFlat(true);
m_addBlockDirIcon = new QLabel(m_addBlockDirWidget);
m_addBlockDirIcon->setPixmap(QIcon("/usr/share/ukui-search/search-ukcc-plugin/image/add.svg").pixmap(12, 12));
m_addBlockDirIcon->setProperty("useIconHighlightEffect", true);
m_addBlockDirIcon->setProperty("iconHighlightEffectMode", 1);
// m_addBlockDirIcon = new QLabel(m_addBlockDirWidget);
// m_addBlockDirIcon->setPixmap(QIcon("/usr/share/ukui-search/search-ukcc-plugin/image/add.svg").pixmap(12, 12));
// m_addBlockDirIcon->setProperty("useIconHighlightEffect", true);
// m_addBlockDirIcon->setProperty("iconHighlightEffectMode", 1);
m_addBlockDirLabel = new QLabel(m_addBlockDirWidget);
m_addBlockDirLabel->setText(tr("Choose folder"));
// m_addBlockDirLabel = new QLabel(m_addBlockDirWidget);
// m_addBlockDirLabel->setText(tr("Choose folder"));
m_addBlockDirLyt = new QHBoxLayout(m_addBlockDirWidget);
m_addBlockDirWidget->setLayout(m_addBlockDirLyt);
// m_addBlockDirLyt = new QHBoxLayout(m_addBlockDirWidget);
// m_addBlockDirWidget->setLayout(m_addBlockDirLyt);
m_blockDirsLyt->addWidget(m_addBlockDirWidget);
m_addBlockDirLyt->addStretch();
m_addBlockDirLyt->addWidget(m_addBlockDirIcon);
m_addBlockDirLyt->addWidget(m_addBlockDirLabel);
m_addBlockDirLyt->addStretch();
// m_addBlockDirLyt->addStretch();
// m_addBlockDirLyt->addWidget(m_addBlockDirIcon);
// m_addBlockDirLyt->addWidget(m_addBlockDirLabel);
// m_addBlockDirLyt->addStretch();
m_mainLyt->addSpacing(32);
m_mainLyt->addWidget(m_blockDirTitleLabel);
m_mainLyt->addWidget(m_blockDirDescLabel);

View File

@ -22,6 +22,7 @@
#include <ukcc/widgets/switchbutton.h>
#include <ukcc/widgets/comboxframe.h>
#include <ukcc/widgets/titlelabel.h>
#include <ukcc/widgets/addbtn.h>
#define UKUI_SEARCH_SCHEMAS "org.ukui.search.settings"
#define SEARCH_METHOD_KEY "fileIndexEnable"
@ -88,7 +89,8 @@ private:
QLabel * m_blockDirDescLabel = nullptr;
QFrame * m_blockDirsFrame = nullptr;
QVBoxLayout * m_blockDirsLyt = nullptr;
QPushButton * m_addBlockDirWidget = nullptr;
// QPushButton * m_addBlockDirWidget = nullptr;
AddBtn * m_addBlockDirWidget = nullptr;
QLabel * m_addBlockDirIcon = nullptr;
QLabel * m_addBlockDirLabel = nullptr;
QHBoxLayout * m_addBlockDirLyt = nullptr;