3 #include "findwindow.h"
6 FindWindow::FindWindow(QWidget* parent, const char* name)
7 : QGroupBox( 0, Horizontal, "Find", parent, name )
10 setCaption ("VYM - Find Text");
16 QVBoxLayout* box = new QVBoxLayout( layout() );
18 QHBoxLayout *row1 = new QHBoxLayout( box );
19 row1->setMargin( 10 );
22 QLabel* label = new QLabel( "Text to find: ", this);
23 row1->addWidget( label );
25 // Create LineEdit (here QComboBox)
26 QHBoxLayout *row2 = new QHBoxLayout( box );
27 row2->setMargin( 10 );
28 findcombo = new QComboBox( true, this );
29 findcombo->setMinimumWidth(150);
30 row2->addWidget( findcombo );
31 connect ( findcombo, SIGNAL( highlighted(int) ),
32 this, SLOT( findPressed() ) );
33 connect ( findcombo, SIGNAL( textChanged(const QString &) ),
34 this, SLOT( findTextChanged(const QString&) ) );
35 //findcombo->insertItem( "Normal", -1 );
38 QHBoxLayout *row3 = new QHBoxLayout( box );
39 row3->setMargin( 10 );
40 clearbutton = new QPushButton (tr("Clear"),this);
41 connect ( clearbutton, SIGNAL( clicked() ),
42 findcombo, SLOT( clearEdit() ) );
43 row3->addWidget (clearbutton);
45 QSpacerItem *si1= new QSpacerItem (10,0,QSizePolicy::Minimum, QSizePolicy::Expanding );
48 cancelbutton = new QPushButton (tr("Cancel"),this);
49 cancelbutton->setAccel (Key_Escape);
50 connect ( cancelbutton, SIGNAL( clicked() ),
51 this, SLOT( cancelPressed() ) );
52 row3->addWidget (cancelbutton);
54 QSpacerItem *si2= new QSpacerItem (10,0,QSizePolicy::Fixed, QSizePolicy::Fixed);
57 findbutton = new QPushButton (tr("Find"),this);
58 findbutton->setDefault (true);
59 connect ( findbutton, SIGNAL( clicked() ),
60 this, SLOT( findPressed() ) );
61 row3->add(findbutton);
63 findcombo->setFocus();
66 void FindWindow::popup()
68 findcombo->lineEdit()->selectAll();
72 void FindWindow::cancelPressed()
77 void FindWindow::findPressed()
79 emit (findButton(findcombo->currentText() ) );
82 void FindWindow::findTextChanged(const QString&)
84 emit (somethingChanged() );