diff -r 000000000000 -r b163492fda17 findwidget.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/findwidget.cpp Wed Nov 25 15:27:22 2009 +0000 @@ -0,0 +1,66 @@ +#include +#include +#include + +#include "findwidget.h" + + +extern QString vymName; + +FindWidget::FindWidget(QWidget* parent) +{ + QVBoxLayout* mainLayout = new QVBoxLayout; + QHBoxLayout *row2Layout = new QHBoxLayout; + + // Create Buttons + cancelbutton = new QPushButton; + cancelbutton->setText(tr("Cancel")); + cancelbutton->setShortcut (Qt::Key_Escape); + connect ( cancelbutton, SIGNAL( clicked() ), this, SLOT( cancelPressed() ) ); + + // Create LineEdit (here QComboBox) + findcombo = new QComboBox; + findcombo->setMinimumWidth(250); + findcombo->setEditable(true); + connect ( findcombo, SIGNAL( highlighted(int) ), + this, SLOT( nextPressed() ) ); + connect ( findcombo, SIGNAL( textChanged(const QString &) ), + this, SLOT( findTextChanged(const QString&) ) ); + + nextbutton = new QPushButton; + nextbutton->setText (tr("Next","Find widget")); + //nextbutton->setDefault (true); + //nextbutton->setShortcut (Qt::Key_Return); + connect ( nextbutton, SIGNAL( clicked() ), this, SLOT( nextPressed() ) ); + + row2Layout->addWidget (cancelbutton); + row2Layout->addWidget(findcombo); + row2Layout->addWidget(nextbutton); + + mainLayout->addLayout (row2Layout); + + setLayout (mainLayout); +} + +void FindWidget::popup() +{ + show(); + findcombo->lineEdit()->selectAll(); + findcombo->setFocus(); +} + +void FindWidget::cancelPressed() +{ + hide(); +} + +void FindWidget::nextPressed() +{ + emit (nextButton(findcombo->currentText() ) ); +} + +void FindWidget::findTextChanged(const QString&) +{ + emit (somethingChanged() ); +} +