Added QPixmap(QVariant).
Reviewed by Renato Araújo <renato.filho@openbossa.org>
This commit is contained in:
parent
03030ce194
commit
e5624ded52
2 changed files with 18 additions and 2 deletions
|
|
@ -636,6 +636,16 @@
|
||||||
<extra-includes>
|
<extra-includes>
|
||||||
<include file-name="QVariant" location="global"/>
|
<include file-name="QVariant" location="global"/>
|
||||||
</extra-includes>
|
</extra-includes>
|
||||||
|
<add-function signature="QPixmap(QVariant)">
|
||||||
|
<inject-code class="target" position="beginning">
|
||||||
|
if (%1.type() == QVariant::Pixmap)
|
||||||
|
%0 = new %TYPE(%1.value<QPixmap>());
|
||||||
|
else if (%1.type() == QVariant::Image)
|
||||||
|
%0 = new %TYPE(QPixmap::fromImage(%1.value<QImage>()));
|
||||||
|
else
|
||||||
|
PyErr_SetString(PyExc_TypeError, "QVariant must be holding a QPixmap");
|
||||||
|
</inject-code>
|
||||||
|
</add-function>
|
||||||
|
|
||||||
<modify-function signature="operator=(QPixmap)" remove="all"/>
|
<modify-function signature="operator=(QPixmap)" remove="all"/>
|
||||||
<modify-function signature="operator!()const" remove="all"/>
|
<modify-function signature="operator!()const" remove="all"/>
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from helper import UsesQApplication
|
from helper import UsesQApplication
|
||||||
from PySide.QtGui import QPixmap
|
from PySide.QtGui import *
|
||||||
from PySide.QtCore import QVariant, QSize, QString
|
from PySide.QtCore import *
|
||||||
|
|
||||||
class QPixmapTest(UsesQApplication):
|
class QPixmapTest(UsesQApplication):
|
||||||
def testQVariantConstructor(self):
|
def testQVariantConstructor(self):
|
||||||
|
|
@ -17,6 +17,12 @@ class QPixmapTest(UsesQApplication):
|
||||||
def testQStringConstructor(self):
|
def testQStringConstructor(self):
|
||||||
pixmap = QPixmap(QString("Testing!"))
|
pixmap = QPixmap(QString("Testing!"))
|
||||||
|
|
||||||
|
def testQVariantConstructor(self):
|
||||||
|
v = QVariant(QPixmap())
|
||||||
|
pixmap2 = QPixmap(v)
|
||||||
|
v = QVariant(QImage())
|
||||||
|
pixmap2 = QPixmap(v)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue