Exemplo n.º 1
0
QList<QToolButton *> TestNavigationWidget::createToolButtons()
{
    QList<QToolButton *> list;

    m_filterButton = new QToolButton(m_view);
    m_filterButton->setIcon(Core::Icons::FILTER.icon());
    m_filterButton->setToolTip(tr("Filter Test Tree"));
    m_filterButton->setProperty("noArrow", true);
    m_filterButton->setAutoRaise(true);
    m_filterButton->setPopupMode(QToolButton::InstantPopup);
    m_filterMenu = new QMenu(m_filterButton);
    initializeFilterMenu();
    connect(m_filterMenu, &QMenu::triggered, this, &TestNavigationWidget::onFilterMenuTriggered);
    m_filterButton->setMenu(m_filterMenu);

    m_sortAlphabetically = true;
    m_sort = new QToolButton(this);
    m_sort->setIcon(Icons::SORT_NATURALLY.icon());
    m_sort->setToolTip(tr("Sort Naturally"));

    QToolButton *expand = new QToolButton(this);
    expand->setIcon(Core::Icons::EXPAND_TOOLBAR.icon());
    expand->setToolTip(tr("Expand All"));

    QToolButton *collapse = new QToolButton(this);
    collapse->setIcon(Core::Icons::COLLAPSE_TOOLBAR.icon());
    collapse->setToolTip(tr("Collapse All"));

    connect(expand, &QToolButton::clicked, m_view, &TestTreeView::expandAll);
    connect(collapse, &QToolButton::clicked, m_view, &TestTreeView::collapseAll);
    connect(m_sort, &QToolButton::clicked, this, &TestNavigationWidget::onSortClicked);

    list << m_filterButton << m_sort << expand << collapse;
    return list;
}
Exemplo n.º 2
0
Core::NavigationView TestNavigationWidgetFactory::createWidget()
{
    Core::NavigationView view;
    TestSelector *ptw = new TestSelector();
    ptw->rescan();
    view.widget = ptw;

    QToolButton *filter = new QToolButton;
    filter->setIcon(QIcon(Core::Constants::ICON_FILTER));
    filter->setToolTip(tr("Filter tree"));
    filter->setPopupMode(QToolButton::InstantPopup);

    QMenu *filterMenu = new QMenu(filter);
    filterMenu->addAction(ptw->m_componentViewMode);
    filterMenu->addAction(ptw->m_showUnitTests);
    filterMenu->addAction(ptw->m_showIntegrationTests);
    filterMenu->addAction(ptw->m_showPerformanceTests);
    filterMenu->addAction(ptw->m_showSystemTests);
    filter->setMenu(filterMenu);

    QToolButton *newTest = new QToolButton;
    newTest->setIcon(QIcon(":/core/images/filenew.png"));
    newTest->setToolTip(tr("New test"));
    newTest->setPopupMode(QToolButton::InstantPopup);
    QObject::connect(newTest, SIGNAL(clicked()), ptw,
        SLOT(testInsertUnitOrSystemTest()), Qt::DirectConnection);

    view.dockToolBarWidgets << filter << newTest;
    return view;
}
Exemplo n.º 3
0
QTabWidget *OptionDialog::createTabs() {
  tabs = new QTabWidget(this);
  for (int i = 0; i < myFractal->_funcCount; ++i)
    tabs->addTab(new FunctionTab(myFractal->_functions[i]),
                 QString::number(i + 1));
  QToolButton *newTabButton = new QToolButton(tabs);
  newTabButton->setCursor(Qt::ArrowCursor);
  newTabButton->setAutoRaise(true);
  newTabButton->setIcon(QIcon(":/images/plus_16.png"));
  newTabButton->setToolTip(tr("Add function"));
  tabs->setCornerWidget(newTabButton, Qt::TopLeftCorner);

  QToolButton *closeTabButton = new QToolButton(tabs);
  closeTabButton->setCursor(Qt::ArrowCursor);
  closeTabButton->setAutoRaise(true);
  closeTabButton->setIcon(QIcon(":/images/delete_16.png"));
  closeTabButton->setToolTip(tr("Remove function"));
  tabs->setCornerWidget(closeTabButton, Qt::TopRightCorner);

  tabs->repaint();
  connect(closeTabButton, SIGNAL(clicked()), this, SLOT(remFunc()));
  connect(newTabButton, SIGNAL(clicked()), this, SLOT(addFunc()));
  // connect(tabs,SIGNAL(currentChanged(int)),this,SLOT(tabChange(false)));
  return tabs;
}
Exemplo n.º 4
0
VLCProfileSelector::VLCProfileSelector( QWidget *_parent ): QWidget( _parent )
{
    QHBoxLayout *layout = new QHBoxLayout( this );

    QLabel *prLabel = new QLabel( qtr( "Profile"), this );
    layout->addWidget( prLabel );

    profileBox = new QComboBox( this );
    layout->addWidget( profileBox );

    QToolButton *editButton = new QToolButton( this );
    editButton->setIcon( QIcon( ":/menu/preferences" ) );
    editButton->setToolTip( qtr( "Edit selected profile" ) );
    layout->addWidget( editButton );

    QToolButton *deleteButton = new QToolButton( this );
    deleteButton->setIcon( QIcon( ":/toolbar/clear" ) );
    deleteButton->setToolTip( qtr( "Delete selected profile" ) );
    layout->addWidget( deleteButton );

    QToolButton *newButton = new QToolButton( this );
    newButton->setIcon( QIcon( ":/new" ) );
    newButton->setToolTip( qtr( "Create a new profile" ) );
    layout->addWidget(newButton);

    BUTTONACT( newButton, newProfile() );
    BUTTONACT( editButton, editProfile() );
    BUTTONACT( deleteButton, deleteProfile() );
    fillProfilesCombo();

    CONNECT( profileBox, activated( int ),
             this, updateOptions( int ) );
    updateOptions( 0 );
}
QgsBrowserDockWidget::QgsBrowserDockWidget( QWidget * parent ) :
    QDockWidget( parent ), mModel( NULL )
{
  setWindowTitle( tr( "Browser" ) );

  mBrowserView = new QgsBrowserTreeView( this );

  QToolButton* refreshButton = new QToolButton( this );
  refreshButton->setIcon( QgsApplication::getThemeIcon( "mActionDraw.png" ) );
  // remove this to save space
  refreshButton->setToolButtonStyle( Qt::ToolButtonTextBesideIcon );
  refreshButton->setText( tr( "Refresh" ) );
  refreshButton->setToolTip( tr( "Refresh" ) );
  refreshButton->setAutoRaise( true );
  connect( refreshButton, SIGNAL( clicked() ), this, SLOT( refresh() ) );

  QToolButton* addLayersButton = new QToolButton( this );
  addLayersButton->setIcon( QgsApplication::getThemeIcon( "mActionAddLayer.png" ) );
  // remove this to save space
  addLayersButton->setToolButtonStyle( Qt::ToolButtonTextBesideIcon );
  addLayersButton->setText( tr( "Add Selection" ) );
  addLayersButton->setToolTip( tr( "Add Selected Layers" ) );
  addLayersButton->setAutoRaise( true );
  connect( addLayersButton, SIGNAL( clicked() ), this, SLOT( addSelectedLayers() ) );

  QToolButton* collapseButton = new QToolButton( this );
  collapseButton->setIcon( QgsApplication::getThemeIcon( "mActionCollapseTree.png" ) );
  collapseButton->setToolTip( tr( "Collapse All" ) );
  collapseButton->setAutoRaise( true );
  connect( collapseButton, SIGNAL( clicked() ), mBrowserView, SLOT( collapseAll() ) );

  QVBoxLayout* layout = new QVBoxLayout();
  QHBoxLayout* hlayout = new QHBoxLayout();
  layout->setContentsMargins( 0, 0, 0, 0 );
  layout->setSpacing( 0 );
  hlayout->setContentsMargins( 0, 0, 0, 0 );
  hlayout->setSpacing( 5 );
  hlayout->setAlignment( Qt::AlignLeft );

  hlayout->addSpacing( 5 );
  hlayout->addWidget( refreshButton );
  hlayout->addSpacing( 5 );
  hlayout->addWidget( addLayersButton );
  hlayout->addStretch( );
  hlayout->addWidget( collapseButton );
  layout->addLayout( hlayout );
  layout->addWidget( mBrowserView );

  QWidget* innerWidget = new QWidget( this );
  innerWidget->setLayout( layout );
  setWidget( innerWidget );

  connect( mBrowserView, SIGNAL( customContextMenuRequested( const QPoint & ) ), this, SLOT( showContextMenu( const QPoint & ) ) );
  connect( mBrowserView, SIGNAL( doubleClicked( const QModelIndex& ) ), this, SLOT( addLayerAtIndex( const QModelIndex& ) ) );

}
QMathMLFileViewer::QMathMLFileViewer( QWidget *parent )
    : QDockWidget( tr("MathML Documents Explorer"), parent )
{
	m_iconSize = QSize(16, 16);
	m_isRecursiveSearch = true;

	m_currentDir.setPath( QDir::currentPath() );

	directoryComboBox = createComboBox( m_currentDir.absolutePath() );
	directoryComboBox->setMinimumWidth(150);
	QDirModel *dirModelCompleter = new QDirModel(this);
	dirModelCompleter->setFilter( QDir::AllDirs/*QDir::Dirs*/ );
	QCompleter *completer = new QCompleter( this );
    completer->setModel( dirModelCompleter );
    directoryComboBox->setCompleter( completer );
	connect(directoryComboBox, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(changeDir(const QString&)));

	QToolButton *btnBrowse = new QToolButton();
	btnBrowse->setIcon(QIcon(":/images/folderopen.png"));
	//btnBrowse->setIconSize( m_iconSize );
	btnBrowse->setToolTip(tr("Select a new folder"));
	connect(btnBrowse, SIGNAL(clicked()), this, SLOT(browse()));

	QToolButton *btnBrowseUp = new QToolButton();
	btnBrowseUp->setIcon(QIcon(":/images/up.png"));
	//btnBrowseUp->setIconSize( m_iconSize );
	btnBrowseUp->setToolTip(tr("Navagate one level up"));
	connect(btnBrowseUp, SIGNAL(clicked()), this, SLOT(browseUp()));

	QHBoxLayout *dirLayout = new QHBoxLayout();
	dirLayout->addWidget(directoryComboBox);
	dirLayout->addWidget(btnBrowseUp);
	dirLayout->addWidget(btnBrowse);
	dirLayout->addStretch(1);

	createFilesTree();
	createFilesTable();
	foundMessage = new QLabel(tr("No search results"));

	QHBoxLayout *toolLayout = setupToolLayout();
    QVBoxLayout *mainLayout = new QVBoxLayout();
    mainLayout->addLayout(toolLayout);
    mainLayout->addLayout(dirLayout);
    mainLayout->addWidget(m_dirTree);
    mainLayout->addWidget(filesTable);
	mainLayout->addWidget(foundMessage);

	QDialog *centralDlg = new QDialog();
	centralDlg->setModal( false );
	centralDlg->setLayout( mainLayout );
	setWidget( centralDlg );
}
Exemplo n.º 7
0
ListLayoutRow::ListLayoutRow(QWidget *widget, QWidget *parent, const bool &moveEnabled)
    : QFrame(parent)
{

    m_widget = widget;
    m_upButton = m_downButton = 0;

    setMidLineWidth(0);
    setLineWidth(1);
    setFrameStyle(QFrame::Box);
    setFrameShadow(QFrame::Sunken);    

    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);

    QToolButton *removeButton = new QToolButton(this);
    removeButton->setIcon(KIcon("list-remove"));
    removeButton->setText(i18n("Remove"));
    removeButton->setToolTip(i18n("Remove"));
    connect(removeButton, SIGNAL(clicked()), this, SLOT(removeClicked()));

    KSeparator *separator = new KSeparator(Qt::Vertical);
    
    QHBoxLayout *layout = new QHBoxLayout;
    
    if (moveEnabled) {
        QToolButton *upButton = new QToolButton(this);
        upButton->setIcon(KIcon("go-up"));
        upButton->setText(i18n("Move up"));
        upButton->setToolTip(i18n("Move up"));
    
        QToolButton *downButton = new QToolButton(this);
        downButton->setIcon(KIcon("go-down"));
        downButton->setText(i18n("Move down"));
        downButton->setToolTip(i18n("Move down"));
    
        connect(upButton, SIGNAL(clicked()), this, SLOT(upClicked()));
        connect(downButton, SIGNAL(clicked()), this, SLOT(downClicked()));
        
        layout->addWidget(upButton);
        layout->addWidget(downButton);
    
        m_upButton = upButton;
        m_downButton = downButton;
    }
    
    layout->addWidget(removeButton);
    layout->addWidget(separator);
    layout->addWidget(m_widget);
    setLayout(layout);
    
}
void MusicSystemTrayMenu::createPlayWidgetActions()
{
    m_widgetAction = new QWidgetAction(this);
    QWidget *widgetActionContainer = new QWidget(this);
    QVBoxLayout *vbox = new QVBoxLayout(widgetActionContainer);
    vbox->setMargin(0);

    QWidget *widgetContainer = new QWidget(widgetActionContainer);
    QHBoxLayout *box = new QHBoxLayout(widgetContainer);
    box->setMargin(0);

    QToolButton *previousPlay = new QToolButton(widgetContainer);
    QToolButton *nextPlay = new QToolButton(widgetContainer);
    m_PlayOrStop = new QToolButton(widgetContainer);

    previousPlay->setIcon(QIcon(QString::fromUtf8(":/contextMenu/sysprevious")));
    nextPlay->setIcon(QIcon(QString::fromUtf8(":/contextMenu/sysnext")));
    m_PlayOrStop->setIcon(QIcon(QString::fromUtf8(":/contextMenu/sysplay")));

    previousPlay->setIconSize(QSize(40, 40));
    nextPlay->setIconSize(QSize(40, 40));
    m_PlayOrStop->setIconSize(QSize(45, 45));

    previousPlay->setStyleSheet(MusicUIObject::MToolButtonStyle01);
    nextPlay->setStyleSheet(MusicUIObject::MToolButtonStyle01);
    m_PlayOrStop->setStyleSheet(MusicUIObject::MToolButtonStyle01);

    previousPlay->setCursor(QCursor(Qt::PointingHandCursor));
    nextPlay->setCursor(QCursor(Qt::PointingHandCursor));
    m_PlayOrStop->setCursor(QCursor(Qt::PointingHandCursor));

    previousPlay->setToolTip(tr("Previous"));
    nextPlay->setToolTip(tr("Next"));
    m_PlayOrStop->setToolTip(tr("Play"));

    box->addWidget(previousPlay);
    box->addWidget(m_PlayOrStop);
    box->addWidget(nextPlay);

    m_showText = new QLabel(widgetActionContainer);
    m_showText->setAlignment(Qt::AlignCenter);
    m_showText->setStyleSheet(MusicUIObject::MCustomStyle12);
    vbox->addWidget(widgetContainer);
    vbox->addWidget(m_showText);
    widgetActionContainer->setLayout(vbox);
    m_widgetAction->setDefaultWidget(widgetActionContainer);

    connect(previousPlay, SIGNAL(clicked()), parent(), SLOT(musicPlayPrevious()));
    connect(nextPlay, SIGNAL(clicked()), parent(), SLOT(musicPlayNext()));
    connect(m_PlayOrStop, SIGNAL(clicked()), parent(), SLOT(musicStatePlay()));
}
Exemplo n.º 9
0
void OptionsTabPlugins::listPlugins()
{
	if ( !w )
		return;

	OptPluginsUI *d = (OptPluginsUI *)w;

	d->tw_Plugins->clear();

	PluginManager *pm=PluginManager::instance();

	QStringList plugins = pm->availablePlugins();
	plugins.sort();
	const QSize buttonSize = QSize(21,21);
	foreach ( const QString& plugin, plugins ){
		QIcon icon = pm->icon(plugin);
		bool enabled = pm->isEnabled(plugin);
		const QString path = pm->pathToPlugin(plugin);
		QString toolTip = tr("Plugin Path:\n%1").arg(path);
		Qt::CheckState state = enabled ? Qt::Checked : Qt::Unchecked;
		QTreeWidgetItem *item = new QTreeWidgetItem(d->tw_Plugins, QTreeWidgetItem::Type);
		item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
		item->setText(C_NAME, plugin);
		item->setText(C_VERSION, pm->version(plugin));
		item->setTextAlignment(C_VERSION, Qt::AlignHCenter);
		item->setToolTip(C_NAME, toolTip);
		item->setCheckState(C_NAME, state);
		if ( !enabled ) {
			icon = QIcon(icon.pixmap(icon.availableSizes().at(0), QIcon::Disabled));
		}
		item->setIcon(C_NAME,icon);
		QString shortName = PluginManager::instance()->shortName(plugin);

		QToolButton *aboutbutton = new QToolButton(d->tw_Plugins);
		aboutbutton->setIcon(QIcon(IconsetFactory::iconPixmap("psi/info")));
		aboutbutton->resize(buttonSize);
		aboutbutton->setObjectName("ab_" + shortName);
		aboutbutton->setToolTip(tr("Show information about plugin"));
		connect(aboutbutton, SIGNAL(clicked()), this, SLOT(showPluginInfo()));
		d->tw_Plugins->setItemWidget(item, C_ABOUT, aboutbutton);

		QToolButton *settsbutton = new QToolButton(d->tw_Plugins);
		settsbutton->setIcon(QIcon(IconsetFactory::iconPixmap("psi/options")));
		settsbutton->resize(buttonSize);
		settsbutton->setObjectName("sb_" + shortName);
		settsbutton->setToolTip(tr("Open plugin settings dialog"));
		connect(settsbutton, SIGNAL(clicked()), this, SLOT(settingsClicked()));
		settsbutton->setEnabled(enabled);
		d->tw_Plugins->setItemWidget(item, C_SETTS, settsbutton);
	}
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);

}
Exemplo n.º 11
0
void
MidiProgramsEditor::slotKeyMapMenuItemSelected(int i)
{
    if (!m_device)
        return ;

    const KeyMappingList &kml = m_device->getKeyMappings();
    if (kml.empty())
        return ;

    MidiProgram *program = getProgram(*getCurrentBank(), m_currentMenuProgram);
    if (!program)
        return ;

    std::string newMapping;

    if (i == 0) { // no key mapping
        newMapping = "";
    } else {
        --i;
        if (i < (int)kml.size()) {
            newMapping = kml[i].getName();
        }
    }

    m_device->setKeyMappingForProgram(*program, newMapping);
//     QString pixmapDir = KGlobal::dirs()->findResource("appdata", "pixmaps/");
    IconLoader il;
    QIcon icon;

    bool haveKeyMappings = (m_device->getKeyMappings().size() > 0);  //@@@ JAS restored from before port/
    QToolButton *btn = getKeyMapButton(m_currentMenuProgram);

    if (newMapping.empty()) {
        icon = il.load( "key-white" );
        if( ! icon.isNull() ) {
            btn->setIcon( icon );
        }
        // QToolTip::remove(btn);
        btn->setToolTip(QString(""));       //@@@ Usefull ?
    } else {
        icon = il.load( "key-green" );
        if( ! icon.isNull() ){
            btn->setIcon( icon );
        }
        btn->setToolTip(tr("Key Mapping: %1").arg(strtoqstr(newMapping)));
    }
    btn->setEnabled(haveKeyMappings);
}
Exemplo n.º 12
0
FilterBar::FilterBar(QWidget* parent) :
    QWidget(parent)
{
    // Create close button
    QToolButton *closeButton = new QToolButton(this);
    closeButton->setAutoRaise(true);
    closeButton->setIcon(KIcon("dialog-close"));
    closeButton->setToolTip(i18nc("@info:tooltip", "Hide Filter Bar"));
    connect(closeButton, SIGNAL(clicked()), this, SIGNAL(closeRequest()));

    // Create label
    QLabel* filterLabel = new QLabel(i18nc("@label:textbox", "Filter:"), this);

    // Create filter editor
    m_filterInput = new KLineEdit(this);
    m_filterInput->setLayoutDirection(Qt::LeftToRight);
    m_filterInput->setClearButtonShown(true);
    connect(m_filterInput, SIGNAL(textChanged(QString)),
            this, SIGNAL(filterChanged(QString)));
    setFocusProxy(m_filterInput);

    // Apply layout
    QHBoxLayout* hLayout = new QHBoxLayout(this);
    hLayout->setMargin(0);
    hLayout->addWidget(closeButton);
    hLayout->addWidget(filterLabel);
    hLayout->addWidget(m_filterInput);

    filterLabel->setBuddy(m_filterInput);
}
Exemplo n.º 13
0
WNavigationTreeCaption::WNavigationTreeCaption()
	{
	QToolButton * pwButtonUndock = new QToolButton(this);
	pwButtonUndock->setToolTip("Float / Unfloat");
	#if 1
	pwButtonUndock->setStyleSheet("QToolButton { border: none; padding: 3px; }");
	#else
	pwButtonUndock->setStyleSheet("QToolButton { border: none; padding: 0px; }");
	#endif
	QPixmap oPixmap = style()->standardPixmap(QStyle::SP_TitleBarNormalButton);
	pwButtonUndock->setIcon(oPixmap);
//	pwButtonUndock->setMaximumSize(oPixmap.size());
	pwButtonUndock->setCursor(Qt::ArrowCursor);
	pwButtonUndock->setFocusPolicy(Qt::ClickFocus);

	QHBoxLayout * layout = new QHBoxLayout(this);
	layout->setMargin(0);
//	layout->setSpacing(10);
//	layout->addStretch();
	#if 0
	layout->addWidget(g_pwButtonStatusOfNavigationTree, Qt::AlignLeft | Qt::AlignHCenter);
	#endif
	layout->addWidget(g_pwButtonSwitchProfile); // , Qt::AlignLeft | Qt::AlignHCenter);
	//layout->addWidget(new QWidget);
	layout->addStretch();
	//layout->addWidget(pwButtonUndock, Qt::AlignRight | Qt::AlignHCenter);
	layout->addWidget(pwButtonUndock);
	setLayout(layout);
	connect(pwButtonUndock, SIGNAL(clicked()), g_pwNavigationTree, SLOT(SL_ToggleDocking()));
	setCursor(Qt::OpenHandCursor);		// This cursor shows to the user he/she may drag the widget to undock the Navigation Tree
	}
