Ejemplo n.º 1
0
void TabDeckEditor::createFiltersDock()
{
    filterModel = new FilterTreeModel();
    filterModel->setObjectName("filterModel");
    databaseDisplayModel->setFilterTree(filterModel->filterTree());
    databaseDisplayModel->setObjectName("databaseDisplayModel");
    filterView = new QTreeView;
    filterView->setObjectName("filterView");
    filterView->setModel(filterModel);
    filterView->setUniformRowHeights(true);
    filterView->setHeaderHidden(true);
    filterView->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(filterModel, SIGNAL(layoutChanged()), filterView, SLOT(expandAll()));
    connect(filterView, SIGNAL(customContextMenuRequested(const QPoint &)),this, SLOT(filterViewCustomContextMenu(const QPoint &)));

    FilterBuilder *filterBuilder = new FilterBuilder;
    filterBuilder->setObjectName("filterBuilder");
    connect(filterBuilder, SIGNAL(add(const CardFilter *)), filterModel, SLOT(addFilter(const CardFilter *)));

    QToolButton *filterDelOne = new QToolButton();
    filterDelOne->setObjectName("filterDelOne");
    filterDelOne->setDefaultAction(aClearFilterOne);
    filterDelOne->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);

    QToolButton *filterDelAll = new QToolButton();
    filterDelAll->setObjectName("filterDelAll");
    filterDelAll->setDefaultAction(aClearFilterAll);
    filterDelAll->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);

    QGridLayout *filterLayout = new QGridLayout;
    filterLayout->setObjectName("filterLayout");
    filterLayout->setContentsMargins(0,0,0,0);
    filterLayout->addWidget(filterBuilder, 0, 0, 1, 3);
    filterLayout->addWidget(filterView, 1, 0, 1, 3);
    filterLayout->addWidget(filterDelOne, 2, 0, 1, 1);
    filterLayout->addWidget(filterDelAll, 2, 2, 1, 1);

    filterBox = new QWidget();
    filterBox->setObjectName("filterBox");
    filterBox->setLayout(filterLayout);

    QVBoxLayout *filterFrame = new QVBoxLayout;
    filterFrame->setObjectName("filterFrame");
    filterFrame->addWidget(filterBox);

    filterDock = new QDockWidget(MainWindow);
    filterDock->setObjectName("filterDock");

    filterDock->setFeatures(QDockWidget::DockWidgetClosable|QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable);
    QWidget *filterDockContents = new QWidget(MainWindow);
    filterDockContents->setObjectName("filterDockContents");
    filterDockContents->setLayout(filterFrame);
    filterDock->setWidget(filterDockContents);    

    connect(btnFilter,SIGNAL(toggled(bool)),filterDock,SLOT(setVisible(bool)));
    filterDock->installEventFilter(this);
}
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& ) ) );

}
Ejemplo n.º 3
0
void SettingsWindow::genReset()
{
    QLabel *textView = new QLabel;
    textView->setWordWrap(true);
    textView->setText(tr("If you click \"Start Reset\", you accept close browser (loose all opened tabs) and delete :<ul><li>Account</li><li>Color background</li><li>Home Page</li><li>Elements of Interface</li><li>Account</li></ul>Do you continue ?"));
    textView->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum);

    QToolButton *btnReset = new QToolButton;
    btnReset->setIcon(QIcon(":/img/forward.png"));
    btnReset->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    btnReset->setText(tr("Start Reset"));
    btnReset->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum);
    connect(btnReset,SIGNAL(clicked()),this,SLOT(reset()));

    // --------------------------

    QWidget *spacer = new QWidget;
    spacer->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);

    QGridLayout *mainLayout = new QGridLayout;
    mainLayout->setSpacing(10);
    mainLayout->setContentsMargins(0,10,0,0);
    mainLayout->addWidget(textView);
    mainLayout->addWidget(btnReset);
    mainLayout->addWidget(spacer);

    tabReset = new SettingsPanel;
    tabReset->setTitle(tr("Reset"));
    tabReset->setMainLayout(mainLayout);
}
Ejemplo n.º 4
0
void SettingsWindow::genOptions()
{
    QCheckBox *checkPlugins = new QCheckBox(tr("Enable Plugins"));
    QCheckBox *checkJava = new QCheckBox(tr("Enable Java"));
    QCheckBox *checkJavaScript = new QCheckBox(tr("Enable JavaScript"));
    QCheckBox *checkJavascriptCanOpenWindows = new QCheckBox(tr("JavaScript can open windows"));
    QCheckBox *checkJavascriptCanAccessClipboard = new QCheckBox(tr("JavaScript can access clipboard"));

    QToolButton *btnCheckAll = new QToolButton;
    btnCheckAll->setIcon(QIcon(":/img/menu.png"));
    btnCheckAll->setIconSize(QSize(0,0));
    btnCheckAll->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    btnCheckAll->setText(tr("Select all"));
    btnCheckAll->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum);

    // --------------------------

    QWidget *spacer = new QWidget;
    spacer->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);

    QGridLayout *mainLayout = new QGridLayout;
    mainLayout->setSpacing(10);
    mainLayout->setContentsMargins(0,10,0,0);
    mainLayout->addWidget(checkPlugins);
    mainLayout->addWidget(checkJava);
    mainLayout->addWidget(checkJavaScript);
    mainLayout->addWidget(checkJavascriptCanOpenWindows);
    mainLayout->addWidget(checkJavascriptCanAccessClipboard);
    mainLayout->addWidget(btnCheckAll);
    mainLayout->addWidget(spacer);

    tabOptions = new SettingsPanel;
    tabOptions->setTitle(tr("Options"));
    tabOptions->setMainLayout(mainLayout);
}
Ejemplo n.º 5
0
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 );
        }
