3 #include "findwindow.h"
7 FindWindow::FindWindow(QWidget* parent, const char* name)
8 : QGroupBox( 0, Horizontal, "Find", parent, name )
11 setCaption (__VYM " - " +tr("Find Text"));
17 QVBoxLayout* box = new QVBoxLayout( layout() );
19 QHBoxLayout *row1 = new QHBoxLayout( box );
20 row1->setMargin( 10 );
23 QLabel* label = new QLabel( "Text to find: ", this);
24 row1->addWidget( label );
26 // Create LineEdit (here QComboBox)
27 QHBoxLayout *row2 = new QHBoxLayout( box );
28 row2->setMargin( 10 );
29 findcombo = new QComboBox( true, this );
30 findcombo->setMinimumWidth(150);
31 row2->addWidget( findcombo );
32 connect ( findcombo, SIGNAL( highlighted(int) ),
33 this, SLOT( findPressed() ) );
34 connect ( findcombo, SIGNAL( textChanged(const QString &) ),
35 this, SLOT( findTextChanged(const QString&) ) );
36 //findcombo->insertItem( "Normal", -1 );
39 QHBoxLayout *row3 = new QHBoxLayout( box );
40 row3->setMargin( 10 );
41 clearbutton = new QPushButton (tr("Clear"),this);
42 connect ( clearbutton, SIGNAL( clicked() ),
43 findcombo, SLOT( clearEdit() ) );
44 row3->addWidget (clearbutton);
46 QSpacerItem *si1= new QSpacerItem (10,0,QSizePolicy::Minimum, QSizePolicy::Expanding );
49 cancelbutton = new QPushButton (tr("Cancel"),this);
50 cancelbutton->setAccel (Key_Escape);
51 connect ( cancelbutton, SIGNAL( clicked() ),
52 this, SLOT( cancelPressed() ) );
53 row3->addWidget (cancelbutton);
55 QSpacerItem *si2= new QSpacerItem (10,0,QSizePolicy::Fixed, QSizePolicy::Fixed);
58 findbutton = new QPushButton (tr("Find"),this);
59 findbutton->setDefault (true);
60 connect ( findbutton, SIGNAL( clicked() ),
61 this, SLOT( findPressed() ) );
62 row3->add(findbutton);
64 findcombo->setFocus();
67 void FindWindow::popup()
69 findcombo->lineEdit()->selectAll();
73 void FindWindow::cancelPressed()
78 void FindWindow::findPressed()
80 emit (findButton(findcombo->currentText() ) );
83 void FindWindow::findTextChanged(const QString&)
85 emit (somethingChanged() );