UI: Fix icon tool buttons

This commit is contained in:
Nodir Temirkhodjaev 2023-12-28 10:30:36 +03:00
parent 2a6a22ed4b
commit 686e1f1af0
3 changed files with 15 additions and 9 deletions

View File

@ -27,10 +27,8 @@ void AppInfoRow::setupUi()
auto layout = new QHBoxLayout(); auto layout = new QHBoxLayout();
layout->setContentsMargins(0, 0, 0, 0); layout->setContentsMargins(0, 0, 0, 0);
m_btAppCopyPath = m_btAppCopyPath = ControlUtil::createIconToolButton(":/icons/page_copy.png");
ControlUtil::createFlatToolButton(":/icons/page_copy.png", Qt::ToolButtonIconOnly); m_btAppOpenFolder = ControlUtil::createIconToolButton(":/icons/folder.png");
m_btAppOpenFolder =
ControlUtil::createFlatToolButton(":/icons/folder.png", Qt::ToolButtonIconOnly);
m_lineAppPath = ControlUtil::createLineLabel(); m_lineAppPath = ControlUtil::createLineLabel();

View File

@ -123,10 +123,10 @@ QToolButton *ControlUtil::createToolButton(
return c; return c;
} }
QToolButton *ControlUtil::createFlatToolButton(const QString &iconPath, Qt::ToolButtonStyle style) QToolButton *ControlUtil::createFlatToolButton(const QString &iconPath)
{ {
auto c = createToolButton(iconPath); auto c = createToolButton(iconPath);
c->setToolButtonStyle(style); c->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
c->setCursor(Qt::PointingHandCursor); c->setCursor(Qt::PointingHandCursor);
c->setAutoRaise(true); c->setAutoRaise(true);
c->setFocusPolicy(Qt::TabFocus); c->setFocusPolicy(Qt::TabFocus);
@ -143,11 +143,18 @@ QToolButton *ControlUtil::createFlatToolButton(
return c; return c;
} }
QToolButton *ControlUtil::createIconToolButton(const QString &iconPath)
{
auto c = createFlatToolButton(iconPath);
c->setToolButtonStyle(Qt::ToolButtonIconOnly);
return c;
}
QToolButton *ControlUtil::createSplitterButton( QToolButton *ControlUtil::createSplitterButton(
const QString &iconPath, const std::function<void()> &onClicked) const QString &iconPath, const std::function<void()> &onClicked)
{ {
auto c = createFlatToolButton(iconPath, onClicked); auto c = createFlatToolButton(iconPath, onClicked);
c->setCursor(Qt::ArrowCursor); c->setToolButtonStyle(Qt::ToolButtonIconOnly);
c->setFixedSize(32, 32); c->setFixedSize(32, 32);
return c; return c;
} }

View File

@ -50,11 +50,12 @@ public:
static QToolButton *createToolButton( static QToolButton *createToolButton(
const QString &iconPath, const std::function<void()> &onClicked); const QString &iconPath, const std::function<void()> &onClicked);
static QToolButton *createFlatToolButton( static QToolButton *createFlatToolButton(const QString &iconPath);
const QString &iconPath, Qt::ToolButtonStyle style = Qt::ToolButtonTextBesideIcon);
static QToolButton *createFlatToolButton( static QToolButton *createFlatToolButton(
const QString &iconPath, const std::function<void()> &onClicked); const QString &iconPath, const std::function<void()> &onClicked);
static QToolButton *createIconToolButton(const QString &iconPath);
static QToolButton *createSplitterButton( static QToolButton *createSplitterButton(
const QString &iconPath, const std::function<void()> &onClicked); const QString &iconPath, const std::function<void()> &onClicked);