Exemplo n.º 1
0
BOOL CListCtrlEx::OnEraseBkgnd(CDC* pDC) 
{
	// TODO: Add your message handler code here and/or call default
	CRect rect;
	CListCtrlEx::GetClientRect(rect);
	
	POINT mypoint;  
	
	CBrush brush0(m_colRow1);
	CBrush brush1(m_colRow2);
	
	int chunk_height=GetCountPerPage();
	pDC->FillRect(&rect,&brush1);
	
	for (int i=0;i<=chunk_height;i++)
	{
		GetItemPosition(i,&mypoint);
		rect.top=mypoint.y ;
		GetItemPosition(i+1,&mypoint);
		rect.bottom =mypoint.y;
		pDC->FillRect(&rect,i %2 ? &brush1 : &brush0);
		
	}
	brush0.DeleteObject();
	brush1.DeleteObject();
	
	//return FALSE;
	return CListCtrl::OnEraseBkgnd(pDC);
}
Exemplo n.º 2
0
void Na2DViewer::paintCrosshair(QPainter& painter)
{
    float scale = defaultScale * cameraModel.scale();
    QBrush brush1(Qt::black);
    QBrush brush2(QColor(255, 255, 180));
    QPen pen1(brush1, 2.0/scale);
    QPen pen2(brush2, 1.0/scale);
    // qDebug() << "paint crosshair";
    // Q: Why all this complicated math instead of just [width()/2, height()/2]?
    // A: This helps debug/document placement of image focus
    qreal w2 = (pixmap.width() - 1.0) / 2.0; // origin at pixel center, not corner
    qreal h2 = (pixmap.height() - 1.0) / 2.0; // origin at pixel center, not corner
    qreal cx = w2 + flip_X * (cameraModel.focus().x() - w2) + 0.5;
    qreal cy = h2 + flip_Y * (cameraModel.focus().y() - h2) + 0.5;
    QPointF f(cx, cy);
    QPointF dx1(4.0 / scale, 0);
    QPointF dy1(0, 4.0 / scale);
    QPointF dx2(10.0 / scale, 0); // crosshair size is ten pixels
    QPointF dy2(0, 10.0 / scale);
    painter.setPen(pen1);
    painter.drawLine(f + dx1, f + dx2);
    painter.drawLine(f - dx1, f - dx2);
    painter.drawLine(f + dy1, f + dy2);
    painter.drawLine(f - dy1, f - dy2);
    painter.setPen(pen2);
    painter.drawLine(f + dx1, f + dx2);
    painter.drawLine(f - dx1, f - dx2);
    painter.drawLine(f + dy1, f + dy2);
    painter.drawLine(f - dy1, f - dy2);
}
Exemplo n.º 3
0
void CPropCurtain::OnPaint()
{
	//擦除已画图形
	this->Invalidate(true);

	CPaintDC dc(this); // device context for painting
	// TODO: 在此处添加消息处理程序代码
	// 不为绘图消息调用 CPropertyPage::OnPaint()
	
	/*
	//CClientDC dc(this);
	CDC* pDC=GetDC();
	CDC* pMemDC=new CDC;
	CBitmap* pMemBitmap=new CBitmap;
	CBitmap* pMemBitmapOld;
	CRect rectTemp;
	pMemDC->CreateCompatibleDC(NULL);
	pMemBitmap->CreateCompatibleBitmap(pDC,rectTemp.Width(),rectTemp.Height());
	pMemBitmapOld=pMemDC->SelectObject(pMemBitmap);
	//CBitmap* pBitmapOld=MemDC.SelectObject(&MemBitmap);
	//MemDC.FillSolidRect(0,0,rectTemp.Width(),rectTemp.Height(),RGB(255,255,255));
	CBrush brush2(RGB(0,128,255));
	pMemDC->SelectObject(brush2);
	pMemDC->Rectangle(90,66,90+width,250);
	pMemDC->Rectangle(290+(200-width),66,490,250);

	pDC->BitBlt(rectTemp.left,rectTemp.top,rectTemp.Width(),rectTemp.Height(),
		pMemDC,0,0,SRCCOPY);
	pMemDC->SelectObject(pMemBitmapOld);
	pMemBitmap->DeleteObject();
	pMemDC->DeleteDC();
	*/

	
	//窗帘上部
	CBrush brush1(RGB(128,0,0));
	dc.SelectObject(brush1);
	HRGN hRgn,hRgn1,hRgn2;
	hRgn = CreateRectRgn(50, 50, 530, 66);
	hRgn1 = CreateEllipticRgn(42, 50, 58, 66);
	hRgn2 = CreateEllipticRgn(522, 50, 538, 66);
	CombineRgn(hRgn, hRgn, hRgn1, RGN_OR);
	CombineRgn(hRgn, hRgn, hRgn2, RGN_OR);
	CRgn* rgn=CRgn::FromHandle(hRgn);
	dc.FillRgn(rgn, &brush1);
	DeleteObject(hRgn);
	DeleteObject(hRgn1);
	DeleteObject(hRgn2);

	//窗帘绘制
	CPen pen(PS_SOLID,1,RGB(255,0,0));
	//CBrush* pBrush=CBrush::FromHandle((HBRUSH)GetStockObject(NULL_BRUSH));
	CBrush brush2(RGB(0,128,255));
	dc.SelectObject(brush2);
	//CClientDC dc(this);
	dc.SelectObject(&pen);
	dc.Rectangle(90,66,90+width,250);
	dc.Rectangle(290+(200-width),66,490,250);
	
}
Exemplo n.º 4
0
void Game2048ItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
		
		QRect tRect = option.rect;

		int iTop = tRect.top()+5;
		int iLeft = tRect.left()+5;
		QRect rect(iTop, iLeft, 90, 90);
		QBrush brush1(QColor(204, 192, 178));
		painter->fillRect(rect, brush1);

		
		QPen pen;
		pen.setWidth(10);
		pen.setColor(QColor(191,176,150));
		painter->setPen(pen);
		painter->drawRect(tRect);

		QString text = index.data(Qt::DisplayRole).toString();
		qDebug() << index.row() << index.column() << text;
		
		//if (text != "0")
		//{
			QPen pen1;
			pen1.setColor(QColor(Qt::red));
			painter->setPen(pen1);
			QFont font;
			font.setPixelSize(50);
			font.setBold(true);
			painter->setFont(font);
			painter->drawText(tRect, Qt::AlignCenter, text);
		//}
		
			
}
Exemplo n.º 5
0
QImage *ImageItem::createImage(const QMatrix &matrix) const
{
    QImage *original = new QImage(image);
    if (original->isNull()){
        return original; // nothing we can do about it...
    }

    QPoint size = matrix.map(QPoint(this->maxWidth, this->maxHeight));
    float w = size.x(); // x, y is the used as width, height
    float h = size.y();

    // Optimization: if image is smaller than maximum allowed size, just return the loaded image
    if (original->size().height() <= h && original->size().width() <= w && !this->adjustSize && this->scale == 1)
        return original;

    // Calculate what the size of the final image will be:
    w = qMin(w, float(original->size().width()) * this->scale);
    h = qMin(h, float(original->size().height()) * this->scale);

    float adjustx = 1.0f;
    float adjusty = 1.0f;
    if (this->adjustSize){
        adjustx = qMin(matrix.m11(), matrix.m22());
        adjusty = matrix.m22() < adjustx ? adjustx : matrix.m22();
        w *= adjustx;
        h *= adjusty;
    }

    // Create a new image with correct size, and draw original on it
    QImage *image = new QImage(int(w+2), int(h+2), QImage::Format_ARGB32_Premultiplied);
    image->fill(QColor(0, 0, 0, 0).rgba());
    QPainter painter(image);
    painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
    if (this->adjustSize)
        painter.scale(adjustx, adjusty);
    if (this->scale != 1)
       painter.scale(this->scale, this->scale);
    painter.drawImage(0, 0, *original);

    if (!this->adjustSize){
       // Blur out edges
       int blur = 30;
       if (h < original->height()){
           QLinearGradient brush1(0, h - blur, 0, h);
           brush1.setSpread(QGradient::PadSpread);
           brush1.setColorAt(0.0, QColor(0, 0, 0, 0));
           brush1.setColorAt(1.0, Colors::sceneBg1);
           painter.fillRect(0, int(h) - blur, original->width(), int(h), brush1);
       }
       if (w < original->width()){
           QLinearGradient brush2(w - blur, 0, w, 0);
           brush2.setSpread(QGradient::PadSpread);
           brush2.setColorAt(0.0, QColor(0, 0, 0, 0));
           brush2.setColorAt(1.0, Colors::sceneBg1);
           painter.fillRect(int(w) - blur, 0, int(w), original->height(), brush2);
       }
    }
    delete original;
    return image;
}
Exemplo n.º 6
0
void SevenSegment::Draw(CDC* pDC){
	CRect rect(this->base_point.x, this->base_point.y, this->base_point.x + this->GetLength() * 10 - 10 + 1, this->base_point.y + this->GetLength() * 10 - 10 + 1);
	this->baseRect = rect;
	CBrush brush(mv == RGB(0, 0, 0) ? basic : mv);
	CBrush b(RGB(40, 40, 40));
	CPen pen(PS_SOLID, 5, RGB(40, 40, 255));
	CDC memDC;
	memDC.CreateCompatibleDC(pDC);
	CBitmap bmp;
	pDC->SelectObject(&b);
	CPen* old = pDC->SelectObject(&pen);
	pDC->RoundRect(rect, CPoint(9, 9));
	switch (this->radius){
	case 0:
		for (int i = 0; i < 7; i++){
			this->ins[i] = CRect(rect.left - 10, rect.top + 5 + (i * 20), rect.left, rect.top + 15 + (i * 20));
			pDC->Rectangle(this->ins[i]);
		}
		break;
	case 1:
		for (int i = 0; i < 7; i++){
			this->ins[i] = CRect(rect.left + 5 + (i * 20), rect.top - 10, rect.left + 15 + (i * 20), rect.top);
			pDC->Rectangle(this->ins[i]);
		}
		break;
	case 2:
		for (int i = 0; i < 7; i++){
			this->ins[i] = CRect(rect.right, rect.top + 5 + (i * 20), rect.right + 10, rect.top + 15 + (i * 20));
			pDC->Rectangle(this->ins[i]);
		}
		break;
	case 3:
		for (int i = 0; i < 7; i++){
			this->ins[i] = CRect(rect.left + 5 + (i * 20), rect.bottom, rect.left + 15 + (i * 20), rect.bottom + 10);
			pDC->Rectangle(this->ins[i]);
		}
		break;
	}

	CRect dRects[7];
	dRects[0].SetRect(rect.left + 45, rect.top + 20, rect.right - 45, rect.top + 30);
	dRects[1].SetRect(rect.right - 30, rect.top + 30, rect.right - 40, rect.top + 65);
	dRects[2].SetRect(rect.right - 30, rect.bottom - 65, rect.right - 40, rect.bottom - 30);
	dRects[3].SetRect(rect.left + 45, rect.bottom - 30, rect.right - 45, rect.bottom - 20);
	dRects[4].SetRect(rect.left + 30, rect.bottom - 65, rect.left + 40, rect.bottom - 30);
	dRects[5].SetRect(rect.left + 30, rect.top + 30, rect.left + 40, rect.top + 65);
	dRects[6].SetRect(rect.left + 45, rect.top + 65, rect.right - 45, rect.bottom - 65);

	auto& db = SingleTon<GaiaDrawGrid>::use()->dBoard;
	CBrush brush1(RGB(255, 20, 20));
	CBrush brush2(RGB(70, 70, 70));
	for (int i = 0; i < 7; i++){
		if (db[this->ins[i].CenterPoint().x / 10][this->ins[i].CenterPoint().y / 10] == TRUE){
			pDC->FillRect(dRects[i], &brush1);
		}
		else{
			pDC->FillRect(dRects[i], &brush2);
		}
	}
}
Exemplo n.º 7
0
CNotificationDlg::CNotificationDlg(CWnd* pParent /*=NULL*/, wchar_t* title, wchar_t* content, int _idx, int _uid)
	: CDialog(CNotificationDlg::IDD, pParent)
{
	idx=_idx;
	uid=_uid;
	CDC scrdc;
	scrdc.Attach(::GetDC(0));
	bdc.CreateCompatibleDC(&scrdc);
	CBitmap bmp;
	bmp.CreateCompatibleBitmap(&scrdc, 200, 95);
	CBitmap* obmp=bdc.SelectObject(&bmp);
	skin.notifierBG.DrawUnscaled(&bdc, 0, 0, 200, 95, 0, 0);
	skin.tabCloseInact.DrawUnscaled(&bdc, 168, 15, 15, 15, 0, 0);
	std::wstring _content=content;
	int cl=_content.length();
	int nPos;
	while((nPos=_content.find(L"<br>"))!=-1){
		_content.replace(nPos, 4, L" ");
		cl-=3;
	}
	while((nPos=_content.find(L"&lt;"))!=-1){
		_content.replace(nPos, 4, L"<");
		cl-=3;
	}
	while((nPos=_content.find(L"&gt;"))!=-1){
		_content.replace(nPos, 4, L">");
		cl-=3;
	}
	while((nPos=_content.find(L"&quot;"))!=-1){
		_content.replace(nPos, 6, L"\"");
		cl-=5;
	}
	while((nPos=_content.find(L"&amp;"))!=-1){
		_content.replace(nPos, 5, L"&");
		cl-=4;
	}

	Gdiplus::Graphics g(bdc.GetSafeHdc());
    Gdiplus::FontFamily ff(_T("Tahoma"));
    Gdiplus::Font font(&ff, 11, Gdiplus::FontStyleBold, Gdiplus::UnitPixel);
	Gdiplus::Font font2(&ff, 11, Gdiplus::FontStyleRegular, Gdiplus::UnitPixel);
    Gdiplus::PointF pt(15, 40);
	Gdiplus::RectF rc(15,55, 170, 27);
	Gdiplus::SolidBrush brush1(Gdiplus::Color(254, GetRValue(skin.notifyTitleColor), GetGValue(skin.notifyTitleColor), GetBValue(skin.notifyTitleColor)));
	Gdiplus::SolidBrush brush2(Gdiplus::Color(254, GetRValue(skin.notifyTextColor), GetGValue(skin.notifyTextColor), GetBValue(skin.notifyTextColor)));
    g.DrawString(title, wcslen(title), &font, pt, &brush1);
	g.DrawString(_content.c_str(), wcslen(content), &font2, rc, NULL, &brush2);

	::ReleaseDC(0, scrdc);

	mouseInside=true;
	needClose=false;
	_i=0;

	Create(IDD, pParent);
}
QBrush DBrushAdjuster::flipBrush(const QBrush &brush, Qt::Orientation o)
{
	QBrush brush1(brush);
	if(brush.gradient())
	{
		QGradient grad = DGradientAdjuster::flipGradient( brush.gradient(), o );
		brush1 = QBrush(grad);
	}
	else if(!brush.texture().isNull())
	{
	}
	return brush1;
}
Exemplo n.º 9
0
void QmaxButton::createSideButton(QPainter &painter)
{
    QRect scaledRect;
    scaledRect = matrix.mapRect(QRect(0,0,this->logicalSize.width(),this->logicalSize.height()));
    QColor color1(80,85,85,255);
    QColor color(189,198,198,255);
    QColor color2(155,150,158,255);
    QPoint start(0,40);
    QPoint end(40,80);
    QLinearGradient gradient(start,end);
    QLinearGradient brush1(0,0,0,scaledRect.height());
    QPen pen(QBrush(color),2);
    if(m_nPressed)
    {
        painter.setPen(pen);
        gradient.setColorAt(0,color);
        gradient.setColorAt(1,color2);
    }
    else
    {
        painter.setPen(Qt::NoPen);
        gradient.setColorAt(0,color1);
        gradient.setColorAt(1,color1);
    }
    painter.setBrush(gradient);
    painter.drawRect(0,0,100,80);
    painter.drawPixmap(0, 0, this->m_strImage);
    QFont font( "DejaVu Sans" );
    font.setPointSize( 12 );
    painter.setFont( font );
    brush1.setColorAt(1.0f,QColor(255,255,255,255));
    if(this->isEnabled()==false)
    {
        brush1.setColorAt(1.0f,QColor(200,200,200,100));
    }
    painter.setPen(QPen(brush1,1));
    painter.setBrush(brush1);
    QFontMetrics fMetrics = painter.fontMetrics();
    QSize sz = fMetrics.size( Qt::TextWordWrap, m_strText );
    QRectF txtRect( scaledRect.center(), sz );
    int xPoint = (scaledRect.width()/2)- ((m_strText.count()/2));
    int yPoint = scaledRect.height()/2;
    painter.drawText(xPoint,yPoint,m_strText);

}
Exemplo n.º 10
0
QBrush DBrushAdjuster::mapBrush(const QBrush &brush, const QMatrix &matrix  )
{
	QBrush brush1(brush);
	if(brush.gradient())
	{
		QGradient grad = DGradientAdjuster::mapGradient( brush.gradient(), matrix );
		brush1 = QBrush(grad);
	}
	else if(!brush.texture().isNull())
	{
		QPixmap p(brush.texture());
		p = p.transformed(matrix , Qt::SmoothTransformation );
		brush1.setTexture( p );
	}
	
	
	return brush1;
}
Exemplo n.º 11
0
BOOL CClonePairListCtrl::OnEraseBkgnd(CDC* pDC) 
{
	// TODO: Add your message handler code here and/or call default

  CRect rect;
  CClonePairListCtrl::GetClientRect(rect);


  POINT mypoint;  
  
  CBrush brush0(m_colRow1);
  CBrush brush1(m_colRow2);


 
 int chunk_height=GetCountPerPage();
 //pDC->FillRect(&rect,&brush1);

 int top = 0;
 int bottom = 0;
 GetItemPosition(0,&mypoint);
 top = mypoint.y;
 GetItemPosition(1,&mypoint);
 bottom = mypoint.y;
 int height = bottom - top;
 for (int i=0;i<=chunk_height;i++)
 {
		
	//GetItemPosition(i,&mypoint);
	rect.top=top; //mypoint.y ;
	//GetItemPosition(i+1,&mypoint);
	rect.bottom = bottom; //mypoint.y;
	pDC->FillRect(&rect,i %2 ? &brush1 : &brush0);

	top = bottom;
	bottom +=height;

 }

  brush0.DeleteObject();
  brush1.DeleteObject();

  return FALSE;
}
Exemplo n.º 12
0
MiniViewContainer::MiniViewContainer( QWidget * parent )
	: QWidget(parent)
{
	this->setMinimumSize(32, 32);

	m_miniView = new MiniView(this);
	connect(m_miniView, SIGNAL(rectChangedSignal()), this, SLOT(updateFrame()) );
	connect(m_miniView, SIGNAL(miniViewMousePressedSignal()), this, SLOT(miniViewMousePressedSlot()) );
	m_miniView->resize(this->minimumSize());

	QBrush brush1(QColor(0,0,0));
	m_outerFrame = new MiniViewFrame(brush1, false, this);
	m_outerFrame->resize(this->minimumSize());
	//m_outerFrame->setUpdatesEnabled(false);

	QBrush brush2(QColor(128,0,0));
	m_frame = new MiniViewFrame(brush2, true, this);
	m_frame->resize(this->minimumSize());
}
Exemplo n.º 13
0
QBrush DBrushAdjuster::adjustBrush(const QBrush &brush, const QRect &rect )
{
	QBrush brush1(brush);
	if(brush.gradient())
	{
		QGradient grad = DGradientAdjuster::adjustGradient( brush.gradient(), rect );
		brush1 = QBrush(grad);
	}
	else if(!brush.texture().isNull())
	{
		QPixmap p = (brush.texture()/*.toImage ()*/);
		int offset= 0;
		QRect br = p.rect();
		QMatrix matrix;
		
		float sx = 1, sy = 1;
		if ( rect.width() < br.width() )
		{
			sx = static_cast<float>(rect.width()-offset) / static_cast<float>(br.width());
		}
		if ( rect.height() < br.height() )
		{
			sy = static_cast<float>(rect.height()-offset) / static_cast<float>(br.height());
		}
	
		float factor = qMin(sx, sy);
		matrix.scale(sx, sy);
		p = p.transformed(matrix ,Qt::SmoothTransformation );
	
		matrix.reset();
	
		QPointF pos = br.topLeft();
	
		float tx = offset/2-pos.x(), ty = offset/2-pos.y();
	
		matrix.translate(tx, ty);
		p = p.transformed(matrix ,Qt::SmoothTransformation );
		
// 		brush1 = QBrush(p);
		brush1.setTexture (  p );
	}
	return brush1;
}
Exemplo n.º 14
0
void LinePlotterWindow::setupUI()
{
    centralWidget = new QWidget(this);
    centralWidget->setObjectName(QStringLiteral("centralWidget"));
    verticalLayout = new QVBoxLayout(centralWidget);
    verticalLayout->setSpacing(6);
    verticalLayout->setContentsMargins(11, 11, 11, 11);
    verticalLayout->setObjectName(QStringLiteral("verticalLayout"));
    m_customPlot = new QCustomPlot(centralWidget);
    m_customPlot->setObjectName(QStringLiteral("PlotWidget"));
    verticalLayout->addWidget(m_customPlot);
    this->setCentralWidget(centralWidget);
    this->setWindowTitle("Пространственный срез");
    this->resize(518,360);
    QPalette palette;
    QBrush brush1(QColor(255, 255, 255, 255));
    palette.setBrush(QPalette::All, QPalette::Window, brush1);
    this->setPalette(palette);

}
Exemplo n.º 15
0
Screen::Screen(ScreensContainer::ScreenId id , GuiHandler *guiHandler, ScreensContainer *parent)
    : m_id(id),
      m_footer(NULL),
      m_screenManager(parent),
      m_guiHandler(guiHandler)
{
    const QMetaObject &mo = ScreensContainer::staticMetaObject;
    int index = mo.indexOfEnumerator("ScreenId"); // watch out during refactorings
    QMetaEnum metaEnum = mo.enumerator(index);

    if (this->objectName().isEmpty())
        this->setObjectName(metaEnum.valueToKey(id));
    this->resize(800, 400);
    QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    sizePolicy.setHorizontalStretch(0);
    sizePolicy.setVerticalStretch(0);
    sizePolicy.setHeightForWidth(this->sizePolicy().hasHeightForWidth());
    this->setSizePolicy(sizePolicy);
    this->setMinimumSize(QSize(800, 400)); // this includes the footer
    this->setMaximumSize(QSize(1600, 800));

    m_mainGrid = new QGridLayout(this);
    m_mainGrid->setSpacing(0);
    m_mainGrid->setObjectName("gridLayout");
    m_mainGrid->setContentsMargins(0, 0, 5, 0);
    QPalette palette;
    QBrush brush1(QColor(245, 245, 245, 255));
    brush1.setStyle(Qt::SolidPattern);
    palette.setBrush(QPalette::Active, QPalette::Window, brush1);
    palette.setBrush(QPalette::Inactive, QPalette::Base, brush1);
    palette.setBrush(QPalette::Inactive, QPalette::Window, brush1);
    palette.setBrush(QPalette::Disabled, QPalette::Base, brush1);
    palette.setBrush(QPalette::Disabled, QPalette::Window, brush1);
    this->setPalette(palette);
    this->setAutoFillBackground(true);

    connect(m_guiHandler, SIGNAL(goToPrevious()), this, SLOT(goToPrevious()));
}
Exemplo n.º 16
0
void IndividualIcon::paint( QPainter * painter,
             const QStyleOptionGraphicsItem * option, QWidget * ){

    //QGraphicsPixmapItem::paint(painter, option, widget);

    QRectF b = boundingRect();
    QIcon ic = m_item.getActualIcon();
    QRect iconRect;
    iconRect.setTopLeft(b.topLeft().toPoint());
    iconRect.setWidth(UI_DEFAULT_MINI_ICON_SIZE);
    iconRect.setHeight(UI_DEFAULT_MINI_ICON_SIZE);

    ic.paint(painter, iconRect);
    painter->save();
    if(this->isSelected()){
        QBrush brush1(option->palette.highlight());
        brush1.setStyle(Qt::SolidPattern);
        painter->setBrush(brush1);
        painter->drawRect(b);
    }
    QFont fnt = m_item.getDisplayFont();
//    QFontMetrics fm(fnt);
//    int fnt_h = fm.height();
    QRect r(0,0,0,0);
    r.setTop(b.height());
    r.setBottom(b.bottom());
    r.setWidth(b.width());


    painter->setClipRect(r);

    //qDebug() << "test onto rect: " << r;
    drawHtmlLine(painter, fnt, r, m_item.formattedName());

    painter->restore();

}
Exemplo n.º 17
0
void
MainWindow::makeUI()
{
    setObjectName(QString::fromUtf8("MainWindow"));

#if 0
    action_Print = new QAction(this);
    action_Print->setObjectName(QString::fromUtf8("action_Print"));
#endif

#if 1
    action_Exit = new QAction(this);
    action_Exit->setObjectName(QString::fromUtf8("action_Exit"));
	//connect(action_Exit, SIGNAL(triggered()), qApp, SLOT(quit()));
	connect(action_Exit, SIGNAL(triggered()), this, SLOT(close()));
#endif

    action_Multiplot = new QAction(this);
    action_Multiplot->setObjectName(QString::fromUtf8("action_Multiplot"));
	connect(action_Multiplot, SIGNAL(triggered()), this, SLOT(showMultiplot()));

    action_Archivesheet = new QAction(this);
    action_Archivesheet->setObjectName(QString::fromUtf8("action_Archivesheet"));
	connect(action_Archivesheet, SIGNAL(triggered()), this, SLOT(showArchivesheet()));

    action_Archiverviewer = new QAction(this);
    action_Archiverviewer->setObjectName(QString::fromUtf8("action_Archiverviewer"));
	connect(action_Archiverviewer, SIGNAL(triggered()), this, SLOT(showArchiverviewer()));

    action_SignalDB = new QAction(this);
    action_SignalDB->setObjectName(QString::fromUtf8("action_SignalDB"));
	connect(action_SignalDB, SIGNAL(triggered()), this, SLOT(showSignalDB()));

    action_PVListV = new QAction(this);
    action_PVListV->setObjectName(QString::fromUtf8("action_PVListV"));
	connect(action_PVListV, SIGNAL(triggered()), this, SLOT(showPVListViewer()));

	action_Manual = new QAction(this);
	action_Manual->setObjectName(QString::fromUtf8("action_Manual"));
	connect(action_Manual, SIGNAL(triggered()), this, SLOT(showManual()));

	action_AboutECH = new QAction(this);
	action_AboutECH->setObjectName(QString::fromUtf8("action_AboutECH"));
	connect(action_AboutECH, SIGNAL(triggered()), this, SLOT(showAboutECH()));

    centralwidget = new QWidget(this);
    centralwidget->setObjectName(QString::fromUtf8("centralwidget"));
    //centralwidget->setGeometry(QRect(0, 0, 1280, 821));
	
    widget = new QWidget(centralwidget);
    widget->setObjectName(QString::fromUtf8("widget"));
    widget->setGeometry(QRect(200, 0, 1080, 821));
    widget->setMinimumSize(QSize(400, 0));
    vboxLayout = new QVBoxLayout(widget);
    vboxLayout->setSpacing(0);
    vboxLayout->setMargin(0);
    vboxLayout->setObjectName(QString::fromUtf8("vboxLayout"));
    dockWidget = new QDockWidget(widget);
    dockWidget->setObjectName(QString::fromUtf8("dockWidget"));
    QSizePolicy sizePolicy(static_cast<QSizePolicy::Policy>(7), static_cast<QSizePolicy::Policy>(7));
    sizePolicy.setHorizontalStretch(0);
    sizePolicy.setVerticalStretch(0);
    sizePolicy.setHeightForWidth(dockWidget->sizePolicy().hasHeightForWidth());
    dockWidget->setSizePolicy(sizePolicy);
    //dockWidget->setFeatures(QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable|QDockWidget::NoDockWidgetFeatures);
    //dockWidget->setFeatures(QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable);
    //dockWidget->setAllowedAreas(Qt::AllDockWidgetAreas);
    dockWidgetContents = new QWidget(dockWidget);
    dockWidgetContents->setObjectName(QString::fromUtf8("dockWidgetContents"));

    vdockLayout = new QVBoxLayout(widget);
    vdockLayout->setSpacing(0);
    vdockLayout->setMargin(0);
    vdockLayout->setObjectName(QString::fromUtf8("vdockLayout"));

    stackedWidget = new QStackedWidget(dockWidgetContents);
    stackedWidget->setObjectName(QString::fromUtf8("stackedWidget"));
    stackedWidget->setGeometry(QRect(0, 0, 1080, 821));
    dockWidget->setWidget(dockWidgetContents);

    vboxLayout->addWidget(dockWidget);

	dockWidgetContents->setLayout(vdockLayout);
	vdockLayout->addWidget(stackedWidget);

    tabWidget = new QTabWidget(centralwidget);
    tabWidget->setObjectName(QString::fromUtf8("tabWidget"));
    tabWidget->setGeometry(QRect(0, 0, 200, 821));
    QSizePolicy sizePolicy1(static_cast<QSizePolicy::Policy>(5), static_cast<QSizePolicy::Policy>(5));
    sizePolicy1.setHorizontalStretch(0);
    sizePolicy1.setVerticalStretch(0);
    sizePolicy1.setHeightForWidth(tabWidget->sizePolicy().hasHeightForWidth());

#if 1
	/* TabWidget color setting */
    QPalette palettetw;

    QBrush brushtw1(QColor(60, 76, 100, 255));
    brushtw1.setStyle(Qt::SolidPattern);
    palettetw.setBrush(QPalette::Active, QPalette::Window, brushtw1);
    //palettetw.setBrush(QPalette::Inactive, QPalette::Window, brushtw1);
    //palettetw.setBrush(QPalette::Disabled, QPalette::Window, brushtw1);

    QBrush brushtw2(QColor(60, 76, 100, 255));
    brushtw2.setStyle(Qt::SolidPattern);
    palettetw.setBrush(QPalette::Active, QPalette::Base, brushtw2);
    //palettetw.setBrush(QPalette::Inactive, QPalette::Base, brushtw2);
    //palettetw.setBrush(QPalette::Disabled, QPalette::Base, brushtw2);

    palettetw.setBrush(QPalette::Active, QPalette::Button, brushtw1);
    //palettetw.setBrush(QPalette::Inactive, QPalette::Button, brushtw1);
    //palettetw.setBrush(QPalette::Disabled, QPalette::Button, brushtw1);

    QBrush brushtw3(QColor(255, 255, 255, 255));
    brushtw3.setStyle(Qt::SolidPattern);
    palettetw.setBrush(QPalette::Active, QPalette::ButtonText, brushtw3);
    //palettetw.setBrush(QPalette::Inactive, QPalette::ButtonText, brushtw3);
    //palettetw.setBrush(QPalette::Disabled, QPalette::ButtonText, brushtw3);

    palettetw.setBrush(QPalette::Active, QPalette::WindowText, brushtw3);
    //palettetw.setBrush(QPalette::Inactive, QPalette::WindowText, brushtw3);
    //palettetw.setBrush(QPalette::Disabled, QPalette::WindowText, brushtw3);

    tabWidget->setPalette(palettetw);

#endif

#if 0
    QPalette palettetw;
    QBrush brushtw1(QColor(0, 0, 55, 200));
    brushtw1.setStyle(Qt::SolidPattern);
    palettetw.setBrush(QPalette::Active, QPalette::Window, brushtw1);
    QBrush brushtw2(QColor(96, 96, 129, 200));
    brushtw2.setStyle(Qt::SolidPattern);
    palettetw.setBrush(QPalette::Active, QPalette::Base, brushtw2);
    QBrush brushtw3(QColor(100, 100, 100, 255));
    brushtw3.setStyle(Qt::SolidPattern);
    palettetw.setBrush(QPalette::Active, QPalette::WindowText, brushtw3);
    //QBrush brushtw4(QColor(255, 255, 255, 50));
    QBrush brushtw4(QColor(55, 55, 55, 100));
    brushtw4.setStyle(Qt::SolidPattern);
    palettetw.setBrush(QPalette::Active, QPalette::Button, brushtw4);
    tabWidget->setPalette(palettetw);
#endif

    tabWidget->setSizePolicy(sizePolicy1);
    tabWidget->setMaximumSize(QSize(16777215, 16777215));
    tabWidget->setTabPosition(QTabWidget::West);
    tabWidget->setTabShape(QTabWidget::Triangular);
    tabWidget->setElideMode(Qt::ElideNone);

    tab_0 = new QWidget();
    tab_0->setObjectName(QString::fromUtf8("tab_0"));
    QFont font;
    font.setPointSize(14);
    vboxLayout0 = new QVBoxLayout(tab_0);
    vboxLayout0->setSpacing(6);
    vboxLayout0->setMargin(4);
    vboxLayout0->setAlignment(Qt::AlignTop);
    vboxLayout0->setObjectName(QString::fromUtf8("vboxLayout0"));

    QPalette paletteb;
    QBrush brushb(QColor(211, 197, 179, 255));
    brushb.setStyle(Qt::SolidPattern);
    paletteb.setBrush(QPalette::Active, QPalette::Button, brushb);
    //paletteb.setBrush(QPalette::Inactive, QPalette::Button, brushb);
    //paletteb.setBrush(QPalette::Disabled, QPalette::Button, brushb);

    QBrush brushbt(QColor(106, 88, 62, 255));
    brushbt.setStyle(Qt::SolidPattern);
    paletteb.setBrush(QPalette::Active, QPalette::ButtonText, brushbt);
    //paletteb.setBrush(QPalette::Inactive, QPalette::ButtonText, brushbt);
    //paletteb.setBrush(QPalette::Disabled, QPalette::ButtonText, brushbt);

    pushButton[0] = new QPushButton(tab_0);
    pushButton[0]->setObjectName(QString::fromUtf8("pushButton_0"));
    pushButton[0]->setFont(font);
    pushButton[0]->setText(QApplication::translate("MainWindow", "Operation", 0, QApplication::UnicodeUTF8));
    pushButton[0]->setPalette(paletteb);
    vboxLayout0->addWidget(pushButton[0]);

    pushButton[1] = new QPushButton(tab_0);
    pushButton[1]->setObjectName(QString::fromUtf8("pushButton_1"));
    pushButton[1]->setFont(font);
    pushButton[1]->setText(QApplication::translate("MainWindow", "Interlock", 0, QApplication::UnicodeUTF8));
    pushButton[1]->setPalette(paletteb);
    vboxLayout0->addWidget(pushButton[1]);

    pushButton[2] = new QPushButton(tab_0);
    pushButton[2]->setObjectName(QString::fromUtf8("pushButton_2"));
    pushButton[2]->setFont(font);
    pushButton[2]->setText(QApplication::translate("MainWindow", "DAQ", 0, QApplication::UnicodeUTF8));
    pushButton[2]->setPalette(paletteb);
    vboxLayout0->addWidget(pushButton[2]);

#if 0
    pushButton[3] = new QPushButton(tab_0);
    pushButton[3]->setObjectName(QString::fromUtf8("pushButton_3"));
    pushButton[3]->setFont(font);
    pushButton[3]->setText(QApplication::translate("MainWindow", "Waveform Graph2", 0, QApplication::UnicodeUTF8));
    pushButton[3]->setPalette(paletteb);
    vboxLayout0->addWidget(pushButton[3]);
#endif

#if 0
    spacerItem0 = new QSpacerItem(20, 1, QSizePolicy::Minimum, QSizePolicy::Expanding);
    vboxLayout0->addItem(spacerItem0);
#endif
    frame = new QFrame(tab_0);
    frame->setObjectName(QString::fromUtf8("frame"));
    QSizePolicy sizePolicy2(static_cast<QSizePolicy::Policy>(5), static_cast<QSizePolicy::Policy>(5));
    sizePolicy2.setHorizontalStretch(1);
    sizePolicy2.setVerticalStretch(0);
    sizePolicy2.setHeightForWidth(frame->sizePolicy().hasHeightForWidth());
    frame->setSizePolicy(sizePolicy2);
    frame->setMinimumSize(QSize(16, 704));
    frame->setFrameShape(QFrame::StyledPanel);
    frame->setFrameShadow(QFrame::Raised);

    vboxLayout0->addWidget(frame);
	QVBoxLayout *vfboxLayout = new QVBoxLayout(frame);
	vfboxLayout->setSpacing(0);
	vfboxLayout->setMargin(0);
	vfboxLayout->setObjectName(QString::fromUtf8("vfboxLayout"));

	QUiLoader m_loader;
	QFile *file = new QFile("/usr/local/opi/ui/ECH_Menu_Area.ui");
	file->open(QFile::ReadOnly);
	QWidget *m_widget = m_loader.load(file);
	file->close();
	vfboxLayout->addWidget(m_widget);

	AttachChannelAccess *pattachECHMenu = new AttachChannelAccess(frame);

/* TG remove 20130704
    tab_1 = new QWidget();
    tab_1->setObjectName(QString::fromUtf8("tab_1"));
    vboxLayout1 = new QVBoxLayout(tab_1);
    vboxLayout1->setSpacing(6);
    vboxLayout1->setMargin(4);
    vboxLayout1->setObjectName(QString::fromUtf8("vboxLayout1"));

    pushButton[3] = new QPushButton(tab_1);
    pushButton[3]->setObjectName(QString::fromUtf8("pushButton_3"));
    pushButton[3]->setFont(font);
    pushButton[3]->setText(QApplication::translate("MainWindow", "DAQ WavePattern", 0, QApplication::UnicodeUTF8));
    pushButton[3]->setPalette(paletteb);
    vboxLayout1->addWidget(pushButton[3]);

	spacerItem1 = new QSpacerItem(20, 1, QSizePolicy::Minimum, QSizePolicy::Expanding);
	vboxLayout1->addItem(spacerItem1);


    frame2 = new QFrame(tab_1);
    frame2->setObjectName(QString::fromUtf8("frame2"));
    QSizePolicy sizePolicy3(static_cast<QSizePolicy::Policy>(5), static_cast<QSizePolicy::Policy>(5));
    sizePolicy3.setHorizontalStretch(1);
    sizePolicy3.setVerticalStretch(0);
    sizePolicy3.setHeightForWidth(frame2->sizePolicy().hasHeightForWidth());
    frame2->setSizePolicy(sizePolicy3);
    frame2->setMinimumSize(QSize(16, 704));
    frame2->setFrameShape(QFrame::StyledPanel);
    frame2->setFrameShadow(QFrame::Raised);

    vboxLayout1->addWidget(frame2);
	QVBoxLayout *vfboxLayout1 = new QVBoxLayout(frame2);
	vfboxLayout1->setSpacing(0);
	vfboxLayout1->setMargin(0);
	vfboxLayout1->setObjectName(QString::fromUtf8("vfboxLayout1"));
	QUiLoader m_loader1;
	QFile *file1 = new QFile("/usr/local/opi/ui/ECH_Menu_Area.ui");
	file1->open(QFile::ReadOnly);
	QWidget *m_widget1 = m_loader1.load(file1);
	file1->close();
	vfboxLayout1->addWidget(m_widget1);

	AttachChannelAccess *pattachECHSubMenu = new AttachChannelAccess(frame2);

*/

	/*
    spacerItem1 = new QSpacerItem(20, 20, QSizePolicy::Fixed, QSizePolicy::Fixed);
    vfboxLayout->addItem(spacerItem1);

	QUiLoader m_loader2;
	QFile *file2 = new QFile("/usr/local/opi/ui/ECH_Menu_Area2.ui");
	file2->open(QFile::ReadOnly);
	QWidget *m_widget2 = m_loader2.load(file2);
	file2->close();
	vfboxLayout->addWidget(m_widget2);
	*/




    tabWidget->addTab(tab_0, QApplication::translate("MainWindow", "ECH Main panels", 0, QApplication::UnicodeUTF8));
//    tabWidget->addTab(tab_1, QApplication::translate("MainWindow", "ECH Sub panels", 0, QApplication::UnicodeUTF8));

    menubar = new QMenuBar(this);
    menubar->setObjectName(QString::fromUtf8("menubar"));
    menubar->setGeometry(QRect(0, 0, 1280, 30));
    menu_File = new QMenu(menubar);
    menu_File->setObjectName(QString::fromUtf8("menu_File"));
    menu_Util = new QMenu(menubar);
    menu_Util->setObjectName(QString::fromUtf8("menu_Util"));
	menu_Help = new QMenu(menubar);
	menu_Help->setObjectName(QString::fromUtf8("menu_Help"));
    setMenuBar(menubar);

    QLabel *slabel1 = new QLabel("Set your mouse on the dynamic value to read PVNAME.");
    slabel1->setAlignment(Qt::AlignHCenter);
    slabel1->setMinimumSize(slabel1->sizeHint());
    slabel1->setFrameStyle(QFrame::Panel | QFrame::Plain);

    QFrame *sframe = new QFrame();
    QVBoxLayout *svlayout = new QVBoxLayout(sframe);
    svlayout->setSpacing(1);
    svlayout->setMargin(2);

    statusBar()->addWidget(sframe,1);
    
    toolBar = new QToolBar(this);
    toolBar->setObjectName(QString::fromUtf8("toolBar"));

    QPalette palette;
    QBrush brush(QColor(108, 147, 255, 100));
    brush.setStyle(Qt::SolidPattern);
    palette.setBrush(QPalette::Active, QPalette::Base, brush);
    palette.setBrush(QPalette::Active, QPalette::AlternateBase, brush);
    QBrush brush1(QColor(44, 51, 91, 100));
    brush1.setStyle(Qt::SolidPattern);
    palette.setBrush(QPalette::Active, QPalette::Window, brush1);
    QBrush brush2(QColor(108, 147, 255, 100));
    brush2.setStyle(Qt::SolidPattern);
    palette.setBrush(QPalette::Inactive, QPalette::Base, brush2);
    QBrush brush3(QColor(44, 51, 91, 100));
    brush3.setStyle(Qt::SolidPattern);
    palette.setBrush(QPalette::Inactive, QPalette::Window, brush3);
    QBrush brush4(QColor(44, 51, 91, 100));
    brush4.setStyle(Qt::SolidPattern);
    palette.setBrush(QPalette::Disabled, QPalette::Base, brush4);
    QBrush brush5(QColor(44, 51, 91, 100));
    brush5.setStyle(Qt::SolidPattern);
    palette.setBrush(QPalette::Disabled, QPalette::Window, brush5);
    toolBar->setPalette(palette);
    toolBar->setOrientation(Qt::Horizontal);
    addToolBar(static_cast<Qt::ToolBarArea>(4), toolBar);

    menubar->addAction(menu_File->menuAction());
    menubar->addAction(menu_Util->menuAction());
    //menubar->addAction(menu_View->menuAction());
	menubar->addSeparator();
    menubar->addAction(menu_Help->menuAction());
#if 0
    menu_File->addAction(action_Print);
#endif
    menu_File->addAction(action_Exit);

    menu_Util->addAction(action_Multiplot);
    menu_Util->addAction(action_Archivesheet);
    menu_Util->addAction(action_Archiverviewer);
    menu_Util->addAction(action_SignalDB);
    menu_Util->addAction(action_PVListV);

#if 0
	menu_Help->addAction(action_Manual);
#endif
	menu_Help->addAction(action_AboutECH);

#if 1
    QFrame *tbframe = new QFrame();
    toolBar->addWidget(tbframe);

    QHBoxLayout *tblayout = new QHBoxLayout(tbframe);
    tblayout->QLayout::setAlignment(Qt::AlignRight|Qt::AlignVCenter);
    tblayout->setSpacing(0);
    tblayout->setMargin(0);
    tblayout->setObjectName(QString::fromUtf8("toolBarLayout"));

    QSpacerItem *tbspacer = new QSpacerItem(1000, 10, QSizePolicy::Fixed, QSizePolicy::Fixed);
    QSpacerItem *tbspacer2 = new QSpacerItem(5, 5, QSizePolicy::Fixed, QSizePolicy::Fixed);

	//CAGraphic *ioc1HB = new CAGraphic();
	ioc1HB = new CAGraphic();
	ioc1HB->setLineWidth(2);
	ioc1HB->setMinimumSize(QSize(20,20));
	ioc1HB->setMaximumSize(QSize(20,20));
	ioc1HB->setFillColor(QColor("white"));
	ioc1HB->setLineColor(QColor("black"));
	ioc1HB->setFillMode(StaticGraphic::Solid);
	ioc1HB->setPvname("ECH_HEARTBEAT");
	ioc1HB->setFillDisplayMode(CAGraphic::ActInact);
	ioc1HB->setObjectName("CAGraphic_ioc1HB");
	ioc1HB->setToolTip("ECH IOC HEART BEAT");

	//CAGraphic *ioc2HB = new CAGraphic();
/*
	ioc2HB = new CAGraphic();
	ioc2HB->setLineWidth(2);
	ioc2HB->setMinimumSize(QSize(20,20));
	ioc2HB->setMaximumSize(QSize(20,20));
	ioc2HB->setFillColor(QColor("white"));
	ioc2HB->setLineColor(QColor("black"));
	ioc2HB->setFillMode(StaticGraphic::Solid);
	ioc2HB->setPvname("ECH_LTU_HEARTBEAT");
	ioc2HB->setFillDisplayMode(CAGraphic::ActInact);
	ioc2HB->setObjectName("CAGraphic_ioc2HB");
	ioc2HB->setToolTip("ECH LTU HEART BEAT");
*/

    font.setPointSize(12);
    //CAWclock *wclock1 = new CAWclock();
    wclock1 = new CAWclock();
	wclock1->setMinimumSize(QSize(160,20));
	wclock1->setMaximumSize(QSize(160,20));
	wclock1->setPvname("ECH_IOC_WCLOCK.RVAL");
	wclock1->setFont(font);
	wclock1->setObjectName("CAWclock_wclock1");
	
    //QLabel *logo = new QLabel("KSTAR logo");
    logo = new QLabel("KSTAR logo");
    logo->setPixmap(QPixmap::fromImage(QImage(":/images/kstar.png")));

    tblayout->addItem(tbspacer);
    tblayout->addWidget(wclock1);
    tblayout->addItem(tbspacer2);
	tblayout->addWidget(ioc1HB);
//	tblayout->addWidget(ioc2HB);
    tblayout->addItem(tbspacer2);
    tblayout->addWidget(logo);
	AttachChannelAccess *pattachTB = new AttachChannelAccess(tbframe);
#endif

    QSize size(1280, 1024);
    size = size.expandedTo(minimumSizeHint());
    resize(size);
    tabWidget->setCurrentIndex(0);
    QMetaObject::connectSlotsByName(this);

    msgframe = new QFrame(centralwidget);
    msgframe->setObjectName(QString::fromUtf8("msgframe"));
    QSizePolicy sizePolicy4(static_cast<QSizePolicy::Policy>(5), static_cast<QSizePolicy::Policy>(5));
    sizePolicy4.setHorizontalStretch(0);
    sizePolicy4.setVerticalStretch(0);
    sizePolicy4.setHeightForWidth(frame->sizePolicy().hasHeightForWidth());
//TG    msgframe->setGeometry(QRect(19, 820, 1255, 90));
    //msgframe->setSizePolicy(sizePolicy4);
    msgframe->setGeometry(QRect(10, 880, 1254, 70));
    //msgframe->setMinimumSize(QSize(1164, 90));
    //msgframe->setFrameShape(QFrame::StyledPanel);
    //msgframe->setFrameShadow(QFrame::Raised);

	vboxLayout2 = new QVBoxLayout(msgframe);
	vboxLayout2->setSpacing(0);
	vboxLayout2->setMargin(0);


/*
	QUiLoader m_loader2;
	QFile *file2 = new QFile("/usr/local/opi/ui/ECH_message.ui");
	file2->open(QFile::ReadOnly);
	QWidget *m_widget2 = m_loader2.load(file2);
	file2->close();
	vboxLayout2->addWidget(m_widget2);
*/

	QHBoxLayout *vhLayout = new QHBoxLayout();
	vhLayout->setSpacing(0);
	vhLayout->setMargin(0);

	CADisplayer *ioc1_interlock = new CADisplayer();
	ioc1_interlock->setMinimumSize(QSize(160,20));
	ioc1_interlock->setMaximumSize(QSize(160,20));
	ioc1_interlock->setPvname("ECH_IOC1_INTERLOCK");
	ioc1_interlock->setObjectName("CADisplayer_ioc1_interlock");
	ioc1_interlock->setVisible(false);
	vhLayout->addWidget(ioc1_interlock);

	CADisplayer *ioc2_interlock = new CADisplayer();
	ioc2_interlock->setMinimumSize(QSize(160,20));
	ioc2_interlock->setMaximumSize(QSize(160,20));
	ioc2_interlock->setPvname("ECH_IOC2_INTERLOCK");
	ioc2_interlock->setObjectName("CADisplayer_ioc2_interlock");
	ioc2_interlock->setVisible(false);
	vhLayout->addWidget(ioc2_interlock);
	vboxLayout2->addLayout(vhLayout);

	textEdit = new QTextEdit(this);
	textEdit->setObjectName(QString::fromUtf8("textEdit"));
	//textEdit->setGeometry(QRect(0, 0, 1000, 50)); 
	//textEdit->setGeometry(QRect(16, 900, 1000, 70)); 
	textEdit->setFontPointSize(12);
	textEdit->setAutoFormatting(QTextEdit::AutoAll);
	textEdit->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);

	vboxLayout2->addWidget(textEdit);

	//AttachChannelAccess *pattach_msg = new AttachChannelAccess(msgframe);
	setCentralWidget(centralwidget);

	QObject::connect(ioc1_interlock, SIGNAL(valueChanged(QString)), this,  SLOT(changeText(QString))); 

	QObject::connect(tabWidget, SIGNAL(currentChanged(int)), SLOT(setDefaultIndex(int))); 


	// Set Object Text.
	setWindowTitle(QApplication::translate("MainWindow", "ECH (KSTAR 84GHz ECH System)", 0, QApplication::UnicodeUTF8));
	setWindowIcon(QIcon(QString::fromUtf8("/usr/local/opi/images/ECH.xpm")));
