コード例 #1
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);
}
コード例 #2
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);
}
コード例 #3
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);
}
コード例 #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
void MainWindow::createToolbars()
{
  
  //////////////////
  QToolBar *fileToolBar;
  fileToolBar = addToolBar(tr("fileToolbar"));
  fileToolBar->addAction(newAction);
  fileToolBar->addAction(openFileAction);
  //  fileToolBar->addAction(saveAction);
  fileToolBar->addAction(saveProjectAction);
  
  //Button for contexts related
  contextItemsButtonGroup = new QButtonGroup(this);  
  QToolButton *selectItemToolButton = new QToolButton(this);  
  selectItemToolButton ->setCheckable(true);
  selectItemToolButton ->setChecked(true);
  selectItemToolButton ->setIcon(QIcon(":/images/pointer.png"));  
  
  QToolButton *insertLineToolButton = new QToolButton(this);
  insertLineToolButton->setCheckable(true);  
  insertLineToolButton->setIcon(QIcon(":/images/linepointer.png"));  
  
  QToolButton *insertPolygonToolButton = new QToolButton(this);
  insertPolygonToolButton->setCheckable(true);  
  insertPolygonToolButton->setIcon(QIcon(":/images/polygon.png"));  
  
  contextItemsButtonGroup->addButton(selectItemToolButton,int(RbeVisualizeWidget_GraphicsScene::ITEM_SELECTION_MODE));
  contextItemsButtonGroup->addButton(insertLineToolButton,int(RbeVisualizeWidget_GraphicsScene::INSERT_LINE_MODE));  
  contextItemsButtonGroup->addButton(insertPolygonToolButton,int(RbeVisualizeWidget_GraphicsScene::INSERT_POLYGON_MODE));
  
  QToolBar *contextItemsButtonGroupToolBar;    
  contextItemsButtonGroupToolBar = addToolBar(tr("contextItemsButtonGroup"));
  contextItemsButtonGroupToolBar->addWidget(selectItemToolButton);
  contextItemsButtonGroupToolBar->addWidget(insertLineToolButton);
  contextItemsButtonGroupToolBar->addWidget(insertPolygonToolButton);    
  
  connect(contextItemsButtonGroup, SIGNAL(buttonClicked(int)),
          this, SLOT(contextItemsButtonGroupClicked()));
  
  
  ////////////////////RULE TOOLBAR  
  QToolBar *ruleToolBar;
  ruleToolBar = addToolBar(tr("ruleToolbar"));
  ruleToolBar->addAction(newRuleAction);
  
  ////////////////////
  QToolBar *runToolBar;
  runToolBar = addToolBar(tr("runToolbar"));  
  //runToolBar->addAction(runAnimateAction);
  runToolBar->addAction(openVideoAction);
  runToolBar->addAction(runVirtualFencingAction);  
  //////////////////////
  QToolBar *exitToolBar;
  exitToolBar = addToolBar((tr("exitToolBar")));
  exitToolBar->addAction(exitAction);
  
}
コード例 #6
0
VESPERSBeamSelectorView::VESPERSBeamSelectorView(QWidget *parent)
	: QWidget(parent)
{
	currentBeam_ = 0;

	beams_ = new QButtonGroup;

	QToolButton *temp = new QToolButton;
	temp->setText("Pink");
	temp->setFixedSize(35, 22);
	temp->setCheckable(true);
	beams_->addButton(temp, 0);

	temp = new QToolButton;
	temp->setText("10%");
	temp->setFixedSize(35, 22);
	temp->setCheckable(true);
	beams_->addButton(temp, 1);

	temp = new QToolButton;
	temp->setText("1.6%");
	temp->setFixedSize(35, 22);
	temp->setCheckable(true);
	beams_->addButton(temp, 2);

	temp = new QToolButton;
	temp->setText("Si");
	temp->setFixedSize(35, 22);
	temp->setCheckable(true);
	beams_->addButton(temp, 3);

	connect(beams_, SIGNAL(buttonClicked(int)), this, SLOT(changeBeam(int)));
	connect(VESPERSBeamline::vespers(), SIGNAL(currentBeamChanged(VESPERS::Beam)), this, SLOT(onCurrentBeamChanged(VESPERS::Beam)));

	progressBar_ = new QProgressBar;
	progressBar_->hide();
	progressBar_->setRange(0, 100);

	QHBoxLayout *buttonsLayout = new QHBoxLayout;
	buttonsLayout->addWidget(beams_->button(0));
	buttonsLayout->addWidget(beams_->button(1));
	buttonsLayout->addWidget(beams_->button(2));
	buttonsLayout->addWidget(beams_->button(3));

	QVBoxLayout *beamSelectorLayout = new QVBoxLayout;
	beamSelectorLayout->addLayout(buttonsLayout);
	beamSelectorLayout->addWidget(progressBar_);

	setLayout(beamSelectorLayout);
}
コード例 #7
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);

}
コード例 #8
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;
}
コード例 #9
0
ファイル: widgets.cpp プロジェクト: akhilo/cmplayer
	QToolButton *make_button(const QString &toolTip, const QIcon &icon, QWidget *parent) {
		QToolButton *button = new QToolButton(parent);
		button->setIcon(icon);
		button->setToolTip(toolTip);
		button->setCheckable(true);
		return button;
	}
