Пример #1
0
Device::Device(QWidget *parent)
    : QWidget(parent)
    , m_vecticalLine(new QFrame)
{
    QHBoxLayout* hbox = new QHBoxLayout;
    setLayout(hbox);

    {
        QGridLayout *layout = new QGridLayout;
        hbox->addLayout(layout);
        for (int i = 0; i < 4; ++i) {
            QLabel* label1 = new QLabel(tr("Line %1.1:").arg(i + 1));
            QLabel* label2 = new QLabel(tr("Line %1:2").arg(i + 1));
            QLabel* label3 = new QLabel(tr("Line %1:3").arg(i + 1));
            layout->addWidget(label1, i, 0);
            layout->addWidget(label2, i, 1);
            layout->addWidget(label3, i, 2);
        }
    }
    {
        hbox->addWidget(m_vecticalLine);

        GlobalContext* m_globalContext = GlobalContext::instance();
        int m_lineWidth=10*m_globalContext->m_dFactorY;
        m_vecticalLine->setEnabled(true);
        //m_vecticalLine->setGeometry(QRect(300, 250, 10, 200));
        m_vecticalLine->setLineWidth(0);
        m_vecticalLine->setMidLineWidth(m_lineWidth);

        QPalette palette1;
        QBrush brush2(QColor(0, 0, 0, 255));
        brush2.setStyle(Qt::SolidPattern);
        palette1.setBrush(QPalette::Active, QPalette::Mid, brush2);
        palette1.setBrush(QPalette::Inactive, QPalette::Mid, brush2);
        palette1.setBrush(QPalette::Disabled, QPalette::Mid, brush2);
        m_vecticalLine->setPalette(palette1);
        m_vecticalLine->setFrameShape(QFrame::VLine);
        m_vecticalLine->setFrameShadow(QFrame::Sunken);
        m_vecticalLine->show();
    }
    {
        QVBoxLayout* vbox = new QVBoxLayout(this);
        hbox->addLayout(vbox);
        {
            QLabel* lbl = new QLabel(tr("Output descriptions"));
            vbox->addWidget(lbl);

            QHBoxLayout* hboxName = new QHBoxLayout;
            vbox->addLayout(hboxName);
            {
                QLabel* lblName = new QLabel(tr("Name: "));
                hboxName->addWidget(lblName);
                QLineEdit* le = new QLineEdit(tr("My Video"));
                hboxName->addWidget(le);
            }
            QHBoxLayout* hboxSave = new QHBoxLayout;
            vbox->addLayout(hboxSave);
            {
                QLabel* lblName = new QLabel(tr("Save to: "));
                hboxSave->addWidget(lblName);
                QLineEdit* le = new QLineEdit;
                hboxSave->addWidget(le);
            }

            QHBoxLayout* hboxResolution = new QHBoxLayout;
            vbox->addLayout(hboxResolution);
            {
                QLabel* lblName = new QLabel(tr("Resolution: "));
                hboxResolution->addWidget(lblName);
                QLabel* lblValue = new QLabel(tr("1334*750"));
                hboxResolution->addWidget(lblValue);

                QToolButton* m_boldButton = new QToolButton;
                m_boldButton->setText(tr("Settings"));
                hboxResolution->addWidget(m_boldButton);
            }
            
            QHBoxLayout* hboxSize = new QHBoxLayout;
            vbox->addLayout(hboxSize);
            {
                QLabel* lblName = new QLabel(tr("Size: "));
                hboxSize->addWidget(lblName);
                QLabel* lblValue = new QLabel(tr("7.9MB"));
                hboxSize->addWidget(lblValue);
            }

            QHBoxLayout* hboxDuration = new QHBoxLayout;
            vbox->addLayout(hboxDuration);
            {
                QLabel* lblName = new QLabel(tr("Duration: "));
                hboxDuration->addWidget(lblName);
                QLabel* lblValue = new QLabel(tr("00:00:23"));
                hboxDuration->addWidget(lblValue);
            }
        }
        {
            QWidget* nullWidget = new QWidget;
            nullWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
            vbox->addWidget(nullWidget);
        }
    }
}
Пример #2
0
void CttView::OnDraw(CDC* pDC)
{
	CttDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if (!pDoc)
		return;
	//pDC->MoveTo(10,10);
	//pDC->LineTo(10,400);
	//pDC->LineTo(1024,400);
	//pDC->LineTo(1024,10);
	//pDC->LineTo(10,10);
	if (m_animeON){
		CRect rect;
		GetClientRect(&rect);

		if (m_cls) pDC->FillRect(rect, RGB(0, 0, 0));
		double as = fabs(sin(m_x / 50.0));
		double ac = fabs(cos(m_y / 50.0));
		double as2 = sin(2 * 3.1415926 *m_x / rect.Width());
		double ac2 = sin(2 * 3.1415926 *m_y / rect.Height());
		int rc = min((int)(((as2 + 1.0) / 2.0) * 0xff), 0xff);
		int gc = min((int)(((ac2 + 1.0) / 2.0) * 0xff), 0xff);
		int bc = min(255, 512 - rc - gc);
		COLORREF color = RGB(rc, gc, bc);

		CPen pen(1, 5, color);
		CBrush brush(color);
		pDC->SelectObject(&pen);
		pDC->SelectObject(&brush);
		int bigx = abs(sin(m_x / 50.0)) * 50 + 1;
		int bigy = abs(cos(m_y / 50.0)) * 50 + 1;
		pDC->Ellipse(m_x - bigx, m_y - bigy, m_x + bigx, m_y + bigy);
	}
	if (m_gameON){
		CRect rect;
		GetClientRect(&rect);
		int &px = m_player_x;
		int &py = m_player_y;
		int bigx = 30;
		int bigy = 30;
		COLORREF color = RGB(23, 123, 123);
		COLORREF enemy_color = RGB(255, 0, 0);
		CPen pen(1, 5, color);
		CBrush brush(RGB(23,123,223));
		CPen pen2(1, 3, enemy_color);
		CBrush brush2(RGB(0,0,0));
		CPen pen3(1, 2, RGB(123,255,23));
		CBrush brush3(RGB(155, 225, 123));
		pDC->FillRect(rect, RGB(0, 0, 0));
		int cnt = m_enemy.size();
		pDC->SelectObject(&pen2);
		pDC->SelectObject(&brush2);
		for (int i = 0; i < cnt; i++){
			int ex = m_enemy[i].x;
			int ey = m_enemy[i].y;
			pDC->Ellipse(ex-10,ey-10,ex+10,ey+10);
		}
		pDC->SelectObject(&pen3);
		pDC->SelectObject(&brush3);
		cnt = m_bullet.size();
		for (int i = 0; i < cnt; i++){
			int ex = m_bullet[i].first.x;
			int ey = m_bullet[i].first.y;
			pDC->Ellipse(ex - 10, ey - 10, ex + 10, ey + 10);
		}
		pDC->SelectObject(&pen);
		pDC->SelectObject(&brush);
		pDC->Ellipse(px - bigx, py - bigy, px + bigx, py + bigy);
	}
	// TODO: 在此处为本机数据添加绘制代码
}
Пример #3
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