Skip to content

Commit

Permalink
- change: Prevent mouse wheel change combobox's current selection.
Browse files Browse the repository at this point in the history
  • Loading branch information
royqh1979 committed Dec 19, 2024
1 parent 0dba9d2 commit b76d59c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
5 changes: 3 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ Red Panda C++ Version 3.3
- fix: Can't show definitions in iconv.h in the completion list.
- fix: Color scheme's "Indent Guide Line" item is not used by the editor.
- fix: "Indent Guide Line" item doesn't show in the option / editor / color scheme page.
- fix: Remove not used option "indent guide line" in the option / editor / general page .

- fix: Remove not used option "indent guide line" in the option / editor / general page.
- change: Prevent mouse wheel change combobox's current selection.

Red Panda C++ Version 3.2

- change: The way to calcuate astyle path.
Expand Down
3 changes: 3 additions & 0 deletions RedPandaIDE/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,9 @@ int main(int argc, char *argv[])
WindowLogoutEventFilter filter;
app.installNativeEventFilter(&filter);
#endif
//Event filter to prevent QCombobox receive wheel event;
app.installEventFilter(pMainWindow);

if (lockFile.isLocked()) {
lockFile.unlock();
}
Expand Down
11 changes: 11 additions & 0 deletions RedPandaIDE/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5844,6 +5844,17 @@ bool MainWindow::event(QEvent *event)
return QMainWindow::event(event);
}

bool MainWindow::eventFilter(QObject *watched, QEvent *event)
{
//Prevent QComboBox wheel event
if (event->type() == QEvent::Wheel) {
QComboBox *p=qobject_cast<QComboBox*>(watched);
if (p && !(p->view() && p->view()->isVisible()))
return true;
}
return false;
}

//void MainWindow::dragEnterEvent(QDragEnterEvent *event)
//{
// if (event->mimeData()->hasUrls()){
Expand Down
3 changes: 3 additions & 0 deletions RedPandaIDE/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -1042,12 +1042,15 @@ private slots:
// QObject interface
public:
bool event(QEvent *event) override;
bool eventFilter(QObject *watched, QEvent *event) override;

bool isClosingAll() const;
bool isQuitting() const;
const std::shared_ptr<VisitHistoryManager> &visitHistoryManager() const;
bool closingProject() const;
bool openingFiles() const;
bool openingProject() const;

};

extern MainWindow* pMainWindow;
Expand Down

0 comments on commit b76d59c

Please sign in to comment.