MCPcopy Create free account
hub / github.com/Liniyous/ElaWidgetTools / paintEvent

Method paintEvent

ElaWidgetTools/ElaMultiSelectComboBox.cpp:169–206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

167 {
168 d->_isPopupPressed = true;
169 setFocus(Qt::MouseFocusReason);
170 event->accept();
171 update();
172 return;
173 }
174 QComboBox::mousePressEvent(event);
175}
176
177void ElaMultiSelectComboBox::mouseReleaseEvent(QMouseEvent* event)
178{
179 Q_D(ElaMultiSelectComboBox);
180 if (event->button() == Qt::LeftButton && d->_pressedTagIndex.isValid())
181 {
182 const QPersistentModelIndex pressedIndex = d->_pressedTagIndex;
183 d->_pressedTagIndex = QModelIndex();
184 for (const auto& tag: d->_getSelectionTags())
185 {
186 if (tag.index == pressedIndex && tag.closeRect.contains(event->pos()))
187 {
188 d->onItemPressed(tag.index);
189 break;
190 }
191 }
192 event->accept();
193 update();
194 return;
195 }
196 if (event->button() == Qt::LeftButton && d->_isPopupPressed)
197 {
198 d->_isPopupPressed = false;
199 if (isEnabled() && rect().contains(event->pos()))
200 {
201 if (d->_popup->getIsVisible())
202 {
203 hidePopup();
204 }
205 else
206 {
207 showPopup();
208 }
209 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected