5 #include "findwidget.h"
8 extern QString vymName;
10 FindWidget::FindWidget(QWidget* parent)
12 QVBoxLayout* mainLayout = new QVBoxLayout;
13 QHBoxLayout *row2Layout = new QHBoxLayout;
16 cancelbutton = new QPushButton;
17 cancelbutton->setText(tr("Cancel"));
18 cancelbutton->setShortcut (Qt::Key_Escape);
19 connect ( cancelbutton, SIGNAL( clicked() ), this, SLOT( cancelPressed() ) );
21 // Create LineEdit (here QComboBox)
22 findcombo = new QComboBox;
23 findcombo->setMinimumWidth(250);
24 findcombo->setEditable(true);
25 connect ( findcombo, SIGNAL( highlighted(int) ),
26 this, SLOT( nextPressed() ) );
27 connect ( findcombo, SIGNAL( textChanged(const QString &) ),
28 this, SLOT( findTextChanged(const QString&) ) );
30 nextbutton = new QPushButton;
31 nextbutton->setText (tr("Next","Find widget"));
32 //nextbutton->setDefault (true);
33 //nextbutton->setShortcut (Qt::Key_Return);
34 connect ( nextbutton, SIGNAL( clicked() ), this, SLOT( nextPressed() ) );
36 row2Layout->addWidget (cancelbutton);
37 row2Layout->addWidget(findcombo);
38 row2Layout->addWidget(nextbutton);
40 mainLayout->addLayout (row2Layout);
42 setLayout (mainLayout);
45 void FindWidget::popup()
48 findcombo->lineEdit()->selectAll();
49 findcombo->setFocus();
52 void FindWidget::cancelPressed()
57 void FindWidget::nextPressed()
59 emit (nextButton(findcombo->currentText() ) );
62 void FindWidget::findTextChanged(const QString&)
64 emit (somethingChanged() );