本文整理汇总了C++中QTextBrowser::setObjectName方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextBrowser::setObjectName方法的具体用法?C++ QTextBrowser::setObjectName怎么用?C++ QTextBrowser::setObjectName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTextBrowser
的用法示例。
在下文中一共展示了QTextBrowser::setObjectName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QDialog
TextDialog::TextDialog(QString t1, QWidget *parent, QString name):
QDialog(parent)
{
setObjectName(name);
setModal(true);
setWindowTitle( tr("Output") );
QTextBrowser *te = new QTextBrowser(this);
te->setObjectName("good label");
te->setText(t1);
te->setGeometry(10,10,230,200);
QPushButton *ok;
ok = new QPushButton(tr("OK"), this);
ok->setGeometry(85,250,80,30);
ok->setPalette(QPalette(Qt::lightGray));
connect(ok, SIGNAL(clicked()), SLOT(accept()) );
}
示例2: initHistory
void MainWindow::initHistory(int snapType)
{
QString title = dockCtrlNames[snapType];
QDockWidget *dockWidget = new QDockWidget(this);
dockWidget->setObjectName("dockWidget_" + title);
dockWidget->setFeatures(QDockWidget::DockWidgetClosable|QDockWidget::DockWidgetMovable|QDockWidget::NoDockWidgetFeatures);
QWidget *dockWidgetContents = new QWidget(dockWidget);
dockWidgetContents->setObjectName("dockWidgetContents_" + title);
QGridLayout *gridLayout = new QGridLayout(dockWidgetContents);
gridLayout->setObjectName("gridLayout_" + title);
gridLayout->setContentsMargins(0, 0, 0, 0);
QTextBrowser * tb;
if (snapType == DOCK_HISTORY)
{
tb = tbHistory = new QTextBrowser(dockWidgetContents);
tbHistory->setOpenExternalLinks(true);
}
else if (snapType == DOCK_MAMEINFO)
tb = tbMameinfo = new QTextBrowser(dockWidgetContents);
else if (snapType == DOCK_DRIVERINFO)
tb = tbDriverinfo = new QTextBrowser(dockWidgetContents);
else if (snapType == DOCK_STORY)
tb = tbStory = new QTextBrowser(dockWidgetContents);
else
tb = tbCommand = new QTextBrowser(dockWidgetContents);
tb->setObjectName("textBrowser_" + title);
tb->setFrameShape(QFrame::NoFrame);
gridLayout->addWidget(tb);
dockWidget->setWidget(dockWidgetContents);
dockWidget->setWindowTitle(tr(qPrintable(title)));
addDockWidget(static_cast<Qt::DockWidgetArea>(Qt::RightDockWidgetArea), dockWidget);
// create tabbed history widgets
if (dwHistory)
tabifyDockWidget(dwHistory, dockWidget);
else
dwHistory = dockWidget;
menuDocuments->addAction(dockWidget->toggleViewAction());
dockCtrls[snapType] = dockWidget;
}
示例3: initTabNews
/*
* This is the TextBrowser News tab, which shows the latest news from Distro news feed
*/
void MainWindow::initTabNews()
{
QString aux(StrConstants::getTabNewsName());
QWidget *tabNews = new QWidget();
QGridLayout *gridLayoutX = new QGridLayout(tabNews);
gridLayoutX->setSpacing(0);
gridLayoutX->setMargin(0);
QTextBrowser *text = new QTextBrowser(tabNews);
text->setObjectName("textBrowser");
text->setReadOnly(true);
text->setFrameShape(QFrame::NoFrame);
text->setFrameShadow(QFrame::Plain);
text->setOpenExternalLinks(true);
gridLayoutX->addWidget(text, 0, 0, 1, 1);
text->show();
#if QT_VERSION > 0x050000
int tindex = ui->twProperties->insertTab(ctn_TABINDEX_NEWS, tabNews, QApplication::translate (
"MainWindow", aux.toUtf8(), 0/*, QApplication::UnicodeUTF8*/ ) );
ui->twProperties->setTabText(ui->twProperties->indexOf(tabNews), QApplication::translate(
"MainWindow", aux.toUtf8(), 0/*, QApplication::UnicodeUTF8*/));
#else
int tindex = ui->twProperties->insertTab(ctn_TABINDEX_NEWS, tabNews, QApplication::translate (
"MainWindow", aux.toUtf8(), 0, QApplication::UnicodeUTF8 ) );
ui->twProperties->setTabText(ui->twProperties->indexOf(tabNews), QApplication::translate(
"MainWindow", aux.toUtf8(), 0, QApplication::UnicodeUTF8));
#endif
SearchBar *searchBar = new SearchBar(this);
connect(searchBar, SIGNAL(textChanged(QString)), this, SLOT(searchBarTextChangedInTextBrowser(QString)));
connect(searchBar, SIGNAL(closed()), this, SLOT(searchBarClosedInTextBrowser()));
connect(searchBar, SIGNAL(findNext()), this, SLOT(searchBarFindNextInTextBrowser()));
connect(searchBar, SIGNAL(findPrevious()), this, SLOT(searchBarFindPreviousInTextBrowser()));
gridLayoutX->addWidget(searchBar, 1, 0, 1, 1);
connect(text, SIGNAL(sourceChanged(QUrl)), this, SLOT(onTabNewsSourceChanged(QUrl)));
text->show();
ui->twProperties->setCurrentIndex(tindex);
text->setFocus();
}
示例4: QToolButton
void MainWindow2::init_gui()
{
// create own menus
menus["&File"]->addAction( actionFileNew );
menus["&File"]->addSeparator();
menus["&File"]->addAction( actionQuit );
menus["&Edit"];
menus["&Navigation"];
menus["&Search"];
menus["&Configuration"];
menus["&Help"]->addAction( actionQtTopics );
menus["&Help"]->addAction( actionAbout );
// toolbars
toolbars["File"]->addAction( actionFileNew );
toolbars["File"]->addAction( actionQtTopics );
// show the stuff on screen
updateGUI( this );
// make the tab widget
tabWidget = new qmdiTabWidget;
tabNewBtn = new QToolButton(tabWidget);
tabNewBtn->setAutoRaise( true );
connect( tabNewBtn, SIGNAL(clicked()), this, SLOT(fileNew()));
tabNewBtn->setIcon(QIcon(":images/addtab.png"));
tabCloseBtn = new QToolButton(tabWidget);
tabCloseBtn->setAutoRaise( true );
connect( tabCloseBtn, SIGNAL(clicked()), this, SLOT(fileClose()));
tabCloseBtn->setIcon(QIcon(":images/closetab.png"));
tabWidget->setCornerWidget( tabNewBtn, Qt::TopLeftCorner );
tabWidget->setCornerWidget( tabCloseBtn, Qt::TopRightCorner );
setCentralWidget( tabWidget );
// feed it with a default widget, this browser is a
// non mdi client, and will add no new menus nor toolbars
QTextBrowser *browser = new QTextBrowser;
browser->setObjectName("welcome_tab");
browser->setSource( QUrl(":mdi-tab.html") );
tabWidget->addTab( browser, "Welcome" );
}
示例5: initTabHelpUsage
/*
* Initialize the Help tab with basic information about using OctoPkg
*/
void MainWindow::initTabHelpUsage()
{
QWidget *tabHelpUsage = new QWidget();
QGridLayout *gridLayoutX = new QGridLayout(tabHelpUsage);
gridLayoutX->setSpacing(0);
gridLayoutX->setMargin(0);
QTextBrowser *text = new QTextBrowser(tabHelpUsage);
text->setObjectName("textBrowser");
text->setReadOnly(true);
text->setFrameShape(QFrame::NoFrame);
text->setFrameShadow(QFrame::Plain);
text->setOpenExternalLinks(true);
gridLayoutX->addWidget(text, 0, 0, 1, 1);
QString iconPath = "<img height=\"16\" width=\"16\" src=\":/resources/images/";
QString strForMoreInfo = tr("For more information, visit:");
QString html =
QString("<h2>OctoPkg</h2>") +
QString("<h3><p>") + tr("A Qt5-based pkgng front-end,") + " " +
tr("licensed under the terms of") + " ";
if ((!WMHelper::isKDERunning() && (!WMHelper::isRazorQtRunning())))
{
html +=
QString("<a style=\"color:'#4BC413'\" href=\"http://www.gnu.org/licenses/gpl-2.0.html\">GPL v2</a>.</p></h3>") +
QString("<h4><p>") + strForMoreInfo + " " +
QString("<a style=\"color:'#4BC413'\" href=\"http://octopkg.wordpress.com\">http://octopkg.wordpress.com</a>.</p></h4><br>");
}
else
{
html +=
QString("<a href=\"http://www.gnu.org/licenses/gpl-2.0.html\">GPL v2</a>.</p></h3>") +
QString("<h4><p>") + strForMoreInfo + " " +
QString("<a href=\"http://octopkg.wordpress.com\">http://octopkg.wordpress.com</a>.</p></h4><br>");
}
html += tr("Package classification:") +
QString("<ul type=\"square\"><li>") + iconPath + "installed.png\"/> " +
tr("An installed package") + QString("</li>") +
QString("<li>") + iconPath + "unrequired.png\"/> " +
tr("An installed package (not required by others)") +
QString("</li>") +
QString("</li>") +
QString("<li>") + iconPath + "noninstalled.png\"/> " +
tr("A non installed package") +
QString("</li>") +
QString("<li>") + iconPath + "outdated.png\"/> " +
tr("An outdated package") +
QString("</li>") +
QString("</li></ul>") +
/*QString("<li>") + iconPath + "newer.png\"/> " +
tr("A newer than repository package") +
QString("</li></ul>") +*/
tr("Basic usage help:") +
QString("<ul><li>") +
tr("Position the mouse over a package to see its description") +
QString("</li><li>") +
tr("Double click an installed package to see its contents") +
QString("</li><li>") +
tr("Right click package to install/reinstall or remove it") +
QString("</li></ul>") +
tr("Alt+key sequences:") +
QString("<ul><li>") +
tr("Alt+1 to switch to 'Info' tab") +
QString("</li><li>") +
tr("Alt+2 to switch to 'Files' tab") +
QString("</li><li>") +
tr("Alt+3 to switch to 'Transaction' tab") +
QString("</li><li>") +
tr("Alt+4 to switch to 'Output' tab") +
QString("</li><li>") +
tr("Alt+5 to switch to 'News' tab") +
QString("</li><li>") +
tr("Alt+6 or 'F1' to show this help page") +
QString("</li><li>") +
tr("Alt+\"Left key\" to go to previous clicked anchor") +
QString("</li><li>") +
tr("Alt+\"Right key\" to go to next clicked anchor") +
QString("</li><li>") +
tr("Alt+\"Home key\" to go to first clicked anchor") +
QString("</li><li>") +
tr("Alt+\"End key\" to go to last clicked anchor") +
QString("</li></ul>") +
tr("Control+key sequences:") +
QString("<ul><li>") +
tr("Ctrl+D or 'File/Sync database' to sync the local database with latest remote changes") +
QString("</li><li>") +
tr("Ctrl+U or 'File/System upgrade' to make a full system upgrade") +
QString("</li><li>") +
tr("Ctrl+L to find a package in the package list") +
QString("</li><li>") +
tr("Ctrl+F to search for text inside tab Files, News and Usage") +
//.........这里部分代码省略.........
示例6: setupUi
void setupUi(QMainWindow *Detection)
{
if (Detection->objectName().isEmpty())
Detection->setObjectName(QString::fromUtf8("Detection"));
Detection->resize(729, 480);
actionE_xit = new QAction(Detection);
actionE_xit->setObjectName(QString::fromUtf8("actionE_xit"));
action_Load_Map = new QAction(Detection);
action_Load_Map->setObjectName(QString::fromUtf8("action_Load_Map"));
action_Connect = new QAction(Detection);
action_Connect->setObjectName(QString::fromUtf8("action_Connect"));
action_Disconnect = new QAction(Detection);
action_Disconnect->setObjectName(QString::fromUtf8("action_Disconnect"));
centralWidget = new QWidget(Detection);
centralWidget->setObjectName(QString::fromUtf8("centralWidget"));
gridLayoutWidget = new QWidget(centralWidget);
gridLayoutWidget->setObjectName(QString::fromUtf8("gridLayoutWidget"));
gridLayoutWidget->setGeometry(QRect(0, 0, 721, 421));
gridLayout = new QGridLayout(gridLayoutWidget);
gridLayout->setSpacing(6);
gridLayout->setContentsMargins(11, 11, 11, 11);
gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
gridLayout->setSizeConstraint(QLayout::SetNoConstraint);
gridLayout->setVerticalSpacing(5);
gridLayout->setContentsMargins(0, 0, 0, 0);
ugvFeedLabel = new QLabel(gridLayoutWidget);
ugvFeedLabel->setObjectName(QString::fromUtf8("ugvFeedLabel"));
QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
sizePolicy.setHeightForWidth(ugvFeedLabel->sizePolicy().hasHeightForWidth());
ugvFeedLabel->setSizePolicy(sizePolicy);
gridLayout->addWidget(ugvFeedLabel, 1, 2, 1, 1);
connectionButton = new QCommandLinkButton(gridLayoutWidget);
connectionButton->setObjectName(QString::fromUtf8("connectionButton"));
gridLayout->addWidget(connectionButton, 0, 2, 1, 1);
uavFeedLabel = new QLabel(gridLayoutWidget);
uavFeedLabel->setObjectName(QString::fromUtf8("uavFeedLabel"));
sizePolicy.setHeightForWidth(uavFeedLabel->sizePolicy().hasHeightForWidth());
uavFeedLabel->setSizePolicy(sizePolicy);
uavFeedLabel->setMaximumSize(QSize(16777215, 16777215));
gridLayout->addWidget(uavFeedLabel, 1, 0, 1, 1);
ugvMapLabel = new QLabel(gridLayoutWidget);
ugvMapLabel->setObjectName(QString::fromUtf8("ugvMapLabel"));
QSizePolicy sizePolicy1(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding);
sizePolicy1.setHorizontalStretch(0);
sizePolicy1.setVerticalStretch(0);
sizePolicy1.setHeightForWidth(ugvMapLabel->sizePolicy().hasHeightForWidth());
ugvMapLabel->setSizePolicy(sizePolicy1);
gridLayout->addWidget(ugvMapLabel, 1, 3, 1, 1);
horizontalLayout_4 = new QHBoxLayout();
horizontalLayout_4->setSpacing(6);
horizontalLayout_4->setObjectName(QString::fromUtf8("horizontalLayout_4"));
label_2 = new QLabel(gridLayoutWidget);
label_2->setObjectName(QString::fromUtf8("label_2"));
horizontalLayout_4->addWidget(label_2);
uavTakeoffLandButton = new QPushButton(gridLayoutWidget);
uavTakeoffLandButton->setObjectName(QString::fromUtf8("uavTakeoffLandButton"));
horizontalLayout_4->addWidget(uavTakeoffLandButton);
gridLayout->addLayout(horizontalLayout_4, 2, 0, 1, 1);
horizontalLayout_2 = new QHBoxLayout();
horizontalLayout_2->setSpacing(6);
horizontalLayout_2->setObjectName(QString::fromUtf8("horizontalLayout_2"));
label = new QLabel(gridLayoutWidget);
label->setObjectName(QString::fromUtf8("label"));
horizontalLayout_2->addWidget(label);
ugvSpeedLCD = new QLCDNumber(gridLayoutWidget);
ugvSpeedLCD->setObjectName(QString::fromUtf8("ugvSpeedLCD"));
ugvSpeedLCD->setFrameShape(QFrame::Box);
horizontalLayout_2->addWidget(ugvSpeedLCD);
gridLayout->addLayout(horizontalLayout_2, 4, 2, 1, 1);
horizontalLayout_6 = new QHBoxLayout();
horizontalLayout_6->setSpacing(6);
horizontalLayout_6->setObjectName(QString::fromUtf8("horizontalLayout_6"));
label_3 = new QLabel(gridLayoutWidget);
label_3->setObjectName(QString::fromUtf8("label_3"));
horizontalLayout_6->addWidget(label_3);
ugvSpeakerButton = new QPushButton(gridLayoutWidget);
//.........这里部分代码省略.........