Skip to content
This repository has been archived by the owner on Jan 2, 2023. It is now read-only.

More support for --enable-forms. #43

Open
wants to merge 10 commits into
base: wk_4.8.7
Choose a base branch
from
21 changes: 15 additions & 6 deletions src/gui/painting/qpaintengine.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,23 @@ class Q_GUI_EXPORT QPaintEngine
virtual void addHyperlink(const QRectF &r, const QUrl &url) {Q_UNUSED(r); Q_UNUSED(url);}
virtual void addAnchor(const QRectF &r, const QString &name) {Q_UNUSED(r); Q_UNUSED(name);}
virtual void addLink(const QRectF &r, const QString &anchor) {Q_UNUSED(r); Q_UNUSED(anchor);}
virtual void addTextField(const QRectF &r, const QString &text, const QString &name, bool multiLine, bool password, bool readOnly, int maxLength) {
Q_UNUSED(r); Q_UNUSED(text); Q_UNUSED(name); Q_UNUSED(multiLine); Q_UNUSED(password); Q_UNUSED(readOnly); Q_UNUSED(maxLength);
virtual void addTextField(const QRectF &r,const QMap<QString, QString> &data, const QString &text, const QString &name, bool multiLine, bool password, bool readOnly, int maxLength) {
Q_UNUSED(r); Q_UNUSED(text); Q_UNUSED(name); Q_UNUSED(multiLine); Q_UNUSED(password); Q_UNUSED(readOnly); Q_UNUSED(maxLength); Q_UNUSED(data);
}
virtual void addCheckBox(const QRectF &r, bool checked, const QString &name, bool readOnly) {
Q_UNUSED(r); Q_UNUSED(checked); Q_UNUSED(name); Q_UNUSED(readOnly);
virtual void addHiddenField(const QRectF &r, const QMap<QString, QString> &data, const QString &value, const QString &name) {
Q_UNUSED(r); Q_UNUSED(name); Q_UNUSED(value); Q_UNUSED(data);
}
virtual void addRadioButton(const QRectF &r, const QString & group="", bool checked=false, const QString &name="", bool readOnly=false) {
Q_UNUSED(r); Q_UNUSED(checked); Q_UNUSED(name); Q_UNUSED(readOnly); Q_UNUSED(group);
virtual void addCheckBox(const QRectF &r, const QMap<QString, QString> &data, bool checked, const QString &name, bool readOnly) {
Q_UNUSED(r); Q_UNUSED(checked); Q_UNUSED(name); Q_UNUSED(readOnly); Q_UNUSED(data);
}
virtual void addRadioButton(const QRectF &r, const QMap<QString, QString> &data, bool checked=false, const QString &name="", const QString &value="", bool readOnly=false) {
Q_UNUSED(r); Q_UNUSED(checked); Q_UNUSED(name); Q_UNUSED(readOnly); Q_UNUSED(value); Q_UNUSED(data);
}
virtual void addComboBox(const QRectF &r, const QMap<QString, QString> &data, const QString &name="", const QString &option_list="[]", const QString &default_value="", bool readOnly=false) {
Q_UNUSED(r); Q_UNUSED(default_value); Q_UNUSED(name); Q_UNUSED(readOnly); Q_UNUSED(option_list); Q_UNUSED(data);
}
virtual void addPageJavaScript(const QMap<QString, QString> &data, const QString &script) {
Q_UNUSED(data); Q_UNUSED(script);
}

virtual void drawLines(const QLine *lines, int lineCount);
Expand Down
39 changes: 33 additions & 6 deletions src/gui/painting/qpainter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7420,32 +7420,59 @@ void QPainter::addHyperlink(const QRectF &r, const QUrl &url)
d->engine->addHyperlink(worldTransform().mapRect(r), url);
}

void QPainter::addTextField(const QRectF &r, const QString &text, const QString &name, bool multiLine, bool password, bool readOnly, int maxLength) {
void QPainter::addHiddenField(const QRectF &r, const QMap<QString, QString> &data, const QString &value, const QString &name) {
Q_D(QPainter);
if (!d->engine) {
qWarning("QPainter::addHiddenField: Painter not active");
return;
}
d->engine->addHiddenField(worldTransform().mapRect(r), data, value, name);
}

void QPainter::addTextField(const QRectF &r, const QMap<QString, QString> &data, const QString &text, const QString &name, bool multiLine, bool password, bool readOnly, int maxLength) {
Q_D(QPainter);
if (!d->engine) {
qWarning("QPainter::addTextField: Painter not active");
return;
}
d->engine->addTextField(worldTransform().mapRect(r), text, name, multiLine, password, readOnly, maxLength);
d->engine->addTextField(worldTransform().mapRect(r), data, text, name, multiLine, password, readOnly, maxLength);
}

void QPainter::addPageJavaScript(const QMap<QString, QString> &data, const QString &script) {
Q_D(QPainter);
if (!d->engine) {
qWarning("QPainter::addPageJavascript: Painter not active");
return;
}
d->engine->addPageJavaScript(data, script);
}

void QPainter::addCheckBox(const QRectF &r, bool checked, const QString &name, bool readOnly) {
void QPainter::addCheckBox(const QRectF &r, const QMap<QString, QString> &data, bool checked, const QString &name, bool readOnly) {
Q_D(QPainter);
if (!d->engine) {
qWarning("QPainter::addCheckBox: Painter not active");
return;
}
d->engine->addCheckBox(worldTransform().mapRect(r), checked, name, readOnly);
d->engine->addCheckBox(worldTransform().mapRect(r), data, checked, name, readOnly);
}


void QPainter::addRadioButton(const QRectF &r, const QString & group, bool checked, const QString &name, bool readOnly) {
void QPainter::addRadioButton(const QRectF &r, const QMap<QString, QString> &data, bool checked, const QString &name, const QString &value, bool readOnly) {
Q_D(QPainter);
if (!d->engine) {
qWarning("QPainter::addRadioButton: Painter not active");
return;
}
d->engine->addRadioButton(worldTransform().mapRect(r), group, checked, name, readOnly);
d->engine->addRadioButton(worldTransform().mapRect(r), data, checked, name, value, readOnly);
}

void QPainter::addComboBox(const QRectF &r, const QMap<QString, QString> &data, const QString &name, const QString &option_list, const QString &default_value, bool readOnly) {
Q_D(QPainter);
if (!d->engine) {
qWarning("QPainter::addComboBox: Painter not active");
return;
}
d->engine->addComboBox(worldTransform().mapRect(r), data, name, option_list, default_value, readOnly);
}

/*!
Expand Down
11 changes: 7 additions & 4 deletions src/gui/painting/qpainter.h
Original file line number Diff line number Diff line change
Expand Up @@ -454,10 +454,13 @@ class Q_GUI_EXPORT QPainter
inline void addLink(int x, int y, int w, int h, const QString &anchor);
inline void addLink(const QRect &r, const QString &anchor);
void addLink(const QRectF &r, const QString &anchor);

void addTextField(const QRectF &r, const QString &text="", const QString &name="", bool multiLine=false, bool password=false, bool readOnly=false, int maxLength=-1);
void addCheckBox(const QRectF &r, bool checked=false, const QString &name="", bool readOnly=false);
void addRadioButton(const QRectF &r, const QString & group="", bool checked=false, const QString &name="", bool readOnly=false);;

void addHiddenField(const QRectF &r, const QMap<QString, QString> &data, const QString &value="", const QString &name="");
void addPageJavaScript(const QMap<QString, QString> &data, const QString &script);
void addTextField(const QRectF &r, const QMap<QString, QString> &data, const QString &text="", const QString &name="", bool multiLine=false, bool password=false, bool readOnly=false, int maxLength=-1);
void addCheckBox(const QRectF &r, const QMap<QString, QString> &data, bool checked=false, const QString &name="", bool readOnly=false);
void addRadioButton(const QRectF &r, const QMap<QString, QString> &data, bool checked=false, const QString &name="", const QString &value="", bool readOnly=false);
void addComboBox(const QRectF &r, const QMap<QString, QString> &data, const QString &name="", const QString &option_list="[]", const QString &default_value="", bool readOnly=false);

inline void addHyperlink(int x, int y, int w, int h, const QUrl &url);
inline void addHyperlink(const QRect &r, const QUrl &url);
Expand Down
Loading