diff --git a/libs/ui/widgets/kis_categorized_list_view.h b/libs/ui/widgets/kis_categorized_list_view.h --- a/libs/ui/widgets/kis_categorized_list_view.h +++ b/libs/ui/widgets/kis_categorized_list_view.h @@ -33,7 +33,7 @@ void setModel(QAbstractItemModel* model) override; QSize sizeHint() const override; - + void setCompositeBoxControl(bool value); Q_SIGNALS: void sigCategoryToggled(const QModelIndex& index, bool toggled); @@ -50,10 +50,9 @@ void mousePressEvent(QMouseEvent* event) override; void mouseReleaseEvent(QMouseEvent* event) override; - - private: - void updateRows(int begin, int end); + void updateRows(int begin, int end); + bool isCompositeBoxControl = false; }; #endif // KIS_CATEGORIZED_LIST_VIEW_H_ diff --git a/libs/ui/widgets/kis_categorized_list_view.cpp b/libs/ui/widgets/kis_categorized_list_view.cpp --- a/libs/ui/widgets/kis_categorized_list_view.cpp +++ b/libs/ui/widgets/kis_categorized_list_view.cpp @@ -52,6 +52,11 @@ return QSize(width, sh.height()); } +void KisCategorizedListView::setCompositeBoxControl(bool value) +{ + isCompositeBoxControl = value; +} + void KisCategorizedListView::updateRows(int begin, int end) { for(; begin!=end; ++begin) { @@ -111,8 +116,32 @@ { QListView::mousePressEvent(event); + QModelIndex index = QListView::indexAt(event->pos()); + + + // hack: the custom compositeop combo box has issues with events being sent + // those widgets will run this extra code to help them know if a checkbox is clicked + if (isCompositeBoxControl) { + + if (index.isValid() && (event->pos().x() < 25) && (model()->flags(index) & Qt::ItemIsUserCheckable)) { + QListView::mousePressEvent(event); + QMouseEvent releaseEvent(QEvent::MouseButtonRelease, + event->pos(), + event->globalPos(), + event->button(), + event->button() | event->buttons(), + event->modifiers()); + + QListView::mouseReleaseEvent(&releaseEvent); + emit sigEntryChecked(index); + + return; // don't worry about running the 'right' click logic below. that is not relevant with composite ops + } + } + + + if(event->button() == Qt::RightButton){ - QModelIndex index = QListView::indexAt(event->pos()); QMenu menu(this); if(index.data(__CategorizedListModelBase::isLockableRole).toBool() && index.isValid()) { diff --git a/libs/ui/widgets/kis_cmb_composite.cc b/libs/ui/widgets/kis_cmb_composite.cc --- a/libs/ui/widgets/kis_cmb_composite.cc +++ b/libs/ui/widgets/kis_cmb_composite.cc @@ -62,6 +62,7 @@ m_allowToHidePopup(true) { m_view = new KisCategorizedListView(); + m_view->setCompositeBoxControl(true); setMaxVisibleItems(100); setSizeAdjustPolicy(AdjustToContents);