#if 0
    action_Print->setText(QApplication::translate("MainWindow", "&Print", 0, QApplication::UnicodeUTF8));
#endif
    action_Exit->setText(QApplication::translate("MainWindow", "e&Xit", 0, QApplication::UnicodeUTF8));
    action_Multiplot->setText(QApplication::translate("MainWindow", "&Multiplot", 0, QApplication::UnicodeUTF8));
    action_Archivesheet->setText(QApplication::translate("MainWindow", "&Archivesheet", 0, QApplication::UnicodeUTF8));
    action_Archiverviewer->setText(QApplication::translate("MainWindow", "a&Rchiveviewer", 0, QApplication::UnicodeUTF8));
    action_SignalDB->setText(QApplication::translate("MainWindow", "&SignalDB", 0, QApplication::UnicodeUTF8));
    action_PVListV->setText(QApplication::translate("MainWindow", "&PVListviewer", 0, QApplication::UnicodeUTF8));
    action_Manual->setText(QApplication::translate("MainWindow", "ma&Nual", 0, QApplication::UnicodeUTF8));
    action_AboutECH->setText(QApplication::translate("MainWindow", "About &ECH", 0, QApplication::UnicodeUTF8));
    tabWidget->setTabText(tabWidget->indexOf(tab_0), QApplication::translate("MainWindow", "ECH main panels", 0, QApplication::UnicodeUTF8));