Ejemplo n.º 6
0
void BookmarksToolBar::build()
{
    clear();
    for (int i = 0; i < m_bookmarksModel->rowCount(m_root); ++i) {
        QModelIndex idx = m_bookmarksModel->index(i, 0, m_root);
        if (m_bookmarksModel->hasChildren(idx)) {
            QToolButton *button = new QToolButton(this);
            button->setPopupMode(QToolButton::InstantPopup);
            button->setArrowType(Qt::DownArrow);
            button->setText(idx.data().toString());
            ModelMenu *menu = new ModelMenu(this);
            connect(menu, SIGNAL(activated(QModelIndex)),
                    this, SLOT(activated(QModelIndex)));
            menu->setModel(m_bookmarksModel);
            menu->setRootIndex(idx);
            menu->addAction(new QAction(menu));
            button->setMenu(menu);
            button->setToolButtonStyle(Qt::ToolButtonTextOnly);
            QAction *a = addWidget(button);
            a->setText(idx.data().toString());
        } else {
            QAction *action = addAction(idx.data().toString());
            action->setData(idx.data(BookmarksModel::UrlRole));
        }
    }
}
  EmptyServiceCallInterfaceAction::EmptyServiceCallInterfaceAction( QWidget* parent )
    : rviz::Panel( parent )
  {
    parseROSParameters();

    QHBoxLayout* h_layout = new QHBoxLayout;
    h_layout->setAlignment(Qt::AlignLeft);
    layout = new QVBoxLayout();
    signal_mapper = new QSignalMapper(this);

    for(size_t i = 0; i < service_call_button_infos_.size();i++){
      ServiceCallButtonInfo target_button = service_call_button_infos_[i];
      QToolButton* tbutton = new QToolButton(this);
      tbutton->setText(target_button.text.c_str());
      tbutton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
      tbutton->setIconSize(QSize(100, 100));
      tbutton->setIcon(QIcon(QPixmap(QString(target_button.icon_file_path.c_str()))));
      connect(tbutton, SIGNAL(clicked()), signal_mapper, SLOT(map()));
      signal_mapper->setMapping(tbutton, i);
      h_layout->addWidget(tbutton);
    };
    connect(signal_mapper, SIGNAL(mapped(int)),
            this, SLOT(callRequestEmptyCommand(int)));
    layout->addLayout(h_layout);
    setLayout( layout );
  }
