# HG changeset patch # User insilmaril # Date 1259247323 0 # Node ID a9295db4dcbf1c0ddad0b73911c0aae9495beba4 # Parent 0a1abd218f3698ce1127d2855ea3a19e8c975524 More fixes to new findwidget diff -r 0a1abd218f36 -r a9295db4dcbf findwidget.cpp --- a/findwidget.cpp Wed Nov 25 15:28:05 2009 +0000 +++ b/findwidget.cpp Thu Nov 26 14:55:23 2009 +0000 @@ -7,7 +7,7 @@ extern QString vymName; -FindWidget::FindWidget(QWidget* parent) +FindWidget::FindWidget(QWidget *) { QVBoxLayout* mainLayout = new QVBoxLayout; QHBoxLayout *row2Layout = new QHBoxLayout; @@ -18,6 +18,9 @@ cancelbutton->setShortcut (Qt::Key_Escape); connect ( cancelbutton, SIGNAL( clicked() ), this, SLOT( cancelPressed() ) ); + QLabel *label=new QLabel; + label->setText (tr("Find:","FindWidget")); + // Create LineEdit (here QComboBox) findcombo = new QComboBox; findcombo->setMinimumWidth(250); @@ -29,17 +32,20 @@ nextbutton = new QPushButton; nextbutton->setText (tr("Next","Find widget")); - //nextbutton->setDefault (true); - //nextbutton->setShortcut (Qt::Key_Return); + nextbutton->setDefault (true); + nextbutton->setShortcut (Qt::Key_Return); + //nextbutton->setShortcutContext (Qt::WidgetShortcut); connect ( nextbutton, SIGNAL( clicked() ), this, SLOT( nextPressed() ) ); row2Layout->addWidget (cancelbutton); + row2Layout->addWidget (label); row2Layout->addWidget(findcombo); row2Layout->addWidget(nextbutton); mainLayout->addLayout (row2Layout); setLayout (mainLayout); + setStatus (Undefined); } void FindWidget::popup() @@ -64,3 +70,18 @@ emit (somethingChanged() ); } +void FindWidget::setStatus (Status st) +{ + QPalette p=palette(); + QColor c; + switch (st) + { + case Success: c=QColor (100,255,100); break; + case Failed: c=QColor (255,100,100); break; + default: c=QColor (255,255,255); + } + p.setColor(QPalette::Active, static_cast(9), c); + p.setColor(QPalette::Inactive, static_cast(9), c); + findcombo->setPalette(p); +} + diff -r 0a1abd218f36 -r a9295db4dcbf findwidget.h --- a/findwidget.h Wed Nov 25 15:28:05 2009 +0000 +++ b/findwidget.h Thu Nov 26 14:55:23 2009 +0000 @@ -13,13 +13,16 @@ Q_OBJECT public: - FindWidget (QWidget* parent=0); + enum Status {Undefined,Success,Failed}; + + FindWidget (QWidget *parent=NULL); public slots: void popup(); void cancelPressed(); void nextPressed(); void findTextChanged(const QString&); + void setStatus (Status st); signals: void nextButton(QString); diff -r 0a1abd218f36 -r a9295db4dcbf mapeditor.cpp --- a/mapeditor.cpp Wed Nov 25 15:28:05 2009 +0000 +++ b/mapeditor.cpp Thu Nov 26 14:55:23 2009 +0000 @@ -125,6 +125,7 @@ a = new QAction( tr( "Edit heading","MapEditor" ), this); a->setShortcut ( Qt::Key_Return ); //Edit heading + a->setShortcutContext (Qt::WidgetShortcut); addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( editHeading() ) ); a = new QAction( tr( "Edit heading","MapEditor" ), this); diff -r 0a1abd218f36 -r a9295db4dcbf version.h --- a/version.h Wed Nov 25 15:28:05 2009 +0000 +++ b/version.h Thu Nov 26 14:55:23 2009 +0000 @@ -7,7 +7,7 @@ #define __VYM_VERSION "1.13.0" //#define __VYM_CODENAME "Codename: RC-1" #define __VYM_CODENAME "Codename: development version, not for production!" -#define __VYM_BUILD_DATE "2009-11-25" +#define __VYM_BUILD_DATE "2009-11-26" bool checkVersion(const QString &); diff -r 0a1abd218f36 -r a9295db4dcbf vymview.cpp --- a/vymview.cpp Wed Nov 25 15:28:05 2009 +0000 +++ b/vymview.cpp Thu Nov 26 14:55:23 2009 +0000 @@ -18,6 +18,7 @@ // Create findWidget findWidget=new FindWidget (this); + findWidget->hide(); // Create TreeView treeEditor=new TreeEditor (model); @@ -172,7 +173,7 @@ } } -void VymView::changeProxySelection (const QItemSelection &newsel, const QItemSelection &oldsel) +void VymView::changeProxySelection (const QItemSelection &newsel, const QItemSelection &) { // Notify mainwindow to update satellites, but map selection to // original model first @@ -289,7 +290,7 @@ void VymView::showFindWidget() { - findWidget->show(); + findWidget->popup(); } void VymView::findNext (QString s) @@ -297,14 +298,8 @@ bool cs=false; BranchItem *bi=model->findText(s, cs); if (bi) - { - //statusBar()->message( "Found: " + bi->getHeading(), statusbarTime ); - cout << "VV::Found!\n"; - } else - { - cout << "VV::Nothing found!\n"; - //QMessageBox::information( findWindow, tr( "VYM -Information:" ), - // tr("No matches found for \"%1\"").arg(s)); - } + findWidget->setStatus (FindWidget::Success); + else + findWidget->setStatus (FindWidget::Failed); }