Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 214331
Collapse All | Expand All

(-)a/extensions/PythonQt_QtAll/PythonQt_QtAll.cpp (+2 lines)
Lines 45-50 void PythonQt_init_QtXmlPatterns(PyObjec Link Here
45
void PythonQt_init_QtMultimedia(PyObject*);
45
void PythonQt_init_QtMultimedia(PyObject*);
46
void PythonQt_init_QtQml(PyObject*);
46
void PythonQt_init_QtQml(PyObject*);
47
void PythonQt_init_QtQuick(PyObject*);
47
void PythonQt_init_QtQuick(PyObject*);
48
void PythonQt_init_QtUiTools(PyObject*);
48
49
49
#ifdef PYTHONQT_WITH_WEBKIT
50
#ifdef PYTHONQT_WITH_WEBKIT
50
void PythonQt_init_QtWebKit(PyObject*);
51
void PythonQt_init_QtWebKit(PyObject*);
Lines 67-72 namespace PythonQt_QtAll Link Here
67
    PythonQt_init_QtMultimedia(0);
68
    PythonQt_init_QtMultimedia(0);
68
    PythonQt_init_QtQml(0);
69
    PythonQt_init_QtQml(0);
69
    PythonQt_init_QtQuick(0);
70
    PythonQt_init_QtQuick(0);
71
    PythonQt_init_QtUiTools(0);
70
  };
72
  };