Ejemplo n.º 8
0
MainWindow::MainWindow( QWidget *parent ):
    QMainWindow( parent )
{
    d_plot = new Plot( this );
    setCentralWidget( d_plot );

    QToolBar *toolBar = new QToolBar( this );

    QComboBox *typeBox = new QComboBox( toolBar );
    typeBox->addItem( "Bars" );
    typeBox->addItem( "CandleSticks" );
    typeBox->setCurrentIndex( 1 );
    typeBox->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );

    QToolButton *btnExport = new QToolButton( toolBar );
    btnExport->setText( "Export" );
    btnExport->setToolButtonStyle( Qt::ToolButtonTextUnderIcon );
    connect( btnExport, SIGNAL( clicked() ), d_plot, SLOT( exportPlot() ) );

    toolBar->addWidget( typeBox );
    toolBar->addWidget( btnExport );
    addToolBar( toolBar );

    d_plot->setMode( typeBox->currentIndex() );
    connect( typeBox, SIGNAL( currentIndexChanged( int ) ),
        d_plot, SLOT( setMode( int ) ) );
}
Ejemplo n.º 9
0
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);
}
QWidget *KToolBarPopupAction::createWidget(QWidget *_parent)
{
    QToolBar *parent = qobject_cast<QToolBar *>(_parent);
    if (!parent) {
        return QWidgetAction::createWidget(_parent);
    }
    QToolButton *button = new QToolButton(parent);
    button->setAutoRaise(true);
    button->setFocusPolicy(Qt::NoFocus);
    button->setIconSize(parent->iconSize());
    button->setToolButtonStyle(parent->toolButtonStyle());
    button->setDefaultAction(this);

    connect(parent, &QToolBar::iconSizeChanged,
            button, &QAbstractButton::setIconSize);
    connect(parent, &QToolBar::toolButtonStyleChanged,
            button, &QToolButton::setToolButtonStyle);
    connect(button, &QToolButton::triggered,
            parent, &QToolBar::actionTriggered);

    if (d->delayed)
        if (d->stickyMenu) {
            button->setPopupMode(QToolButton::MenuButtonPopup);
        } else {
            button->setPopupMode(QToolButton::DelayedPopup);
        }
    else {
        button->setPopupMode(QToolButton::InstantPopup);
    }

    return button;
}
Ejemplo n.º 11
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;
}
Ejemplo n.º 12
0
void QtMainWindow::ShowActionWithText(QToolBar *toolbar, QAction *action, bool showText)
{
	if(NULL != toolbar && NULL != action)
	{
		QToolButton *toolBnt = dynamic_cast<QToolButton *>(toolbar->widgetForAction(action));
		if(NULL != toolBnt)
		{
			if(showText)
			{
				toolBnt->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
			}
			else
			{
				toolBnt->setToolButtonStyle(Qt::ToolButtonIconOnly);
			}
		}
	}
}
Ejemplo n.º 13
0
QToolButton *ToolBarChanger::insertAction(Action *AAction, int AGroup)
{
	QToolButton *button = new QToolButton(FToolBar);
	button->setToolButtonStyle(FToolBar->toolButtonStyle());
	button->setDefaultAction(AAction);
	FButtons.insert(AAction, button);
	insertWidget(button, AGroup);
	return button;
}
Ejemplo n.º 14
0
static QToolButton *createToolButton(const QIcon &icon, const QString &text, QWidget *parent = 0)
{
	QToolButton *result = new QToolButton(parent);
	result->setIcon(icon);
	result->setText(text);
	result->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
	result->setAutoRaise(true);
	return result;
}
Ejemplo n.º 15
0
MainWindow::MainWindow( QWidget *parent ):
    QMainWindow( parent )
{
    d_plot = new Plot( this );

    setCentralWidget( d_plot );

    QToolBar *toolBar = new QToolBar( this );

#ifndef QT_NO_PRINTER
    QToolButton *btnPrint = new QToolButton( toolBar );
    btnPrint->setText( "Print" );
    btnPrint->setToolButtonStyle( Qt::ToolButtonTextUnderIcon );
    toolBar->addWidget( btnPrint );
    connect( btnPrint, SIGNAL( clicked() ),
        d_plot, SLOT( printPlot() ) );

    toolBar->addSeparator();
#endif

    toolBar->addWidget( new QLabel("Color Map " ) );
    QComboBox *mapBox = new QComboBox( toolBar );
    mapBox->addItem( "RGB" );
    mapBox->addItem( "Indexed Colors" );
    mapBox->addItem( "Hue" );
    mapBox->addItem( "Alpha" );
    mapBox->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
    toolBar->addWidget( mapBox );
    connect( mapBox, SIGNAL( currentIndexChanged( int ) ),
             d_plot, SLOT( setColorMap( int ) ) );

    toolBar->addWidget( new QLabel( " Opacity " ) );
    QSlider *slider = new QSlider( Qt::Horizontal );
    slider->setRange( 0, 255 );
    slider->setValue( 255 );
    connect( slider, SIGNAL( valueChanged( int ) ), 
        d_plot, SLOT( setAlpha( int ) ) );

    toolBar->addWidget( slider );
    toolBar->addWidget( new QLabel("   " ) );

    QCheckBox *btnSpectrogram = new QCheckBox( "Spectrogram", toolBar );
    toolBar->addWidget( btnSpectrogram );
    connect( btnSpectrogram, SIGNAL( toggled( bool ) ),
        d_plot, SLOT( showSpectrogram( bool ) ) );

    QCheckBox *btnContour = new QCheckBox( "Contour", toolBar );
    toolBar->addWidget( btnContour );
    connect( btnContour, SIGNAL( toggled( bool ) ),
        d_plot, SLOT( showContour( bool ) ) );

    addToolBar( toolBar );

    btnSpectrogram->setChecked( true );
    btnContour->setChecked( false );

}
Ejemplo n.º 16
0
QToolButton* ProcessingManager::getButton(const QString& icon, const QString& text, const QString& tooltip) {
    QToolButton* button = new QToolButton();
    button->setIcon(ApplicationData::icon(icon));
    button->setText(text);
    button->setIconSize(QSize(32, 32));
    button->setFixedHeight(60);
    button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    button->setToolTip("Remove all images from queue");
    return button;
}
Ejemplo n.º 17
0
QToolButton* AppearanceDialog::selectButton(int width, int height, QString toolTip) {
    QToolButton* button = new QToolButton(this);
    button->setToolTip(toolTip);
    button->setToolButtonStyle(Qt::ToolButtonTextOnly);
    button->setMenu(new QMenu(button));
    button->setMinimumWidth(width);
    button->setMinimumHeight(height);

    return button;
}
Ejemplo n.º 18
0
void FeatureTreeWidget::assignColorFromSMVTreeWidget(QString featureName)
{
    QTreeWidgetItem *item = getItemFromFeatureName(featureName);

    if (item!=0)
    {
        if (item->childCount()==0){
            mainWindow->questionDialog->writeToLog("assignColor<1>");
            Feature *f = getCorrespondingFeature(featureName);
            Color *c = static_cast<MyListWidgetItem*>(listWidget->selectedItems().at(0))->getBGColor();
            if (item->backgroundColor(0).isValid())
                mainWindow->removeColorAssignment(static_cast<MyTreeWidgetItem*>(item));
            colorManager->setColorForFeature(f,c);

            //X zum Abwählen der Farbe setzen
            if (itemWidget(item, 1))
                itemWidget(item, 1)->show();
            else{
                QToolButton *deleteButton = new QToolButton(this);
                deleteButton->setFont(QFont(QString("MS Shell Dlg 2"),9,10,false));
                //deleteButton->setFixedSize(15,18);
                deleteButton->setFixedWidth(16);

                QIcon icon = QIcon();
                icon.addPixmap(QPixmap(QString(":/images/cross.png")),QIcon::Normal,QIcon::On);
                deleteButton->setIcon(icon);
                deleteButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
                setItemWidget(item,1,deleteButton);
                connect(deleteButton,SIGNAL(clicked()),this,SLOT(removeColorAssignment()));
            }

            //aktualisiere SmvTreeWidget und TextEdit
            mainWindow->updateSMVTreeTexture(f);
            redrawListWidget();

            //wenn Farbe schon in FeatureTreeWidget vorhanden, setze diese auf weiß/transparent
            QList <QTreeWidgetItem*> *treeList = new QList <QTreeWidgetItem*>();
            findBackGroundColor(c->color,root,treeList);
            if (treeList->isEmpty()==false)
            {
                for (int i = 0;i < treeList->size();i++){
                    static_cast<MyTreeWidgetItem*>(treeList->at(i))->setBackgroundInvalid();
//                    treeList->at(i)->background(0).setStyle(Qt::NoBrush);
//                    treeList->at(i)->setBackgroundColor(0,QColor(0,0,0,0));
                    colorManager->deleteColorForFeature(getCorrespondingFeature(treeList->at(i)->text(0)));

                }
            }
            //setze Farbe im FeatureTreeWidget
            static_cast<MyTreeWidgetItem*>(item)->setBGColor(c);
            //item->setBackgroundColor(0,selected->color);
        }
    }
}
Ejemplo n.º 19
0
QToolButton* 
EchonestSteerer::initButton( QWidget* parent )
{
    QToolButton* btn = new QToolButton( parent );
    btn->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
    btn->setIconSize( QSize( 14, 14 ) );
    btn->setToolButtonStyle( Qt::ToolButtonIconOnly );
    btn->setAutoRaise( true );
    btn->setContentsMargins( 0, 0, 0, 0 );
    return btn;
}
Ejemplo n.º 20
0
QToolButton* FindWidget::setupToolButton(const QString &text, const QString &icon)
{
    QToolButton *toolButton = new QToolButton(this);

    toolButton->setText(text);
    toolButton->setAutoRaise(true);
    toolButton->setIcon(QIcon(icon));
    toolButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);

    return toolButton;
}
Ejemplo n.º 21
0
QToolButton* MainWindow::createToolButton(QIcon buttonIcon, QString buttonName) //初始化顶部按钮
{
    QToolButton* toolButton;
    toolButton = new QToolButton(this);
    toolButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    toolButton->setIcon(buttonIcon);
    toolButton->setIconSize(QSize(50,50));
    toolButton->setText(buttonName);
    toolButton->setMinimumWidth(65);
    toolButton->setAutoRaise(true);
    return toolButton;
}
Ejemplo n.º 22
0
QAbstractButton *StartTab::addShortcut(const QString &name, const QIcon &icon, QWidget *parent)
{
	// QPushButton has visual problems with big icons
	QToolButton *button = new QToolButton(parent);
	button->setText(name);
	button->setIcon(icon);
	button->setFocusPolicy(Qt::NoFocus);
	button->setIconSize(QSize(48, 48));
	button->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
	button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
	return button;
}
Ejemplo n.º 23
0
PreviewDialog::PreviewDialog(QWidget *parent) : DragWidget(parent)
{
    m_borderImage = false;
    setAutoFillBackground(true);

    m_label = new PreviewLabel(this);
    m_slider = new QSlider(this);

    m_zoomLabel = new QLabel(this);

    setZoom(1);

    QVBoxLayout *layout = new QVBoxLayout(this);
    QHBoxLayout *horizontalLayout = new QHBoxLayout();
    QHBoxLayout *horizontalLayout2 = new QHBoxLayout();
    layout->setMargin(0);
    layout->setContentsMargins(2, 2, 2, 16);
    layout->setSpacing(4);
    QToolButton *toolButton = new QToolButton(this);
    QIcon icon(style()->standardIcon(QStyle::SP_DockWidgetCloseButton));
    toolButton->setIcon(icon);
    toolButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
    toolButton->setFixedSize(icon.availableSizes().value(0) + QSize(4, 4));
    connect(toolButton, SIGNAL(clicked()), this, SLOT(onTogglePane()));

    QScrollArea *scrollArea = new QScrollArea(this);
    WheelFilter *wheelFilter = new WheelFilter(scrollArea);
    scrollArea->setWidget(m_label);
    scrollArea->setFrameStyle(QFrame::NoFrame);
    m_slider->setOrientation(Qt::Horizontal);
    m_slider->setRange(1, 6);
    m_slider->setFixedWidth(80);
    m_zoomLabel->setFixedWidth(50);

    horizontalLayout->addWidget(toolButton);
    horizontalLayout->addSpacing(6);
    horizontalLayout->addWidget(m_slider);
    horizontalLayout->addSpacing(6);
    horizontalLayout->addWidget(m_zoomLabel);
    horizontalLayout->addStretch(1);

    layout->addLayout(horizontalLayout);
    horizontalLayout2->addSpacing(24);
    horizontalLayout2->addWidget(scrollArea);
    layout->addLayout(horizontalLayout2);

    wheelFilter->setTarget(this);

    connect(m_slider, SIGNAL(valueChanged(int)), this, SLOT(onSliderMoved(int)));

    foreach (QWidget *childWidget, findChildren<QWidget*>()) {
        childWidget->installEventFilter(wheelFilter);
    }
Ejemplo n.º 24
0
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;
}
Ejemplo n.º 25
0
void BtFindWidget::createToolButton(QIcon const & icon,
                                    QString const & text,
                                    char const * slot)
{
    QToolButton* button = new QToolButton(this);
    button->setIcon(icon);
    button->setIconSize(QSize(16,16));
    button->setText(text);
    button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    button->setAutoRaise(true);
    m_layout->addWidget(button);
    bool ok = connect(button, SIGNAL(released()), this, slot);
    Q_ASSERT(ok);
}
Ejemplo n.º 26
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);
}
Ejemplo n.º 27
0
void SideBarGroup::addAction(QAction* action)
{
    int size = KIconLoader::global()->currentSize(KIconLoader::Small);
    QToolButton* button = new SideBarButton();
    button->setFocusPolicy(Qt::NoFocus);
    button->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
    button->setAutoRaise(true);
    button->setDefaultAction(action);
    button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    button->setIconSize(QSize(size, size));
    if (action->menu()) {
        button->setPopupMode(QToolButton::InstantPopup);
    }
    addWidget(button);
}
Ejemplo n.º 28
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;
    }
