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
  Converting file tierra32 7 104 8 hours ago
Last Post: tierra32
  Creating a list of class objects hjuyrfc 2 50 Jul-22-2017, 07:41 PM
Last Post: hjuyrfc
  Class construction in python Alberto 3 84 Jul-18-2017, 03:37 PM
Last Post: ichabod801
  Error Type: <class 'OSError'> And Error Type: <class 'ValueError'> runnerpaul 1 65 Jul-18-2017, 03:08 PM
Last Post: Larz60+
  Converting Flattened JSON to Dataframe in Python 2.7 ManMan 1 75 Jul-12-2017, 06:52 PM
Last Post: ManMan
  The problem of converting string to float by using CSV file CChen 2 94 Jul-11-2017, 03:32 PM
Last Post: CChen
  Closing SQL Connection within Class vviiper 1 76 Jul-02-2017, 08:27 AM
Last Post: DeaD_EyE
  How to append arrays within a class shaynehansen 3 106 Jun-28-2017, 08:49 PM
Last Post: ichabod801
  Help using class methods shaynehansen 1 90 Jun-21-2017, 10:00 PM
Last Post: Ofnuts
  how to make class and instance method (multiple decorator) ? harun2525 7 257 May-29-2017, 04:56 PM
Last Post: harun2525

Forum Jump:


Users browsing this thread: 1 Guest(s)