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()));
}
  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 );
  }
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;
}
Пример #4
0
QtChatWindow::AlertID QtChatWindow::addAlert(const std::string& alertText) {
	QWidget* alertWidget = new QWidget(this);
	QHBoxLayout* alertLayout = new QHBoxLayout(alertWidget);
	alertLayout_->addWidget(alertWidget);
	QLabel* alertLabel = new QLabel(this);
	alertLabel->setText(alertText.c_str());
	alertLayout->addWidget(alertLabel);

	QToolButton* closeButton = new QToolButton(alertWidget);
	closeButton->setIcon(style()->standardIcon(QStyle::SP_TitleBarCloseButton));
	closeButton->setIconSize(QSize(16,16));
	closeButton->setCursor(Qt::ArrowCursor);
	closeButton->setStyleSheet("QToolButton { border: none; padding: 0px; }");
	connect (closeButton, SIGNAL(clicked()), this, SLOT(handleAlertButtonClicked()));

	alertLayout->addWidget(closeButton);
	QPalette palette = alertWidget->palette();
	palette.setColor(QPalette::Window, QColor(Qt::yellow));
	palette.setColor(QPalette::WindowText, QColor(Qt::black));
	alertWidget->setStyleSheet(alertStyleSheet_);
	alertLabel->setStyleSheet(alertStyleSheet_);

	AlertID id = nextAlertId_++;
	alertWidgets_[id] = alertWidget;
	return id;
}
Пример #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 );
        }
Пример #6
0
dtkSearchField::dtkSearchField(QWidget *parent) : QWidget(parent)
{
    QLineEdit *lineEdit = new QLineEdit(this);
    connect(lineEdit, SIGNAL(textChanged(QString)),
            this, SIGNAL(textChanged(QString)));
    connect(lineEdit, SIGNAL(editingFinished()),
            this, SIGNAL(editingFinished()));
    connect(lineEdit, SIGNAL(textChanged(QString)),
            this, SLOT(setText(QString)));

    QToolButton *clearButton = new QToolButton(this);
    QPixmap clearIcon(QString(":/Qocoa/qsearchfield_nonmac.png"));
    clearButton->setIcon(QIcon(clearIcon));
    clearButton->setIconSize(clearIcon.size());
    clearButton->setFixedSize(clearIcon.size());
    clearButton->setStyleSheet("border: none;");
    clearButton->hide();
    connect(clearButton, SIGNAL(clicked()), this, SLOT(clear()));

    d = new dtkSearchFieldPrivate(this, lineEdit, clearButton);

    lineEdit->setStyleSheet(QString("QLineEdit { padding-right: %1px; } ").arg(d->clearButtonPaddedWidth()));
    const int width = qMax(lineEdit->minimumSizeHint().width(), d->clearButtonPaddedWidth());
    const int height = qMax(lineEdit->minimumSizeHint().height(), d->clearButtonPaddedHeight());
    lineEdit->setMinimumSize(width, height);

    QVBoxLayout *layout = new QVBoxLayout(this);
    layout->setMargin(0);
    layout->addWidget(lineEdit);
}
Пример #7
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);
}
Пример #8
0
void WelcomeWidget::UpdateRecentProjects(
    const QVector<RecentProject> &recent_projects) {
  ui->tableWidgetRecent->clearContents();
  ui->tableWidgetRecent->setRowCount(recent_projects.count());
  int row = 0;
  QSignalMapper *mapper = new QSignalMapper;
  for (const RecentProject &recent_project : recent_projects) {
    QTableWidgetItem *item_name = new QTableWidgetItem(recent_project.name());
    QTableWidgetItem *item_path = new QTableWidgetItem(recent_project.path());
    QToolButton *erase = new QToolButton;
    erase->setStyleSheet("border: 0;");
    erase->setCursor(QCursor(Qt::PointingHandCursor));
    erase->setIcon(QIcon(":/icons/images/remove.png"));
    erase->setIconSize(QSize(12, 12));
    connect(erase, SIGNAL(clicked()), mapper, SLOT(map()));
    mapper->setMapping(erase, row);
    QFont font = item_name->font();
    font.setBold(true);
    item_name->setFont(font);
    item_name->setToolTip(recent_project.name());
    item_path->setToolTip(recent_project.path());
    ui->tableWidgetRecent->setIndexWidget(
          ui->tableWidgetRecent->model()->index(row, 0), erase);
    ui->tableWidgetRecent->setItem(row, 1, item_name);
    ui->tableWidgetRecent->setItem(row, 2, item_path);
    ++row;
  }
  connect(mapper, SIGNAL(mapped(int)),
          parent_, SLOT(RemoveRecentProject(int)));
}
QToolButton* OurUserItemWidget::createToolButton(const QIcon& icon, const QSize iconSize, const QString& toolTip)
{
    QToolButton* toolButton = new QToolButton(this);
    toolButton->setIcon(icon);
    toolButton->setIconSize(iconSize);
    toolButton->setToolTip(toolTip);
    toolButton->setAutoRaise(true);

    return toolButton;
}
Пример #10
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;
}
Пример #11
0
/**
 * function that emulates button factory:)
 * @param icon
 * @param tip
 * @param dstobj
 * @param slot_method
 * @param layout
 * @return 
 */
