// ------------------ // 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); }
/** * @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); } }
//--------------------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())); }
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; }
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& ) ) ); }
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; }
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; }
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 ); }
MsgFile::MsgFile(CToolCustom *parent, Message *msg) : QLineEdit(parent) { m_client = msg->client(); for (QWidget *p = parent->parentWidget(); p; p = p->parentWidget()){ if (p->inherits("MsgEdit")){ m_edit = static_cast<MsgEdit*>(p); break; } } m_edit->m_edit->setTextFormat(PlainText); QString t = msg->getPlainText(); if (!t.isEmpty()) m_edit->m_edit->setText(t); setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); parent->addWidget(this); QToolButton *btn = new QToolButton(parent); btn->setAutoRaise(true); btn->setIconSet(*Icon("fileopen")); btn->setTextLabel(i18n("Select file")); parent->addWidget(btn); btn->show(); connect(btn, SIGNAL(clicked()), this, SLOT(selectFile())); parent->setText(i18n("File:")); connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(changed(const QString&))); Command cmd; cmd->id = CmdSend; cmd->param = m_edit; Event e(EventCommandWidget, cmd); btnSend = (QToolButton*)(e.process()); setText(static_cast<FileMessage*>(msg)->getFile()); changed(text()); show(); }
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); }
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 ); }
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(); }
/*! \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; }
/* * 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())); }
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; }
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())); }
void MainWindow::initMenus() { menuBar()->clear(); FileOperationsMenu* fileOpMenu = new FileOperationsMenu(); m_menuManager.registerMenus(fileOpMenu); fileOpMenu->setActive(this); m_menuManager.addActivation(fileOpMenu); m_menuables.append(fileOpMenu); SourceFileMenu* sourceFileMenu = new SourceFileMenu(this); m_menuManager.registerMenus(sourceFileMenu); m_menuables.append(sourceFileMenu); MainWindowMenu* mainWindowMenu = new MainWindowMenu(this); m_menuManager.registerMenus(mainWindowMenu); mainWindowMenu->setActive(this); m_menuManager.addActivation(mainWindowMenu); m_menuables.append(mainWindowMenu); TargetMenu* targetMenu = new TargetMenu; m_menuManager.registerMenus(targetMenu); m_menuables.append(targetMenu); ProjectMenu* projectMenu = new ProjectMenu(); m_menuManager.registerMenus(projectMenu); m_menuables.append(projectMenu); #ifdef BUILD_WEB_TAB WebTabMenu* webTabMenu = new WebTabMenu; m_menuManager.registerMenus(webTabMenu); m_menuables.append(webTabMenu); #endif #ifdef BUILD_DEVELOPER_TOOLS DeveloperMenu* developerMenu = new DeveloperMenu(this); m_menuManager.registerMenus(developerMenu); m_menuManager.addActivation(developerMenu); m_menuables.append(developerMenu); #endif #ifdef BUILD_DOCUMENTATION_TAB DocumentationMenu* documentationMenu = new DocumentationMenu(this); m_menuManager.registerMenus(documentationMenu); m_menuManager.addActivation(documentationMenu); m_menuables.append(documentationMenu); #endif m_menuManager.construct(ui_menubar, ui_toolBar); /* Sets up the QTabWidget that handles the editor windows */ QToolButton *cornerButton = new QToolButton(ui_tabWidget); cornerButton->setDefaultAction(mainWindowMenu->closeNode()->rawAction); cornerButton->setAutoRaise(true); ui_tabWidget->setCornerWidget(cornerButton); }
QToolButton *ToolWindow::addButton(QGridLayout *layout, int row, int col, const char *iconPath, EmulatorWindowSlot slot) { QToolButton *button = new QToolButton(); button->setAutoRaise(true); button->setIcon(QIcon(iconPath)); QObject::connect(button, &QPushButton::clicked, emulator_window, slot); layout->addWidget(button, row, col); layout->setAlignment(button, Qt::AlignHCenter); return button; }
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; }
QToolButton *ListWidgetButtonContainer::newButton(QWidget *parent) const { QToolButton *button = new QToolButton(parent); button->setDisabled(true); button->setAutoRaise(true); return button; }
QToolButton * KviWindow::createToolButton(QWidget * pPar, const char * pcName, KviIconManager::SmallIcon eIcon, const QString & szToolTip, bool bOn) { QToolButton * pTool = new QToolButton(pPar); pTool->setObjectName(pcName); pTool->setIcon(QIcon(*(g_pIconManager->getSmallIcon(eIcon)))); pTool->setAutoRaise(true); pTool->setChecked(bOn); KviTalToolTip::add(pTool, szToolTip); return pTool; }
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; }
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; }
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* 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; }
QToolButton *TitleBarWidget::addButton(QBoxLayout *layout, const char *iconPath, ToolWindowSlot slot) { QToolButton *button = new QToolButton(); button->setAutoRaise(true); if (iconPath) button->setIcon(QIcon(iconPath)); button->setMaximumSize(QSize(15, 15)); button->setMinimumSize(button->maximumSize()); button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); QObject::connect(button, &QPushButton::clicked, tool_window, slot); layout->addWidget(button); layout->setAlignment(button, Qt::AlignLeft); return button; }
/*! Add smileys by setting a imgage file and a textlist of textual representations. */ void EmoticonMenu::addEmoticon(const QString &imgPath, const QStringList &texts) { QToolButton *button = new QToolButton(this); button->setIcon(QIcon(imgPath)); button->setAutoRaise(true); button->setToolTip(texts.first()); button->setProperty("smiley", QString("<img src=\"%1\" />").arg(imgPath)); connect(button, &QToolButton::clicked, this, &EmoticonMenu::onEmoticonTriggered); connect(button, &QToolButton::clicked, this, &EmoticonMenu::close); layout->addWidget(button, layout->count()/5, layout->count()%5); getSmileyHash().insert(imgPath, texts); }
FileInfo() { resize(0, 40); QHBoxLayout* layout = new QHBoxLayout(this); path = new QLineEdit; path->setFrame(false); path->setStyleSheet("background:transparent;"); layout->addWidget(path); remove = new QToolButton; remove->setAutoRaise(true); remove->setIcon(QIcon(":/Resources/delete.png")); layout->addWidget(remove); }
QT_BEGIN_NAMESPACE static QToolButton *createToolButton(QWidget *parent, Qt::ArrowType at, const QString &name) { QToolButton *rc = new QToolButton(); rc->setAttribute(Qt::WA_NoChildEventsForParent, true); rc->setParent(parent); rc->setObjectName(name); rc->setArrowType(at); rc->setAutoRaise(true); rc->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); rc->setFixedSize(QSize(15, 15)); return rc; }
static QToolButton *createFilterButton(QIcon icon, const QString &toolTip, QObject *receiver, const char *slot) { QToolButton *button = new QToolButton; button->setIcon(icon); button->setToolTip(toolTip); button->setCheckable(true); button->setChecked(true); button->setAutoRaise(true); button->setEnabled(true); QObject::connect(button, SIGNAL(toggled(bool)), receiver, slot); return button; }