Commit 9b946cee authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

We need to be able to compare accesskey support

parent 7833ea4b
......@@ -25,14 +25,56 @@
#include <QStandardPaths>
#include <KActionCollection>
#include <QLabel>
#include <QPushButton>
TestWidget::TestWidget(QWidget *parent)
: QWidget(parent)
{
MessageViewer::MessageViewerSettings::self()->setAccessKeyEnabled(true);
QHBoxLayout *hbox = new QHBoxLayout(this);
hbox->setMargin(0);
TestWebEngineAccesskey *webEngine = new TestWebEngineAccesskey(this);
hbox->addWidget(webEngine);
}
TestWidget::~TestWidget()
{
}
TestWebKitAccesskey::TestWebKitAccesskey(QWidget *parent)
: QWidget(parent)
{
QVBoxLayout *vboxLayout = new QVBoxLayout(this);
QLabel *label = new QLabel(QStringLiteral("WebKit"));
vboxLayout->addWidget(label);
mTestWebEngine = new MessageViewer::MailWebEngineView(new KActionCollection(this), this);
mTestWebEngine->settings()->setAttribute(QWebEngineSettings::JavascriptEnabled, true);
vboxLayout->addWidget(mTestWebEngine);
mTestWebEngine->load(QUrl(QStringLiteral("http://www.kde.org")));
QPushButton *searchAccessKey = new QPushButton(QStringLiteral("AccessKey"), this);
vboxLayout->addWidget(searchAccessKey);
connect(searchAccessKey, &QPushButton::clicked, this, &TestWebKitAccesskey::slotShowAccessKey);
}
TestWebKitAccesskey::~TestWebKitAccesskey()
{
}
void TestWebKitAccesskey::slotShowAccessKey()
{
mTestWebEngine->showAccessKeys();
}
TestWebEngineAccesskey::TestWebEngineAccesskey(QWidget *parent)
: QWidget(parent)
{
QVBoxLayout *vboxLayout = new QVBoxLayout(this);
MessageViewer::MessageViewerSettings::self()->setAccessKeyEnabled(true);
mTestWebEngine = new MessageViewer::MailWebEngineView(new KActionCollection(this), this);
mTestWebEngine->settings()->setAttribute(QWebEngineSettings::JavascriptEnabled, true);
vboxLayout->addWidget(mTestWebEngine);
......@@ -57,8 +99,9 @@ int main(int argc, char *argv[])
QApplication app(argc, argv);
QStandardPaths::setTestModeEnabled(true);
app.setAttribute(Qt::AA_UseHighDpiPixmaps, true);
TestWebEngineAccesskey *testWebEngine = new TestWebEngineAccesskey;
TestWidget *testWebEngine = new TestWidget;
testWebEngine->show();
const int ret = app.exec();
return ret;
}
......@@ -25,6 +25,30 @@ namespace MessageViewer
class MailWebEngineView;
}
class TestWidget : public QWidget
{
Q_OBJECT
public:
explicit TestWidget(QWidget *parent = Q_NULLPTR);
~TestWidget();
};
class TestWebKitAccesskey : public QWidget
{
Q_OBJECT
public:
explicit TestWebKitAccesskey(QWidget *parent = Q_NULLPTR);
~TestWebKitAccesskey();
private Q_SLOTS:
void slotShowAccessKey();
private:
MessageViewer::MailWebEngineView *mTestWebEngine;
};
class TestWebEngineAccesskey : public QWidget
{
Q_OBJECT
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment