コード例 #1
0
ファイル: tcptransfer.cpp プロジェクト: newdebug/NewDebug
void TCPTransfer::setCurrentStackWidgetSlot()
{
    QObject* sender = this->sender();
    QToolButton* tbtn = static_cast<QToolButton*>(sender);
    if(!tbtn) return;

    ui->friendsTBtn->setChecked(false);
    ui->uploadTBtn->setChecked(false);
    ui->historyTBtn->setChecked(false);

    int index = 0;
    if( tbtn == ui->friendsTBtn )
    {
        tbtn->setChecked(true);
        index = 0;
    }
    else if( tbtn == ui->uploadTBtn )
    {
        tbtn->setChecked(true);
        index = 1;
    }
    else if( tbtn == ui->historyTBtn )
    {
        tbtn->setChecked(true);
        index = 2;
    }

    updateButton(index);
    emit currentStackWidgetSingal(index);
}
コード例 #2
0
ファイル: plot3d.cpp プロジェクト: piotrbetlej/hexplorer
Plot3D::Plot3D(QWidget *parent, Data *dat) : QMainWindow(parent)
{
    // pointers
    data = dat;

    // create 3D surface
    setData();

    // design widget
    QToolBar *toolBar = new QToolBar(this);

    QToolButton *btnSpectrogram = new QToolButton(toolBar);
    QToolButton *btnContour = new QToolButton(toolBar);
    QToolButton *btnPrint = new QToolButton(toolBar);

    btnPrint->setText("Print");
    btnPrint->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    toolBar->addWidget(btnPrint);

    addToolBar(toolBar);

    connect(btnPrint, SIGNAL(clicked()), this, SLOT(printPlot()));

    btnSpectrogram->setChecked(true);
    btnContour->setChecked(false);
}
コード例 #3
0
void UIControllerSetting::tbButton_clicked()
{
	QToolButton* tb = qobject_cast<QToolButton*>( sender() );
	
	if ( !mTimer->isActive() )
	{
		tb->setChecked( true );
		mPadKey = mButtons[ tb ];
	
		QString text1 = QtYabause::translate(QString("Awaiting input for"));
		QString text2 = QtYabause::translate(mNames[ mPadKey ]);
		QString text3 = QtYabause::translate(QString("Press Esc key to cancel"));

		mlInfos->setText( text1 + QString(": %1\n").arg(text2) + text3 );
		setScanFlags(mScanMasks[mPadKey]);
		mCore->Flush();
		curTb=tb;
		tb->setAttribute(Qt::WA_TransparentForMouseEvents);
		mTimer->start();
	}
	else
	{
		tb->setChecked( tb == mButtons.key( mPadKey ) );
	}
}
コード例 #4
0
ファイル: mainwindow.cpp プロジェクト: Nobu19800/RMC
void MainWindow::createToolbars()
{
    editToolBar = addToolBar(tc->toUnicode("Edit"));
    editToolBar->addAction(deleteAction);
    editToolBar->addAction(toFrontAction);
    editToolBar->addAction(sendBackAction);
	editToolBar->addAction(checkAction);
    editToolBar->addAction(BHAct);
	editToolBar->addAction(JHAct);


	QToolButton *pointerButton = new QToolButton;
    pointerButton->setCheckable(true);
    pointerButton->setChecked(true);
    pointerButton->setIcon(QIcon(":/images/pointer.png"));



    pointerTypeGroup = new QButtonGroup;
    pointerTypeGroup->addButton(pointerButton, int(MoveItem));
    connect(pointerTypeGroup, SIGNAL(buttonClicked(int)),
            this, SLOT(pointerGroupClicked(int)));




    pointerToolbar = addToolBar(tc->toUnicode("Pointer type"));
    pointerToolbar->addWidget(pointerButton);



	QToolButton *BanButton = new QToolButton;
    BanButton->setCheckable(true);

	QToolButton *TransButton = new QToolButton;
    TransButton->setCheckable(true);
    TransButton->setChecked(true);
    BanButton->setIcon(QIcon(":/images/ban.png"));
	TransButton->setIcon(QIcon(":/images/scale.png"));



    BorTGroup = new QButtonGroup;
    BorTGroup->addButton(BanButton, 1);
    connect(BorTGroup, SIGNAL(buttonClicked(int)),
            this, SLOT(BorTGroupClicked(int)));
	BorTGroup->addButton(TransButton, 0);
    connect(BorTGroup, SIGNAL(buttonClicked(int)),
            this, SLOT(BorTGroupClicked(int)));




    BorTToolbar = addToolBar(tc->toUnicode("Pointer type"));
    BorTToolbar->addWidget(BanButton);
	BorTToolbar->addWidget(TransButton);

}
コード例 #5
0
ファイル: sensorwidget.cpp プロジェクト: slew/mne-cpp
void SensorWidget::createUI()
{
    if(m_pSensorModel)
    {
        // Sensor Selection
        QButtonGroup *qBGSensorSelection = new QButtonGroup;
        qBGSensorSelection->setExclusive(true);

        QVBoxLayout *VBoxSensorSelection = new QVBoxLayout;
        for(qint32 i = 0; i < m_pSensorModel->getSensorGroups().size(); ++i)
        {
            QToolButton *sensorSelectionButton = new QToolButton;
            sensorSelectionButton->setText(m_pSensorModel->getSensorGroups()[i].getGroupName());
            qBGSensorSelection->addButton(sensorSelectionButton,i);
            VBoxSensorSelection->addWidget(sensorSelectionButton);
        }

        connect(qBGSensorSelection, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), m_pSensorModel, &SensorModel::applySensorGroup);


        // Layout Selection
        QButtonGroup *qBGLayout = new QButtonGroup;
        qBGLayout->setExclusive(true);

        QHBoxLayout *HBoxButtonGroupLayout = new QHBoxLayout;

        for(qint32 i = 0; i < m_pSensorModel->getNumLayouts(); ++i)
        {
            QToolButton *buttonLayout = new QToolButton;
            buttonLayout->setText(m_pSensorModel->getSensorLayouts()[i].getName());
            buttonLayout->setCheckable(true);

            if(i == 0)
                buttonLayout->setChecked(true);
            else
                buttonLayout->setChecked(false);

            qBGLayout->addButton(buttonLayout, i);

            HBoxButtonGroupLayout->addWidget(buttonLayout);
        }

        connect(qBGLayout, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), m_pSensorModel, &SensorModel::setCurrentLayout);


        QGridLayout *topLayout = new QGridLayout;
        topLayout->addWidget(m_pGraphicsView, 0, 0);
        topLayout->addLayout(VBoxSensorSelection, 0, 1);
        topLayout->addLayout(HBoxButtonGroupLayout, 1, 0);

        setLayout(topLayout);
    }
}
コード例 #6
0
ファイル: mainwindow.cpp プロジェクト: RayRiver/QBTEditor
void MainWindow::createToolbars()
{
	QToolButton *dragButton = new QToolButton;
	dragButton->setCheckable(true);
	dragButton->setChecked(true);
	dragButton->setIcon(QIcon(":/images/pointer.png"));

	QToolButton *linePointerButton = new QToolButton;
	linePointerButton->setCheckable(true);
	linePointerButton->setIcon(QIcon(":/images/linepointer.png"));

	m_pointerTypeGroup = new QButtonGroup(this);
	m_pointerTypeGroup->addButton(dragButton, int(BTEditorScene::Mode::Drag));
	m_pointerTypeGroup->addButton(linePointerButton, int(BTEditorScene::Mode::InsertLine));
	connect(m_pointerTypeGroup, SIGNAL(buttonClicked(int)), this, SLOT(onPointerTypeGroupClicked(int)));

	m_sceneScaleCombo = new QComboBox;
	QStringList scales;
	scales << tr("25%") << tr("50%") << tr("75%") << tr("100%") << tr("150%") << tr("200%");
	m_sceneScaleCombo->addItems(scales);
	m_sceneScaleCombo->setCurrentIndex(3);
	connect(m_sceneScaleCombo, SIGNAL(currentIndexChanged(QString)), this, SLOT(onSceneScaleChanged(QString)));

	m_pointerToolbar = addToolBar(tr("pointer"));
	m_pointerToolbar->addWidget(dragButton);
	m_pointerToolbar->addWidget(linePointerButton);
	m_pointerToolbar->addWidget(m_sceneScaleCombo);
}
コード例 #7
0
void QmitkToolSelectionBox::toolButtonClicked(int id)
{
  if ( !QWidget::isEnabled() ) return; // this method could be triggered from the constructor, when we are still disabled

  MITK_DEBUG << "toolButtonClicked(" << id << "): id translates to tool ID " << m_ToolIDForButtonID[id];

  //QToolButton* toolButton = dynamic_cast<QToolButton*>( Q3ButtonGroup::find(id) );
  QToolButton* toolButton = dynamic_cast<QToolButton*>( m_ToolButtonGroup->buttons().at(id) );
  if (toolButton)
  {
    if (    (m_ButtonIDForToolID.find( m_ToolManager->GetActiveToolID() ) != m_ButtonIDForToolID.end()) // if we have this tool in our box
         && (m_ButtonIDForToolID[ m_ToolManager->GetActiveToolID() ] == id) ) // the tool corresponding to this button is already active
    {
      // disable this button, disable all tools
      // mmueller
      toolButton->setChecked(false);
      m_ToolManager->ActivateTool(-1); // disable everything
    }
    else
    {
      // enable the corresponding tool
      m_SelfCall = true;

      m_ToolManager->ActivateTool( m_ToolIDForButtonID[id] );

      m_SelfCall = false;
    }
  }

}
コード例 #8
0
void AMBrowseScansView::addChildView(QAbstractItemView *childView, const QIcon &icon)
{
	if(!childView)
		return;

	childViews_.append(childView);
	childView->setModel(proxyModel_);

	QToolButton* viewButton = new QToolButton();
	viewButton->setIcon(icon);
	viewButton->setCheckable(true);
	if(viewButtonGroup_->buttons().isEmpty())
		viewButton->setChecked(true);

	viewButtonLayout_->addWidget(viewButton);
	viewButtonGroup_->addButton(viewButton);
	childViewDisplayArea_->addWidget(childView);
	viewButtonGroup_->setId(viewButton, viewButtonGroup_->buttons().count()-1);

	childView->setContextMenuPolicy(Qt::CustomContextMenu);
	childView->setDragEnabled(true);
	childView->setDropIndicatorShown(true);
	connect(childView, SIGNAL(doubleClicked(const QModelIndex&)), this, SIGNAL(childViewDoubleClicked(const QModelIndex&)));
	connect(childView, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(onContextMenuRequested(const QPoint&)));
	connect(childView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(onChildViewSelectionChanged()));
}
コード例 #9
0
void fmSegmentsImpl::createToolbars()
{
	mainToolBar = addToolBar(tr("Start"));
	mainToolBar->addAction(startAction);

	editToolBar = addToolBar(tr("Edit"));
  //editToolBar->addAction(deleteAction);
	editToolBar->addAction(clearAction);

	QToolButton *pointerButton = new QToolButton;
  pointerButton->setCheckable(true);
  pointerButton->setIcon(QIcon("./images/pointer.png"));
  QToolButton *linePointerButton = new QToolButton;
  linePointerButton->setCheckable(true);
	linePointerButton->setChecked(true);
  linePointerButton->setIcon(QIcon("./images/linepointer.png"));

  pointerTypeGroup = new QButtonGroup;
  pointerTypeGroup->addButton(pointerButton, int(SegmentScene::MoveSegment));
  pointerTypeGroup->addButton(linePointerButton, int(SegmentScene::InsertSegment));
  connect(pointerTypeGroup, SIGNAL(buttonClicked(int )), this, SLOT(pointerGroupClicked(int )));

	pointerToolbar = addToolBar(tr("Pointer type"));
  pointerToolbar->addWidget(pointerButton);
  pointerToolbar->addWidget(linePointerButton);
}
コード例 #10
0
void MainWindow::creatToolbar()
{
    QToolButton *pointerButton = new QToolButton;
    pointerButton->setCheckable(true);
    pointerButton->setChecked(true);
    pointerButton->setIcon(QIcon(":/images/pointer.png"));

    QToolButton *linkButton = new QToolButton;
    linkButton->setCheckable(true);
    linkButton->setIcon(QIcon(":/images/link.png"));

    pointerTypeGroup = new QButtonGroup;
    pointerTypeGroup->addButton(pointerButton,FDBScene::MoveItem);
    pointerTypeGroup->addButton(linkButton,FDBScene::InsertLine);
    connect(pointerTypeGroup,SIGNAL(buttonClicked(int)),this,SLOT(pointerTypeGroupClicked(int)));

    editToolBar = addToolBar(tr("Edit"));
    editToolBar->addAction(addAndGateAction);
    editToolBar->addAction(addOrGateAction);
    editToolBar->addAction(addOrGateAction);
    editToolBar->addAction(addNotGateAction);
    //...
    editToolBar->addSeparator();

    editToolBar->addAction(cutAction);
    editToolBar->addAction(copyAction);
    editToolBar->addAction(pasteAction);
    editToolBar->addSeparator();
    editToolBar->addAction(deleteAction);
    editToolBar->addAction(bringToFrontAction);
    editToolBar->addAction(sendToBackAction);
    editToolBar->addWidget(pointerButton);
    editToolBar->addWidget(linkButton);
}
コード例 #11
0
QWidget *QmlProfilerTraceView::createToolbar()
{
    Utils::StyledBar *bar = new Utils::StyledBar(this);
    bar->setStyleSheet(QLatin1String("background: #9B9B9B"));
    bar->setSingleRow(true);
    bar->setFixedWidth(150);
    bar->setFixedHeight(24);

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

    QToolButton *buttonPrev= new QToolButton;
    buttonPrev->setIcon(QIcon(QLatin1String(":/qmlprofiler/ico_prev.png")));
    buttonPrev->setToolTip(tr("Jump to previous event"));
    connect(buttonPrev, SIGNAL(clicked()), this, SIGNAL(jumpToPrev()));
    connect(this, SIGNAL(enableToolbar(bool)), buttonPrev, SLOT(setEnabled(bool)));

    QToolButton *buttonNext= new QToolButton;
    buttonNext->setIcon(QIcon(QLatin1String(":/qmlprofiler/ico_next.png")));
    buttonNext->setToolTip(tr("Jump to next event"));
    connect(buttonNext, SIGNAL(clicked()), this, SIGNAL(jumpToNext()));
    connect(this, SIGNAL(enableToolbar(bool)), buttonNext, SLOT(setEnabled(bool)));

    QToolButton *buttonZoomControls = new QToolButton;
    buttonZoomControls->setIcon(QIcon(QLatin1String(":/qmlprofiler/ico_zoom.png")));
    buttonZoomControls->setToolTip(tr("Show zoom slider"));
    buttonZoomControls->setCheckable(true);
    buttonZoomControls->setChecked(false);
    connect(buttonZoomControls, SIGNAL(toggled(bool)), this, SIGNAL(showZoomSlider(bool)));
    connect(this, SIGNAL(enableToolbar(bool)), buttonZoomControls, SLOT(setEnabled(bool)));

    d->m_buttonRange = new QToolButton;
    d->m_buttonRange->setIcon(QIcon(QLatin1String(":/qmlprofiler/ico_rangeselection.png")));
    d->m_buttonRange->setToolTip(tr("Select range"));
    d->m_buttonRange->setCheckable(true);
    d->m_buttonRange->setChecked(false);
    connect(d->m_buttonRange, SIGNAL(clicked(bool)), this, SLOT(toggleRangeMode(bool)));
    connect(this, SIGNAL(enableToolbar(bool)), d->m_buttonRange, SLOT(setEnabled(bool)));
    connect(this, SIGNAL(rangeModeChanged(bool)), d->m_buttonRange, SLOT(setChecked(bool)));

    d->m_buttonLock = new QToolButton;
    d->m_buttonLock->setIcon(QIcon(QLatin1String(":/qmlprofiler/ico_selectionmode.png")));
    d->m_buttonLock->setToolTip(tr("View event information on mouseover"));
    d->m_buttonLock->setCheckable(true);
    d->m_buttonLock->setChecked(false);
    connect(d->m_buttonLock, SIGNAL(clicked(bool)), this, SLOT(toggleLockMode(bool)));
    connect(this, SIGNAL(enableToolbar(bool)), d->m_buttonLock, SLOT(setEnabled(bool)));
    connect(this, SIGNAL(lockModeChanged(bool)), d->m_buttonLock, SLOT(setChecked(bool)));

    toolBarLayout->addWidget(buttonPrev);
    toolBarLayout->addWidget(buttonNext);
    toolBarLayout->addWidget(new Utils::StyledSeparator());
    toolBarLayout->addWidget(buttonZoomControls);
    toolBarLayout->addWidget(new Utils::StyledSeparator());
    toolBarLayout->addWidget(d->m_buttonRange);
    toolBarLayout->addWidget(d->m_buttonLock);

    return bar;
}
コード例 #12
0
ファイル: KviWindow.cpp プロジェクト: Cizzle/KVIrc
QToolButton * KviWindow::createToolButton(QWidget * pPar, const char * pcName, KviIconManager::SmallIcon eIcon, const QString & szToolTip, bool bOn)
{
	QToolButton * pTool = new QToolButton(pPar);
	pTool->setObjectName(pcName);
	pTool->setIcon(QIcon(*(g_pIconManager->getSmallIcon(eIcon))));
	pTool->setAutoRaise(true);
	pTool->setChecked(bOn);
	KviTalToolTip::add(pTool, szToolTip);
	return pTool;
}
コード例 #13
0
ファイル: taskwindow.cpp プロジェクト: AtlantisCD9/Qt
static QToolButton *createFilterButton(QIcon icon, const QString &toolTip,
                                       QObject *receiver, const char *slot)
{
    QToolButton *button = new QToolButton;
    button->setIcon(icon);
    button->setToolTip(toolTip);
    button->setCheckable(true);
    button->setChecked(true);
    button->setAutoRaise(true);
    button->setEnabled(true);
    QObject::connect(button, SIGNAL(toggled(bool)), receiver, slot);
    return button;
}
コード例 #14
0
ファイル: qwwtaskpanel.cpp プロジェクト: TeamKami/KamiCmd
void Task::setOpen(bool o) {
    QToolButton *b = m_header->toggleButton();
    if (b->isChecked() == o) {
        b->setChecked(o);
        if (b->arrowType()!=Qt::NoArrow) {
            if (o) {
                b->setArrowType(Qt::UpArrow);
            } else {
                b->setArrowType(Qt::DownArrow);
            }
        }
        QwwTaskPanel *tp = parent() ? qobject_cast<QwwTaskPanel*>(parent()->parent()->parent()->parent()) : 0;
        if(tp && tp->isAnimated()){
        if (m_animator.state()!=QTimeLine::NotRunning) {
            m_animator.setDirection(m_animator.direction()==QTimeLine::Forward ? QTimeLine::Backward : QTimeLine::Forward);
        } else {
            m_animBody = new QWidget;
            m_animBody->installEventFilter(this);
#ifndef Q_WS_WIN
            m_animBody->setEnabled(false);
#endif
            m_animBody->setAttribute(Qt::WA_NoSystemBackground, true);
            body()->ensurePolished();
            QSize s = QLayout::closestAcceptableSize(body(), body()->sizeHint()).expandedTo(QSize(width(), 0));
            body()->resize(s);

            body()->setAttribute(Qt::WA_WState_ExplicitShowHide, true);
            body()->setAttribute(Qt::WA_WState_Hidden, false);
            m_animpix = QPixmap::grabWidget(body());
            body()->setAttribute(Qt::WA_WState_Hidden, true);
            if (o) {
                m_animator.setDirection(QTimeLine::Forward);
                m_animator.setFrameRange(0, s.height());
            } else {
                m_animator.setDirection(QTimeLine::Backward);
                m_animator.setFrameRange(0, m_body->height());
            }
            m_body->hide();
            QVBoxLayout *l = (QVBoxLayout*)layout();
            l->addWidget(m_animBody);
            m_animBody->show();
            m_animator.start();
        }
        } else {
            if(o)
                m_body->show();
            else
                m_body->hide();
        }
    }
}
コード例 #15
0
Core::NavigationView FolderNavigationWidgetFactory::createWidget()
{
    Core::NavigationView n;
    FolderNavigationWidget *ptw = new FolderNavigationWidget;
    n.widget = ptw;
    QToolButton *toggleSync = new QToolButton;
    toggleSync->setIcon(QIcon(QLatin1String(Core::Constants::ICON_LINK)));
    toggleSync->setCheckable(true);
    toggleSync->setChecked(ptw->autoSynchronization());
    toggleSync->setToolTip(tr("Synchronize with Editor"));
    connect(toggleSync, SIGNAL(clicked(bool)), ptw, SLOT(toggleAutoSynchronization()));
    n.dockToolBarWidgets << toggleSync;
    return n;
}
コード例 #16
0
ファイル: monitoreditwidget.cpp プロジェクト: eddrog/kdenlive
void MonitorEditWidget::addCustomButton(const QIcon& icon, const QString& text, const QObject* receiver, const char* member, bool checkable, bool checked)
{
    QToolButton *button = new QToolButton(m_ui.frameCustomControls);
    button->setIcon(icon);
    button->setToolTip(text);
    button->setCheckable(checkable);
    button->setChecked(checked);
    button->setAutoRaise(true);
    if (checkable)
        connect(button, SIGNAL(toggled(bool)), receiver, member);
    else
        connect(button, SIGNAL(clicked()), receiver, member);
    m_customControlsLayout->addWidget(button);
}
コード例 #17
0
void CIndicatorEditorMainWindow::_CreateToolBarPointerType()
{
	//
	QToolButton *pToolButtonPointer = NULL;
	QToolButton *pToolButtonLinePointer = NULL;

	m_pToolBarPointer = this->addToolBar(QObject::tr("Pointer type"));

	m_pButtonGroupPointerType = new QButtonGroup(this);
	pToolButtonPointer = new QToolButton();
	pToolButtonLinePointer = new QToolButton();


	pToolButtonPointer->setCheckable(true);
	pToolButtonPointer->setChecked(true);
	pToolButtonPointer->setIcon(QIcon(":/images/pointer.png"));
	pToolButtonPointer->setToolTip(QObject::tr("SelectItem"));

	pToolButtonLinePointer->setCheckable(true);
	pToolButtonLinePointer->setIcon(QIcon(":/images/linepointer.png"));
	pToolButtonLinePointer->setToolTip(QObject::tr("InsertLine"));

	m_pButtonGroupPointerType->addButton(pToolButtonPointer, int(ActionType_MoveItem));
	m_pButtonGroupPointerType->addButton(pToolButtonLinePointer, int(ActionType_Insert_CInformationRectItemEdge));
	//connect(m_pButtonGroupPointerType, SIGNAL(buttonClicked(int)), this, SLOT(slotPointerGroupClicked(int)));//DiagramScene::Mode_MoveItem DiagramScene::Mode_InsertLine


	//connect(m_pComboBoxSceneScale, SIGNAL(currentIndexChanged(QString)), this, SLOT(sceneScaleChanged(QString)));

	QGroupBox* pGroupBoxScale = NULL;
	QVBoxLayout* pGroupLayoutScale = NULL;
	QSize nScaleSliderSize = QSize(400, 40);

	pGroupBoxScale = new QGroupBox(this);
	pGroupBoxScale->setTitle(tr("Scale"));
	m_pSliderScale = new QSlider(Qt::Horizontal, pGroupBoxScale);
	m_pSliderScale->setRange(1, 4000);
	m_pSliderScale->setValue(1000);
	//scaleSlider->setMaximumSize(nScaleSliderSize);
	//scaleSlider->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
	pGroupLayoutScale = new QVBoxLayout(pGroupBoxScale);
	pGroupLayoutScale->addWidget(m_pSliderScale);


	m_pToolBarPointer->addWidget(pToolButtonPointer);
	m_pToolBarPointer->addWidget(pToolButtonLinePointer);
	m_pToolBarPointer->addWidget(pGroupBoxScale);

}
コード例 #18
0
void PreferencesDialog::getToolButton(const QString& ic, const QString& text, int indexOfStackedWidget) {
    QToolButton *button = new QToolButton;
    button->setIcon(ApplicationData::icon(ic));
    button->setText(text);
    button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    button->setFixedSize(QSize(90, 64));
    button->setCheckable(true);
    if(indexOfStackedWidget == 0) button->setChecked(true);
    connect(button, &QToolButton::toggled, [ = ] (){
        pagesWidget_->setCurrentIndex(indexOfStackedWidget);
    });
    
    toolBarButtonGroup_->addButton(button);
    contentsWidget_->addWidget(button);
}
コード例 #19
0
Core::NavigationView
NavigationWidgetFactory::createWidget()
{
    Core::NavigationView n;
    NavigationWidget *ptw = new NavigationWidget;
    n.widget = ptw;

    QToolButton * toggleSync = new QToolButton;
    toggleSync->setIcon( QIcon(":/core/images/linkicon.png"));
    toggleSync->setCheckable( true );
    toggleSync->setChecked( ptw->autoSyncronization() );
    toggleSync->setToolTip( tr("Synchronize with Editor" ) );
    // filter->setPopupMode( QToolButton:: InstantPopup );

    connect( toggleSync, SIGNAL(clicked(bool)), ptw, SLOT( toggleAutoSynchronization() ) );

    n.dockToolBarWidgets << toggleSync;
    return n;
}
コード例 #20
0
GraphHierarchiesEditor::GraphHierarchiesEditor(QWidget *parent): QWidget(parent), _ui(new Ui::GraphHierarchiesEditorData), _contextGraph(NULL), _model(NULL) {
  _ui->setupUi(this);
  _ui->hierarchiesTree->addAction(_ui->actionDelete_All);
  _ui->actionDelete_All->setShortcutContext(Qt::WidgetWithChildrenShortcut);

  QToolButton* linkButton = new QToolButton();
  linkButton->setObjectName("linkButton");
  linkButton->setIcon(QIcon(":/tulip/gui/icons/16/link.png"));
  linkButton->setToolTip("Click here to disable the synchronization with workspace active panel.\nWhen synchronization is enabled, the graph currently displayed\nin the active panel, becomes the current one in the Graphs panel.");
  linkButton->setIconSize(QSize(22,22));
  linkButton->setMinimumSize(25,25);
  linkButton->setMaximumSize(25,25);
  linkButton->setCheckable(true);
  linkButton->setChecked(true);
  _ui->header->insertWidget(linkButton);
  _linkButton = linkButton;
  connect(linkButton, SIGNAL(toggled(bool)),
          this, SLOT(toggleSynchronization(bool)));
  _ui->hierarchiesTree->installEventFilter(this);

  connect(_ui->hierarchiesTree, SIGNAL(clicked(const QModelIndex &)),
          this, SLOT(clicked(const QModelIndex &)));
}
コード例 #21
0
AMScanViewScanBar::AMScanViewScanBar(AMScanSetModel* model, int scanIndex, QWidget* parent)
	: QFrame(parent)
{
	model_ = model;
	scanIndex_ = scanIndex;

	setObjectName("AMScanViewScanBar");
	setStyleSheet("QFrame#AMScanViewScanBar { "
				  "background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(81, 81, 81, 255), stop:0.494444 rgba(81, 81, 81, 255), stop:0.5 rgba(64, 64, 64, 255), stop:1 rgba(64, 64, 64, 255));"
				  "border-bottom: 1px solid black;"
				  "}");


	exclusiveModeOn_ = false;
	sourceButtons_.setExclusive(false);

	AMScan* source = model->scanAt(scanIndex_);


	// UI Setup:
	///////////////////////

	QHBoxLayout* hl = new QHBoxLayout();
	nameLabel_ = new QLabel();
	if(source)
		nameLabel_->setText(source->name() + QString(" #%1").arg(source->number()));
	nameLabel_->setStyleSheet("color: white;");
	hl->addWidget(nameLabel_);
	hl->addStretch(0);

	cramBar_ = new AMCramBarHorizontal();


	if(source) {
		for(int i=0; i<source->dataSourceCount(); i++) {
			QColor color = model->plotColor(scanIndex, i);

			QToolButton* sourceButton = new AMColoredTextToolButton(color); /// \todo special buttons, with lines underneath that show the line color / style, and differentiate 1D, 2D datasets.

			sourceButton->setMaximumHeight(18);
			sourceButton->setText(source->dataSourceAt(i)->name());	/// \todo description or name? both? name if description is empty?
			sourceButton->setCheckable(true);
			sourceButton->setChecked(model->isVisible(scanIndex, i));
			sourceButtons_.addButton(sourceButton, i);
			cramBar_->addWidget(sourceButton);
			// hide the button if this data source should be hidden from users:
			sourceButton->setHidden(model->isHiddenFromUsers(scanIndex, i));

			sourceButton->setContextMenuPolicy(Qt::CustomContextMenu);
			connect(sourceButton, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onDataSourceButtonRightClicked(QPoint)));
		}
	}

	hl->addWidget(cramBar_);
	hl->addStretch(1);

	hl->setContentsMargins(6, 0, 6, 0);
	hl->setSpacing(24);
	setLayout(hl);

	connect(model, SIGNAL(rowsInserted(QModelIndex, int, int)), this, SLOT(onRowInserted(QModelIndex,int,int)));
	connect(model, SIGNAL(rowsAboutToBeRemoved(QModelIndex, int, int)), this, SLOT(onRowAboutToBeRemoved(QModelIndex,int,int)));
	connect(model, SIGNAL(rowsRemoved(QModelIndex, int, int)), this, SLOT(onRowRemoved(QModelIndex,int,int)));
	connect(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(onModelDataChanged(QModelIndex,QModelIndex)));
	connect(model, SIGNAL(exclusiveDataSourceChanged(QString)), this, SLOT(onExclusiveDataSourceChanged(QString)));

	connect(&sourceButtons_, SIGNAL(buttonClicked(int)), this, SLOT(onSourceButtonClicked(int)));

	// connect(closeButton_, SIGNAL(clicked()), this, SLOT(onCloseButtonClicked()));

}
コード例 #22
0
void QmitkToolSelectionBox::RecreateButtons()
{
  if (m_ToolManager.IsNull()) return;

  /*
  // remove all buttons that are there
  QObjectList *l = Q3ButtonGroup::queryList( "QButton" );
  QObjectListIt it( *l ); // iterate over all buttons
  QObject *obj;

  while ( (obj = it.current()) != 0 )
  {
    ++it;
    QButton* button = dynamic_cast<QButton*>(obj);
    if (button)
    {
      Q3ButtonGroup::remove(button);
      delete button;
    }
  }
  delete l; // delete the list, not the objects
  */

  // mmueller Qt impl
  QList<QAbstractButton *> l = m_ToolButtonGroup->buttons();
  // remove all buttons that are there
  QList<QAbstractButton *>::iterator it;
  QAbstractButton * btn;

  for(it=l.begin(); it!=l.end();++it)
  {
    btn = *it;
    m_ToolButtonGroup->removeButton(btn);
    //this->removeChild(btn);
    delete btn;
  }
  // end mmueller Qt impl

  mitk::ToolManager::ToolVectorTypeConst allPossibleTools = m_ToolManager->GetTools();
  mitk::ToolManager::ToolVectorTypeConst allTools;

  typedef std::pair< std::string::size_type, const mitk::Tool* > SortPairType;
  typedef std::priority_queue< SortPairType > SortedToolQueueType;
  SortedToolQueueType toolPositions;

  // clear and sort all tools
  // step one: find name/group of all tools in m_DisplayedGroups string. remember these positions for all tools.
  for ( mitk::ToolManager::ToolVectorTypeConst::const_iterator iter = allPossibleTools.begin();
        iter != allPossibleTools.end();
        ++iter)
  {
    const mitk::Tool* tool = *iter;

    std::string::size_type namePos =  m_DisplayedGroups.find( std::string("'") + tool->GetName() + "'" );
    std::string::size_type groupPos = m_DisplayedGroups.find( std::string("'") + tool->GetGroup() + "'" );

    if ( !m_DisplayedGroups.empty() && namePos == std::string::npos && groupPos == std::string::npos ) continue; // skip

    if ( m_DisplayedGroups.empty() && std::string(tool->GetName()).length() > 0 )
    {
      namePos = static_cast<std::string::size_type> (tool->GetName()[0]);
    }

    SortPairType thisPair = std::make_pair( namePos < groupPos ? namePos : groupPos, *iter );
    toolPositions.push( thisPair );
  }

  // step two: sort tools according to previously found positions in m_DisplayedGroups
  MITK_DEBUG << "Sorting order of tools (lower number --> earlier in button group)";
  while ( !toolPositions.empty() )
  {
    SortPairType thisPair = toolPositions.top();
    MITK_DEBUG << "Position " << thisPair.first << " : " << thisPair.second->GetName();

    allTools.push_back( thisPair.second );
    toolPositions.pop();
  }
  std::reverse( allTools.begin(), allTools.end() );

  MITK_DEBUG << "Sorted tools:";
  for ( mitk::ToolManager::ToolVectorTypeConst::const_iterator iter = allTools.begin();
        iter != allTools.end();
        ++iter)
  {
    MITK_DEBUG << (*iter)->GetName();
  }

  // try to change layout... bad?
  //Q3GroupBox::setColumnLayout ( m_LayoutColumns, Qt::Horizontal );
  // mmueller using gridlayout instead of Q3GroupBox
  //this->setLayout(0);
  if(m_ButtonLayout == NULL)
    m_ButtonLayout = new QGridLayout;
  /*else
    delete m_ButtonLayout;*/

  int row(0);
  int column(-1);

  int currentButtonID(0);
  m_ButtonIDForToolID.clear();
  m_ToolIDForButtonID.clear();
  QToolButton* button = 0;

  MITK_DEBUG << "Creating buttons for tools";
  // fill group box with buttons
  for ( mitk::ToolManager::ToolVectorTypeConst::const_iterator iter = allTools.begin();
        iter != allTools.end();
        ++iter)
  {
    const mitk::Tool* tool = *iter;
    int currentToolID( m_ToolManager->GetToolID( tool ) );

    ++column;
    // new line if we are at the maximum columns
    if(column == m_LayoutColumns)
    {
      ++row;
      column = 0;
    }

    button = new QToolButton;
    button->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
    // add new button to the group
    MITK_DEBUG << "Adding button with ID " << currentToolID;
    m_ToolButtonGroup->addButton(button, currentButtonID);
    // ... and to the layout
    MITK_DEBUG << "Adding button in row/column " << row << "/" << column;
    m_ButtonLayout->addWidget(button, row, column);

    if (m_LayoutColumns == 1)
    {
      //button->setTextPosition( QToolButton::BesideIcon );
      // mmueller
      button->setToolButtonStyle( Qt::ToolButtonTextBesideIcon );
    }
    else
    {
      //button->setTextPosition( QToolButton::BelowIcon );
      // mmueller
      button->setToolButtonStyle( Qt::ToolButtonTextUnderIcon );
    }

    //button->setToggleButton( true );
    // mmueller
    button->setCheckable ( true );

    if(currentToolID == m_ToolManager->GetActiveToolID())
      button->setChecked(true);

    QString label;
    if (m_GenerateAccelerators)
    {
      label += "&";
    }
    label += tool->GetName();
    QString tooltip = tool->GetName();
    MITK_DEBUG << tool->GetName() << ", " << label.toLocal8Bit().constData() << ", '" << tooltip.toLocal8Bit().constData();

    if ( m_ShowNames )
    {
      /*
      button->setUsesTextLabel(true);
      button->setTextLabel( label );              // a label
      QToolTip::add( button, tooltip );
      */
      // mmueller Qt
      button->setText( label );              // a label
      button->setToolTip( tooltip );
      // mmueller

      QFont currentFont = button->font();
      currentFont.setBold(false);
      button->setFont( currentFont );
    }

    us::ModuleResource iconResource = tool->GetIconResource();

    if (!iconResource.IsValid())
    {
      button->setIcon(QIcon(QPixmap(tool->GetXPM())));
    }
    else
    {
      us::ModuleResourceStream resourceStream(iconResource, std::ios::binary);
      resourceStream.seekg(0, std::ios::end);
      std::ios::pos_type length = resourceStream.tellg();
      resourceStream.seekg(0, std::ios::beg);

      char* data = new char[length];
      resourceStream.read(data, length);
      QPixmap pixmap;
      pixmap.loadFromData(QByteArray::fromRawData(data, length));
      QIcon* icon = new QIcon(pixmap);
      delete[] data;

      button->setIcon(*icon);

      if (m_ShowNames)
      {
        if (m_LayoutColumns == 1)
          button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
        else
          button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);

        button->setIconSize(QSize(24, 24));
      }
      else
      {
        button->setToolButtonStyle(Qt::ToolButtonIconOnly);
        button->setIconSize(QSize(32,32));
        button->setToolTip(tooltip);
      }
    }

    if (m_GenerateAccelerators)
    {
      QString firstLetter = QString( tool->GetName() );
      firstLetter.truncate( 1 );
      button->setShortcut( firstLetter );                      // a keyboard shortcut (just the first letter of the given name w/o any CTRL or something)
    }

    mitk::DataNode* dataNode = m_ToolManager->GetReferenceData(0);

    if (dataNode != NULL && !tool->CanHandle(dataNode->GetData()))
      button->setEnabled(false);

    m_ButtonIDForToolID[currentToolID] = currentButtonID;
    m_ToolIDForButtonID[currentButtonID] = currentToolID;

    MITK_DEBUG << "m_ButtonIDForToolID[" << currentToolID << "] == " << currentButtonID;
    MITK_DEBUG << "m_ToolIDForButtonID[" << currentButtonID << "] == " << currentToolID;

    tool->GUIProcessEventsMessage += mitk::MessageDelegate<QmitkToolSelectionBox>( this, &QmitkToolSelectionBox::OnToolGUIProcessEventsMessage ); // will never add a listener twice, so we don't have to check here
    tool->ErrorMessage += mitk::MessageDelegate1<QmitkToolSelectionBox, std::string>( this, &QmitkToolSelectionBox::OnToolErrorMessage ); // will never add a listener twice, so we don't have to check here
    tool->GeneralMessage += mitk::MessageDelegate1<QmitkToolSelectionBox, std::string>( this, &QmitkToolSelectionBox::OnGeneralToolMessage );

    ++currentButtonID;
  }
  // setting grid layout for this groupbox
  this->setLayout(m_ButtonLayout);

  //this->update();
}
コード例 #23
0
void QmitkToolSelectionBox::SetOrUnsetButtonForActiveTool()
{
  // we want to emit a signal in any case, whether we selected ourselves or somebody else changes "our" tool manager. --> emit before check on m_SelfCall
  int id = m_ToolManager->GetActiveToolID();

  // don't emit signal for shape model tools
  bool emitSignal = true;
  mitk::Tool* tool = m_ToolManager->GetActiveTool();
  if(tool && std::string(tool->GetGroup()) == "organ_segmentation")
    emitSignal = false;

  if(emitSignal)
    emit ToolSelected(id);

  // delete old GUI (if any)
  if ( m_LastToolGUI && m_ToolGUIWidget )
  {
    if (m_ToolGUIWidget->layout())
    {
      m_ToolGUIWidget->layout()->removeWidget(m_LastToolGUI);
    }


    //m_LastToolGUI->reparent(NULL, QPoint(0,0));
    // TODO: reparent <-> setParent, Daniel fragen
    m_LastToolGUI->setParent(0);
    delete m_LastToolGUI; // will hopefully notify parent and layouts
    m_LastToolGUI = NULL;

    QLayout* layout = m_ToolGUIWidget->layout();
    if (layout)
    {
      layout->activate();
    }
  }

  QToolButton* toolButton(NULL);
  //mitk::Tool* tool = m_ToolManager->GetActiveTool();

  if (m_ButtonIDForToolID.find(id) != m_ButtonIDForToolID.end()) // if this tool is in our box
  {
    //toolButton = dynamic_cast<QToolButton*>( Q3ButtonGroup::find( m_ButtonIDForToolID[id] ) );
    toolButton = dynamic_cast<QToolButton*>( m_ToolButtonGroup->buttons().at( m_ButtonIDForToolID[id] ) );
  }

  if ( toolButton )
  {
    // mmueller
    // uncheck all other buttons
    QAbstractButton* tmpBtn = 0;
    QList<QAbstractButton*>::iterator it;
    for(int i=0; i < m_ToolButtonGroup->buttons().size(); ++i)
    {
      tmpBtn = m_ToolButtonGroup->buttons().at(i);
      if(tmpBtn != toolButton)
        dynamic_cast<QToolButton*>( tmpBtn )->setChecked(false);
    }

    toolButton->setChecked(true);

    if (m_ToolGUIWidget && tool)
    {
      // create and reparent new GUI (if any)
      itk::Object::Pointer possibleGUI = tool->GetGUI("Qmitk", "GUI").GetPointer(); // prefix and postfix
      QmitkToolGUI* gui = dynamic_cast<QmitkToolGUI*>( possibleGUI.GetPointer() );

      //!
      m_LastToolGUI = gui;
      if (gui)
      {
        gui->SetTool( tool );

        // mmueller
        //gui->reparent(m_ToolGUIWidget, gui->geometry().topLeft(), true );
        gui->setParent(m_ToolGUIWidget);
        gui->move(gui->geometry().topLeft());
        gui->show();

        QLayout* layout = m_ToolGUIWidget->layout();
        if (!layout)
        {
          layout = new QVBoxLayout( m_ToolGUIWidget );
        }
        if (layout)
        {
          // mmueller
          layout->addWidget( gui );
          //layout->add( gui );
          layout->activate();
        }
      }
    }
  }
  else
  {
    // disable all buttons
    QToolButton* selectedToolButton = dynamic_cast<QToolButton*>( m_ToolButtonGroup->checkedButton() );
    //QToolButton* selectedToolButton = dynamic_cast<QToolButton*>( Q3ButtonGroup::find( Q3ButtonGroup::selectedId() ) );
    if (selectedToolButton)
    {
      // mmueller
      selectedToolButton->setChecked(false);
      //selectedToolButton->setOn(false);
    }
  }
}
コード例 #24
0
MainWindow::MainWindow(QWidget *parent):
    QMainWindow(parent)
{
    d_plot = new Plot(this);

    setCentralWidget(d_plot);

    QToolBar *toolBar = new QToolBar(this);

    QToolButton *btnSpectrogram = new QToolButton(toolBar);
    QToolButton *btnContour = new QToolButton(toolBar);
    QToolButton *btnPrint = new QToolButton(toolBar);

#if QT_VERSION >= 0x040000
    btnSpectrogram->setText("Spectrogram");
    //btnSpectrogram->setIcon(QIcon());
    btnSpectrogram->setCheckable(true);
    btnSpectrogram->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    toolBar->addWidget(btnSpectrogram);

    btnContour->setText("Contour");
    //btnContour->setIcon(QIcon());
    btnContour->setCheckable(true);
    btnContour->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    toolBar->addWidget(btnContour);

	btnPrint->setText("Print");
    btnPrint->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    toolBar->addWidget(btnPrint);
#else
    btnSpectrogram->setTextLabel("Spectrogram");
    //btnSpectrogram->setPixmap(zoom_xpm);
    btnSpectrogram->setToggleButton(true);
    btnSpectrogram->setUsesTextLabel(true);

    btnContour->setTextLabel("Contour");
    //btnContour->setPixmap(zoom_xpm);
    btnContour->setToggleButton(true);
    btnContour->setUsesTextLabel(true);

    btnPrint->setTextLabel("Print");
    btnPrint->setUsesTextLabel(true);
#endif

    addToolBar(toolBar);

    connect(btnSpectrogram, SIGNAL(toggled(bool)), 
        d_plot, SLOT(showSpectrogram(bool)));
    connect(btnContour, SIGNAL(toggled(bool)), 
        d_plot, SLOT(showContour(bool)));
    connect(btnPrint, SIGNAL(clicked()), 
        d_plot, SLOT(printPlot()) );

#if QT_VERSION >= 0x040000
    btnSpectrogram->setChecked(true);
    btnContour->setChecked(false);
#else
    btnSpectrogram->setOn(true);
    btnContour->setOn(false);
#endif
}
コード例 #25
0
controlMainWindow::controlMainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::controlMainWindow)
{
    ui->setupUi(this);
    ui->statusBar->addWidget(&m_txWidget);
    connect(&m_socketClient,SIGNAL(tx()),&m_txWidget,SLOT(tx()));
    connect(&m_socketClient,SIGNAL(rx()),&m_txWidget,SLOT(rx()));
//Botones para la barra de herramientas:
    QToolButton* btnConnect     = new QToolButton(this);
    btnConnect->setMinimumSize(64,64);
    btnConnect->setMaximumSize(64,64);
    btnConnect->setIcon(QIcon(":/icons/icons/connect-icon.png"));
        btnConnect->setIconSize(QSize(64,64));
    connect(btnConnect,SIGNAL(toggled(bool)),ui->connectionWidget,SLOT(connectSocket(bool)));
    btnConnect->setCheckable(true);

    QToolButton* btnShowSensors = new QToolButton(this);
    btnShowSensors->setText("Sensors");
    btnShowSensors->setCheckable(true);
    btnShowSensors->setChecked(false);
    connect(btnShowSensors,SIGNAL(toggled(bool)),ui->sensorViewWidget,SLOT(setVisible(bool)));
    connect(btnShowSensors,SIGNAL(toggled(bool)),&m_socketClient,SLOT(requestSensorData(bool)));

    QToolButton* btnShowBright  = new QToolButton(this);
    btnShowBright->setText("Bright");
    btnShowBright->setCheckable(true);
    btnShowBright->setChecked(false);
    connect(btnShowBright,SIGNAL(toggled(bool)),ui->groupBrightness,SLOT(setVisible(bool)));

    QToolButton* btnOffsetTool = new QToolButton(this);
    btnOffsetTool->setText("OffsetTool");
    btnOffsetTool->setCheckable(true);
    btnOffsetTool->setChecked(false);
    connect(btnOffsetTool,SIGNAL(toggled(bool)),ui->groupOffset ,SLOT(setVisible(bool)));

    QToolButton* btnShowEffects = new QToolButton(this);
    btnShowEffects->setText("Effects");
    btnShowEffects->setCheckable(true);
    btnShowEffects->setChecked(true);
    connect(btnShowEffects,SIGNAL(toggled(bool)),ui->effectsWidget ,SLOT(setVisible(bool)));

    ui->mainToolBar->addWidget(btnConnect);
    ui->mainToolBar->addWidget(btnShowSensors);
    ui->mainToolBar->addWidget(btnShowBright);
    ui->mainToolBar->addWidget(btnShowEffects);
    ui->mainToolBar->addWidget(btnOffsetTool);
//
    ui->sensorViewWidget->hide();
//    ui->effectsWidget->hide();
    ui->groupBrightness->hide();
    ui->groupOffset->hide();

    connect(ui->connectionWidget,SIGNAL(ready())    ,this,SLOT(enableUI()));
    connect(ui->connectionWidget,SIGNAL(notReady()) ,this,SLOT(disableUI()));

    ui->connectionWidget->setClient(&m_socketClient);
    ui->sensorViewWidget->setClient(&m_socketClient);

    connect(ui->btnOff,           SIGNAL(clicked(bool)),&m_socketClient,    SLOT(off()));
    connect(ui->btnNext,          SIGNAL(clicked(bool)),&m_socketClient,    SLOT(nextEffect()));
    connect(ui->btnPrev,          SIGNAL(clicked(bool)),&m_socketClient,    SLOT(prevEffect()));
    connect(ui->btnCircle,        SIGNAL(clicked(bool)),&m_socketClient,    SLOT(animationCircle()));
    connect(ui->btnDoubleCircle,  SIGNAL(clicked(bool)),&m_socketClient,    SLOT(animationDoubleCircle()));
    connect(ui->btnRainbow,       SIGNAL(clicked(bool)),&m_socketClient,    SLOT(animationRainbow()));
    connect(ui->btnFlash ,        SIGNAL(clicked(bool)),&m_socketClient,    SLOT(animationFlash()));
    connect(ui->btnSetColor,      SIGNAL(clicked(bool)),this,               SLOT(setColor()));
    connect(ui->sliderBrightness, SIGNAL(valueChanged(int)),this,           SLOT(setBrightness(int)));
    connect(ui->dialOffset,       SIGNAL(valueChanged(int)),&m_socketClient,SLOT(setOffset(int)));

    disableUI();
}
コード例 #26
0
 virtual void set_value (QVariant value) { m_tool_button->setChecked (value.toBool ());}
