3 #include <Q3HBoxLayout>
4 #include <Q3VBoxLayout>
7 #include "findwindow.h"
11 FindWindow::FindWindow(QWidget* parent, const char* name)
12 : Q3GroupBox( 0, Qt::Horizontal, "Find", parent, name )
15 setCaption (__VYM " - " +tr("Find Text"));
19 //FIXME not avail in QT4 setMargin( 100 );
21 Q3VBoxLayout* box = new Q3VBoxLayout( layout() );
23 Q3HBoxLayout *row1 = new Q3HBoxLayout( box );
24 row1->setMargin( 10 );
27 QLabel* label = new QLabel( "Text to find: ", this);
28 row1->addWidget( label );
30 // Create LineEdit (here QComboBox)
31 Q3HBoxLayout *row2 = new Q3HBoxLayout( box );
32 row2->setMargin( 10 );
33 findcombo = new QComboBox( true, this );
34 findcombo->setMinimumWidth(150);
35 row2->addWidget( findcombo );
36 connect ( findcombo, SIGNAL( highlighted(int) ),
37 this, SLOT( findPressed() ) );
38 connect ( findcombo, SIGNAL( textChanged(const QString &) ),
39 this, SLOT( findTextChanged(const QString&) ) );
40 //findcombo->insertItem( "Normal", -1 );
43 Q3HBoxLayout *row3 = new Q3HBoxLayout( box );
44 row3->setMargin( 10 );
45 clearbutton = new QPushButton (tr("Clear"),this);
46 connect ( clearbutton, SIGNAL( clicked() ),
47 findcombo, SLOT( clearEdit() ) );
48 row3->addWidget (clearbutton);
50 QSpacerItem *si1= new QSpacerItem (10,0,QSizePolicy::Minimum, QSizePolicy::Expanding );
53 cancelbutton = new QPushButton (tr("Cancel"),this);
54 cancelbutton->setAccel (Qt::Key_Escape);
55 connect ( cancelbutton, SIGNAL( clicked() ),
56 this, SLOT( cancelPressed() ) );
57 row3->addWidget (cancelbutton);
59 QSpacerItem *si2= new QSpacerItem (10,0,QSizePolicy::Fixed, QSizePolicy::Fixed);
62 findbutton = new QPushButton (tr("Find"),this);
63 findbutton->setDefault (true);
64 connect ( findbutton, SIGNAL( clicked() ),
65 this, SLOT( findPressed() ) );
66 row3->add(findbutton);
68 findcombo->setFocus();
71 void FindWindow::popup()
73 findcombo->lineEdit()->selectAll();
77 void FindWindow::cancelPressed()
82 void FindWindow::findPressed()
84 emit (findButton(findcombo->currentText() ) );
87 void FindWindow::findTextChanged(const QString&)
89 emit (somethingChanged() );