Пример #1
0
PaletteDetailViewControls::PaletteDetailViewControls(PaletteDetailView *paletteDetailView)
    : QWidget(paletteDetailView)
    , m_paletteDetailView(paletteDetailView)
{
    QToolButton *moveItemToFirstPositionButton = new QToolButton(this);
    moveItemToFirstPositionButton->setIcon(KIcon("go-top"));
    moveItemToFirstPositionButton->setToolTip(i18n("First position"));

    QToolButton *moveItemToPrevPositionButton = new QToolButton(this);
    moveItemToPrevPositionButton->setIcon(KIcon("go-up"));
    moveItemToPrevPositionButton->setToolTip(i18n("Previous position"));
    moveItemToPrevPositionButton->setAutoRepeat(true);

    QToolButton *insertColorItemButton = new QToolButton(this);
    insertColorItemButton->setIcon(KIcon("insert-horizontal-rule"));
    insertColorItemButton->setToolTip(i18n("Insert color"));

    QToolButton *insertCommentItemButton = new QToolButton(this);
    insertCommentItemButton->setIcon(KIcon("list-add-font"));
    insertCommentItemButton->setToolTip(i18n("Insert comment"));

    QToolButton *removeItemButton = new QToolButton(this);
    removeItemButton->setIcon(KIcon("list-remove"));
    removeItemButton->setToolTip(i18n("Remove item"));

    QToolButton *moveItemToNextPositionButton = new QToolButton(this);
    moveItemToNextPositionButton->setIcon(KIcon("go-down"));
    moveItemToNextPositionButton->setToolTip(i18n("Next position"));
    moveItemToNextPositionButton->setAutoRepeat(true);

    QToolButton *moveItemToLastPositionButton = new QToolButton(this);
    moveItemToLastPositionButton->setIcon(KIcon("go-bottom"));
    moveItemToLastPositionButton->setToolTip(i18n("Last position"));

    QVBoxLayout *mainLayout = new QVBoxLayout(this);
    mainLayout->addStretch(1);
    mainLayout->addWidget(moveItemToFirstPositionButton);
    mainLayout->addWidget(moveItemToLastPositionButton);
    mainLayout->addStretch(1);
    mainLayout->addWidget(moveItemToPrevPositionButton);
    mainLayout->addWidget(moveItemToNextPositionButton);
    mainLayout->addStretch(1); 
    mainLayout->addWidget(insertColorItemButton);
    mainLayout->addWidget(insertCommentItemButton);
    mainLayout->addWidget(removeItemButton);
    mainLayout->addStretch(1);

    connect(moveItemToFirstPositionButton, SIGNAL(pressed()), this, SLOT(moveItemToFirstPosition()));
    connect(moveItemToPrevPositionButton, SIGNAL(pressed()), this, SLOT(moveItemToPrevPosition()));
    connect(insertColorItemButton, SIGNAL(pressed()), this, SLOT(insertColorItem()));
    connect(insertCommentItemButton, SIGNAL(pressed()), this, SLOT(insertCommentItem()));
    connect(removeItemButton, SIGNAL(pressed()), this, SLOT(removeItem()));
    connect(moveItemToNextPositionButton, SIGNAL(pressed()), this, SLOT(moveItemToNextPosition()));
    connect(moveItemToLastPositionButton, SIGNAL(pressed()), this, SLOT(moveItemToLastPosition()));
}
Пример #2
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();
}
Пример #3
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();
}
Пример #4
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();
}
Пример #5
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();
}
Пример #6
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()));

}
SystemTopologyToolBar::SystemTopologyToolBar()
{
    parent   = 0;
    leftAct  = this->addAction( QIcon( ":/images/left_small.png" ), QString( "left" ) );
    rightAct = this->addAction( QIcon( ":/images/right_small.png" ), QString( "right" ) );
    upAct    = this->addAction( QIcon( ":/images/up_small.png" ), QString( "up" ) );
    downAct  = this->addAction( QIcon( ":/images/down_small.png" ), QString( "down" ) );
    dist1Act = this->addAction( QIcon( ":/images/distance1_small.png" ), QString( "dist+" ) );
    dist2Act = this->addAction( QIcon( ":/images/distance2_small.png" ), QString( "dist-" ) );
    zoom1Act = this->addAction( QIcon( ":/images/zoomin_small.png" ), QString( "zoom+" ) );
    zoom2Act = this->addAction( QIcon( ":/images/zoomout_small.png" ), QString( "zoom-" ) );
    resetAct = this->addAction( QIcon( ":/images/reset_small.png" ), QString( "reset" ) );
    scaleAct = this->addAction( QIcon( ":/images/scale_small.png" ), QString( "scale" ) );
    userAct  = this->addAction( QIcon( ":/images/user_small.png" ), QString( "min/max" ) );

    leftAct->setWhatsThis( "Moves the whole topology to the left." );
    rightAct->setWhatsThis( "Moves the whole topology to the right." );
    upAct->setWhatsThis( "Moves the whole topology upwards." );
    downAct->setWhatsThis( "Moves the whole topology downwards." );
    dist1Act->setWhatsThis( "Increase the distance between the planes of the topology." );
    dist2Act->setWhatsThis( "Decrease the distance between the planes of the topology." );
    zoom1Act->setWhatsThis( "Enlarge the topology." );
    zoom2Act->setWhatsThis( "Scale down the topology." );
    resetAct->setWhatsThis( "Reset the display. It scales the topology such that it fits into the visible rectangle, and transforms it into a default position." );
    scaleAct->setWhatsThis( "It scales the topology such that it fits into the visible rectangle, without transformations." );
    userAct->setWhatsThis( " Similarly to the functions offered in the context menu of trees, you can activate and deactivate the application of user-defined minimal and maximal values for the color extremes, i.e., the values corresponding to the left and right end of the color legend. If the you activate user-defined values for the color extremes, you are asked to define two values that should correspond to the minimal and to the maximal colors. All values outside of this interval will get the color gray. Note that canceling any of the input windows causes no changes in the coloring method.  If user-defined min/max values are activated, the selected value information widget displays a \"(u)\" for \"user-defined\" behind the minimal and maximal color values." );

    xLabel = new QLabel( "x-rot:" );
    this->addWidget( xLabel );

    xSpin = new QSpinBox();
    xSpin->setMinimum( 0 );
    xSpin->setMaximum( 359 );
    xSpin->setSingleStep( 1 );
    xSpin->setValue( 300 );
    this->addWidget( xSpin );

    yLabel = new QLabel( "y-rot:" );
    this->addWidget( yLabel );

    ySpin = new QSpinBox();
    ySpin->setMinimum( 0 );
    ySpin->setMaximum( 359 );
    ySpin->setSingleStep( 1 );
    ySpin->setValue( 30 );
    this->addWidget( ySpin );

    xLabel->setWhatsThis( "Rotate the topology cube about the x-axis with the defined angle." );
    xSpin->setWhatsThis( "Rotate the topology cube about the x-axis with the defined angle." );
    yLabel->setWhatsThis( "Rotate the topology cube about the y-axis with the defined angle." );
    ySpin->setWhatsThis( "Rotate the topology cube about the y-axis with the defined angle." );

    QToolButton* leftButton  = ( QToolButton* )( this->widgetForAction( leftAct ) );
    QToolButton* rightButton = ( QToolButton* )( this->widgetForAction( rightAct ) );
    QToolButton* upButton    = ( QToolButton* )( this->widgetForAction( upAct ) );
    QToolButton* downButton  = ( QToolButton* )( this->widgetForAction( downAct ) );
    QToolButton* dist1Button = ( QToolButton* )( this->widgetForAction( dist1Act ) );
    QToolButton* dist2Button = ( QToolButton* )( this->widgetForAction( dist2Act ) );
    QToolButton* zoom1Button = ( QToolButton* )( this->widgetForAction( zoom1Act ) );
    QToolButton* zoom2Button = ( QToolButton* )( this->widgetForAction( zoom2Act ) );
    QToolButton* resetButton = ( QToolButton* )( this->widgetForAction( resetAct ) );
    QToolButton* scaleButton = ( QToolButton* )( this->widgetForAction( scaleAct ) );
    QToolButton* userButton  = ( QToolButton* )( this->widgetForAction( userAct ) );

    leftButton->setAutoRaise( false );
    rightButton->setAutoRaise( false );
    upButton->setAutoRaise( false );
    downButton->setAutoRaise( false );
    dist1Button->setAutoRaise( false );
    dist2Button->setAutoRaise( false );
    zoom1Button->setAutoRaise( false );
    zoom2Button->setAutoRaise( false );
    resetButton->setAutoRaise( false );
    scaleButton->setAutoRaise( false );
    userButton->setAutoRaise( false );

    leftAct->setToolTip( "Move left" );
    rightAct->setToolTip( "Move right" );
    upAct->setToolTip( "Move up" );
    downAct->setToolTip( "Move down" );
    dist1Act->setToolTip( "Increase plane distance" );
    dist2Act->setToolTip( "Decrease plane distance" );
    zoom1Act->setToolTip( "Zoom in" );
    zoom2Act->setToolTip( "Zoom out" );
    resetAct->setToolTip( "Reset" );
    scaleAct->setToolTip( "Scale into window" );
    userAct->setToolTip( "Set minimum/maximum values for coloring" );

    leftButton->setAutoRepeat( true );
    rightButton->setAutoRepeat( true );
    upButton->setAutoRepeat( true );
    downButton->setAutoRepeat( true );
    dist1Button->setAutoRepeat( true );
    dist2Button->setAutoRepeat( true );
    zoom1Button->setAutoRepeat( true );
    zoom2Button->setAutoRepeat( true );

    connect( leftButton, SIGNAL( pressed() ), this, SLOT( moveLeft() ) );
    connect( rightButton, SIGNAL( pressed() ), this, SLOT( moveRight() ) );
    connect( upButton,   SIGNAL( pressed() ), this, SLOT( moveUp() ) );
    connect( downButton, SIGNAL( pressed() ), this, SLOT( moveDown() ) );
    connect( dist1Button, SIGNAL( pressed() ), this, SLOT( increasePlaneDistance() ) );
    connect( dist2Button, SIGNAL( pressed() ), this, SLOT( decreasePlaneDistance() ) );
    connect( zoom1Button, SIGNAL( pressed() ), this, SLOT( zoomIn() ) );
    connect( zoom2Button, SIGNAL( pressed() ), this, SLOT( zoomOut() ) );
    connect( resetButton, SIGNAL( pressed() ), this, SLOT( reset() ) );
    connect( scaleButton, SIGNAL( pressed() ), this, SLOT( scale() ) );
    connect( userButton, SIGNAL( pressed() ), this, SLOT( minMaxValues() ) );

    connect( xSpin, SIGNAL( valueChanged( int ) ), this, SLOT( setXAngle( int ) ) );
    connect( ySpin, SIGNAL( valueChanged( int ) ), this, SLOT( setYAngle( int ) ) );

    disableTopologyButtons();
}
Пример #8
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()));

}