mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-11 19:58:49 -05:00
Switch QPushButton to QToolButton
This will be more consistent with the widget styles used throughout OBS and solves a few layout issues
This commit is contained in:
44
lib/utils/list-controls.cpp
Normal file
44
lib/utils/list-controls.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
#include "list-controls.hpp"
|
||||
#include "obs-module-helper.hpp"
|
||||
#include "ui-helpers.hpp"
|
||||
|
||||
#include <QLayout>
|
||||
#include <QToolButton>
|
||||
|
||||
namespace advss {
|
||||
|
||||
ListControls::ListControls(QWidget *parent, bool reorder) : QToolBar(parent)
|
||||
{
|
||||
setObjectName("listControls");
|
||||
setStyleSheet("#listControls { background-color: transparent; }");
|
||||
|
||||
setIconSize({16, 16});
|
||||
|
||||
AddActionHelper("addIconSmall", "AdvSceneSwitcher.listControls.add",
|
||||
[this]() { Add(); });
|
||||
AddActionHelper("removeIconSmall",
|
||||
"AdvSceneSwitcher.listControls.remove",
|
||||
[this]() { Remove(); });
|
||||
|
||||
if (reorder) {
|
||||
addSeparator();
|
||||
AddActionHelper("upArrowIconSmall",
|
||||
"AdvSceneSwitcher.listControls.up",
|
||||
[this]() { Up(); });
|
||||
AddActionHelper("downArrowIconSmall",
|
||||
"AdvSceneSwitcher.listControls.down",
|
||||
[this]() { Down(); });
|
||||
}
|
||||
}
|
||||
|
||||
void ListControls::AddActionHelper(const char *theme, const char *tooltip,
|
||||
const std::function<void()> &signal)
|
||||
{
|
||||
auto button = new QToolButton(this);
|
||||
button->setToolTip(obs_module_text(tooltip));
|
||||
button->setProperty("themeID", QVariant(QString(theme)));
|
||||
auto action = addWidget(button);
|
||||
button->connect(button, &QToolButton::clicked, this, signal);
|
||||
}
|
||||
|
||||
} // namespace advss
|
||||
Reference in New Issue
Block a user