forked from qt-creator/qt-creator
Git: Resize columns in branches dialog when data is changed
When setting a tracking branch, creating or deleting a branch. Change-Id: I58dd06912fbf23900674a8714224ee414f1da4b7 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
3d63136836
commit
53c4b36e4a
@@ -88,6 +88,9 @@ BranchDialog::BranchDialog(QWidget *parent) :
|
||||
|
||||
connect(m_ui->branchView->selectionModel(), &QItemSelectionModel::selectionChanged,
|
||||
this, &BranchDialog::enableButtons);
|
||||
connect(m_model, &QAbstractItemModel::dataChanged, this, &BranchDialog::resizeColumns);
|
||||
connect(m_model, &QAbstractItemModel::rowsInserted, this, &BranchDialog::resizeColumns);
|
||||
connect(m_model, &QAbstractItemModel::rowsRemoved, this, &BranchDialog::resizeColumns);
|
||||
|
||||
enableButtons();
|
||||
}
|
||||
@@ -109,8 +112,7 @@ void BranchDialog::refresh(const QString &repository, bool force)
|
||||
VcsOutputWindow::appendError(errorMessage);
|
||||
|
||||
m_ui->branchView->expandAll();
|
||||
m_ui->branchView->resizeColumnToContents(0);
|
||||
m_ui->branchView->resizeColumnToContents(1);
|
||||
resizeColumns();
|
||||
}
|
||||
|
||||
void BranchDialog::refreshIfSame(const QString &repository)
|
||||
@@ -119,6 +121,12 @@ void BranchDialog::refreshIfSame(const QString &repository)
|
||||
refreshCurrentRepository();
|
||||
}
|
||||
|
||||
void BranchDialog::resizeColumns()
|
||||
{
|
||||
m_ui->branchView->resizeColumnToContents(0);
|
||||
m_ui->branchView->resizeColumnToContents(1);
|
||||
}
|
||||
|
||||
void BranchDialog::enableButtons()
|
||||
{
|
||||
QModelIndex idx = selectedIndex();
|
||||
|
@@ -52,11 +52,11 @@ public:
|
||||
explicit BranchDialog(QWidget *parent = 0);
|
||||
~BranchDialog() override;
|
||||
|
||||
public slots:
|
||||
void refresh(const QString &repository, bool force);
|
||||
void refreshIfSame(const QString &repository);
|
||||
|
||||
private:
|
||||
void resizeColumns();
|
||||
void enableButtons();
|
||||
void refreshCurrentRepository();
|
||||
void add();
|
||||
|
Reference in New Issue
Block a user