Commit b18e4fea authored by Tim Jenssen's avatar Tim Jenssen

QmlDesigner: remove unnecessary methods

Change-Id: I17d7b7141d677b1729ee61b59fdcc14d9c576f64
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@theqtcompany.com>
parent ef2f37f6
......@@ -117,28 +117,18 @@ QList<QToolButton *> ConnectionViewWidget::createToolBarWidgets()
buttons.last()->setIcon(QIcon(QStringLiteral(":/connectionview/plus.png")));
buttons.last()->setToolTip(tr("Add binding or connection."));
connect(buttons.last(), SIGNAL(clicked()), this, SLOT(addButtonClicked()));
connect(this, SIGNAL(setEnabledAddButtonChanged(bool)), buttons.last(), SLOT(setEnabled(bool)));
connect(this, SIGNAL(setEnabledAddButton(bool)), buttons.last(), SLOT(setEnabled(bool)));
buttons << new QToolButton();
buttons.last()->setIcon(QIcon(QStringLiteral(":/connectionview/minus.png")));
buttons.last()->setToolTip(tr("Remove selected binding or connection."));
buttons.last()->setShortcut(QKeySequence(Qt::Key_Delete));
connect(buttons.last(), SIGNAL(clicked()), this, SLOT(removeButtonClicked()));
connect(this, SIGNAL(setEnabledRemoveButtonChanged(bool)), buttons.last(), SLOT(setEnabled(bool)));
connect(this, SIGNAL(setEnabledRemoveButton(bool)), buttons.last(), SLOT(setEnabled(bool)));
return buttons;
}
void ConnectionViewWidget::setEnabledAddButton(bool enabled)
{
emit setEnabledAddButtonChanged(enabled);
}
void ConnectionViewWidget::setEnabledRemoveButton(bool enabled)
{
emit setEnabledRemoveButtonChanged(enabled);
}
ConnectionViewWidget::TabStatus ConnectionViewWidget::currentTab() const
{
switch (ui->stackedWidget->currentIndex()) {
......@@ -166,16 +156,16 @@ void ConnectionViewWidget::resetItemViews()
void ConnectionViewWidget::invalidateButtonStatus()
{
if (currentTab() == ConnectionTab) {
setEnabledRemoveButton(ui->connectionView->selectionModel()->hasSelection());
emit setEnabledRemoveButton(ui->connectionView->selectionModel()->hasSelection());
setEnabledAddButton(true);
} else if (currentTab() == BindingTab) {
setEnabledRemoveButton(ui->bindingView->selectionModel()->hasSelection());
emit setEnabledRemoveButton(ui->bindingView->selectionModel()->hasSelection());
BindingModel *bindingModel = qobject_cast<BindingModel*>(ui->bindingView->model());
setEnabledAddButton(bindingModel->connectionView()->model() &&
bindingModel->connectionView()->selectedModelNodes().count() == 1);
} else if (currentTab() == DynamicPropertiesTab) {
setEnabledRemoveButton(ui->dynamicPropertiesView->selectionModel()->hasSelection());
emit setEnabledRemoveButton(ui->dynamicPropertiesView->selectionModel()->hasSelection());
DynamicPropertiesModel *dynamicPropertiesModel = qobject_cast<DynamicPropertiesModel*>(ui->dynamicPropertiesView->model());
setEnabledAddButton(dynamicPropertiesModel->connectionView()->model() &&
dynamicPropertiesModel->connectionView()->selectedModelNodes().count() == 1);
......@@ -253,9 +243,9 @@ void ConnectionViewWidget::bindingTableViewSelectionChanged(const QModelIndex &c
{
if (currentTab() == BindingTab) {
if (current.isValid()) {
setEnabledRemoveButton(true);
emit setEnabledRemoveButton(true);
} else {
setEnabledRemoveButton(false);
emit setEnabledRemoveButton(false);
}
}
}
......@@ -264,9 +254,9 @@ void ConnectionViewWidget::connectionTableViewSelectionChanged(const QModelIndex
{
if (currentTab() == ConnectionTab) {
if (current.isValid()) {
setEnabledRemoveButton(true);
emit setEnabledRemoveButton(true);
} else {
setEnabledRemoveButton(false);
emit setEnabledRemoveButton(false);
}
}
}
......@@ -275,9 +265,9 @@ void ConnectionViewWidget::dynamicPropertiesTableViewSelectionChanged(const QMod
{
if (currentTab() == DynamicPropertiesTab) {
if (current.isValid()) {
setEnabledRemoveButton(true);
emit setEnabledRemoveButton(true);
} else {
setEnabledRemoveButton(false);
emit setEnabledRemoveButton(false);
}
}
}
......
......@@ -65,9 +65,6 @@ public:
QList<QToolButton*> createToolBarWidgets();
void setEnabledAddButton(bool enabled);
void setEnabledRemoveButton(bool enabled);
TabStatus currentTab() const;
void resetItemViews();
......@@ -83,8 +80,8 @@ public slots:
void dynamicPropertiesTableViewSelectionChanged(const QModelIndex &current, const QModelIndex &previous);
signals:
void setEnabledAddButtonChanged(bool);
void setEnabledRemoveButtonChanged(bool);
void setEnabledAddButton(bool enabled);
void setEnabledRemoveButton(bool enabled);
private slots:
void handleTabChanged(int i);
......
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