mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-19 19:14:42 +00:00
- cleaned a bit the code
This commit is contained in:
parent
deb1e9e8a5
commit
aaa0d6bb06
@ -792,7 +792,7 @@ bool MLAutoCompleterPopUp::event( QEvent *event )
|
||||
return QListView::event(event);
|
||||
}
|
||||
|
||||
SearchBar::SearchBar(const WordActionsMapAccessor& wm,const int max,QWidget* parent)
|
||||
SearchMenu::SearchMenu(const WordActionsMapAccessor& wm,const int max,QWidget* parent)
|
||||
:QMenu(parent),searchline(NULL),wama(wm),maxres(max)
|
||||
{
|
||||
searchline = new QLineEdit(this);
|
||||
@ -802,7 +802,7 @@ SearchBar::SearchBar(const WordActionsMapAccessor& wm,const int max,QWidget* par
|
||||
connect(searchline,SIGNAL(textEdited( const QString&)),this,SLOT(edited( const QString&)));
|
||||
}
|
||||
|
||||
void SearchBar::updateResults()
|
||||
void SearchMenu::updateResults()
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -826,21 +826,23 @@ void SearchBar::updateResults()
|
||||
}
|
||||
}
|
||||
|
||||
void SearchBar::edited( const QString& )
|
||||
void SearchMenu::edited( const QString& )
|
||||
{
|
||||
updateResults();
|
||||
}
|
||||
|
||||
void SearchBar::clearResults()
|
||||
void SearchMenu::clearResults()
|
||||
{
|
||||
QList<QAction*> actlst = actions();
|
||||
foreach(QAction* act,actlst)
|
||||
{
|
||||
//QLineEdit MUST NOT be deleted!
|
||||
if (qobject_cast<QWidgetAction*>(act) == 0)
|
||||
removeAction(act);
|
||||
}
|
||||
}
|
||||
|
||||
//MyToolButton class has been introduced to overcome the "always on screen small down arrow visualization problem" officially recognized qt bug.
|
||||
MyToolButton::MyToolButton( QWidget * parent /*= 0 */ ) : QToolButton( parent )
|
||||
{
|
||||
|
||||
|
||||
@ -225,11 +225,11 @@ protected:
|
||||
void paintEvent( QPaintEvent * );
|
||||
};
|
||||
|
||||
class SearchBar : public QMenu
|
||||
class SearchMenu : public QMenu
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SearchBar(const WordActionsMapAccessor& wm,const int max,QWidget* parent);
|
||||
SearchMenu(const WordActionsMapAccessor& wm,const int max,QWidget* parent);
|
||||
inline void setMaxResultNum(const int max) {maxres = max;};
|
||||
inline int maxResultNum() const {return maxres;};
|
||||
void clearResults();
|
||||
|
||||
@ -481,13 +481,10 @@ void MainWindow::createToolBars()
|
||||
MyToolButton* toolb = new MyToolButton(this);
|
||||
toolb->setPopupMode(QToolButton::InstantPopup);
|
||||
toolb->setIcon(QIcon(":/images/search.png"));
|
||||
|
||||
searchToolBar->addWidget(toolb);
|
||||
SearchBar* ser = new SearchBar(wama,10,toolb);
|
||||
SearchMenu* ser = new SearchMenu(wama,10,toolb);
|
||||
toolb->setMenu(ser);
|
||||
connect(ser,SIGNAL(updatedResults()),toolb,SLOT(tbupdate()));
|
||||
|
||||
//searchToolBar->addAction(searchAct);
|
||||
}
|
||||
|
||||
|
||||
@ -637,27 +634,13 @@ void MainWindow::createMenus()
|
||||
splitMenu = handleMenu->addMenu(tr("&Split"));
|
||||
unSplitMenu = handleMenu->addMenu("&Close");
|
||||
|
||||
wama;
|
||||
|
||||
/////////WordActionsMapAccessor init. Probably should have been done from menu and not from PM. //////////
|
||||
for(QMap<QString,QAction*>::iterator it = PM.actionFilterMap.begin();it != PM.actionFilterMap.end();++it)
|
||||
{
|
||||
QString tx = it.value()->text() + " " + it.value()->toolTip();
|
||||
wama.addWordsPerAction(*it.value(),tx);
|
||||
}
|
||||
try
|
||||
{
|
||||
RankedMatches rm;
|
||||
int ii = wama.rankedMatchesPerInputString("subdivision Butterfly surface",rm);
|
||||
if (ii > 0)
|
||||
{
|
||||
QList<QAction*> myacts;
|
||||
rm.getActionsWithNMatches(ii,myacts);
|
||||
}
|
||||
}
|
||||
catch(InvalidInvariantException& e)
|
||||
{
|
||||
qDebug() << "WARNING!!!!!!!!!!!!!!!!!!!" << e.what() << "\n";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::fillFilterMenu()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user