コード例 #27
0
ファイル: editortools.cpp プロジェクト: FXIhub/hawk
EditorTools::EditorTools(EditorWorkspace * parent)
  :QGroupBox((QWidget *)parent)
{
  editor = parent;
  setTitle(tr("Tools"));
  QGridLayout * layout = new QGridLayout(this);
  this->setLayout(layout);
  QSize iconSize = QSize(22,22);
  QToolButton * pointer = new QToolButton(this);
  pointer->setIcon(QIcon(":images/cursor_arrow.png"));
  pointer->setToolTip(tr("Drag/Scale Image\n(Shift to activate)"));
  pointer->setIconSize(iconSize);
  pointer->setCheckable(true);
  pointer->setAutoExclusive(true);
  if(editor->editorView()->editorMode() == ImageEditorView::EditorDefaultMode){
    pointer->setChecked(true);
  }
  connect(pointer,SIGNAL(clicked(bool)),this,SLOT(onPointerClicked()));
  layout->addWidget(pointer,0,0);
  QToolButton * bullseye = new QToolButton(this);
  bullseye->setIcon(QIcon(":images/bullseye.png"));
  bullseye->setToolTip(tr("Set Image Center"));
  bullseye->setIconSize(iconSize);
  bullseye->setCheckable(true);
  bullseye->setAutoExclusive(true);
  connect(bullseye,SIGNAL(toggled(bool)),this,SLOT(onBullseyeToggled(bool)));
  layout->addWidget(bullseye,0,1);
  QToolButton * drop = new QToolButton(this);
  drop->setIcon(QIcon(":images/water_drop.png"));
  drop->setToolTip(tr("Blur Image"));
  drop->setIconSize(iconSize);
  drop->setCheckable(true);
  drop->setAutoExclusive(true);
  if(editor->editorView()->editorMode() == ImageEditorView::EditorBlurMode){
    drop->setChecked(true);
  }
  connect(drop,SIGNAL(clicked(bool)),this,SLOT(onDropClicked()));
  layout->addWidget(drop,0,2);
  QToolButton * mathEdit = new QToolButton(this);
  mathEdit->setIcon(QIcon(":images/formula_pi.png"));
  mathEdit->setToolTip(tr("Evaluate Expression"));
  mathEdit->setIconSize(iconSize);
  connect(mathEdit,SIGNAL(clicked(bool)),this,SLOT(onMathEdit()));
  layout->addWidget(mathEdit,0,3);


  QToolButton * editMask = new QToolButton(this);
  editMask->setIcon(QIcon(":images/mask_happy.png"));
  editMask->setToolTip(tr("Edit image mask"));
  editMask->setIconSize(iconSize);
  editMask->setCheckable(true);
  editMask->setAutoExclusive(true);
  connect(editMask,SIGNAL(clicked(bool)),this,SLOT(onEditMaskClicked()));
  layout->addWidget(editMask,0,4);

  /*  QToolButton * filter = new QToolButton(this);
  filter->setIcon(QIcon(":images/optical_filter.png"));
  filter->setToolTip(tr("Filter Image"));
  filter->setIconSize(iconSize);
  filter->setCheckable(true);
  filter->setAutoExclusive(true);
  connect(filter,SIGNAL(clicked(bool)),this,SLOT(onFilterClicked()));
  layout->addWidget(filter,0,4);*/

  QToolButton * selection = new QToolButton(this);
  selection->setIcon(QIcon(":images/selection.png"));
  selection->setToolTip(tr("Select image section"));
  selection->setIconSize(iconSize);
  selection->setCheckable(true);
  selection->setAutoExclusive(true);
  connect(selection,SIGNAL(clicked(bool)),this,SLOT(onSelectionClicked()));
  layout->addWidget(selection,0,5);

  QToolButton * lineout = new QToolButton(this);
  lineout->setIcon(QIcon(":images/lineout_plot.png"));
  lineout->setToolTip(tr("Plot linear profile"));
  lineout->setIconSize(iconSize);
  lineout->setCheckable(true);
  lineout->setAutoExclusive(true);
  connect(lineout,SIGNAL(clicked(bool)),this,SLOT(onLineoutClicked()));
  layout->addWidget(lineout,0,6);

  QToolButton * undo = new QToolButton(this);
  undo->setIcon(QIcon(":images/undo.png"));
  undo->setToolTip(tr("Undo last edit"));
  undo->setIconSize(iconSize);
  undo->setEnabled(false);
  connect(undo,SIGNAL(clicked(bool)),this,SLOT(onUndoClicked()));
  layout->addWidget(undo,1,0);

  QToolButton * redo = new QToolButton(this);
  redo->setIcon(QIcon(":images/redo.png"));
  redo->setToolTip(tr("Redo last undone edit"));
  redo->setIconSize(iconSize);
  redo->setEnabled(false);
  connect(redo,SIGNAL(clicked(bool)),this,SLOT(onRedoClicked()));
  layout->addWidget(redo,1,1);

  QToolButton * removeElectronics = new QToolButton(this);
  removeElectronics->setIcon(QIcon(":images/hardware.png"));
  removeElectronics->setToolTip(tr("Remove electronic noise"));
  removeElectronics->setIconSize(iconSize);
  removeElectronics->setCheckable(true);
  removeElectronics->setAutoExclusive(true);
  connect(removeElectronics,SIGNAL(clicked(bool)),this,SLOT(onRemoveElectronicsClicked()));
  layout->addWidget(removeElectronics,1,2);

  QToolButton * xcamMagic = new QToolButton(this);
  xcamMagic->setIcon(QIcon(":images/xcam.png"));
  xcamMagic->setToolTip(tr("Remove overscan and noise from xcam data"));
  xcamMagic->setIconSize(iconSize);
  connect(xcamMagic,SIGNAL(clicked(bool)),this,SLOT(onXcamMagicClicked()));
  layout->addWidget(xcamMagic,1,3);

  QToolButton * fillEmpty = new QToolButton(this);
  fillEmpty->setIcon(QIcon(":images/magic.png"));
  fillEmpty->setToolTip(tr("Fill data on the missing regions by interpolation"));
  fillEmpty->setIconSize(iconSize);
  fillEmpty->setCheckable(true);
  fillEmpty->setAutoExclusive(true);
  connect(fillEmpty,SIGNAL(clicked(bool)),this,SLOT(onFillEmptyClicked()));
  layout->addWidget(fillEmpty,1,4);

  QToolButton * crop = new QToolButton(this);
  crop->setIcon(QIcon(":images/crop.png"));
  crop->setToolTip(tr("Crop image to selection"));
  crop->setIconSize(iconSize);
  connect(crop,SIGNAL(clicked(bool)),this,SLOT(onCropClicked()));
  layout->addWidget(crop,1,5);

  //  connect(mathEdit,SIGNAL(clicked(bool)),this,SLOT(onMathEdit()));
  
  toolOptions = new QWidget(this);
  QVBoxLayout * vbox = new QVBoxLayout(toolOptions);
  toolOptions->setLayout(vbox);
  QFrame * separator = new QFrame(toolOptions);
  separator->setFrameStyle(QFrame::HLine|QFrame::Raised);
  separator->setLineWidth(1);


  vbox->addWidget(separator);
  toolOptionsLayout = new QStackedLayout();
  vbox->addLayout(toolOptionsLayout);
  toolOptionsLayout->addWidget(new QWidget(toolOptions));
  toolOptionsLayout->addWidget(new QWidget(toolOptions));

  dropToolOptions = new QWidget(toolOptions);
  QGridLayout * grid = new QGridLayout(dropToolOptions);
  dropToolOptions->setLayout(grid);
  grid->addWidget(new QLabel(tr("Brush Radius:"),dropToolOptions),0,0);
  QDoubleSpinBox * spinBox = new QDoubleSpinBox(dropToolOptions);
  connect(spinBox,SIGNAL(valueChanged(double)),editor->editorView(),SLOT(setDropBrushRadius(double)));
  spinBox->setMinimum(0);
  spinBox->setValue(editor->editorView()->getDropBrushRadius());
  grid->addWidget(spinBox,0,1);
  grid->addWidget(new QLabel(tr("Blur Radius:"),dropToolOptions),1,0);
  spinBox = new QDoubleSpinBox(dropToolOptions);
  spinBox->setMinimum(0);
  spinBox->setValue(editor->editorView()->getDropBlurRadius());
  connect(spinBox,SIGNAL(valueChanged(double)),editor->editorView(),SLOT(setDropBlurRadius(double)));
  grid->addWidget(spinBox,1,1);
  toolOptionsLayout->addWidget(dropToolOptions);

  
  editMaskToolOptions = new QWidget(toolOptions);
  grid = new QGridLayout(editMaskToolOptions);
  editMaskToolOptions->setLayout(grid);
  QLabel * label = new QLabel(tr("Mode:"),editMaskToolOptions);
  label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
  grid->addWidget(label,1,1);
  editMaskIncludeButton = new QToolButton(editMaskToolOptions);
  editMaskIncludeButton->setIcon(QIcon(":images/mask_happy.png"));
  editMaskIncludeButton->setToolTip("Include in mask");
  editMaskIncludeButton->setCheckable(true);
  editMaskIncludeButton->setChecked(true);
  editMaskIncludeButton->setAutoExclusive(true);
  grid->addWidget(editMaskIncludeButton,1,2);
  editMaskExcludeButton = new QToolButton(editMaskToolOptions);
  editMaskExcludeButton->setIcon(QIcon(":images/mask_sad.png"));
  editMaskExcludeButton->setToolTip("Exclude from mask");
  editMaskExcludeButton->setCheckable(true);
  editMaskExcludeButton->setAutoExclusive(true);
  grid->addWidget(editMaskExcludeButton,1,3);
  label = new QLabel(tr("Brush Radius:"),editMaskToolOptions);
  label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
  grid->addWidget(label,2,1);

  m_editMaskBrushRadius =  new QSpinBox(editMaskToolOptions);
  connect(m_editMaskBrushRadius,SIGNAL(valueChanged(int)),editor->editorView(),SLOT(updateEditMaskCursor(int)));
  m_editMaskBrushRadius->setValue(5);
  
  grid->addWidget(m_editMaskBrushRadius,2,2,1,2);

  QPushButton * loadMaskFromFile = new QPushButton("Load mask from file",
						   editMaskToolOptions);
  loadMaskFromFile->setToolTip("Load a mask from a black and white png file.\n"
			       "White is included in the mask and black excluded.");
  connect(loadMaskFromFile,SIGNAL(clicked()),this,SLOT(onLoadMaskFromFile()));
  grid->addWidget(loadMaskFromFile,3,1,1,3);

  QPushButton * invertMask = new QPushButton("Invert mask",
					     editMaskToolOptions);
  invertMask->setToolTip("Inverts the mask of the current image.");
  connect(invertMask,SIGNAL(clicked()),this,SLOT(onInvertMask()));
  grid->addWidget(invertMask,4,1,1,3);

  grid->setRowStretch(0,100);
  grid->setColumnStretch(0,100);
  grid->setRowStretch(5,100);
  grid->setColumnStretch(5,100);
  toolOptionsLayout->addWidget(editMaskToolOptions);

  filterToolOptions = new QWidget(toolOptions);
  grid = new QGridLayout(filterToolOptions);
  filterToolOptions->setLayout(grid);
  grid->addWidget(new QLabel(tr("Filter Type:"),filterToolOptions),0,0);
  QComboBox * comboBox = new QComboBox(filterToolOptions);
  comboBox->addItem("Gaussian Radial");
  comboBox->addItem("Horizontal bands removal");
  comboBox->setMinimumContentsLength(10);
  comboBox->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon);
  grid->addWidget(comboBox,0,1);
  grid->setRowStretch(2,100);
  grid->setColumnStretch(2,100);
  toolOptionsLayout->addWidget(filterToolOptions);

  selectionToolOptions = new QWidget(toolOptions);
  grid = new QGridLayout(selectionToolOptions);
  selectionToolOptions->setLayout(grid);
  label = new QLabel("Mode:",selectionToolOptions);
  label->setAlignment(Qt::AlignRight);
  grid->addWidget(label,0,0);
  QToolButton *  button = new QToolButton(selectionToolOptions);
  button->setIcon(QIcon(":images/selection.png"));
  button->setToolTip("Set selection");
  button->setCheckable(true);
  button->setChecked(true);
  button->setAutoExclusive(true);
  connect(button,SIGNAL(clicked()),this,SLOT(setSelectionModeSet()));
  grid->addWidget(button,0,1);
  button = new QToolButton(selectionToolOptions);
  button->setIcon(QIcon(":images/selection_union.png"));
  button->setToolTip("Add to selection");
  button->setCheckable(true);
  button->setAutoExclusive(true);
  connect(button,SIGNAL(clicked()),this,SLOT(setSelectionModeUnite()));
  grid->addWidget(button,0,2);
  button = new QToolButton(selectionToolOptions);
  button->setIcon(QIcon(":images/selection_subtract.png"));
  button->setToolTip("Remove from selection");  
  button->setCheckable(true);
  button->setAutoExclusive(true);
  connect(button,SIGNAL(clicked()),this,SLOT(setSelectionModeSubtract()));
  grid->addWidget(button,0,3);
  label = new QLabel("Expression:",selectionToolOptions);
  label->setAlignment(Qt::AlignRight);
  grid->addWidget(label,1,0);
  selectExpression = new QLineEdit("A > 10",selectionToolOptions);
  grid->addWidget(selectExpression,1,1,1,3);
  QPushButton * evalExpression = new QPushButton("Select by Expression",selectionToolOptions);
  connect(evalExpression,SIGNAL(clicked()),this,SLOT(onSelectByExpression()));
  grid->addWidget(evalExpression,2,0,1,4);
  grid->setRowStretch(5,100);
  grid->setColumnStretch(5,100);
  _selectionMode = SelectionSet;
  toolOptionsLayout->addWidget(selectionToolOptions);

  electronicsToolOptions = new QWidget(toolOptions);
  grid = new QGridLayout(electronicsToolOptions);
  electronicsToolOptions->setLayout(grid);
  QPushButton * push = new QPushButton("Remove Vertical Lines",electronicsToolOptions);
  grid->addWidget(push,0,0);
  connect(push,SIGNAL(clicked()),this,SLOT(onRemoveVerticalLinesClicked()));
  push = new QPushButton("Remove Horizontal Lines",electronicsToolOptions);
  grid->addWidget(push,1,0);
  connect(push,SIGNAL(clicked()),this,SLOT(onRemoveHorizontalLinesClicked()));
  toolOptionsLayout->addWidget(electronicsToolOptions);

  fillEmptyToolOptions = new QWidget(toolOptions);
  grid = new QGridLayout(fillEmptyToolOptions);
  fillEmptyToolOptions->setLayout(grid);
  grid->addWidget(new QLabel("Blur Radius (px)",0,0));
  fillBlurRadius =  new QDoubleSpinBox(fillEmptyToolOptions);
  grid->addWidget(fillBlurRadius,0,1);

  grid->addWidget(new QLabel("Iterations"),1,0);
  fillIterations =  new QSpinBox(fillEmptyToolOptions);
  fillIterations->setMinimum(1);
  grid->addWidget(fillIterations,1,1);

  grid->addWidget(new QLabel("Blur Kernel"),2,0);
  fillBlurKernel = new QComboBox(fillEmptyToolOptions);
  fillBlurKernel->addItem("Gaussian");
  fillBlurKernel->addItem("Sinc");
  grid->addWidget(fillBlurKernel,2,1);

  push = new QPushButton("Interpolate",fillEmptyToolOptions);
  grid->addWidget(push,3,0,1,2);
  connect(push,SIGNAL(clicked()),this,SLOT(onInterpolateEmptyClicked()));
  toolOptionsLayout->addWidget(fillEmptyToolOptions);



  toolOptions->hide();
  layout->addWidget(toolOptions,2,0,1,11);
  layout->setColumnStretch(11,100);
  layout->setRowStretch(3,100);
}
コード例 #28
0
ファイル: rotationtool.cpp プロジェクト: LabShare/IMOD
/*
 * The constructor.  The central button is optional, centerIcon and centerTip are the
 * icon and tooltip for it and can be NULL.  size specifies the size of the buttons.
 * The autoRaise flag is used to set whether the buttons autoraise.  A step size label
 * is optional and provided if stepSize >= 0.
 */
