Commit 1e4a5804 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Implement loadtoolbutton

parent d048f452
Pipeline #44509 canceled with stage
......@@ -34,5 +34,5 @@ void LoadGroupMenuTest::shouldHaveDefaultValues()
LoadGroupMenu m;
QVERIFY(m.isEmpty());
QVERIFY(!m.isEnabled());
//TODO
QVERIFY(!m.title().isEmpty());
}
......@@ -82,7 +82,7 @@ KDebugSettingsDialog::KDebugSettingsDialog(QWidget *parent)
LoadToolButton *load = new LoadToolButton(this);
load->setObjectName(QStringLiteral("load_button"));
buttonBox->addButton(load, QDialogButtonBox::ActionRole);
connect(load, &LoadToolButton::clicked, this, &KDebugSettingsDialog::slotLoad);
connect(load, &LoadToolButton::loadFromFile, this, &KDebugSettingsDialog::slotLoad);
connect(load, &LoadToolButton::loadGroupRequested, this, &KDebugSettingsDialog::slotLoadGroup);
QPushButton *insertCategories = new QPushButton(i18n("Insert..."), this);
......
......@@ -20,12 +20,15 @@
#include "loadgroupmenu.h"
#include <KLocalizedString>
#include <QDir>
#include <QStandardPaths>
LoadGroupMenu::LoadGroupMenu(QWidget *parent)
: QMenu(parent)
{
setTitle(i18n("Load Group"));
init();
}
......
......@@ -25,11 +25,18 @@
LoadToolButton::LoadToolButton(QWidget *parent)
: QToolButton(parent)
{
setPopupMode(QToolButton::InstantPopup);
setText(i18n("Load..."));
QMenu *mainMenu = new QMenu(this);
setMenu(mainMenu);
QAction *act = mainMenu->addAction(i18n("Load From File..."));
connect(act, &QAction::triggered, this, &LoadToolButton::loadFromFile);
LoadGroupMenu *loadMenu = new LoadGroupMenu(this);
loadMenu->setObjectName(QStringLiteral("loadMenu"));
connect(loadMenu, &LoadGroupMenu::loadGroupRequested, this, &LoadToolButton::loadGroupRequested);
setMenu(loadMenu);
mainMenu->addMenu(loadMenu);
}
LoadToolButton::~LoadToolButton()
......
......@@ -32,6 +32,7 @@ public:
~LoadToolButton() override;
Q_SIGNALS:
void loadGroupRequested(const QString &fullPath);
void loadFromFile();
};
#endif // LOADTOOLBUTTON_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment