Browse Source

Allow user to add a label to a custom widget

QGC4.4
John Tapsell 12 years ago
parent
commit
ca68c1e93a
  1. 12
      src/ui/designer/QGCToolWidget.cc
  2. 2
      src/ui/designer/QGCToolWidget.h

12
src/ui/designer/QGCToolWidget.cc

@ -518,6 +518,10 @@ void QGCToolWidget::createActions() @@ -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() @@ -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)

2
src/ui/designer/QGCToolWidget.h

@ -74,6 +74,7 @@ protected: @@ -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: @@ -99,6 +100,7 @@ public slots:
protected slots:
void addParam();
void addCommand();
void addLabel();
void setTitle();
void setWindowTitle(const QString& title);

Loading…
Cancel
Save