コード例 #10
0
    void MainWindow::createStatusBar()
    {
        QColor windowColor = palette().window().color();
        QColor buttonBgColor = windowColor.lighter(105);
        QColor buttonBorderBgColor = windowColor.darker(120);
        QColor buttonPressedColor = windowColor.darker(102);

        QToolButton *log = new QToolButton(this);
        log->setText("Logs");
        log->setCheckable(true);
        log->setDefaultAction(_logDock->toggleViewAction());
        log->setStyleSheet(QString(
            "QToolButton {"
            "   background-color: %1;"
            "   border-style: outset;"
            "   border-width: 1px;"
            "   border-radius: 3px;"
            "   border-color: %2;"
            "   padding: 1px 20px 1px 20px;"
            "} \n"
            ""
            "QToolButton:checked, QToolButton:pressed {"
            "   background-color: %3;"
            "   border-style: inset;"
            "}")
            .arg(buttonBgColor.name())
            .arg(buttonBorderBgColor.name())
            .arg(buttonPressedColor.name()));

        statusBar()->insertWidget(0, log);
        statusBar()->setStyleSheet("QStatusBar::item { border: 0px solid black };");
    }
コード例 #11
0
void FileRenamerDlgImpl::createButtons()
{
    QBoxLayout* pLayout (dynamic_cast<QBoxLayout*>(m_pButtonsW->layout()));
    CB_ASSERT (0 != pLayout);
    /*int nPos (pLayout->indexOf(pOldBtn));
    pLayout->insertWidget(nPos, this);*/

    QObjectList l (m_pButtonsW->children());
    //qDebug("cnt: %d", l.size());

    for (int i = 1, n = l.size(); i < n; ++i) // l[0] is m_pButtonsW's layout (note that m_pAlbumTypeL is in m_pBtnPanelW)
    {
        delete l[i];
    }

    for (int i = 0, n = cSize(m_vstrPatterns); i < n; ++i)
    {
        QToolButton* p (new QToolButton(m_pButtonsW));
        p->setText(toNativeSeparators(convStr(m_vstrPatterns[i])));
        p->setCheckable(true);
        m_pButtonGroup->addButton(p, m_nBtnId++);
        //p->setAutoExclusive(true);
        connect(p, SIGNAL(clicked()), this, SLOT(onPatternClicked()));
        pLayout->insertWidget(i, p);
    }
}
コード例 #12
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()));
}
コード例 #13
0
ファイル: selectors.cpp プロジェクト: euronomus/SimplePainter
//====================================================================================================
FillSelector::FillSelector(QWidget *parent) :
    QFrame(parent){
    for (int i=0; i<FILL_BUTTONS; i++){
        QToolButton *tb = new QToolButton(this);
        tb->setMaximumSize(FILL_BUTTON_SIZE);
        tb->setObjectName(QString("fillButton").append(QString::number(i)));
        tb->setCheckable(true);
        buttongroup.addButton(tb);
        buttongroup.setId(tb, i);
        buttons.push_back(tb);
    }
    buttongroup.button(0)->setChecked(true);
    layout = new QGridLayout(this);
    layout->setSpacing(3);
    layout->setObjectName(QStringLiteral("fillLayout"));
    layout->setContentsMargins(1, 1, 1, 1);
    int r = 0;
    int c = 0;
    for (QToolButton *tb : buttons){
        layout->addWidget(tb, r, c, 1, 1);
        c++;
        if (c==FILL_COLUMNS){
            c = 0;
            r++;
        }
    }
    createIcons();
    //this->setFixedSize(FILL_FRAME_SIZE);

};
コード例 #14
0
void
new_mail_widget::make_toolbars()
{
  QToolBar* toolbar = addToolBar(tr("Message Operations"));
  toolbar->addAction(m_action_send_msg);
  toolbar->addAction(m_action_attach_file);
  toolbar->addAction(m_action_edit_note);
  toolbar->addAction(m_action_add_header);
  toolbar->addAction(m_action_open_notepad);

  m_toolbar_html1 = m_toolbar_html2 = NULL;

  if (m_html_edit) {
    QList<QToolBar*> toolbars = m_html_edit->create_toolbars();
    for (int i=0; i<toolbars.size(); i++) {
      if (i==0) m_toolbar_html1 = toolbars[i];
      if (i==1) {
	addToolBarBreak();
	m_toolbar_html2 = toolbars[i];
      }
      addToolBar(toolbars[i]);
    }
    // Add our own toggle button to the second HTML toolbar
    if (m_toolbar_html2 != NULL) {
      QToolButton* source = new QToolButton();
      source->setIcon(HTML_ICON("stock_view-html-source.png"));
      source->setToolTip(tr("Toggle between HTML source edit and visual edit"));
      source->setCheckable(true);
      connect(source, SIGNAL(toggled(bool)), this, SLOT(toggle_edit_source(bool)));
      m_toolbar_html2->addWidget(source);
    }
  }
コード例 #15
0
ファイル: toolaction.cpp プロジェクト: KDE/okular
QWidget* ToolAction::createWidget( QWidget *parent )
{
    QToolBar *toolBar = qobject_cast< QToolBar * >( parent );
    if ( !toolBar )
        return 0;

    QToolButton *button = new QToolButton( toolBar );
    button->setAutoRaise( true );
    button->setFocusPolicy( Qt::NoFocus );
    button->setIconSize( toolBar->iconSize() );
    button->setToolButtonStyle( toolBar->toolButtonStyle() );
    button->setPopupMode( QToolButton::DelayedPopup );
    button->setMenu( new QMenu( button ) );
    button->setCheckable( true );
    connect(toolBar, &QToolBar::iconSizeChanged, button, &QToolButton::setIconSize);
    connect(toolBar, &QToolBar::toolButtonStyleChanged, button, &QToolButton::setToolButtonStyle);
    connect(button, &QToolButton::triggered, toolBar, &QToolBar::actionTriggered);
    connect( button->menu(), &QMenu::triggered, this, &ToolAction::slotNewDefaultAction );

    m_buttons.append( button );

    if ( !m_actions.isEmpty() )
    {
        button->setDefaultAction( m_actions.first() );
        foreach ( QAction *action, m_actions )
        {
            button->menu()->addAction( action );
            if ( action->isChecked() )
                button->setDefaultAction( action );
        }
コード例 #16
0
ファイル: SidebarWidget.cpp プロジェクト: jernejs/otter
void SidebarWidget::registerPanel(const QString &identifier)
{
	QString title;
	QIcon icon;

	if (identifier == QLatin1String("bookmarks"))
	{
		icon = Utils::getIcon(QLatin1String("bookmarks"));
		title = tr("Bookmarks");
	}
	else if (identifier == QLatin1String("cache"))
	{
		icon  = Utils::getIcon(QLatin1String("cache"));
		title = tr("Cache");
	}
	else if (identifier == QLatin1String("config"))
	{
		icon  = Utils::getIcon(QLatin1String("configuration"));
		title = tr("Configuration");
	}
	else if (identifier == QLatin1String("cookies"))
	{
		icon  = Utils::getIcon(QLatin1String("cookies"));
		title = tr("Cookies");
	}
	else if (identifier == QLatin1String("history"))
	{
		icon  = Utils::getIcon(QLatin1String("view-history"));
		title = tr("History");
	}
	else if (identifier == QLatin1String("transfers"))
	{
		icon  = Utils::getIcon(QLatin1String("transfers"));
		title = tr("Transfers");
	}
	else
	{
		icon  = Utils::getIcon(QLatin1String("text-html"));
		title = identifier.section(':', 1, -1);
	}

	QToolButton *button = new QToolButton(this);
	button->setIcon(icon);
	button->setToolTip(title);
	button->setCheckable(true);
	button->setAutoRaise(true);

	QAction *action = new QAction(button);
	action->setData(identifier);

	m_ui->buttonsLayout->insertWidget(qMax(0, (m_ui->buttonsLayout->count() - 2)), button);

	m_buttons.insert(identifier, button);

	connect(button, SIGNAL(clicked()), action, SLOT(trigger()));
	connect(action, SIGNAL(triggered()), this, SLOT(openPanel()));
}
コード例 #17
0
// Most initialization is moved from constructor to allow signals triggered correctly
void ClipartCategoriesList::loadCategories()
{
	TimeMeasure t("ClipartCategoriesList::loadCategories()");

	// Fetch list of clipart subfolders
	QString baseClipartFolder = AppTools::getClipartResourcesFolder();

	QDir clipartFolder(baseClipartFolder);
	
	if (!clipartFolder.exists()) // If clipart folder not exists (e.g. on development computers) we try to find clipart directly in "Clipart"
	{
		baseClipartFolder = CLIPART_DIR;
#ifdef Q_WS_MAC
		baseClipartFolder = "../../" + baseClipartFolder;
#endif
		clipartFolder = QDir(baseClipartFolder);
	}

	QStringList folders = clipartFolder.entryList(QDir::Dirs | QDir::NoDotAndDotDot);

	// Add a button with action for each subfolder
	QHBoxLayout *layout = new QHBoxLayout;
	layout->setContentsMargins(0, 0, 0, 0);
	layout->setSpacing(0);

	for (int i = 0; i < folders.size(); i++)
	{
		QAction *action = new QAction(this);
		action->setToolTip(folders[i]);

		QString categoryFolder = AppTools::addPathSeparator(baseClipartFolder) + folders[i];

		QString iconFile = categoryFolder + CLIPART_ICON_EXTENSION;
		QIcon icon(iconFile);
		action->setIcon(icon);

		QToolButton *button = new QToolButton(this);
		button->setDefaultAction(action);
		button->setCheckable(true);
		connect(button, SIGNAL(triggered(QAction *)), this, SLOT(on_toolbutton_triggered(QAction *)));
		layout->addWidget(button);

		buttons << button;

		clipartCategories[action] = getClipartFolder(categoryFolder, action);
		if (!startAction) startAction = action;
	}

	layout->addStretch();

	this->setLayout(layout);

	if (startAction)
		sendClipartLoadRequest(startAction);
}
コード例 #18
0
UBToolbarButtonGroup::UBToolbarButtonGroup(QToolBar *toolBar, const QList<QAction*> &actions)
    : QWidget(toolBar)
    , mActions(actions)
    , mCurrentIndex(-1)
    , mDisplayLabel(true)
    , mActionGroup(0)
{
    Q_ASSERT(actions.size() > 0);

    mToolButton = qobject_cast<QToolButton*>(toolBar->layout()->itemAt(0)->widget());
    Q_ASSERT(mToolButton);

    QVBoxLayout *verticalLayout = new QVBoxLayout(this);
    QHBoxLayout *horizontalLayout = new QHBoxLayout();
    horizontalLayout->setSpacing(0);
    verticalLayout->addStretch();
    verticalLayout->addLayout(horizontalLayout);
    verticalLayout->addStretch();

    mActionGroup = new QActionGroup(this);
    mActionGroup->setExclusive(true);

    QSize buttonSize;

    int i = 0;

    foreach(QAction *action, actions)
    {
        mActionGroup->addAction(action);

        QToolButton *button = new QToolButton(this);
        mButtons.append(button);
        button->setDefaultAction(action);
        button->setCheckable(true);

        if(i == 0)
        {
            button->setObjectName("ubButtonGroupLeft");
        }
        else if (i == actions.size() - 1)
        {
            button->setObjectName("ubButtonGroupRight");
        }
        else
        {
            button->setObjectName("ubButtonGroupCenter");
        }

        connect(button, SIGNAL(triggered(QAction*)), this, SLOT(selected(QAction*)));

        horizontalLayout->addWidget(button);
        mLabel = action->text();
        buttonSize = button->sizeHint();
        i++;
    }
コード例 #19
0
QToolButton *VcsBaseEditorParameterWidget::addToggleButton(const QStringList &options, const QString &label, const QString &tooltip)
{
    QToolButton *tb = new QToolButton;
    tb->setText(label);
    tb->setToolTip(tooltip);
    tb->setCheckable(true);
    connect(tb, SIGNAL(toggled(bool)), this, SIGNAL(argumentsChanged()));
    d->m_layout->addWidget(tb);
    d->m_optionMappings.append(OptionMapping(options, tb));
    return tb;
}
コード例 #20
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);
    }
}
コード例 #21
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;
}
コード例 #22
0
ファイル: SettingsDialog.cpp プロジェクト: Artanomell/schat
QToolButton *SettingsDialog::addBtn(const QIcon &icon, const QString &text)
{
  QToolButton *button = new QToolButton(this);
  button->setIcon(icon);
  button->setText(text);
  button->setAutoRaise(true);
  button->setCheckable(true);
  button->setIconSize(QSize(32, 32));
  button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
  connect(button, SIGNAL(clicked()), SLOT(tooglePage()));

  return button;
}
コード例 #23
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);
}
コード例 #24
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;
}
コード例 #25
0
QToolButton *StManagerStudyListComp::createToolButton ( const QIcon &icon, const char *member )
{
  QToolButton *toolButton = new QToolButton();

  toolButton->setCheckable( true );
  toolButton->setAutoExclusive( true );

  toolButton->setIconSize( QSize( 27, 27 ) );
  toolButton->setIcon( icon );

  connect( toolButton, SIGNAL(clicked()), this, member );

  return toolButton;
}
コード例 #26
0
void
Panel::initialize( QString panelName )
{
    QFont font;
    font.setFamily( "Calibri" );
    font.setPointSize( 13 );

    const int panelWidth = 256;

    QLabel *panelLabel = new QLabel( panelName );
    panelLabel->setAlignment( Qt::AlignRight );
    panelLabel->setFont( font );

    QToolButton *panelButton = new QToolButton();
    icon.addPixmap( QPixmap(":/Resources/Misc/triangle-left.png"),
		QIcon::Normal, QIcon::Off );
    icon.addPixmap( QPixmap(":/Resources/Misc/triangle-down.png"),
		QIcon::Normal, QIcon::On );
    panelButton->setIcon( icon );
    panelButton->setIconSize( QSize(16,16) );
    panelButton->setAutoRaise( true );
    panelButton->setCheckable( true );

    QFrame *line = new QFrame(); 
    line->setFixedWidth( panelWidth );
    line->setFrameShape( QFrame::HLine ); 
    line->setFrameShadow( QFrame::Sunken ); 
    line->setLineWidth( 0 ); 
    line->setMidLineWidth( 2 ); 

    QHBoxLayout *barLayout = new QHBoxLayout();
    barLayout->addWidget( panelLabel, 1, Qt::AlignVCenter );
    barLayout->addWidget( panelButton, 0, Qt::AlignVCenter );

    panelExtension = new QWidget();
    panelExtension->hide();

    QObject::connect(
	panelButton, SIGNAL(toggled(bool)),
	panelExtension, SLOT(setVisible(bool)) );

    QVBoxLayout *panelLayout = new QVBoxLayout( this );
    panelLayout->addLayout( barLayout );
    panelLayout->addWidget( panelExtension );
    //panelLayout->addSpacing( -2 );
    panelLayout->addWidget( line );

    setLayout( panelLayout );
}
コード例 #27
0
    QToolButton *addToolButton(QString const &label, QIcon const &icon)
    {
        QToolButton *tb = new QToolButton;
        tb->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
        tb->setFocusPolicy(Qt::NoFocus);
        tb->setText(label);
        tb->setIcon(icon);
        tb->setCheckable(true);
#ifdef MACOSX
        // Tighter spacing, please.
        tb->setStyleSheet("padding-bottom:-5px");
#endif
        tools->addWidget(tb);
        return tb;
    }
