forked from qt-creator/qt-creator
Utils: Un-export TreeViewComboBoxView
It's only used as QTreeView in user code. Change-Id: I1db77e6a5acc6b6feec914a025c403e74cb6cef2 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -5,21 +5,23 @@
|
||||
|
||||
#include <QWheelEvent>
|
||||
|
||||
using namespace Utils;
|
||||
namespace Utils {
|
||||
|
||||
TreeViewComboBoxView::TreeViewComboBoxView(QWidget *parent)
|
||||
: QTreeView(parent)
|
||||
class TreeViewComboBoxView final : public QTreeView
|
||||
{
|
||||
// TODO: Disable the root for all items (with a custom delegate?)
|
||||
setRootIsDecorated(false);
|
||||
}
|
||||
|
||||
void TreeViewComboBoxView::adjustWidth(int width)
|
||||
{
|
||||
setMaximumWidth(width);
|
||||
setMinimumWidth(qMin(qMax(sizeHintForColumn(0), minimumSizeHint().width()), width));
|
||||
}
|
||||
public:
|
||||
TreeViewComboBoxView()
|
||||
{
|
||||
// TODO: Disable the root for all items (with a custom delegate?)
|
||||
setRootIsDecorated(false);
|
||||
}
|
||||
|
||||
void adjustWidth(int width)
|
||||
{
|
||||
setMaximumWidth(width);
|
||||
setMinimumWidth(qMin(qMax(sizeHintForColumn(0), minimumSizeHint().width()), width));
|
||||
}
|
||||
};
|
||||
|
||||
TreeViewComboBox::TreeViewComboBox(QWidget *parent)
|
||||
: QComboBox(parent)
|
||||
@@ -135,7 +137,9 @@ void TreeViewComboBox::hidePopup()
|
||||
QComboBox::hidePopup();
|
||||
}
|
||||
|
||||
TreeViewComboBoxView *TreeViewComboBox::view() const
|
||||
QTreeView *TreeViewComboBox::view() const
|
||||
{
|
||||
return m_view;
|
||||
}
|
||||
|
||||
} // Utils
|
||||
|
@@ -10,13 +10,6 @@
|
||||
|
||||
namespace Utils {
|
||||
|
||||
class QTCREATOR_UTILS_EXPORT TreeViewComboBoxView : public QTreeView
|
||||
{
|
||||
public:
|
||||
TreeViewComboBoxView(QWidget *parent = nullptr);
|
||||
void adjustWidth(int width);
|
||||
};
|
||||
|
||||
class QTCREATOR_UTILS_EXPORT TreeViewComboBox : public QComboBox
|
||||
{
|
||||
public:
|
||||
@@ -29,14 +22,15 @@ public:
|
||||
void showPopup() override;
|
||||
void hidePopup() override;
|
||||
|
||||
TreeViewComboBoxView *view() const;
|
||||
QTreeView *view() const;
|
||||
|
||||
private:
|
||||
QModelIndex indexBelow(QModelIndex index);
|
||||
QModelIndex indexAbove(QModelIndex index);
|
||||
QModelIndex lastIndex(const QModelIndex &index);
|
||||
|
||||
TreeViewComboBoxView *m_view;
|
||||
class TreeViewComboBoxView *m_view;
|
||||
bool m_skipNextHide = false;
|
||||
};
|
||||
}
|
||||
|
||||
} // Utils
|
||||
|
Reference in New Issue
Block a user