Exemplo n.º 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);
    }
  }
Exemplo n.º 15
0
	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;
	}
Exemplo n.º 16
0
Widget::Widget( QWidget *pParent )
  : QWidget( pParent ), d( new Private( this ) )
{
  Manager::registerWidget( this );
  connect( Manager::instance(), SIGNAL(aggregationsChanged()),
           this, SLOT(aggregationsChanged() ) );
  connect( Manager::instance(), SIGNAL(themesChanged()),
           this, SLOT(themesChanged() ) );

  setAutoFillBackground( true );
  setObjectName( QLatin1String( "messagelistwidget" ) );

  QGridLayout * g = new QGridLayout( this );
  g->setMargin( 2 ); // use a smaller default
  g->setSpacing( 2 );

  d->mSearchEdit = new KLineEdit( this );
  d->mSearchEdit->setClickMessage( i18nc( "Search for messages.", "Search" ) );
  d->mSearchEdit->setObjectName( QLatin1String( "quicksearch" ) );
  d->mSearchEdit->setClearButtonShown( true );

  connect( d->mSearchEdit, SIGNAL( textEdited( const QString & ) ),
           SLOT( searchEditTextEdited( const QString & ) ) );

  connect( d->mSearchEdit, SIGNAL( clearButtonClicked() ),
           SLOT( searchEditClearButtonClicked() ) );

  g->addWidget( d->mSearchEdit, 0, 0 );

  // The status filter button. Will be populated later, as populateStatusFilterCombo() is virtual
  d->mStatusFilterCombo = new KComboBox( this ) ;
  g->addWidget( d->mStatusFilterCombo, 0, 1 );

  // The "Open Full Search" button
  QToolButton * tb = new QToolButton( this );
  tb->setIcon( KIcon( QLatin1String( "edit-find-mail" ) ) );
  tb->setText( i18n( "Open Full Search" ) );
  tb->setToolTip( tb->text() );
  g->addWidget( tb, 0, 2 );

  connect( tb, SIGNAL( clicked() ),
           this, SIGNAL( fullSearchRequest() ) );


  d->mView = new View( this );
  d->mView->setSortOrder( &d->mSortOrder );
  d->mView->setObjectName( QLatin1String( "messagealistview" ) );
  g->addWidget( d->mView, 1, 0, 1, 6 );

  connect( d->mView->header(), SIGNAL( sectionClicked( int ) ),
           SLOT( slotViewHeaderSectionClicked( int ) ) );

  g->setRowStretch( 1, 1 );
  g->setColumnStretch( 0, 1 );

  d->mSearchEdit->setEnabled( false );
  d->mStatusFilterCombo->setEnabled( false );

  d->mSearchTimer = 0;
}
Exemplo n.º 17
0
FlyToEditWidget::FlyToEditWidget( const QModelIndex &index, MarbleWidget* widget, QWidget *parent ) :
    QWidget( parent ),
    m_widget( widget ),
    m_index( index ),
    m_button( new QToolButton )
{
    QHBoxLayout *layout = new QHBoxLayout;
    layout->setSpacing( 5 );

    QLabel* iconLabel = new QLabel;
    iconLabel->setPixmap( QPixmap( ":/marble/flag.png" ) );
    layout->addWidget( iconLabel );

    QLabel *waitLabel = new QLabel;
    waitLabel->setText(tr("Wait duration:"));
    layout->addWidget(waitLabel);

    m_waitSpin = new QDoubleSpinBox;
    layout->addWidget(m_waitSpin);
    m_waitSpin->setValue(flyToElement()->duration());
    m_waitSpin->setSuffix( tr(" s", "seconds") );

    QToolButton* flyToPinCenter = new QToolButton;
    flyToPinCenter->setIcon(QIcon(":/marble/places.png"));
    flyToPinCenter->setToolTip(tr("Current map center"));
    connect(flyToPinCenter, SIGNAL(clicked()), this, SLOT(updateCoordinates()));
    layout->addWidget(flyToPinCenter);

    m_button->setIcon( QIcon( ":/marble/document-save.png" ) );
    connect(m_button, SIGNAL(clicked()), this, SLOT(save()));
    layout->addWidget( m_button );

    setLayout( layout );
}
Exemplo n.º 18
0
/*!
    \fn OptToolBar::addActionWithoutButtonGroup(QAction* action)
 */