//    tabWidget->setTabText(tabWidget->indexOf(tab_1), QApplication::translate("MainWindow", "ECH sub panels", 0, QApplication::UnicodeUTF8));
    menu_File->setTitle(QApplication::translate("MainWindow", "&File", 0, QApplication::UnicodeUTF8));
    menu_Util->setTitle(QApplication::translate("MainWindow", "&Util", 0, QApplication::UnicodeUTF8));
    //menu_View->setTitle(QApplication::translate("MainWindow", "&View", 0, QApplication::UnicodeUTF8));
    menu_Help->setTitle(QApplication::translate("MainWindow", "&Help", 0, QApplication::UnicodeUTF8));

} // setupUi
Exemplo n.º 18
0
void CColorTree::OnPaint()
{
	CTreeCtrl::OnPaint();
	CPaintDC dc(this); // device context for painting
	HTREEITEM hItem;
	CImageList *List;
			List = GetImageList(0);

	
	hItem = GetFirstVisibleItem();
	CRect rec, recText;

	 CBrush brush0(m_colRow1);
	CBrush brush1(m_colRow2);

	int i;
	i = 0;
	CDC * pDC;
	pDC = GetDC();
	CFont Font;
	Font.CreateFontW(15,0,0,0,FW_NORMAL, FALSE, FALSE,FALSE,RUSSIAN_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,ANTIALIASED_QUALITY,FF_MODERN|DEFAULT_PITCH,_T("TestFont"));
	pDC->SelectObject(Font);
	while(hItem!=NULL)
	{
		GetItemRect(hItem,rec,FALSE);
		GetItemRect(hItem,recText,TRUE);
		//
		if(i % 2 == 0)
			{
				pDC->FillRect(rec,&brush0);
				pDC->SetBkColor(m_colRow1);
			}
		else
			{
				pDC->SetBkColor(m_colRow2);
				pDC->FillRect(rec,&brush1);
			}
		CString sName;
		sName = GetItemText(hItem);
		if(sName.Find(_T("\n"))>-1)
		{
			sName =  sName.Left(sName.Find(_T("\n")));
		}
		if(sName.Find(_T("\t"))>-1)
			{
				CString sVal;
				sVal = sName.Left(sName.Find(_T("\t")));
				pDC->TextOutW(recText.left-20 ,rec.top,sVal,sVal.GetLength());
				
				sVal = sName.Right(sName.GetLength()-1-sVal.GetLength());
				pDC->TextOutW(rec.left + (rec.right - rec.left)/2,rec.top,sVal,sVal.GetLength());
			}
		else
			pDC->TextOutW(recText.left - 20,rec.top,sName,sName.GetLength());


		if(GetItemState(hItem, TVIS_EXPANDED)& TVIS_EXPANDED)
		{
			if(List!=NULL)
			{
				CPoint xy; 		
				xy =  recText.TopLeft();
				xy.x = xy.x - 40;
				List->Draw(pDC,1,xy,ILD_NORMAL);
			}
		}
		else
		{
			if(List!=NULL)
			{
				CPoint xy; 		
				xy =  recText.TopLeft();
				xy.x = xy.x - 40;
				if(GetChildItem(hItem)!=NULL)
					List->Draw(pDC,0, xy,ILD_NORMAL);
				else
					List->Draw(pDC,2, xy,ILD_NORMAL);
			}
		}

		hItem = GetNextVisibleItem(hItem);
		i++;
	}
}
Exemplo n.º 19
0
void
MainWindow::makeUI()
{
    setObjectName(QString::fromUtf8("MainWindow"));
#if 1
    action_Exit = new QAction(this);
    action_Exit->setObjectName(QString::fromUtf8("action_Exit"));
	//connect(action_Exit, SIGNAL(triggered()), qApp, SLOT(quit()));
	connect(action_Exit, SIGNAL(triggered()), this, SLOT(close()));
#endif

    centralwidget = new QWidget(this);
    centralwidget->setObjectName(QString::fromUtf8("centralwidget"));
	
    widget = new QWidget(centralwidget);
    widget->setObjectName(QString::fromUtf8("widget"));
    widget->setGeometry(QRect(190, 0, 1080, 821));
    widget->setMinimumSize(QSize(400, 0));
    vboxLayout = new QVBoxLayout(widget);
    vboxLayout->setSpacing(0);
    vboxLayout->setMargin(0);
    vboxLayout->setObjectName(QString::fromUtf8("vboxLayout"));
    dockWidget = new QDockWidget(widget);
    dockWidget->setObjectName(QString::fromUtf8("dockWidget"));
    QSizePolicy sizePolicy(static_cast<QSizePolicy::Policy>(7), static_cast<QSizePolicy::Policy>(7));
    sizePolicy.setHorizontalStretch(0);
    sizePolicy.setVerticalStretch(0);
    sizePolicy.setHeightForWidth(dockWidget->sizePolicy().hasHeightForWidth());
    dockWidget->setSizePolicy(sizePolicy);
    dockWidgetContents = new QWidget(dockWidget);
    dockWidgetContents->setObjectName(QString::fromUtf8("dockWidgetContents"));

    vdockLayout = new QVBoxLayout(widget);
    vdockLayout->setSpacing(0);
    vdockLayout->setMargin(0);
    vdockLayout->setObjectName(QString::fromUtf8("vdockLayout"));

    stackedWidget = new QStackedWidget(dockWidgetContents);
    stackedWidget->setObjectName(QString::fromUtf8("stackedWidget"));
    stackedWidget->setGeometry(QRect(0, 0, 1080, 821));
    dockWidget->setWidget(dockWidgetContents);

    vboxLayout->addWidget(dockWidget);

	dockWidgetContents->setLayout(vdockLayout);
	vdockLayout->addWidget(stackedWidget);

    tabWidget = new QTabWidget(centralwidget);
    tabWidget->setObjectName(QString::fromUtf8("tabWidget"));
    tabWidget->setGeometry(QRect(0, 0, 190, 821));
    QSizePolicy sizePolicy1(static_cast<QSizePolicy::Policy>(5), static_cast<QSizePolicy::Policy>(5));
    sizePolicy1.setHorizontalStretch(0);
    sizePolicy1.setVerticalStretch(0);
    sizePolicy1.setHeightForWidth(tabWidget->sizePolicy().hasHeightForWidth());

    tabWidget->setSizePolicy(sizePolicy1);
    tabWidget->setMaximumSize(QSize(16777215, 16777215));
    tabWidget->setTabPosition(QTabWidget::West);
    tabWidget->setTabShape(QTabWidget::Triangular);
    tabWidget->setElideMode(Qt::ElideNone);

    tab_0 = new QWidget();
    tab_0->setObjectName(QString::fromUtf8("tab_0"));
    QFont font;
    font.setPointSize(14);
    vboxLayout0 = new QVBoxLayout(tab_0);
    vboxLayout0->setSpacing(6);
    vboxLayout0->setMargin(9);
    vboxLayout0->setAlignment(Qt::AlignTop);
    vboxLayout0->setObjectName(QString::fromUtf8("vboxLayout0"));

    pushButton[0] = new QPushButton(tab_0);
    pushButton[0]->setObjectName(QString::fromUtf8("pushButton_0"));
    pushButton[0]->setFont(font);
    pushButton[0]->setText(QApplication::translate("MainWindow", "PMS In Board", 0, QApplication::UnicodeUTF8));
    vboxLayout0->addWidget(pushButton[0]);

    pushButton[1] = new QPushButton(tab_0);
    pushButton[1]->setObjectName(QString::fromUtf8("pushButton_1"));
    pushButton[1]->setFont(font);
    pushButton[1]->setText(QApplication::translate("MainWindow", "PMS Out Board", 0, QApplication::UnicodeUTF8));
    vboxLayout0->addWidget(pushButton[1]);

    QSpacerItem *spacerItem;
    //spacerItem = new QSpacerItem(31, 61, QSizePolicy::Minimum, QSizePolicy::Expanding);
    spacerItem = new QSpacerItem(31, 61, QSizePolicy::Minimum, QSizePolicy::Fixed);
    vboxLayout0->addItem(spacerItem);

	//Add Code.
    archiveList = new QComboBox(tab_0);
    archiveList->setObjectName(QString::fromUtf8("archiveList"));
    vboxLayout0->addWidget(archiveList);

    Start_dateTime = new QDateTimeEdit(tab_0);
    Start_dateTime->setObjectName(QString::fromUtf8("Start_dateTime"));
    Start_dateTime->setDisplayFormat("yyyy/MM/dd hh:mm:ss");
    Start_dateTime->setDateTime(QDateTime(QDate(2012,5,29), QTime(12,0,0)));
    vboxLayout0->addWidget(Start_dateTime);

    End_dateTime = new QDateTimeEdit(tab_0);
    End_dateTime->setObjectName(QString::fromUtf8("End_dateTime"));
    End_dateTime->setDisplayFormat("yyyy/MM/dd hh:mm:ss");
    End_dateTime->setDateTime(QDateTime(QDate(2012,5,29), QTime(13,0,0)));
    vboxLayout0->addWidget(End_dateTime);

    RButton = new QPushButton(tab_0);
    RButton->setObjectName(QString::fromUtf8("RButton"));
    RButton->setText("OK");
	if(RButton!=0) connect(RButton, SIGNAL(clicked()), this, SLOT(getChannelValues()));
    //RButton->setGeometry(QRect(980, 20, 80, 27));
    vboxLayout0->addWidget(RButton);


    currentTimeLabel = new QLabel(tab_0);
    currentTimeLabel->setObjectName(QString::fromUtf8("currentTimeLabel"));
    currentTimeLabel->setText("Current Index Time");
    //currentTimeLabel->setGeometry(QRect(760, 7, 161, 21));
    vboxLayout0->addWidget(currentTimeLabel);

    timeSlider = new QSlider(tab_0);
    timeSlider->setObjectName(QString::fromUtf8("timeSlider"));
    //timeSlider->setGeometry(QRect(760, 24, 201, 16));
    timeSlider->setValue(-1);
    timeSlider->setOrientation(Qt::Horizontal);
	connect(timeSlider, SIGNAL(valueChanged(int)), this, SLOT(readValue(int)));
    vboxLayout0->addWidget(timeSlider);

	//--> Splitter
    splitter = new QSplitter(tab_0);
    splitter->setObjectName(QString::fromUtf8("splitter"));
    splitter->setOrientation(Qt::Horizontal);

    incButtonDouble = new QPushButton(splitter);
    incButtonDouble->setObjectName(QString::fromUtf8("incButtonDouble"));
    QSizePolicy sizePol(QSizePolicy::Fixed, QSizePolicy::Fixed);
    sizePol.setHeightForWidth(incButtonDouble->sizePolicy().hasHeightForWidth());
    incButtonDouble->setSizePolicy(sizePol);
    incButtonDouble->setText("<<");
	connect(incButtonDouble,SIGNAL(clicked()), this, SLOT(decDouble()));
    splitter->addWidget(incButtonDouble);

    incButton = new QPushButton(splitter);
    incButton->setObjectName(QString::fromUtf8("incButton"));
    sizePol.setHeightForWidth(incButton->sizePolicy().hasHeightForWidth());
    incButton->setSizePolicy(sizePol);
    incButton->setText("<");
	connect(incButton,SIGNAL(clicked()), this, SLOT(decrease()));
    splitter->addWidget(incButton);

    decButton = new QPushButton(splitter);
    decButton->setObjectName(QString::fromUtf8("decButton"));
    sizePol.setHeightForWidth(decButton->sizePolicy().hasHeightForWidth());
    decButton->setSizePolicy(sizePol);
    decButton->setText(">");
	connect(decButton,SIGNAL(clicked()), this, SLOT(increase()));
    splitter->addWidget(decButton);

    decButtonDouble = new QPushButton(splitter);
    decButtonDouble->setObjectName(QString::fromUtf8("decButtonDouble"));
    sizePol.setHeightForWidth(decButtonDouble->sizePolicy().hasHeightForWidth());
    decButtonDouble->setSizePolicy(sizePol);
    decButtonDouble->setText(">>");
	connect(decButtonDouble,SIGNAL(clicked()), this, SLOT(incDouble()));
    splitter->addWidget(decButtonDouble);

    vboxLayout0->addWidget(splitter);
	//<-- Splitter

    splitter2 = new QSplitter(tab_0);
    splitter2->setObjectName(QString::fromUtf8("splitter2"));
    splitter2->setOrientation(Qt::Horizontal);

    stopButton = new QPushButton(splitter2);
    stopButton->setObjectName(QString::fromUtf8("stopButton"));
    sizePol.setHeightForWidth(stopButton->sizePolicy().hasHeightForWidth());
    stopButton->setSizePolicy(sizePol);
    stopButton->setText("Stop");
	connect(stopButton,SIGNAL(clicked()), this, SLOT(timerStop()));
    splitter2->addWidget(stopButton);

    startButton = new QPushButton(splitter2);
    startButton->setObjectName(QString::fromUtf8("startButton"));
    sizePol.setHeightForWidth(startButton->sizePolicy().hasHeightForWidth());
    startButton->setSizePolicy(sizePol);
    startButton->setText("Run");
	connect(startButton,SIGNAL(clicked()), this, SLOT(timerRun()));
    splitter2->addWidget(startButton);

    vboxLayout0->addWidget(splitter2);

    tabWidget->addTab(tab_0, QApplication::translate("MainWindow", "PMS Panel", 0, QApplication::UnicodeUTF8));

    menubar = new QMenuBar(this);
    menubar->setObjectName(QString::fromUtf8("menubar"));
    menubar->setGeometry(QRect(0, 0, 1280, 30));
    menu_File = new QMenu(menubar);
    menu_File->setObjectName(QString::fromUtf8("menu_File"));
    menu_Util = new QMenu(menubar);
    menu_Util->setObjectName(QString::fromUtf8("menu_Util"));

	menu_Help = new QMenu(menubar);
	menu_Help->setObjectName(QString::fromUtf8("menu_Help"));
    setMenuBar(menubar);

    QLabel *slabel1 = new QLabel("Set your mouse on the dynamic value to read PVNAME.");
    slabel1->setAlignment(Qt::AlignHCenter);
    slabel1->setMinimumSize(slabel1->sizeHint());
    slabel1->setFrameStyle(QFrame::Panel | QFrame::Plain);

    QFrame *sframe = new QFrame();
    QVBoxLayout *svlayout = new QVBoxLayout(sframe);
    svlayout->setSpacing(1);
    svlayout->setMargin(2);

    statusBar()->addWidget(sframe,1);
    
    toolBar = new QToolBar(this);
    toolBar->setObjectName(QString::fromUtf8("toolBar"));
    QPalette palette;
    QBrush brush(QColor(108, 147, 255, 100));
    brush.setStyle(Qt::SolidPattern);
    palette.setBrush(QPalette::Active, QPalette::Base, brush);
    palette.setBrush(QPalette::Active, QPalette::AlternateBase, brush);
    QBrush brush1(QColor(44, 51, 91, 100));
    brush1.setStyle(Qt::SolidPattern);
    palette.setBrush(QPalette::Active, QPalette::Window, brush1);
    QBrush brush2(QColor(108, 147, 255, 100));
    brush2.setStyle(Qt::SolidPattern);
    palette.setBrush(QPalette::Inactive, QPalette::Base, brush2);
    QBrush brush3(QColor(44, 51, 91, 100));
    brush3.setStyle(Qt::SolidPattern);
    palette.setBrush(QPalette::Inactive, QPalette::Window, brush3);
    QBrush brush4(QColor(44, 51, 91, 100));
    brush4.setStyle(Qt::SolidPattern);
    palette.setBrush(QPalette::Disabled, QPalette::Base, brush4);
    QBrush brush5(QColor(44, 51, 91, 100));
    brush5.setStyle(Qt::SolidPattern);
    palette.setBrush(QPalette::Disabled, QPalette::Window, brush5);
    toolBar->setPalette(palette);
    toolBar->setOrientation(Qt::Horizontal);
    addToolBar(static_cast<Qt::ToolBarArea>(4), toolBar);

    menubar->addAction(menu_File->menuAction());
    menubar->addAction(menu_Util->menuAction());
	menubar->addSeparator();
    menubar->addAction(menu_Help->menuAction());


    menu_File->addAction(action_Exit);

    QSize size(1280, 1024);
    size = size.expandedTo(minimumSizeHint());
    resize(size);
    tabWidget->setCurrentIndex(0);
    QMetaObject::connectSlotsByName(this);

    msgframe = new QFrame(centralwidget);
    msgframe->setObjectName(QString::fromUtf8("msgframe"));
    QSizePolicy sizePolicy4(static_cast<QSizePolicy::Policy>(5), static_cast<QSizePolicy::Policy>(5));
    sizePolicy4.setHorizontalStretch(0);
    sizePolicy4.setVerticalStretch(0);
    msgframe->setGeometry(QRect(19, 820, 1255, 90));
    //msgframe->setSizePolicy(sizePolicy4);
    //msgframe->setGeometry(QRect(18, 880, 1254, 70));
    //msgframe->setMinimumSize(QSize(1164, 90));
    //msgframe->setFrameShape(QFrame::StyledPanel);
    //msgframe->setFrameShadow(QFrame::Raised);

	setCentralWidget(centralwidget);

	QObject::connect(tabWidget, SIGNAL(currentChanged(int)), SLOT(setDefaultIndex(int))); 

	// Set Object Text.
	setWindowTitle(QApplication::translate("MainWindow", "PMS (Plant Monitoring System)", 0, QApplication::UnicodeUTF8));
    action_Exit->setText(QApplication::translate("MainWindow", "e&Xit", 0, QApplication::UnicodeUTF8));
    tabWidget->setTabText(tabWidget->indexOf(tab_0), QApplication::translate("MainWindow", "PMS Data Retrieval", 0, QApplication::UnicodeUTF8));
    menu_File->setTitle(QApplication::translate("MainWindow", "&File", 0, QApplication::UnicodeUTF8));
    menu_Util->setTitle(QApplication::translate("MainWindow", "&Util", 0, QApplication::UnicodeUTF8));
    menu_Help->setTitle(QApplication::translate("MainWindow", "&Help", 0, QApplication::UnicodeUTF8));

} // makeUI
Exemplo n.º 20
0
SocioTwitterwidget::SocioTwitterwidget(const QRectF &rect, QWidget *widget):
    DesktopWidget(rect, widget)
{


    if (SocioTwitterwidget->objectName().isEmpty())
        SocioTwitterwidget->setObjectName(QString::fromUtf8("SocioTwitterClass"));
    SocioTwitterwidget->resize(272, 415);
    QSizePolicy sizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
    sizePolicy.setHorizontalStretch(0);
    sizePolicy.setVerticalStretch(0);
    sizePolicy.setHeightForWidth(SocioTwitterClass->sizePolicy().hasHeightForWidth());
    SocioTwitterwidget->setSizePolicy(sizePolicy);
    SocioTwitterwidget->setCursor(QCursor(Qt::ArrowCursor));
    SocioTwitterwidget->setAcceptDrops(true);
    SocioTwitterwidget->setWindowTitle(QString::fromUtf8("SocioTwitter"));
    SocioTwitterwidget->setAutoFillBackground(false);
    SocioTwitterwidget->setStyleSheet(QString::fromUtf8("QWidget{   \n"
                                      "background:transparent;\n"
                                      "transparent-color:black;\n"
                                      "background-color:qlineargradient(spread:pad, x1:0.604, y1:0.409, x2:0.193, y2:0.938, stop:0.233503 rgba(1, 0, 		0,255))\n"
                                      "\n"
                                      "\n"
                                      "  }"));

    lineEdit = new QLineEdit(SocioTwitterwidget);
    lineEdit->setObjectName(QString::fromUtf8("lineEdit"));
    lineEdit->setGeometry(QRect(0, 370, 271, 41));
    QSizePolicy sizePolicy1(QSizePolicy::Fixed, QSizePolicy::Fixed);
    sizePolicy1.setHorizontalStretch(0);
    sizePolicy1.setVerticalStretch(0);
    sizePolicy1.setHeightForWidth(lineEdit->sizePolicy().hasHeightForWidth());

    lineEdit->setSizePolicy(sizePolicy1);
    lineEdit->setFocusPolicy(Qt::StrongFocus);
    lineEdit->setStyleSheet(QString::fromUtf8("QLineEdit {     \n"
                            " border: 1px solid gray;     \n"
                            " border-radius: 5px;     \n"
                            " padding: 0 8px;     \n"
                            " background: beige;     \n"
                            " selection-background-color: darkgray;\n"
                            "  }"));

    scrollArea = new QScrollArea(SocioTwitterwidget);
    scrollArea->setObjectName(QString::fromUtf8("scrollArea"));
    scrollArea->setGeometry(QRect(0, 40, 271, 331));

    QSizePolicy sizePolicy2(QSizePolicy::Fixed, QSizePolicy::Fixed);

    sizePolicy2.setHorizontalStretch(10);
    sizePolicy2.setVerticalStretch(0);
    sizePolicy2.setHeightForWidth(scrollArea->sizePolicy().hasHeightForWidth());

    scrollArea->setSizePolicy(sizePolicy2);
    scrollArea->setAcceptDrops(true);
    scrollArea->setAutoFillBackground(true);
    scrollArea->setFrameShape(QFrame::NoFrame);
    scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    scrollArea->setWidgetResizable(true);
    scrollArea->setAlignment(Qt::AlignHCenter | Qt::AlignTop);

    scrollAreaWidgetContents = new QWidget();
    scrollAreaWidgetContents->setObjectName(QString::fromUtf8("scrollAreaWidgetContents"));
    scrollAreaWidgetContents->setGeometry(QRect(0, 0, 267, 327));

    graphicsView = new QGraphicsView(scrollAreaWidgetContents);
    graphicsView->setObjectName(QString::fromUtf8("graphicsView"));
    graphicsView->setGeometry(QRect(10, 20, 61, 51));
    graphicsView->setFrameShadow(QFrame::Raised);
    graphicsView->setLineWidth(1);
    graphicsView->setMidLineWidth(0);
    graphicsView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    graphicsView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

    graphicsView_2 = new QGraphicsView(scrollAreaWidgetContents);
    graphicsView_2->setObjectName(QString::fromUtf8("graphicsView_2"));
    graphicsView_2->setGeometry(QRect(10, 80, 61, 51));
    graphicsView_2->setFrameShape(QFrame::StyledPanel);

    graphicsView_3 = new QGraphicsView(scrollAreaWidgetContents);
    graphicsView_3->setObjectName(QString::fromUtf8("graphicsView_3"));
    graphicsView_3->setGeometry(QRect(10, 140, 61, 51));
    graphicsView_3->setFrameShape(QFrame::NoFrame);

    graphicsView_4 = new QGraphicsView(scrollAreaWidgetContents);
    graphicsView_4->setObjectName(QString::fromUtf8("graphicsView_4"));
    graphicsView_4->setGeometry(QRect(10, 200, 61, 51));
    graphicsView_4->setFrameShape(QFrame::StyledPanel);

    graphicsView_5 = new QGraphicsView(scrollAreaWidgetContents);
    graphicsView_5->setObjectName(QString::fromUtf8("graphicsView_5"));
    graphicsView_5->setGeometry(QRect(10, 260, 61, 51));
    graphicsView_5->setFrameShape(QFrame::NoFrame);

    textBrowser = new QTextBrowser(scrollAreaWidgetContents);
    textBrowser->setObjectName(QString::fromUtf8("textBrowser"));
    textBrowser->setGeometry(QRect(80, 20, 181, 51));
    textBrowser->setFrameShape(QFrame::Box);

    textBrowser_2 = new QTextBrowser(scrollAreaWidgetContents);
    textBrowser_2->setObjectName(QString::fromUtf8("textBrowser_2"));
    textBrowser_2->setGeometry(QRect(80, 80, 181, 51));
    textBrowser_2->setFrameShape(QFrame::NoFrame);

    textBrowser_3 = new QTextBrowser(scrollAreaWidgetContents);
    textBrowser_3->setObjectName(QString::fromUtf8("textBrowser_3"));
    textBrowser_3->setGeometry(QRect(80, 140, 181, 51));
    textBrowser_3->setFrameShape(QFrame::NoFrame);

    textBrowser_4 = new QTextBrowser(scrollAreaWidgetContents);
    textBrowser_4->setObjectName(QString::fromUtf8("textBrowser_4"));
    textBrowser_4->setGeometry(QRect(80, 200, 181, 51));
    textBrowser_4->setFrameShape(QFrame::NoFrame);

    textBrowser_5 = new QTextBrowser(scrollAreaWidgetContents);
    textBrowser_5->setObjectName(QString::fromUtf8("textBrowser_5"));
    textBrowser_5->setGeometry(QRect(80, 260, 181, 51));
    textBrowser_5->setFrameShape(QFrame::NoFrame);

    scrollArea->setWidget(scrollAreaWidgetContents);

    pushButton = new QPushButton(SocioTwitterClass);
    pushButton->setObjectName(QString::fromUtf8("pushButton"));
    pushButton->setGeometry(QRect(10, 10, 71, 41));

    QFont font;
    font.setBold(true);
    font.setWeight(75);

    pushButton->setFont(font);
    pushButton->setCursor(QCursor(Qt::PointingHandCursor));
    pushButton->setMouseTracking(false);
    pushButton->setFocusPolicy(Qt::StrongFocus);

    OPtions = new QPushButton(SocioTwitterClass);
    OPtions->setObjectName(QString::fromUtf8("OPtions"));
    OPtions->setEnabled(true);
    OPtions->setGeometry(QRect(80, 10, 71, 41));

    QPalette palette;
    QLinearGradient gradient(0.604, 0.409, 0.193, 0.938);

    gradient.setSpread(QGradient::PadSpread);
    gradient.setCoordinateMode(QGradient::ObjectBoundingMode);
    gradient.setColorAt(0.233503, QColor(1, 0, 0, 255));
    QBrush brush(gradient);

    palette.setBrush(QPalette::Active, QPalette::Button, brush);
    QBrush brush1(QColor(169, 169, 169, 255));
    brush1.setStyle(Qt::SolidPattern);
    palette.setBrush(QPalette::Active, QPalette::Highlight, brush1);
    QLinearGradient gradient1(0.604, 0.409, 0.193, 0.938);
    gradient1.setSpread(QGradient::PadSpread);
    gradient1.setCoordinateMode(QGradient::ObjectBoundingMode);
    gradient1.setColorAt(0.233503, QColor(1, 0, 0, 255));

    QBrush brush2(gradient1);
    palette.setBrush(QPalette::Inactive, QPalette::Button, brush2);
    palette.setBrush(QPalette::Inactive, QPalette::Highlight, brush1);
    QLinearGradient gradient2(0.604, 0.409, 0.193, 0.938);

    gradient2.setSpread(QGradient::PadSpread);
    gradient2.setCoordinateMode(QGradient::ObjectBoundingMode);
    gradient2.setColorAt(0.233503, QColor(1, 0, 0, 255));

    QBrush brush3(gradient2);
    palette.setBrush(QPalette::Disabled, QPalette::Button, brush3);
    palette.setBrush(QPalette::Disabled, QPalette::Highlight, brush1);
    OPtions->setPalette(palette);

    QFont font1;
    font1.setFamily(QString::fromUtf8("Sans Serif"));
    font1.setPointSize(10);
    font1.setBold(true);
    font1.setWeight(75);

    OPtions->setFont(font1);
    OPtions->setCursor(QCursor(Qt::PointingHandCursor));
    OPtions->setAutoDefault(false);
    OPtions->setDefault(false);
    OPtions->setFlat(false);

    retranslateUi(SocioTwitterClass);

    QMetaObject::connectSlotsByName(SocioTwitterClass);
}
Exemplo n.º 21
0
void CPenBrushUnit::ReDraw(CDC* memDC,DataInfo &pDataInfo)
{
	CPoint sPoint,ePoint,psPoint,pePoint,ptPoint;	
	double dx,dy,xlen,ylen;
	double preWidth,nWidth;
	Matrix matrix;
	int count=1;
	int alpha;
	int v=0;
	int Red,Green,Blue;
	Red=GetRValue(pDataInfo.penColor);
	Green=GetGValue(pDataInfo.penColor);
	Blue=GetBValue(pDataInfo.penColor);
	SolidBrush brush(Color(255,Red,Green,Blue));
	SolidBrush brush1(Color(200,Red,Green,Blue));
	Graphics mGraphics(memDC->m_hDC);
	mGraphics.TranslateTransform(pDataInfo.CenterPoint.x,pDataInfo.CenterPoint.y);
	mGraphics.RotateTransform(pDataInfo.RotateAngle);
	mGraphics.SetSmoothingMode(SmoothingModeAntiAlias);
	mGraphics.ScaleTransform(pDataInfo.xScale,pDataInfo.yScale);
	///////////////////////////////////
	Region tRgn;
	Region *ptRgn=tRgn.FromHRGN(pDataInfo.hRgn);
	if(ptRgn != NULL)
	mGraphics.ExcludeClip(ptRgn);	
	delete ptRgn;
	////////////////////////////////////
	int Size=pDataInfo.AllRate.size();
	sPoint=CaculatePoint(pDataInfo.StartPoint,pDataInfo);
	ePoint=CaculatePoint(pDataInfo.EndPoint,pDataInfo);
	xlen=ePoint.x-sPoint.x;
	ylen=ePoint.y-sPoint.y;
	if(xlen<1)
		xlen=1;
	if(ylen<1)
		ylen=1;
	if(fwidth.size()!=0)
		fwidth.clear();
	fwidth.insert(std::map<DWORD,float>::value_type(0,pDataInfo.AllRate[0].preWidth));
	alpha=pDataInfo.AllRate[0].alpha;

	psPoint.x=sPoint.x+xlen*pDataInfo.AllRate[0].xRate;
	psPoint.y=sPoint.y+ylen*pDataInfo.AllRate[0].yRate;
	for(int Index=1;Index<Size;Index++)	
	{
		pePoint.x=sPoint.x+xlen*pDataInfo.AllRate[Index].xRate;
		pePoint.y=sPoint.y+ylen*pDataInfo.AllRate[Index].yRate;

		if(Index==1)
			PushStart(psPoint,0);
		if(Push(psPoint,pePoint,0))
		{
			RectF headRect;
			RectF tailRect;
			float width,dx,dy;
			PointF lfCenter,rtCenter;
			mGraphics.FillPolygon(&brush,pts,npts);
			mGraphics.DrawPolygon(&Pen(Color(200,Red,Green,Blue),1),pts,npts);
			if(npts==4)
			{
				headRect=RectF((pts[0].X+pts[3].X)/2.0f,(pts[0].Y+pts[3].Y)/2.0f,0.0f,0.0f);
				tailRect=RectF((pts[1].X+pts[2].X)/2.0f,(pts[1].Y+pts[2].Y)/2.0f,0.0f,0.0f);
				dx=pts[3].X-pts[0].X;
				dy=pts[3].Y-pts[0].Y;
				width=sqrt(dx*dx+dy*dy)/2.0f+0.5f;
				headRect.Inflate(width,width);
				dx=pts[2].X-pts[1].X;
				dy=pts[2].Y-pts[1].Y;
				width=sqrt(dx*dx+dy*dy)/2.0f+0.5f;
				tailRect.Inflate(width,width);
			}
			else
			{
				headRect=RectF((pts[0].X+pts[9].X)/2.0f,(pts[0].Y+pts[9].Y)/2.0f,0.0f,0.0f);
				tailRect=RectF((pts[4].X+pts[5].X)/2.0f,(pts[4].Y+pts[5].Y)/2.0f,0.0f,0.0f);
				dx=pts[9].X-pts[0].X;
				dy=pts[9].Y-pts[0].Y;
				width=sqrt(dx*dx+dy*dy)/2.0f+0.5f;
				headRect.Inflate(width,width);
				dx=pts[5].X-pts[4].X;
				dy=pts[5].Y-pts[4].Y;
				width=sqrt(dx*dx+dy*dy)/2.0f+0.5f;
				tailRect.Inflate(width,width);
			}
			mGraphics.FillEllipse(&brush1,headRect);
			mGraphics.FillEllipse(&brush1,tailRect);


			//preWidth=nWidth;
			psPoint=pePoint;
		}
	}
	mGraphics.ResetTransform();
}
Exemplo n.º 22
0
void BotTargetList::updateMapInformation()
{
    const QList<QListWidgetItem*> &selectedItems=ui->bots->selectedItems();
    if(selectedItems.size()!=1)
        return;
    const QString &pseudo=selectedItems.at(0)->text();
    if(!pseudoToBot.contains(pseudo))
        return;
    MultipleBotConnection::CatchChallengerClient * client=pseudoToBot.value(pseudo);
    if(!actionsAction->clientList.contains(client->api))
        return;

    QList<QColor> colorsList;
    colorsList << QColor(200, 70, 70, 255);
    colorsList << QColor(255, 255, 0, 255);
    colorsList << QColor(70, 187, 70, 255);
    colorsList << QColor(100, 100, 200, 255);
    colorsList << QColor(255, 128, 128, 255);
    colorsList << QColor(180, 70, 180, 255);
    colorsList << QColor(255, 200, 110, 255);
    colorsList << QColor(115, 255, 240, 255);
    colorsList << QColor(115, 255, 120, 255);

    const ActionsBotInterface::Player &player=actionsAction->clientList.value(client->api);

    if(actionsAction->id_map_to_map.find(mapId)!=actionsAction->id_map_to_map.cend())
    {
        const std::string &mapStdString=actionsAction->id_map_to_map.at(mapId);
        CatchChallenger::CommonMap *map=actionsAction->map_list.at(mapStdString);
        MapServerMini *mapServer=static_cast<MapServerMini *>(map);
        if((uint32_t)ui->comboBoxStep->currentIndex()>=mapServer->step.size())
            return;
        MapServerMini::MapParsedForBot &step=mapServer->step.at(ui->comboBoxStep->currentIndex());
        if(step.map==NULL)
            return;
        QString QtGraphvizText=QString::fromStdString(step.graphvizText);

        if(actionsAction->id_map_to_map.find(player.mapId)!=actionsAction->id_map_to_map.cend())
        {
            const std::string &playerMapStdString=actionsAction->id_map_to_map.at(mapId);
            CatchChallenger::CommonMap *playerMap=actionsAction->map_list.at(playerMapStdString);
            QString mapString=QString::fromStdString(playerMap->map_file)+QString(" (%1,%2)").arg(player.x).arg(player.y);
            ui->label_local_target->setTitle("Target on the map: "+mapString+", displayed map: "+QString::fromStdString(mapStdString));
        }
        else
            ui->label_local_target->setTitle("Unknown player map ("+QString::number(player.mapId)+")");

        ui->mapPreview->setColumnCount(0);
        ui->mapPreview->setRowCount(0);
        /*ui->mapPreview->setColumnCount(mapServer->max_x-mapServer->min_x);
        ui->mapPreview->setRowCount(mapServer->max_y-mapServer->min_y);*/
        ui->mapPreview->setColumnCount(mapServer->max_x-mapServer->min_x);
        ui->mapPreview->setRowCount(mapServer->max_y-mapServer->min_y);

        {
            int y=mapServer->min_y;
            while(y<mapServer->max_y)
            {
                int x=mapServer->min_x;
                while(x<mapServer->max_x)
                {
                    QTableWidgetItem *tablewidgetitem = new QTableWidgetItem();
                    //color
                    int codeZone=step.map[x+y*mapServer->width];
                    if(codeZone>0)
                    {
                        QColor color=colorsList[codeZone%colorsList.size()];
                        QBrush brush1(color);
                        brush1.setStyle(Qt::SolidPattern);
                        tablewidgetitem->setBackground(brush1);
                        tablewidgetitem->setText(QString::number(codeZone));
                    }
                    //icon
                    if(x==player.x && y==player.y && player.mapId==mapId)
                    {
                        QIcon icon;
                        icon.addFile(QStringLiteral(":/playerloc.png"), QSize(), QIcon::Normal, QIcon::Off);
                        tablewidgetitem->setText("");
                        tablewidgetitem->setIcon(icon);
                    }
                    ui->mapPreview->setItem(y-mapServer->min_y,x-mapServer->min_x,tablewidgetitem);

                    x++;
                }
                y++;
            }
        }
        {
            ui->comboBox_Layer->clear();
            unsigned int index=0;
            while(index<step.layers.size())
            {
                const MapServerMini::MapParsedForBot::Layer &layer=step.layers.at(index);

                if(layer.name!="Lost layer" || !layer.contentList.empty())
                {
                    ui->comboBox_Layer->addItem(QString::fromStdString(layer.name),index);

                    const unsigned int codeZone=(index+1);
                    QColor color=colorsList[codeZone%colorsList.size()];
                    //replace struct1 [label="<f0> Block 1|<f1> w"]\n -> struct1 [label="<f0> Block 1|<f1> w" style=filled fillcolor="#FFFEE0"]\n
                    QRegularExpression regexcolor("(\nstruct"+QString::number(codeZone)+" [^\n]+)[^\n;]\n",QRegularExpression::InvertedGreedinessOption);
                    QtGraphvizText.replace(regexcolor,"\\1 style=filled fillcolor=\""+color.name(QColor::HexRgb)+"\"]\n");
                }

                index++;
            }
            if(step.graphvizText.empty())
                ui->graphvizText->setVisible(false);
            else
            {
                ui->graphvizText->setVisible(true);
                ui->graphvizText->setPlainText(QtGraphvizText);
            }
        }
    }
    else
        ui->label_local_target->setTitle("Unknown map ("+QString::number(mapId)+")");
    updateLayerElements();
}
Exemplo n.º 23
0
void CTTCheckBtnGroup::DrawGradient(CDC* pDC, CRect rect)
{
	Color gdipBaseColor, gdipLightColor;

	COLORREF baseColor = m_ColorMap.GetColor(Press, BackgroundTopGradientStart);
	HLSColor hlsBaseColor = RgbToHls(baseColor);
	if (hlsBaseColor.L > 0.8)
	{
	
		COLORREF darkColor = GetLumColor(baseColor, -0.3);

		gdipBaseColor.SetFromCOLORREF(baseColor);
		gdipLightColor.SetFromCOLORREF(darkColor);
	}
	else
	{
		COLORREF lightColor = GetLumColor(baseColor, 0.3);

		gdipBaseColor.SetFromCOLORREF(baseColor);
		gdipLightColor.SetFromCOLORREF(lightColor);
	}	

	Graphics graphics(pDC->GetSafeHdc());
	graphics.SetSmoothingMode(SmoothingModeAntiAlias);
	graphics.SetInterpolationMode(InterpolationModeHighQualityBicubic);

	// Draw frag rectangle
	Rect boundsRect(rect.left, rect.top, rect.Width(), rect.Height());

	GraphicsPath path;
	GetRoundRectPath(&path, boundsRect, 8);
	
	Rect upperRect(boundsRect);
	upperRect.Height = boundsRect.Height / 2;

	Rect lowerRect(boundsRect);
	lowerRect.Y = upperRect.GetBottom() - 1;
	lowerRect.Height = boundsRect.Height - upperRect.Height;

	
	Rect upGradRect(upperRect);
	upGradRect.Inflate(0, 1);

	Rect loGradRect(lowerRect);
	loGradRect.Inflate(0, 1);

	LinearGradientBrush brush1(upGradRect, gdipLightColor, gdipBaseColor, LinearGradientMode::LinearGradientModeVertical);
	LinearGradientBrush brush2(loGradRect, gdipBaseColor, gdipBaseColor, LinearGradientMode::LinearGradientModeVertical);

	//SolidBrush brush(baseColor);

	//graphics.FillRectangle(&brush, upperRect);
	//graphics.FillPath(&brush1, &path);

	Region wholeRgn(&path);

	Region upperRgn(upperRect);
	upperRgn.Intersect(&wholeRgn);

	Region lowerRgn(lowerRect);
	lowerRgn.Intersect(&wholeRgn);

	graphics.FillRegion(&brush1, &upperRgn);
	graphics.FillRegion(&brush2, &lowerRgn);

	//SolidBrush brush(gdipFragColor);
	//graphics.FillPath(&brush, &path);
}
void BoardDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
	// Проверки
	if (!index.isValid())
		return;
	int row = index.row();
	if (row <= 0 || row >= model_->rowCount() - 1)
		return;
	int col = index.column();
	if (col <= 0 || col >= model_->columnCount() - 1)
		return;
	painter->save();
	QRectF rect(option.rect);
	// Отрисовка фона
	if (skin == 0) {
		QBrush fill_brush(QColor(220, 179, 92, 255), Qt::SolidPattern);
		painter->fillRect(rect, fill_brush);
	} else {
		QPixmap *pixmap = pixmaps->getBoardPixmap(col - 1, row - 1, rect.width(), rect.height());
		painter->drawPixmap(rect, *pixmap, pixmap->rect());
	}
	QBrush brush1(Qt::SolidPattern);
	int row_min = 2;
	int row_max = model_->rowCount() - 3;
	int col_min = 2;
	int col_max = model_->columnCount() - 3;
	if (row >= row_min && row <= row_max && col >= col_min && col <= col_max) {
		// Отрисовка центральных линий
		qreal x = rect.left() + rect.width() / 2.0;
		qreal y = rect.top() + rect.height() / 2.0;
		painter->setPen(Qt::darkGray);
		painter->drawLine(rect.left(), y - 1, rect.right(), y - 1);
		painter->drawLine(x - 1, rect.top(), x - 1, rect.bottom());
		painter->setPen(Qt::lightGray);
		painter->drawLine(rect.left(), y, rect.right(), y);
		painter->drawLine(x, rect.top(), x, rect.bottom());
		// Отрисовка разделителя
		if (row == row_min || col == col_min || row == row_max || col == col_max) {
			painter->setPen(Qt::black);
			if (row == row_min) {
				painter->drawLine(rect.topLeft(), rect.topRight());
			} else if (row == row_max) {
				QPointF p1 = rect.bottomLeft();
				p1.setY(p1.y() - 1.0);
				QPointF p2 = rect.bottomRight();
				p2.setY(p2.y() - 1.0);
				painter->drawLine(p1, p2);
			}
			if (col == col_min) {
				painter->drawLine(rect.topLeft(), rect.bottomLeft());
			} else if (col == col_max) {
				QPointF p1 = rect.topRight();
				p1.setX(p1.x() - 1);
				QPointF p2 = rect.bottomRight();
				p2.setX(p2.x() - 1);
				painter->drawLine(p1, p2);
			}
		}
		if (model_->selectX == col && model_->selectY == row) {
			brush1.setColor(QColor(0, 255, 0, 64));
			painter->fillRect(rect, brush1);
		}
		// Отрисовка если курсор мыши над клеткой
		if (option.state & QStyle::State_MouseOver) {
			brush1.setColor(QColor(0, 0, 0, 32));
			painter->fillRect(rect, brush1);
		}
		rect.setWidth(rect.width() - 1);
		rect.setHeight(rect.height() - 1);
		// Отрисовка если клетка выбрана
		if (option.state & QStyle::State_Selected) {
			QRectF rect2(rect);
			rect2.setLeft(rect2.left() + 1);
			rect2.setTop(rect2.top() + 1);
			rect2.setWidth(rect2.width() - 1);
			rect2.setHeight(rect2.height() - 1);
			painter->setPen(Qt::gray);
			painter->drawRect(rect2);
		}
		// Отрисовка элемента
		const GameElement *el = model_->getGameElement(col, row);
		if (el) {
			el->paint(painter, rect);
		}
	} else {
		// Рисуем координаты
		if ((row == 1 || row == model_->columnCount() - 2) && col >= 2 && col <= model_->columnCount() - 3) {
			// Буквы
			QString text = horHeaderString.at(col - 2);
			painter->drawText(rect, Qt::AlignCenter,text, 0);
		} else if ((col == 1 || model_->rowCount() - 2) && row >= 2 && row <= model_->rowCount() - 3) {
			// Цифры
			QString text = QString::number(row - 1);
			painter->drawText(rect, Qt::AlignCenter,text, 0);
		}
	}
	painter->restore();
}
Exemplo n.º 25
0
void CMapManagerView::OnMouseMove(UINT nFlags, CPoint point) 
{
	CMapManagerDoc* pDoc=GetDocument();
	//判断是否打开图形文件
	if(m_IsLoadMap)
	{	
         CClientDC dc(this);
		
		 dc.SetROP2(R2_NOTXORPEN);//设置绘图异或模式
		 OnPrepareDC(&dc);				
		 POINT mousepoint = point;	//记录鼠标点击的位置(设备坐标)			 
		 dc.DPtoLP(&mousepoint);//由设备坐标(客户区坐标)转换为逻辑坐标(窗口坐标)	     		
		 FillStatusCoord(mousepoint); //状态栏显示
        //捕获鼠标状态
		if(GetCapture()==this)
		{
			//矩形放大
			if(m_CurOper == ID_ZOOMIN)
			{
				HCURSOR hcurHand;
				hcurHand= AfxGetApp()->LoadCursor(IDC_ZOOMIN);
				SetCapture();
				::SetCursor(hcurHand);//调用光标资源
				//清除先前的矩形
				dc.Rectangle(m_rtZoom.left,m_rtZoom.top,m_rtZoom.right,m_rtZoom.bottom);
				
				m_rtZoom.right = mousepoint.x;
				m_rtZoom.bottom = mousepoint.y;				
				//绘制新矩形
				dc.Rectangle(m_rtZoom.left,m_rtZoom.top,m_rtZoom.right,m_rtZoom.bottom);
			}
		

			if (m_CurOper==ID_ZOOMOUT)
			{
				HCURSOR hcurHand;
				hcurHand= AfxGetApp()->LoadCursor(IDC_ZOOMOUT);
				SetCapture();
				::SetCursor(hcurHand);//调用光标资源
				dc.Rectangle(m_rtZoom.left,m_rtZoom.top,m_rtZoom.right,m_rtZoom.bottom);
				
				m_rtZoom.right = mousepoint.x;
				m_rtZoom.bottom = mousepoint.y;
				
				//绘制新矩形
				dc.Rectangle(m_rtZoom.left,m_rtZoom.top,m_rtZoom.right,m_rtZoom.bottom);

			}

           //点漫游操作
	       if(m_CurOper == ID_PAN)
		   {
		   		HCURSOR hcurHand;
				hcurHand= AfxGetApp()->LoadCursor(IDC_PAN1);
				SetCapture();
				SetCursor(hcurHand);//调用光标资源
		       //记录结束点
			    m_rtZoom.right = mousepoint.x;
		        m_rtZoom.bottom = mousepoint.y;

			    ZoomMove();
	    		hcurHand= AfxGetApp()->LoadCursor(IDC_PAN2);
	    		SetCursor(hcurHand);
			    Invalidate();
	    
		   }
		 }
	       if (m_CurOper==ID_MEASUREDISTANCE && (m_bCountDis==1))
		   {
			   if (m_PointOld!=point)
			   {
				   	dc.SetROP2(R2_NOTXORPEN);
					CPen pen1(PS_SOLID,3,RGB(0,0,255));
					CPen *pOldPen1=dc.SelectObject(&pen1);
					CBrush brush1(HS_DIAGCROSS,RGB(3,200,200));
					CBrush *pOldBrush1=dc.SelectObject(&brush1);
					//嚓除以前的多边形
					CPoint *pPolyPoint=new CPoint[CountArray.GetSize()+1];
					for(int i=0;i<CountArray.GetSize();i++)
					{
						pPolyPoint[i]=CountArray.GetAt(i);
					}
					//利用异或线擦去原来的矩形;
					pPolyPoint[CountArray.GetSize()]=m_PointOld;
					dc.Polyline(pPolyPoint,CountArray.GetSize()+1);
				
					pPolyPoint[CountArray.GetSize()]=mousepoint;
					dc.Polyline(pPolyPoint,CountArray.GetSize()+1);
					m_PointOld=mousepoint;
					delete [] pPolyPoint;

			   }
		   }
		 
		   if(m_CurOper == ID_MEASUREAREA && (m_bCountArea==1))
			{
				if(m_PointOld!=point)
				{
				
					dc.SetROP2(R2_NOTXORPEN);
					CPen pen1(PS_DOT,1,RGB(0,0,255));
					CPen *pOldPen1=dc.SelectObject(&pen1);
					CBrush brush1(HS_DIAGCROSS,RGB(3,200,200));
					CBrush *pOldBrush1=dc.SelectObject(&brush1);
					//嚓除以前的多边形
					CPoint *pPolyPoint=new CPoint[CountArray.GetSize()+1];
					for(int i=0;i<CountArray.GetSize();i++)
					{
						pPolyPoint[i]=CountArray.GetAt(i);
					}
					//利用异或线擦去原来的矩形;
					pPolyPoint[CountArray.GetSize()]=m_PointOld;
					dc.Polygon(pPolyPoint,CountArray.GetSize()+1);
				
					pPolyPoint[CountArray.GetSize()]=mousepoint;
					dc.Polygon(pPolyPoint,CountArray.GetSize()+1);
					m_PointOld=mousepoint;
					delete [] pPolyPoint;
				}	
			}
		
	}
	
	CView::OnMouseMove(nFlags, point);
}
Exemplo n.º 26
0
void CMapManagerView::OnLButtonDblClk(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	if(m_CurOper == ID_MEASUREDISTANCE)
	{
		m_bCountDis=0;
		CDC *pDC=GetDC();
		pDC->SetBkMode(TRANSPARENT);
		CPen pen(PS_SOLID,2,RGB(0,255,0));
        CPen *pOldPen=pDC->SelectObject(&pen);
		CBrush brush(RGB(200,255,200));
		CFont font;
		font.CreateFont(15,0,0,0,0,0,0,0,0,OUT_DEFAULT_PRECIS,CLIP_CHARACTER_PRECIS 
			,DEFAULT_QUALITY,DEFAULT_PITCH&FF_SWISS,"宋体");
		CFont *pOldFont=pDC->SelectObject(&font);
		CBrush *pOldBrush=pDC->SelectObject(&brush);
		pDC->Rectangle(point.x+5,point.y+5,point.x+208,point.y+60);
		
		float disX,disY,DisXY;
		float TempResult=0.0;
		for(int i=0;i<CountArray.GetSize()-1;i++)
		{
			disX=CountArray.GetAt(i+1).x-CountArray.GetAt(i).x;
			disY=CountArray.GetAt(i+1).y-CountArray.GetAt(i).y;
			DisXY=sqrt(disX*disX+disY*disY);
			TempResult+=DisXY;
		}
		
		CString ss;
		TempResult=labs(TempResult);
		ss.Format("%f",TempResult);
		ss="直线距离"+ss+"米";
		
		pDC->TextOut(point.x+15,point.y+15,ss);
		
		
		CountArray.RemoveAll();//清除当前记录点轨迹坐标串数组
	}
	if(m_CurOper == ID_MEASUREAREA)
	{
		m_bCountArea=0;
		CDC *pDC1=GetDC(); 			
		OnPrepareDC(pDC1);
		pDC1->SetBkMode(TRANSPARENT);//使当前字体无背景色
		CPen pen1(PS_DOT,1,RGB(0,0,255));
		CBrush brush1(HS_DIAGCROSS,RGB(3,200,200));
		CPen *pOldPen1=pDC1->SelectObject(&pen1);
		CBrush *pOldBrush1=pDC1->SelectObject(&brush1);
		int m_Number=CountArray.GetSize();
		CPoint *p_Point=new CPoint[m_Number];
		for(int i=0;i<m_Number;i++)
		{
			p_Point[i]=CountArray.GetAt(i);//画一个区域多变形
		}
		pDC1->Polygon(p_Point,m_Number);
		delete []p_Point;
		
	
		CDC *pDC=GetDC();
		pDC->SetBkMode(TRANSPARENT);
		CPen pen(PS_DOT,1,RGB(250,0,0));
        CPen *pOldPen=pDC->SelectObject(&pen);
		CBrush brush(RGB(200,255,200));
		CFont font;
		font.CreateFont(15,0,0,0,0,0,0,0,0,OUT_DEFAULT_PRECIS,CLIP_CHARACTER_PRECIS 
			,DEFAULT_QUALITY,DEFAULT_PITCH&FF_SWISS,"宋体");
		CFont *pOldFont=pDC->SelectObject(&font);
		CBrush *pOldBrush=pDC->SelectObject(&brush);
		pDC->Rectangle(point.x+5,point.y+5,point.x+200,point.y+50);
		
		float Result=0.0;
		float Area;
		if(CountArray.GetSize()>2)
		{
			CountArray.Add(CountArray.GetAt(0));
			for(int i=0;i<CountArray.GetSize()-1;i++)
			{
				CPoint Point1=CountArray.GetAt(i+1);
				CPoint Point0=CountArray.GetAt(i);
				

				Area=(-1)*(Point0.x*Point1.y-Point1.x*Point0.y)/2;
				Result+=Area;
			}
		}
		
		CString pp;
		Result=labs(Result);
		pp.Format("%f",Result);
		pp="面积"+pp+"平方米";
		pDC->TextOut(point.x+15,point.y+15,pp);
		
		CountArray.RemoveAll();//清除当前记录点轨迹坐标串数组
	}
	CView::OnLButtonDblClk(nFlags, point);
}
Exemplo n.º 27
0
gamewidget::gamewidget(QWidget *parent) : QWidget(parent)
{
    this->setAutoFillBackground(true);//覆盖
    this->resize(580,340);
    this->setWindowIcon(QIcon("image/snake.ico"));
    this->setWindowTitle("贪吃蛇");

    QPalette palette2;
    QBrush brush1(QPixmap("image/bj.jpg").scaled(580,340));
    palette2.setBrush(QPalette::Background,brush1);
    this->setPalette(palette2);
//    //按钮区
    Leftbtn = new QPushButton(QIcon("image/left.png"),"",this);
    Leftbtn->setIconSize(QSize(35,35));
    Leftbtn->setGeometry(425,150,35,35);
    Leftbtn->setFlat(true);

    Rightbtn = new QPushButton(QIcon("image/right.png"),"",this);
    Rightbtn->setIconSize(QSize(35,35));
    Rightbtn->setGeometry(505,150,35,35);
    Rightbtn->setFlat(true);

    Upbtn = new QPushButton(QIcon("image/up.png"),"",this);
    Upbtn->setIconSize(QSize(35,35));
    Upbtn->setGeometry(465,110,35,35);
    Upbtn->setFlat(true);


    Downbtn = new QPushButton(QIcon("image/down.png"),"",this);
    Downbtn->setIconSize(QSize(35,35));
    Downbtn->setGeometry(465,190,35,35);
    Downbtn->setFlat(true);

    Startbtn = new QPushButton(QIcon("image/ks.png"),"",this);
    Startbtn->setIconSize(QSize(35,35));
    Startbtn->setGeometry(415,270,35,35);
    Startbtn->setFlat(true);


    Pausebtn = new QPushButton(QIcon("image/zt.png"),"",this);
    Pausebtn->setIconSize(QSize(35,35));
    Pausebtn->setGeometry(465,270,35,35);
    Pausebtn->setFlat(true);

    Exitbtn = new QPushButton(QIcon("image/fh.png"),"",this);
    Exitbtn->setIconSize(QSize(35,35));
    Exitbtn->setGeometry(515,270,35,35);
    Exitbtn->setFlat(true);

//    //连接信号和槽
    connect(Leftbtn,SIGNAL(clicked(bool)),this,SLOT(Leftbtn_click()));
    connect(Rightbtn,SIGNAL(clicked(bool)),this,SLOT(Rightbtn_click()));
    connect(Upbtn,SIGNAL(clicked(bool)),this,SLOT(Upbtn_cliak()));
    connect(Downbtn,SIGNAL(clicked(bool)),this,SLOT(Downbtn_click()));
    connect(Startbtn,SIGNAL(clicked(bool)),this,SLOT(Startbtn_click()));
    connect(Pausebtn,SIGNAL(clicked(bool)),this,SLOT(Pausebtn_click()));
    connect(Exitbtn,SIGNAL(clicked(bool)),this,SLOT(Exitbtn_click()));


    //设置起始信息
    QTime tim1;
    tim1 = QTime().currentTime();
    int seed = tim1.second();
    qsrand(seed);
    snake[0][0] = qrand()%12;
    snake[0][1] = qrand()%10;
    Drec = qrand()%4;
    FoodPostion();
    foodnum = 0;
    score = 0;
    //设置时钟
    timer1 = new QTimer(this);
    connect(timer1,SIGNAL(timeout()),this,SLOT(Timer_out()));

}
Exemplo n.º 28
0
void  QmaxButton::createButton(QPainter &painter)
{
    QRect scaledRect;
    scaledRect = matrix.mapRect(QRect(0,0,this->logicalSize.width(),this->logicalSize.height()));
    QImage bg(this->m_strImage);
    painter.setRenderHint(QPainter::SmoothPixmapTransform);
    painter.setRenderHint(QPainter::Antialiasing);
    painter.setPen(Qt::NoPen);
    QLinearGradient brush1(0,0,0,scaledRect.height());
    painter.drawImage(-2, -2, bg);


    if(Colors::useEightBitPalette)
    {
        painter.setPen(QColor(120,120,120));
        if(this->m_nPressed)
            painter.setBrush(QColor(60,60,60));
        else if(this->m_nHighlight)
            painter.setBrush(QColor(100,100,100));
        else
            painter.setBrush(QColor(80,80,80));
    }
    else
    {
        QLinearGradient outlinebrush(0,0,0,scaledRect.height());
        QLinearGradient brush(0,0,0,scaledRect.height());

        brush.setSpread(QLinearGradient::PadSpread);
        QColor highlight(255,255,255,128);
        QColor shadow(0,0,0,70);
        QColor sunken(220,220,220,30);
        QColor normal1(255,255,245,60);
        QColor normal2(255,255,235,10);
        QColor normal3(200,200,200,10);
        QColor normal4(255,255,250,255);

         if(m_nType && m_nType != 5  )
         {
            normal1 = QColor(200,170,160,50);
            normal2 = QColor(50,10,0,50);
         }
        if(m_nPressed)
        {
            outlinebrush.setColorAt(0.0f,shadow);
            outlinebrush.setColorAt(1.0f,highlight);
            brush.setColorAt(1.0f,sunken);
            painter.setPen(Qt::NoPen);

        }
        else
        {
            outlinebrush.setColorAt(1.0f,shadow);
            outlinebrush.setColorAt(0.0f,highlight);
            brush.setColorAt(0.0f,normal1);
            if(m_nHighlight)
                brush.setColorAt(1.0f,normal2);
            painter.setPen(QPen(outlinebrush,1));
        }
        if(this->isEnabled()==false )
        {
            outlinebrush.setColorAt(1.0f,shadow);
            outlinebrush.setColorAt(0.0f,highlight);
            brush.setColorAt(0.0f,normal3);
            painter.setPen(QPen(outlinebrush,1));

        }
        if(m_nStatus )
        {
            outlinebrush.setColorAt(1.0f,shadow);
            outlinebrush.setColorAt(0.0f,highlight);
            brush.setColorAt(0.0f,normal4);
            painter.setPen(QPen(outlinebrush,1));
        }
        painter.setBrush(brush);

    }


    if(m_nType == 1)
        painter.drawRect(0,0,scaledRect.width(),scaledRect.height());
    else if(m_nType == 0)
        painter.drawRoundedRect(0,0,scaledRect.width(),scaledRect.height(),40.0,40.0,Qt::RelativeSize);
    else if(m_nType == 5)
        painter.drawEllipse(0,0,scaledRect.width(),scaledRect.height());
    QFont font( "DejaVu Sans" );
    font.setPointSize( 12 );
    painter.setFont( font );
    brush1.setColorAt(1.0f,QColor(255,255,255,255));
    if(this->isEnabled()==false)
    {
        brush1.setColorAt(1.0f,QColor(200,200,200,100));
    }
    painter.setPen(QPen(brush1,1));
    painter.setBrush(brush1);
    QFontMetrics fMetrics = painter.fontMetrics();
    QSize sz = fMetrics.size( Qt::TextWordWrap, m_strText );
    QRectF txtRect( scaledRect.center(), sz );
    int xPoint = (scaledRect.width()/2)- ((m_strText.count()/2)*10);
    int yPoint = scaledRect.height()/2;
    painter.drawText(xPoint,yPoint,m_strText);
}
Exemplo n.º 29
0
void ThemeDownloader::init() {
  wizard_ = new QWizard();
  
  wizard_->setAttribute(Qt::WA_DeleteOnClose);
  
	//The screen width should be 1100 unless the resolution is too low
	int width = 1100;
	if (BumpTopApp::singleton()->screen_resolution().x < width) {
    width = BumpTopApp::singleton()->screen_resolution().x;
	}
	wizard_->resize(width,BumpTopApp::singleton()->screen_resolution().x * 0.5);

	QPalette palette;
	QBrush brush(QColor(243, 243, 227, 255));
	brush.setStyle(Qt::SolidPattern);
	palette.setBrush(QPalette::Active, QPalette::Base, brush);
	palette.setBrush(QPalette::Inactive, QPalette::Base, brush);
	QBrush brush1(QColor(240, 240, 240, 255));
	brush1.setStyle(Qt::SolidPattern);
	palette.setBrush(QPalette::Disabled, QPalette::Base, brush1);
	wizard_->setPalette(palette);
	wizard_->setOptions(QWizard::HelpButtonOnRight);
	
  QWizardPage* page = new QWizardPage(wizard_);
	QVBoxLayout* vertical_layout = new QVBoxLayout(page);

  wizard_->setWindowTitle(QT_TR_NOOP("Customize"));

  web_view_ = new QWebView(page);
  web_view_->page()->setForwardUnsupportedContent(true);
  web_view_->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
  vertical_layout->addWidget(web_view_, 200);
  
  progress_bar_ = new QProgressBar(page);
  progress_bar_->setVisible(false);
  progress_bar_->setMinimum(0);
  vertical_layout->addWidget(progress_bar_, 1);
  
  default_status_message_ = QT_TR_NOOP("Download a theme above, and it will be installed");
  status_ = new QLabel(default_status_message_);
  status_->setFont(QFont("Tahoma", 12));
  vertical_layout->addWidget(status_, 0, Qt::AlignRight);

	page->setLayout(vertical_layout);
	wizard_->addPage(page);
	
	button_layout_ = new QList<QWizard::WizardButton>();
	*button_layout_ << QWizard::Stretch << QWizard::CustomButton1 << QWizard::FinishButton;
	wizard_->setButtonLayout(*button_layout_);
  
	wizard_->setButtonText(QWizard::FinishButton, QT_TR_NOOP("Close"));	
	wizard_->setButtonText(QWizard::CustomButton1, QT_TR_NOOP("Go Back"));
  
	wizard_->setWizardStyle(QWizard::ModernStyle);
	wizard_->setOption(QWizard::HaveHelpButton, false);

  QMetaObject::connectSlotsByName(web_view_->page());
  connect(web_view_->page(), SIGNAL(loadStarted()), this, SLOT(loadStarted()));	
  connect(web_view_->page(), SIGNAL(loadProgress(int)), this, SLOT(loadProgress(int)));	
  connect(web_view_->page(), SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool)));	
  connect(web_view_->page(), SIGNAL(downloadRequested(const QNetworkRequest &)), this, SLOT(downloadRequested(const QNetworkRequest &)));
  connect(web_view_->page(), SIGNAL(unsupportedContent(QNetworkReply *)), this, SLOT(unsupportedContent(QNetworkReply *)));
  connect(web_view_->page(), SIGNAL(linkClicked(const QUrl &)), this, SLOT(linkClicked(const QUrl &)));
  connect(wizard_, SIGNAL(customButtonClicked(int)), this, SLOT(customButtonClicked(int)));
  connect(wizard_, SIGNAL(finished(int)), this, SLOT(exitDialog(int)));

  web_view_->setUrl(QUrl("http://bumptop.customize.org/"));
}