Ejemplo n.º 29
0
MainWindow::MainWindow()
{
    QWidget *w = new QWidget( this );

    d_canvas[0] = new Canvas( Canvas::Svg, this );
    d_canvas[0]->setAutoFillBackground( true );
    d_canvas[0]->setPalette( Qt::gray );

    d_canvas[1] = new Canvas( Canvas::VectorGraphic, this );
    d_canvas[1]->setAutoFillBackground( true );
    d_canvas[1]->setPalette( Qt::gray );

    QVBoxLayout *vBox1 = new QVBoxLayout();
    vBox1->setContentsMargins( 0, 0, 0, 0 );
    vBox1->setSpacing( 5 );
    vBox1->addWidget( new QLabel( "SVG" ), 0, Qt::AlignCenter );
    vBox1->addWidget( d_canvas[0], 10 );

    QVBoxLayout *vBox2 = new QVBoxLayout();
    vBox2->setContentsMargins( 0, 0, 0, 0 );
    vBox2->setSpacing( 5 );
    vBox2->addWidget( new QLabel( "Vector Graphic" ), 0, Qt::AlignCenter );
    vBox2->addWidget( d_canvas[1], 10 );

    QHBoxLayout *layout = new QHBoxLayout( w );
    layout->addLayout( vBox1 );
    layout->addLayout( vBox2 );

    setCentralWidget( w );

    QToolBar *toolBar = new QToolBar( this );

    QToolButton *btnLoad = new QToolButton( toolBar );

    btnLoad->setText( "Load SVG" );
    btnLoad->setToolButtonStyle( Qt::ToolButtonTextUnderIcon );
    toolBar->addWidget( btnLoad );

    addToolBar( toolBar );

    connect( btnLoad, SIGNAL( clicked() ), this, SLOT( loadSVG() ) );

#if 0
    QPainterPath path;
    path.addRect( QRectF( 1.0, 1.0, 2.0, 2.0 ) );
    loadPath( path );
#endif
};
Ejemplo n.º 30
0
	QWidget * createWidget (QWidget * pParent)
	{
		QToolButton * pToolButton = new QToolButton(pParent);
		pToolButton->setToolButtonStyle(Qt::ToolButtonTextOnly);
		pToolButton->setPopupMode(QToolButton::InstantPopup);
		pToolButton->setMinimumHeight(TOOLBAR_MIN_HEIGHT);
		pToolButton->setMinimumWidth(100);

		QMenu * pMenu = new QMenu(pToolButton);
		pMenu->addMenu(tr("Textured"));
		pMenu->addMenu(tr("Wireframe"));
		pMenu->addMenu(tr("Tex-Wir"));

		pToolButton->setMenu(pMenu);
		return pToolButton;
	}