本文整理汇总了C++中QLabel::setWordWrap方法的典型用法代码示例。如果您正苦于以下问题:C++ QLabel::setWordWrap方法的具体用法?C++ QLabel::setWordWrap怎么用?C++ QLabel::setWordWrap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLabel
的用法示例。
在下文中一共展示了QLabel::setWordWrap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QWidget
/**
* Second Panel - Shows the extra metadata in a tree, non editable.
**/
ExtraMetaPanel::ExtraMetaPanel( QWidget *parent ) : QWidget( parent )
{
QGridLayout *layout = new QGridLayout(this);
QLabel *topLabel = new QLabel( qtr( "Extra metadata and other information"
" are shown in this panel.\n" ) );
topLabel->setWordWrap( true );
layout->addWidget( topLabel, 0, 0 );
extraMetaTree = new QTreeWidget( this );
extraMetaTree->setAlternatingRowColors( true );
extraMetaTree->setColumnCount( 2 );
extraMetaTree->resizeColumnToContents( 0 );
extraMetaTree->setHeaderHidden( true );
layout->addWidget( extraMetaTree, 1, 0 );
}
示例2: createGui
void ChatGroupsConfigurationWidget::createGui()
{
auto layout = new QVBoxLayout{this};
QLabel *label =
new QLabel{tr("Add <b>%1</b> to the groups below by checking the box next to the appropriate groups.")
.arg(m_chat.display()),
this};
label->setWordWrap(true);
m_groupList = m_injectedFactory->makeInjected<GroupList>(this);
m_groupList->setCheckedGroups(m_chat.groups());
layout->addWidget(label);
layout->addWidget(m_groupList);
}
示例3: QWidget
EditNullView::EditNullView()
: QWidget()
{
QVBoxLayout * mainVLayout = new QVBoxLayout();
mainVLayout->setContentsMargins(5,5,5,5);
mainVLayout->setSpacing(5);
setLayout(mainVLayout);
QLabel * label = new QLabel();
label->setText("Select a Measure to Edit");
label->setWordWrap(true);
label->setAlignment(Qt::AlignCenter);
mainVLayout->addWidget(label);
label->setStyleSheet("QLabel { font-size: 24px; font: bold; color: #6D6D6D }");
}
示例4: setFileInfo
void FileInfoGroupBox::setFileInfo(QString fileInfoTitle, QList<fileInfoItem> fileInfoList)
{
// Set the title
setTitle(fileInfoTitle);
if (fileInfoList.count() == p_nrLabelPairs) {
// The correct number of label pairs is already in the groupBox.
// No need to delete all items and reattach them. Just update the text.
for (int i = 0; i < p_nrLabelPairs; i++)
{
assert(p_nrLabelPairs * 2 == p_labelList.count());
p_labelList[i * 2 ]->setText(fileInfoList[i].first);
p_labelList[i * 2 + 1]->setText(fileInfoList[i].second);
}
}
else {
// Update the grid layout. Delete all the labels and add as many new ones as necessary.
// Clear the grid layout
foreach(QLabel *l, p_labelList) {
p_gridLayout->removeWidget(l);
delete l;
}
p_labelList.clear();
// For each item in the list add a two labels to the grid layout
int i = 0;
foreach(fileInfoItem info, fileInfoList) {
// Create labels
QLabel *newTextLabel = new QLabel(info.first);
QLabel *newValueLabel = new QLabel(info.second);
newValueLabel->setWordWrap(true);
// Add to grid
p_gridLayout->addWidget(newTextLabel, i, 0);
p_gridLayout->addWidget(newValueLabel, i, 1);
// Set row stretch to 0
p_gridLayout->setRowStretch(i, 0);
i++;
// Add to list of labels
p_labelList.append(newTextLabel);
p_labelList.append(newValueLabel);
}
示例5: QWidget
CAbout::CAbout( QWidget *pwidgetParent, const char *pszName )
: QWidget( pwidgetParent, pszName )
{
QVBoxLayout * playoutTop;
QHBoxLayout * playoutHelp;
CAboutDiagram * pdiagram;
QFrame * pframeHelp;
QLabel * plabelIcon;
QLabel * plabelText;
QPushButton * ppushbuttonCredits;
playoutTop = new QVBoxLayout( this, 5 );
// DIAGRAM
pdiagram = new CAboutDiagram( this );
playoutTop->addWidget( pdiagram, 10 );
// HELP - FRAME
pframeHelp = new QFrame( this );
pframeHelp->setFrameStyle( QFrame::Box | QFrame::Raised );
playoutTop->addWidget( pframeHelp );
//
playoutHelp = new QHBoxLayout( pframeHelp, 5 );
plabelIcon = new QLabel( pframeHelp );
plabelIcon->setPixmap( xpmAbout );
plabelText = new QLabel( pframeHelp );
plabelText->setText( "Open DataBase Connectivity (ODBC) was developed to be an Open and portable standard for accessing data. unixODBC implements this standard for Linux/UNIX.\nhttp://www.unixodbc.org" );
#ifdef QT_V4LAYOUT
plabelText->setAlignment( Qt::AlignLeft | Qt::WordBreak );
plabelText->setWordWrap( true );
#else
plabelText->setAlignment( AlignLeft | WordBreak );
#endif
ppushbuttonCredits = new QPushButton( pframeHelp );
connect( ppushbuttonCredits, SIGNAL(clicked()), SLOT(pbCredits_Clicked()) );
ppushbuttonCredits->setText( "&Credits" );
playoutHelp->addWidget( plabelIcon );
playoutHelp->addWidget( plabelText, 10 );
playoutHelp->addWidget( ppushbuttonCredits );
}
示例6: QWizardPage
FirstRunWelcomePage::FirstRunWelcomePage(AntiMicroSettings *settings, QWidget *parent) :
QWizardPage(parent)
{
this->settings = settings;
setTitle(tr("Welcome"));
setLayout(new QVBoxLayout);
QLabel *tempLabel = new QLabel(
tr("Thank you for checking out antimicro. This "
"wizard can be used to customize some of the "
"program's behavior. More settings can be found "
"from the main interface under "
"Options > Settings."));
tempLabel->setWordWrap(true);
layout()->addWidget(tempLabel);
}
示例7: addDestBandPage
void ReplaceBandInputWizard::addDestBandPage()
{
QWizardPage* pPage = new QWizardPage(this);
pPage->setTitle("Select destination band");
QLabel* pPageLabel = new QLabel("Select the destination band.", pPage);
pPageLabel->setWordWrap(true);
mpDestBand = new QComboBox(pPage);
mpDestBand->setEditable(false);
mpDestBand->addItems(getBandNames(static_cast<const RasterDataDescriptor*>(mpDest->getDataDescriptor())));
QVBoxLayout* pLayout = new QVBoxLayout();
pLayout->addWidget(pPageLabel);
pLayout->addWidget(mpDestBand);
pPage->setLayout(pLayout);
addPage(pPage);
}
示例8: QCommDeviceController
BTSettingsMainWindow::BTSettingsMainWindow(QWidget *parent, Qt::WFlags fl)
: QMainWindow(parent, fl), m_localDevice(new QBluetoothLocalDevice(this)),
m_controller(0)
{
if (!m_localDevice->isValid()) {
QLabel *label = new QLabel(tr("(Bluetooth not available.)"));
label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
label->setWordWrap(true);
label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
setCentralWidget(label);
return;
}
QScrollArea* scroll = new QScrollArea();
scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
scroll->setWidgetResizable(true);
scroll->setFrameStyle(QFrame::NoFrame);
m_menu = QSoftMenuBar::menuFor(this);
m_tabs = new QTabWidget();
m_controller =
new QCommDeviceController(m_localDevice->deviceName().toLatin1(), this);
SettingsDisplay *settings = new SettingsDisplay(m_localDevice, m_controller);
scroll->setWidget(settings);
scroll->setFocusProxy(settings);
m_tabs->addTab(scroll, tr("Settings"));
// Delay initialization of tabs other than the first
m_tabs->addTab(new QWidget, tr("Paired Devices"));
m_tabs->setTabEnabled(1, false);
m_tabs->setCurrentIndex(0);
// change the context menu when the tab changes
connect(m_tabs, SIGNAL(currentChanged(int)), SLOT(tabChanged(int)));
// set the current context menu
tabChanged(m_tabs->currentIndex());
setCentralWidget(m_tabs);
setWindowTitle(tr("Bluetooth"));
QTimer::singleShot(0, this, SLOT(init()));
}
示例9: QLabel
void K3PasswordDialog::addLine(const QString &key, const QString &value)
{
if (m_Row > 3)
return;
QLabel *lbl = new QLabel(key, m_pMain);
lbl->setAlignment(Qt::AlignLeft|Qt::AlignTop);
lbl->setFixedSize(lbl->sizeHint());
m_pGrid->addWidget(lbl, m_Row+2, 0, Qt::AlignLeft);
lbl = new QLabel(value, m_pMain);
lbl->setAlignment(Qt::AlignTop);
lbl->setWordWrap(true);
lbl->setFixedSize(275, lbl->heightForWidth(275));
m_pGrid->addWidget(lbl, m_Row+2, 2, Qt::AlignLeft);
++m_Row;
}
示例10: QWizardPage
QWizardPage * MobileConnectionWizard::createIntroPage()
{
QWizardPage *page = new QWizardPage();
page->setTitle(i18nc("Mobile Connection Wizard", "Set up a Mobile Broadband Connection"));
QVBoxLayout *layout = new QVBoxLayout;
QLabel *label = new QLabel(i18nc("Mobile Connection Wizard", "This assistant helps you easily set up a mobile broadband connection to a cellular (3G) network."));
label->setWordWrap(true);
layout->addWidget(label);
label = new QLabel("\n" + i18nc("Mobile Connection Wizard", "You will need the following information:"));
layout->addWidget(label);
label = new QLabel(QString(" . %1\n . %2\n . %3").
arg(i18nc("Mobile Connection Wizard", "Your broadband provider's name")).
arg(i18nc("Mobile Connection Wizard", "Your broadband billing plan name")).
arg(i18nc("Mobile Connection Wizard", "(in some cases) Your broadband billing plan APN (Access Point Name)")));
layout->addWidget(label);
if (!mInitialMethodType) {
label = new QLabel("\n" + i18nc("Mobile Connection Wizard", "Create a connection for &this mobile broadband device:"));
layout->addWidget(label);
mDeviceComboBox = new QComboBox();
mDeviceComboBox->addItem(i18nc("Mobile Connection Wizard", "Any GSM device"));
mDeviceComboBox->setItemData(0, Knm::Connection::Gsm);
mDeviceComboBox->addItem(i18nc("Mobile Connection Wizard", "Any CDMA device"));
mDeviceComboBox->setItemData(1, Knm::Connection::Cdma);
mDeviceComboBox->insertSeparator(NUMBER_OF_STATIC_ENTRIES-1);
label->setBuddy(mDeviceComboBox);
layout->addWidget(mDeviceComboBox);
QObject::connect(Solid::Control::NetworkManagerNm09::notifier(), SIGNAL(networkInterfaceAdded(QString)),
this, SLOT(introDeviceAdded(QString)));
QObject::connect(Solid::Control::NetworkManagerNm09::notifier(), SIGNAL(networkInterfaceRemoved(QString)),
this, SLOT(introDeviceRemoved(QString)));
QObject::connect(Solid::Control::NetworkManagerNm09::notifier(), SIGNAL(statusChanged(Solid::Networking::Status)),
this, SLOT(introStatusChanged(Solid::Networking::Status)));
introAddInitialDevices();
}
page->setLayout(layout);
return page;
}
示例11: QDialog
DlgErrorReport::DlgErrorReport(const QString &xmlWithoutDocument,
const QString &xmlWithDocument,
QWidget *parent) :
QDialog (parent),
m_xmlWithoutDocument (xmlWithoutDocument),
m_xmlWithDocument (xmlWithDocument)
{
QVBoxLayout *layout = new QVBoxLayout;
layout->setSizeConstraint (QLayout::SetFixedSize);
setLayout (layout);
QCommonStyle style;
setModal(true);
setWindowTitle (tr ("Error Report"));
setWindowIcon(style.standardIcon (QStyle::SP_MessageBoxCritical));
QLabel *lblPreview = new QLabel (tr ("An unrecoverable error has occurred. Would you like to send an error report to "
"the Engauge developers?\n\n"
"Adding document information to the error report greatly increases the chances of finding "
"and fixing the problems. However, document information should not be included if your document "
"contains any information that should remain private."));
lblPreview->setWordWrap(true);
layout->addWidget (lblPreview);
m_chkWithDocument = new QCheckBox ("Include document information");
m_chkWithDocument->setChecked (true);
updateFile ();
layout->addWidget (m_chkWithDocument);
connect (m_chkWithDocument, SIGNAL (stateChanged (int)), this, SLOT (slotDocumentCheckboxChanged (int)));
QHBoxLayout *layoutButtons = new QHBoxLayout;
QWidget *panelButtons = new QWidget;
panelButtons->setLayout (layoutButtons);
layout->addWidget (panelButtons);
m_btnSend = new QPushButton(tr ("Send"));
m_btnSend->setMaximumWidth (MAX_BTN_WIDTH);
layoutButtons->addWidget (m_btnSend);
connect (m_btnSend, SIGNAL (released ()), this, SLOT (slotSend()));
m_btnCancel = new QPushButton(tr ("Cancel"));
m_btnCancel->setMaximumWidth (MAX_BTN_WIDTH);
layoutButtons->addWidget (m_btnCancel);
connect (m_btnCancel, SIGNAL (released ()), this, SLOT (reject ()));
}
示例12: checkLineEndings
void KDocumentTextBuffer::checkLineEndings()
{
QString bufferContents = kDocument()->text();
if ( bufferContents.contains("\r\n") || bufferContents.contains("\r") ) {
KDialog* dlg = new KDialog(kDocument()->activeView());
dlg->setAttribute(Qt::WA_DeleteOnClose);
dlg->setButtons(KDialog::Ok | KDialog::Cancel);
dlg->button(KDialog::Ok)->setText(i18n("Continue"));
QLabel* l = new QLabel(i18n("The document you opened contains non-standard line endings. "
"Do you want to convert them to the standard \"\\n\" format?<br><br>"
"<i>Note: This change will be synchronized to the server.</i>"), dlg);
l->setWordWrap(true);
dlg->setMainWidget(l);
connect(dlg, SIGNAL(okClicked()), this, SLOT(replaceLineEndings()));
dlg->show();
}
}
示例13: addOptionalMessage
/** Add the optional message in a light yellow box to the layout
*
* @param mainLay :: layout
*/
void AlgorithmDialog::addOptionalMessage(QVBoxLayout *mainLay) {
QLabel *inputMessage = new QLabel(this);
inputMessage->setFrameStyle(QFrame::Panel | QFrame::Sunken);
QPalette pal = inputMessage->palette();
pal.setColor(inputMessage->backgroundRole(),
QColor(255, 255, 224)); // Light yellow
pal.setColor(inputMessage->foregroundRole(), Qt::black);
inputMessage->setPalette(pal);
inputMessage->setAutoFillBackground(true);
inputMessage->setWordWrap(true);
inputMessage->setAlignment(Qt::AlignJustify);
inputMessage->setMargin(3);
inputMessage->setText(getOptionalMessage());
QHBoxLayout *msgArea = new QHBoxLayout;
msgArea->addWidget(inputMessage);
mainLay->addLayout(msgArea, 0);
}
示例14: main
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QString text("Qt Concurrent is not yet supported on this platform");
QLabel *label = new QLabel(text);
label->setWordWrap(true);
#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5)
label->showMaximized();
#else
label->show();
#endif
qDebug() << text;
app.exec();
}
示例15: addParagraph
void AboutDialog::addParagraph(const QString &title, const QString &value)
{
QGroupBox *gb = new QGroupBox;
QGridLayout *grid = new QGridLayout;
grid->setColumnStretch(0, 1);
QLabel *lab;
grid->addWidget(lab = new QLabel(value), 0, 0, Qt::AlignLeft|Qt::AlignTop);
lab->setWordWrap(true);
gb->setTitle(title);
gb->setLayout(grid);
appendWidget(gb);
}