RotationTool::RotationTool(QWidget *parent, QIcon *centerIcon, const char *centerTip, 
                           int size, bool autoRaise, float stepSize)
  : QWidget(parent)
{
  int ind, row, col;
  mStepLabel = NULL;
  mCenterBut = NULL;
  if (sFirstTime) {
    for (ind = 0; ind < 8; ind++) {
      sIcons[ind] = new QIcon();
      sIcons[ind]->addFile(QString(sFileList[ind]), QSize(size - 4, size - 4));
    }
  }

  QHBoxLayout *hLayout = new QHBoxLayout(this);
  hLayout->setContentsMargins(0, 0, 0, 0);
  hLayout->setSpacing(0);
  QVBoxLayout *vLayout = new QVBoxLayout();
  hLayout->addLayout(vLayout);
  vLayout->setContentsMargins(0, 0, 0, 0);
  vLayout->setSpacing(2);
  hLayout->addStretch();

  // Make the grid and the signal mapper
  QGridLayout *grid = new QGridLayout();
  vLayout->addLayout(grid);
  grid->setContentsMargins(0, 0, 0, 0);
  grid->setSpacing(autoRaise ? 0 : 4);

  QSignalMapper *rotMapper = new QSignalMapper(this);
  connect(rotMapper, SIGNAL(mapped(int)), this, SLOT(buttonClicked(int)));

  // Fill the grid
  ind = 0;
  for (row = 0; row < 3; row++) {
    for (col = 0; col < 3; col++) {
      QToolButton *button = new QToolButton(this);
      button->setAutoRaise(autoRaise);
      button->setFixedSize(size, size);
      button->setFocusPolicy(Qt::NoFocus);
      grid->addWidget(button, row, col);
      if (col == 1 && row == 1) {

        // Set center toggle button properties
        button->setCheckable(true);
        button->setChecked(false);
        mCenterBut = button;
        if (centerTip)
          button->setToolTip(centerTip);
        if (centerIcon) 
          button->setIcon(*centerIcon);
        connect(mCenterBut, SIGNAL(toggled(bool)), this, SLOT(centerToggled(bool)));
      } else {

        // Set rotation button properties and mapping, and autorepeat for non-step ones
        button->setToolTip(sButtonTips[ind]);
        button->setIcon(*sIcons[ind]);
        rotMapper->setMapping(button, ind);
        connect(button, SIGNAL(clicked()), rotMapper, SLOT(map()));
        if (!sStepSign[ind]) {
          button->setAutoRepeat(true);
          button->setAutoRepeatDelay(300);
          button->setAutoRepeatInterval(100);
        }
        ind++;
      }
    }