forked from qt-creator/qt-creator
BaseTreeView: Make resizeColumns() publicly accessible
Simplifies the only used code path through the model and a custom signal. Change-Id: I9bbab725cdd122b7261a8f14b101786e38e61e57 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -47,8 +47,6 @@ const char ColumnKey[] = "Columns";
|
||||
|
||||
class BaseTreeViewPrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BaseTreeViewPrivate(BaseTreeView *parent)
|
||||
: q(parent), m_settings(0), m_expectUserChanges(false), m_progressIndicator(0)
|
||||
@@ -169,7 +167,7 @@ public:
|
||||
return minimum;
|
||||
}
|
||||
|
||||
Q_SLOT void resizeColumns() // Needs moc, see BaseTreeView::setModel
|
||||
void resizeColumns()
|
||||
{
|
||||
QHeaderView *h = q->header();
|
||||
QTC_ASSERT(h, return);
|
||||
@@ -281,7 +279,6 @@ void BaseTreeView::setModel(QAbstractItemModel *m)
|
||||
};
|
||||
#define DESC(sign, receiver, slot) { #sign, SIGNAL(sign), receiver, SLOT(slot) }
|
||||
const ExtraConnection c[] = {
|
||||
DESC(columnAdjustmentRequested(), d, resizeColumns()),
|
||||
DESC(requestExpansion(QModelIndex), this, expand(QModelIndex))
|
||||
};
|
||||
#undef DESC
|
||||
@@ -406,6 +403,11 @@ void BaseTreeView::rowClicked(const QModelIndex &index)
|
||||
model()->setData(index, QVariant(), ItemClickedRole);
|
||||
}
|
||||
|
||||
void BaseTreeView::resizeColumns()
|
||||
{
|
||||
d->resizeColumns();
|
||||
}
|
||||
|
||||
void BaseTreeView::setSettings(QSettings *settings, const QByteArray &key)
|
||||
{
|
||||
QTC_ASSERT(!d->m_settings, qDebug() << "DUPLICATED setSettings" << key);
|
||||
@@ -454,5 +456,3 @@ QModelIndexList ItemViewEvent::currentOrSelectedRows() const
|
||||
}
|
||||
|
||||
} // namespace Utils
|
||||
|
||||
#include "basetreeview.moc"
|
||||
|
||||
@@ -70,6 +70,7 @@ public:
|
||||
|
||||
void showProgressIndicator();
|
||||
void hideProgressIndicator();
|
||||
void resizeColumns();
|
||||
|
||||
signals:
|
||||
void aboutToShow();
|
||||
|
||||
@@ -3154,6 +3154,7 @@ void updateWatchersWindow(bool showWatch, bool showReturn)
|
||||
{
|
||||
dd->m_watchersWindow->setVisible(showWatch);
|
||||
dd->m_returnWindow->setVisible(showReturn);
|
||||
dd->m_localsView->resizeColumns();
|
||||
}
|
||||
|
||||
bool hasSnapshots()
|
||||
|
||||
@@ -1126,7 +1126,7 @@ bool WatchModel::setData(const QModelIndex &idx, const QVariant &value, int role
|
||||
m_expandedINames.remove(item->iname);
|
||||
}
|
||||
if (item->iname.contains('.'))
|
||||
emit columnAdjustmentRequested();
|
||||
m_handler->updateWatchersWindow();
|
||||
return true;
|
||||
|
||||
case LocalsTypeFormatRole:
|
||||
@@ -2347,8 +2347,6 @@ void WatchModel::clearWatches()
|
||||
|
||||
void WatchHandler::updateWatchersWindow()
|
||||
{
|
||||
emit m_model->columnAdjustmentRequested();
|
||||
|
||||
// Force show/hide of watchers and return view.
|
||||
int showWatch = !theWatcherNames.isEmpty();
|
||||
int showReturn = m_model->m_returnRoot->childCount() != 0;
|
||||
|
||||
@@ -50,7 +50,6 @@ signals:
|
||||
void currentIndexRequested(const QModelIndex &idx);
|
||||
void itemIsExpanded(const QModelIndex &idx);
|
||||
void inameIsExpanded(const QString &iname);
|
||||
void columnAdjustmentRequested();
|
||||
void updateStarted();
|
||||
void updateFinished();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user