QToolButton *MediaApp::initButton(QStyle::StandardPixmap icon, const QString & tip, QObject* dstobj, const char* slot_method, QLayout* layout) {
    QToolButton* button = new QToolButton;
    button->setIcon(style()->standardIcon(icon));
    button->setIconSize(QSize(20, 20));
    button->setToolTip(tip);
    connect(button, SIGNAL(clicked()), dstobj, slot_method);
    layout->addWidget(button);

    return button;
}
MusicSongsSummariziedFloatWidget::MusicSongsSummariziedFloatWidget(QWidget *parent)
    : QLabel(parent)
{
    setWindowFlags( Qt::Window | Qt::FramelessWindowHint );
    setObjectName("MainWidget");
    setStyleSheet("#MainWidget{background:rgba(0, 0, 0, 60);}");

    resize(60, 25);
    MusicUtils::widgetToRound(this, 10, 10);

    QHBoxLayout *layout = new QHBoxLayout(this);
    layout->setContentsMargins(0, 0, 0, 0);
    layout->setSpacing(0);
    QToolButton *locationButton = new QToolButton(this);
    QToolButton *searchButton = new QToolButton(this);
    layout->addWidget(locationButton);
    layout->addWidget(searchButton);

    locationButton->setIcon(QIcon(QString::fromUtf8(":/appTools/location")));
    locationButton->setIconSize(QSize(20, 20));
    locationButton->setStyleSheet(MusicUIObject::MToolButtonStyle03);
    locationButton->setCursor(QCursor(Qt::PointingHandCursor));
    searchButton->setIcon(QIcon(QString::fromUtf8(":/appTools/search")));
    searchButton->setIconSize(QSize(20, 20));
    searchButton->setStyleSheet(MusicUIObject::MToolButtonStyle03);
    searchButton->setCursor(QCursor(Qt::PointingHandCursor));
    connect(locationButton, SIGNAL(clicked()), SIGNAL(musicCurrentPlayLocation()));
    connect(searchButton, SIGNAL(clicked()), SIGNAL(musicSearch()));

    m_currentAnimationValue = 1;
    m_timer.setInterval(3*1000);
    connect(&m_timer, SIGNAL(timeout()), SLOT(leaveTimeout()));

    m_animation = new QPropertyAnimation(this, "windowOpacity");
    m_animation->setDuration(1000);
    connect(m_animation, SIGNAL(finished()), SLOT(animationFinished()));

    M_CONNECTION->setValue("MusicSongsSummariziedFloatWidget", this);
    M_CONNECTION->poolConnect("MusicSongsSummariziedFloatWidget", "MusicBottomAreaWidget");
    M_CONNECTION->poolConnect("MusicSongsSummariziedFloatWidget", "MusicApplication");
    m_timer.start();
}
Пример #13
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;
}
QToolButton *
PlayerWidget::createToolButton(QWidget *parent, const char *name, int size)
{
	QToolButton *toolButton = new QToolButton(parent);
	toolButton->setObjectName(name);
	toolButton->setMinimumSize(size, size);
	toolButton->setIconSize(size >= 32 ? QSize(size - 6, size - 6) : QSize(size, size));
	toolButton->setAutoRaise(true);
	toolButton->setFocusPolicy(Qt::NoFocus);
	return toolButton;
}
Пример #15
0
QToolButton* DiagramToolBox::createButton(QAction* action)
{
	int size = 1.8 * QFontMetrics(font()).height();

	QToolButton* newButton = new QToolButton();
	newButton->setDefaultAction(action);
	newButton->setToolTip(action->text());
	newButton->setIconSize(QSize(size, size));

	return newButton;
}
Пример #16
0
void LC_DockWidget::add_actions(QList<QAction*> list, int columns, int icon_size)
{
	for(auto const& item: list)
    {
		QToolButton* toolbutton = new QToolButton(this);
		toolbutton->setDefaultAction(item);
		toolbutton->setIconSize(QSize(icon_size, icon_size));
		int const count=grid->count();
		grid->addWidget(toolbutton, count/columns, count%columns);
    }
}
//=============================================================================
QToolButton *sstQt01PathPaintWidgetCls::createToolButton(const QString &toolTip,
                                          const QIcon &icon, const char *member)
{
    QToolButton *button = new QToolButton(this);
    button->setToolTip(toolTip);
    button->setIcon(icon);
    button->setIconSize(QSize(32, 32));
    connect(button, SIGNAL(clicked()), this, member);

    return button;
}
Пример #18
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;
}
Пример #19
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;
}
Пример #20
0
void MyTabBar::setupMoveButtons()
{
	for (int i = 0; i < count(); i++)
	{
		QFrame *leftFrame = new QFrame(this);
		QHBoxLayout *leftSide = new QHBoxLayout;
		leftSide->setContentsMargins(0, 0, 0, 0);
		leftSide->setSpacing(2);

		MyCheckBox *chActive = new MyCheckBox(this);
		chActive->setObjectName(QString("checkBox_fractal_enable_%1").arg(i + 1));
		leftSide->addWidget(chActive);
		connect(chActive, SIGNAL(stateChanged(int)), this, SLOT(slotToggleActive(int)));
		chActive->setChecked(i == 0);

		if (i > 0)
		{
			QToolButton *tbMoveLeft = new QToolButton(this);
			QIcon arrowLeft = this->style()->standardIcon(QStyle::SP_ArrowLeft);
			tbMoveLeft->setIcon(arrowLeft);
			tbMoveLeft->setIconSize(QSize(10, 10));
			tbMoveLeft->setObjectName(QString::number(i));
			connect(tbMoveLeft, SIGNAL(clicked()), this, SLOT(slotMoveLeft()));
			leftSide->addWidget(tbMoveLeft);
		}
		leftFrame->setLayout(leftSide);
		setTabButton(i, QTabBar::LeftSide, leftFrame);

		if (i < count() - 1)
		{
			QToolButton *tbMoveRight = new QToolButton(this);
			QIcon arrowRight = this->style()->standardIcon(QStyle::SP_ArrowRight);
			tbMoveRight->setIcon(arrowRight);
			tbMoveRight->setIconSize(QSize(10, 10));
			tbMoveRight->setObjectName(QString::number(i));
			setTabButton(i, QTabBar::RightSide, tbMoveRight);
			connect(tbMoveRight, SIGNAL(clicked()), this, SLOT(slotMoveRight()));
		}
	}
}
Пример #21
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;
}
Пример #22
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);
}
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;
}
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 );
}
Пример #25
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);
}
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;
}
Пример #27
0
void FileRenamerDlgImpl::resizeIcons()
{
    vector<QToolButton*> v;
    v.push_back(m_pPrevB);
    v.push_back(m_pNextB);
    v.push_back(m_pEditPatternsB);
    v.push_back(m_pRenameB);

    int k (m_pCommonData->m_nMainWndIconSize);
    for (int i = 0, n = cSize(v); i < n; ++i)
    {
        QToolButton* p (v[i]);
        p->setMaximumSize(k, k);
        p->setMinimumSize(k, k);
        p->setIconSize(QSize(k - 4, k - 4));
    }
}
Пример #28
0
void Widget::showNextThumbnails()
{
    int viewersize = viewer.size();
    if (thumbnailIndex >= viewersize) {
        thumbnailIndex = 0;
    } else {
        if ((thumbnailIndex + 5) >= viewersize)
            thumbnailIndex = 0;
        else
            thumbnailIndex += 5;
    }

    currentImages = viewer.getImageList(thumbnailIndex, 5);

    QPixmap pixmap;
    QToolButton *button;
    const Image *image;

    QLayoutItem *child;
    while ((child = ui->frameThumnailArea->layout()->takeAt(0)) != 0) {
        delete child->widget();
    }

    for (int j = 0; j < currentImages.size(); ++j) {
        image = currentImages.at(j);
        pixmap = image->getThumbnailPixmap();
        button = new QToolButton;
        button->setFixedSize(pixmap.size());
        button->setAccessibleName(QString::number(j));
        button->setAccessibleDescription(image->getPathString());
        button->setIcon(pixmap);
        button->setIconSize(pixmap.size());
        button->setAutoRaise(true);

        connect(button, SIGNAL(clicked()),&signalMapper, SLOT(map()));
        signalMapper.setMapping(static_cast<QObject *>(button), static_cast<QObject *>(button));

        ui->frameThumnailArea->layout()->addWidget(button);
    }

    currentIndex = 0;
    image = currentImages.at(currentIndex);
    QString path = image->getPathString();
    pixmap = QPixmap(path).scaled(400, 300, Qt::KeepAspectRatio);
    currentImage->setPixmap(pixmap);
}
ResetWidget::ResetWidget(QtProperty *property, QWidget *editor, QWidget *parent)
    : QWidget(parent)
    , mProperty(property)
{
    QHBoxLayout *layout = new QHBoxLayout(this);

    QToolButton *resetButton = new QToolButton(this);
    resetButton->setIcon(QIcon(QLatin1String(":/images/16x16/edit-clear.png")));
    resetButton->setIconSize(QSize(16, 16));
    resetButton->setAutoRaise(true);
    Utils::setThemeIcon(resetButton, "edit-clear");

    layout->setMargin(0);
    layout->setSpacing(0);
    layout->addWidget(editor);
    layout->addWidget(resetButton);

    connect(resetButton, &QToolButton::clicked, this, &ResetWidget::buttonClicked);
}
Пример #30
0
QToolButton* QuickButtonDisplay::actionButton(const char* objName, const char* icon, QString value) {
    QToolButton* toolButton = new QToolButton();
    toolButton->setIconSize(QSize(32, 32));
    toolButton->setObjectName(objName);
    toolButton->setIcon(QIcon(icon));
    toolButton->setText(value);
    toolButton->setToolTip(value);
    toolButton->setCursor(Qt::PointingHandCursor);
    toolButton->setContextMenuPolicy(Qt::CustomContextMenu);

    toolButton->setStyleSheet("QToolButton {"
                              "background: #242024;"
                              "}");

    connect(toolButton, SIGNAL(clicked()),
            toolBar, SLOT(quickButtonAction()));

    return toolButton;
}