timeline: implemented adding objects in the timeline (e.g. solid, title)
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include <QButtonGroup>
|
||||
#include <QEvent>
|
||||
|
||||
#include "widget/menu/menu.h"
|
||||
#include "ui/icons/icons.h"
|
||||
|
||||
Toolbar::Toolbar(QWidget *parent) :
|
||||
@@ -49,7 +50,10 @@ Toolbar::Toolbar(QWidget *parent) :
|
||||
|
||||
// Create snapping button, which is not actually a tool, it's a toggle option
|
||||
btn_snapping_toggle_ = CreateNonToolButton();
|
||||
connect(btn_snapping_toggle_, SIGNAL(clicked(bool)), this, SLOT(SnappingButtonClicked(bool)));
|
||||
connect(btn_snapping_toggle_, &QPushButton::clicked, this, &Toolbar::SnappingButtonClicked);
|
||||
|
||||
// Connect add button to menu signal
|
||||
connect(btn_add_, &QPushButton::clicked, this, &Toolbar::AddButtonClicked);
|
||||
|
||||
Retranslate();
|
||||
UpdateIcons();
|
||||
@@ -160,3 +164,22 @@ void Toolbar::SnappingButtonClicked(bool b)
|
||||
{
|
||||
emit SnappingChanged(b);
|
||||
}
|
||||
|
||||
void Toolbar::AddButtonClicked()
|
||||
{
|
||||
QMenu m(this);
|
||||
|
||||
for (int i=0;i<Tool::kAddableCount;i++) {
|
||||
QAction* action = m.addAction(Tool::GetAddableObjectName(static_cast<Tool::AddableObject>(i)));
|
||||
action->setData(i);
|
||||
}
|
||||
|
||||
connect(&m, &QMenu::triggered, this, &Toolbar::AddMenuItemTriggered);
|
||||
|
||||
m.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
void Toolbar::AddMenuItemTriggered(QAction* a)
|
||||
{
|
||||
emit AddableObjectChanged(static_cast<Tool::AddableObject>(a->data().toInt()));
|
||||
}
|
||||
|
||||
@@ -106,6 +106,11 @@ signals:
|
||||
*/
|
||||
void SnappingChanged(const bool& b);
|
||||
|
||||
/**
|
||||
* @brief Emitted when the addable object is changed from the add tool menu
|
||||
*/
|
||||
void AddableObjectChanged(const Tool::AddableObject& obj);
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Reset all strings based on the currently selected language
|
||||
@@ -195,6 +200,19 @@ private slots:
|
||||
* The new snapping value received from the sender's clicked signal
|
||||
*/
|
||||
void SnappingButtonClicked(bool b);
|
||||
|
||||
/**
|
||||
* @brief Receiver for the add button
|
||||
*
|
||||
* The add button pops up a list for which object to create.
|
||||
*/
|
||||
void AddButtonClicked();
|
||||
|
||||
/**
|
||||
* @brief Receiver for the menu created by AddButtonClicked()
|
||||
*/
|
||||
void AddMenuItemTriggered(QAction* a);
|
||||
|
||||
};
|
||||
|
||||
#endif // TOOLBAR_H
|
||||
|
||||
Reference in New Issue
Block a user