Skip to content

Commit

Permalink
ENH: Added python bindings for ctkCheckableHeaderView
Browse files Browse the repository at this point in the history
Co-authored-by: Andras Lasso <[email protected]>
  • Loading branch information
kerim371 and lassoan committed Apr 5, 2023
1 parent 83a570a commit fa1732f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Libs/Widgets/ctkCheckableHeaderView.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ class CTK_WIDGETS_EXPORT ctkCheckableHeaderView : public QHeaderView
/// Utility function that returns the checkState of the section.
/// One can access the same value through the model:
/// model->headerData(orientation, section, Qt::CheckStateRole)
Qt::CheckState checkState(int section)const;
Q_INVOKABLE Qt::CheckState checkState(int section)const;

///
/// Utility function that returns the checkState of the section.
/// One can access the same value through the model:
/// model->headerData(orientation, section, Qt::CheckStateRole)
bool checkState(int section,Qt::CheckState& checkState )const;
Q_INVOKABLE bool checkState(int section,Qt::CheckState& checkState )const;

ctkCheckableModelHelper* checkableModelHelper()const;
Q_INVOKABLE ctkCheckableModelHelper* checkableModelHelper()const;

public Q_SLOTS:
///
Expand Down
9 changes: 9 additions & 0 deletions Libs/Widgets/ctkWidgetsPythonQtDecorators.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <ctkTransferFunctionGradientItem.h>
#include <ctkWidgetsUtils.h>
#include <ctkWorkflowWidgetStep.h>
#include <ctkCheckableHeaderView.h>

// NOTE:
//
Expand Down Expand Up @@ -143,6 +144,13 @@ public Q_SLOTS:
delete obj;
}

// ctkCheckableHeaderView

ctkCheckableHeaderView *new_ctkCheckableHeaderView(Qt::Orientation orient, QWidget *parent = 0)
{
return new ctkCheckableHeaderView(orient, parent);
}

};

//-----------------------------------------------------------------------------
Expand All @@ -169,6 +177,7 @@ void initCTKWidgetsPythonQtDecorators()
PythonQt::self()->registerClass(&ctkTransferFunctionBarsItem::staticMetaObject, "CTKWidgets");
PythonQt::self()->registerClass(&ctkTransferFunctionControlPointsItem::staticMetaObject, "CTKWidgets");
PythonQt::self()->registerClass(&ctkTransferFunctionGradientItem::staticMetaObject, "CTKWidgets");
PythonQt::self()->registerClass(&ctkCheckableHeaderView::staticMetaObject, "CTKWidgets");

PythonQt::self()->addDecorators(new ctkWidgetsPythonQtDecorators);

Expand Down

0 comments on commit fa1732f

Please sign in to comment.