当前位置: 首页>>代码示例>>C++>>正文


C++ QToolButton::setAutoRaise方法代码示例

本文整理汇总了C++中QToolButton::setAutoRaise方法的典型用法代码示例。如果您正苦于以下问题:C++ QToolButton::setAutoRaise方法的具体用法?C++ QToolButton::setAutoRaise怎么用?C++ QToolButton::setAutoRaise使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QToolButton的用法示例。


在下文中一共展示了QToolButton::setAutoRaise方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: d

// ------------------
// HintProposalWidget
// ------------------
FunctionHintProposalWidget::FunctionHintProposalWidget()
    : d(new FunctionHintProposalWidgetPrivate)
{
    QToolButton *downArrow = new QToolButton;
    downArrow->setArrowType(Qt::DownArrow);
    downArrow->setFixedSize(16, 16);
    downArrow->setAutoRaise(true);

    QToolButton *upArrow = new QToolButton;
    upArrow->setArrowType(Qt::UpArrow);
    upArrow->setFixedSize(16, 16);
    upArrow->setAutoRaise(true);

    QHBoxLayout *pagerLayout = new QHBoxLayout(d->m_pager);
    pagerLayout->setMargin(0);
    pagerLayout->setSpacing(0);
    pagerLayout->addWidget(upArrow);
    pagerLayout->addWidget(d->m_numberLabel);
    pagerLayout->addWidget(downArrow);

    QHBoxLayout *popupLayout = new QHBoxLayout(d->m_popupFrame);
    popupLayout->setMargin(0);
    popupLayout->setSpacing(0);
    popupLayout->addWidget(d->m_pager);
    popupLayout->addWidget(d->m_hintLabel);

    connect(upArrow, SIGNAL(clicked()), SLOT(previousPage()));
    connect(downArrow, SIGNAL(clicked()), SLOT(nextPage()));

    qApp->installEventFilter(this);

    setFocusPolicy(Qt::NoFocus);
}
开发者ID:Azarien,项目名称:qt-creator,代码行数:36,代码来源:functionhintproposalwidget.cpp

示例2: QMainWindow

/**
* @brief 构造函数
* @param [I] 平台指针
* @param [I] 父指针
* @param [I] 窗口标志
*/
MainWindow::MainWindow(Workbench *wb, QWidget *parent, Qt::WFlags flags)
    : QMainWindow(parent, flags)
    , ui(new Ui::MainWindowClass)
    , m_workbench(wb)
{
    ui->setupUi(this);
    m_messageWidget = MessageWidget::instance();
    m_messageWidget->setParent(this, Qt::Tool);

    QStatusBar *statusBar = this->statusBar();

	{
		QToolButton *button = new QToolButton(statusBar);
		button->setIcon(QApplication::style()->standardIcon(QStyle::SP_FileDialogDetailedView));
		button->setAutoRaise(true);
		connect(button, SIGNAL(clicked()), workbench(), SLOT(showDebugger()));
		statusBar->addPermanentWidget(button);
	}

    // 显示消息按钮
    {
        QToolButton *button = new QToolButton(statusBar);
        button->addAction(m_messageWidget->toggleAction());
        button->setDefaultAction(m_messageWidget->toggleAction());
        button->setAutoRaise(true);
        statusBar->addPermanentWidget(button);
    }
}
开发者ID:walterqin,项目名称:weighbridge,代码行数:34,代码来源:mainwindow.cpp

示例3: QMainWindow

