Hello everyone,
I have been playing around with changing the Color of my Stethoscope while its running (for some very cheap visuals). This can be done by editing the Stethoscope class, however only the Color of the line that gets drawn is changeable (and that only since there is a different color for control and audio rate scope).
I have been digging around and have found now that the way to change the background color is most likely to edit “QcScopeShm.cpp” (propably _bkg(QColor(0, 0, 0)) in line 48) and to compile the software myself.
However I don’t have any experience with either of these things so i was wondering if there is a simpler way, or if this is maybe already integrated and i just can’t read it out of the code how to.
SCFan
I once had to do this… As a c++ novice, it’s not so bad, the patterns are all clearly laid out and you just follow them with the new things you want to add.
I wish widgets were easier to change and distribute though…
nvm, Accessing Parameters from QtScopeShm in SCLang - #4 by droptableuser is the proper answer here
Old post
I am not too familiar with QtCollider, but it seems the values from sclang
are simply mapped to a function call on the C++ side
https://github.com/supercollider/supercollider/blob/9028422a145230c322cfc923e3c1a41fc4a1b998/QtCollider/widgets/QcScopeShm.cpp#L79-L88
and
class QcScopeShm : public QWidget, QcHelper {
Q_OBJECT
Q_PROPERTY(int serverPort READ serverPort WRITE setServerPort);
Q_PROPERTY(int bufferNumber READ dummyInt WRITE setBufferNumber);
Q_PROPERTY(float xOffset READ dummyFloat WRITE setXOffset);
Q_PROPERTY(float yOffset READ dummyFloat WRITE setYOffset);
Q_PROPERTY(float xZoom READ dummyFloat WRITE setXZoom);
Q_PROPERTY(float yZoom READ dummyFloat WRITE setYZoom);
Q_PROPERTY(int style READ style WRITE setStyle);
Q_PROPERTY(QVariantList waveColors READ dummyVariantList WRITE setWaveColors);
Q_PROPERTY(QColor background READ background WRITE setBackground);
Q_PROPERTY(bool fill READ fill WRITE setFill);
Q_PROPERTY(int updateInterval READ updateInterval WRITE setUpdateInterval);
Q_PROPERTY(bool running READ running);
public:
QcScopeShm();
~QcScopeShm();
int serverPort() const { return _srvPort; }
void setServerPort(int);
But QcScopeShm has already a setter for the bg color on the C++ side
and
class QcScopeShm : public QWidget, QcHelper {
Q_OBJECT
Q_PROPERTY(int serverPort READ serverPort WRITE setServerPort);
Q_PROPERTY(int bufferNumber READ dummyInt WRITE setBufferNumber);
Q_PROPERTY(float xOffset READ dummyFloat WRITE setXOffset);
Q_PROPERTY(float yOffset READ dummyFloat WRITE setYOffset);
Q_PROPERTY(float xZoom READ dummyFloat WRITE setXZoom);
Q_PROPERTY(float yZoom READ dummyFloat WRITE setYZoom);
Q_PROPERTY(int style READ style WRITE setStyle);
Q_PROPERTY(QVariantList waveColors READ dummyVariantList WRITE setWaveColors);
Q_PROPERTY(QColor background READ background WRITE setBackground);
Q_PROPERTY(bool fill READ fill WRITE setFill);
Q_PROPERTY(int updateInterval READ updateInterval WRITE setUpdateInterval);
Q_PROPERTY(bool running READ running);
public:
QcScopeShm();
~QcScopeShm();
int serverPort() const { return _srvPort; }
void setServerPort(int);
void setBufferNumber(int);
but it is not exposed via its sclang class - so I wrote a PR to fix this => Set background color of scope via sclang by capital-G · Pull Request #6857 · supercollider/supercollider · GitHub
Not sure if you’re looking for something different but you can change the background color via the scopeView property…
w = Window.new("my own scope", Rect(20, 20, 400, 500));
w.view.decorator = FlowLayout(w.view.bounds);
c = Stethoscope.new(s, view:w.view);
c.scopeView.background_(Color.blue);
c.scopeView.waveColors_( [Color.yellow, Color.red ] )
w.onClose = { c.free }; // don't forget this
w.front;