mirror of
https://github.com/MultiMC/MultiMC5.git
synced 2024-10-06 06:50:16 +00:00
NOISSUE Hide the join world buttons properly
This also fixes `QAction::setVisible` not working correctly in other parts of the codebase
This commit is contained in:
parent
1ad3e4417f
commit
5ff03584a5
@ -320,12 +320,6 @@ void WorldListPage::worldChanged(const QModelIndex ¤t, const QModelIndex &
|
|||||||
bool enable = index.isValid();
|
bool enable = index.isValid();
|
||||||
ui->actionJoin->setVisible(enableJoinActions);
|
ui->actionJoin->setVisible(enableJoinActions);
|
||||||
ui->actionJoinOffline->setVisible(enableJoinActions);
|
ui->actionJoinOffline->setVisible(enableJoinActions);
|
||||||
// The above lines will only hide the actions from the right click menu, to hide them from the toolbar we need to do this.
|
|
||||||
// If any more actions are added above the Join/Join Offline actions, these indices will need to be updated!
|
|
||||||
ui->toolBar->actions().at(2)->setVisible(enableJoinActions);
|
|
||||||
ui->toolBar->actions().at(3)->setVisible(enableJoinActions);
|
|
||||||
// Also disable the separator so there aren't 2 separators in a row
|
|
||||||
ui->toolBar->actions().at(4)->setVisible(enableJoinActions);
|
|
||||||
ui->actionJoin->setEnabled(enable && enableJoinActions);
|
ui->actionJoin->setEnabled(enable && enableJoinActions);
|
||||||
ui->actionJoinOffline->setEnabled(enable && enableJoinActions);
|
ui->actionJoinOffline->setEnabled(enable && enableJoinActions);
|
||||||
ui->actionCopy_Seed->setEnabled(enable);
|
ui->actionCopy_Seed->setEnabled(enable);
|
||||||
|
@ -81,9 +81,8 @@
|
|||||||
</attribute>
|
</attribute>
|
||||||
<addaction name="actionAdd"/>
|
<addaction name="actionAdd"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionJoin" />
|
<addaction name="actionJoin"/>
|
||||||
<addaction name="actionJoinOffline" />
|
<addaction name="actionJoinOffline"/>
|
||||||
<addaction name="separator" />
|
|
||||||
<addaction name="actionRename"/>
|
<addaction name="actionRename"/>
|
||||||
<addaction name="actionCopy"/>
|
<addaction name="actionCopy"/>
|
||||||
<addaction name="actionRemove"/>
|
<addaction name="actionRemove"/>
|
||||||
|
@ -20,7 +20,6 @@ private slots:
|
|||||||
setText(m_action->text());
|
setText(m_action->text());
|
||||||
setIcon(m_action->icon());
|
setIcon(m_action->icon());
|
||||||
setToolTip(m_action->toolTip());
|
setToolTip(m_action->toolTip());
|
||||||
setHidden(!m_action->isVisible());
|
|
||||||
setFocusPolicy(Qt::NoFocus);
|
setFocusPolicy(Qt::NoFocus);
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
@ -63,6 +62,9 @@ void WideBar::addAction(QAction* action)
|
|||||||
{
|
{
|
||||||
auto entry = new BarEntry();
|
auto entry = new BarEntry();
|
||||||
entry->qAction = addWidget(new ActionButton(action, this));
|
entry->qAction = addWidget(new ActionButton(action, this));
|
||||||
|
connect(action, &QAction::changed, entry->qAction, [entry, action](){
|
||||||
|
entry->qAction->setVisible(action->isVisible());
|
||||||
|
});
|
||||||
entry->wideAction = action;
|
entry->wideAction = action;
|
||||||
entry->type = BarEntry::Action;
|
entry->type = BarEntry::Action;
|
||||||
m_entries.push_back(entry);
|
m_entries.push_back(entry);
|
||||||
|
Loading…
Reference in New Issue
Block a user