Hello guest, if you read this it means you are not registered. Click here to register in a few simple steps, you will enjoy all features of our Forum.
Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Converting c++ class to python class
#11
Ok, another c++ clas that I 'm tryin to convert to python:

HEADER file:
class OptionGroup : public QWidget
{
Q_OBJECT
Q_PROPERTY(int currentSelection READ currentSelection WRITE setCurrentSelection USER true)

SOURCE file:
OptionGroup::OptionGroup(QWidget *parent) :QWidget(parent), currentSelection_(-1)
{
}
What do you think of this, is it correct?
class OptionGroup(QtGui.QWidget) :
    def __init__(self, parent):
        super(OptionGroup, self).__init__(parent)
        self.currentSelection_ = -1
        self.currentSelection = pyqtProperty(int, self.getCurrentSelection, self.setCurrentSelection)
Quote
#12
I found the solution!
Changed:
currentSelection = pyqtProperty(int, currentSelection, setCurrentSelection)
...to:

currentSelection = pyqtProperty(int, currentSelection, setCurrentSelection, user = True)
Quote
#13
Thanks for sharing!
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Author class, with constructor validations nexusfactor 3 62 Oct-12-2017, 11:00 PM
Last Post: ichabod801
  Setter of class object maitreyaverma 1 45 Sep-28-2017, 06:15 PM
Last Post: nilamo
  Class Error OmarSinno 1 57 Sep-28-2017, 05:49 AM
Last Post: Mekire
  Trying to create a child class in Python 2.7 mac77 1 82 Sep-27-2017, 06:15 PM
Last Post: nilamo
  Create class instances from list of strings pythonck 1 64 Sep-18-2017, 06:13 PM
Last Post: ichabod801
  Multiple classes in another class Dargonoth 3 90 Sep-08-2017, 12:29 PM
Last Post: Dargonoth
  Class File ankur2207 1 68 Sep-07-2017, 02:22 PM
Last Post: ichabod801
  Converting .ui to .py with the command prompt? PyQt & pyuic4 WildPictus 1 94 Sep-06-2017, 10:49 AM
Last Post: Larz60+
  Global accessing of parameter to class Mahamutha 3 107 Aug-23-2017, 07:04 PM
Last Post: nilamo
  Can access class private variable? Michael 2 118 Aug-11-2017, 01:59 PM
Last Post: snippsat

Forum Jump:


Users browsing this thread: 1 Guest(s)