QToolButton* OptToolBar::addActionWithoutButtonGroup(QAction* action)
{
  if(!action)
  {
    return NULL;
  }

  int id = mRow*mColSize + mCol;

  //create new button
  QToolButton *button = new QToolButton;
  button->setToolTip( action->statusTip() );
  button->setDefaultAction(action);

  //set the button icon using action's icon 
  QIcon icon = action->icon();
  if( !icon.isNull() )
  {
    button->setIcon(icon);
    //button->setIconSize( QSize(50, 50) );
  }
   
  mButtons[ id ]= make_pair(button, action);
  
  mLayout->addWidget(button, mRow, mCol);

  //update row and col
  if( mCol+1>=mColSize )
  {
    ++mRow;
  }
  mCol = (mCol+1) % mColSize;

  return button;
}
Exemplo n.º 19
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;
}
Exemplo n.º 20
0
/****************
 * VLMBroadcast
 ****************/
VLMBroadcast::VLMBroadcast( const QString& _name, const QString& _input,
                            const QString& _inputOptions,
                            const QString& _output, bool _enabled,
                            bool _looped, VLMDialog *_parent )
                          : VLMAWidget( _name, _input, _inputOptions, _output,
                                        _enabled, _parent, QVLM_Broadcast )
{
    nameLabel->setText( qtr("Broadcast: ") + name );
    type = QVLM_Broadcast;
    b_looped = _looped;

    playButton = new QToolButton;
    playButton->setIcon( QIcon( ":/menu/play" ) );
    playButton->setToolTip( qtr("Play") );
    objLayout->addWidget( playButton, 1, 0 );
    b_playing = true;

    QToolButton *stopButton = new QToolButton;
    stopButton->setIcon( QIcon( ":/toolbar/stop_b" ) );
    stopButton->setToolTip( qtr("Stop") );
    objLayout->addWidget( stopButton, 1, 1 );

    loopButton = new QToolButton;
    loopButton->setToolTip( qtr("Repeat") );
    objLayout->addWidget( loopButton, 1, 2 );

    BUTTONACT( playButton, togglePlayPause() );
    BUTTONACT( stopButton, stop() );
    BUTTONACT( loopButton, toggleLoop() );

    update();
}
Exemplo n.º 21
0
void FilePathPropertyEditor::onInitialize()
{
   QWidget* frame = new QWidget( this );
   QHBoxLayout* layout = new QHBoxLayout( frame );
   layout->setSpacing( 0 );
   layout->setMargin( 0 );
   frame->setLayout( layout );
   addWidget( frame );

   // a field that shows the resource
   m_droppedFilePath = new DropArea( frame, new FSNodeMimeData( m_paths ) );
   connect( m_droppedFilePath, SIGNAL( changed() ), this, SLOT( valChanged() ) );
   m_droppedFilePath->setMinimumSize( 20, 20 );
   m_droppedFilePath->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
   layout->addWidget( m_droppedFilePath );

   // a button for NULLing the resource
   QToolButton* eraseButton = new QToolButton( frame );
   eraseButton->setIcon( QIcon( ":/TamyEditor/Resources/Icons/Editor/quit.png" ) );
   eraseButton->setToolTip( "Reset value" );
   connect( eraseButton, SIGNAL( clicked( bool ) ), this, SLOT( valErased( bool ) ) );
   eraseButton->setMinimumSize( 20, 20 );
   eraseButton->setMaximumSize( 20, 20 );
   eraseButton->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
   layout->addWidget( eraseButton );

   refreshPropertyName();
}
QgsFilterAlgorithmConfigurationWidget::QgsFilterAlgorithmConfigurationWidget( QWidget *parent )
  : QgsProcessingAlgorithmConfigurationWidget( parent )
{
  setContentsMargins( 0, 0, 0, 0 );

  mOutputExpressionWidget = new QTableWidget();
  mOutputExpressionWidget->setColumnCount( 3 );
  mOutputExpressionWidget->setHorizontalHeaderItem( 0, new QTableWidgetItem( tr( "Output Name" ) ) );
  mOutputExpressionWidget->setHorizontalHeaderItem( 1, new QTableWidgetItem( tr( "Filter Expression" ) ) );
  mOutputExpressionWidget->setHorizontalHeaderItem( 2, new QTableWidgetItem( tr( "Final Output" ) ) );
  mOutputExpressionWidget->horizontalHeader()->setResizeMode( 1, QHeaderView::Stretch );
  QGridLayout *layout = new QGridLayout();
  setLayout( layout );

  layout->addWidget( new QLabel( tr( "Outputs and filters" ) ), 0, 0, 1, 2 );
  layout->addWidget( mOutputExpressionWidget, 1, 0, 4, 1 );
  QToolButton *addOutputButton = new QToolButton();
  addOutputButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddLayer.svg" ) ) );
  addOutputButton->setText( tr( "Add Output" ) );

  QToolButton *removeOutputButton = new QToolButton();
  removeOutputButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionRemoveLayer.svg" ) ) );
  removeOutputButton->setToolTip( tr( "Remove Selected Outputs" ) );

  layout->addWidget( addOutputButton, 2, 1, 1, 1 );
  layout->addWidget( removeOutputButton, 3, 1, 1, 1 );

  connect( addOutputButton, &QToolButton::clicked, this, &QgsFilterAlgorithmConfigurationWidget::addOutput );
  connect( removeOutputButton, &QToolButton::clicked, this, &QgsFilterAlgorithmConfigurationWidget::removeSelectedOutputs );

  connect( mOutputExpressionWidget->selectionModel(), &QItemSelectionModel::selectionChanged, this, [removeOutputButton, this]
  {
    removeOutputButton->setEnabled( !mOutputExpressionWidget->selectionModel()->selectedIndexes().isEmpty() );
  } );
}
Exemplo n.º 23
0
QToolButton* ToolHelper::createButton()
{
    QToolButton *but = new QToolButton();
    but->setIcon(KIcon(m_toolFactory->icon()).pixmap(22));
    but->setToolTip(m_toolFactory->toolTip());
    connect(but, SIGNAL(clicked()), this, SLOT(buttonPressed()));
    return but;
}
Exemplo n.º 24
0
/** Constructor */
GxsChannelDialog::GxsChannelDialog(QWidget *parent)
	: RsGxsUpdateBroadcastPage(rsGxsChannels, parent), GxsServiceDialog(dynamic_cast<GxsCommentContainer *>(parent))
{
	/* Invoke the Qt Designer generated object setup routine */
	ui.setupUi(this);

	/* Setup UI helper */
	mStateHelper = new UIStateHelper(this);

	mStateHelper->addWidget(TOKEN_TYPE_POSTS, ui.progressBar, UISTATE_LOADING_VISIBLE);
	mStateHelper->addWidget(TOKEN_TYPE_POSTS, ui.progressLabel, UISTATE_LOADING_VISIBLE);

	mStateHelper->addLoadPlaceholder(TOKEN_TYPE_GROUP_DATA, ui.nameLabel);

	mStateHelper->addWidget(TOKEN_TYPE_GROUP_DATA, ui.postButton);
	mStateHelper->addWidget(TOKEN_TYPE_GROUP_DATA, ui.logoLabel);

	mChannelQueue = new TokenQueue(rsGxsChannels->getTokenService(), this);

	connect(ui.postButton, SIGNAL(clicked()), this, SLOT(createMsg()));
//	connect(NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)));

	/*************** Setup Left Hand Side (List of Channels) ****************/

	connect(ui.treeWidget, SIGNAL(treeCustomContextMenuRequested(QPoint)), this, SLOT(channelListCustomPopupMenu(QPoint)));
	connect(ui.treeWidget, SIGNAL(treeCurrentItemChanged(QString)), this, SLOT(selectChannel(QString)));
	connect(ui.todoPushButton, SIGNAL(clicked()), this, SLOT(todo()));

	mChannelId.clear();

	/* Set initial size the splitter */
	QList<int> sizes;
	sizes << 300 << width(); // Qt calculates the right sizes
	ui.splitter->setSizes(sizes);

	/* Initialize group tree */
	QToolButton *newChannelButton = new QToolButton(this);
	newChannelButton->setIcon(QIcon(":/images/add_channel24.png"));
	newChannelButton->setToolTip(tr("Create Channel"));
	connect(newChannelButton, SIGNAL(clicked()), this, SLOT(createChannel()));
	ui.treeWidget->addToolButton(newChannelButton);

	ownChannels = ui.treeWidget->addCategoryItem(tr("My Channels"), QIcon(IMAGE_CHANNELBLUE), true);
	subcribedChannels = ui.treeWidget->addCategoryItem(tr("Subscribed Channels"), QIcon(IMAGE_CHANNELRED), true);
	popularChannels = ui.treeWidget->addCategoryItem(tr("Popular Channels"), QIcon(IMAGE_CHANNELGREEN), false);
	otherChannels = ui.treeWidget->addCategoryItem(tr("Other Channels"), QIcon(IMAGE_CHANNELYELLOW), false);

	ui.progressLabel->hide();
	ui.progressBar->hide();

	ui.nameLabel->setMinimumWidth(20);

	/* load settings */
	processSettings(true);

	/* Initialize empty GUI */
	requestGroupData(mChannelId);
}
Exemplo n.º 25
0
/*
 * Obligatory initialization code.
 */
