Hi every one

I've a question to qcombobox. In my application I would add all current Serial ports to the Combo box during the runtime. I tried to update the list, when the user clicks on the Combobox (read only).

After some searching I found something:
http://www.qtcentre.org/threads/946-...from-QCombobox
But the problem is, that the Event function is never called... so where is my fault?

Qt Code:
  1. #ifndef MAINWINDOW_H
  2. #define MAINWINDOW_H
  3.  
  4. #include <QMainWindow>
  5. #include <QQueue>
  6. #include <QLineSeries>
  7. #include <QSerialPortInfo>
  8.  
  9. namespace Ui {
  10. class MainWindow;
  11. }
  12.  
  13.  
  14. class MainWindow : public QMainWindow
  15. {
  16.  
  17. public:
  18. explicit MainWindow(QWidget *parent = 0);
  19. ~MainWindow();
  20.  
  21. private:
  22. Ui::MainWindow *ui;
  23.  
  24. public slots:
  25. void vUpdatePortList();
  26.  
  27. protected:
  28. bool bEventFilter(QObject* o, QEvent* e);
  29. };
  30.  
  31. #endif // MAINWINDOW_H
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. #include "mainwindow.h"
  2.  
  3. #include <QLabel>
  4. #include <QTimer>
  5. #include <QChartView>
  6. #include <QValueAxis>
  7. #include <QLineSeries>
  8. #include <QMessageBox>
  9. #include <QSortFilterProxyModel>
  10.  
  11.  
  12. MainWindow::MainWindow(QWidget *parent) :
  13. QMainWindow(parent),
  14. ui(new Ui::MainWindow),
  15. {
  16. ui->setupUi(this);
  17.  
  18. const QList<QSerialPortInfo> portList(QSerialPortInfo::availablePorts());
  19. int i = 0;
  20. foreach (QSerialPortInfo port, portList)
  21. {
  22. ui->comboBoxPorts->addItem(port.portName());
  23. ui->comboBoxPorts->setItemData(i, port.description(), Qt::ToolTipRole);
  24. i++;
  25. }
  26. // Sort List
  27. QSortFilterProxyModel* proxy = new QSortFilterProxyModel(ui->comboBoxPorts);
  28. proxy->setSourceModel(ui->comboBoxPorts->model());
  29. ui->comboBoxPorts->model()->setParent(proxy);
  30. ui->comboBoxPorts->model()->sort(0);
  31.  
  32.  
  33. ui->comboBoxPorts->installEventFilter(this);
  34. }
  35.  
  36. MainWindow::~MainWindow()
  37. {
  38. delete ui;
  39. }
  40.  
  41. bool MainWindow::bEventFilter(QObject* o, QEvent* e)
  42. {
  43. if(e->type() == QEvent::Show)
  44. {
  45. vUpdatePortList();
  46. ui->textEdit->append("TRUE");
  47. return true;
  48. }
  49. else
  50. {
  51. ui->textEdit->append("FALSE");
  52. return false;
  53. }
  54. }
  55.  
  56. void MainWindow::vUpdatePortList()
  57. {
  58. ui->textEdit->append("Hallo");
  59. }
To copy to clipboard, switch view to plain text mode 

Isn't there any Click-Signal in QT?

Thank you for helping me.
Best regards, P51D