Commit ca68c1e9 authored by John Tapsell's avatar John Tapsell

Allow user to add a label to a custom widget

parent 9143c8c5
......@@ -518,6 +518,10 @@ void QGCToolWidget::createActions()
addCommandAction->setStatusTip(tr("Add a new action button to the tool"));
connect(addCommandAction, SIGNAL(triggered()), this, SLOT(addCommand()));
addLabelAction = new QAction(tr("New &Text Label"), this);
addLabelAction->setStatusTip(tr("Add a new label to the tool"));
connect(addLabelAction, SIGNAL(triggered()), this, SLOT(addLabel()));
setTitleAction = new QAction(tr("Set Widget Title"), this);
setTitleAction->setStatusTip(tr("Set the title caption of this tool widget"));
connect(setTitleAction, SIGNAL(triggered()), this, SLOT(setTitle()));
......@@ -591,6 +595,14 @@ void QGCToolWidget::addCommand()
button->startEditMode();
}
void QGCToolWidget::addLabel()
{
QGCTextLabel* label= new QGCTextLabel(this);
connect(label, SIGNAL(destroyed()), this, SLOT(storeSettings()));
toolLayout->addWidget(label);
label->startEditMode();
}
void QGCToolWidget::addToolWidget(QGCToolWidgetItem* widget)
{
if (ui->hintLabel)
......
......@@ -74,6 +74,7 @@ protected:
QVariantMap settingsMap;
QAction* addParamAction;
QAction* addCommandAction;
QAction* addLabelAction;
QAction* setTitleAction;
QAction* deleteAction;
QAction* exportAction;
......@@ -99,6 +100,7 @@ public slots:
protected slots:
void addParam();
void addCommand();
void addLabel();
void setTitle();
void setWindowTitle(const QString& title);
......
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