当前位置: 首页>>代码示例>>C++>>正文


C++ cursor函数代码示例

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


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

示例1: cursor

void wxDynamicSashWindowLeaf::OnLeave(wxMouseEvent &WXUNUSED(event))
{
    wxCursor cursor(wxCURSOR_ARROW);
    m_impl->m_container->SetCursor(cursor);
}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:5,代码来源:dynamicsash.cpp

示例2: cursor

Qt::CursorShape CursorShapeArea::cursorShape() const
{
  return cursor().shape();
}
开发者ID:ideo-digital-shop,项目名称:VISOR-tester-qt,代码行数:4,代码来源:cursorshapearea.cpp

示例3: dprints

void dprints(bc *bc, char *s)
{
char *p,ch;
static char escape=0;
int i;
static int escapedata[20],ecount;

	cursor(bc, 0);
	p=s;
	ecount=escape=0;
	while((ch=*p++))
	{
		if(escape)
		{
			if(ch>='0' && ch<='9')
			{
				escapedata[ecount]*=10;
				escapedata[ecount]+=ch-'0';
			} else if(ch==';')
			{
				++ecount;
				escapedata[ecount]=0;
			}
			else
			{
				escape=0;
				switch(ch)
				{
				case 'k':
					i=bc->txpos;
					while(i<bc->txsize)
						drawcharxy(bc, i++, bc->typos,' ');
					break;
				case 'x':
					bc->txpos=escapedata[0];
					if(bc->txpos<=0) bc->txpos=0;
					if(bc->txpos>=bc->txsize) bc->txpos=bc->txsize-1;
					break;
				case 'y':
					bc->typos = escapedata[0];
					if(bc->typos<0) bc->typos=0;
					if(bc->typos>=bc->tysize) bc->typos=bc->tysize-1;
					break;
				}
			}
			continue;
		}
		switch(ch)
		{
		case '\r':
			bc->txpos=0;
			break;
		case '\n':
			newline(bc);
			break;
		case '\t':
			while(bc->txpos&7)
				drawcharxy(bc, bc->txpos++,bc->typos,' ');
			break;
		case 8:
			if(bc->txpos)
				drawcharxy(bc, --bc->txpos,bc->typos,' ');
			break;
		case 0x1b:
			ecount=0;
			escapedata[ecount]=0;
			escape=1;
			break;
		default:
			drawcharxy(bc, bc->txpos++,bc->typos,ch);
			break;
		}
		if(bc->txpos >= bc->txsize)
			newline(bc);
	}
	cursor(bc, 1);
	update(bc);
}
开发者ID:nssilva,项目名称:SDL,代码行数:78,代码来源:font.c

示例4: get_cursor

 cursor get_cursor() const { return cursor(c.get_cursor(), sel); }
开发者ID:theperm,项目名称:RxM4A,代码行数:1,代码来源:linq_select.hpp

示例5: switch

