• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ setCursor函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中setCursor函数的典型用法代码示例。如果您正苦于以下问题:C++ setCursor函数的具体用法?C++ setCursor怎么用?C++ setCursor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了setCursor函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: setCursor

void NBaseMiniAppWidget::leaveEvent(QEvent *event)
{
    setCursor(Qt::ArrowCursor);
    NBaseMoveableWidget::leaveEvent(event);
}
开发者ID:Jinxiaohai,项目名称:QT,代码行数:5,代码来源:nbaseminiappwidget.cpp


示例2: Splitter

 Splitter( BrowserBar *w ) : QWidget( w, "divider" )
 {
     setCursor( QCursor(SplitHCursor) );
     styleChange( style() );
 }
开发者ID:gms8994,项目名称:amarok-1.4,代码行数:5,代码来源:browserbar.cpp


示例3: setFontType

/** \brief Initialisation of MicroOLED Library.

    Setup IO pins for SPI port then send initialisation commands to the SSD1306 controller inside the OLED.
*/
void MicroOLED::begin()
{
	// default 5x7 font
	setFontType(0);
	setColor(WHITE);
	setDrawMode(NORM);
	setCursor(0,0);

	pinMode(dcPin, OUTPUT);
	pinMode(rstPin, OUTPUT);

	// Set up the selected interface:
	if (interface == MODE_SPI)
		spiSetup();
	else if (interface == MODE_I2C)
		i2cSetup();
	else if (interface == MODE_PARALLEL)
		parallelSetup();

	// Display reset routine
	pinMode(rstPin, OUTPUT);	// Set RST pin as OUTPUT
	digitalWrite(rstPin, HIGH);	// Initially set RST HIGH
	delay(5);	// VDD (3.3V) goes high at start, lets just chill for 5 ms
	digitalWrite(rstPin, LOW);	// Bring RST low, reset the display
	delay(10);	// wait 10ms
	digitalWrite(rstPin, HIGH);	// Set RST HIGH, bring out of reset

	// Display Init sequence for 64x48 OLED module
	command(DISPLAYOFF);			// 0xAE

	command(SETDISPLAYCLOCKDIV);	// 0xD5
	command(0x80);					// the suggested ratio 0x80

	command(SETMULTIPLEX);			// 0xA8
	command(0x2F);

	command(SETDISPLAYOFFSET);		// 0xD3
	command(0x0);					// no offset

	command(SETSTARTLINE | 0x0);	// line #0

	command(CHARGEPUMP);			// enable charge pump
	command(0x14);

	command(NORMALDISPLAY);			// 0xA6
	command(DISPLAYALLONRESUME);	// 0xA4

	command(SEGREMAP | 0x1);
	command(COMSCANDEC);

	command(SETCOMPINS);			// 0xDA
	command(0x12);

	command(SETCONTRAST);			// 0x81
	command(0x8F);

	command(SETPRECHARGE);			// 0xd9
	command(0xF1);

	command(SETVCOMDESELECT);			// 0xDB
	command(0x40);

	command(DISPLAYON);				//--turn on oled panel
	clear(ALL);						// Erase hardware memory inside the OLED controller to avoid random data in memory.
}
开发者ID:Olivinitic,项目名称:Garden_Project_Libraries,代码行数:69,代码来源:SFE_MicroOLED.cpp


示例4: if

void ChartWidget::mouseMoveEvent(QMouseEvent* e)
{
	const QPoint& pos = e->pos();
	m_ptMouseWidget = pos;
	m_ptMousePixmap = m_ptMouseWidget - m_rcPixmap.topLeft();

	if (m_bDragging)
	{
		const ChartPointInfo& info = m_clickInfo;
		ViewWaveInfo* vwi = info.vwi;
		WaveInfo* wave = (vwi != NULL) ? vwi->waveInfo() : NULL;

		if (m_bSelecting)
		{
			// While selecting, don't let the mouse move out of the pixmap
			if (m_ptMousePixmap.x() < 0)
				m_ptMousePixmap.setX(0);
			else if (m_ptMousePixmap.x() >= m_rcPixmap.width())
				m_ptMousePixmap.setX(m_rcPixmap.width() - 1);
			update();
		}
		else if (info.iChosenPeak >= 0)
		{
			int x = pos.x() - m_rcPixmap.left();
			int didx = m_pixmap->xToCenterSample(info.vwi->wave(), x);
			moveMarkerHandle(vwi, info.iChosenPeak, info.iMarkerDidx, didx);
		}
		else if (wave != NULL)
		{
			// REFACTOR: I don't know what this statement is doing here -- ellis, 2010-10-04
			if (e->modifiers() == Qt::ControlModifier && m_chartS->params().peakMode == EadMarkerMode_Edit && wave == m_pixmap->waveOfPeaks())
			{
				setCursor(Qt::PointingHandCursor);
			}
			else
			{
				// How much has the mouse been moved in total during this drag?
				double nStart = m_pixmap->yToValue(vwi, m_ptClickPixmap.y());
				double nEnd = m_pixmap->yToValue(vwi, m_ptMousePixmap.y());
				double nVolts = nEnd - nStart;
				double nOffset = nVolts / vwi->voltsPerDivision();
				// Set the channel offset appropriately
				vwi->setDivisionOffset(m_nDragOrigDivisionOffset - nOffset);

				m_chartS->redraw();
			}
		}
		else
		{
			int nDiffXOrig = m_ptMousePixmap.x() - m_ptClickPixmap.x();
			int nDiffSamplesOrig = m_pixmap->widthToSampleCount(-nDiffXOrig);
			int iSample = m_nClickSampleOffset + nDiffSamplesOrig;
			m_chartS->setSampleOffset(iSample);
		}
	}
	else
	{
		updateMouseCursor(e->modifiers());
	}

	updateStatus();
}
开发者ID:ellis,项目名称:gcead,代码行数:62,代码来源:ChartWidget.cpp


