您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ underMouse函数代码示例

51自学网 2021-06-03 09:09:29
  C++
这篇教程C++ underMouse函数代码示例写得很实用,希望能帮到您。

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

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

示例1: killTimer

void Communicate::timerEvent(QTimerEvent *e){    if (e->timerId() == m_timerId) {        killTimer(m_timerId);        if (!underMouse())            close();        return;    }    QLabel::timerEvent(e);}
开发者ID:Gonchar64,项目名称:Rline,代码行数:10,


示例2: downArrowPixmap

	QPixmap downArrowPixmap() const	{		// if (isDown())		// 	return QPixmap(":/images/down-arrow/pressed.png");		if (underMouse() || isDown())			return QPixmap(":/images/down-arrow/hover.png");		return QPixmap(":/images/down-arrow/normal.png");	}
开发者ID:AlekSi,项目名称:Jabbin,代码行数:10,


示例3: killTimer

void QBalloonTip::timerEvent(QTimerEvent *e){    if (e->timerId() == timerId) {        killTimer(timerId);        if (!underMouse())            close();        return;    }    QWidget::timerEvent(e);}
开发者ID:KDE,项目名称:android-qt5-qtbase,代码行数:10,


示例4: setIcon

void PlayPauseButton::reloadContent( const QSize &sz ){    const int width  = sz.width();    const int height = sz.height();    //NOTICE this is a bit cumbersome, as Qt renders faster to images than to pixmaps    // However we need the Image and generate the pixmap ourself - maybe extend the SvgHandler API    m_icon.play[0] = The::svgHandler()->renderSvg( "PLAYpause", width, height, "PLAYpause", true ).toImage();    m_icon.play[1] = The::svgHandler()->renderSvg( "PLAYpause_active", width, height, "PLAYpause_active", true ).toImage();    m_icon.pause[0] = The::svgHandler()->renderSvg( "playPAUSE", width, height, "playPAUSE", true ).toImage();    m_icon.pause[1] = The::svgHandler()->renderSvg( "playPAUSE_active", width, height, "playPAUSE_active", true ).toImage();    if( layoutDirection() == Qt::RightToLeft )    {        for ( int i = 0; i < 2; ++i )        {            m_icon.play[i] = m_icon.play[i].mirrored( true, false );            m_icon.pause[i] = m_icon.pause[i].mirrored( true, false );        }    }    setIcon( m_isPlaying ? m_icon.pause[underMouse()] : m_icon.play[underMouse()] );}
开发者ID:darthcodus,项目名称:Amarok,代码行数:20,


示例5: shape

void TabBarWidget::removeTab(int index){	if (underMouse())	{		const bool isHorizontal = (shape() == QTabBar::RoundedNorth || shape() == QTabBar::RoundedSouth);		const QSize size = tabSizeHint(count() - 1);		m_tabSize = (isHorizontal ? size.width() : size.height());	}	QTabBar::removeTab(index);	if (underMouse() && tabAt(mapFromGlobal(QCursor::pos())) < 0)	{		m_tabSize = 0;		updateGeometry();		adjustSize();	}}
开发者ID:wanarek,项目名称:otter,代码行数:20,


示例6: redrawLine

  void OutputPlugWidget::mouseMoveEvent(QMouseEvent* e)  {    if (m_lineDrawMode)      {       emit redrawLine(this->pos()+parentWidget()->pos() + QPoint(this->width() / 2,this->height() / 2),			this->pos()+e->pos()+parentWidget()->pos());      }    else      {	emit underMouse(this);      }  }
开发者ID:ChristianFrisson,项目名称:gephex,代码行数:12,


示例7: Q_UNUSED

void KateTabButton::paintEvent(QPaintEvent *ev){    Q_UNUSED(ev)    QColor barColor(palette().color(QPalette::Highlight));    // read from the parent widget (=KateTabBar) the isActiveViewSpace property    if (isActiveViewSpace()) {        // if inactive, convert color to gray value        const int g = qGray(barColor.rgb());        barColor = QColor(g, g, g);    }    // compute sane margins    const int margin = style()->pixelMetric(QStyle::PM_ButtonMargin, 0, this);    const int barMargin = margin / 2;    const int barHeight = ceil(height() / 10.0);    QPainter p(this);    // paint bar if inactive but hovered    if (!isChecked() && underMouse()) {        barColor.setAlpha(80);        p.fillRect(QRect(barMargin, height() - barHeight, width() - 2 * barMargin, barHeight), barColor);    }    // paint bar    if (isChecked()) {        barColor.setAlpha(255);        p.fillRect(QRect(barMargin, height() - barHeight, width() - 2 * barMargin, barHeight), barColor);    }    // icon, if applicable    int leftMargin = margin;    if (! icon().isNull()) {        const int y = (height() - 16) / 2;        icon().paint(&p, margin, y, 16, 16);        leftMargin += 16;        leftMargin += margin;    }    // the width of the text is reduced by the close button + 2 * margin    const int w = width() // width of widget                - m_closeButton->width() - 2 * margin // close button                - leftMargin; // modified button    // draw text, we need to elide to xxx...xxx is too long    const QString elidedText = QFontMetrics(font()).elidedText (text(), Qt::ElideMiddle, w);    const QRect textRect(leftMargin, 0, w, height());    const QPalette pal = QApplication::palette();    style()->drawItemText(&p, textRect, Qt::AlignHCenter | Qt::AlignVCenter, pal, true, elidedText);}
开发者ID:cmacq2,项目名称:kate,代码行数:52,


示例8: p

void  CImgButton::paintEvent( QPaintEvent * e ){    QPainter p( this );    if ( !underMouse() )    {        if ( isDown() || isChecked() )        {            const QPixmap & pm = image( m_cName, m_cKey );            p.drawPixmap( QPoint( 0, 0 ), pm );        }        else        {            const QPixmap & pm = image( m_uName, m_uKey );            p.drawPixmap( QPoint( 0, 0 ), pm );        }    }    else    {        if ( m_hovered )        {            if ( isDown() || isChecked() )            {                const QPixmap & pm = image( m_chName, m_chKey );                p.drawPixmap( QPoint( 0, 0 ), pm );            }            else            {                const QPixmap & pm = image( m_uhName, m_uhKey );                p.drawPixmap( QPoint( 0, 0 ), pm );            }        }        else        {            if ( isDown() || isChecked() )            {                const QPixmap & pm = image( m_cName, m_cKey );                p.drawPixmap( QPoint( 0, 0 ), pm );            }            else            {                const QPixmap & pm = image( m_uName, m_uKey );                p.drawPixmap( QPoint( 0, 0 ), pm );            }            // А поверх рисуем прямоугольник.            QPen   pen   = QPen( QColor( 170, 170, 210, 150 ) );            QBrush brush = QBrush( QColor( 170, 170, 210, 150 ) );            p.setPen( pen );            p.setBrush( brush );            p.drawRect( QRect( 0, 0, size().width(), size().height() ) );        }    }}
开发者ID:z80,项目名称:avrusb,代码行数:52,


示例9: tabButtonCloseRequest

void KateTabBar::tabButtonCloseRequest(KateTabButton *tabButton){    // keep width    if (underMouse()) {        m_keepTabWidth = true;    }    const int id = m_idToTab.key(tabButton, -1);    Q_ASSERT(id >= 0);    if (id >= 0) {        emit closeTabRequested(id);    }}
开发者ID:benpope82,项目名称:kate,代码行数:13,


示例10: p

void SelectorActionButton::paintEvent( QPaintEvent *event ){    QPainter p( this );    QColor color = palette().color( QPalette::HighlightedText );    color.setAlpha( 80 );    if( underMouse() )        p.fillRect( rect(), color );    p.setPen( color );    int frame = style()->pixelMetric( QStyle::PM_DefaultFrameWidth, 0, this );    p.drawLine( rect().topLeft() + QPoint( 0, frame ),                rect().bottomLeft() - QPoint( 0, frame ) );    QFramelessButton::paintEvent( event );}
开发者ID:DZLiao,项目名称:vlc-2.1.4.32.subproject-2013-update2,代码行数:13,


示例11: Q_UNUSED

/*!    /overload    /internal    Draws the background.    Event /a ev not used.*/void QtScrollDial::paintEvent(QPaintEvent* ev){    Q_UNUSED(ev);    QPainter p(this);    p.save();    p.scale(width(), height());    if (underMouse() || m_popup->isVisible()) {        m_hoverBackground.play(&p);    } else {        m_background.play(&p);    }    p.restore();}
开发者ID:Linux-enCaja,项目名称:SIE,代码行数:19,


示例12: updateTimer

void SessionBar::updateTimer(){    if (!underMouse()) {        QList<SBSeg>::iterator i;        for (i=segments.begin();i!=segments.end();++i) {            (*i).highlight=false;        }    } else {        timer.singleShot(50,this, SLOT(updateTimer()));    }    update();}
开发者ID:greg100,项目名称:greg100-sleepyhead,代码行数:13,


示例13: paintEvent

	// reimplemented	void paintEvent(QPaintEvent*)	{		QPainter p(this);		// p.drawPixmap(0, 0, moodButton_->currentPixmap());		//XMPP::Status::Type status = enableRotation_ ? XMPP::Status::Reconnecting : status_;		XMPP::Status::Type status = status_;		p.drawPixmap(0, 0, Ya::VisualUtil::statusPixmap(status, underMouse() || isDown()));		p.drawPixmap(10, 4, downArrowPixmap());		// p.setPen(Qt::black);		// p.drawRect(rect().adjusted(0, 0, -1, -1));	}
开发者ID:AlekSi,项目名称:Jabbin,代码行数:14,


示例14: sprintf

void MyTextBrowser::mouseReleaseEvent(QMouseEvent *event){  char buf[80];  if(event == NULL) return;  sprintf(buf,"QPushButtonReleased(%d) -xy=%d,%d/n",id, event->x(), event->y());  if(underMouse()) tcp_send(s,buf,strlen(buf));#ifdef NO_WEBKIT  QTextBrowser::mouseReleaseEvent(event);#else  QWebView::mouseReleaseEvent(event);#endif  }
开发者ID:pvbrowser,项目名称:pvb,代码行数:13,


示例15: Q_D

/*! /reimp */void QCommandLinkButton::paintEvent(QPaintEvent *){    Q_D(QCommandLinkButton);    QStylePainter p(this);    p.save();    QStyleOptionButton option;    initStyleOption(&option);    //Enable command link appearence on Vista    option.features |= QStyleOptionButton::CommandLinkButton;    option.text = QString();    option.icon = QIcon(); //we draw this ourselves    QSize pixmapSize = icon().actualSize(iconSize());    int vOffset = isDown() ? style()->pixelMetric(QStyle::PM_ButtonShiftVertical) : 0;    int hOffset = isDown() ? style()->pixelMetric(QStyle::PM_ButtonShiftHorizontal) : 0;    //Draw icon    p.drawControl(QStyle::CE_PushButton, option);    if (!icon().isNull())        p.drawPixmap(d->leftMargin() + hOffset, d->topMargin() + vOffset,        icon().pixmap(pixmapSize, isEnabled() ? QIcon::Normal : QIcon::Disabled,                                  isChecked() ? QIcon::On : QIcon::Off));    //Draw title    QColor textColor = palette().buttonText().color();    if (isEnabled() && d->usingVistaStyle()) {        textColor = QColor(21, 28, 85);        if (underMouse() && !isDown())            textColor = QColor(7, 64, 229);        //A simple text color transition        d->currentColor = d->mergedColors(textColor, d->currentColor, 60);        option.palette.setColor(QPalette::ButtonText, d->currentColor);    }    int textflags = Qt::TextShowMnemonic;    if (!style()->styleHint(QStyle::SH_UnderlineShortcut, &option, this))        textflags |= Qt::TextHideMnemonic;    p.setFont(d->titleFont());    p.drawItemText(d->titleRect().translated(hOffset, vOffset),                    textflags, option.palette, isEnabled(), text(), QPalette::ButtonText);    //Draw description    textflags |= Qt::TextWordWrap | Qt::ElideRight;    p.setFont(d->descriptionFont());    p.drawItemText(d->descriptionRect().translated(hOffset, vOffset), textflags,                    option.palette, isEnabled(), description(), QPalette::ButtonText);    p.restore();}
开发者ID:Fale,项目名称:qtmoko,代码行数:52,


示例16: Q_UNUSED

void CloseButton::paintEvent(QPaintEvent *AEvent){	Q_UNUSED(AEvent);	if (icon().isNull())	{		QStyleOption opt;		opt.init(this);		opt.state |= QStyle::State_AutoRaise;		if (isEnabled() && underMouse() && !isChecked() && !isDown())			opt.state |= QStyle::State_Raised;		if (isChecked())			opt.state |= QStyle::State_On;		if (isDown())			opt.state |= QStyle::State_Sunken;		QPainter p(this);		style()->drawPrimitive(QStyle::PE_IndicatorTabClose, &opt, &p, this);	}	else	{		QIcon::Mode mode = QIcon::Normal;		if (!isEnabled())			mode = QIcon::Disabled;		else if (underMouse())			mode = QIcon::Active;		QIcon::State state = QIcon::Off;		if (isChecked())			state = QIcon::On;		QPixmap pixmap = icon().pixmap(iconSize(),mode,state);		QRect pixmapRect = QRect(0, 0, pixmap.width(), pixmap.height());		pixmapRect.moveCenter(rect().center());		QPainter p(this);		p.drawPixmap(pixmapRect, pixmap);	}}
开发者ID:ChALkeR,项目名称:vacuum-im,代码行数:38,


示例17: keyPressEvent

void QTerrain::keyPressEvent(QKeyEvent* Event){	if(underMouse())	{		if(Event->key() == Qt::Key_Up)			m_ScrollVeritcal->setValue(m_ScrollVeritcal->value() - 30);		if(Event->key() == Qt::Key_Down)			m_ScrollVeritcal->setValue(m_ScrollVeritcal->value() + 30);		if(Event->key() == Qt::Key_Left)			m_ScrollHorizontal->setValue(m_ScrollHorizontal->value() - 30);			if(Event->key() == Qt::Key_Right)			m_ScrollHorizontal->setValue(m_ScrollHorizontal->value() + 30);	}}
开发者ID:Majchrzak,项目名称:Modern-Control,代码行数:14,


示例18: mouseMoveEvent

void VideoContainer::mouseMoveEvent( QMouseEvent* event ){	if ( underMouse() || m_oVideoWidget->underMouse() || m_oMediaControls->underMouse() )	{		if ( !m_oMediaControls->isVisible() )		{			m_oMediaControls->show();		}		m_tMediaControls->start( 5000 );	}	QWidget::mouseMoveEvent( event );}
开发者ID:rusingineer,项目名称:quazaa,代码行数:14,


示例19: p

void MoodLineEdit::paintEvent(QPaintEvent *e){    QPainter p( this );    QFontMetrics fm = p.fontMetrics();    if ( underMouse() )    {        p.save();        p.setPen( QPen( Qt::lightGray ));        p.drawRect( this->rect().adjusted( 1, 1, -1, -1 ) ) ;        p.restore();    }    p.drawText( this->rect().adjusted( 2, 1, -1, -1 ),                Qt::AlignVCenter,                fm.elidedText( lineEdit->text().isEmpty() ? strMood : lineEdit->text(),                               Qt::ElideRight, this->rect().width() ));}
开发者ID:MtDesert,项目名称:ChatClient,代码行数:16,


示例20: tabAt

void TabBarWidget::contextMenuEvent(QContextMenuEvent *event){	m_clickedTab = tabAt(event->pos());	hidePreview();	QMenu menu(this);	menu.addAction(ActionsManager::getAction(QLatin1String("NewTab"), this));	menu.addAction(ActionsManager::getAction(QLatin1String("NewTabPrivate"), this));	if (m_clickedTab >= 0)	{		const bool isPinned = getTabProperty(m_clickedTab, QLatin1String("isPinned"), false).toBool();		menu.addAction(tr("Clone Tab"), this, SLOT(cloneTab()))->setEnabled(getTabProperty(m_clickedTab, QLatin1String("canClone"), false).toBool());		menu.addAction((isPinned ? tr("Unpin Tab") : tr("Pin Tab")), this, SLOT(pinTab()));		menu.addSeparator();		menu.addAction(tr("Detach Tab"), this, SLOT(detachTab()))->setEnabled(count() > 1);		menu.addSeparator();		if (isPinned)		{			QAction *closeAction = menu.addAction(Utils::getIcon(QLatin1String("tab-close")), tr("Close Tab"));			ActionsManager::setupLocalAction(ActionsManager::getAction(QLatin1String("CloseTab"), this), closeAction, true);			closeAction->setEnabled(false);		}		else		{			menu.addAction(ActionsManager::getAction(QLatin1String("CloseTab"), this));		}		const int amount = (count() - getPinnedTabsAmount());		menu.addAction(Utils::getIcon(QLatin1String("tab-close-other")), tr("Close Other Tabs"), this, SLOT(closeOther()))->setEnabled(amount > 0 && !(amount == 1 && !isPinned));	}	menu.exec(event->globalPos());	m_clickedTab = -1;	if (underMouse())	{		m_previewTimer = startTimer(250);	}}
开发者ID:NYAMNYAM3,项目名称:otter,代码行数:47,


示例21: palette

void TrackActionButton::reloadContent( const QSize &sz ){    if ( sz.isNull() )        return;    int r,g,b;    palette().color(foregroundRole()).getRgb(&r,&g,&b);        m_icon.image[2] = m_icon.icon.pixmap( sz ).toImage();    QImage img = m_icon.image[2].convertToFormat(QImage::Format_ARGB32);    int n = img.width() * img.height();        const uchar *bits = img.bits();    QRgb *pixel = (QRgb*)(const_cast<uchar*>(bits));    // this creates a (slightly) translucent monochromactic version of the    // image using the foreground color    // the gray value is turned into the opacity#define ALPHA qAlpha(pixel[i])#define GRAY qGray(pixel[i])    if ( qMax( qMax(r,g), b ) > 128 ) // value > 50%, bright foreground        for (int i = 0; i < n; ++i)            pixel[i] = qRgba( r,g,b, ( ALPHA * ( (160*GRAY) / 255 ) ) / 255 );    else // inverse        for (int i = 0; i < n; ++i)            pixel[i] = qRgba( r,g,b, ( ALPHA * ( (160*(255-GRAY)) / 255 ) ) / 255 );    // premultiplied is much faster on painting / alphablending    m_icon.image[1] = img.convertToFormat(QImage::Format_ARGB32_Premultiplied);    // and a very translucent variant    for (int i = 0; i < n; ++i)        pixel[i] = qRgba(r,g,b, ALPHA/6);#undef ALPHA#undef GRAY    m_icon.image[0] = img.convertToFormat(QImage::Format_ARGB32_Premultiplied);    int i = 0;    if ( underMouse() )        i = 2;    else if ( !parentWidget() || parentWidget()->underMouse() )        i = 1;    setIcon( m_icon.image[i] );}
开发者ID:ErrAza,项目名称:amarok,代码行数:46,


示例22: eventFilter

bool KoPageNavigator::eventFilter(QObject *watched, QEvent *event){    if (event->type() == QEvent::FocusOut && watched == d->pageNumberEdit) {        if (! underMouse()) {            setCurrentIndex(Display);        }        // reset editor in any case        KoPADocument *const kopaDocument = d->view->kopaDocument();        KoPAPageBase *const activePage = d->view->activePage();        const int pageNumber = kopaDocument->pageIndex(activePage) + 1;        const QString text = (pageNumber > 0) ? QString::number(pageNumber) : QString();        d->pageNumberEdit->setText(text);    } else if (event->type() == QEvent::Wheel) {        // Scroll the pages by the wheel        // Because the numbers are representatives of the actual pages        // and the list of pages is ordered by smaller number first,        // here an increasing delta means going up in the list, so go to        // smaller page numbers, and vice versa.        QWheelEvent *wheelEvent = static_cast<QWheelEvent*>(event);        const int delta = wheelEvent->delta();        // trigger the respective actions        if (delta > 0) {            QAction *gotoPreviousPageAction = d->gotoPreviousPageButton->action();            if (gotoPreviousPageAction->isEnabled()) {                gotoPreviousPageAction->activate(QAction::Trigger);            }        } else if (delta < 0) {            QAction *gotoNextPageAction = d->gotoNextPageButton->action();            if (gotoNextPageAction->isEnabled()) {                gotoNextPageAction->activate(QAction::Trigger);            }        }        // scroll wheel events also cancel the editing,        // so move focus out of the pageNumberEdit        if (d->pageNumberEdit->hasFocus()) {            d->view->setFocus();        }    }    return false;}
开发者ID:NavyZhao1978,项目名称:QCalligra,代码行数:44,


示例23: Q_UNUSED

void PlainToolButton::paintEvent(QPaintEvent *e) {  Q_UNUSED(e)  QPainter p(this);  QRect rect(QPoint(0, 0), size());  // Set padding.  rect.adjust(m_padding, m_padding, -m_padding, -m_padding);  // Paint the icon.  if (!isEnabled()) {    p.setOpacity(0.4);  }  else if (underMouse() || hasFocus()) {    p.setOpacity(0.7);  }  icon().paint(&p, rect);}
开发者ID:007durgesh219,项目名称:BuildmLearn-Toolkit,代码行数:19,


示例24: Q_D

/*!    Initialize /a option with the values from this QRadioButton. This method is useful    for subclasses when they need a QStyleOptionButton, but don't want to fill    in all the information themselves.    /sa QStyleOption::initFrom()*/void QRadioButton::initStyleOption(QStyleOptionButton *option) const{    if (!option)        return;    Q_D(const QRadioButton);    option->initFrom(this);    option->text = d->text;    option->icon = d->icon;    option->iconSize = iconSize();    if (d->down)        option->state |= QStyle::State_Sunken;    option->state |= (d->checked) ? QStyle::State_On : QStyle::State_Off;    if (testAttribute(Qt::WA_Hover) && underMouse()) {        if (d->hovering)            option->state |= QStyle::State_MouseOver;        else            option->state &= ~QStyle::State_MouseOver;    }}
开发者ID:MarianMMX,项目名称:MarianMMX,代码行数:26,


示例25: p

void ExtendedButton::paintEvent(QPaintEvent* event){    if (!isVisible())        return;    QStylePainter p(this);    QStyleOptionButton option;    initStyleOption(&option);    if (option.features & QStyleOptionButton::Flat)    {        if (isChecked() || isDown())            p.setOpacity(m_pressedOpacity / 100.0);        else if (underMouse())            p.setOpacity(m_hoveredOpacity / 100.0);        else            p.setOpacity(m_normalOpacity / 100.0);        option.features = option.features & ~QStyleOptionButton::Flat;    }    p.drawControl(QStyle::CE_PushButtonBevel, option);    if (p.opacity() != 1.0)        p.setOpacity(1.0);    if (m_contentOrientation == Qt::Horizontal)    {        p.drawControl(QStyle::CE_PushButtonLabel, option);    }    else    {        long x = option.rect.left() + (option.rect.width() - option.iconSize.width()) / 2;        long y = option.rect.top() + (option.rect.height() - option.iconSize.height() -                                      m_contentInterval - option.fontMetrics.height()) / 2;        p.drawPixmap(x, y, option.iconSize.width(), option.iconSize.height(), option.icon.pixmap(option.iconSize));        y += option.iconSize.height() + m_contentInterval;        p.drawText(QRect(option.rect.left(), y, option.rect.width(), option.fontMetrics.height()), Qt::AlignHCenter | Qt::AlignTop, option.text);    }}
开发者ID:KevinMiller4k,项目名称:four-k-download,代码行数:43,


示例26: Q_UNUSED

void SeExprEdSlider::paintEvent(QPaintEvent* e){    Q_UNUSED(e);    QPainter p(this);        float v = value();    float r = maximum()-minimum();    int linepos = (int)((v-minimum())/r*(width()-5)+2);        QColor qcol = palette().color(QPalette::Dark);    QColor bcol = palette().color(QPalette::Midlight);    QColor dcol = bcol.lighter(140);    QColor bgcol = palette().color(QPalette::Base);        if (underMouse())    {        bcol = bcol.lighter(110);        bgcol = bgcol.lighter(110);        int mx = mapFromGlobal(QCursor::pos()).x();        if (abs(linepos-mx)<4) dcol = dcol.lighter(200);    }        p.fillRect(1,1,width()-1,height()-2,bgcol);    p.fillRect(1,1,linepos-1,height()-2,bcol);        QPen pen = p.pen();        pen.setColor(dcol);    p.setPen(pen);    pen.setWidth(3);    p.setPen(pen);    p.drawLine(linepos,2,linepos,height()-2);    pen.setWidth(1);    pen.setColor(qcol);    p.setPen(pen);    p.drawLine(linepos-2,1,linepos-2,height()-1);    p.drawLine(linepos+2,1,linepos+2,height()-1);        pen.setWidth(1);    pen.setColor(qcol);    p.setPen(pen);    p.drawRect(0,0,width()-1,height()-1);}
开发者ID:Vertexwahn,项目名称:appleseed-deps,代码行数:43,


示例27: Q_D

void Q3TitleBar::paintEvent(QPaintEvent *){    Q_D(Q3TitleBar);    QStyleOptionTitleBar opt = d->getStyleOption();    opt.subControls = QStyle::SC_TitleBarLabel;    opt.activeSubControls = d->buttonDown;    if (d->flags & Qt::WindowSystemMenuHint) {        opt.subControls |= QStyle::SC_TitleBarSysMenu | QStyle::SC_TitleBarCloseButton;        if (d->window && (d->flags & Qt::WindowShadeButtonHint)) {            if (d->window->isMinimized())                opt.subControls |= QStyle::SC_TitleBarUnshadeButton;            else                opt.subControls |= QStyle::SC_TitleBarShadeButton;        }        if (d->window && (d->flags & Qt::WindowMinMaxButtonsHint)) {            if(d->window && d->window->isMinimized())                opt.subControls |= QStyle::SC_TitleBarNormalButton;            else                opt.subControls |= QStyle::SC_TitleBarMinButton;        }        if (d->window && (d->flags & Qt::WindowMaximizeButtonHint) && !d->window->isMaximized())            opt.subControls |= QStyle::SC_TitleBarMaxButton;    }    QStyle::SubControl under_mouse = QStyle::SC_None;        if (underMouse()) {        under_mouse = style()->hitTestComplexControl(QStyle::CC_TitleBar, &opt,                                                     mapFromGlobal(QCursor::pos()), this);        opt.activeSubControls |= under_mouse;        if (d->pressed)            opt.state |= QStyle::State_Sunken;        else if(autoRaise())            opt.state |= QStyle::State_MouseOver;    }        opt.palette.setCurrentColorGroup(usesActiveColor() ? QPalette::Active : QPalette::Inactive);    QPainter p(this);    if (!windowTitle().isEmpty())        opt.titleBarFlags |= Qt::WindowTitleHint;    style()->drawComplexControl(QStyle::CC_TitleBar, &opt, &p, this);}
开发者ID:husninazer,项目名称:qt,代码行数:42,


示例28: painter

void StatusArrowButton::paintEvent(QPaintEvent *event){	QStylePainter painter(this);	if(underMouse()) {		QStyleOptionButton opt;		opt.initFrom(this);		if(isDown()) {			opt.state |= QStyle::State_Sunken;		}		painter.drawControl(QStyle::CE_PushButton, opt);	}	QStyleOptionComboBox opt;	opt.initFrom(this);	opt.rect = QRect(width() - 15, height() / 2 - 6, 11, 13);	painter.drawPrimitive(QStyle::PE_IndicatorArrowDown, opt);}
开发者ID:KittyIM,项目名称:Client,代码行数:20,


示例29: painter

voidGcScopeButton::paintEvent(QPaintEvent *){    QPainter painter(this);    painter.save();    painter.setRenderHints(QPainter::Antialiasing|QPainter::TextAntialiasing, true);    // widget rectangle    QRectF body(0,0,width(), height());    QRectF off(0,1,width(), height());    QRectF inside(0,2,width(), height()-4);    QPainterPath clip;    clip.addRect(inside);    painter.setClipPath(clip);    painter.setPen(Qt::NoPen);    if (checked && underMouse()) {        painter.setBrush(QBrush(QColor(150,150,150)));             painter.drawRoundedRect(body, 19, 11);        if (highlighted) {            QColor over = GColor(CCALCURRENT);            over.setAlpha(180);            painter.setBrush(over);            painter.drawRoundedRect(body, 19, 11);        }    } else if (checked && !underMouse()) {        painter.setBrush(QBrush(QColor(120,120,120)));             painter.drawRoundedRect(body, 19, 11);        if (highlighted) {            QColor over = GColor(CCALCURRENT);            over.setAlpha(180);            painter.setBrush(over);            painter.drawRoundedRect(body, 19, 11);        }    } else if (!checked && underMouse()) {        painter.setBrush(QBrush(QColor(180,180,180)));             painter.drawRoundedRect(body, 19, 11);    } else if (!checked && !underMouse()) {    }    // now paint the text    painter.setPen((underMouse() || checked) ? QColor(50,50,50) : Qt::white);    painter.drawText(off, text, Qt::AlignVCenter | Qt::AlignCenter);    painter.setPen((underMouse() || checked) ? QColor(240,240,240) : QColor(30,30,30,200));    painter.drawText(body, text, Qt::AlignVCenter | Qt::AlignCenter);    painter.restore();}
开发者ID:bbrond,项目名称:GoldenCheetah,代码行数:48,



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


C++ undo函数代码示例
C++ undefinedp函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。