5 #include "findwindow.h"
8 extern QString vymName;
10 FindWindow::FindWindow(QWidget* parent)
11 //: QGroupBox( tr("Find"), parent )
14 //setWindowTitle(vymName + " - " +tr("Find Text"));
16 QVBoxLayout* mainLayout = new QVBoxLayout;
18 QHBoxLayout *row1Layout = new QHBoxLayout;
21 QLabel* label = new QLabel;
22 label->setText( tr("Text to find:"));
23 row1Layout->addWidget( label );
26 // Create LineEdit (here QComboBox)
27 QHBoxLayout *row2Layout = new QHBoxLayout;
28 findcombo = new QComboBox;
29 findcombo->setMinimumWidth(250);
30 findcombo->setEditable(true);
31 connect ( findcombo, SIGNAL( highlighted(int) ),
32 this, SLOT( findPressed() ) );
33 connect ( findcombo, SIGNAL( textChanged(const QString &) ),
34 this, SLOT( findTextChanged(const QString&) ) );
36 row2Layout->addWidget(findcombo);
39 //QHBoxLayout *row3Layout = new QHBoxLayout;
40 clearbutton = new QPushButton;
41 clearbutton->setText(tr("Clear"));
42 connect ( clearbutton, SIGNAL( clicked() ), this, SLOT( clearLineEdit() ) );
43 row2Layout->addWidget (clearbutton);
45 cancelbutton = new QPushButton;
46 cancelbutton->setText(tr("Cancel"));
47 cancelbutton->setShortcut (Qt::Key_Escape);
48 connect ( cancelbutton, SIGNAL( clicked() ), this, SLOT( cancelPressed() ) );
49 row2Layout->addWidget (cancelbutton);
51 findbutton = new QPushButton;
52 findbutton->setText (tr("Find"));
53 findbutton->setDefault (true);
54 findbutton->setShortcut (Qt::Key_Return);
55 connect ( findbutton, SIGNAL( clicked() ), this, SLOT( findPressed() ) );
57 //row2Layout->addStretch(2);
58 row2Layout->addWidget(findbutton);
60 mainLayout->addLayout (row1Layout);
61 mainLayout->addLayout (row2Layout);
62 //mainLayout->addLayout (row3Layout);
63 setLayout (mainLayout);
66 void FindWindow::popup()
69 findcombo->lineEdit()->selectAll();
70 findcombo->setFocus();
73 void FindWindow::cancelPressed()
78 void FindWindow::findPressed()
80 emit (findButton(findcombo->currentText() ) );
83 void FindWindow::findTextChanged(const QString&)
85 emit (somethingChanged() );
88 void FindWindow::clearLineEdit()
90 findcombo->lineEdit()->clear();