void bt459_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, u8 *pixel_data)
{
	// initialise the blink timer
	if (m_blink_start > screen.frame_number())
		m_blink_start = screen.frame_number();

	// compute the blink state according to the programmed duty cycle
	const bool blink_state = ((screen.frame_number() - m_blink_start) & (
		(m_command_0 & CR0302) == CR0302_1616 ? 0x10 :
		(m_command_0 & CR0302) == CR0302_3232 ? 0x20 :
		(m_command_0 & CR0302) == CR0302_6464 ? 0x40 : 0x30)) == 0;

	// compute the pixel mask from the pixel read mask and blink mask/state
	const u8 pixel_mask = m_pixel_read_mask & (blink_state ? 0xffU : ~m_pixel_blink_mask);

	// draw visible pixel data
	switch (m_command_0 & CR0100)
	{
	case CR0100_1BPP:
		for (int y = screen.visible_area().min_y; y <= screen.visible_area().max_y; y++)
			for (int x = screen.visible_area().min_x; x <= screen.visible_area().max_x; x += 8)
			{
				u8 data = *pixel_data++;

				bitmap.pix(y, x + 7) = get_rgb(data & 0x1, pixel_mask); data >>= 1;
				bitmap.pix(y, x + 6) = get_rgb(data & 0x1, pixel_mask); data >>= 1;
				bitmap.pix(y, x + 5) = get_rgb(data & 0x1, pixel_mask); data >>= 1;
				bitmap.pix(y, x + 4) = get_rgb(data & 0x1, pixel_mask); data >>= 1;
				bitmap.pix(y, x + 3) = get_rgb(data & 0x1, pixel_mask); data >>= 1;
				bitmap.pix(y, x + 2) = get_rgb(data & 0x1, pixel_mask); data >>= 1;
				bitmap.pix(y, x + 1) = get_rgb(data & 0x1, pixel_mask); data >>= 1;
				bitmap.pix(y, x + 0) = get_rgb(data & 0x1, pixel_mask);
			}
		break;

	case CR0100_2BPP:
		for (int y = screen.visible_area().min_y; y <= screen.visible_area().max_y; y++)
			for (int x = screen.visible_area().min_x; x <= screen.visible_area().max_x; x += 4)
			{
				u8 data = *pixel_data++;

				bitmap.pix(y, x + 3) = get_rgb(data & 0x3, pixel_mask); data >>= 2;
				bitmap.pix(y, x + 2) = get_rgb(data & 0x3, pixel_mask); data >>= 2;
				bitmap.pix(y, x + 1) = get_rgb(data & 0x3, pixel_mask); data >>= 2;
				bitmap.pix(y, x + 0) = get_rgb(data & 0x3, pixel_mask);
			}
		break;

	case CR0100_4BPP:
		for (int y = screen.visible_area().min_y; y <= screen.visible_area().max_y; y++)
			for (int x = screen.visible_area().min_x; x <= screen.visible_area().max_x; x += 2)
			{
				u8 data = *pixel_data++;

				bitmap.pix(y, x + 1) = get_rgb(data & 0x7, pixel_mask); data >>= 4;
				bitmap.pix(y, x + 0) = get_rgb(data & 0x7, pixel_mask);
			}
		break;

	case CR0100_8BPP:
		for (int y = screen.visible_area().min_y; y <= screen.visible_area().max_y; y++)
			for (int x = screen.visible_area().min_x; x <= screen.visible_area().max_x; x++)
				bitmap.pix(y, x) = get_rgb(*pixel_data++, pixel_mask);
		break;
	}

	// draw cursors when visible and not blinked off
	if ((m_cursor_command & (CR47 | CR46 | CR45 | CR44)) && ((m_cursor_command & CR40) == 0 || blink_state))
	{
		// get 64x64 bitmap and cross hair cursor plane enable
		const u8 bm_cursor_enable = (m_cursor_command & (CR47 | CR46)) >> 6;
		const u8 ch_cursor_enable = (m_cursor_command & (CR45 | CR44)) >> 4;

		// get cross hair cursor half thickness
		const int ch_thickness = (m_cursor_command & CR4241) >> 1;

		/*
		 * The cursor (x) value to be written is calculated as follows:
		 *
		 *   Cx = desired display screen (x) position + H - P
		 *
		 * where
		 *
		 *   P = 37 if 1:1 input multiplexing, 52 if 4:1 input multiplexing,
		 *       57 if 5:1 input multiplexing
		 *   H = number of pixels between the first rising edge of LD*
		 *       following the falling edge of HSYNC* to active video
		 *
		 * The cursor (y) value to be written is calculated as follows:
		 *
		 *   Cy = desired display screen (y) position + V - 32
		 *
		 * where
		 *
		 *   V = number of scan lines from the second sync pulse during
		 *       vertical blanking to active video
		 *
		 * Values from $0FC0 (-64) to $0FBF (+4031) may be loaded into the
		 * cursor (y) register. The negative values ($0FC0 to $0FFF) are used
		 * in situations where V < 32, and the cursor must be moved off the
//.........这里部分代码省略.........
开发者ID:qwijibo,项目名称:mame,代码行数:101,代码来源:bt459.cpp

示例6: cursor

void LiquidCrystal_I2C::cursor_on(){
	cursor();
}
开发者ID:BioClub,项目名称:BioHackBoard,代码行数:3,代码来源:LiquidCrystal_I2C.cpp

示例7: qt_static_metacall

int QWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 23)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 23;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< bool*>(_v) = isModal(); break;
        case 1: *reinterpret_cast< Qt::WindowModality*>(_v) = windowModality(); break;
        case 2: *reinterpret_cast< bool*>(_v) = isEnabled(); break;
        case 3: *reinterpret_cast< QRect*>(_v) = geometry(); break;
        case 4: *reinterpret_cast< QRect*>(_v) = frameGeometry(); break;
        case 5: *reinterpret_cast< QRect*>(_v) = normalGeometry(); break;
        case 6: *reinterpret_cast< int*>(_v) = x(); break;
        case 7: *reinterpret_cast< int*>(_v) = y(); break;
        case 8: *reinterpret_cast< QPoint*>(_v) = pos(); break;
        case 9: *reinterpret_cast< QSize*>(_v) = frameSize(); break;
        case 10: *reinterpret_cast< QSize*>(_v) = size(); break;
        case 11: *reinterpret_cast< int*>(_v) = width(); break;
        case 12: *reinterpret_cast< int*>(_v) = height(); break;
        case 13: *reinterpret_cast< QRect*>(_v) = rect(); break;
        case 14: *reinterpret_cast< QRect*>(_v) = childrenRect(); break;
        case 15: *reinterpret_cast< QRegion*>(_v) = childrenRegion(); break;
        case 16: *reinterpret_cast< QSizePolicy*>(_v) = sizePolicy(); break;
        case 17: *reinterpret_cast< QSize*>(_v) = minimumSize(); break;
        case 18: *reinterpret_cast< QSize*>(_v) = maximumSize(); break;
        case 19: *reinterpret_cast< int*>(_v) = minimumWidth(); break;
        case 20: *reinterpret_cast< int*>(_v) = minimumHeight(); break;
        case 21: *reinterpret_cast< int*>(_v) = maximumWidth(); break;
        case 22: *reinterpret_cast< int*>(_v) = maximumHeight(); break;
        case 23: *reinterpret_cast< QSize*>(_v) = sizeIncrement(); break;
        case 24: *reinterpret_cast< QSize*>(_v) = baseSize(); break;
        case 25: *reinterpret_cast< QPalette*>(_v) = palette(); break;
        case 26: *reinterpret_cast< QFont*>(_v) = font(); break;
        case 27: *reinterpret_cast< QCursor*>(_v) = cursor(); break;
        case 28: *reinterpret_cast< bool*>(_v) = hasMouseTracking(); break;
        case 29: *reinterpret_cast< bool*>(_v) = isActiveWindow(); break;
        case 30: *reinterpret_cast< Qt::FocusPolicy*>(_v) = focusPolicy(); break;
        case 31: *reinterpret_cast< bool*>(_v) = hasFocus(); break;
        case 32: *reinterpret_cast< Qt::ContextMenuPolicy*>(_v) = contextMenuPolicy(); break;
        case 33: *reinterpret_cast< bool*>(_v) = updatesEnabled(); break;
        case 34: *reinterpret_cast< bool*>(_v) = isVisible(); break;
        case 35: *reinterpret_cast< bool*>(_v) = isMinimized(); break;
        case 36: *reinterpret_cast< bool*>(_v) = isMaximized(); break;
        case 37: *reinterpret_cast< bool*>(_v) = isFullScreen(); break;
        case 38: *reinterpret_cast< QSize*>(_v) = sizeHint(); break;
        case 39: *reinterpret_cast< QSize*>(_v) = minimumSizeHint(); break;
        case 40: *reinterpret_cast< bool*>(_v) = acceptDrops(); break;
        case 41: *reinterpret_cast< QString*>(_v) = windowTitle(); break;
        case 42: *reinterpret_cast< QIcon*>(_v) = windowIcon(); break;
        case 43: *reinterpret_cast< QString*>(_v) = windowIconText(); break;
        case 44: *reinterpret_cast< double*>(_v) = windowOpacity(); break;
        case 45: *reinterpret_cast< bool*>(_v) = isWindowModified(); break;
        case 46: *reinterpret_cast< QString*>(_v) = toolTip(); break;
        case 47: *reinterpret_cast< QString*>(_v) = statusTip(); break;
        case 48: *reinterpret_cast< QString*>(_v) = whatsThis(); break;
        case 49: *reinterpret_cast< QString*>(_v) = accessibleName(); break;
        case 50: *reinterpret_cast< QString*>(_v) = accessibleDescription(); break;
        case 51: *reinterpret_cast< Qt::LayoutDirection*>(_v) = layoutDirection(); break;
        case 52: *reinterpret_cast< bool*>(_v) = autoFillBackground(); break;
        case 53: *reinterpret_cast< QString*>(_v) = styleSheet(); break;
        case 54: *reinterpret_cast< QLocale*>(_v) = locale(); break;
        case 55: *reinterpret_cast< QString*>(_v) = windowFilePath(); break;
        case 56: *reinterpret_cast< Qt::InputMethodHints*>(_v) = inputMethodHints(); break;
        }
        _id -= 57;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 1: setWindowModality(*reinterpret_cast< Qt::WindowModality*>(_v)); break;
        case 2: setEnabled(*reinterpret_cast< bool*>(_v)); break;
        case 3: setGeometry(*reinterpret_cast< QRect*>(_v)); break;
        case 8: move(*reinterpret_cast< QPoint*>(_v)); break;
        case 10: resize(*reinterpret_cast< QSize*>(_v)); break;
        case 16: setSizePolicy(*reinterpret_cast< QSizePolicy*>(_v)); break;
        case 17: setMinimumSize(*reinterpret_cast< QSize*>(_v)); break;
        case 18: setMaximumSize(*reinterpret_cast< QSize*>(_v)); break;
        case 19: setMinimumWidth(*reinterpret_cast< int*>(_v)); break;
        case 20: setMinimumHeight(*reinterpret_cast< int*>(_v)); break;
        case 21: setMaximumWidth(*reinterpret_cast< int*>(_v)); break;
        case 22: setMaximumHeight(*reinterpret_cast< int*>(_v)); break;
        case 23: setSizeIncrement(*reinterpret_cast< QSize*>(_v)); break;
        case 24: setBaseSize(*reinterpret_cast< QSize*>(_v)); break;
        case 25: setPalette(*reinterpret_cast< QPalette*>(_v)); break;
        case 26: setFont(*reinterpret_cast< QFont*>(_v)); break;
        case 27: setCursor(*reinterpret_cast< QCursor*>(_v)); break;
        case 28: setMouseTracking(*reinterpret_cast< bool*>(_v)); break;
        case 30: setFocusPolicy(*reinterpret_cast< Qt::FocusPolicy*>(_v)); break;
        case 32: setContextMenuPolicy(*reinterpret_cast< Qt::ContextMenuPolicy*>(_v)); break;
        case 33: setUpdatesEnabled(*reinterpret_cast< bool*>(_v)); break;
        case 34: setVisible(*reinterpret_cast< bool*>(_v)); break;
        case 40: setAcceptDrops(*reinterpret_cast< bool*>(_v)); break;
        case 41: setWindowTitle(*reinterpret_cast< QString*>(_v)); break;
//.........这里部分代码省略.........
开发者ID:unni07,项目名称:RecommenderSystem,代码行数:101,代码来源:moc_qwidget.cpp

示例8: search

void search(POINT point[SPOTNUM],int *flag_click_beg,int *start,int *finish)
{   
	int star_fin_flag=-1;
	int mouse_x=320,mouse_y=175,mouse_click;
	int i;
	BUTTON bt[4];
	int flag=0;  //设定一个状态值,避免重复画,而产生闪动的效果
     for(i=0;i<3;i++)
	{
		bt[i].x=493+50*i;
		bt[i].y=3;
		bt[i].x1=bt[i].x+43;
		bt[i].y1=bt[i].y+25;
	}
	bt[3].x=5;bt[3].y=325;bt[3].x1=45;
	bt[3].y1=345;
	initmouse(0,getmaxx(),0,getmaxy());
	cursor(mouse_x,mouse_y);
	while(1)
	{
		newmouse(&mouse_x, &mouse_y, &mouse_click);
		/*鼠标移动到按钮上,高亮显示按钮*/
		/*鼠标由按钮外进入按钮里,由于状态值flag为了1,所以如果检测到鼠标移动按钮的位置上时,
		会画出高亮时画面,而flag值已对变为0,所以不会再去画这种高亮状态,避免产生闪动的效果*/

		if(mouse_x>bt[0].x&& mouse_x<bt[0].x1&&mouse_y>bt[0].y&&mouse_y<bt[0].y1&& flag==1)
		{
		   cursor(mouse_x,mouse_y);         //此处的具体含义是在此位置进行画鼠标用异或的方式覆盖掉,下面再调用一次cursor(mouse_x,mouse_y);在此位置画一个鼠标
		   bt[0].state=HIGHLIGHT;                //这个是一旦检测到鼠标进入到这个位置,就画一个鼠标,然后第二个是在外面把它异或掉,注意这个是在鼠标在外面就画了
		   dr_LPbutton(&bt[0]);
		   flag=0;
		   cursor(mouse_x,mouse_y);
		}
		if(mouse_x>bt[1].x&& mouse_x<bt[1].x1&&mouse_y>bt[1].y&&mouse_y<bt[1].y1&& flag==1)
		{
		   cursor(mouse_x,mouse_y);
		   bt[1].state=HIGHLIGHT;
		   dr_LPbutton(&bt[1]);
		   flag=0;
		   cursor(mouse_x,mouse_y);
		}
		if(mouse_x>bt[2].x&& mouse_x<bt[2].x1&&mouse_y>bt[2].y&&mouse_y<bt[2].y1&& flag==1)
		{
		   cursor(mouse_x,mouse_y);
		   bt[2].state=HIGHLIGHT;
		   dr_LPbutton(&bt[2]);
		   flag=0;
		   cursor(mouse_x,mouse_y);
		}
		if(mouse_x>bt[3].x&& mouse_x<bt[3].x1&&mouse_y>bt[3].y&&mouse_y<bt[3].y1&& flag==1)
		{
		   cursor(mouse_x,mouse_y);
		   bt[3].state=HIGHLIGHT;
		   dr_LPbutton(&bt[3]);
		   flag=0;
		   cursor(mouse_x,mouse_y);
		}

		if(mouse_x>470&& mouse_x<490&&mouse_y>0&&mouse_y<30&& flag==1)
		{
			cursor(mouse_x,mouse_y);
			setfillstyle(1,WHITE);
			bar(470,0,489,20);
			setcolor(BLACK);
			setlinestyle(0,0,3);//画X
			line(470,0,489,20);
			line(470,20,489,0);
			flag=0;
			cursor(mouse_x,mouse_y);
		}
		  /*鼠标移出按钮,按钮回复常态,如果此时鼠标已经按下,则再点鼠标也没有任何反应*/
		  /*开始的时候,鼠标肯定是在按钮之外。即使flag为0,进入这种状态后,立即让flag变为1.如果鼠标还在按钮之外移动的话,
				 就只会在新的位置画出鼠标了,而不会再去画按钮,从而避免产生闪动的效果*/
		if(!(mouse_x>bt[0].x && mouse_x<bt[0].x1 && mouse_y>bt[0].y && mouse_y<bt[0].y1)
			&&!(mouse_x>bt[1].x && mouse_x<bt[1].x1 &&mouse_y>bt[1].y && mouse_y<bt[1].y1)
			&&!(mouse_x>bt[2].x && mouse_x<bt[2].x1 && mouse_y>bt[2].y&& mouse_y<bt[2].y1)
		     &&!(mouse_x>bt[3].x && mouse_x<bt[3].x1 && mouse_y>bt[3].y&& mouse_y<bt[3].y1)
		     &&!(mouse_x>470&& mouse_x<490&&mouse_y>0&&mouse_y<30))
		{
			if(0==flag)
			{

				flag=1;
				bt[0].state= NORMALSTATE;
				bt[1].state= NORMALSTATE;
				bt[2].state= NORMALSTATE;
				bt[3].state= NORMALSTATE;
				cursor(mouse_x,mouse_y);
				dr_LPbutton(&bt[0]);
				dr_LPbutton(&bt[1]);
				dr_LPbutton(&bt[2]);
				dr_LPbutton(&bt[3]);
				setfillstyle(1,BROWN);
				bar(470,0,489,20);
				setcolor(YELLOW);
				setlinestyle(0,0,3);//画X
				line(470,0,489,20);
				line(470,20,489,0);
				cursor(mouse_x,mouse_y);
			}
//.........这里部分代码省略.........
开发者ID:wang9262,项目名称:WLHUSTGuide,代码行数:101,代码来源:search.cpp

示例9: MockTextShape

void TestTableLayout::initTest(int rows, int columns,
        KoTableStyle *tableStyle,
        const QList<KoTableColumnStyle *> &columnStyles,
        const QList<KoTableRowStyle *> &rowStyles,
        const QMap<QPair<int, int>, KoTableCellStyle *> &cellStyles,
        const QMap<QPair<int, int>, QString> &cellTexts)
{
    // Mock shape of size 200x1000 pt.
    m_shape = new MockTextShape();
    Q_ASSERT(m_shape);
    m_shape->setSize(QSizeF(200, 1000));

    // Document layout.
    m_layout = m_shape->layout;
    Q_ASSERT(m_layout);

    // Document.
    m_doc = m_layout->document();
    Q_ASSERT(m_doc);
    m_doc->setDefaultFont(QFont("Sans Serif", 12, QFont::Normal, false));

    // Layout state (layout helper).
    m_textLayout = new TextShapeLayout(m_layout);
    Q_ASSERT(m_textLayout);
    m_layout->setLayout(m_textLayout);

    // Style manager.
    m_styleManager = new KoStyleManager();
    Q_ASSERT(m_styleManager);
    KoTextDocument(m_doc).setStyleManager(m_styleManager);

    // Table style.
    m_defaultTableStyle = new KoTableStyle();
    Q_ASSERT(m_defaultTableStyle);
    m_defaultTableStyle->setMargin(0.0);
    m_defaultTableStyle->setWidth(QTextLength(QTextLength::FixedLength, 200));
    QTextTableFormat tableFormat;
    if (tableStyle) {
        tableStyle->applyStyle(tableFormat);
    } else {
        m_defaultTableStyle->applyStyle(tableFormat);
    }

    // Table.
    QTextCursor cursor(m_doc);
    m_table = cursor.insertTable(rows, columns, tableFormat);
    Q_ASSERT(m_table);

    // Column and row style manager.
    m_tableColumnAndRowStyleManager = KoTableColumnAndRowStyleManager::getManager(m_table);

    // Column styles.
    m_defaultColumnStyle.setRelativeColumnWidth(50.0);
    for (int col = 0; col < columns; ++col) {
        if (columnStyles.value(col)) {
            m_tableColumnAndRowStyleManager.setColumnStyle(col, *(columnStyles.at(col)));
        } else {
            m_tableColumnAndRowStyleManager.setColumnStyle(col, m_defaultColumnStyle);
        }
    }

    // Row styles.
    for (int row = 0; row < rows; ++row) {
        if (rowStyles.value(row)) {
            m_tableColumnAndRowStyleManager.setRowStyle(row, *(rowStyles.at(row)));
        } else {
            m_tableColumnAndRowStyleManager.setRowStyle(row, m_defaultRowStyle);
        }
    }

    // Cell styles and texts.
    m_defaultCellStyle = new KoTableCellStyle();
    Q_ASSERT(m_defaultCellStyle);
    for (int row = 0; row < m_table->rows(); ++row) {
        for (int col = 0; col < m_table->columns(); ++col) {
            // Style.
            QTextTableCell cell = m_table->cellAt(row, col);
            QTextTableCellFormat cellFormat = cell.format().toTableCellFormat();
            if (cellStyles.contains(qMakePair(row, col))) {
                cellStyles.value(qMakePair(row, col))->applyStyle(cellFormat);
                cell.setFormat(cellFormat.toCharFormat());
            } else {
                m_defaultCellStyle->applyStyle(cellFormat);
            }
            cell.setFormat(cellFormat.toCharFormat());
            // Text.
            if (cellTexts.contains(qMakePair(row, col))) {
                cell.firstCursorPosition().insertText(cellTexts.value(qMakePair(row, col)));
            }
        }
    }
    KoParagraphStyle style;
    style.setStyleId(101); // needed to do manually since we don't use the stylemanager
    QTextBlock b2 = m_doc->begin();
    while (b2.isValid()) {
        style.applyStyle(b2);
        b2 = b2.next();
    }

}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:100,代码来源:TestTableLayout.cpp

示例10: testOverlineColor

void TestStyles::testUnapplyStyle()
{
    // Used to test OverlineColor style
    QColor testOverlineColor(255, 128, 64);
    KoCharacterStyle::LineWeight testOverlineWeight = KoCharacterStyle::ThickLineWeight;
    qreal testOverlineWidth = 1.5;

    // in this test we should avoid testing any of the hardcodedDefaultProperties; see KoCharacterStyle for details!
    KoParagraphStyle headers;
    headers.setOverlineColor(testOverlineColor);
    headers.setOverlineMode(KoCharacterStyle::ContinuousLineMode);
    headers.setOverlineStyle(KoCharacterStyle::DottedLine);
    headers.setOverlineType(KoCharacterStyle::DoubleLine);
    headers.setOverlineWidth(testOverlineWeight, testOverlineWidth);
    headers.setFontWeight(QFont::Bold);
    headers.setAlignment(Qt::AlignCenter);
    KoParagraphStyle head1;
    head1.setParentStyle(&headers);
    head1.setLeftMargin(QTextLength(QTextLength::FixedLength, 40));

    QTextDocument doc;
    doc.setPlainText("abc");
    QTextBlock block = doc.begin();
    head1.applyStyle(block);

    QTextCursor cursor(block);
    QTextBlockFormat bf = cursor.blockFormat();
    KoParagraphStyle bfStyle (bf, cursor.charFormat());
    QCOMPARE(bf.alignment(), Qt::AlignCenter);
    QCOMPARE(bfStyle.leftMargin(), 40.);
    QTextCharFormat cf = cursor.charFormat();
    QCOMPARE(cf.colorProperty(KoCharacterStyle::OverlineColor), testOverlineColor);
    QCOMPARE(cf.intProperty(KoCharacterStyle::OverlineMode), (int) KoCharacterStyle::ContinuousLineMode);
    QCOMPARE(cf.intProperty(KoCharacterStyle::OverlineStyle), (int) KoCharacterStyle::DottedLine);
    QCOMPARE(cf.intProperty(KoCharacterStyle::OverlineType), (int) KoCharacterStyle::DoubleLine);
    QCOMPARE(cf.intProperty(KoCharacterStyle::OverlineWeight), (int) testOverlineWeight);
    QCOMPARE(cf.doubleProperty(KoCharacterStyle::OverlineWidth), testOverlineWidth);

    head1.unapplyStyle(block);
    bf = cursor.blockFormat();
    QCOMPARE(bf.hasProperty(QTextFormat::BlockAlignment), false);
    QCOMPARE(bf.hasProperty(QTextFormat::BlockLeftMargin), false);
    cf = cursor.charFormat();
    QCOMPARE(cf.hasProperty(KoCharacterStyle::OverlineColor), false);
    QCOMPARE(cf.hasProperty(KoCharacterStyle::OverlineMode), false);
    QCOMPARE(cf.hasProperty(KoCharacterStyle::OverlineStyle), false);
    QCOMPARE(cf.hasProperty(KoCharacterStyle::OverlineType), false);
    QCOMPARE(cf.hasProperty(KoCharacterStyle::OverlineWeight), false);
    QCOMPARE(cf.hasProperty(KoCharacterStyle::OverlineWidth), false);

    doc.clear();
    block = doc.begin();
    head1.applyStyle(block);
    bf = cursor.blockFormat();
    KoParagraphStyle bfStyle2 (bf, cursor.charFormat());
    QCOMPARE(bf.alignment(), Qt::AlignCenter);
    QCOMPARE(bfStyle2.leftMargin(), 40.);
    cf = cursor.charFormat();
    //QCOMPARE(cf.fontOverline(), true);
    QCOMPARE(cf.colorProperty(KoCharacterStyle::OverlineColor), testOverlineColor);
    QCOMPARE(cf.intProperty(KoCharacterStyle::OverlineMode), (int) KoCharacterStyle::ContinuousLineMode);
    QCOMPARE(cf.intProperty(KoCharacterStyle::OverlineStyle), (int) KoCharacterStyle::DottedLine);
    QCOMPARE(cf.intProperty(KoCharacterStyle::OverlineType), (int) KoCharacterStyle::DoubleLine);
    QCOMPARE(cf.intProperty(KoCharacterStyle::OverlineWeight), (int) testOverlineWeight);
    QCOMPARE(cf.doubleProperty(KoCharacterStyle::OverlineWidth), testOverlineWidth);


    head1.unapplyStyle(block);
    bf = cursor.blockFormat();
    QCOMPARE(bf.hasProperty(QTextFormat::BlockAlignment), false);
    QCOMPARE(bf.hasProperty(QTextFormat::BlockLeftMargin), false);
    cf = cursor.charFormat();
    //QCOMPARE(cf.hasProperty(QTextFormat::FontOverline), false);

    doc.setHtml("bla bla<i>italic</i>enzo");

    block = doc.begin();
    head1.applyStyle(block);
    bf = cursor.blockFormat();
    KoParagraphStyle bfStyle3(bf, cursor.charFormat());
    QCOMPARE(bf.alignment(), Qt::AlignCenter);
    QCOMPARE(bfStyle3.leftMargin(), 40.);
    cf = cursor.charFormat();
    //QCOMPARE(cf.fontOverline(), true);
    QCOMPARE(cf.hasProperty(KoCharacterStyle::OverlineColor), true);
    QCOMPARE(cf.hasProperty(KoCharacterStyle::OverlineMode), true);
    QCOMPARE(cf.hasProperty(KoCharacterStyle::OverlineStyle), true);
    QCOMPARE(cf.hasProperty(KoCharacterStyle::OverlineType), true);
    QCOMPARE(cf.hasProperty(KoCharacterStyle::OverlineWeight), true);
    QCOMPARE(cf.hasProperty(KoCharacterStyle::OverlineWidth), true);

    cursor.setPosition(7);
    cursor.setPosition(12, QTextCursor::KeepAnchor);
    QTextCharFormat italic;
    italic.setFontItalic(true);
    cursor.mergeCharFormat(italic);
    cursor.setPosition(8);
    cf = cursor.charFormat();
    QCOMPARE(cf.fontItalic(), true);
    cursor.setPosition(0);
//.........这里部分代码省略.........
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:101,代码来源:TestStyles.cpp

示例11: cursor

bool BaseTextDocument::save(QString *errorString, const QString &fileName, bool autoSave)
{
    QTextCursor cursor(d->m_document);

    // When autosaving, we don't want to modify the document/location under the user's fingers.
    BaseTextEditorWidget *editorWidget = 0;
    int savedPosition = 0;
    int savedAnchor = 0;
    int undos = d->m_document->availableUndoSteps();

    // When saving the current editor, make sure to maintain the cursor position for undo
    Core::IEditor *currentEditor = Core::EditorManager::currentEditor();
    if (BaseTextEditor *editable = qobject_cast<BaseTextEditor*>(currentEditor)) {
        if (editable->document() == this) {
            editorWidget = editable->editorWidget();
            QTextCursor cur = editorWidget->textCursor();
            savedPosition = cur.position();
            savedAnchor = cur.anchor();
            cursor.setPosition(cur.position());
        }
    }

    cursor.beginEditBlock();
    cursor.movePosition(QTextCursor::Start);

    if (d->m_storageSettings.m_cleanWhitespace)
        cleanWhitespace(cursor, d->m_storageSettings.m_cleanIndentation, d->m_storageSettings.m_inEntireDocument);
    if (d->m_storageSettings.m_addFinalNewLine)
        ensureFinalNewLine(cursor);
    cursor.endEditBlock();

    QString fName = d->m_fileName;
    if (!fileName.isEmpty())
        fName = fileName;

    Utils::TextFileFormat saveFormat = format();
    if (saveFormat.codec->name() == "UTF-8") {
        switch (d->m_extraEncodingSettings.m_utf8BomSetting) {
        case TextEditor::ExtraEncodingSettings::AlwaysAdd:
            saveFormat.hasUtf8Bom = true;
            break;
        case TextEditor::ExtraEncodingSettings::OnlyKeep:
            break;
        case TextEditor::ExtraEncodingSettings::AlwaysDelete:
            saveFormat.hasUtf8Bom = false;
            break;
        }
    } // "UTF-8"

    const bool ok = write(fName, saveFormat, d->m_document->toPlainText(), errorString);

    if (autoSave && undos < d->m_document->availableUndoSteps()) {
        d->m_document->undo();
        if (editorWidget) {
            QTextCursor cur = editorWidget->textCursor();
            cur.setPosition(savedAnchor);
            cur.setPosition(savedPosition, QTextCursor::KeepAnchor);
            editorWidget->setTextCursor(cur);
        }
    }

    if (!ok)
        return false;
    d->m_autoSaveRevision = d->m_document->revision();
    if (autoSave)
        return true;

    const QFileInfo fi(fName);
    const QString oldFileName = d->m_fileName;
    d->m_fileName = QDir::cleanPath(fi.absoluteFilePath());
    d->m_document->setModified(false);
    emit fileNameChanged(oldFileName, d->m_fileName);
    emit titleChanged(fi.fileName());
    emit changed();
    return true;
}
开发者ID:mornelon,项目名称:QtCreator_compliments,代码行数:76,代码来源:basetextdocument.cpp

示例12: getMesh

void SWFontRenderer::updateMesh()
{
	if ( !getMesh() ) return;
	if ( !m_fontInfo.isValid() ) return;

	SWMesh* mesh = getMesh();
	mesh->resizeVertexStream( m_text.size() * 4 );
	mesh->resizeTexCoordStream( m_text.size() * 4 );
	mesh->resizeTriangleStream( m_text.size() * 2 );

	tuint32 lastID = '\r';
	tvec2 cursor( 0, 0 );
	tvec2 scale( m_fontInfo()->getScaleW(), m_fontInfo()->getScaleH() );

	float lineHeight = getLinesHeight( m_text );
	switch ( m_alignV )
	{
	case SW_Align_Top    : cursor.y = 0; break;
	case SW_Align_Bottom : cursor.y = lineHeight; break;
	case SW_Align_Center : cursor.y = lineHeight/2.0f; break;
	}

	for ( tuint i = 0 ; i < m_text.size() ; ++i )
	{
		//! convert character to unsigned char id
		tbyte byteID = m_text[i];

		tuint32 id = byteID;

		if ( lastID == (int)'\n' || lastID == (int)'\r' )
		{
			float lineWidth = (float)getLineWidth( m_text, i );
			switch ( m_alignH )
			{
			case SW_Align_Left   : cursor.x = 0; break;
			case SW_Align_Right  : cursor.x = -lineWidth; break;
			case SW_Align_Center : cursor.x = -lineWidth/2.0f; break;
			}
		}

		if ( id == (int)'\n' || id == (int)'\r' )
		{
			lastID = id;
			cursor.y -= m_fontInfo()->getLineHeight();
			continue;
		}

		SWFontInfo::Char*    fontChar = m_fontInfo()->getChar( id );
		if ( fontChar == NULL ) continue;

		SWFontInfo::Kerning* kerning  = m_fontInfo()->getKerning( lastID, id );
		cursor.x += (kerning != NULL)? kerning->amount : 0;
		
		lastID = id;
		tuint base = i*4;

		float left   = cursor.x + fontChar->xoffset;
		float top    = cursor.y - fontChar->yoffset;
		float right  = left + fontChar->width;
		float bottom = top - fontChar->height;
		cursor.x += fontChar->xadvence;
		
		mesh->setTriangle( (i*2)+0, tindex3( base+0, base+1, base+2 ) );
		mesh->setTriangle( (i*2)+1, tindex3( base+3, base+2, base+1 ) );

		mesh->setVertex( base+0, tvec3(  left, top, 0 ) );
		mesh->setVertex( base+1, tvec3( right, top, 0 ) );
		mesh->setVertex( base+2, tvec3(  left, bottom, 0 ) );
		mesh->setVertex( base+3, tvec3( right, bottom, 0 ) );
		
		mesh->setTexCoord( base+0, tvec2(                     fontChar->x/scale.x,                      fontChar->y/scale.y ) );
		mesh->setTexCoord( base+1, tvec2( (fontChar->x + fontChar->width)/scale.x,                      fontChar->y/scale.y ) );
		mesh->setTexCoord( base+2, tvec2(                     fontChar->x/scale.x, (fontChar->y + fontChar->height)/scale.y ) );
		mesh->setTexCoord( base+3, tvec2( (fontChar->x + fontChar->width)/scale.x, (fontChar->y + fontChar->height)/scale.y ) );
	}
}
开发者ID:ultrano,项目名称:project_sw,代码行数:76,代码来源:SWFontRenderer.cpp

示例13: QTextDocument

void FormSimularCuotas::generaReporte()
{
    documento = new QTextDocument();
    QTextCursor cursor( documento );
    int cant_filas = 3 + SBCantidad->value();
    QTextTable *tabla = cursor.insertTable( cant_filas, 5 );
    QTextTableFormat formatoTabla = tabla->format();
    formatoTabla.setHeaderRowCount( 1 );
    formatoTabla.setWidth( QTextLength( QTextLength::PercentageLength, 100 ) );
    formatoTabla.setBorderStyle( QTextFrameFormat::BorderStyle_Solid );
    formatoTabla.setBorder( 1 );
    formatoTabla.setCellPadding( 3 );
    formatoTabla.setCellSpacing( 0 );
    tabla->setFormat( formatoTabla );
    tabla->cellAt( 0,0 ).firstCursorPosition().insertHtml( "<b> # Cuota</b>" );
    tabla->cellAt( 0,1 ).firstCursorPosition().insertHtml( "<b> Fecha de pago </b>" );
    tabla->cellAt( 0,2 ).firstCursorPosition().insertHtml( "<b> Cuota </b>" );
    tabla->cellAt( 0,3 ).firstCursorPosition().insertHtml( "<b> Pagado </b> " );
    tabla->cellAt( 0,4 ).firstCursorPosition().insertHtml( "<b> Subtotal </b>" );

    QTextBlockFormat bfizq = tabla->cellAt( 0, 3 ).firstCursorPosition().blockFormat();
    bfizq.setAlignment( Qt::AlignRight );
    // Ingreso los datos
    double subtotal = DSBImporte->value();
    double pagado = DSBEntrega->value();
    // Importe
    tabla->cellAt( 1, 0 ).firstCursorPosition().insertHtml( " " );
    tabla->cellAt( 1, 1 ).firstCursorPosition().insertHtml( "Importe a pagar en cuotas" );
    tabla->cellAt( 1, 2 ).firstCursorPosition().setBlockFormat( bfizq );
    tabla->cellAt( 1, 2 ).firstCursorPosition().insertHtml( QString( "$ %L1" ).arg( subtotal, 10, 'f', 2 ) );
    tabla->cellAt( 1, 3 ).firstCursorPosition().setBlockFormat( bfizq );
    tabla->cellAt( 1, 3 ).firstCursorPosition().insertHtml( QString( "$ %L1" ).arg( 0.0, 10, 'f', 2 ) );
    tabla->cellAt( 1, 4 ).firstCursorPosition().setBlockFormat( bfizq );
    tabla->cellAt( 1, 4 ).firstCursorPosition().insertHtml( QString( "$ %L1" ).arg( subtotal, 10, 'f', 2 ) );
    subtotal -= DSBEntrega->value();
    tabla->cellAt( 2, 0 ).firstCursorPosition().insertHtml( "" );
    tabla->cellAt( 2, 1 ).firstCursorPosition().insertHtml( "Entrega inicial" );
    tabla->cellAt( 2, 2 ).firstCursorPosition().setBlockFormat( bfizq );
    tabla->cellAt( 2, 2 ).firstCursorPosition().insertHtml( QString( "$ %L1" ).arg( DSBEntrega->value(), 10, 'f', 2 ) );
    tabla->cellAt( 2, 3 ).firstCursorPosition().setBlockFormat( bfizq );
    tabla->cellAt( 2, 3 ).firstCursorPosition().insertHtml( QString( "$ %L1" ).arg( pagado, 10, 'f', 2 ) );
    tabla->cellAt( 2, 4 ).firstCursorPosition().setBlockFormat( bfizq );
    tabla->cellAt( 2, 4 ).firstCursorPosition().insertHtml( QString( "$ %L1" ).arg( subtotal, 10, 'f', 2 ) );
    subtotal *= ( 1 + DSBInteres->value() / 100 );
    double valor_cuota = ( ( DSBTotal->value() ) * ( 1 + DSBInteres->value() / 100 ) ) / SBCantidad->value();
    QDate fch = DEInicio->date();
    for( int i = 1; i<=SBCantidad->value(); i++ ) {
        tabla->cellAt( i+2, 0 ).firstCursorPosition().insertHtml( QString( "#%1" ).arg( i ) );
        tabla->cellAt( i+2, 1 ).firstCursorPosition().insertHtml( QString( "%1" ).arg( fch.toString( Qt::SystemLocaleShortDate ) ) );
        fch.addDays( (i-1)*MPlanCuota::diasEnPeriodo( (MPlanCuota::Periodo) CBPeriodo->currentIndex(), fch ) );
        tabla->cellAt( i+2, 2 ).firstCursorPosition().setBlockFormat( bfizq );
        tabla->cellAt( i+2, 2 ).firstCursorPosition().insertHtml( QString( "$ %L1" ).arg( valor_cuota, 10, 'f', 2 ) );
        pagado += valor_cuota;
        tabla->cellAt( i+2, 3 ).firstCursorPosition().setBlockFormat( bfizq );
        tabla->cellAt( i+2, 3 ).firstCursorPosition().insertHtml( QString( "$ %L1" ).arg( pagado, 10, 'f', 2 ) );
        subtotal -= valor_cuota;
        tabla->cellAt( i+2, 4 ).firstCursorPosition().setBlockFormat( bfizq );
        tabla->cellAt( i+2, 4 ).firstCursorPosition().insertHtml( QString( "$ %L1" ).arg( subtotal, 10, 'f', 2 ) );
    }

    // Firma y aclaracion
    cursor.movePosition( QTextCursor::End );
    cursor.insertBlock();
    cursor.insertBlock();
    cursor.insertBlock();
    cursor.insertBlock();
    cursor.insertBlock();
    cursor.insertText( "Firma del contrayente: ___________________________" );
    cursor.insertBlock();
    cursor.insertBlock();
    cursor.insertBlock();
    cursor.insertBlock();
    cursor.insertText( QString::fromUtf8( "Aclaracion: ________________________________________________      DNI:___-__________-___" ) );
    cursor.insertBlock();
    cursor.insertBlock();
    cursor.insertHtml( QString::fromUtf8( "<small>En caso de provocarse un atraso en la fecha de pago de cualquiera de las cuotas, se aplicara el recargo correspondiente tal cual se hace actualmenete con cualquier recibo emitido por nuestra entidad.</small>" ) );

    // Cabecera
    cursor.movePosition( QTextCursor::Start );
    cursor.insertBlock();
#ifdef Q_OS_WIN
    cursor.insertHtml( "<h1>HiComp Computación</h1><br />" );
#else
    cursor.insertHtml( "<h1>" + ERegistroPlugins::getInstancia()->pluginInfo()->empresa() + "</h1><br />" );
#endif
    cursor.insertHtml( "<h2>Plan de cuotas</h2><br /><br />" );
    cursor.insertBlock();
    cursor.insertHtml( QString( "<b>Fecha de Inicio:</b> %1 <br />" ).arg( DEInicio->date().toString( Qt::SystemLocaleLongDate ) ) );
    cursor.insertHtml( QString( "<b>Nombre del cliente:</b> %1 <br />").arg( MClientes::getRazonSocial( _id_cliente ) ) );
    return;
}
开发者ID:chungote,项目名称:gestotux,代码行数:91,代码来源:formsimularcuotas.cpp

示例14: cursor

// MouseMoved
void
ObjectView::MouseMoved(BPoint where, uint32 transit,
					   const BMessage* dragMessage)
{
//	BRect dirty(where, where);
//	dirty.InsetBy(-10, -10);
//	Invalidate(dirty);
	
if (dragMessage) {
//printf("ObjectView::MouseMoved(BPoint(%.1f, %.1f)) - DRAG MESSAGE\n", where.x, where.y);
//Window()->CurrentMessage()->PrintToStream();
} else {
//printf("ObjectView::MouseMoved(BPoint(%.1f, %.1f))\n", where.x, where.y);
}

	if (fScrolling) {
		BCursor cursor(kGrabCursor);
		SetViewCursor(&cursor);
	
		BPoint offset = fLastMousePos - where;
		ScrollBy(offset.x, offset.y);
		fLastMousePos = where + offset;
	} else if (fInitiatingDrag) {
		BPoint offset = fLastMousePos - where;
		if (sqrtf(offset.x * offset.x + offset.y * offset.y) > 5.0) {
			BMessage dragMessage('drag');
			BBitmap* dragBitmap = new BBitmap(BRect(0, 0, 40, 40), B_RGBA32, true);
			if (dragBitmap->Lock()) {
				BView* helper = new BView(dragBitmap->Bounds(), "offscreen view",
										  B_FOLLOW_ALL, B_WILL_DRAW);
				dragBitmap->AddChild(helper);
				helper->SetDrawingMode(B_OP_ALPHA);
				helper->SetBlendingMode(B_CONSTANT_ALPHA, B_ALPHA_COMPOSITE);

				BRect r(helper->Bounds());
				helper->SetHighColor(0, 0, 0, 128);
				helper->StrokeRect(r);

				helper->SetHighColor(200, 200, 200, 100);
				r.InsetBy(1, 1);
				helper->FillRect(r);

				helper->SetHighColor(0, 0, 0, 255);
				const char* text = "Test";
				float pos = (r.Width() - helper->StringWidth(text)) / 2;
				helper->DrawString(text, BPoint(pos, 25));
				helper->Sync();
			}
			
			DragMessage(&dragMessage, dragBitmap, B_OP_ALPHA, B_ORIGIN, this);
			fInitiatingDrag = false;
		}
	} else {
		BCursor cursor(kMoveCursor);
		SetViewCursor(&cursor);
	
		if (fState && fState->IsTracking()) {
			BRect before = fState->Bounds();
	
			fState->MouseMoved(where);
	
			BRect after = fState->Bounds();
			BRect invalid(before | after);
			Invalidate(invalid);
		}
	}
//	SetViewCursor();
}
开发者ID:mariuz,项目名称:haiku,代码行数:69,代码来源:ObjectView.cpp

示例15: bar

// Check whether the current view is elligible for action.
unsigned int qtractorTimeScaleForm::flags (void) const
{
	if (m_pTimeScale == NULL)
		return 0;

	unsigned int iFlags = 0;

	float fTempo = m_ui.TempoSpinBox->tempo();
	unsigned short iBeatsPerBar = m_ui.TempoSpinBox->beatsPerBar();
	unsigned short iBeatDivisor = m_ui.TempoSpinBox->beatDivisor();

	unsigned short iBar = bar();
	qtractorTimeScale::Cursor cursor(m_pTimeScale);
	qtractorTimeScale::Node *pNode = cursor.seekBar(iBar);

	if (pNode && pNode->bar == iBar) {
		iFlags |= UpdateNode;
		if (pNode->prev())
			iFlags |= RemoveNode;
	}
	if (pNode
		&& ::fabs(pNode->tempo - fTempo) < 0.05f
	//	&& pNode->beatType == iBeatType
		&& pNode->beatsPerBar == iBeatsPerBar
		&& pNode->beatDivisor == iBeatDivisor)
		iFlags &= ~UpdateNode;
	else
		iFlags |=  AddNode;
	if (pNode && pNode->bar == iBar)
		iFlags &= ~AddNode;
	if (pNode
		&& (pNode = pNode->next())	// real assignment
		&& ::fabs(pNode->tempo - fTempo) < 0.05f
	//	&& pNode->beatType == iBeatType
		&& pNode->beatsPerBar == iBeatsPerBar
		&& pNode->beatDivisor == iBeatDivisor)
		iFlags &= ~AddNode;

	unsigned long iFrame = m_pTimeScale->frameFromBar(iBar);
	qtractorTimeScale::Marker *pMarker
		= m_pTimeScale->markers().seekFrame(iFrame);

	const QString& sMarkerText
		= m_ui.MarkerTextLineEdit->text().simplified();
	const QColor& rgbMarkerColor
		= m_ui.MarkerTextLineEdit->palette().text().color();

	if (pMarker && pMarker->frame == iFrame) {
		iFlags |= UpdateMarker;
		iFlags |= RemoveMarker;
	}
	if (pMarker
		&& pMarker->text == sMarkerText
		&& pMarker->color == rgbMarkerColor)
		iFlags &= ~UpdateMarker;
	else if (!sMarkerText.isEmpty())
		iFlags |=  AddMarker;
	if (pMarker && pMarker->frame == iFrame)
		iFlags &= ~AddMarker;

	return iFlags;
}
开发者ID:EQ4,项目名称:qtractor,代码行数:63,代码来源:qtractorTimeScaleForm.cpp


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