Fetch mCmdHistory on an empty mCmdLineEdit
This commit is contained in:
parent
1f0577ff68
commit
6a02c7863b
|
|
@ -46,6 +46,14 @@ void HistoryLineEdit::addLineToHistory(QString parLine)
|
|||
mCmdIndex = -1;
|
||||
}
|
||||
|
||||
QString HistoryLineEdit::getLineFromHistory()
|
||||
{
|
||||
if(mCmdHistory.empty())
|
||||
return "";
|
||||
else
|
||||
return mCmdHistory.first();
|
||||
}
|
||||
|
||||
QString HistoryLineEdit::addHistoryClear()
|
||||
{
|
||||
auto str = text();
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ public:
|
|||
explicit HistoryLineEdit(QWidget* parent = 0);
|
||||
void keyPressEvent(QKeyEvent* event);
|
||||
void addLineToHistory(QString parLine);
|
||||
QString getLineFromHistory();
|
||||
QString addHistoryClear();
|
||||
void setFocus();
|
||||
void loadSettings(QString sectionPrefix);
|
||||
|
|
|
|||
|
|
@ -113,10 +113,13 @@ void CommandLineEdit::execute()
|
|||
if(mCurrentScriptIndex == -1)
|
||||
return;
|
||||
GUISCRIPTEXECUTE exec = mScriptInfo[mCurrentScriptIndex].execute;
|
||||
const QString & cmd = text();
|
||||
QString & cmd = text();
|
||||
|
||||
if(exec)
|
||||
{
|
||||
if(cmd.trimmed().isEmpty())
|
||||
cmd = getLineFromHistory();
|
||||
|
||||
// Send this string directly to the user
|
||||
exec(cmd.toUtf8().constData());
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue