Beispiel #1
0
View::View(const QString &name, QWidget *parent)
    : QFrame(parent)
{
    setFrameStyle(Sunken | StyledPanel);
    graphicsView = new GraphicsView(this);
    graphicsView->setRenderHint(QPainter::Antialiasing, true);
    graphicsView->setDragMode(QGraphicsView::RubberBandDrag);
    graphicsView->setOptimizationFlags(QGraphicsView::DontSavePainterState);
    graphicsView->setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
    graphicsView->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);

    int size = style()->pixelMetric(QStyle::PM_ToolBarIconSize);
    QSize iconSize(size, size);

    QToolButton *zoomInIcon = new QToolButton;
    zoomInIcon->setAutoRepeat(true);
    zoomInIcon->setAutoRepeatInterval(33);
    zoomInIcon->setAutoRepeatDelay(0);
    zoomInIcon->setIcon(QPixmap(":/img/zoomin.png"));
    zoomInIcon->setIconSize(iconSize);
    QToolButton *zoomOutIcon = new QToolButton;
    zoomOutIcon->setAutoRepeat(true);
    zoomOutIcon->setAutoRepeatInterval(33);
    zoomOutIcon->setAutoRepeatDelay(0);
    zoomOutIcon->setIcon(QPixmap(":/img/zoomout.png"));
    zoomOutIcon->setIconSize(iconSize);
    zoomSlider = new QSlider;
    zoomSlider->setMinimum(0);
    zoomSlider->setMaximum(500);
    zoomSlider->setValue(250);
    zoomSlider->setTickPosition(QSlider::TicksRight);

    // Zoom slider layout
    QVBoxLayout *zoomSliderLayout = new QVBoxLayout;
    zoomSliderLayout->addWidget(zoomInIcon);
    zoomSliderLayout->addWidget(zoomSlider);
    zoomSliderLayout->addWidget(zoomOutIcon);

    QToolButton *rotateLeftIcon = new QToolButton;
    rotateLeftIcon->setIcon(QPixmap(":/img/rotateleft.png"));
    rotateLeftIcon->setIconSize(iconSize);
    QToolButton *rotateRightIcon = new QToolButton;
    rotateRightIcon->setIcon(QPixmap(":/img/rotateright.png"));
    rotateRightIcon->setIconSize(iconSize);
    rotateSlider = new QSlider;
    rotateSlider->setOrientation(Qt::Horizontal);
    rotateSlider->setMinimum(-360);
    rotateSlider->setMaximum(360);
    rotateSlider->setValue(0);
    rotateSlider->setTickPosition(QSlider::TicksBelow);

    // Rotate slider layout
    QHBoxLayout *rotateSliderLayout = new QHBoxLayout;
    rotateSliderLayout->addWidget(rotateLeftIcon);
    rotateSliderLayout->addWidget(rotateSlider);
    rotateSliderLayout->addWidget(rotateRightIcon);

    resetButton = new QToolButton;
    resetButton->setText(tr("reset"));
    resetButton->setEnabled(false);

    // Label layout
    QHBoxLayout *labelLayout = new QHBoxLayout;
    label = new QLabel(name);

    printButton = new QToolButton;
    printButton->setIcon(QIcon(QPixmap(":/img/fileprint.png")));

    labelLayout->addWidget(label);
    labelLayout->addStretch();
    labelLayout->addWidget(printButton);

    QGridLayout *topLayout = new QGridLayout;
    topLayout->addLayout(labelLayout, 0, 0);
    topLayout->addWidget(graphicsView, 1, 0);
    topLayout->addLayout(zoomSliderLayout, 1, 1);
    topLayout->addLayout(rotateSliderLayout, 2, 0);
    topLayout->addWidget(resetButton, 2, 1);
    setLayout(topLayout);

    connect(resetButton, SIGNAL(clicked()), this, SLOT(resetView()));
    connect(zoomSlider, SIGNAL(valueChanged(int)), this, SLOT(setupMatrix()));
    connect(rotateSlider, SIGNAL(valueChanged(int)), this, SLOT(setupMatrix()));
    connect(graphicsView->verticalScrollBar(), SIGNAL(valueChanged(int)),
            this, SLOT(setResetButtonEnabled()));
    connect(graphicsView->horizontalScrollBar(), SIGNAL(valueChanged(int)),
            this, SLOT(setResetButtonEnabled()));
    connect(rotateLeftIcon, SIGNAL(clicked()), this, SLOT(rotateLeft()));
    connect(rotateRightIcon, SIGNAL(clicked()), this, SLOT(rotateRight()));
    connect(zoomInIcon, SIGNAL(clicked()), this, SLOT(zoomIn()));
    connect(zoomOutIcon, SIGNAL(clicked()), this, SLOT(zoomOut()));
    connect(printButton, SIGNAL(clicked()), this, SLOT(print()));

    setupMatrix();
}
Beispiel #2
0
View::View (MainWindow * mw, const QString & name, QWidget * parent)
	: m_mainWindow(mw)
	, QFrame(parent)
{
	setFrameStyle(Sunken | StyledPanel);
	m_frameSpinBox = new QSpinBox;
	m_graphicsView = new MyGraphicsView(*m_frameSpinBox);
	m_graphicsView->setRenderHint(QPainter::Antialiasing, false);
	m_graphicsView->setDragMode(QGraphicsView::RubberBandDrag);
	m_graphicsView->setOptimizationFlags(QGraphicsView::DontSavePainterState);
	m_graphicsView->setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);

	int size = style()->pixelMetric(QStyle::PM_ToolBarIconSize);
	QSize iconSize(size, size);

	QToolButton * zoomInIcon = new QToolButton;
	zoomInIcon->setAutoRepeat(true);
	zoomInIcon->setAutoRepeatInterval(33);
	zoomInIcon->setAutoRepeatDelay(0);
	zoomInIcon->setIcon(QPixmap(":/zoomin.png"));
	zoomInIcon->setIconSize(iconSize);
	QToolButton * zoomOutIcon = new QToolButton;
	zoomOutIcon->setAutoRepeat(true);
	zoomOutIcon->setAutoRepeatInterval(33);
	zoomOutIcon->setAutoRepeatDelay(0);
	zoomOutIcon->setIcon(QPixmap(":/zoomout.png"));
	zoomOutIcon->setIconSize(iconSize);
	m_zoomSlider = new QSlider;
	m_zoomSlider->setMinimum(0);
	m_zoomSlider->setMaximum(500);
	m_zoomSlider->setValue(250);
	m_zoomSlider->setTickPosition(QSlider::TicksRight);

	// Zoom slider layout
	QVBoxLayout *zoomSliderLayout = new QVBoxLayout;
	zoomSliderLayout->addWidget(zoomInIcon);
	zoomSliderLayout->addWidget(m_zoomSlider);
	zoomSliderLayout->addWidget(zoomOutIcon);

	m_resetButton = new QToolButton;
	m_resetButton->setText(tr("0"));
	m_resetButton->setEnabled(false);

	// Label layout
	QHBoxLayout *labelLayout = new QHBoxLayout;
	m_label = new QLabel(name);
	m_antialiasButton = new QToolButton;
	m_antialiasButton->setText(tr("Antialiasing"));
	m_antialiasButton->setCheckable(true);
	m_antialiasButton->setChecked(false);
	m_openGlButton = new QToolButton;
	m_openGlButton->setText(tr("OpenGL"));
	m_openGlButton->setCheckable(true);
#ifndef QT_NO_OPENGL
	m_openGlButton->setEnabled(QGLFormat::hasOpenGL());
#else
	m_openGlButton->setEnabled(false);
#endif

	labelLayout->addWidget(m_label);
	labelLayout->addStretch();
	labelLayout->addWidget(m_antialiasButton);
	labelLayout->addWidget(m_openGlButton);

	QGridLayout *topLayout = new QGridLayout;
	topLayout->addLayout(labelLayout, 0, 0);
	topLayout->addWidget(m_graphicsView, 1, 0);
	topLayout->addLayout(zoomSliderLayout, 1, 1);

	QSlider * m_heightSlider = new QSlider;
	m_heightSlider->setMinimum(0);
	m_heightSlider->setMaximum(400);
	m_heightSlider->setValue(g_heightValue);
	topLayout->addWidget(m_heightSlider, 1, 2);
	//m_heightSlider->setTickPosition(QSlider::TicksRight);
	//
	m_frameSpinBox->setMinimum(0);
	m_frameSpinBox->setValue(0);

	int const max = m_mainWindow->getProfileInfo(0).m_frames.size();
	m_frameSpinBox->setMaximum(max);
	topLayout->addWidget(m_frameSpinBox, 0, 1);

	topLayout->addWidget(m_resetButton, 2, 1);
	setLayout(topLayout);

	connect(m_resetButton, SIGNAL(clicked()), this, SLOT(resetView()));
	connect(m_zoomSlider, SIGNAL(valueChanged(int)), this, SLOT(setupMatrix()));
	connect(m_graphicsView->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(setResetButtonEnabled()));
	connect(m_graphicsView->horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(setResetButtonEnabled()));
	connect(m_antialiasButton, SIGNAL(toggled(bool)), this, SLOT(toggleAntialiasing()));
	connect(m_openGlButton, SIGNAL(toggled(bool)), this, SLOT(toggleOpenGL()));
	connect(zoomInIcon, SIGNAL(clicked()), this, SLOT(zoomIn()));
	connect(zoomOutIcon, SIGNAL(clicked()), this, SLOT(zoomOut()));

	connect(m_heightSlider, SIGNAL(valueChanged(int)), this, SLOT(changeHeight(int)));

	setupMatrix();
}
Beispiel #3
0
View::View(const QString &name, QWidget *parent)
    : QFrame(parent)
{
    setFrameStyle(Sunken | StyledPanel);
    graphicsView = new GraphicsView(this);
    graphicsView->setRenderHint(QPainter::Antialiasing, false);
    graphicsView->setDragMode(QGraphicsView::RubberBandDrag);
    graphicsView->setOptimizationFlags(QGraphicsView::DontSavePainterState);
    graphicsView->setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
    graphicsView->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);

    int size = style()->pixelMetric(QStyle::PM_ToolBarIconSize);
    QSize iconSize(size, size);

    QToolButton *zoomInIcon = new QToolButton;
    zoomInIcon->setAutoRepeat(true);
    zoomInIcon->setAutoRepeatInterval(33);
    zoomInIcon->setAutoRepeatDelay(0);
    zoomInIcon->setIcon(QPixmap(":/zoomin.png"));
    zoomInIcon->setIconSize(iconSize);
    QToolButton *zoomOutIcon = new QToolButton;
    zoomOutIcon->setAutoRepeat(true);
    zoomOutIcon->setAutoRepeatInterval(33);
    zoomOutIcon->setAutoRepeatDelay(0);
    zoomOutIcon->setIcon(QPixmap(":/zoomout.png"));
    zoomOutIcon->setIconSize(iconSize);
    zoomSlider = new QSlider;
    zoomSlider->setMinimum(0);
    zoomSlider->setMaximum(500);
    zoomSlider->setValue(250);
    zoomSlider->setTickPosition(QSlider::TicksRight);

    // Zoom slider layout
    QVBoxLayout *zoomSliderLayout = new QVBoxLayout;
    zoomSliderLayout->addWidget(zoomInIcon);
    zoomSliderLayout->addWidget(zoomSlider);
    zoomSliderLayout->addWidget(zoomOutIcon);

    QToolButton *rotateLeftIcon = new QToolButton;
    rotateLeftIcon->setIcon(QPixmap(":/rotateleft.png"));
    rotateLeftIcon->setIconSize(iconSize);
    QToolButton *rotateRightIcon = new QToolButton;
    rotateRightIcon->setIcon(QPixmap(":/rotateright.png"));
    rotateRightIcon->setIconSize(iconSize);
    rotateSlider = new QSlider;
    rotateSlider->setOrientation(Qt::Horizontal);
    rotateSlider->setMinimum(-360);
    rotateSlider->setMaximum(360);
    rotateSlider->setValue(0);
    rotateSlider->setTickPosition(QSlider::TicksBelow);

    // Rotate slider layout
    QHBoxLayout *rotateSliderLayout = new QHBoxLayout;
    rotateSliderLayout->addWidget(rotateLeftIcon);
    rotateSliderLayout->addWidget(rotateSlider);
    rotateSliderLayout->addWidget(rotateRightIcon);

    resetButton = new QToolButton;
    resetButton->setText(tr("0"));
    resetButton->setEnabled(false);

    // Label layout
    QHBoxLayout *labelLayout = new QHBoxLayout;
    label = new QLabel(name);

    refreshButton = new QToolButton;
    refreshButton->setText(tr("Step Sim"));
    refreshButton->setEnabled(true);

    upButton = new QToolButton;
    upButton->setText(tr("Up"));
    upButton->setEnabled(true);

    downButton = new QToolButton;
    downButton->setText(tr("Down"));
    downButton->setEnabled(true);

    leftButton = new QToolButton;
    leftButton->setText(tr("Left"));
    leftButton->setEnabled(true);

    rightButton = new QToolButton;
    rightButton->setText(tr("Right"));
    rightButton->setEnabled(true);

    label2 = new QLabel(tr("Pointer Mode"));

    selectModeButton = new QToolButton;
    selectModeButton->setText(tr("Select"));
    selectModeButton->setCheckable(true);
    selectModeButton->setChecked(true);

    dragModeButton = new QToolButton;
    dragModeButton->setText(tr("Drag"));
    dragModeButton->setCheckable(true);
    dragModeButton->setChecked(false);

    antialiasButton = new QToolButton;
    antialiasButton->setText(tr("Antialiasing"));
    antialiasButton->setCheckable(true);
    antialiasButton->setChecked(false);

    openGlButton = new QToolButton;
    openGlButton->setText(tr("OpenGL"));
    openGlButton->setCheckable(true);
