cmake-gui: Add search functions to the context menu of the Output widget

Signed-off-by: Alex Neundorf <neundorf@kde.org>
This commit is contained in:
Marc Bartholomaeus 2013-04-18 00:53:12 +02:00 committed by Alex Neundorf
parent df3663bfab
commit 4ce65e82f5
2 changed files with 21 additions and 0 deletions

View File

@ -183,6 +183,10 @@ CMakeSetupDialog::CMakeSetupDialog()
this->Output->setFont(outputFont);
this->ErrorFormat.setForeground(QBrush(Qt::red));
this->Output->setContextMenuPolicy(Qt::CustomContextMenu);
connect(this->Output, SIGNAL(customContextMenuRequested(const QPoint&)),
this, SLOT(doOutputContextMenu(const QPoint &)));
// start the cmake worker thread
this->CMakeThread = new QCMakeThread(this);
QObject::connect(this->CMakeThread, SIGNAL(cmakeInitialized()),
@ -1160,6 +1164,22 @@ void CMakeSetupDialog::setSearchFilter(const QString& str)
this->CacheValues->setSearchFilter(str);
}
void CMakeSetupDialog::doOutputContextMenu(const QPoint &pt)
{
QMenu *menu = this->Output->createStandardContextMenu();
menu->addSeparator();
menu->addAction(tr("Find..."),
this, SLOT(doOutputFindDialog()));
menu->addAction(tr("Find Next"),
this, SLOT(doOutputFindNext()), QKeySequence::FindNext);
menu->addAction(tr("Find Previous"),
this, SLOT(doOutputFindPrev()), QKeySequence::FindPrevious);
menu->exec(this->Output->mapToGlobal(pt));
delete menu;
}
void CMakeSetupDialog::doOutputFindDialog()
{
QStringList strings(this->FindHistory);

View File

@ -77,6 +77,7 @@ protected slots:
bool doConfigureInternal();
bool doGenerateInternal();
void exitLoop(int);
void doOutputContextMenu(const QPoint &);
void doOutputFindDialog();
void doOutputFindNext(bool directionForward = true);
void doOutputFindPrev();