Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
4.4.0
-
None
-
c15c9cd2356eaeba33a5f8e62a90b0aeb45284e1
Description
The problem occurs because I have a combo box with certain items being
editable, and some others, not. For this, I switch the editable status
of the combo box when the combo box selection changes...
I have created below a minimum program to reproduce this behavior:
1) run
2) select "bbbbb"
...slot NewSelection(int i) should be called hence the combo box should
become editable... it is, but there is no edit cursor showing. Hence the
user does not "see" the combo box is editable. This is my problem.
3) select "ccccc"
... cursor is there
4) select "bbbbb"
... cursor is there
5) select "aaaaa"
... cursor is not there (normal)
6) select "bbbbb"
... cursor is not there (NOT normal)
7) select "ccccc"
... cursor is there
etc....
#include <QtGui/QApplication>
#include <QtGui/QMainWindow>
#include <QtGui/QComboBox>
class TWindow : public QMainWindow
{
Q_OBJECT
public:
TWindow(QWidget* parent = 0);
QComboBox* comboBox;
public slots:
void NewSelection(int);
};
#include "main.moc"
// -----------------------------------------------------------------------------
TWindow::TWindow(QWidget* parent)
:
QMainWindow(parent)
{
comboBox = new QComboBox(this);
comboBox->resize(QSize(200,22));
comboBox->addItem("aaaaa");
comboBox->addItem("bbbbb");
comboBox->addItem("ccccc");
connect(comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(NewSelection(int)));
}
// -----------------------------------------------------------------------------
void TWindow::NewSelection(int i)
{
comboBox->setEditable(i > 0);
}
// -----------------------------------------------------------------------------
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
TWindow w;
w.show();
return a.exec();
}