#ifndef QT_NO_OPENGL
    openGlButton->setEnabled(QGLFormat::hasOpenGL());
#else
    openGlButton->setEnabled(false);
#endif
    printButton = new QToolButton;
    printButton->setIcon(QIcon(QPixmap(":/fileprint.png")));

    //A container for the PointerMode switcher buttons.
    QButtonGroup *pointerModeGroup = new QButtonGroup;
    pointerModeGroup->setExclusive(true);
    pointerModeGroup->addButton(selectModeButton);
    pointerModeGroup->addButton(dragModeButton);

    //The button Layout
    labelLayout->addWidget(label);
    labelLayout->addWidget(refreshButton);

    //Temporary buttons!
    labelLayout->addWidget(upButton);
    labelLayout->addWidget(downButton);
    labelLayout->addWidget(leftButton);
    labelLayout->addWidget(rightButton);
    //Back to business.

    labelLayout->addStretch();
    labelLayout->addWidget(label2);
    labelLayout->addWidget(selectModeButton);
    labelLayout->addWidget(dragModeButton);
    labelLayout->addStretch();
    labelLayout->addWidget(antialiasButton);
    labelLayout->addWidget(openGlButton);
    labelLayout->addWidget(printButton);

    //Generating layout for entire window
    QGridLayout *topLayout = new QGridLayout;
    topLayout->addLayout(labelLayout, 0, 0);
    topLayout->addWidget(graphicsView, 1, 0);
    topLayout->addLayout(zoomSliderLayout, 1, 1);
    topLayout->addLayout(rotateSliderLayout, 2, 0);
    topLayout->addWidget(resetButton, 2, 1);
    setLayout(topLayout);

    //Connect Socket to signal.
    connect(resetButton, SIGNAL(clicked()), this, SLOT(resetView()));
    connect(zoomSlider, SIGNAL(valueChanged(int)), this, SLOT(setupMatrix()));
    connect(rotateSlider, SIGNAL(valueChanged(int)), this, SLOT(setupMatrix()));
    connect(graphicsView->verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(setResetButtonEnabled()));
    connect(graphicsView->horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(setResetButtonEnabled()));
    connect(selectModeButton, SIGNAL(toggled(bool)), this, SLOT(togglePointerMode()));
    connect(dragModeButton, SIGNAL(toggled(bool)), this, SLOT(togglePointerMode()));
    connect(antialiasButton, SIGNAL(toggled(bool)), this, SLOT(toggleAntialiasing()));
    connect(openGlButton, SIGNAL(toggled(bool)), this, SLOT(toggleOpenGL()));
    connect(rotateLeftIcon, SIGNAL(clicked()), this, SLOT(rotateLeft()));
    connect(rotateRightIcon, SIGNAL(clicked()), this, SLOT(rotateRight()));
    connect(zoomInIcon, SIGNAL(clicked()), this, SLOT(zoomIn()));
    connect(zoomOutIcon, SIGNAL(clicked()), this, SLOT(zoomOut()));
    connect(printButton, SIGNAL(clicked()), this, SLOT(print()));

    setupMatrix();
}
Beispiel #4
0
SVGView::SVGView(const QString &name, QWidget *parent)
	: QFrame(parent)
{
	setFrameStyle(Sunken | StyledPanel);
    m_graphicsView = new QGraphicsView;
    m_graphicsView->setRenderHint(QPainter::Antialiasing, true);
    m_graphicsView->setDragMode(QGraphicsView::RubberBandDrag);
    m_graphicsView->setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
    int size = style()->pixelMetric(QStyle::PM_ToolBarIconSize);
    QSize iconSize(size, size);

    m_domDocument = new QDomDocument;

	m_zoom = 1;
	m_rotation = 0;

    QToolButton *zoomInIcon = new QToolButton;
    zoomInIcon->setAutoRepeat(true);
    zoomInIcon->setAutoRepeatInterval(33);
    zoomInIcon->setAutoRepeatDelay(0);
    zoomInIcon->setIcon(QPixmap(":/zoomin.png"));
    zoomInIcon->setIconSize(iconSize);
    QToolButton *zoomOutIcon = new QToolButton;
    zoomOutIcon->setAutoRepeat(true);
    zoomOutIcon->setAutoRepeatInterval(33);
    zoomOutIcon->setAutoRepeatDelay(0);
    zoomOutIcon->setIcon(QPixmap(":/zoomout.png"));
    zoomOutIcon->setIconSize(iconSize);

    QToolButton *rotateLeftIcon = new QToolButton;
    rotateLeftIcon->setIcon(QPixmap(":/rotateleft.png"));
    rotateLeftIcon->setIconSize(iconSize);
    QToolButton *rotateRightIcon = new QToolButton;
    rotateRightIcon->setIcon(QPixmap(":/rotateright.png"));
    rotateRightIcon->setIconSize(iconSize);

    // Label layout
    QHBoxLayout *labelLayout = new QHBoxLayout;
    m_label = new QLabel(name);

	//TODO: put proper icons in here
    m_printButton = new QToolButton;
    m_printButton->setIcon(QIcon(QPixmap(":/resources/images/document-print.png")));
    m_printButton->setText(tr("Print"));
    m_printButton->setToolTip(tr("Print"));

	m_loadPCBXMLButton = new QToolButton;
    m_loadPCBXMLButton->setIcon(QIcon(QPixmap(":/resources/images/applications-accessories.png")));
	m_loadPCBXMLButton->setText(tr("Import XML"));
	m_loadPCBXMLButton->setToolTip(tr("Import XML"));

    labelLayout->addWidget(m_label);
    labelLayout->addStretch();
    labelLayout->addWidget(m_printButton);
    labelLayout->addWidget(m_loadPCBXMLButton);

    QGridLayout *topLayout = new QGridLayout;
    topLayout->addLayout(labelLayout, 0, 0);
    topLayout->addWidget(m_graphicsView, 1, 0);
    setLayout(topLayout);

    connect(rotateLeftIcon, SIGNAL(clicked()), this, SLOT(rotateLeft()));
    connect(rotateRightIcon, SIGNAL(clicked()), this, SLOT(rotateRight()));
    connect(zoomInIcon, SIGNAL(clicked()), this, SLOT(zoomIn()));
    connect(zoomOutIcon, SIGNAL(clicked()), this, SLOT(zoomOut()));
    connect(m_printButton, SIGNAL(clicked()), this, SLOT(print()));
    connect(m_loadPCBXMLButton, SIGNAL(clicked()), this, SLOT(importPCBXML()));

    setupMatrix();
}
Beispiel #5
0
View::View(const QString &name, QWidget *parent)
    : QFrame(parent)
{
    setFrameStyle(Sunken | StyledPanel);
    graphicsView = new GraphicsView(this);
    graphicsView->setRenderHint(QPainter::Antialiasing, false);
    graphicsView->setDragMode(QGraphicsView::RubberBandDrag);
    graphicsView->setOptimizationFlags(QGraphicsView::DontSavePainterState);
    graphicsView->setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
    graphicsView->setTransformationAnchor(QGraphicsView::AnchorUnderMouse);

    int size = style()->pixelMetric(QStyle::PM_ToolBarIconSize);
    QSize iconSize(size, size);

    QToolButton *zoomInIcon = new QToolButton;
    zoomInIcon->setAutoRepeat(true);
    zoomInIcon->setAutoRepeatInterval(33);
    zoomInIcon->setAutoRepeatDelay(0);
    zoomInIcon->setIcon(QPixmap(":/zoomin.png"));
    zoomInIcon->setIconSize(iconSize);
    QToolButton *zoomOutIcon = new QToolButton;
    zoomOutIcon->setAutoRepeat(true);
    zoomOutIcon->setAutoRepeatInterval(33);
    zoomOutIcon->setAutoRepeatDelay(0);
    zoomOutIcon->setIcon(QPixmap(":/zoomout.png"));
    zoomOutIcon->setIconSize(iconSize);
    zoomSlider = new QSlider;
    zoomSlider->setMinimum(0);
    zoomSlider->setMaximum(500);
    zoomSlider->setValue(250);
    zoomSlider->setTickPosition(QSlider::TicksRight);

    // Zoom slider layout
    QVBoxLayout *zoomSliderLayout = new QVBoxLayout;
    zoomSliderLayout->addWidget(zoomInIcon);
    zoomSliderLayout->addWidget(zoomSlider);
    zoomSliderLayout->addWidget(zoomOutIcon);

    QToolButton *rotateLeftIcon = new QToolButton;
    rotateLeftIcon->setIcon(QPixmap(":/rotateleft.png"));
    rotateLeftIcon->setIconSize(iconSize);
    QToolButton *rotateRightIcon = new QToolButton;
    rotateRightIcon->setIcon(QPixmap(":/rotateright.png"));
    rotateRightIcon->setIconSize(iconSize);
    rotateSlider = new QSlider;
    rotateSlider->setOrientation(Qt::Horizontal);
    rotateSlider->setMinimum(-360);
    rotateSlider->setMaximum(360);
    rotateSlider->setValue(0);
    rotateSlider->setTickPosition(QSlider::TicksBelow);

    // Rotate slider layout
    QHBoxLayout *rotateSliderLayout = new QHBoxLayout;
    rotateSliderLayout->addWidget(rotateLeftIcon);
    rotateSliderLayout->addWidget(rotateSlider);
    rotateSliderLayout->addWidget(rotateRightIcon);

    resetButton = new QToolButton;
    resetButton->setText(tr("0"));
    resetButton->setEnabled(false);


    // Label layout
    QHBoxLayout *labelLayout = new QHBoxLayout;
    label = new QLabel(name);
    label2 = new QLabel(tr("Pointer Mode"));
    selectModeButton = new QToolButton;
    //selectModeButton->setText(tr("Select"));
    selectModeButton->setIcon(QPixmap(":/choose.png"));
    selectModeButton->setIconSize(iconSize);
    selectModeButton->setCheckable(true);
    selectModeButton->setChecked(true);
    dragModeButton = new QToolButton;
    //dragModeButton->setText(tr("Drag"));
    dragModeButton->setIcon(QPixmap(":/Press-and-Drag.png"));
    dragModeButton ->setIconSize(iconSize);
    dragModeButton->setCheckable(true);
    dragModeButton->setChecked(false);
    Btn_Pathfinding = new QToolButton;
    //Btn_Pathfinding ->setText(tr("PathFinding"));
    Btn_Pathfinding ->setIcon(QPixmap(":/pathfinding.png"));
    Btn_Pathfinding ->setIconSize(iconSize);
    Btn_Pathfinding ->setEnabled(true);
    InputDataBtn = new QToolButton;
    //InputDataBtn ->setText(tr("InputData"));
    InputDataBtn->setIcon(QPixmap(":/inputdata.png"));
    InputDataBtn->setIconSize(iconSize);
    InputDataBtn ->setEnabled(true);

    //Scene choose
    label3 = new QLabel(tr("HelpPoint Number"));
    combobox = new QComboBox;
    combobox-> addItem("1");
    combobox-> addItem("2");
    combobox-> addItem("3");

    //scene_check = new QToolButton;
    //scene_check -> setText(tr("Scene_test"));
    //scene_check -> setEnabled(true);

    //EditWindow
    EditWindow = new QTextEdit;
    EditWindow ->setStyleSheet("QTextEdit{background:darkGray}");
    EditWindow->setReadOnly(true);



#ifndef QT_NO_OPENGL
    //openGlButton->setEnabled(QGLFormat::hasOpenGL());
#else
    openGlButton->setEnabled(false);
#endif
    //printButton = new QToolButton;
    //printButton->setIcon(QIcon(QPixmap(":/fileprint.png")));

    QButtonGroup *pointerModeGroup = new QButtonGroup;
    pointerModeGroup->setExclusive(true);
    pointerModeGroup->addButton(selectModeButton);
    pointerModeGroup->addButton(dragModeButton);

    labelLayout->addWidget(label);
   //labelLayout->addStretch();
    labelLayout->addWidget(InputDataBtn);
    //labelLayout->addStretch();
    labelLayout->addWidget(Btn_Pathfinding);
    labelLayout->addStretch();
    labelLayout->addWidget(label2);
    labelLayout->addWidget(selectModeButton);
    labelLayout->addWidget(dragModeButton);
    labelLayout->addStretch();
    labelLayout->addWidget(label3);
    labelLayout->addWidget(combobox);

    QGridLayout *topLayout = new QGridLayout;
    topLayout->addLayout(labelLayout, 0, 0);
    topLayout->addWidget(graphicsView, 1, 0);
    topLayout->addLayout(zoomSliderLayout, 1, 1);
    topLayout->addWidget(EditWindow,1,2);
    topLayout->addLayout(rotateSliderLayout, 2, 0);
    topLayout->addWidget(resetButton, 2, 1);
    setLayout(topLayout);

    connect(resetButton, SIGNAL(clicked()), this, SLOT(resetView()));
    connect(zoomSlider, SIGNAL(valueChanged(int)), this, SLOT(setupMatrix()));
    connect(rotateSlider, SIGNAL(valueChanged(int)), this, SLOT(setupMatrix()));
    connect(graphicsView->verticalScrollBar(), SIGNAL(valueChanged(int)),
            this, SLOT(setResetButtonEnabled()));
    connect(graphicsView->horizontalScrollBar(), SIGNAL(valueChanged(int)),
            this, SLOT(setResetButtonEnabled()));
    connect(selectModeButton, SIGNAL(toggled(bool)), this, SLOT(togglePointerMode()));
    connect(dragModeButton, SIGNAL(toggled(bool)), this, SLOT(togglePointerMode()));
    //connect(antialiasButton, SIGNAL(toggled(bool)), this, SLOT(toggleAntialiasing()));
    //connect(openGlButton, SIGNAL(toggled(bool)), this, SLOT(toggleOpenGL()));
    connect(rotateLeftIcon, SIGNAL(clicked()), this, SLOT(rotateLeft()));
    connect(rotateRightIcon, SIGNAL(clicked()), this, SLOT(rotateRight()));
    connect(zoomInIcon, SIGNAL(clicked()), this, SLOT(zoomIn()));
    connect(zoomOutIcon, SIGNAL(clicked()), this, SLOT(zoomOut()));
    //connect(scene_check, SIGNAL(clicked()), this, SLOT(BtnsetScene()));


    setupMatrix();

    my_serialport = new QSerialPort;
    my_serialport->setPortName("COM3");
    my_serialport->open(QIODevice::ReadWrite);
    my_serialport->setBaudRate(38400);
    my_serialport->setDataBits(QSerialPort::Data8);
    my_serialport->setParity(QSerialPort::NoParity);
    my_serialport->setFlowControl(QSerialPort::NoFlowControl);
    connect(my_serialport,SIGNAL(readyRead()),this,SLOT(my_readuart()));

}
Beispiel #6
0
PreViewPage::PreViewPage(QWidget *parent)
    : QWidget(parent)
    ,leftFrame(0)
    ,rightFrame(0)
    ,thumbSize(100,100)
{
    this->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::MinimumExpanding);
    this->setMinimumSize(320,240);
    this->setMaximumSize(800,600);

    checkPicturesList    = new QCheckBox( this );
    //checkPicturesList->setText(QObject::trUtf8("pic list "));
    checkPicturesList->setEnabled( false );
    checkPicturesList->setChecked( false );
    checkPicturesList->hide();

    this->setWindowTitle(QObject::trUtf8("Предварительный просмотр сформированного документа."));

    int size = style()->pixelMetric(QStyle::PM_ToolBarIconSize);
    QSize iconSize(size, size);

    leftFrame = new ViewPort(this);
    rightFrame = new ViewPort(this);

    leftFrame->showThumbNail(true,thumbSize);
    leftFrame->setMinimumSize(200,512);
    rightFrame->setMinimumSize(720,512);

    // Zoom slider layout
    QFrame *zoomSliderFrame = new QFrame();
    zoomSliderFrame->setFrameStyle(QFrame::Sunken | QFrame::StyledPanel);

    QToolButton *zoomToFitIcon = new QToolButton;
    zoomToFitIcon->setAutoRepeat(true);
    zoomToFitIcon->setAutoRepeatInterval(33);
    zoomToFitIcon->setAutoRepeatDelay(0);
    zoomToFitIcon->setIcon(QPixmap(":/zoomtofit.xpm"));
    zoomToFitIcon->setIconSize(iconSize);
    zoomToFitIcon->setToolTip(QObject::trUtf8("Увеличить изображение до размеров экрана."));

    QToolButton *zoomToFullSizeIcon = new QToolButton;
    zoomToFullSizeIcon->setAutoRepeat(true);
    zoomToFullSizeIcon->setAutoRepeatInterval(33);
    zoomToFullSizeIcon->setAutoRepeatDelay(0);
    zoomToFullSizeIcon->setIcon(QPixmap(":/zoomtofull.xpm"));
    zoomToFullSizeIcon->setIconSize(iconSize);
    zoomToFullSizeIcon->setToolTip(QObject::trUtf8("Исходный размер изображения."));

    QToolButton *zoomInIcon = new QToolButton;
    zoomInIcon->setAutoRepeat(true);
    zoomInIcon->setAutoRepeatInterval(33);
    zoomInIcon->setAutoRepeatDelay(0);
    zoomInIcon->setIcon(QPixmap(":/zoomin.xpm"));
    zoomInIcon->setIconSize(iconSize);
    zoomInIcon->setToolTip(QObject::trUtf8("Уменьшить масштаб изображения."));

    QToolButton *zoomOutIcon = new QToolButton;
    zoomOutIcon->setAutoRepeat(true);
    zoomOutIcon->setAutoRepeatInterval(33);
    zoomOutIcon->setAutoRepeatDelay(0);
    zoomOutIcon->setIcon(QPixmap(":/zoomout.xpm"));
    zoomOutIcon->setIconSize(iconSize);
    zoomOutIcon->setToolTip(QObject::trUtf8("Увеличить масштаб изображения."));
    zoomSlider = new QSlider();
    zoomSlider->setMinimum(0);
    zoomSlider->setMaximum(500);
    zoomSlider->setValue(250);
    zoomSlider->setOrientation(Qt::Horizontal);
    zoomSlider->setTickPosition(QSlider::TicksRight);

    QHBoxLayout * zoomSliderFrame_layout = new QHBoxLayout();
    zoomSliderFrame->setLayout(zoomSliderFrame_layout);
    zoomSliderFrame_layout->addWidget(zoomToFullSizeIcon);
    zoomSliderFrame_layout->addWidget(zoomToFitIcon);
    zoomSliderFrame_layout->addWidget(zoomInIcon);
    zoomSliderFrame_layout->addWidget(zoomSlider);
    zoomSliderFrame_layout->addWidget(zoomOutIcon);

    QSplitter    *toolSplitter = new QSplitter();
    toolSplitter->setOrientation(Qt::Vertical);
    toolSplitter->addWidget(zoomSliderFrame);
    toolSplitter->addWidget(rightFrame);
    toolSplitter->setStretchFactor(1, 1);

    QSplitter    *mainSplitter = new QSplitter();
    mainSplitter->setOrientation(Qt::Horizontal);
    mainSplitter->addWidget(leftFrame);
    mainSplitter->addWidget(toolSplitter);
    mainSplitter->setStretchFactor(1, 1);


    QVBoxLayout *layout = new QVBoxLayout;
    layout->addWidget ( checkPicturesList);
    layout->addWidget ( mainSplitter);

    setLayout(layout);


    connect(leftFrame,SIGNAL(selectPixmap(int)),
            rightFrame,SLOT(showPage(int)));

    connect(zoomInIcon, SIGNAL(clicked()),
            this, SLOT(zoomIn())
            );
    connect(zoomOutIcon, SIGNAL(clicked()),
            this, SLOT(zoomOut())
            );
    connect(zoomSlider, SIGNAL(valueChanged(int)),
            rightFrame, SLOT(setupMatrix(int))
            );
    connect (zoomToFullSizeIcon,SIGNAL(clicked()),
             rightFrame,SLOT(zoomToFullSize()));
    connect (zoomToFitIcon,SIGNAL(clicked()),
             rightFrame,SLOT(zoomToFit()));

}