@@ -37,6 +37,9 @@ class CComboInputDialogPrivate
3737
3838 combo = new QComboBox (q);
3939
40+ infoLabel = new QLabel (q);
41+ infoLabel->setVisible (false );
42+ infoLabel->setWordWrap (true );
4043
4144 buttonBox = new QDialogButtonBox (q);
4245 buttonBox->setOrientation (Qt::Horizontal);
@@ -53,15 +56,18 @@ class CComboInputDialogPrivate
5356 QVBoxLayout *verticalLayout_2 = new QVBoxLayout (q);
5457 verticalLayout_2->addLayout (horizontalLayout_2);
5558 verticalLayout_2->addWidget (combo);
59+ verticalLayout_2->addWidget (infoLabel);
5660 verticalLayout_2->addItem (buttonSpacer);
5761 verticalLayout_2->addWidget (buttonBox);
5862 }
5963
6064 QLabel *pixmapLabel;
6165 QLabel *messageLabel;
66+ QLabel *infoLabel;
6267 QComboBox* combo;
6368 QDialogButtonBox *buttonBox;
6469 QAbstractButton *clickedButton;
70+ QMap<int , QString> infos;
6571};
6672
6773CComboInputDialog::CComboInputDialog (QWidget *parent) :
@@ -71,6 +77,7 @@ CComboInputDialog::CComboInputDialog(QWidget *parent) :
7177 setModal (true );
7278 setWindowFlags (windowFlags () & ~Qt::WindowContextHelpButtonHint);
7379 d->combo ->setFocus ();
80+ connect (d->combo , SIGNAL (currentIndexChanged (int )), SLOT (onCmbIndex (int )));
7481 connect (d->buttonBox , SIGNAL (accepted ()), SLOT (accept ()));
7582 connect (d->buttonBox , SIGNAL (rejected ()), SLOT (reject ()));
7683 connect (d->buttonBox , SIGNAL (clicked (QAbstractButton*)),
@@ -82,6 +89,14 @@ CComboInputDialog::~CComboInputDialog()
8289 delete d;
8390}
8491
92+ void CComboInputDialog::onCmbIndex (int index)
93+ {
94+ QString info = d->infos [index];
95+ if (!info.isEmpty ())
96+ d->infoLabel ->setVisible (true );
97+ d->infoLabel ->setText (info);
98+ }
99+
85100void CComboInputDialog::slotClicked (QAbstractButton *b)
86101{
87102 d->clickedButton = b;
@@ -109,9 +124,11 @@ void CComboInputDialog::setText(const QString &t)
109124 d->messageLabel ->setText (t);
110125}
111126
112- void CComboInputDialog::addItem (const QString& t, const QVariant & v)
127+ void CComboInputDialog::addItem (const QString& t, const QVariant & v, const QString& info )
113128{
114129 d->combo ->addItem (t, v);
130+ if (!info.isEmpty ())
131+ d->infos [d->combo ->count () - 1 ] = info;
115132}
116133
117134void CComboInputDialog::setEditable (bool b)
0 commit comments