i post it 2nd time, coz everybody try to help me and just indicate a problem, but i cant solve it by myself =(
main only:
QApplication a(argc, argv);
QWidget w;
QComboBox* cmb = new QComboBox;
QPushButton* btn = new QPushButton("add");
QDial* dial = new QDial;
QLabel* lbl = new QLabel(" ");
cmb->addItem("item1");
cmb->addItem("dial");
cmb->addItem("item3");
dial->hide();
if (lbl->text() == "dial") {
QObject::connect(btn, SIGNAL(clicked()),
dial, SLOT (show())
);
}
QObject::connect(cmb, SIGNAL(currentTextChanged(QString)),
lbl, SLOT (setText(QString))
);
i can change lbl for “item1”, “dial”, “item3”, but lbl->text is always item1.
calling text() after the connect will of course give you the text of the first item, because it is executed before you change the selection in the GUI.
ok. but how can i solve it. just write specific lines. ty
↧