void SearchBar::init()
{
    setVisible(false);
    setObjectName("searchbar");
    QHBoxLayout *layout = new QHBoxLayout(this);
    layout->setSpacing(0);
    layout->setMargin(4);

    setStyleSheet("QWidget#searchbar{"
                  "border-top-width: .6px;"
                  "border-top-style: solid;"
                  "border-top-color: darkgray;}");

    m_searchLineEdit = new SearchLineEdit(this);
    m_searchLineEdit->setMinimumWidth(300);
    QToolButton *m_previousButton = new QToolButton(this);
    QToolButton *m_nextButton = new QToolButton(this);
    m_previousButton->setToolButtonStyle(Qt::ToolButtonTextOnly);
    m_nextButton->setToolButtonStyle(Qt::ToolButtonTextOnly);

    QAction *m_previousAction = new QAction(this);
    QAction *m_nextAction = new QAction(this);

    m_previousAction->setText("< " + tr("Previous"));
    m_previousButton->setAutoRaise(true);
    m_previousAction->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_F3));
    m_nextAction->setText(tr("Next") + " >");
    m_nextButton->setAutoRaise(true);
    m_nextAction->setShortcut(Qt::Key_F3);
    m_previousButton->setDefaultAction(m_previousAction);
    m_nextButton->setDefaultAction(m_nextAction);

    QToolButton *tbClose = new QToolButton();
    tbClose->setIcon(IconHelper::getIconClose());

    tbClose->setAutoRaise(true);
    tbClose->setStyleSheet("QToolButton{ font-size: 16px; font-family: verdana; border-radius: 4px; } "
                           "QToolButton:hover{ background-color: palette(light); }"
                           "QToolButton::pressed{ background-color: palette(mid); }");

    tbClose->setToolTip(tr("Close"));
    tbClose->setShortcut(Qt::Key_Escape);

    layout->addWidget(tbClose, 1, Qt::AlignLeft);
    layout->addSpacing(3);
    layout->addWidget(m_searchLineEdit, 0, Qt::AlignLeft);
    layout->addSpacing(2);
    layout->addWidget(m_previousButton, 1, Qt::AlignLeft);
    layout->addWidget(m_nextButton, 20, Qt::AlignLeft);

    setLayout(layout);
    m_searchLineEdit->setFocus();

    connect(tbClose, SIGNAL(clicked()), this, SLOT(close()));
    connect(m_searchLineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(textChanged(QString)));
    connect(m_previousAction, SIGNAL(triggered()), this, SIGNAL(findPrevious()));
    connect(m_nextAction, SIGNAL(triggered()), this, SIGNAL(findNext()));
}
Exemplo n.º 26
0
// Configuration widget
CMakeRunConfigurationWidget::CMakeRunConfigurationWidget(CMakeRunConfiguration *cmakeRunConfiguration, QWidget *parent)
    : QWidget(parent), m_ignoreChange(false), m_cmakeRunConfiguration(cmakeRunConfiguration)
{
    QFormLayout *fl = new QFormLayout();
    fl->setMargin(0);
    fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);

    cmakeRunConfiguration->extraAspect<ArgumentsAspect>()->addToMainConfigurationWidget(this, fl);

    m_workingDirectoryEdit = new Utils::PathChooser();
    m_workingDirectoryEdit->setExpectedKind(Utils::PathChooser::Directory);
    m_workingDirectoryEdit->setBaseFileName(m_cmakeRunConfiguration->target()->project()->projectDirectory());
    m_workingDirectoryEdit->setPath(m_cmakeRunConfiguration->baseWorkingDirectory());
    m_workingDirectoryEdit->setHistoryCompleter(QLatin1String("CMake.WorkingDir.History"));
    EnvironmentAspect *aspect
            = m_cmakeRunConfiguration->extraAspect<EnvironmentAspect>();
    if (aspect) {
        connect(aspect, &EnvironmentAspect::environmentChanged,
                this, &CMakeRunConfigurationWidget::environmentWasChanged);
        environmentWasChanged();
    }
    m_workingDirectoryEdit->setPromptDialogTitle(tr("Select Working Directory"));

    QToolButton *resetButton = new QToolButton();
    resetButton->setToolTip(tr("Reset to default."));
    resetButton->setIcon(QIcon(QLatin1String(Core::Constants::ICON_RESET)));

    QHBoxLayout *boxlayout = new QHBoxLayout();
    boxlayout->addWidget(m_workingDirectoryEdit);
    boxlayout->addWidget(resetButton);

    fl->addRow(tr("Working directory:"), boxlayout);

    m_cmakeRunConfiguration->extraAspect<TerminalAspect>()->addToMainConfigurationWidget(this, fl);

    m_detailsContainer = new Utils::DetailsWidget(this);
    m_detailsContainer->setState(Utils::DetailsWidget::NoSummary);

    QWidget *m_details = new QWidget(m_detailsContainer);
    m_detailsContainer->setWidget(m_details);
    m_details->setLayout(fl);

    QVBoxLayout *vbx = new QVBoxLayout(this);
    vbx->setMargin(0);
    vbx->addWidget(m_detailsContainer);

    connect(m_workingDirectoryEdit, &Utils::PathChooser::changed,
            this, &CMakeRunConfigurationWidget::setWorkingDirectory);

    connect(resetButton, &QToolButton::clicked,
            this, &CMakeRunConfigurationWidget::resetWorkingDirectory);

    connect(m_cmakeRunConfiguration, &CMakeRunConfiguration::baseWorkingDirectoryChanged,
            this, &CMakeRunConfigurationWidget::workingDirectoryChanged);

    setEnabled(m_cmakeRunConfiguration->isEnabled());
}
Exemplo n.º 27
0
PaletteBox::PaletteBox(QWidget* parent)
   : QDockWidget(tr("Palettes"), parent)
      {
      setContextMenuPolicy(Qt::ActionsContextMenu);
      setObjectName("palette-box");
      setAllowedAreas(Qt::DockWidgetAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea));

      QAction* a = new QAction(this);
      a->setText(tr("Single Palette"));
      a->setCheckable(true);
      a->setChecked(preferences.singlePalette);
      addAction(a);
      connect(a, SIGNAL(toggled(bool)), SLOT(setSinglePalette(bool)));

      QWidget* w = new QWidget(this);
      w->setContextMenuPolicy(Qt::NoContextMenu);
      QVBoxLayout* vl = new QVBoxLayout(w);
      vl->setMargin(0);
      QHBoxLayout* hl = new QHBoxLayout;
      hl->setContentsMargins(5,5,5,0);

      workspaceList = new QComboBox;
      workspaceList->setToolTip(tr("Select workspace"));
      updateWorkspaces();
      hl->addWidget(workspaceList);
      QToolButton* nb = new QToolButton;

      nb->setMinimumHeight(27);
      nb->setText(tr("+"));
      nb->setToolTip(tr("Add new workspace"));
      hl->addWidget(nb);

      setWidget(w);

      PaletteBoxScrollArea* sa = new PaletteBoxScrollArea;
      sa->setFocusPolicy(Qt::NoFocus);
      sa->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
      sa->setContextMenuPolicy(Qt::CustomContextMenu);
      sa->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
      sa->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
      sa->setWidgetResizable(true);
      sa->setFrameShape(QFrame::NoFrame);
      vl->addWidget(sa);
      vl->addLayout(hl);

      QWidget* paletteList = new QWidget;
      sa->setWidget(paletteList);
      vbox = new QVBoxLayout;
      paletteList->setLayout(vbox);
      vbox->setMargin(0);
      vbox->setSpacing(1);
      vbox->addStretch();
      paletteList->show();

      connect(nb, SIGNAL(clicked()), SLOT(newWorkspaceClicked()));
      connect(workspaceList, SIGNAL(activated(int)), SLOT(workspaceSelected(int)));
      }
Exemplo n.º 28
0
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()));
}
Exemplo n.º 29
0
QToolButton* KexiRecordNavigator::createAction(const KGuiItem& item)
{
    QToolButton *toolButton;
    d->lyr->addWidget(toolButton = new KexiSmallToolButton(item.icon(), QString(), this), 0, Qt::AlignVCenter);
    toolButton->setFocusPolicy(Qt::NoFocus);
    toolButton->setToolTip(item.toolTip());
    toolButton->setWhatsThis(item.whatsThis());
    return toolButton;
}
Exemplo n.º 30
0
QToolButton* PanIconWidget::button()
{
    QToolButton* btn = new QToolButton;
    btn->setToolButtonStyle(Qt::ToolButtonIconOnly);
    btn->setIcon(SmallIcon("transform-move"));
    btn->hide();
    btn->setToolTip( i18n("Pan the image to a region"));
    return btn;
}