findwindow.cpp
author insilmaril
Wed, 25 Jan 2006 12:34:55 +0000
changeset 199 202572375c98
parent 180 60e2297bab39
child 364 7b74fa3772bf
permissions -rw-r--r--
Fixed outputFile in OO export
insilmaril@0
     1
#include <qlineedit.h>
insilmaril@0
     2
insilmaril@0
     3
#include "findwindow.h"
insilmaril@180
     4
#include "version.h"
insilmaril@0
     5
insilmaril@0
     6
insilmaril@167
     7
FindWindow::FindWindow(QWidget* parent, const char* name) 
insilmaril@0
     8
	: QGroupBox( 0, Horizontal, "Find", parent, name )
insilmaril@0
     9
insilmaril@0
    10
{
insilmaril@180
    11
	setCaption (__VYM " - " +tr("Find Text"));
insilmaril@0
    12
	//resize (180,130);
insilmaril@0
    13
	move (130,130);
insilmaril@0
    14
insilmaril@0
    15
	setMargin( 100 );
insilmaril@0
    16
insilmaril@0
    17
    QVBoxLayout* box = new QVBoxLayout( layout() );
insilmaril@0
    18
    
insilmaril@0
    19
    QHBoxLayout *row1 = new QHBoxLayout( box );
insilmaril@0
    20
    row1->setMargin( 10 );
insilmaril@0
    21
insilmaril@0
    22
    // Create a Label
insilmaril@0
    23
    QLabel* label = new QLabel( "Text to find: ", this);
insilmaril@0
    24
    row1->addWidget( label );
insilmaril@0
    25
insilmaril@0
    26
	// Create LineEdit (here QComboBox)
insilmaril@0
    27
    QHBoxLayout *row2 = new QHBoxLayout( box );
insilmaril@0
    28
    row2->setMargin( 10 );
insilmaril@0
    29
    findcombo = new QComboBox( true, this );
insilmaril@0
    30
	findcombo->setMinimumWidth(150);
insilmaril@0
    31
    row2->addWidget( findcombo );
insilmaril@0
    32
	connect ( findcombo, SIGNAL( highlighted(int) ), 
insilmaril@0
    33
		this, SLOT( findPressed() ) );
insilmaril@0
    34
	connect ( findcombo, SIGNAL( textChanged(const QString &) ), 
insilmaril@0
    35
		this, SLOT( findTextChanged(const QString&) ) );
insilmaril@0
    36
    //findcombo->insertItem( "Normal", -1 );
insilmaril@0
    37
insilmaril@0
    38
	// Create Buttons
insilmaril@0
    39
    QHBoxLayout *row3 = new QHBoxLayout( box );
insilmaril@0
    40
    row3->setMargin( 10 );
insilmaril@0
    41
	clearbutton = new QPushButton (tr("Clear"),this);
insilmaril@0
    42
	connect ( clearbutton, SIGNAL( clicked() ), 
insilmaril@0
    43
		findcombo, SLOT( clearEdit() ) );
insilmaril@0
    44
	row3->addWidget (clearbutton);
insilmaril@0
    45
	
insilmaril@0
    46
	QSpacerItem *si1= new QSpacerItem (10,0,QSizePolicy::Minimum, QSizePolicy::Expanding );
insilmaril@0
    47
	row3->addItem(si1);
insilmaril@0
    48
	
insilmaril@0
    49
	cancelbutton = new QPushButton (tr("Cancel"),this);
insilmaril@0
    50
	cancelbutton->setAccel (Key_Escape);
insilmaril@0
    51
	connect ( cancelbutton, SIGNAL( clicked() ), 
insilmaril@0
    52
		this, SLOT( cancelPressed() ) );
insilmaril@0
    53
	row3->addWidget (cancelbutton);
insilmaril@0
    54
insilmaril@0
    55
	QSpacerItem *si2= new QSpacerItem (10,0,QSizePolicy::Fixed, QSizePolicy::Fixed);
insilmaril@0
    56
	row3->addItem(si2);
insilmaril@0
    57
	
insilmaril@0
    58
	findbutton = new QPushButton (tr("Find"),this);
insilmaril@0
    59
	findbutton->setDefault (true);
insilmaril@0
    60
	connect ( findbutton, SIGNAL( clicked() ), 
insilmaril@0
    61
		this, SLOT( findPressed() ) );
insilmaril@0
    62
	row3->add(findbutton);
insilmaril@0
    63
	
insilmaril@0
    64
	findcombo->setFocus();
insilmaril@0
    65
}
insilmaril@0
    66
insilmaril@0
    67
void FindWindow::popup()
insilmaril@0
    68
{
insilmaril@0
    69
	findcombo->lineEdit()->selectAll();
insilmaril@0
    70
	show();
insilmaril@0
    71
}
insilmaril@0
    72
insilmaril@0
    73
void FindWindow::cancelPressed()
insilmaril@0
    74
{
insilmaril@0
    75
	hide();
insilmaril@0
    76
}
insilmaril@0
    77
insilmaril@0
    78
void FindWindow::findPressed()
insilmaril@0
    79
{
insilmaril@0
    80
	emit (findButton(findcombo->currentText() ) );
insilmaril@0
    81
}
insilmaril@0
    82
insilmaril@0
    83
void FindWindow::findTextChanged(const QString&)
insilmaril@0
    84
{
insilmaril@0
    85
	emit (somethingChanged() );
insilmaril@0
    86
}