findwidget.cpp
changeset 810 a9295db4dcbf
parent 808 b163492fda17
child 811 c79486b7cb4b
     1.1 --- a/findwidget.cpp	Wed Nov 25 15:28:05 2009 +0000
     1.2 +++ b/findwidget.cpp	Thu Nov 26 14:55:23 2009 +0000
     1.3 @@ -7,7 +7,7 @@
     1.4  
     1.5  extern QString vymName;
     1.6  
     1.7 -FindWidget::FindWidget(QWidget* parent)
     1.8 +FindWidget::FindWidget(QWidget *)
     1.9  {
    1.10      QVBoxLayout* mainLayout = new QVBoxLayout;
    1.11      QHBoxLayout *row2Layout = new QHBoxLayout;
    1.12 @@ -18,6 +18,9 @@
    1.13  	cancelbutton->setShortcut (Qt::Key_Escape);
    1.14  	connect ( cancelbutton, SIGNAL( clicked() ), this, SLOT( cancelPressed() ) );
    1.15  	
    1.16 +	QLabel *label=new QLabel;
    1.17 +	label->setText (tr("Find:","FindWidget"));
    1.18 +	
    1.19  	// Create LineEdit (here QComboBox)
    1.20      findcombo = new QComboBox;
    1.21  	findcombo->setMinimumWidth(250);
    1.22 @@ -29,17 +32,20 @@
    1.23  
    1.24  	nextbutton = new QPushButton;
    1.25  	nextbutton->setText (tr("Next","Find widget"));
    1.26 -	//nextbutton->setDefault (true);
    1.27 -	//nextbutton->setShortcut (Qt::Key_Return);
    1.28 +	nextbutton->setDefault (true);
    1.29 +	nextbutton->setShortcut (Qt::Key_Return);
    1.30 +	//nextbutton->setShortcutContext (Qt::WidgetShortcut);
    1.31  	connect ( nextbutton, SIGNAL( clicked() ), this, SLOT( nextPressed() ) );
    1.32  
    1.33  	row2Layout->addWidget (cancelbutton);
    1.34 +	row2Layout->addWidget (label);
    1.35  	row2Layout->addWidget(findcombo);
    1.36  	row2Layout->addWidget(nextbutton);
    1.37  
    1.38  	mainLayout->addLayout (row2Layout);
    1.39  
    1.40  	setLayout (mainLayout);
    1.41 +	setStatus (Undefined);
    1.42  }
    1.43  
    1.44  void FindWidget::popup()
    1.45 @@ -64,3 +70,18 @@
    1.46  	emit (somethingChanged() );
    1.47  }
    1.48  
    1.49 +void FindWidget::setStatus (Status st)
    1.50 +{
    1.51 +	QPalette p=palette();
    1.52 +	QColor c;
    1.53 +	switch (st)
    1.54 +	{
    1.55 +		case Success: c=QColor (100,255,100); break;
    1.56 +		case Failed:  c=QColor (255,100,100); break;
    1.57 +		default:  c=QColor (255,255,255); 
    1.58 +	}
    1.59 +    p.setColor(QPalette::Active, static_cast<QPalette::ColorRole>(9), c);
    1.60 +    p.setColor(QPalette::Inactive, static_cast<QPalette::ColorRole>(9), c);
    1.61 +    findcombo->setPalette(p);
    1.62 +}
    1.63 +