//---------------------------------------------init void ModuleWidget::init() { m_pUi = new Ui::ModuleWidgetUI(); m_pUi->setupUi(this); m_pUi->m_pModuleName->setText(QString(m_pModule->getRuntimeModuleID().c_str())); setAcceptDrops(true); m_aTimer.start(TIMER_UNIT); //interval the timer is invoked connectModuleSignals(); //call virtual method //QObject::connect(m_pUi->m_pRunButton, SIGNAL(pressed()), this, SLOT(onRunButton())); //QObject::connect(m_pUi->m_pResetButton, SIGNAL(pressed()), this, SLOT(onResetButton())); QObject::connect(&m_aTimer, SIGNAL(timeout()), this, SLOT(onTimer())); initInputs(); initOutputs(); setContextMenuPolicy(Qt::CustomContextMenu); static QBitmap aMask; if(aMask.width() == 0) //create the mask only once { aMask = QBitmap(size()); aMask.clear(); QPainter aPainter(&aMask); aPainter.setBrush(QBrush(Qt::SolidPattern)); aPainter.drawEllipse(QPoint(width()/2, height()/2), width()/2, width()/2); } setMask(aMask); }
//------------------------------------------------------- void Terrain::createCrossCursor () { //--------------------------------------------------- // Define new cross cursor, more visible //--------------------------------------------------- /* * B=1 and M=1 gives black. * B=0 and M=1 gives white. * B=0 and M=0 gives transparent. * B=1 and M=0 gives an XOR'd result.*/ QBitmap *crossBits = new QBitmap(32,32); QBitmap *crossMask = new QBitmap(32,32); crossBits->clear(); crossMask->clear(); QPainter pb (crossBits); QPainter pm (crossMask); QPen pen1(Qt::color1); pen1.setWidth(1); pb.setPen(pen1); pb.drawLine(6,16, 26,16); pb.drawLine(16,6, 16,26); pm.setPen(pen1); // black pm.drawLine(6,16, 26,16); pm.drawLine(16,6, 16,26); // white pm.drawLine(6,15, 26,15); pm.drawLine(6,17, 26,17); pm.drawLine(15,6, 15,26); pm.drawLine(17,6, 17,26); pb.end(); pm.end(); myCrossCursor = QCursor(*crossBits, *crossMask); int v = 180; selectColor = QColor(v,v,v); setCursor(myCrossCursor); }
static PyObject *meth_QBitmap_clear(PyObject *sipSelf, PyObject *sipArgs) { PyObject *sipParseErr = NULL; { QBitmap *sipCpp; if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QBitmap, &sipCpp)) { sipCpp->clear(); Py_INCREF(Py_None); return Py_None; } } /* Raise an exception if the arguments couldn't be parsed. */ sipNoMethod(sipParseErr, sipName_QBitmap, sipName_clear, doc_QBitmap_clear); return NULL; }