71
};
73
};
72
74
(-)a/extensions/PythonQt_QtAll/PythonQt_QtAll.pro (-1 / +2 lines)
Lines 21-27 SOURCES += \ Link Here
21
21
22
QT += gui svg sql network xml xmlpatterns opengl
22
QT += gui svg sql network xml xmlpatterns opengl
23
QT += widgets printsupport multimedia multimediawidgets
23
QT += widgets printsupport multimedia multimediawidgets
24
QT += quick qml quickwidgets
24
QT += quick qml quickwidgets uitools
25
25
26
include ($$PYTHONQT_GENERATED_PATH/com_trolltech_qt_core/com_trolltech_qt_core.pri)
26
include ($$PYTHONQT_GENERATED_PATH/com_trolltech_qt_core/com_trolltech_qt_core.pri)
27
include ($$PYTHONQT_GENERATED_PATH/com_trolltech_qt_gui/com_trolltech_qt_gui.pri)
27
include ($$PYTHONQT_GENERATED_PATH/com_trolltech_qt_gui/com_trolltech_qt_gui.pri)
Lines 34-39 include ($$PYTHONQT_GENERATED_PATH/com_t Link Here
34
include ($$PYTHONQT_GENERATED_PATH/com_trolltech_qt_multimedia/com_trolltech_qt_multimedia.pri)
34
include ($$PYTHONQT_GENERATED_PATH/com_trolltech_qt_multimedia/com_trolltech_qt_multimedia.pri)
35
include ($$PYTHONQT_GENERATED_PATH/com_trolltech_qt_qml/com_trolltech_qt_qml.pri)
35
include ($$PYTHONQT_GENERATED_PATH/com_trolltech_qt_qml/com_trolltech_qt_qml.pri)
36
include ($$PYTHONQT_GENERATED_PATH/com_trolltech_qt_quick/com_trolltech_qt_quick.pri)
36
include ($$PYTHONQT_GENERATED_PATH/com_trolltech_qt_quick/com_trolltech_qt_quick.pri)
37
include ($$PYTHONQT_GENERATED_PATH/com_trolltech_qt_uitools/com_trolltech_qt_uitools.pri)
37
38
38
PythonQtWebKit {
39
PythonQtWebKit {
39
  QT += webkit webkitwidgets
40
  QT += webkit webkitwidgets
(-)a/generator/abstractmetalang.cpp (-4 / +14 lines)
Lines 838-851 AbstractMetaFunctionList AbstractMetaCla Link Here
838
    return returned;
838
    return returned;
839
}
839
}
840
840
841
bool AbstractMetaClass::hasDefaultIsNull() const 
841
QString AbstractMetaClass::getDefaultNonZeroFunction() const
842
{
842
{
843
  foreach(const AbstractMetaFunction* fun, queryFunctionsByName("isEmpty")) {
844
    if (fun->actualMinimumArgumentCount()==0 && fun->isPublic()) {
845
      return "isEmpty";
846
    }
847
  }
848
  foreach(const AbstractMetaFunction* fun, queryFunctionsByName("isValid")) {
849
    if (fun->actualMinimumArgumentCount() == 0 && fun->isPublic()) {
850
      return "isValid";
851
    }
852
  }
843
  foreach(const AbstractMetaFunction* fun, queryFunctionsByName("isNull")) {
853
  foreach(const AbstractMetaFunction* fun, queryFunctionsByName("isNull")) {
844
    if (fun->actualMinimumArgumentCount()==0) {
854
    if (fun->actualMinimumArgumentCount() == 0 && fun->isPublic()) {
845
      return true;
855
      return "isNull";
846
    }
856
    }
847
  }
857
  }
848
  return false;
858
  return QString();
849
}
859
}
850
860
851
/*******************************************************************************
861
/*******************************************************************************
(-)a/generator/abstractmetalang.h (-1 / +2 lines)
Lines 800-806 public: Link Here
800
    void setHasCloneOperator(bool on) { m_has_clone_operator = on; }
800
    void setHasCloneOperator(bool on) { m_has_clone_operator = on; }
801
    bool hasCloneOperator() const { return m_has_clone_operator; }
801
    bool hasCloneOperator() const { return m_has_clone_operator; }
802
802
803
    bool hasDefaultIsNull() const;
803
    QString getDefaultNonZeroFunction() const;
804
804
    void addPropertySpec(QPropertySpec *spec) { m_property_specs << spec; }
805
    void addPropertySpec(QPropertySpec *spec) { m_property_specs << spec; }
805
    QList<QPropertySpec *> propertySpecs() const { return m_property_specs; }
806
    QList<QPropertySpec *> propertySpecs() const { return m_property_specs; }
806
807
(-)a/generator/merge.sh (+11 lines)
Line 0 Link Here
1
#!/bin/sh
2
3
xsltproc -o typesystem_core.xml --stringparam source 'typesystem_core-qtscript.xml'  merge.xsl typesystem_core-common.xml
4
xsltproc -o typesystem_gui.xml --stringparam source 'typesystem_gui-qtscript.xml'  merge.xsl typesystem_gui-common.xml
5
xsltproc -o typesystem_opengl.xml --stringparam source 'typesystem_opengl-qtscript.xml'  merge.xsl typesystem_opengl-common.xml
6
xsltproc -o typesystem_network.xml --stringparam source 'typesystem_network-qtscript.xml'  merge.xsl typesystem_network-common.xml
7
xsltproc -o typesystem_xml.xml --stringparam source 'typesystem_xml-qtscript.xml'  merge.xsl typesystem_xml-common.xml
8
xsltproc -o typesystem_webkit.xml --stringparam source 'typesystem_webkit-qtscript.xml'  merge.xsl typesystem_webkit-common.xml
9
xsltproc -o typesystem_sql.xml --stringparam source 'typesystem_sql-qtscript.xml'  merge.xsl typesystem_sql-common.xml
10
xsltproc -o typesystem_svg.xml --stringparam source 'typesystem_svg-qtscript.xml'  merge.xsl typesystem_svg-common.xml
11
xsltproc -o typesystem_xmlpatterns.xml --stringparam source 'typesystem_xmlpatterns-qtscript.xml'  merge.xsl typesystem_xmlpatterns-common.xml
(-)a/generator/setupgenerator.cpp (-1 / +1 lines)
Lines 105-111 static QStringList getOperatorCodes(cons Link Here
105
      r.insert("PythonQt::Type_InplaceXor");
105
      r.insert("PythonQt::Type_InplaceXor");
106
    }
106
    }
107
  }
107
  }
108
  if (cls->hasDefaultIsNull()) {
108
  if (!cls->getDefaultNonZeroFunction().isEmpty()) {
109
    r.insert("PythonQt::Type_NonZero");
109
    r.insert("PythonQt::Type_NonZero");
110
  }
110
  }
111
111
(-)a/generator/shellheadergenerator.cpp (-3 / +12 lines)
Lines 267-273 void ShellHeaderGenerator::write(QTextSt Link Here
267
  QList<FlagsTypeEntry*> flags;
267
  QList<FlagsTypeEntry*> flags;
268
  foreach(AbstractMetaEnum* enum1, enums1) {
268
  foreach(AbstractMetaEnum* enum1, enums1) {
269
    // catch gadgets and enums that are not exported on QObjects...
269
    // catch gadgets and enums that are not exported on QObjects...
270
    if ((enum1->wasProtected() || enum1->wasPublic()) && (!meta_class->isQObject() || !enum1->hasQEnumsDeclaration())) {
270
    // since we don't parse Q_FLAG(S), we also need to generate for Q_ENUM which might
271
    // have a missing Q_FLAG(S) declaration.
272
    if ((enum1->wasProtected() || enum1->wasPublic()) && 
273
      (!meta_class->isQObject() || !enum1->hasQEnumsDeclaration() || enum1->typeEntry()->flags()))
274
    {
271
      enums << enum1;
275
      enums << enum1;
272
      if (enum1->typeEntry()->flags()) {
276
      if (enum1->typeEntry()->flags()) {
273
        flags << enum1->typeEntry()->flags();
277
        flags << enum1->typeEntry()->flags();
Lines 395-402 void ShellHeaderGenerator::write(QTextSt Link Here
395
  if (meta_class->hasDefaultToStringFunction() || meta_class->hasToStringCapability()) {
399
  if (meta_class->hasDefaultToStringFunction() || meta_class->hasToStringCapability()) {
396
    s << "    QString py_toString(" << meta_class->qualifiedCppName() << "*);" << endl; 
400
    s << "    QString py_toString(" << meta_class->qualifiedCppName() << "*);" << endl; 
397
  }
401
  }
398
  if (meta_class->hasDefaultIsNull()) {
402
  QString nonZeroFunc = meta_class->getDefaultNonZeroFunction();
399
    s << "    bool __nonzero__(" << meta_class->qualifiedCppName() << "* obj) { return !obj->isNull(); }" << endl; 
403
  if (!nonZeroFunc.isEmpty()) {
404
    s << "    bool __nonzero__(" << meta_class->qualifiedCppName() << "* obj) { return ";
405
    if (nonZeroFunc != "isValid") {
406
      s << "!";
407
    }
408
    s << "obj->" << nonZeroFunc << "(); }" << endl;
400
  }
409
  }
401
410
402
  AbstractMetaFieldList fields = meta_class->fields();
411
  AbstractMetaFieldList fields = meta_class->fields();
(-)a/generator/typesystem_core.xml (+2 lines)
Lines 550-555 Link Here
550
  <rejection class="QObject" function-name="disconnectNotify"/>
550
  <rejection class="QObject" function-name="disconnectNotify"/>
551
  <rejection class="QObject" function-name="registerUserData"/>
551
  <rejection class="QObject" function-name="registerUserData"/>
552
  <rejection class="QProcess" function-name="pid"/>
552
  <rejection class="QProcess" function-name="pid"/>
553
  <rejection class="QProcess" function-name="setInheritHandles"/>
554
  <rejection class="QProcess" function-name="inheritHandles"/>
553
  <rejection class="QRegion" function-name="cleanUp"/>
555
  <rejection class="QRegion" function-name="cleanUp"/>
554
  <rejection class="QSettings" function-name="registerFormat"/>
556
  <rejection class="QSettings" function-name="registerFormat"/>
555
  <rejection class="QVector" function-name="back"/>
557
  <rejection class="QVector" function-name="back"/>
(-)a/generator/typesystem_gui.xml (+11 lines)
Lines 1307-1312 PyObject* constScanLine(QImage* image, i Link Here
1307
  <object-type name="QWizard">
1307
  <object-type name="QWizard">
1308
    <!-- ### Requires correct class name in meta object -->
1308
    <!-- ### Requires correct class name in meta object -->
1309
    <modify-function signature="setDefaultProperty(const char *, const char *, const char *)" remove="all"/>
1309
    <modify-function signature="setDefaultProperty(const char *, const char *, const char *)" remove="all"/>
1310
    
1311
    <modify-function signature="addPage(QWizardPage*)">
1312
      <modify-argument index="1">
1313
        <define-ownership owner="c++" />
1314
      </modify-argument>
1315
    </modify-function>
1316
    <modify-function signature="setButton(QWizard::WizardButton, QAbstractButton*)">
1317
      <modify-argument index="2">
1318
        <define-ownership owner="c++" />
1319
      </modify-argument>
1320
    </modify-function>
1310
  </object-type>
1321
  </object-type>
1311
  <object-type name="QWizardPage">
1322
  <object-type name="QWizardPage">
1312
  </object-type>
1323
  </object-type>
(-)a/src/PythonQtConversion.cpp (-5 / +25 lines)
Lines 746-754 QString PythonQtConv::PyObjGetRepresenta Link Here
746
QString PythonQtConv::PyObjGetString(PyObject* val, bool strict, bool& ok) {
746
QString PythonQtConv::PyObjGetString(PyObject* val, bool strict, bool& ok) {
747
  QString r;
747
  QString r;
748
  ok = true;
748
  ok = true;
749
#ifndef PY3K
750
  // in Python 3, we don't want to convert to QString, since we don't know anything about the encoding
751
  // in Python 2, we assume the default for str is latin-1
749
  if (val->ob_type == &PyBytes_Type) {
752
  if (val->ob_type == &PyBytes_Type) {
750
    r = QString(PyBytes_AS_STRING(val));
753
    r = QString::fromLatin1(PyBytes_AS_STRING(val));
751
  } else if (PyUnicode_Check(val)) {
754
  } else
755
#endif
756
  if (PyUnicode_Check(val)) {
752
#ifdef PY3K
757
#ifdef PY3K
753
    r = QString::fromUtf8(PyUnicode_AsUTF8(val));
758
    r = QString::fromUtf8(PyUnicode_AsUTF8(val));
754
#else
759
#else
Lines 976-983 QVariant PythonQtConv::PyObjToQVariant(P Link Here
976
#endif
981
#endif
977
    ) {
982
    ) {
978
    // no special type requested
983
    // no special type requested
979
    if (PyBytes_Check(val) || PyUnicode_Check(val)) {
984
    if (PyBytes_Check(val)) {
980
      // NOTE: for compatibility reasons between Python 2/3 we don't use ByteArray for PyBytes_Type
985
#ifdef PY3K
986
      // In Python 3, it is a ByteArray
987
      type = QVariant::ByteArray;
988
#else
989
      // In Python 2, we need to use String, since it might be a string
990
      type = QVariant::String;
991
#endif
992
    } else if (PyUnicode_Check(val)) {
981
      type = QVariant::String;
993
      type = QVariant::String;
982
    } else if (val == Py_False || val == Py_True) {
994
    } else if (val == Py_False || val == Py_True) {
983
      type = QVariant::Bool;
995
      type = QVariant::Bool;
Lines 1117-1122 QVariant PythonQtConv::PyObjToQVariant(P Link Here
1117
    }
1129
    }
1118
1130
1119
  case QVariant::ByteArray:
1131
  case QVariant::ByteArray:
1132
    {
1133
      bool ok;
1134
#ifdef PY3K
1135
      v = QVariant(PyObjGetBytes(val, false, ok));
1136
#else
1137
      v = QVariant(PyObjGetString(val, false, ok));
1138
#endif
1139
    }
1120
  case QVariant::String:
1140
  case QVariant::String:
1121
    {
1141
    {
1122
      bool ok;
1142
      bool ok;
Lines 1504-1510 QByteArray PythonQtConv::getCPPTypeName( Link Here
1504
bool PythonQtConv::isStringType(PyTypeObject* type)
1524
bool PythonQtConv::isStringType(PyTypeObject* type)
1505
{
1525
{
1506
#ifdef PY3K
1526
#ifdef PY3K
1507
  return type == &PyUnicode_Type
1527
  return type == &PyUnicode_Type;
1508
#else
1528
#else
1509
  return type == &PyUnicode_Type || type == &PyString_Type;
1529
  return type == &PyUnicode_Type || type == &PyString_Type;
1510
#endif
1530
#endif
(-)a/src/PythonQt.cpp (+1 lines)
Lines 1977-1982 void PythonQtPrivate::buildDynamicMetaOb Link Here
1977
  // Now look for slots: (this is a bug in QMetaObjectBuilder, all signals need to be added first)
1977
  // Now look for slots: (this is a bug in QMetaObjectBuilder, all signals need to be added first)
1978
  while (PyDict_Next(dict, &pos, &key, &value)) {
1978
  while (PyDict_Next(dict, &pos, &key, &value)) {
1979
    if (PythonQtProperty_Check(value)) {
1979
    if (PythonQtProperty_Check(value)) {
1980
      needsMetaObject = true;
1980
      PythonQtProperty* prop = (PythonQtProperty*)value;
1981
      PythonQtProperty* prop = (PythonQtProperty*)value;
1981
      QMetaPropertyBuilder newProp = builder.addProperty(PyString_AsString(key), prop->data->cppType);
1982
      QMetaPropertyBuilder newProp = builder.addProperty(PyString_AsString(key), prop->data->cppType);
1982
      newProp.setReadable(true);
1983
      newProp.setReadable(true);
(-)a/src/PythonQtSlotDecorator.cpp (-2 / +2 lines)
Lines 42-50 int PythonQtSlotDecorator_init(PyObject Link Here
42
  char* argName = 0;
42
  char* argName = 0;
43
  PyObject* argResult = 0;
43
  PyObject* argResult = 0;
44
44
45
  static char* kwlist[] = {"name", "result", 0};
45
  static const char* kwlist[] = {"name", "result", 0};
46
  static PyObject* emptyTuple = PyTuple_New(0);
46
  static PyObject* emptyTuple = PyTuple_New(0);
47
  if (!PyArg_ParseTupleAndKeywords(emptyTuple, kw, "|sO:QtCore.Slot", kwlist, &argName, &argResult)) {
47
  if (!PyArg_ParseTupleAndKeywords(emptyTuple, kw, "|sO:QtCore.Slot", (char**) kwlist, &argName, &argResult)) {
48
    return 0;
48
    return 0;
49
  }
49
  }
50
50
(-)a/src/PythonQtStdDecorators.cpp (-3 / +3 lines)
Lines 153-164 QVariant PythonQtStdDecorators::property Link Here
153
  return o->property(name);
153
  return o->property(name);
154
}
154
}
155
155
156
QString PythonQtStdDecorators::tr(QObject* obj, const QByteArray& text, const QByteArray& ambig, int n)
156
QString PythonQtStdDecorators::tr(QObject* obj, const QString& text, const QString& ambig, int n)
157
{
157
{
158
#if( QT_VERSION >= QT_VERSION_CHECK(5,0,0) )
158
#if( QT_VERSION >= QT_VERSION_CHECK(5,0,0) )
159
  return QCoreApplication::translate(obj->metaObject()->className(), text.constData(), ambig.constData(), n);
159
  return QCoreApplication::translate(obj->metaObject()->className(), text.toUtf8().constData(), ambig.toUtf8().constData(), n);
160
#else
160
#else
161
  return QCoreApplication::translate(obj->metaObject()->className(), text.constData(), ambig.constData(), QCoreApplication::CodecForTr, n);
161
  return QCoreApplication::translate(obj->metaObject()->className(), text.toUtf8().constData(), ambig.toUtf8().constData(), QCoreApplication::CodecForTr, n);
162
#endif
162
#endif
163
}
163
}
164
164
(-)a/src/PythonQtStdDecorators.h (-3 / +3 lines)
Lines 106-115 public Q_SLOTS: Link Here
106
  int static_Qt_qrand() { return qrand(); }
106
  int static_Qt_qrand() { return qrand(); }
107
  void static_Qt_qsrand(uint a) { qsrand(a); }
107
  void static_Qt_qsrand(uint a) { qsrand(a); }
108
108
109
  QString tr(QObject* obj, const QByteArray& text, const QByteArray& ambig = QByteArray(), int n = -1);
109
  QString tr(QObject* obj, const QString& text, const QString& ambig = QString(), int n = -1);
110
110
111
  QByteArray static_Qt_SIGNAL(const QByteArray& s) { return QByteArray("2") + s; }
111
  QString static_Qt_SIGNAL(const QString& s) { return QString("2") + s; }
112
  QByteArray static_Qt_SLOT(const QByteArray& s) { return QByteArray("1") + s; }
112
  QString static_Qt_SLOT(const QString& s) { return QString("1") + s; }
113
113
114
  void static_QTimer_singleShot(int msec, PyObject* callable);
114
  void static_QTimer_singleShot(int msec, PyObject* callable);
115
115

Return to bug 214331