示例5: tr

void GenCertDialog::genPerson()
{
	/* Check the data from the GUI. */
	std::string genLoc  = ui.node_input->text().toUtf8().constData();
	RsPgpId PGPId;
	bool isHiddenLoc = false;

    if (ui.hidden_checkbox->isChecked())
	{
		std::string hl = ui.hiddenaddr_input->text().toStdString();
		uint16_t port  = ui.hiddenport_spinBox->value();
		if (!RsInit::SetHiddenLocation(hl, port))	/* parses it */
		{
			/* Message Dialog */
			QMessageBox::warning(this,
				tr("Invalid hidden node"),
			tr("Please enter a valid address of the form: 31769173498.onion:7800 or [52 characters].b32.i2p"),
			QMessageBox::Ok);
			return;
		}
		isHiddenLoc = true;
	}

	if (!genNewGPGKey) {
		if (genLoc.length() < 3) {
			/* Message Dialog */
			QMessageBox::warning(this,
								 tr("PGP key pair generation failure"),
								 tr("Node field is required with a minimum of 3 characters"),
								 QMessageBox::Ok);
			return;
		}
		int pgpidx = ui.genPGPuser->currentIndex();
		if (pgpidx < 0)
		{
			/* Message Dialog */
			QMessageBox::warning(this,
								 tr("Profile generation failure"),
								 tr("Missing PGP certificate"),
								 QMessageBox::Ok);
			return;
		}
		QVariant data = ui.genPGPuser->itemData(pgpidx);
		PGPId = RsPgpId((data.toString()).toStdString());
	} else {
		if (ui.password_input->text().length() < 3 || ui.name_input->text().length() < 3 || genLoc.length() < 3) {
			/* Message Dialog */
			QMessageBox::warning(this,
								 tr("PGP key pair generation failure"),
								 tr("All fields are required with a minimum of 3 characters"),
								 QMessageBox::Ok);
			return;
		}

		if(ui.password_input->text() != ui.password_input_2->text())
		{
			QMessageBox::warning(this,
								 tr("PGP key pair generation failure"),
								 tr("Passwords do not match"),
								 QMessageBox::Ok);
			return;
		}
		//generate a new gpg key
		std::string err_string;
		ui.no_gpg_key_label->setText(tr("Generating new PGP key pair, please be patient: this process needs generating large prime numbers, and can take some minutes on slow computers. \n\nFill in your PGP password when asked, to sign your new key."));
		ui.no_gpg_key_label->show();
		ui.new_gpg_key_checkbox->hide();
		ui.name_label->hide();
		ui.name_input->hide();
//		ui.email_label->hide();
//		ui.email_input->hide();
		ui.password_label_2->hide();
		ui.password_input_2->hide();
		ui.password_label->hide();
		ui.password_input->hide();
		ui.genPGPuserlabel->hide();
		ui.genPGPuser->hide();
		ui.node_label->hide();
		ui.node_input->hide();
        ui.genButton2->hide();
		ui.importIdentity_PB->hide();
		ui.genprofileinfo_label->hide();
        ui.hidden_checkbox->hide();
        ui.adv_checkbox->hide();
        ui.keylength_label->hide();
		ui.keylength_comboBox->hide();

		setCursor(Qt::WaitCursor) ;

		QCoreApplication::processEvents();
		while(QAbstractEventDispatcher::instance()->processEvents(QEventLoop::AllEvents)) ;

		std::string email_str = "" ;
		RsAccounts::GeneratePGPCertificate(
					ui.name_input->text().toUtf8().constData(),
					email_str.c_str(),
					ui.password_input->text().toUtf8().constData(),
					PGPId,
					ui.keylength_comboBox->itemData(ui.keylength_comboBox->currentIndex()).toInt(),
					err_string);
//.........这里部分代码省略.........
开发者ID:heini,项目名称:RetroShare,代码行数:101,代码来源:GenCertDialog.cpp


示例6: setCursor

void Text::dragTo(const QPointF& p)
      {
      setCursor(p, QTextCursor::KeepAnchor);
      score()->setUpdateAll();
      score()->end();
      }
开发者ID:fivearrows,项目名称:MuseScore,代码行数:6,代码来源:text.cpp


示例7: setCursor

//////////////////////////////////////////////////////////////////////
// Called when mouse moves and does different things depending
//on the state of the mouse buttons for dragging the demod bar or
// filter edges.
//////////////////////////////////////////////////////////////////////
void CPlotter::mouseMoveEvent(QMouseEvent* event)
{

    QPoint pt = event->pos();

    /* mouse enter / mouse leave events */
    if (m_OverlayPixmap.rect().contains(pt))
    {	//is in Overlay bitmap region
        if (event->buttons() == Qt::NoButton)
        {
            bool onTag=false;
            if(pt.y()<15*3) //FIXME
            {
                for(int i=0; i<m_BookmarkTags.size() && !onTag; i++)
                {
                    if(m_BookmarkTags[i].first.contains(event->pos()))
                        onTag=true;
                }
            }
            //if no mouse button monitor grab regions and change cursor icon
            if(onTag)
            {
                setCursor(QCursor(Qt::PointingHandCursor));
                m_CursorCaptured=BOOKMARK;
            }
            else if (isPointCloseTo(pt.x(), m_DemodFreqX, m_CursorCaptureDelta))
            {	//in move demod box center frequency region
                if (CENTER != m_CursorCaptured)
                    setCursor(QCursor(Qt::SizeHorCursor));
                m_CursorCaptured = CENTER;
                if (m_TooltipsEnabled)
                    QToolTip::showText(event->globalPos(),
                                       QString("Demod: %1 kHz")
                                       .arg(m_DemodCenterFreq/1.e3f, 0, 'f', 3),
                                       this, rect());
            }
            else if (isPointCloseTo(pt.x(), m_DemodHiCutFreqX, m_CursorCaptureDelta))
            {	//in move demod hicut region
                if (RIGHT != m_CursorCaptured)
                    setCursor(QCursor(Qt::SizeFDiagCursor));
                m_CursorCaptured = RIGHT;
                if (m_TooltipsEnabled)
                    QToolTip::showText(event->globalPos(),
                                       QString("High cut: %1 Hz")
                                       .arg(m_DemodHiCutFreq),
                                       this, rect());
            }
            else if (isPointCloseTo(pt.x(), m_DemodLowCutFreqX, m_CursorCaptureDelta))
            {	//in move demod lowcut region
                if (LEFT != m_CursorCaptured)
                    setCursor(QCursor(Qt::SizeBDiagCursor));
                m_CursorCaptured = LEFT;
                if (m_TooltipsEnabled)
                    QToolTip::showText(event->globalPos(),
                                       QString("Low cut: %1 Hz")
                                       .arg(m_DemodLowCutFreq),
                                       this, rect());
            }
            else if (isPointCloseTo(pt.x(), m_YAxisWidth/2, m_YAxisWidth/2))
            {
                if (YAXIS != m_CursorCaptured)
                    setCursor(QCursor(Qt::OpenHandCursor));
                m_CursorCaptured = YAXIS;
                if (m_TooltipsEnabled)
                    QToolTip::hideText();
            }
            else if (isPointCloseTo(pt.y(), m_XAxisYCenter, m_CursorCaptureDelta+5))
            {
                if (XAXIS != m_CursorCaptured)
                    setCursor(QCursor(Qt::OpenHandCursor));
                m_CursorCaptured = XAXIS;
                if (m_TooltipsEnabled)
                    QToolTip::hideText();
            }
            else
            {	//if not near any grab boundaries
                if (NONE != m_CursorCaptured)
                {
                    setCursor(QCursor(Qt::ArrowCursor));
                    m_CursorCaptured = NONE;
                }
                if (m_TooltipsEnabled)
                    QToolTip::showText(event->globalPos(),
                                       QString("F: %1 kHz")
                                       .arg(freqFromX(pt.x())/1.e3f, 0, 'f', 3),
                                       this, rect());
            }
            m_GrabPosition = 0;
        }
    }
    else
    {	//not in Overlay region
        if (event->buttons() == Qt::NoButton)
        {
            if (NONE != m_CursorCaptured)
//.........这里部分代码省略.........
开发者ID:azorg,项目名称:gqrx,代码行数:101,代码来源:plotter.cpp


示例8: if


//.........这里部分代码省略.........
    {
        rect.translate(event->pos()-origin);
        handleTL.moveCenter(rect.topLeft());
        handleTR.moveCenter(rect.topRight());
        handleBL.moveCenter(rect.bottomLeft());
        handleBR.moveCenter(rect.bottomRight());
        handleT.moveCenter(QPoint(rect.topRight().x()-(rect.width()/2), rect.top()));
        handleB.moveCenter(QPoint(rect.bottomRight().x()-(rect.width()/2),rect.bottom()));
        handleL.moveCenter(QPoint(rect.left(), rect.bottomRight().y()-(rect.height()/2)));
        handleR.moveCenter(QPoint(rect.right(), rect.bottomRight().y()-(rect.height()/2)));
        origin=event->pos();

    }

    //Draw cursor
    if(handleBR.contains(event->pos()) || handleTL.contains(event->pos())) //Bottom Rigth or Top Left
    {
        cursor.setShape(Qt::SizeFDiagCursor);
    }else if(handleTR.contains(event->pos()) || handleBL.contains(event->pos())) //Top Rigth or Bottom Left
    {
        cursor.setShape(Qt::SizeBDiagCursor);
    }else if(handleT.contains(event->pos()) || handleB.contains(event->pos())) //Top or Bottom
    {
        cursor.setShape(Qt::SizeVerCursor);
    }else if(handleL.contains(event->pos()) || handleR.contains(event->pos())) //Rigth or Left
    {
        cursor.setShape(Qt::SizeHorCursor);
    }else if(rect.contains(event->pos()) && !rect.contains(event->pos(),true)) //Move
    {
        cursor.setShape(Qt::SizeAllCursor);
    }else{
        cursor.setShape(Qt::ArrowCursor); //Default
    }
    setCursor(cursor);

    text->setGeometry(rect.x()+1,rect.y()+1,rect.width()-1,rect.height()-1); //Update textEdit following border

    //Update position of options buttons
    textB->move(rect.right()+xOffset,rect.top());
    fontComboBox->move(rect.right()+2*xOffset,rect.top());
    textColorB->move(rect.right()+2*xOffset+183,rect.top());


    textBDimension->move(rect.right()+xOffset,textB->y()+yOffset);
    textLessB->move(rect.right()+2*xOffset,textB->y()+yOffset);
    textDefaultB->move(rect.right()+3*xOffset,textB->y()+yOffset);
    textMoreB->move(rect.right()+4*xOffset,textB->y()+yOffset);


    backgroundB->move(rect.right()+xOffset,textBDimension->y()+yOffset);
    backgroundPreviousB->move(rect.right()+2*xOffset,textBDimension->y()+yOffset);
    backgroundNextB->move(rect.right()+3*xOffset,textBDimension->y()+yOffset);
    backgroundColorB->move(rect.right()+4*xOffset,textBDimension->y()+yOffset);


    musicB->move(rect.right()+xOffset,backgroundB->y()+yOffset);
    musicPreviousB->move(rect.right()+2*xOffset,backgroundB->y()+yOffset);
    musicNextB->move(rect.right()+3*xOffset,backgroundB->y()+yOffset);
    musicMuteB->move(rect.right()+4*xOffset,backgroundB->y()+yOffset);


    keyboardB->move(rect.right()+xOffset,musicB->y()+yOffset);
    keyboardPreviousB->move(rect.right()+2*xOffset,musicB->y()+yOffset);
    keyboardNextB->move(rect.right()+3*xOffset,musicB->y()+yOffset);
    keyboardMuteB->move(rect.right()+4*xOffset,musicB->y()+yOffset);
开发者ID:deycrypt,项目名称:koalawriter,代码行数:66,代码来源:editor.cpp


示例9: mapToGlobal

void FramelessWin2::GetMoveDirect(QPoint cursorPoint)
{
QRect rect = this->rect();
QPoint tl = mapToGlobal(rect.topLeft());
QPoint rb = mapToGlobal(rect.bottomRight());
int x = cursorPoint.x();
int y = cursorPoint.y();
//左上角
if( x-m_padding <= tl.x() && x >= tl.x() && y - m_padding <= tl.y() && y >= tl.y())
{
    m_direct = FramelessWin2::LEFTTOP;
    setCursor(Qt::SizeFDiagCursor);
}
//左下角
else if (x - m_padding <= tl.x() && x > tl.x() && y - m_padding <= rb.y() && y >= rb.y())
{
    m_direct = LEFTDOWN;
    setCursor(Qt::SizeBDiagCursor);
}
//左边
else if (x <= tl.x() + m_padding && x >= tl.x())
{
    m_direct = LEFT;
    setCursor(Qt::SizeHorCursor);
}
//右上角
else if (x <= rb.x() && x + m_padding >= rb.x() && y >= tl.y() && y - m_padding <= tl.y())
{
    m_direct = RIGHTTOP;
    setCursor(Qt::SizeBDiagCursor);
}
//右下角
else if (x <= rb.x() && x + m_padding >= rb.x() && y <= rb.y() && y + m_padding >= rb.y())
{
    m_direct = RIGHTDOWN;
    setCursor(Qt::SizeFDiagCursor);
}
//右边
else if (x <= rb.x() && x + m_padding >= rb.x())
{

    m_direct = RIGHT;
    setCursor(Qt::SizeHorCursor);
}
//上
else if (y > tl.y() && y < tl.y()+m_padding)
{
    m_direct = UP;
    setCursor(Qt::SizeVerCursor);
}
else if (y <= rb.y() && y +  m_padding >= rb.y())
{
    m_direct = DOWN;
    setCursor(Qt::SizeVerCursor);
}
else
{
    m_direct = UNKOWN;
    setCursor(Qt::ArrowCursor);
}
}
开发者ID:ycsoft,项目名称:SafeThrough,代码行数:61,代码来源:framelesswin2.cpp


示例10: QAbstractButton

ActionLineEditButton::ActionLineEditButton( QWidget *parent )
		: QAbstractButton(parent), action_(0), popup_(0)
{
	setCursor(Qt::PointingHandCursor);
}
开发者ID:ChowZenki,项目名称:psi,代码行数:5,代码来源:actionlineedit.cpp


示例11: setCursor

void UniversalAdapter::home()
{
    setCursor(0, 0);
}
开发者ID:DouglasPearless,项目名称:Smoothieware,代码行数:4,代码来源:UniversalAdapter.cpp


示例12: resizerTop

UBRubberBand::enm_resizingMode UBRubberBand::determineResizingMode(QPoint pos)
{
    if (mMouseIsPressed)
        return mResizingMode;
    
    QRect resizerTop    (mResizingBorderHeight               , 0                             , rect().width()-2*mResizingBorderHeight, mResizingBorderHeight                    );
    QRect resizerBottom (mResizingBorderHeight               , rect().height() - mResizingBorderHeight, rect().width()-2*mResizingBorderHeight, mResizingBorderHeight                    );
    QRect resizerLeft   (0                          , mResizingBorderHeight                  , mResizingBorderHeight                 , rect().height() - 2*mResizingBorderHeight);
    QRect resizerRight  (rect().width()-mResizingBorderHeight, mResizingBorderHeight                  , mResizingBorderHeight                 , rect().height() - 2*mResizingBorderHeight);

    QRect resizerTopLeft    (0                          , 0                             , mResizingBorderHeight, mResizingBorderHeight);
    QRect resizerTopRight   (rect().width()-mResizingBorderHeight, 0                             , mResizingBorderHeight, mResizingBorderHeight);
    QRect resizerBottomLeft (0                          , rect().height() - mResizingBorderHeight, mResizingBorderHeight, mResizingBorderHeight);
    QRect resizerBottomRight(rect().width()-mResizingBorderHeight, rect().height() - mResizingBorderHeight, mResizingBorderHeight, mResizingBorderHeight);

    enm_resizingMode resizingMode;
    
    QTransform cursorTransrofm;

    if (resizerTop.contains(pos))
    {
        resizingMode = Top;
        cursorTransrofm.rotate(90);
    }
    else
    if (resizerBottom.contains(pos))
    {
        resizingMode = Bottom;
        cursorTransrofm.rotate(90);
    }
    else
    if (resizerLeft.contains(pos))
    {
        resizingMode = Left;
    }
    else
    if (resizerRight.contains(pos))
    {
        resizingMode = Right;
    }
    else
    if (resizerTopLeft.contains(pos))
    {
        resizingMode = TopLeft;
        cursorTransrofm.rotate(45);
    }
    else
    if (resizerTopRight.contains(pos))
    {
        resizingMode = TopRight;
        cursorTransrofm.rotate(-45);
    }
    else
    if (resizerBottomLeft.contains(pos))
    {
        resizingMode = BottomLeft;
        cursorTransrofm.rotate(-45);
    }
    else
    if (resizerBottomRight.contains(pos))
    {
        resizingMode = BottomRight;
        cursorTransrofm.rotate(45);
    }
    else
        resizingMode = None;
    
    if (None != resizingMode)
    {
        QPixmap pix(":/images/cursors/resize.png");
        QCursor resizeCursor  = QCursor(pix.transformed(cursorTransrofm, Qt::SmoothTransformation), pix.width() / 2,  pix.height() / 2);
        setCursor(resizeCursor);
    }
    else
        unsetCursor();

    return resizingMode;
}
开发者ID:fightersheart,项目名称:myLiveNotes,代码行数:78,代码来源:UBRubberBand.cpp


示例13: main

//Main function (execution starts here after startup file)
int main(void)
{
	int i;
	int e;
	uint16_t temperature;

	init_GPIO_pins();
	
	//Short delay during which we can communicate with MCU via debugger even if later user code causes error such as sleep state with no wakeup event that prevents debugger interface working
	//THIS MUST COME BEFORE ALL USER CODE TO ENSURE CHIPS CAN BE REPROGRAMMED EVEN IF THEY GET STUCK IN A SLEEP STATE LATER
	for (i = 0; i < 1000000; i++)
	{
		LED_on();
	}
	
	GPIO_Init_Mode(GPIOA,GPIO_Pin_0,GPIO_Mode_IN_FLOATING); //User button.
	GPIO_Init_Mode(GPIOC,GPIO_Pin_11,GPIO_Mode_IN_FLOATING); //Accelerometer interrupt.
	delay_init();
	LED_off();
	LCDINIT();
	home();
	clear();
	display(); //Surely some of these can be commented out.
	noCursor();
	noBlink();

	standby();

	UART_init();
	humidity_init();
	ADC_init();
	I2C_EEPROM();
	I2C_ACCEL_INIT();
	I2C_EE_LoadConfig();
	logging_timer_init();
	
//	I2C_EE_BufferWrite(Test_Buffer, EEPROM_WriteAddress1, 100);
//I2C_EE_BufferRead(buffer, 0, 100);

	/*while(1){
		if(LEDbyte==512){LEDbyte=1;}
		else {LEDbyte=LEDbyte<<1;}
		setLEDS();
		
	setCursor(0,1);
	temperature=getTemperature();
	writenumber( temperature/100);
	write('.');
	writenumber((temperature/10)%10);
		write(' ');

		write(0xDF);
	write('C');
	setCursor(0,0);
	writenumber(readhumidity(24)); //Needs real temperature
	write(' ');
	write('%');
	write('R');
	write('H');
		delay_ms(50);
		
		check_and_process_received_command();
		
	}*/
	//currentstate=UPLOADING;

	while(1)
	{
		switch (currentstate){
			
		case WAITING:
			if (GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_0)) //Polling is probably ok here, since the loop will be very very fast.
			{
				currentstate=LOGGING;
				clear();
				write('S');
				write('t');
				write('a');
				write('r');
				write('t');
				write('i');
				write('n');
				write('g');
				delay_ms(2000);
				clear();
				I2C_EE_StartLog();
				TIM4->CNT=0;
			}
			break;

		case LOGGING:
			if (GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_0)){currentstate=WAITING;I2C_EE_FinishLog();break;} //Polling is probably ok here, since the loop will be very very fast.
			LEDbyte|= 1<<8;
			setLEDS();
			if (TIM_GetFlagStatus(TIM3, TIM_FLAG_Update) != RESET)
			{
				TIM_ClearFlag(TIM3, TIM_IT_Update);
				temperature = getTemperature();
				LogBuffer[0]=(temperature>>8)&0xFF;
//.........这里部分代码省略.........
开发者ID:JamesGlanville,项目名称:datalogger,代码行数:101,代码来源:main.c


示例14: QWidget

FxLine::FxLine( QWidget * _parent, FxMixerView * _mv, int _channelIndex ) :
	QWidget( _parent ),
	m_mv( _mv ),
	m_channelIndex( _channelIndex ),
	m_backgroundActive( Qt::SolidPattern ),
	m_strokeOuterActive( 0, 0, 0 ),
	m_strokeOuterInactive( 0, 0, 0 ),
	m_strokeInnerActive( 0, 0, 0 ),
	m_strokeInnerInactive( 0, 0, 0 ),
	m_inRename( false )
{
	if( !s_sendBgArrow )
	{
		s_sendBgArrow = new QPixmap( embed::getIconPixmap( "send_bg_arrow", 29, 56 ) );
	}
	if( !s_receiveBgArrow )
	{
		s_receiveBgArrow = new QPixmap( embed::getIconPixmap( "receive_bg_arrow", 29, 56 ) );
	}

	setFixedSize( 33, FxLineHeight );
	setAttribute( Qt::WA_OpaquePaintEvent, true );
	setCursor( QCursor( embed::getIconPixmap( "hand" ), 3, 3 ) );

	// mixer sends knob
	m_sendKnob = new Knob( knobBright_26, this, tr( "Channel send amount" ) );
	m_sendKnob->move( 3, 22 );
	m_sendKnob->setVisible( false );

	// send button indicator
	m_sendBtn = new SendButtonIndicator( this, this, m_mv );
	m_sendBtn->move( 2, 2 );

	// channel number
	m_lcd = new LcdWidget( 2, this );
	m_lcd->setValue( m_channelIndex );
	m_lcd->move( 4, 58 );
	m_lcd->setMarginWidth( 1 );
	
	QString name = Engine::fxMixer()->effectChannel( m_channelIndex )->m_name;
	setToolTip( name );

	m_renameLineEdit = new QLineEdit();
	m_renameLineEdit->setText( name );
	m_renameLineEdit->setFixedWidth( 65 );
	m_renameLineEdit->setFont( pointSizeF( font(), 7.5f ) );
	m_renameLineEdit->setReadOnly( true );
	m_renameLineEdit->installEventFilter( this );

	QGraphicsScene * scene = new QGraphicsScene();
	scene->setSceneRect( 0, 0, 33, FxLineHeight );

	m_view = new QGraphicsView( this );
	m_view->setStyleSheet( "border-style: none; background: transparent;" );
	m_view->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
	m_view->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
	m_view->setAttribute( Qt::WA_TransparentForMouseEvents, true );
	m_view->setScene( scene );

	QGraphicsProxyWidget * proxyWidget = scene->addWidget( m_renameLineEdit );
	proxyWidget->setRotation( -90 );
	proxyWidget->setPos( 8, 145 );

	connect( m_renameLineEdit, SIGNAL( editingFinished() ), this, SLOT( renameFinished() ) );
}
开发者ID:JohannesLorenz,项目名称:lmms,代码行数:65,代码来源:FxLine.cpp


示例15: setCursor

void RegexGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
    setCursor(Qt::ClosedHandCursor);
}
开发者ID:aelliott,项目名称:expressioneditor,代码行数:4,代码来源:regexgraphicsitem.cpp


示例16: Q_D

/*! \reimp */
bool QToolBar::event(QEvent *event)
{
    Q_D(QToolBar);

    switch (event->type()) {
    case QEvent::Timer:
        if (d->waitForPopupTimer.timerId() == static_cast<QTimerEvent*>(event)->timerId()) {
            QWidget *w = QApplication::activePopupWidget();
            if (!waitForPopup(this, w)) {
                d->waitForPopupTimer.stop();
                if (!this->underMouse())
                    d->layout->setExpanded(false);
            }
        }
        break;
    case QEvent::Hide:
        if (!isHidden())
            break;
    // fallthrough intended
    case QEvent::Show:
        d->toggleViewAction->setChecked(event->type() == QEvent::Show);
        emit visibilityChanged(event->type() == QEvent::Show);
#if defined(Q_WS_MAC)
        if (toolbarInUnifiedToolBar(this)) {
            // I can static_cast because I did the qobject_cast in the if above, therefore
            // we must have a QMainWindowLayout here.
            QMainWindowLayout *mwLayout = qt_mainwindow_layout(qobject_cast<QMainWindow *>(parentWidget()));
            mwLayout->fixSizeInUnifiedToolbar(this);
            mwLayout->syncUnifiedToolbarVisibility();
        }
#endif // Q_WS_MAC
        break;
    case QEvent::ParentChange:
        d->layout->checkUsePopupMenu();
#if defined(Q_WS_MAC)
        if (parentWidget() && parentWidget()->isWindow())
            qt_mac_updateToolBarButtonHint(parentWidget());
#endif
        break;

    case QEvent::MouseButtonPress: {
        if (d->mousePressEvent(static_cast<QMouseEvent*>(event)))
            return true;
        break;
    }
    case QEvent::MouseButtonRelease:
        if (d->mouseReleaseEvent(static_cast<QMouseEvent*>(event)))
            return true;
        break;
    case QEvent::HoverEnter:
    case QEvent::HoverLeave:
        // there's nothing special to do here and we don't want to update the whole widget
        return true;
    case QEvent::HoverMove: {
#ifndef QT_NO_CURSOR
        QHoverEvent *e = static_cast<QHoverEvent*>(event);
        QStyleOptionToolBar opt;
        initStyleOption(&opt);
        if (style()->subElementRect(QStyle::SE_ToolBarHandle, &opt, this).contains(e->pos()))
            setCursor(Qt::SizeAllCursor);
        else
            unsetCursor();
#endif
        break;
    }
    case QEvent::MouseMove:
        if (d->mouseMoveEvent(static_cast<QMouseEvent*>(event)))
            return true;
        break;
#ifdef Q_OS_WINCE
    case QEvent::ContextMenu:
    {
        QContextMenuEvent* contextMenuEvent = static_cast<QContextMenuEvent*>(event);
        QWidget* child = childAt(contextMenuEvent->pos());
        QAbstractButton* button = qobject_cast<QAbstractButton*>(child);
        if (button)
            button->setDown(false);
    }
    break;
#endif
    case QEvent::Leave:
        if (d->state != 0 && d->state->dragging) {
#ifdef Q_OS_WIN
            // This is a workaround for loosing the mouse on Vista.
            QPoint pos = QCursor::pos();
            QMouseEvent fake(QEvent::MouseMove, mapFromGlobal(pos), pos, Qt::NoButton,
                             QApplication::mouseButtons(), QApplication::keyboardModifiers());
            d->mouseMoveEvent(&fake);
#endif
        } else {
            if (!d->layout->expanded)
                break;

            QWidget *w = QApplication::activePopupWidget();
            if (waitForPopup(this, w)) {
                d->waitForPopupTimer.start(POPUP_TIMER_INTERVAL, this);
                break;
            }

//.........这里部分代码省略.........
开发者ID:ballock,项目名称:qtbase,代码行数:101,代码来源:qtoolbar.cpp


示例17: setCursor

void GRolloverButton::hoverMoveEvent( QGraphicsSceneHoverEvent *e )
{
    GLabelItem::hoverMoveEvent( e );
    setCursor( QCursor( Qt::PointingHandCursor ) );
}
开发者ID:TheAppsDude,项目名称:phisketeer,代码行数:5,代码来源:gwidgetitems.cpp


示例18: setCursor

void QgsComposerItem::updateCursor( const QPointF& itemPos )
{
  setCursor( cursorForPosition( itemPos ) );
}
开发者ID:PhilippeDorelon,项目名称:Quantum-GIS,代码行数:4,代码来源:qgscomposeritem.cpp


示例19: setCursor

void MeshGraphItemVelocityHandle::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
    setCursor(Qt::ClosedHandCursor);
    QGraphicsItem::mousePressEvent(event);
}
开发者ID:denis-itskovich,项目名称:wifi-mesh,代码行数:5,代码来源:MeshGraphItemVelocityHandle.cpp


示例20: addMarker

void ChartWidget::mousePressEvent(QMouseEvent* e)
{
    //qDebug() << "mousePressEvent";
	QRect rcWaveforms = m_rcPixmap;

	ChartPointInfo info;
	QPoint ptPixmap = e->pos() - m_rcPixmap.topLeft();
	m_pixmap->fillChartPointInfo(ptPixmap, &info);
	m_clickInfo = info;
	ViewWaveInfo* vwi = info.vwi;

	m_ptMouseWidget = e->pos();
	m_ptMousePixmap = ptPixmap;
	m_ptClickWidget = m_ptMouseWidget;
	m_ptClickPixmap = m_ptMousePixmap;
	m_nClickSampleOffset = m_chartS->sampleOffset();
	
	const WaveInfo* wave = NULL;
	if (vwi != NULL)
		wave = vwi->wave();

	if (e->button() == Qt::LeftButton)
	{
		// If the user Ctrl+clicks on the selected FID wave while in peak editing mode:
		if (e->modifiers() == Qt::ControlModifier)
		{
			// If the user Ctrl+clicks on the selected FID wave while in peak editing mode:
			if (wave != NULL && m_chartS->params().peakMode == EadMarkerMode_Edit) {
				if (info.iChosenPeak < 0)
					addMarker(vwi, m_ptClickPixmap.x());
				else if (wave->peaksChosen[info.iChosenPeak].type == MarkerType_EadPeakXY) {
					addEadPeakXYEndPoint(vwi, info.iChosenPeak);
				}
			}
		}
		else {
			bool bIgnore = false;

			// Force no dragging of markers unless in edit mode:
			if (m_chartS->params().peakMode != EadMarkerMode_Edit) {
				if (m_clickInfo.iChosenPeak >= 0)
					bIgnore = true;
			}

			if (bIgnore)
			{
				;
			}
			// Clicked on a chosen peak:
			else if (info.iChosenPeak >= 0)
			{
				m_bDragging = true;
				setCursor(Qt::SizeHorCursor);
			}
			// Clicked on a detected peak:
			else if (info.didxPossiblePeak >= 0)
			{
				vwi->choosePeakAtDidx(info.didxPossiblePeak);
			}
			// Clicked on a wave:
			else if (wave != NULL)
			{
				m_bDragging = true;
				// REFACTOR: remove m_waveDrag and use m_clickInfo instead
				//m_waveDrag = vwi->waveInfo();
				m_nDragOrigDivisionOffset = vwi->divisionOffset();
				setCursor(Qt::SizeVerCursor);
			}
			else if (rcWaveforms.contains(e->pos()))
			{
				m_bDragging = true;
				m_bSelecting = true;
				setCursor(Qt::IBeamCursor);
				updateStatus();
				update();
			}
			else
			{
				m_bDragging = false;
			}
		}
	}
	else if (e->button() == Qt::MidButton)
	{
		m_clickInfo.iChosenPeak = -1;
		m_clickInfo.iMarkerDidx = -1;
		m_clickInfo.vwi = NULL;
		m_bDragging = true;
		setCursor(Qt::SizeHorCursor);
	}

	updateStatus();
}
开发者ID:ellis,项目名称:gcead,代码行数:93,代码来源:ChartWidget.cpp



注:本文中的setCursor函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ setCursorPos函数代码示例发布时间:2022-05-30
下一篇:
C++ setCurrentWidget函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap