本文整理汇总了C++中QWidgetAction::setText方法的典型用法代码示例。如果您正苦于以下问题:C++ QWidgetAction::setText方法的具体用法?C++ QWidgetAction::setText怎么用?C++ QWidgetAction::setText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWidgetAction
的用法示例。
在下文中一共展示了QWidgetAction::setText方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QMainWindow
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
QString strNumber = "k";
int nNumber = strNumber.toInt( );
strNumber = "";
nNumber = strNumber.toInt( );
QString strDateTime = "2011-01-06 01:02:03";
QString strFormat = "yyyy-M-d H:m:s";
QDateTime dt = QDateTime::fromString( strDateTime, strFormat );
strDateTime = "";
strDateTime = dt.toString( "yyyy-MM-dd HH:mm:ss" );
ui->setupUi(this);
//QPalette pal;
//QPixmap map( "D:/WinParkUI/debug/Image/NewIcon/CommonBG-normal.jpg");
//QBrush br( map );
//pal.setBrush( backgroundRole( ), br );
//setPalette( pal );
//setAutoFillBackground( true );
//mysql.DbConnect( "192.168.1.51", "test", "test", "parkadmin", 3306 );
//QSplitter *splitter = new QSplitter(this);
//splitter->setGeometry( this->geometry( ) );
//splitter->addWidget( ui->pushButton );
//splitter->addWidget( ui->tableWidget );
//splitter->addWidget( ui->pushButton_3 );
QWidgetAction* act = new QWidgetAction( ui->menuTest );
QComboBox* cbx = new QComboBox( ui->menuTest );
QStringList lst;
lst << "1" << "2" << "3";
cbx->addItems( lst );
act->setDefaultWidget( cbx );
//ui->toolBar->addAction( act );
act->setText( "Hello" );
ui->menuTest->addAction( act );
act = new QWidgetAction( ui->menuTest );
QDateTimeEdit* edit = new QDateTimeEdit( ui->menuTest );
edit->setCalendarPopup( true );
act->setDefaultWidget( edit );
ui->menuTest->addAction( act );
}
示例2: addEmpty
void MainMenu::addEmpty(QMenu *menu)
{
QWidgetAction *act = new QWidgetAction(menu);
act->setText(tr("*** Empty ***"));
menu->addAction(act);
}
示例3: createActionsForMainWindow
void QuickOpenPlugin::createActionsForMainWindow(Sublime::MainWindow* /*window*/, QString& xmlFile, KActionCollection& actions)
{
xmlFile = QStringLiteral("kdevquickopen.rc");
QAction* quickOpen = actions.addAction(QStringLiteral("quick_open"));
quickOpen->setText( i18n("&Quick Open") );
quickOpen->setIcon( QIcon::fromTheme(QStringLiteral("quickopen")) );
actions.setDefaultShortcut( quickOpen, Qt::CTRL | Qt::ALT | Qt::Key_Q );
connect(quickOpen, &QAction::triggered, this, &QuickOpenPlugin::quickOpen);
QAction* quickOpenFile = actions.addAction(QStringLiteral("quick_open_file"));
quickOpenFile->setText( i18n("Quick Open &File") );
quickOpenFile->setIcon( QIcon::fromTheme(QStringLiteral("quickopen-file")) );
actions.setDefaultShortcut( quickOpenFile, Qt::CTRL | Qt::ALT | Qt::Key_O );
connect(quickOpenFile, &QAction::triggered, this, &QuickOpenPlugin::quickOpenFile);
QAction* quickOpenClass = actions.addAction(QStringLiteral("quick_open_class"));
quickOpenClass->setText( i18n("Quick Open &Class") );
quickOpenClass->setIcon( QIcon::fromTheme(QStringLiteral("quickopen-class")) );
actions.setDefaultShortcut( quickOpenClass, Qt::CTRL | Qt::ALT | Qt::Key_C );
connect(quickOpenClass, &QAction::triggered, this, &QuickOpenPlugin::quickOpenClass);
QAction* quickOpenFunction = actions.addAction(QStringLiteral("quick_open_function"));
quickOpenFunction->setText( i18n("Quick Open &Function") );
quickOpenFunction->setIcon( QIcon::fromTheme(QStringLiteral("quickopen-function")) );
actions.setDefaultShortcut( quickOpenFunction, Qt::CTRL | Qt::ALT | Qt::Key_M );
connect(quickOpenFunction, &QAction::triggered, this, &QuickOpenPlugin::quickOpenFunction);
QAction* quickOpenAlreadyOpen = actions.addAction(QStringLiteral("quick_open_already_open"));
quickOpenAlreadyOpen->setText( i18n("Quick Open &Already Open File") );
quickOpenAlreadyOpen->setIcon( QIcon::fromTheme(QStringLiteral("quickopen-file")) );
connect(quickOpenAlreadyOpen, &QAction::triggered, this, &QuickOpenPlugin::quickOpenOpenFile);
QAction* quickOpenDocumentation = actions.addAction(QStringLiteral("quick_open_documentation"));
quickOpenDocumentation->setText( i18n("Quick Open &Documentation") );
quickOpenDocumentation->setIcon( QIcon::fromTheme(QStringLiteral("quickopen-documentation")) );
actions.setDefaultShortcut( quickOpenDocumentation, Qt::CTRL | Qt::ALT | Qt::Key_D );
connect(quickOpenDocumentation, &QAction::triggered, this, &QuickOpenPlugin::quickOpenDocumentation);
QAction* quickOpenActions = actions.addAction(QStringLiteral("quick_open_actions"));
quickOpenActions->setText( i18n("Quick Open &Actions") );
actions.setDefaultShortcut( quickOpenActions, Qt::CTRL | Qt::ALT | Qt::Key_A);
connect(quickOpenActions, &QAction::triggered, this, &QuickOpenPlugin::quickOpenActions);
m_quickOpenDeclaration = actions.addAction(QStringLiteral("quick_open_jump_declaration"));
m_quickOpenDeclaration->setText( i18n("Jump to Declaration") );
m_quickOpenDeclaration->setIcon( QIcon::fromTheme(QStringLiteral("go-jump-declaration") ) );
actions.setDefaultShortcut( m_quickOpenDeclaration, Qt::CTRL | Qt::Key_Period );
connect(m_quickOpenDeclaration, &QAction::triggered, this, &QuickOpenPlugin::quickOpenDeclaration, Qt::QueuedConnection);
m_quickOpenDefinition = actions.addAction(QStringLiteral("quick_open_jump_definition"));
m_quickOpenDefinition->setText( i18n("Jump to Definition") );
m_quickOpenDefinition->setIcon( QIcon::fromTheme(QStringLiteral("go-jump-definition") ) );
actions.setDefaultShortcut( m_quickOpenDefinition, Qt::CTRL | Qt::Key_Comma );
connect(m_quickOpenDefinition, &QAction::triggered, this, &QuickOpenPlugin::quickOpenDefinition, Qt::QueuedConnection);
QWidgetAction* quickOpenLine = new QWidgetAction(this);
quickOpenLine->setText( i18n("Embedded Quick Open") );
// actions.setDefaultShortcut( quickOpenLine, Qt::CTRL | Qt::ALT | Qt::Key_E );
// connect(quickOpenLine, SIGNAL(triggered(bool)), this, SLOT(quickOpenLine(bool)));
quickOpenLine->setDefaultWidget(createQuickOpenLineWidget());
actions.addAction(QStringLiteral("quick_open_line"), quickOpenLine);
QAction* quickOpenNextFunction = actions.addAction(QStringLiteral("quick_open_next_function"));
quickOpenNextFunction->setText( i18n("Next Function") );
actions.setDefaultShortcut( quickOpenNextFunction, Qt::CTRL| Qt::ALT | Qt::Key_PageDown );
connect(quickOpenNextFunction, &QAction::triggered, this, &QuickOpenPlugin::nextFunction);
QAction* quickOpenPrevFunction = actions.addAction(QStringLiteral("quick_open_prev_function"));
quickOpenPrevFunction->setText( i18n("Previous Function") );
actions.setDefaultShortcut( quickOpenPrevFunction, Qt::CTRL| Qt::ALT | Qt::Key_PageUp );
connect(quickOpenPrevFunction, &QAction::triggered, this, &QuickOpenPlugin::previousFunction);
QAction* quickOpenNavigateFunctions = actions.addAction(QStringLiteral("quick_open_outline"));
quickOpenNavigateFunctions->setText( i18n("Outline") );
actions.setDefaultShortcut( quickOpenNavigateFunctions, Qt::CTRL| Qt::ALT | Qt::Key_N );
connect(quickOpenNavigateFunctions, &QAction::triggered, this, &QuickOpenPlugin::quickOpenNavigateFunctions);
}
示例4: createActions
void ReferencesTool::createActions()
{
QWidgetAction *wAction = 0;
QAction *action = new QAction(i18n("Insert"), this);
addAction("insert_tableofcontents", action);
action->setToolTip(i18n("Insert a Table of Contents into the document."));
action = new QAction(i18n("Insert Custom..."), this);
addAction("insert_configure_tableofcontents", action);
action->setToolTip(i18n("Insert a custom Table of Contents into the document."));
action = new QAction(koIcon("configure"), i18n("Configure..."), this);
addAction("format_tableofcontents", action);
action->setToolTip(i18n("Configure the Table of Contents"));
connect(action, SIGNAL(triggered()), this, SLOT(formatTableOfContents()));
action = new QAction(i18n("Insert footnote with auto number"),this);
addAction("insert_autofootnote",action);
connect(action, SIGNAL(triggered()), this, SLOT(insertAutoFootNote()));
wAction = new QWidgetAction(this);
wAction->setText(i18n("Insert Labeled Footnote"));
QWidget *w = new LabeledWidget(wAction, i18n("Insert with label:"), LabeledWidget::INLINE, false);
wAction->setDefaultWidget(w);
addAction("insert_labeledfootnote", wAction);
connect(w, SIGNAL(triggered(QString)), this, SLOT(insertLabeledFootNote(QString)));
action = new QAction(i18n("Insert endnote with auto number"),this);
addAction("insert_autoendnote",action);
connect(action, SIGNAL(triggered()), this, SLOT(insertAutoEndNote()));
wAction = new QWidgetAction(this);
wAction->setText(i18n("Insert Labeled Endnote"));
w = new LabeledWidget(wAction, i18n("Insert with label:"), LabeledWidget::INLINE, false);
wAction->setDefaultWidget(w);
addAction("insert_labeledendnote", wAction); connect(w, SIGNAL(triggered(QString)), this, SLOT(insertLabeledEndNote(QString)));
action = new QAction(koIcon("configure"), i18n("Settings..."), this);
addAction("format_footnotes",action);
connect(action, SIGNAL(triggered()), this, SLOT(showFootnotesConfigureDialog()));
action = new QAction(koIcon("configure"), i18n("Settings..."), this);
addAction("format_endnotes",action);
connect(action, SIGNAL(triggered()), this, SLOT(showEndnotesConfigureDialog()));
action = new QAction(i18n("Insert Citation"), this);
addAction("insert_citation",action);
action->setToolTip(i18n("Insert a citation into the document."));
connect(action, SIGNAL(triggered()), this, SLOT(insertCitation()));
action = new QAction(i18n("Insert Bibliography"), this);
addAction("insert_bibliography",action);
action->setToolTip(i18n("Insert a bibliography into the document."));
action = new QAction(i18n("Insert Custom Bibliography"), this);
addAction("insert_custom_bibliography", action);
action->setToolTip(i18n("Insert a custom Bibliography into the document."));
action = new QAction(i18n("Configure"),this);
addAction("configure_bibliography",action);
action->setToolTip(i18n("Configure the bibliography"));
connect(action, SIGNAL(triggered()), this, SLOT(configureBibliography()));
action = new QAction(i18n("Insert Link"), this);
addAction("insert_link", action);
action->setToolTip(i18n("Insert a weblink or link to a bookmark."));
connect(action, SIGNAL(triggered()), this, SLOT(insertLink()));
wAction = new QWidgetAction(this);
wAction->setText(i18n("Add Bookmark"));
m_bmark = new LabeledWidget(wAction, i18n("Add Bookmark :"), LabeledWidget::ABOVE, true);
connect(m_bmark, SIGNAL(lineEditChanged(QString)), this, SLOT(validateBookmark(QString)));
wAction->setDefaultWidget(m_bmark);
addAction("insert_bookmark", wAction);
connect(m_bmark, SIGNAL(triggered(QString)), this, SLOT(insertBookmark(QString)));
wAction->setToolTip(i18n("Insert a Bookmark. This is useful to create links that point to areas within the document"));
action = new QAction(i18n("Bookmarks"), this);
addAction("invoke_bookmark_handler", action);
action->setToolTip(i18n("Display a pop up that hosts the options to add new Bookmark or handle existing Bookmarks"));
action = new QAction(i18n("Manage Bookmarks"), this);
addAction("manage_bookmarks", action);
action->setToolTip(i18n("Manage your Bookmarks. Check where are they pointing to, Delete or Rename."));
}