Test your websites with this simple GUI based scripted webtester. Generate simple testscripts directly from surfng on the webpage, enhance them with your commands, with variables, loops, checks, … and finally run automated web tests.
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.3 KiB
54 lines
1.3 KiB
#ifndef __HELP__HXX |
|
#define __HELP__HXX |
|
|
|
#include <ui_help.hxx> |
|
#include <commands.hxx> |
|
#include <cassert> |
|
|
|
class Help: public QDockWidget, protected Ui::Help { |
|
Q_OBJECT |
|
public: |
|
Help(QWidget* p = nullptr): QDockWidget(p) { |
|
setupUi(this); |
|
_search->hide(); |
|
_help->setText(script.commands(Script::HTML)); |
|
} |
|
public Q_SLOTS: |
|
void on__search_textEdited(const QString& txt) { |
|
_help->moveCursor(QTextCursor::Start); |
|
if (script.prototypes().count(txt)) |
|
_help->scrollToAnchor(txt); |
|
else |
|
_help->find(txt); |
|
} |
|
void on__search_returnPressed() { |
|
next(); |
|
} |
|
void next() { |
|
_help->find(_search->text()); |
|
} |
|
void previous() { |
|
_help->find(_search->text(), QTextDocument::FindBackward); |
|
} |
|
void startSearch() { |
|
_search->show(); |
|
_search->setFocus(); |
|
_search->selectAll(); |
|
} |
|
protected: |
|
void keyPressEvent(QKeyEvent *e) { |
|
if (e->matches(QKeySequence::Find)) |
|
startSearch(); |
|
if (e->matches(QKeySequence::FindNext)) |
|
next(); |
|
if (e->matches(QKeySequence::FindPrevious)) |
|
previous(); |
|
if (e->matches(QKeySequence::Cancel)) |
|
_search->hide(); |
|
return QDockWidget::keyPressEvent(e); |
|
} |
|
private: |
|
const Script script; |
|
}; |
|
|
|
#endif
|
|
|