|
@@ -50,6 +50,7 @@ public:
|
|
bool RootSet;
|
|
bool RootSet;
|
|
bool SendCurrentItem;
|
|
bool SendCurrentItem;
|
|
QPersistentModelIndex Root;
|
|
QPersistentModelIndex Root;
|
|
|
|
+ int VisibleModelColumn;
|
|
};
|
|
};
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
// -------------------------------------------------------------------------
|
|
@@ -59,6 +60,7 @@ ctkTreeComboBoxPrivate::ctkTreeComboBoxPrivate(ctkTreeComboBox& object)
|
|
this->SkipNextHide = false;
|
|
this->SkipNextHide = false;
|
|
this->RootSet = false;
|
|
this->RootSet = false;
|
|
this->SendCurrentItem = false;
|
|
this->SendCurrentItem = false;
|
|
|
|
+ this->VisibleModelColumn = -1; // all visible by default
|
|
}
|
|
}
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
// -------------------------------------------------------------------------
|
|
@@ -90,6 +92,20 @@ ctkTreeComboBox::~ctkTreeComboBox()
|
|
}
|
|
}
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
// -------------------------------------------------------------------------
|
|
|
|
+int ctkTreeComboBox::visibleModelColumn()const
|
|
|
|
+{
|
|
|
|
+ Q_D(const ctkTreeComboBox);
|
|
|
|
+ return d->VisibleModelColumn;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// -------------------------------------------------------------------------
|
|
|
|
+void ctkTreeComboBox::setVisibleModelColumn(int index)
|
|
|
|
+{
|
|
|
|
+ Q_D(ctkTreeComboBox);
|
|
|
|
+ d->VisibleModelColumn = index;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// -------------------------------------------------------------------------
|
|
bool ctkTreeComboBox::eventFilter(QObject* object, QEvent* _event)
|
|
bool ctkTreeComboBox::eventFilter(QObject* object, QEvent* _event)
|
|
{
|
|
{
|
|
Q_D(ctkTreeComboBox);
|
|
Q_D(ctkTreeComboBox);
|
|
@@ -150,6 +166,19 @@ bool ctkTreeComboBox::eventFilter(QObject* object, QEvent* _event)
|
|
}
|
|
}
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
// -------------------------------------------------------------------------
|
|
|
|
+void ctkTreeComboBox::showPopup()
|
|
|
|
+{
|
|
|
|
+ Q_D(ctkTreeComboBox);
|
|
|
|
+ QHeaderView* header = qobject_cast<QTreeView*>(this->view())->header();
|
|
|
|
+ for (int i = 0; i < header->count(); ++i)
|
|
|
|
+ {
|
|
|
|
+ header->setSectionHidden(i, d->VisibleModelColumn != -1 &&
|
|
|
|
+ i != d->VisibleModelColumn);
|
|
|
|
+ }
|
|
|
|
+ this->QComboBox::showPopup();
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// -------------------------------------------------------------------------
|
|
void ctkTreeComboBox::hidePopup()
|
|
void ctkTreeComboBox::hidePopup()
|
|
{
|
|
{
|
|
Q_D(ctkTreeComboBox);
|
|
Q_D(ctkTreeComboBox);
|