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:
hjk
2024-12-02 14:51:00 +01:00
parent 3690bef597
commit 05724a2d46
2 changed files with 21 additions and 23 deletions

View File

@@ -5,21 +5,23 @@
#include <QWheelEvent>
using namespace Utils;
namespace Utils {
TreeViewComboBoxView::TreeViewComboBoxView(QWidget *parent)
: QTreeView(parent)
class TreeViewComboBoxView final : public QTreeView
{
public:
TreeViewComboBoxView()
{
// TODO: Disable the root for all items (with a custom delegate?)
setRootIsDecorated(false);
}
}
void TreeViewComboBoxView::adjustWidth(int width)
{
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

View File

@@ -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