Example #1
0
void FStateButton::changeState()
{
    state = qAbs(1 - state);
    if(state == 0){
        if(bflag == 0){
            setIcon(QIcon(fStateIcon));
            setMask(QBitmap(fStateIcon).mask());
        }
        else if(bflag == 1)
        {
            setText(fStateIcon);
        }

    }
    else if(state == 1)
    {
        if(bflag == 0){
            setIcon(QIcon(bStateIcon));
            setMask(QBitmap(bStateIcon).mask());
        }
        else if(bflag == 1)
        {
            setText(bStateIcon);
        }
    }
    emit stateChanged();
}
Example #2
0
void MainWindow::loadCursors()
{
   cursorList << Qt::ArrowCursor;
   
   QPixmap cursorCrossPic;
   cursorCrossPic.load((cursorDir+QString("cursorCross.bmp")), "BMP", Qt::MonoOnly);
   cursorCrossPic.setMask(QBitmap(cursorCrossPic));
   QCursor cursorCross(cursorCrossPic, 15,15);
   cursorList << cursorCross;

   QPixmap cursorDownPic;
   cursorDownPic.load((cursorDir+QString("cursorDown.bmp")), "BMP", Qt::MonoOnly);
   cursorDownPic.setMask(QBitmap(cursorDownPic));
   QCursor cursorDown(cursorDownPic, 15,31);
   cursorList << cursorDown;

   QPixmap cursorLeftPic;
   cursorLeftPic.load((cursorDir+QString("cursorLeft.bmp")), "BMP", Qt::MonoOnly);
   cursorLeftPic.setMask(QBitmap(cursorLeftPic));
   QCursor cursorLeft(cursorLeftPic, 0,15);
   cursorList << cursorLeft;

   QPixmap cursorRightPic;
   cursorRightPic.load((cursorDir+QString("cursorRight.bmp")), "BMP", Qt::MonoOnly);
   cursorRightPic.setMask(QBitmap(cursorRightPic));
   QCursor cursorRight(cursorRightPic, 31,15);
   cursorList << cursorRight;
   
   cursorList+=cursorList;
   roundNum = 1;
}
Example #3
0
/*!
  What do you think it does?
 */