//--------------------utech--------------------utech--------------------utech--------------------
UMainWindow_AParkPerevez::UMainWindow_AParkPerevez(QWidget *parent)
        : QMainWindow(parent)
{
    ui.setupUi(this);
	setAttribute(Qt::WA_DeleteOnClose, true);
	setWindowTitle("\"Автопарк менеджер\" в."+QString(UAutoPark::version())+" -> Користувач:  "+UDialogRegisterUser::registeredUserName());
	
	QToolButton *tButton = new QToolButton(ui.tabWidget_parts);
	tButton->setIcon(QIcon(":/icontexto_webdev_pack/icontexto_webdev_pack/icontexto-webdev-add-032x032.png"));
	tButton->setAutoRaise(true);
	connect(tButton, SIGNAL(clicked(bool)), this, SLOT(buttonCreateTabParts_clicked()));
	ui.tabWidget_parts->setCornerWidget( tButton, Qt::TopLeftCorner );
	tButton = new QToolButton(ui.tabWidget_parts);
	tButton->setIcon(QIcon(":/icontexto_webdev_pack/icontexto_webdev_pack/icontexto-webdev-remove-032x032.png"));
	tButton->setAutoRaise(true);
	connect(tButton, SIGNAL(clicked(bool)), this, SLOT(buttonDeleteTabParts_clicked()));
	ui.tabWidget_parts->setCornerWidget( tButton, Qt::TopRightCorner );
	connect(ui.tabWidget_parts, SIGNAL(tabCloseRequested(int)), this, SLOT(tabWidget_parts_tabCloseRequested(int)));
	
	populateZmistTreeWidget();
	if (!loadUserSession())
		populatePartsTabWidget(UAutoPark::HelpWidget);
	
		//Connectors
	connect(ui.treeWidget_zmist, SIGNAL(activated (const QModelIndex &)), this, SLOT(treeWidget_zmist_itemDoubleClicked()));
	connect(ui.tabWidget_parts, SIGNAL(currentChanged(int)), this, SLOT(tabWidget_parts_currentChanged(int)));
	
	connect(ui.action_debugMessages, SIGNAL(activated()), this, SLOT(action_debugMessages_activated()));
	connect(ui.action_close, SIGNAL(activated()), this, SLOT(action_close_activated()));
	
	connect(ui.action_firmInfo, SIGNAL(activated()), this, SLOT(action_firmInfo_activated()));
	connect(ui.action_aboutProgram, SIGNAL(activated()), this, SLOT(action_aboutProgram_activated()));
}
开发者ID:utech,项目名称:autoparkmeneger,代码行数:34,代码来源:UMainWindow_AParkPerevez_constructor.cpp

示例4: QTabWidget

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;
}
开发者ID:jvesely,项目名称:ignitor,代码行数:25,代码来源:optionDialog.cpp

示例5: QDockWidget

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& ) ) );

}
开发者ID:carsonfarmer,项目名称:Quantum-GIS,代码行数:56,代码来源:qgsbrowserdockwidget.cpp

示例6: settings

NavFichiers::NavFichiers(QWidget *parent) : QMainWindow(parent)
{
	QSettings settings(Multiuso::appDirPath() + "/ini/nav_fichiers.ini", QSettings::IniFormat);

	if (settings.value("view_type").toString().isEmpty())
		settings.setValue("view_type", "Tableau");

	selectView = new QComboBox;
		selectView->addItems(QStringList() << "Tableau" << "Liste");
		selectView->setCurrentIndex(selectView->findText(settings.value("view_type").toString()));
			connect(selectView, SIGNAL(currentIndexChanged(QString)), this, SLOT(viewChanged(QString)));

	status = statusBar();
		status->addPermanentWidget(new QLabel("Vue : "));
		status->addPermanentWidget(selectView);

	creerActions();

	QToolButton *buttonNewTab = new QToolButton;
		buttonNewTab->setDefaultAction(actionNouvelOnglet);
		buttonNewTab->setAutoRaise(true);

	QToolButton *buttonCloseTab = new QToolButton;
		buttonCloseTab->setDefaultAction(actionFermerOnglet);
		buttonCloseTab->setAutoRaise(true);

	onglets = new QTabWidget;
		onglets->setMovable(true);
		onglets->setDocumentMode(true);
		onglets->setCornerWidget(buttonNewTab, Qt::BottomLeftCorner);
		onglets->setCornerWidget(buttonCloseTab, Qt::BottomRightCorner);
			connect(onglets, SIGNAL(tabCloseRequested(int)), this, SLOT(slotFermerOnglet(int)));
			connect(onglets, SIGNAL(currentChanged(int)), this, SLOT(slotOngletChange(int)));

	ajouterOnglet();
	onglets->setTabsClosable(false);

	setCentralWidget(onglets);

	QSettings reglages(Multiuso::appDirPath() + "/ini/nav_fichiers.ini", QSettings::IniFormat);
		restoreState(reglages.value("etat_fenetre").toByteArray());

	QShortcut *shortcutSwitchTab = new QShortcut(QKeySequence("Ctrl+Tab"), this);
		connect(shortcutSwitchTab, SIGNAL(activated()), this, SLOT(slotSwitchTab()));

	p_fenPrincipale = parent;
	p_navigateurWeb = NULL;
	
	m_copyCutObject = new CopyCutObject;
}
开发者ID:qrichert,项目名称:Multiuso,代码行数:50,代码来源:NavFichiers.cpp

示例7: createWidget

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;
}
开发者ID:SpiritSPb,项目名称:kwidgetsaddons,代码行数:32,代码来源:ktoolbarpopupaction.cpp

示例8: createWidget

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 );
        }
开发者ID:KDE,项目名称:okular,代码行数:30,代码来源:toolaction.cpp

示例9: QWidget

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);
}
开发者ID:theunbelievablerepo,项目名称:dolphin2.1,代码行数:30,代码来源:filterbar.cpp

示例10: QWidget

