本文整理汇总了C++中QLabel::setTextInteractionFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ QLabel::setTextInteractionFlags方法的具体用法?C++ QLabel::setTextInteractionFlags怎么用?C++ QLabel::setTextInteractionFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLabel
的用法示例。
在下文中一共展示了QLabel::setTextInteractionFlags方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QVBoxLayout
AboutDialog::AboutDialog() {
setWindowTitle(tr("%1 - About").arg(PROGRAM_NAME));
setAttribute(Qt::WA_DeleteOnClose);
QVBoxLayout *vbox = new QVBoxLayout(this);
vbox->setSizeConstraint(QLayout::SetFixedSize);
QHBoxLayout *hbox = new QHBoxLayout;
vbox->addLayout(hbox);
QString str = tr(
"<p><font face='Arial' size='20'><b>%1</b></font></p>"
"<p>Copyright 2008-2009 by jlh (<a href='mailto:[email protected]'>[email protected]</a>)<br>"
"Copyright 2010-2011 by Peter Savichev (proton) (<a href='[email protected]'>[email protected]</a>)<br>"
"Version: %2<br>"
"Website: <a href='%3'>%3</a></p>");
str = str.arg(PROGRAM_NAME).arg(recorderVersion).arg(websiteURL);
QLabel *label = new QLabel(str);
label->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse);
label->setTextFormat(Qt::RichText);
label->setOpenExternalLinks(true);
hbox->addWidget(label, 1, Qt::AlignTop);
label = new QLabel;
label->setPixmap(QPixmap(":/res/tray-red.png"));
hbox->addWidget(label, 0, Qt::AlignTop);
str = tr(
"<hr>"
"<p>This program is free software; you can redistribute it and/or modify it under<br>"
"the terms of the GNU General Public License as published by the <a href='http://www.fsf.org/'>Free<br>"
"Software Foundation</a>; either <a href='http://www.gnu.org/licenses/old-licenses/gpl-2.0.html'>version 2 of the License</a>, "
"<a href='http://www.gnu.org/licenses/gpl.html'>version 3 of the<br>"
"License</a>, or (at your option) any later version.</p>"
"<p>This program is distributed in the hope that it will be useful, but WITHOUT<br>"
"ANY WARRANTY; without even the implied warranty of MERCHANTABILITY<br>"
"or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public<br>"
"License for more details.</p>"
"<hr>"
"<p>This product uses the Skype API but is not endorsed, certified or otherwise<br>"
"approved in any way by Skype.</p>"
"<hr>"
"<p><small>Git commit: %1<br>"
"Build date: %2</small></p>");
str = str.arg(recorderCommit, recorderDate);
label = new QLabel(str);
label->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse);
label->setTextFormat(Qt::RichText);
label->setOpenExternalLinks(true);
vbox->addWidget(label);
QPushButton *button = new QPushButton(tr("&Close"));
connect(button, SIGNAL(clicked()), this, SLOT(close()));
vbox->addWidget(button);
show();
}
示例2: PopupWidget
ScriptTerminatorWidget::ScriptTerminatorWidget( const QString &message )
: PopupWidget( 0 )
{
setFrameStyle( QFrame::StyledPanel | QFrame::Raised );
setContentsMargins( 4, 4, 4, 4 );
setMinimumWidth( 26 );
setMinimumHeight( 26 );
setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding );
QPalette p = QToolTip::palette();
setPalette( p );
QLabel *alabel = new QLabel( message, this );
alabel->setWordWrap( true );
alabel->setTextFormat( Qt::RichText );
alabel->setTextInteractionFlags( Qt::TextBrowserInteraction );
alabel->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred );
alabel->setPalette( p );
KPushButton *button = new KPushButton( i18n( "Terminate" ), this );
button->setPalette(p);;
connect( button, SIGNAL(clicked()), SIGNAL(terminate()) );
button = new KPushButton( KStandardGuiItem::close(), this );
button->setPalette(p);
connect( button, SIGNAL(clicked()), SLOT(hide()) );
reposition();
}
示例3: QDialog
AboutDialog::AboutDialog(QWidget *parent)
: QDialog(parent)
{
setWindowIcon(GuiRegistry::instance().mainWindowIcon());
setWindowTitle("About "PROJECT_NAME_TITLE);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QGridLayout *layout = new QGridLayout(this);
layout->setSizeConstraint(QLayout::SetFixedSize);
QLabel *copyRightLabel = new QLabel(description);
copyRightLabel->setWordWrap(true);
copyRightLabel->setOpenExternalLinks(true);
copyRightLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
QPushButton *closeButton = buttonBox->button(QDialogButtonBox::Close);
buttonBox->addButton(closeButton, QDialogButtonBox::ButtonRole(QDialogButtonBox::RejectRole | QDialogButtonBox::AcceptRole));
connect(buttonBox , SIGNAL(rejected()), this, SLOT(reject()));
QIcon icon = GuiRegistry::instance().mainWindowIcon();
QPixmap iconPixmap = icon.pixmap(48, 48);
QLabel *logoLabel = new QLabel;
logoLabel->setPixmap(iconPixmap);
layout->addWidget(logoLabel , 0, 0, 1, 1);
layout->addWidget(copyRightLabel, 0, 1, 4, 4);
layout->addWidget(buttonBox, 4, 0, 1, 5);
}
示例4: QDialog
StartRemoteCdbDialog::StartRemoteCdbDialog(QWidget *parent) :
QDialog(parent), m_okButton(0), m_lineEdit(new QLineEdit)
{
setWindowTitle(tr("Start a CDB Remote Session"));
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QGroupBox *groupBox = new QGroupBox;
QLabel *helpLabel = new QLabel(cdbRemoteHelp());
helpLabel->setWordWrap(true);
helpLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
QLabel *label = new QLabel(tr("&Connection:"));
label->setBuddy(m_lineEdit);
m_lineEdit->setMinimumWidth(400);
QDialogButtonBox *box = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
QFormLayout *formLayout = new QFormLayout;
formLayout->addRow(helpLabel);
formLayout->addRow(label, m_lineEdit);
groupBox->setLayout(formLayout);
QVBoxLayout *vLayout = new QVBoxLayout(this);
vLayout->addWidget(groupBox);
vLayout->addWidget(box);
m_okButton = box->button(QDialogButtonBox::Ok);
m_okButton->setEnabled(false);
connect(m_lineEdit, SIGNAL(textChanged(QString)), this, SLOT(textChanged(QString)));
connect(m_lineEdit, SIGNAL(returnPressed()), m_okButton, SLOT(animateClick()));
connect(box, SIGNAL(accepted()), this, SLOT(accept()));
connect(box, SIGNAL(rejected()), this, SLOT(reject()));
}
示例5: createHyperlinkLabel
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
QLabel* IssuesDockWidget::createHyperlinkLabel(PipelineMessage msg)
{
QString filterClassName = (msg.getFilterClassName() );
QString filterHumanLabel = (msg.getFilterHumanLabel() );
QString msgPrefix = (msg.getPrefix());
if ( filterClassName.isEmpty() || filterHumanLabel.isEmpty() )
{
if(filterClassName.isEmpty() == false) { return new QLabel(filterClassName); }
else if(filterHumanLabel.isEmpty() == false) { return new QLabel(filterHumanLabel); }
return new QLabel("Unknown Filter Class");
}
QUrl filterURL = DREAM3DHelpUrlGenerator::generateHTMLUrl( filterClassName.toLower() );
QString filterHTMLText("<a href=\"");
filterHTMLText.append(filterURL.toString()).append("\">").append(filterHumanLabel).append("</a>");
QLabel* hyperlinkLabel = new QLabel(filterHTMLText);
hyperlinkLabel->setTextFormat(Qt::RichText);
hyperlinkLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
hyperlinkLabel->setOpenExternalLinks(false);
connect(hyperlinkLabel, SIGNAL(linkActivated(const QString&)), this, SLOT(showFilterHelp(const QString&)));
return hyperlinkLabel;
}
示例6: QWidget
AddressRowWidget::AddressRowWidget(QWidget *parent, const QString &headerName,
const QList<Imap::Message::MailAddress> &addresses, MessageView *messageView):
QWidget(parent)
{
FlowLayout *lay = new FlowLayout(this, 0, 0, -1);
setLayout(lay);
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
const QString &headerNameEscaped = Qt::escape(headerName);
#else
const QString &headerNameEscaped = headerName.toHtmlEscaped();
#endif
QLabel *title = new QLabel(QString::fromUtf8("<b>%1:</b>").arg(headerNameEscaped), this);
title->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
title->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse);
lay->addWidget(title);
for (int i = 0; i < addresses.size(); ++i) {
QWidget *w = new OneEnvelopeAddress(this, addresses[i], messageView,
i == addresses.size() - 1 ?
OneEnvelopeAddress::Position::Last :
OneEnvelopeAddress::Position::Middle);
lay->addWidget(w);
}
}
示例7: applyQListToLayout
void QVListLayout::applyQListToLayout(const QStringList &list)
{
bool toggle = true;
QLabel *bLabel;
QFont labelFont;
labelFont.setBold(true);
foreach(const QString &item, list)
{
if(!item.isEmpty())
{
bLabel = new QLabel(item);
bLabel->setWordWrap(true);
if(bLabel->text() != QLatin1String("--"))
{
if(toggle)
{
toggle = false;
bLabel->setFont(labelFont);
} else {
bLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
bLabel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
bLabel->setAlignment(Qt::AlignTop);
toggle = true;
}
} else {
bLabel->setText(QLatin1String(""));
}
addWidget(bLabel);
}
}
}
示例8: addToolboxItem
void MainWindow::addToolboxItem(string title, string text)
{
QLabel *label = new QLabel(QString::fromStdString(text),this);
label->setTextInteractionFlags(Qt::TextSelectableByMouse);
ui->toolBox->addItem(label,QString::fromStdString(title));
}
示例9: createLabels
void InfoPane::createLabels(const QString& title, const QString& value, const int num_cols, int& x, int& y)
{
QLabel* labelTitle = new QLabel(title, this);
labelTitle->setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
labelTitle->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter);
QPalette palette = labelTitle->palette();
QColor f = palette.color(QPalette::Foreground);
f.setAlpha(128);
palette.setColor(QPalette::Foreground, f);
labelTitle->setPalette(palette);
gridLayout().addWidget(labelTitle, y, x, 1, 1);
QLabel* labelValue = new QLabel(value, this);
labelValue->setTextInteractionFlags(Qt::TextBrowserInteraction);
labelValue->setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
gridLayout().addWidget(labelValue, y, x + 1, 1, 1);
x += 2;
if (x % num_cols == 0)
{
x = 0;
y++;
}
}
示例10: QDialog
VersionDialog::VersionDialog(QWidget *parent)
: QDialog(parent)
{
// We need to set the window icon explicitly here since for some reason the
// application icon isn't used when the size of the dialog is fixed (at least not on X11/GNOME)
setWindowIcon(QIcon(":/core/images/openpilot_logo_32.png"));
setWindowTitle(tr("About OpenPilot GCS"));
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QGridLayout *layout = new QGridLayout(this);
layout->setSizeConstraint(QLayout::SetFixedSize);
QString version = QLatin1String(GCS_VERSION_LONG);
version += QDate(2007, 25, 10).toString(Qt::SystemLocaleDate);
QString ideRev;
#ifdef GCS_REVISION
//: This gets conditionally inserted as argument %8 into the description string.
ideRev = tr("From revision %1<br/>").arg(QString::fromLatin1(GCS_REVISION_STR).left(10));
#endif
const QString description = tr(
"<h3>OpenPilot GCS %1</h3>"
"Based on Qt %2 (%3 bit)<br/>"
"<br/>"
"Built on %4 at %5<br />"
"<br/>"
"%8"
"<br/>"
"Copyright 2008-%6 %7. All rights reserved.<br/>"
"<br/>"
"<small>This program is free software; you can redistribute it and/or modify<br/>"
"it under the terms of the GNU General Public License as published by<br/>"
"the Free Software Foundation; either version 3 of the License, or<br/>"
"(at your option) any later version.<br/><br/>"
"The program is provided AS IS with NO WARRANTY OF ANY KIND, "
"INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A "
"PARTICULAR PURPOSE.</small><br/>")
.arg(version, QLatin1String(QT_VERSION_STR), QString::number(QSysInfo::WordSize),
QLatin1String(__DATE__), QLatin1String(__TIME__), QLatin1String(GCS_YEAR),
(QLatin1String(GCS_AUTHOR)), ideRev);
QLabel *copyRightLabel = new QLabel(description);
copyRightLabel->setWordWrap(true);
copyRightLabel->setOpenExternalLinks(true);
copyRightLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
QPushButton *closeButton = buttonBox->button(QDialogButtonBox::Close);
QTC_ASSERT(closeButton, /**/);
buttonBox->addButton(closeButton, QDialogButtonBox::ButtonRole(QDialogButtonBox::RejectRole | QDialogButtonBox::AcceptRole));
connect(buttonBox , SIGNAL(rejected()), this, SLOT(reject()));
QLabel *logoLabel = new QLabel;
logoLabel->setPixmap(QPixmap(QLatin1String(":/core/images/openpilot_logo_128.png")));
layout->addWidget(logoLabel , 0, 0, 1, 1);
layout->addWidget(copyRightLabel, 0, 1, 4, 4);
layout->addWidget(buttonBox, 4, 0, 1, 5);
}
示例11: QLabel
QWidget *toResultItem::createTitle(QWidget *parent)
{
QLabel *widget = new QLabel(parent);
widget->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
widget->setWordWrap(true);
widget->setTextInteractionFlags(Qt::TextSelectableByMouse);
return widget;
}
示例12: SLOT
void
MessageBar::show( const QString& message, const QString& id )
{
QLabel* label = findChild<QLabel*>( id );
if (label && id.size()) {
if (message.isEmpty())
{
QProgressBar* p = label->findChild<QProgressBar*>();
if (p)
p->setRange( 0, 1 ),
p->setValue( 1 );
QTimer::singleShot( 3000, label, SLOT(deleteLater()) );
}
else
label->setText( message );
return;
}
label = new QLabel( message, ui.papyrus );
label->setBackgroundRole( QPalette::Base );
label->setMargin( 8 );
label->setIndent( 4 );
label->setTextFormat( Qt::RichText );
label->setOpenExternalLinks( true );
label->setTextInteractionFlags( Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse );
ImageButton* close = new ImageButton( ":/buckets/radio_clear_all_x.png" );
QHBoxLayout* h = new QHBoxLayout( label );
h->addStretch();
if (id.size())
{
label->setObjectName( id );
QProgressBar* p;
h->addWidget( p = new QProgressBar );
p->setRange( 0, 0 );
p->setFixedWidth( 90 );
}
h->addWidget( close );
h->setMargin( 4 );
label->setFixedWidth( width() );
label->adjustSize();
label->show();
ui.papyrus->move( 0, -label->height() );
doLayout();
connect( close, SIGNAL(clicked()), label, SLOT(deleteLater()) );
connect( label, SIGNAL(destroyed()), SLOT(onLabelDestroyed()), Qt::QueuedConnection );
m_timeline->setFrameRange( height(), ui.papyrus->height() );
m_timeline->start();
}
示例13: QDialog
AboutDialog::AboutDialog(QWidget *parent)
: QDialog(parent)
{
// We need to set the window icon explicitly here since for some reason the
// application icon isn't used when the size of the dialog is fixed (at least not on X11/GNOME)
//setWindowIcon(QIcon(QLatin1String(Constants::ICON_QTLOGO_128)));
setWindowTitle("About MMMLauncher");
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QGridLayout *layout = new QGridLayout(this);
layout->setSizeConstraint(QLayout::SetFixedSize);
QString ideRev;
#ifdef IDE_REVISION
//: This gets conditionally inserted as argument %8 into the description string.
ideRev = tr("From revision %1<br/>").arg(QString::fromLatin1(Constants::IDE_REVISION_STR).left(10));
#endif
const QString description = tr(
"<h3>MMMLauncher %1</h3>"
"%2<br/>"
"Built on %3 at %4<br />"
"<br/>"
"Crafted by: %5 (%6)<br/>"
"Thanks to: %7 (%8)<br/>"
"<br />"
"Support: <a href='irc://nyanch.at/#mmm'>irc://nyanch.at/#mmm</a><br />"
"<br />"
"The program is provided AS IS with NO WARRANTY OF ANY KIND, "
"INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A "
"PARTICULAR PURPOSE.<br/>")
.arg(
QApplication::applicationVersion(),
MMMLUtils::buildCompatibilityString(),
QLatin1String(__DATE__), QLatin1String(__TIME__),
QApplication::organizationName(), "<a href='"+ QApplication::organizationDomain() +"'>"+ QApplication::organizationDomain() +"</a>",
"Endres", "For the old MMMLauncher"
);
QLabel *copyRightLabel = new QLabel(description);
copyRightLabel->setWordWrap(true);
copyRightLabel->setOpenExternalLinks(true);
copyRightLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
QPushButton *closeButton = buttonBox->button(QDialogButtonBox::Close);
buttonBox->addButton(closeButton, QDialogButtonBox::ButtonRole(QDialogButtonBox::RejectRole | QDialogButtonBox::AcceptRole));
connect(buttonBox , SIGNAL(rejected()), this, SLOT(reject()));
QLabel *logoLabel = new QLabel;
logoLabel->setPixmap(QPixmap(QLatin1String(":/images/images/about.png")));
layout->addWidget(logoLabel , 0, 0, 1, 1);
layout->addWidget(copyRightLabel, 0, 1, 4, 4);
layout->addWidget(buttonBox, 4, 0, 1, 5);
}
示例14: QDialog
VersionDialog::VersionDialog(QWidget *parent)
: QDialog(parent)
{
// We need to set the window icon explicitly here since for some reason the
// application icon isn't used when the size of the dialog is fixed (at least not on X11/GNOME)
setWindowIcon(QIcon(QLatin1String(Constants::ICON_QTLOGO_128)));
setWindowTitle(tr("About Qt Creator"));
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
QGridLayout *layout = new QGridLayout(this);
layout->setSizeConstraint(QLayout::SetFixedSize);
QString ideRev;
#ifdef IDE_REVISION
//: This gets conditionally inserted as argument %8 into the description string.
ideRev = tr("From revision %1<br/>").arg(QString::fromLatin1(Constants::IDE_REVISION_STR).left(14));
#endif
const QString description = tr(
"<h3>%1</h3>"
"%2<br/>"
"<br/>"
"Built on %3 at %4<br />"
"<br/>"
"%5"
"<br/>"
"Copyright 2008-%6 %7. All rights reserved.<br/>"
"<br/>"
"The program is provided AS IS with NO WARRANTY OF ANY KIND, "
"INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A "
"PARTICULAR PURPOSE.<br/>")
.arg(ICore::versionString(),
ICore::buildCompatibilityString(),
QLatin1String(__DATE__), QLatin1String(__TIME__),
ideRev,
QLatin1String(Constants::IDE_YEAR),
QLatin1String(Constants::IDE_AUTHOR));
QLabel *copyRightLabel = new QLabel(description);
copyRightLabel->setWordWrap(true);
copyRightLabel->setOpenExternalLinks(true);
copyRightLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
QPushButton *closeButton = buttonBox->button(QDialogButtonBox::Close);
QTC_CHECK(closeButton);
buttonBox->addButton(closeButton, QDialogButtonBox::ButtonRole(QDialogButtonBox::RejectRole | QDialogButtonBox::AcceptRole));
connect(buttonBox , SIGNAL(rejected()), this, SLOT(reject()));
QLabel *logoLabel = new QLabel;
logoLabel->setPixmap(QPixmap(QLatin1String(Constants::ICON_QTLOGO_128)));
layout->addWidget(logoLabel , 0, 0, 1, 1);
layout->addWidget(copyRightLabel, 0, 1, 4, 4);
layout->addWidget(buttonBox, 4, 0, 1, 5);
}
示例15: QLabel
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
Q_UNUSED(option);
QLabel *label = new QLabel(parent);
label->setAutoFillBackground(true);
label->setTextInteractionFlags(Qt::TextSelectableByMouse
| Qt::LinksAccessibleByMouse);
label->setText(index.data().toString());
return label;
}