void QHeader::init( int n )
{
    if ( !hSplitCur )
	hSplitCur = new QCursor( QBitmap( hsplit_width, hsplit_height, hsplit_bits, TRUE),
				 QBitmap( hsplit_width, hsplit_height, hsplitm_bits, TRUE)
				 );
    if ( !vSplitCur )
	vSplitCur = new QCursor( QBitmap( vsplit_width, vsplit_height, vsplit_bits, TRUE),
				 QBitmap( vsplit_width, vsplit_height, vsplitm_bits, TRUE)
				 );
    state = Idle;

    data = new QHeaderData;


    data->sizes.resize(n+1);
    data->labels.resize(n+1);
    data->a2l.resize(n+1);
    data->l2a.resize(n+1);
    data->clicks.resize(n+1);
    data->resize.resize(n+1);
    for ( int i = 0; i < n ; i ++ ) {
	data->labels[i] = 0;
	data->sizes[i] = 88;
	data->a2l[i] = i;
	data->l2a[i] = i;
    }
    data->clicks.fill( TRUE );
    data->resize.fill( TRUE );
    data->move = TRUE;

    setFrameStyle( QFrame::NoFrame );

    if ( orient == Horizontal ) {
	setCellWidth( 0 );
	setCellHeight( height() );
	setNumCols( n );
	setNumRows( 1 );
    } else {
	setCellWidth( width() );
	setCellHeight( 0 );
	setNumCols( 1 );
	setNumRows( n );
    }
    handleIdx = 0;
    //################
    data->labels[n] = 0;
    data->sizes[n] = 0;
    data->a2l[n] = 0;
    data->l2a[n] = 0;
    //#############
    setMouseTracking( TRUE );
    trackingIsOn = FALSE;
}
void
QDBase::createCursors(void)
{
   DEBUG_MSG("QDBase::createCursors(): loading cursors...\n");
   DEBUG_MAKE_INDENT(3);
#ifdef UNIX
   QSize wait_size(wait_width, wait_height);
   cur_wait=new QCursor(QBitmap(wait_size, (u_char *) wait_bits, TRUE),
		    QBitmap(wait_size, (u_char *) wait_mask_bits, TRUE),
		    wait_x, wait_y);

   QSize hand1_size(hand1_width, hand1_height);
   cur_hand1=new QCursor(QBitmap(hand1_size, (u_char *) hand1_bits, TRUE),
		     QBitmap(hand1_size, (u_char *) hand1_mask_bits, TRUE),
		     hand1_x, hand1_y);

   QSize hand2_size(hand2_width, hand2_height);
   cur_hand2=new QCursor(QBitmap(hand2_size, (u_char *) hand2_bits, TRUE),
		     QBitmap(hand2_size, (u_char *) hand2_mask_bits, TRUE),
		     hand2_x, hand2_y);

   QSize zoom_select_size(zoom_select_width, zoom_select_height);
   cur_zoom_select=new QCursor(QBitmap(zoom_select_size, 
                                       (u_char *) zoom_select_bits, TRUE),
                               QBitmap(zoom_select_size, 
                                       (u_char *) zoom_select_mask_bits, TRUE),
		     zoom_select_x, zoom_select_y);

   cur_hand_hl=new QCursor(ArrowCursor);	// TODO: get X11 cursor instead
   cur_ptr=new QCursor(ArrowCursor);
   cur_blank=new QCursor(BlankCursor);
#endif
}
Example #5
0
void TimeTooltip::buildPath()
{
    // Prepare the painter path for future use so
    // we only have to generate the text at runtime.

    // Draw the text box
    mPainterPath = QPainterPath();
    mPainterPath.addRect( mBox );

    // Draw the tip
    QPolygon polygon;
    polygon << QPoint( qMax( 0, mTipX - 3 ), mBox.height() )
            << QPoint( mTipX, mBox.height() + TIP_HEIGHT )
            << QPoint( qMin( mTipX + 3, mBox.width() ), mBox.height() );
    mPainterPath.addPolygon( polygon );

    // Store the simplified version of the path
    mPainterPath = mPainterPath.simplified();

    // Create the mask used to erase the background
    // Note: this is a binary bitmap (black & white)
    mMask = QBitmap( size() );
    QPainter painter( &mMask );
    painter.fillRect( mMask.rect(), Qt::white );
    painter.setPen( Qt::black );
    painter.setBrush( Qt::black );
    painter.drawPath( mPainterPath );
    painter.end();
}
Example #6
0
/*!
    Returns a copy of the given \a image converted to a bitmap using
    the specified image conversion \a flags.

    \sa fromData()
*/
QBitmap QBitmap::fromImage(const QImage &image, Qt::ImageConversionFlags flags)
{
    if (image.isNull())
        return QBitmap();

    QImage img = image.convertToFormat(QImage::Format_MonoLSB, flags);

    // make sure image.color(0) == Qt::color0 (white)
    // and image.color(1) == Qt::color1 (black)
    const QRgb c0 = QColor(Qt::black).rgb();
    const QRgb c1 = QColor(Qt::white).rgb();
    if (img.color(0) == c0 && img.color(1) == c1) {
        img.invertPixels();
        img.setColor(0, c1);
        img.setColor(1, c0);
    }

    QPixmapData *d;
//     QGraphicsSystem* gs = QApplicationPrivate::graphicsSystem();
//     if (gs)
//         d = gs->createPixmapData(QPixmapData::BitmapType);
//     else
//         d = QGraphicsSystem::createDefaultPixmapData(QPixmapData::BitmapType);
// 
//     d->fromImage(img, flags | Qt::MonoOnly);
    return QPixmap(d);
}
Example #7
0
void wxBitmap::SetDepth(int depth)
{
    if (depth == 1)
        M_PIXDATA = QBitmap(GetWidth(), GetHeight());
    else
        M_PIXDATA = QPixmap(GetWidth(), GetHeight());
}
Example #8
0
HCURSOR QWindowsCursor::createPixmapCursor(const QPixmap &pixmap, int hotX, int hotY)
{
    HCURSOR cur = 0;
    QBitmap mask = pixmap.mask();
    if (mask.isNull()) {
        mask = QBitmap(pixmap.size());
        mask.fill(Qt::color1);
    }

    HBITMAP ic = qt_pixmapToWinHBITMAP(pixmap, /* HBitmapAlpha */ 2);
    const HBITMAP im = qt_createIconMask(mask);

    ICONINFO ii;
    ii.fIcon     = 0;
    ii.xHotspot  = hotX;
    ii.yHotspot  = hotY;
    ii.hbmMask   = im;
    ii.hbmColor  = ic;

    cur = CreateIconIndirect(&ii);

    DeleteObject(ic);
    DeleteObject(im);
    return cur;
}
Example #9
0
Splash::Splash(const QString& imagePath)
    : QWidget(0, Qt::SplashScreen | Qt::X11BypassWindowManagerHint)
{
    cachedPixmap = QPixmap(imagePath);
    if (!cachedPixmap.mask().isNull())
    {
        QBitmap mask(cachedPixmap.size());
        mask.fill(Qt::color0);
        QBitmap pixMask = cachedPixmap.mask();
        QPainter p(&mask);
        p.drawPixmap((mask.width() - pixMask.width())/2, (mask.height() - pixMask.height())/2,
                     pixMask);
        setMask(mask);
    }
    else
        setMask(QBitmap());

    QWidget *d = QApplication::desktop()->screen();
    move( (d->width() - cachedPixmap.width ()) / 2,
          (d->height() - cachedPixmap.height()) / 2 );
    resize( cachedPixmap.size() );
    setFocusPolicy( Qt::NoFocus );

    show();
    update();

    QTimer::singleShot( SPLASH_DURATION, this, SLOT(hide()) );
}
Example #10
0
// the what's this manager class
QWhatsThisPrivate::QWhatsThisPrivate()
    : QObject( 0, "global what's this object" )
{
    qAddPostRoutine( tearDownWhatsThis );
    whatsThat = 0;
    dict = new QPtrDict<QWhatsThisPrivate::Item>;
    tlw = new QPtrDict<QWidget>;
    wt = this;
    buttons = new QPtrDict<Button>;
    state = Inactive;
    cursor = new QCursor( QBitmap( cursor_bits_width, cursor_bits_height,
				   cursor_bits_bits, TRUE ),
			  QBitmap( cursor_mask_width, cursor_mask_height,
				   cursor_mask_bits, TRUE ),
			  1, 1 );
}
Example #11
0
//---------------------------------------------init
void ModuleWidget::init()
{
  m_pUi = new Ui::ModuleWidgetUI();
  m_pUi->setupUi(this);
  m_pUi->m_pModuleName->setText(QString(m_pModule->getRuntimeModuleID().c_str()));

  setAcceptDrops(true);

  m_aTimer.start(TIMER_UNIT); //interval the timer is invoked

  connectModuleSignals(); //call virtual method

  //QObject::connect(m_pUi->m_pRunButton, SIGNAL(pressed()), this, SLOT(onRunButton()));
  //QObject::connect(m_pUi->m_pResetButton, SIGNAL(pressed()), this, SLOT(onResetButton()));
  QObject::connect(&m_aTimer, SIGNAL(timeout()), this, SLOT(onTimer()));

  initInputs();
  initOutputs();

  setContextMenuPolicy(Qt::CustomContextMenu);

  static QBitmap aMask;
  if(aMask.width() == 0) //create the mask only once
  {
    aMask = QBitmap(size());
    aMask.clear();
    QPainter aPainter(&aMask);
    aPainter.setBrush(QBrush(Qt::SolidPattern));
    aPainter.drawEllipse(QPoint(width()/2, height()/2), width()/2, width()/2);
  }
  setMask(aMask);
}
Example #12
0
void wxQtDCImpl::SetBrush(const wxBrush& brush)
{
    m_brush = brush;
    
    if (brush.GetStyle() == wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE)
    {
        // Use a monochrome mask: use foreground color for the mask
        QBrush b(brush.GetHandle());
        b.setColor(m_textForegroundColour.GetHandle());
        b.setTexture(b.texture().mask());
        m_qtPainter->setBrush(b);
    }
    else if (brush.GetStyle() == wxBRUSHSTYLE_STIPPLE)
    {
        //Don't use the mask
        QBrush b(brush.GetHandle());

        QPixmap p = b.texture();
        p.setMask(QBitmap());
        b.setTexture(p);

        m_qtPainter->setBrush(b);
    }
    else
    {
        m_qtPainter->setBrush(brush.GetHandle());
    }

    ApplyRasterColourOp();
}
Example #13
0
/*!
  Handle a mouse release event for the observed widget.

  \param mouseEvent Mouse event
  \sa eventFilter(), widgetMousePressEvent(),
      widgetMouseMoveEvent(),
*/
void QwtPanner::widgetMouseReleaseEvent( QMouseEvent *mouseEvent )
{
    if ( isVisible() )
    {
        hide();
#ifndef QT_NO_CURSOR
        showCursor( false );
#endif

        QPoint pos = mouseEvent->pos();
        if ( !isOrientationEnabled( Qt::Horizontal ) )
            pos.setX( d_data->initialPos.x() );
        if ( !isOrientationEnabled( Qt::Vertical ) )
            pos.setY( d_data->initialPos.y() );

        d_data->pixmap = QPixmap();
        d_data->contentsMask = QBitmap();
        d_data->pos = pos;

        if ( d_data->pos != d_data->initialPos )
        {
            Q_EMIT panned( d_data->pos.x() - d_data->initialPos.x(),
                d_data->pos.y() - d_data->initialPos.y() );
        }
    }
}
Example #14
0
/*!
    Reimplement this function to draw the \a pixmap in the given \a
    rect, starting at the given \a p. The pixmap will be
    drawn repeatedly until the \a rect is filled.
*/
void QPaintEngine::drawTiledPixmap(const QRectF &rect, const QPixmap &pixmap, const QPointF &p)
{
    int sw = pixmap.width();
    int sh = pixmap.height();

    if (sw*sh < 8192 && sw*sh < 16*rect.width()*rect.height()) {
        int tw = sw, th = sh;
        while (tw*th < 32678 && tw < rect.width()/2)
            tw *= 2;
        while (tw*th < 32678 && th < rect.height()/2)
            th *= 2;
        QPixmap tile;
        if (pixmap.depth() == 1) {
            tile = QBitmap(tw, th);
        } else {
            tile = QPixmap(tw, th);
            if (pixmap.hasAlphaChannel())
                tile.fill(Qt::transparent);
        }
        qt_fill_tile(&tile, pixmap);
        qt_draw_tile(this, rect.x(), rect.y(), rect.width(), rect.height(), tile, p.x(), p.y());
    } else {
        qt_draw_tile(this, rect.x(), rect.y(), rect.width(), rect.height(), pixmap, p.x(), p.y());
    }
}
Example #15
0
RongHe::RongHe(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::RongHe)
{
    ui->setupUi(this);
    //脡猫脰脙脭虏陆脟麓掳脤氓
    setWindowFlags(Qt::FramelessWindowHint);
    QPixmap mask(":/Images/images/ui_fix_min3.png");//录脫脭脴脩脷脗毛脥录脧帽
    setMask(QBitmap(mask.mask())); //脡猫脰脙麓掳脤氓碌脛脩脷脗毛脥录脧帽,驴脵鲁媒脥录脧帽碌脛掳脳脡芦脟酶脫貌脢碌脧脰虏禄鹿忙脭貌麓掳脤氓
    QPalette p;//脡猫脰脙碌梅脡芦掳氓
    p.setBrush(QPalette::Window, QBrush(mask));//陆芦碌梅脡芦掳氓碌脛禄颅脣垄脡猫脰脙脦陋脩脷脗毛脦禄脥录,脭脷虏禄鹿忙脭貌麓掳脤氓脡脧脧脭脢戮鲁枚脩脷脗毛脦禄脥录
    setPalette(p);
    //QPainter painter(this);
    //painter.drawPixmap(0,0,width(),height(),QPixmap(":/Images/images/ui_fix.png"));

    ui->pushButton->setStyleSheet("QPushButton{border-image: url(:/Images/images/pb_fix_work_normal.png);}"
                                   "QPushButton:hover{border-image: url(:/Images/images/pb_fix_work_hover.png);}"
                                     "QPushButton:pressed{border-image: url(:/Images/images/pb_fix_work_press.png);}");
    ui->pushButton_5->setStyleSheet("QPushButton{border-image: url(:/Images/images/pb_windwork_normal.png);}"
                                   "QPushButton:hover{border-image: url(:/Images/images/pb_windwork_hover.png);}"
                                     "QPushButton:pressed{border-image: url(:/Images/images/pb_windwork_press.png);}");
//    ui->pushButton_8->setStyleSheet("QPushButton{border-image: url(:/Images/images/pb_wavework_normal.png);}"
//                                   "QPushButton:hover{border-image: url(:/Images/images/pb_wavework_hover.png);}"
//                                     "QPushButton:pressed{border-image: url(:/Images/images/pb_wavework_press.png);}");
    //显示结果样式

    ui->pushButton_8->setStyleSheet("QPushButton{border-image: url(:/Images/images/pb_datatrans_normal.png);}"
                                   "QPushButton:hover{border-image: url(:/Images/images/pb_datatrans_hover.png);}"
                                     "QPushButton:pressed{border-image: url(:/Images/images/pb_datatrans_press.png);}");
    ui->pushButton_9->setStyleSheet("QPushButton{border-image: url(:/Images/images/pb_fix_result_normal.png);}"
                                   "QPushButton:hover{border-image: url(:/Images/images/pb_fix_result_hover.png);}"
                                     "QPushButton:pressed{border-image: url(:/Images/images/pb_fix_result_press.png);}");
    ui->pushButton_10->setStyleSheet("QPushButton{border-image: url(:/Images/images/pb_datamix_normal.png);}"
                                   "QPushButton:hover{border-image: url(:/Images/images/pb_datamix_hover.png);}"
                                     "QPushButton:pressed{border-image: url(:/Images/images/pb_datamix_press.png);}");
    ui->pushButton_6->setStyleSheet("QPushButton{border-image: url(:/Images/images/pb_mainui_return_normal2.png);}"
                                   "QPushButton:hover{border-image: url(:/Images/images/pb_mainui_return_hover2.png);}"
                                     "QPushButton:pressed{border-image: url(:/Images/images/pb_mainui_return_press2.png);}");
    /*source button
    ui->pushButton_bf->setStyleSheet("QPushButton{border-image: url(:/Images/images/pb_play_normal.png);}"
                                   "QPushButton:hover{border-image: url(:/Images/images/pb_play_hover.png);}"
                                     "QPushButton:pressed{border-image: url(:/Images/images/pb_play_press.png);}");
    ui->pushButton_zt->setStyleSheet("QPushButton{border-image: url(:/Images/images/pb_pause_normal.png);}"
                                   "QPushButton:hover{border-image: url(:/Images/images/pb_pause_hover.png);}"
                                     "QPushButton:pressed{border-image: url(:/Images/images/pb_pause_press.png);}");
    ui->pushButton_jias->setStyleSheet("QPushButton{border-image: url(:/Images/images/pb_foreward_normal.png);}"
                                   "QPushButton:hover{border-image: url(:/Images/images/pb_foreward_hover.png);}"
                                     "QPushButton:pressed{border-image: url(:/Images/images/pb_foreward_press.png);}");
    ui->pushButton_jians->setStyleSheet("QPushButton{border-image: url(:/Images/images/pb_back_normal.png);}"
                                   "QPushButton:hover{border-image: url(:/Images/images/pb_back_hover.png);}"
                                     "QPushButton:pressed{border-image: url(:/Images/images/pb_back_press.png);}");
    */

	timer = new QTimer;
    speed = 500;
    label = NULL;
    iterator = NULL;
    connect(timer,SIGNAL(timeout()),this,SLOT(nextPicture()));
}
Example #16
0
VertexWidget::VertexWidget(QWidget *shapeWidget, QWidget *parent)
    : QLabel(parent)
    , m_widget(shapeWidget)
    , m_pressed(false)
{
    QPixmap p(vertexPng);
    setPixmap(p);
    setMask(QBitmap(p));
}
void BackgroundWidget::paintEvent( QPaintEvent *e )
{
    if ( !b_withart )
    {
        /* we just want background autofill */
        QWidget::paintEvent( e );
        return;
    }

    int i_maxwidth, i_maxheight;
    QPixmap pixmap = QPixmap( pixmapUrl );
    QPainter painter(this);
    QBitmap pMask;
    float f_alpha = 1.0;

    i_maxwidth  = __MIN( maximumWidth(), width() ) - MARGIN * 2;
    i_maxheight = __MIN( maximumHeight(), height() ) - MARGIN * 2;

    painter.setOpacity( property( "opacity" ).toFloat() );

    if ( height() > MARGIN * 2 )
    {
        /* Scale down the pixmap if the widget is too small */
        if( pixmap.width() > i_maxwidth || pixmap.height() > i_maxheight )
        {
            pixmap = pixmap.scaled( i_maxwidth, i_maxheight,
                            Qt::KeepAspectRatio, Qt::SmoothTransformation );
        }
        else
        if ( b_expandPixmap &&
             pixmap.width() < width() && pixmap.height() < height() )
        {
            /* Scale up the pixmap to fill widget's size */
            f_alpha = ( (float) pixmap.height() / (float) height() );
            pixmap = pixmap.scaled(
                    width() - MARGIN * 2,
                    height() - MARGIN * 2,
                    Qt::KeepAspectRatio,
                    ( f_alpha < .2 )? /* Don't waste cpu when not visible */
                        Qt::SmoothTransformation:
                        Qt::FastTransformation
                    );
            /* Non agressive alpha compositing when sizing up */
            pMask = QBitmap( pixmap.width(), pixmap.height() );
            pMask.fill( QColor::fromRgbF( 1.0, 1.0, 1.0, f_alpha ) );
            pixmap.setMask( pMask );
        }

        painter.drawPixmap(
                MARGIN + ( i_maxwidth - pixmap.width() ) /2,
                MARGIN + ( i_maxheight - pixmap.height() ) /2,
                pixmap);
    }
    QWidget::paintEvent( e );
}
Example #18
0
void LaptopButton::setBitmap(const unsigned char *bitmap)
{
    if (bitmap)
        deco = QBitmap::fromData( QSize(8,  8),  bitmap);
    else {
        deco = QBitmap(8,8);
        deco.fill(Qt::color0);
    }
    deco.setMask(deco);
    repaint();
}
Example #19
0
Forecast::Forecast(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Forecast)
{
    ui->setupUi(this);

    //ÉèÖô°Ìå
    setWindowFlags(Qt::FramelessWindowHint);
    QPixmap mask(":/Images/images/ui_pre_min2.png");
    setMask(QBitmap(mask.mask()));
    QPalette p;
    p.setBrush(QPalette::Window, QBrush(mask));
    setPalette(p);
    ui->pushButton->setStyleSheet("QPushButton{border-image: url(:/Images/images/pb_pre_3dstream_normal.png);}"
                                  "QPushButton:hover{border-image: url(:/Images/images/pb_pre_3dstream_hover.png);}"
                                  "QPushButton:pressed{border-image: url(:/Images/images/pb_pre_3dstream_press.png);}");
    ui->pushButton_6->setStyleSheet("QPushButton{border-image: url(:/Images/images/pb_mainui_return_normal2.png);}"
                                    "QPushButton:hover{border-image: url(:/Images/images/pb_mainui_return_hover2.png);}"
                                    "QPushButton:pressed{border-image: url(:/Images/images/pb_mainui_return_press2.png);}");
    ui->pushButton_hyf->setStyleSheet("QPushButton{border-image: url(:/Images/images/pb_pre_workocean_normal.png);}"
                                      "QPushButton:hover{border-image: url(:/Images/images/pb_pre_workocean_hover.png);}"
                                      "QPushButton:pressed{border-image: url(:/Images/images/pb_pre_workocean_press.png);}");
    ui->pushButton_xw->setStyleSheet("QPushButton{border-image: url(:/Images/images/pb_pre_workoral_normal.png);}"
                                     "QPushButton:hover{border-image: url(:/Images/images/pb_pre_workoral_hover.png);}"
                                     "QPushButton:pressed{border-image: url(:/Images/images/pb_pre_workoral_press.png);}");
    ui->pushButton_yc->setStyleSheet("QPushButton{border-image: url(:/Images/images/pb_pre_uplayer_normal.png);}"
                                     "QPushButton:hover{border-image: url(:/Images/images/pb_pre_uplayer_hover.png);}"
                                     "QPushButton:pressed{border-image: url(:/Images/images/pb_pre_uplayer_press.png);}");
    ui->pushButton_2->setStyleSheet("QPushButton{border-image: url(:/Images/images/pb_fix_result_normal2.png);}"
                                    "QPushButton:hover{border-image: url(:/Images/images/pb_fix_result_hover2.png);}"
                                    "QPushButton:pressed{border-image: url(:/Images/images/pb_fix_result_press2.png);}");
//    ui->pushButton_bf->setStyleSheet("QPushButton{border-image: url(:/Images/images/pb_play_normal.png);}"
//                                   "QPushButton:hover{border-image: url(:/Images/images/pb_play_hover.png);}"
//                                     "QPushButton:pressed{border-image: url(:/Images/images/pb_play_press.png);}");
//    ui->pushButton_zt->setStyleSheet("QPushButton{border-image: url(:/Images/images/pb_pause_normal.png);}"
//                                   "QPushButton:hover{border-image: url(:/Images/images/pb_pause_hover.png);}"
//                                     "QPushButton:pressed{border-image: url(:/Images/images/pb_pause_press.png);}");
//    ui->pushButton_jias->setStyleSheet("QPushButton{border-image: url(:/Images/images/pb_foreward_normal.png);}"
//                                   "QPushButton:hover{border-image: url(:/Images/images/pb_foreward_hover.png);}"
//                                     "QPushButton:pressed{border-image: url(:/Images/images/pb_foreward_press.png);}");
//    ui->pushButton_jians->setStyleSheet("QPushButton{border-image: url(:/Images/images/pb_back_normal.png);}"
//                                   "QPushButton:hover{border-image: url(:/Images/images/pb_back_hover.png);}"
//                                     "QPushButton:pressed{border-image: url(:/Images/images/pb_back_press.png);}");

    timer = new QTimer;
    speed = 500;
    label = NULL;
    iterator = NULL;
    connect(timer,SIGNAL(timeout()),this,SLOT(nextPicture()));

    select_window=NULL;
}
Example #20
0
static QPixmap scalePixmap( const QPixmap& pm, int w, int h )
{
#if QT_VERSION >= 0x030200
	QPixmap result( 20, 20, pm.depth() );
	result.setMask( QBitmap( 20, 20, true ) );
	QPixmap scaled( pm.convertToImage().smoothScale( w, h ) );
	copyBlt( &result, (20 - w) / 2, (20 - h) / 2, &scaled, 0, 0, w, h );
	return result;
#else
	Q_UNUSED(w);
	Q_UNUSED(h);
	return pm;
#endif
}
Example #21
0
void wxCursor::InitFromStock( wxStockCursor cursorId )
{
    Qt::CursorShape qt_cur;
    switch (cursorId)
    {
    case wxCURSOR_BLANK:
    {
        m_qtCursor = QBitmap();
        return;
    }
//    case wxCURSOR_ARROW: 
    case wxCURSOR_DEFAULT:     qt_cur = Qt::ArrowCursor;    break;
//    case wxCURSOR_RIGHT_ARROW:
    case wxCURSOR_HAND:        qt_cur = Qt::OpenHandCursor; break;
    case wxCURSOR_CROSS:       qt_cur = Qt::CrossCursor;    break;
    case wxCURSOR_SIZEWE:      qt_cur = Qt::SizeHorCursor;  break;
    case wxCURSOR_SIZENS:      qt_cur = Qt::SizeVerCursor;  break;
    case wxCURSOR_ARROWWAIT:   qt_cur = Qt::BusyCursor;     break;
    case wxCURSOR_WATCH:
    case wxCURSOR_WAIT:        qt_cur = Qt::WaitCursor;     break;
    case wxCURSOR_SIZING:      qt_cur = Qt::SizeAllCursor;  break;
//    case wxCURSOR_SPRAYCAN:
    case wxCURSOR_IBEAM:       qt_cur = Qt::IBeamCursor;    break;
//    case wxCURSOR_PENCIL:
    case wxCURSOR_NO_ENTRY:    qt_cur = Qt::ForbiddenCursor; break;
    case wxCURSOR_SIZENWSE:    qt_cur = Qt::SizeFDiagCursor; break;
    case wxCURSOR_SIZENESW:    qt_cur = Qt::SizeBDiagCursor; break;
    case wxCURSOR_QUESTION_ARROW: qt_cur = Qt::WhatsThisCursor; break;
/*  case wxCURSOR_PAINT_BRUSH:
    case wxCURSOR_MAGNIFIER:
    case wxCURSOR_CHAR:
    case wxCURSOR_LEFT_BUTTON: 
    case wxCURSOR_MIDDLE_BUTTON:
    case wxCURSOR_RIGHT_BUTTON:
    case wxCURSOR_BULLSEYE:
    case wxCURSOR_POINT_LEFT:
    case wxCURSOR_POINT_RIGHT:
    case wxCURSOR_DOUBLE_ARROW:
    case wxCURSOR_CROSS_REVERSE:
    case wxCURSOR_BASED_ARROW_DOWN:
    case wxCURSOR_BASED_ARROW_UP:   qt_cur = Qt::UpArrowCursor; break;
*/
    default:
        wxFAIL_MSG(wxT("unsupported cursor type"));
        // will use the standard one
        break;
    }

    m_qtCursor.setShape(qt_cur);
}
/*!
   Calculate a mask, that can be used to clip away the border frame

   \param size Size including the frame
*/
QBitmap QwtPlotCanvas::borderMask( const QSize &size ) const
{
    const QRect r( 0, 0, size.width(), size.height() );

    const QPainterPath path = borderPath( r );
    if ( path.isEmpty() )
        return QBitmap();

    QImage image( size, QImage::Format_ARGB32_Premultiplied );
    image.fill( Qt::color0 );

    QPainter painter( &image );
    painter.setClipPath( path );
    painter.fillRect( r, Qt::color1 );

    // now erase the frame

    painter.setCompositionMode( QPainter::CompositionMode_DestinationOut );

    if ( testAttribute(Qt::WA_StyledBackground ) )
    {
        QStyleOptionFrame opt;
        opt.initFrom(this);
        opt.rect = r;
        style()->drawPrimitive( QStyle::PE_Frame, &opt, &painter, this );
    }
    else
    {
        if ( d_data->borderRadius > 0 && frameWidth() > 0 )
        {
            painter.setPen( QPen( Qt::color1, frameWidth() ) );
            painter.setBrush( Qt::NoBrush );
            painter.setRenderHint( QPainter::Antialiasing, true );

            painter.drawPath( path );
        }
    }

    painter.end();

    const QImage mask = image.createMaskFromColor(
        QColor( Qt::color1 ).rgb(), Qt::MaskOutColor );

    return QBitmap::fromImage( mask );
}
Example #23
0
void PopupMessage::display() //SLOT
{
    m_dissolveSize = 24;
    m_dissolveDelta = -1;

    if( m_maskEffect == Dissolve )
    {
        // necessary to create the mask
        m_mask = QBitmap( width(), height() );
        // make the mask empty and hence will not show widget with show() called below
        dissolveMask();
        m_timerId = startTimer( 1000 / 30 );
    }
    else
    {
        m_timerId = startTimer( 6 );
    }
    show();
}
Example #24
0
SelectFile::SelectFile(QWidget *parent) :
    QDialog(parent),currentHeight(1),
    ui(new Ui::SelectFile)
{
    ui->setupUi(this);

    setWindowFlags(Qt::FramelessWindowHint);
    QPixmap mask(":/Images/images/ui_selectfile.png");//加载掩码图像
    setMask(QBitmap(mask.mask())); //设置窗体的掩码图像,抠除图像的白色区域实现不规则窗体
    QPalette p;//设置调色板
    p.setBrush(QPalette::Window, QBrush(mask));//将调色板的画刷设置为掩码位图,在不规则窗体上显示出掩码位图
    setPalette(p);

    //添加渐变动画
    QPropertyAnimation *animation = new QPropertyAnimation(this, "windowOpacity"); //动画对象类型:渐变
    animation->setDuration(1000); //维持1秒
    animation->setStartValue(0);  //起始α值
    animation->setEndValue(1);    //结束α值
    animation->start();           //动画开始

    ui->label_5->hide();
    loadMovie=new QMovie(":/Images/images/loading_2.gif");
    ui->label_5->setMovie(loadMovie);

    ui->pushButton_4->setStyleSheet("QPushButton{border-image: url(:/Images/images/pb_select_work_normal.png);}"
                                   "QPushButton:hover{border-image: url(:/Images/images/pb_select_work_hover.png);}"
                                     "QPushButton:pressed{border-image: url(:/Images/images/pb_select_work_press.png);}");
    ui->pushButton_5->setStyleSheet("QPushButton{border-image: url(:/Images/images/pb_mainui_close_normal.png);}"
                                    "QPushButton:hover{border-image: url(:/Images/images/pb_mainui_close_hover.png);}"
                                    "QPushButton:pressed{border-image: url(:/Images/images/pb_mainui_close_press.png);}");

    timer_Expand = new QTimer() ;
    timer_Expand->start(5);
    connect(timer_Expand,SIGNAL(timeout()),this,SLOT(showFlash()));

    m_fsw = new QFileSystemWatcher;
    connect(m_fsw, SIGNAL(directoryChanged(QString)), this,SLOT(copyFile(QString)));


    QDir dir;
    root_path = QDir::currentPath() + "//release"; ;
}
Example #25
0
HICON QPixmap::toWinHICON() const
{
    QBitmap maskBitmap = mask();
    if (maskBitmap.isNull()) {
        maskBitmap= QBitmap(size());
        maskBitmap.fill(Qt::color1);
    }

    ICONINFO ii;
    ii.fIcon    = true;
    ii.hbmMask  = qt_createIconMask(maskBitmap);
    ii.hbmColor = toWinHBITMAP(QPixmap::Alpha);
    ii.xHotspot = 0;
    ii.yHotspot = 0;

    HICON hIcon = CreateIconIndirect(&ii);

    DeleteObject(ii.hbmColor);
    DeleteObject(ii.hbmMask);

    return hIcon;
}
Example #26
0
void wxQtDCImpl::DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
                          bool useMask )
{
    QPixmap pix = *bmp.GetHandle();
    if (pix.depth() == 1) {
        //Monochrome bitmap, draw using text fore/background
        
        //Save pen/brush
        QBrush savedBrush = m_qtPainter->background();
        QPen savedPen = m_qtPainter->pen();
        
        //Use text colors
        m_qtPainter->setBackground(QBrush(m_textBackgroundColour.GetHandle()));
        m_qtPainter->setPen(QPen(m_textForegroundColour.GetHandle()));

        //Draw
        m_qtPainter->drawPixmap(x, y, pix);
        
        //Restore saved settings
        m_qtPainter->setBackground(savedBrush);
        m_qtPainter->setPen(savedPen);
    } else {
        if ( !useMask && bmp.GetMask() )
        {
            // Temporarly disable mask
            QBitmap mask;
            mask = pix.mask();
            pix.setMask( QBitmap() );

            // Draw
            m_qtPainter->drawPixmap(x, y, pix);

            // Restore saved mask
            pix.setMask( mask );
        }
        else
            m_qtPainter->drawPixmap(x, y, pix);
    }
}
Example #27
0
KDEFX_EXPORT void kColorBitmaps(QPainter *p, const QColorGroup &g, int x, int y, int w,
                   int h, bool isXBitmaps, const uchar *lightColor,
                   const uchar *midColor, const uchar *midlightColor,
                   const uchar *darkColor, const uchar *blackColor,
                   const uchar *whiteColor)
{
    const uchar *data[]={lightColor, midColor, midlightColor, darkColor,
        blackColor, whiteColor};

    QColor colors[]={g.light(), g.mid(), g.midlight(), g.dark(),
        Qt::black, Qt::white};

    int i;
    QBitmap b;
    for(i=0; i < 6; ++i){
        if(data[i]){
            b = QBitmap(w, h, data[i], isXBitmaps);
            b.setMask(b);
            p->setPen(colors[i]);
            p->drawPixmap(x, y, b);
        }
    }
}
Example #28
0
void K3b::WidgetShowEffect::show( bool effectOnly )
{
    m_bShow = true;
    m_offset = 0;
    m_dissolveSize = 24;
    m_dissolveDelta = -1;

    m_widget->ensurePolished();

    if( m_effect == Dissolve ) {
        // necessary to create the mask
        m_mask = QBitmap( m_widget->width(), m_widget->height() );
        // make the mask empty and hence will not show widget with show() called below
        dissolveMask();
        m_timerId = startTimer( 1000 / 30 );
    }
    else {
        m_widget->move( 0, m_widget->parentWidget()->height() );
        m_timerId = startTimer( 6 );
    }

    if( !effectOnly )
        m_widget->show();
}
Example #29
0
// protected virtual [base QWidget]
void kpDualColorButton::paintEvent (QPaintEvent *e)
{
#if DEBUG_KP_DUAL_COLOR_BUTTON && 1
    qCDebug(kpLogWidgets) << "kpDualColorButton::draw() rect=" << rect ()
               << " contentsRect=" << contentsRect ()
               << endl;
#endif

    // Draw frame first.
    QFrame::paintEvent (e);

    QPainter painter (this);

    // Fill with background.
    if (isEnabled ())
    {
        kpView::drawTransparentBackground (&painter,
            contentsRect ().topLeft ()/*checkerboard top-left*/,
            contentsRect (),
            true/*preview*/);
    }
    else
    {
        // Use default widget background.
    }


    painter.translate (contentsRect ().x (), contentsRect ().y ());


    // Draw "Swap Colours" button (top-right).
    QPixmap swapPixmap = UserIcon ("colorbutton_swap_16x16");
    if (!isEnabled ())
    {
        // Don't let the fill() touch the mask.
        QBitmap swapBitmapMask = swapPixmap.mask ();
        swapPixmap.setMask (QBitmap ());

        // Grey out the opaque parts of "swapPixmap".
        swapPixmap.fill (palette ().color (QPalette::Dark));

        swapPixmap.setMask (swapBitmapMask);
    }
    painter.drawPixmap (swapPixmapRect ().topLeft (), swapPixmap);


    // Draw background colour patch.
    QRect bgRect = backgroundRect ();
    QRect bgRectInside = QRect (bgRect.x () + 2, bgRect.y () + 2,
                                bgRect.width () - 4, bgRect.height () - 4);
    if (isEnabled ())
    {
    #if DEBUG_KP_DUAL_COLOR_BUTTON && 1
        qCDebug(kpLogWidgets) << "\tbackgroundColor=" << (int *) m_color [1].toQRgb ()
                   << endl;
    #endif
        if (m_color [1].isTransparent ())  // only if fully transparent
            painter.drawPixmap (bgRectInside, UserIcon ("color_transparent_26x26"));
        else
            painter.fillRect (bgRectInside, m_color [1].toQColor ());
    }
    else
        painter.fillRect (bgRectInside, palette().color (QPalette::Button));
    qDrawShadePanel (&painter, bgRect, palette(),
                     false/*not sunken*/, 2/*lineWidth*/,
                     0/*never fill*/);


    // Draw foreground colour patch.
    // Must be drawn after background patch since we're on top.
    QRect fgRect = foregroundRect ();
    QRect fgRectInside = QRect (fgRect.x () + 2, fgRect.y () + 2,
                                fgRect.width () - 4, fgRect.height () - 4);
    if (isEnabled ())
    {
    #if DEBUG_KP_DUAL_COLOR_BUTTON && 1
        qCDebug(kpLogWidgets) << "\tforegroundColor=" << (int *) m_color [0].toQRgb ()
                   << endl;
    #endif
        if (m_color [0].isTransparent ())  // only if fully transparent
            painter.drawPixmap (fgRectInside, UserIcon ("color_transparent_26x26"));
        else
            painter.fillRect (fgRectInside, m_color [0].toQColor ());
    }
    else
        painter.fillRect (fgRectInside, palette ().color (QPalette::Button));

    qDrawShadePanel (&painter, fgRect, palette (),
                     false/*not sunken*/, 2/*lineWidth*/,
                     0/*never fill*/);
}
Example #30
0
LvlScene::LvlScene(dataconfigs &configs, LevelData &FileData, QObject *parent) : QGraphicsScene(parent)
{
    setItemIndexMethod(NoIndex);

    //Pointerss
    pConfigs = &configs; // Pointer to Main Configs
    LvlData = &FileData; //Ad pointer to level data

    //Options
    opts.animationEnabled = true;
    opts.collisionsEnabled = true;
    grid = true;

    //Indexes
    index_blocks = pConfigs->index_blocks; //Applaying blocks indexes
    index_bgo = pConfigs->index_bgo;
    index_npc = pConfigs->index_npc;

    //Editing mode
    EditingMode = 0;
    EraserEnabled = false;
    PasteFromBuffer = false;
    disableMoveItems = false;
    DrawMode=false;

    //Editing process flags
    IsMoved = false;
    haveSelected = false;

    placingItem=0;

    pResizer = NULL;

    contextMenuOpened = false;

    //Events flags
    resetPosition = false;
    /*
    wasPasted = false;  //call to cursor reset to normal select
    doCopy = false;     //call to copy
    doCut = false;      //call to cut
    SyncLayerList = false; //Call to refresh layer list
    resetResizingSection = false; //Reset resizing applying buttons
    */
    cursor = NULL;
    resetCursor();

    //set dummy images if target not exist or wrong
    uBlockImg = QPixmap(QApplication::applicationDirPath() + "/" + "data/unknown_block.gif");
    npcmask = QBitmap(QApplication::applicationDirPath() + "/" + "data/unknown_npcm.gif");
    uNpcImg = QPixmap(QApplication::applicationDirPath() + "/" + "data/unknown_npc.gif");
    uNpcImg.setMask(npcmask);
    uBgoImg = QPixmap(QApplication::applicationDirPath() + "/" + "data/unknown_bgo.gif");


    //set Default Z Indexes
    bgZ = -1000;
    blockZs = -150; // sizable blocks
    bgoZb = -100; // backround BGO

    blockZ = 1; // standart block
    playerZ = 5; //player Point

    bgoZf = 50; // foreground BGO

    npcZb = 20; // background NPC

    npcZs = 30; // standart NPC

    blockZl = 100; //LavaBlock
    npcZf = 150; // foreground NPC
    waterZ = 500;
    doorZ = 700;
    spaceZ1 = 1000; // interSection space layer
    spaceZ2 = 1020; // section Border

    //HistoryIndex
    historyIndex=0;

    historyChanged = false;

    //Locks
    lock_bgo=false;
    lock_block=false;
    lock_npc=false;
    lock_door=false;
    lock_water=false;

}