KHTMLViewBarWidget::KHTMLViewBarWidget( bool addCloseButton, QWidget *parent )
 : QWidget( parent )
{
    QHBoxLayout *layout = new QHBoxLayout;

    // NOTE: Here be cosmetics.
    layout->setMargin( 2 );

    // hide button
    if ( addCloseButton ) {
        QToolButton *hideButton = new QToolButton( this );
        hideButton->setAutoRaise( true );
        hideButton->setIcon( KIcon( "dialog-close" ) );
        connect( hideButton, SIGNAL( clicked() ), SIGNAL( hideMe() ) );
        layout->addWidget( hideButton );
        layout->setAlignment( hideButton, Qt::AlignLeft | Qt::AlignTop );
    }

    // widget to be used as parent for the real content
    m_centralWidget = new QWidget( this );
    layout->addWidget( m_centralWidget );

    setLayout( layout );
    setFocusProxy( m_centralWidget );
}
开发者ID:vasi,项目名称:kdelibs,代码行数:25,代码来源:khtmlviewbarwidget.cpp

示例11: QWidget

FindBar::FindBar(QWidget *parent)
    : QWidget(parent)
    , m_lineEdit(new KLineEdit(this))
    , m_matchCase(new QCheckBox(i18n("&Match case"), this))
    , m_highlightAll(new QCheckBox(i18n("&Highlight all"), this))
{
    QHBoxLayout *layout = new QHBoxLayout;

    // cosmetic
    layout->setContentsMargins(2, 0, 2, 0);

    // hide button
    QToolButton *hideButton = new QToolButton(this);
    hideButton->setAutoRaise(true);
    hideButton->setIcon(KIcon("dialog-close"));
    connect(hideButton, SIGNAL(clicked()), this, SLOT(hide()));
    layout->addWidget(hideButton);
    layout->setAlignment(hideButton, Qt::AlignLeft | Qt::AlignTop);

    // label
    QLabel *label = new QLabel(i18n("Find:"));
    layout->addWidget(label);

    // Find Bar signal
    connect(this, SIGNAL(searchString(QString)), this, SLOT(find(QString)));

    // lineEdit, focusProxy
    setFocusProxy(m_lineEdit);
    m_lineEdit->setMaximumWidth(250);
    connect(m_lineEdit, SIGNAL(textChanged(QString)), this, SLOT(find(QString)));
    layout->addWidget(m_lineEdit);

    // buttons
    KPushButton *findNext = new KPushButton(KIcon("go-down"), i18n("&Next"), this);
    KPushButton *findPrev = new KPushButton(KIcon("go-up"), i18n("&Previous"), this);
    connect(findNext, SIGNAL(clicked()), this, SLOT(findNext()));
    connect(findPrev, SIGNAL(clicked()), this, SLOT(findPrevious()));
    layout->addWidget(findNext);
    layout->addWidget(findPrev);

    // Case sensitivity. Deliberately set so this is off by default.
    m_matchCase->setCheckState(Qt::Unchecked);
    m_matchCase->setTristate(false);
    connect(m_matchCase, SIGNAL(toggled(bool)), this, SLOT(matchCaseUpdate()));
    layout->addWidget(m_matchCase);

    // Hightlight All. On by default
    m_highlightAll->setCheckState(Qt::Checked);
    m_highlightAll->setTristate(false);
    connect(m_highlightAll, SIGNAL(toggled(bool)), this, SLOT(updateHighlight()));
    layout->addWidget(m_highlightAll);

    // stretching widget on the left
    layout->addStretch();

    setLayout(layout);

    // we start off hidden
    hide();
}
开发者ID:KDE,项目名称:rekonq,代码行数:60,代码来源:findbar.cpp

示例12: QToolButton

/*!
  \internal
  \brief Creates a tool button using given action.
  This action will set as the default action instead of adding into its action list.
  @return the pointer to a QToolButton instance by "new" operation
 */
QToolButton * Ui::MainWindow::createToolButton(QAction *action, QWidget *parent /* = 0 */)
{
    QToolButton *button = new QToolButton(parent);
    button->setDefaultAction(action);
    button->setAutoRaise(true);
    button->setFocusPolicy(Qt::NoFocus);
    return button;
}
开发者ID:jaisurya,项目名称:picworks,代码行数:14,代码来源:mainwindow.cpp

示例13: init

/*
 * 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()));
}
开发者ID:ericbsd,项目名称:octopkg,代码行数:61,代码来源:searchbar.cpp

示例14: QToolButton

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;
}
开发者ID:Monthy,项目名称:gr-lida,代码行数:9,代码来源:editorwidget.cpp

示例15: registerPanel

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()));
}
开发者ID:jernejs,项目名称:otter,代码行数:57,代码来源:SidebarWidget.cpp


注:本文中的QToolButton::setAutoRaise方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。