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>
|
#include <QWheelEvent>
|
||||||
|
|
||||||
using namespace Utils;
|
namespace Utils {
|
||||||
|
|
||||||
TreeViewComboBoxView::TreeViewComboBoxView(QWidget *parent)
|
class TreeViewComboBoxView final : public QTreeView
|
||||||
: QTreeView(parent)
|
|
||||||
{
|
{
|
||||||
// TODO: Disable the root for all items (with a custom delegate?)
|
public:
|
||||||
setRootIsDecorated(false);
|
TreeViewComboBoxView()
|
||||||
}
|
{
|
||||||
|
// TODO: Disable the root for all items (with a custom delegate?)
|
||||||
void TreeViewComboBoxView::adjustWidth(int width)
|
setRootIsDecorated(false);
|
||||||
{
|
}
|
||||||
setMaximumWidth(width);
|
|
||||||
setMinimumWidth(qMin(qMax(sizeHintForColumn(0), minimumSizeHint().width()), width));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
void adjustWidth(int width)
|
||||||
|
{
|
||||||
|
setMaximumWidth(width);
|
||||||
|
setMinimumWidth(qMin(qMax(sizeHintForColumn(0), minimumSizeHint().width()), width));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
TreeViewComboBox::TreeViewComboBox(QWidget *parent)
|
TreeViewComboBox::TreeViewComboBox(QWidget *parent)
|
||||||
: QComboBox(parent)
|
: QComboBox(parent)
|
||||||
@@ -135,7 +137,9 @@ void TreeViewComboBox::hidePopup()
|
|||||||
QComboBox::hidePopup();
|
QComboBox::hidePopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
TreeViewComboBoxView *TreeViewComboBox::view() const
|
QTreeView *TreeViewComboBox::view() const
|
||||||
{
|
{
|
||||||
return m_view;
|
return m_view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // Utils
|
||||||
|
@@ -10,13 +10,6 @@
|
|||||||
|
|
||||||
namespace Utils {
|
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
|
class QTCREATOR_UTILS_EXPORT TreeViewComboBox : public QComboBox
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -29,14 +22,15 @@ public:
|
|||||||
void showPopup() override;
|
void showPopup() override;
|
||||||
void hidePopup() override;
|
void hidePopup() override;
|
||||||
|
|
||||||
TreeViewComboBoxView *view() const;
|
QTreeView *view() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QModelIndex indexBelow(QModelIndex index);
|
QModelIndex indexBelow(QModelIndex index);
|
||||||
QModelIndex indexAbove(QModelIndex index);
|
QModelIndex indexAbove(QModelIndex index);
|
||||||
QModelIndex lastIndex(const QModelIndex &index);
|
QModelIndex lastIndex(const QModelIndex &index);
|
||||||
|
|
||||||
TreeViewComboBoxView *m_view;
|
class TreeViewComboBoxView *m_view;
|
||||||
bool m_skipNextHide = false;
|
bool m_skipNextHide = false;
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
} // Utils
|
||||||
|
Reference in New Issue
Block a user