コード例 #28
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);
}
コード例 #29
0
QToolButton* AMScanViewPlotToolsButtonView::createToolButton(MPlotAbstractTool *tool)
{
	QToolButton *toolButton = 0;

	if (tool) {
		toolButton = new QToolButton();
		toolButton->setIcon(toolToIcon(tool));
		toolButton->setIconSize(QSize(16, 16));
		toolButton->setText(tool->name());
		toolButton->setStatusTip(tool->description());
		toolButton->setToolTip(tool->name());
		toolButton->setCheckable(true);
		toolButton->setAutoRaise(false);
	}

	return toolButton;
}
コード例 #30
0
ファイル: mesas.cpp プロジェクト: trifolio6/Bulmages
void DistroMesas::on_mui_nuevapantalla_clicked() {
            bool ok;
        QString text = QInputDialog::getText(this, tr("QInputDialog::getText()"),
                                             tr("Nombre Pantalla:"), QLineEdit::Normal,
                                             "", &ok);
        if (ok && !text.isEmpty())
            	m_listapantallas.append(text);
	
	QToolButton *but = new QToolButton(this);
	but->setObjectName("p_" + text);
	but->setText(text);
	but->setCheckable(TRUE);
	but->setMinimumHeight(42);
	but->setMinimumWidth(42);
	mui_espaciopantallas->addWidget(but);
	connect(but, SIGNAL(clicked()), this, SLOT(cambiarPantalla()));
    repaint();
}